2 Copyright (C) 2004-2008 Grame
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation; either version 2.1 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #include "JackMachServerNotifyChannel.h"
21 #include "JackRPCEngineUser.c"
22 #include "JackNotification.h"
23 #include "JackTools.h"
24 #include "JackConstants.h"
25 #include "JackError.h"
31 int JackMachServerNotifyChannel::Open(const char* server_name
)
33 jack_log("JackMachServerChannel::Open");
34 char jack_server_entry_name
[512];
35 snprintf(jack_server_entry_name
, sizeof(jack_server_entry_name
), "%s.%d_%s", jack_server_entry
, JackTools::GetUID(), server_name
);
37 if (!fClientPort
.ConnectPort(jack_server_entry_name
)) {
38 jack_error("Cannot connect to server port");
45 void JackMachServerNotifyChannel::Close()
48 void JackMachServerNotifyChannel::Notify(int refnum
, int notify
, int value
)
50 kern_return_t res
= rpc_jack_client_rt_notify(fClientPort
.GetPort(), refnum
, notify
, value
, 0);
51 if (res
!= KERN_SUCCESS
) {
52 jack_error("Could not write request ref = %d notify = %d err = %s", refnum
, notify
, mach_error_string(res
));
56 void JackMachServerNotifyChannel::NotifyQuit()
58 #ifdef MAC_OS_X_VERSION_10_5
59 // Nothing : since exception does not work in this case on pre Snow Loopard systems, see JackMachServerChannel::Close()
61 kern_return_t res
= rpc_jack_client_rt_notify(fClientPort
.GetPort(), -1, kQUIT
, 0, 0);
62 if (res
!= KERN_SUCCESS
) {
63 jack_error("Could not write request ref = %d notify = %d err = %s", -1, kQUIT
, mach_error_string(res
));