Merge branch 'master' into port_register_notification_defer
[jack2.git] / macosx / JackMachServerNotifyChannel.cpp
blob2e1c9abea563950312b884ec7aa3df7d61c50c48
1 /*
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 "JackTools.h"
23 #include "JackConstants.h"
24 #include "JackError.h"
25 #include <stdio.h>
27 namespace Jack
30 int JackMachServerNotifyChannel::Open(const char* server_name)
32 jack_log("JackMachServerChannel::Open");
33 char jack_server_entry_name[512];
34 snprintf(jack_server_entry_name, sizeof(jack_server_entry_name), "%s.%d_%s", jack_server_entry, JackTools::GetUID(), server_name);
36 if (!fClientPort.ConnectPort(jack_server_entry_name)) {
37 jack_error("Cannot connect to server port");
38 return -1;
39 } else {
40 return 0;
44 void JackMachServerNotifyChannel::Close()
46 //fClientPort.DisconnectPort(); pas nŽcessaire car le JackMachServerChannel a dŽja disparu?
49 void JackMachServerNotifyChannel::Notify(int refnum, int notify, int value)
51 kern_return_t res = rpc_jack_client_rt_notify(fClientPort.GetPort(), refnum, notify, value, 0);
52 if (res != KERN_SUCCESS) {
53 jack_error("Could not write request ref = %d notify = %d err = %s", refnum, notify, mach_error_string(res));
57 } // end of namespace