patchbay interface

This commit is contained in:
Nedko Arnaudov 2009-08-20 23:50:24 +03:00
parent b911e15a92
commit b0a9409cbf
6 changed files with 242 additions and 7 deletions

View File

@ -151,7 +151,7 @@ static bool connect_dbus(void)
goto unref_connection;
}
g_control_object = object_path_new(CONTROL_OBJECT_PATH, NULL, 1, &g_lashd_interface_control, NULL);
g_control_object = object_path_new(CONTROL_OBJECT_PATH, NULL, 1, &g_lashd_interface_control);
if (g_control_object == NULL)
{
goto unref_connection;

191
daemon/patchbay.c Normal file
View File

@ -0,0 +1,191 @@
/* -*- Mode: C ; c-basic-offset: 2 -*- */
/*
* LADI Session Handler (ladish)
*
* Copyright (C) 2009 Nedko Arnaudov <nedko@arnaudov.name>
*
**************************************************************************
* This file contains implementation of the D-Bus patchbay interface helpers
**************************************************************************
*
* LADI Session Handler is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* LADI Session Handler is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LADI Session Handler. If not, see <http://www.gnu.org/licenses/>
* or write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "common.h"
#include "patchbay.h"
static void get_all_ports(method_call_t * call_ptr)
{
}
static void get_graph(method_call_t * call_ptr)
{
}
static void connect_ports_by_name(method_call_t * call_ptr)
{
}
static void connect_ports_by_id(method_call_t * call_ptr)
{
}
static void disconnect_ports_by_name(method_call_t * call_ptr)
{
}
static void disconnect_ports_by_id(method_call_t * call_ptr)
{
}
static void disconnect_ports_by_connection_id(method_call_t * call_ptr)
{
}
static void get_client_pid(method_call_t * call_ptr)
{
}
METHOD_ARGS_BEGIN(GetAllPorts, "Get all ports")
METHOD_ARG_DESCRIBE_IN("ports_list", "as", "List of all ports")
METHOD_ARGS_END
METHOD_ARGS_BEGIN(GetGraph, "Get whole graph")
METHOD_ARG_DESCRIBE_IN("known_graph_version", DBUS_TYPE_UINT64_AS_STRING, "Known graph version")
METHOD_ARG_DESCRIBE_OUT("current_graph_version", DBUS_TYPE_UINT64_AS_STRING, "Current graph version")
METHOD_ARG_DESCRIBE_OUT("clients_and_ports", "a(tsa(tsuu))", "Clients and their ports")
METHOD_ARG_DESCRIBE_OUT("connections", "a(tstststst)", "Connections array")
METHOD_ARGS_END
METHOD_ARGS_BEGIN(ConnectPortsByName, "Connect ports")
METHOD_ARG_DESCRIBE_IN("client1_name", DBUS_TYPE_STRING_AS_STRING, "name first port client")
METHOD_ARG_DESCRIBE_IN("port1_name", DBUS_TYPE_STRING_AS_STRING, "name of first port")
METHOD_ARG_DESCRIBE_IN("client2_name", DBUS_TYPE_STRING_AS_STRING, "name second port client")
METHOD_ARG_DESCRIBE_IN("port2_name", DBUS_TYPE_STRING_AS_STRING, "name of second port")
METHOD_ARGS_END
METHOD_ARGS_BEGIN(ConnectPortsByID, "Connect ports")
METHOD_ARG_DESCRIBE_IN("port1_id", DBUS_TYPE_UINT64_AS_STRING, "id of first port")
METHOD_ARG_DESCRIBE_IN("port2_id", DBUS_TYPE_UINT64_AS_STRING, "if of second port")
METHOD_ARGS_END
METHOD_ARGS_BEGIN(DisconnectPortsByName, "Disconnect ports")
METHOD_ARG_DESCRIBE_IN("client1_name", DBUS_TYPE_STRING_AS_STRING, "name first port client")
METHOD_ARG_DESCRIBE_IN("port1_name", DBUS_TYPE_STRING_AS_STRING, "name of first port")
METHOD_ARG_DESCRIBE_IN("client2_name", DBUS_TYPE_STRING_AS_STRING, "name second port client")
METHOD_ARG_DESCRIBE_IN("port2_name", DBUS_TYPE_STRING_AS_STRING, "name of second port")
METHOD_ARGS_END
METHOD_ARGS_BEGIN(DisconnectPortsByID, "Disconnect ports")
METHOD_ARG_DESCRIBE_IN("port1_id", DBUS_TYPE_UINT64_AS_STRING, "id of first port")
METHOD_ARG_DESCRIBE_IN("port2_id", DBUS_TYPE_UINT64_AS_STRING, "if of second port")
METHOD_ARGS_END
METHOD_ARGS_BEGIN(DisconnectPortsByConnectionID, "Disconnect ports")
METHOD_ARG_DESCRIBE_IN("connection_id", DBUS_TYPE_UINT64_AS_STRING, "id of connection to disconnect")
METHOD_ARGS_END
METHOD_ARGS_BEGIN(GetClientPID, "get process id of client")
METHOD_ARG_DESCRIBE_IN("client_id", DBUS_TYPE_UINT64_AS_STRING, "id of client")
METHOD_ARG_DESCRIBE_OUT("process_id", DBUS_TYPE_INT64_AS_STRING, "pid of client")
METHOD_ARGS_END
METHODS_BEGIN
METHOD_DESCRIBE(GetAllPorts, get_all_ports)
METHOD_DESCRIBE(GetGraph, get_graph)
METHOD_DESCRIBE(ConnectPortsByName, connect_ports_by_name)
METHOD_DESCRIBE(ConnectPortsByID, connect_ports_by_id)
METHOD_DESCRIBE(DisconnectPortsByName, disconnect_ports_by_name)
METHOD_DESCRIBE(DisconnectPortsByID, disconnect_ports_by_id)
METHOD_DESCRIBE(DisconnectPortsByConnectionID, disconnect_ports_by_connection_id)
METHOD_DESCRIBE(GetClientPID, get_client_pid)
METHODS_END
SIGNAL_ARGS_BEGIN(GraphChanged, "")
SIGNAL_ARG_DESCRIBE("new_graph_version", DBUS_TYPE_UINT64_AS_STRING, "")
SIGNAL_ARGS_END
SIGNAL_ARGS_BEGIN(ClientAppeared, "")
SIGNAL_ARG_DESCRIBE("new_graph_version", DBUS_TYPE_UINT64_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("client_id", DBUS_TYPE_UINT64_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("client_name", DBUS_TYPE_STRING_AS_STRING, "")
SIGNAL_ARGS_END
SIGNAL_ARGS_BEGIN(ClientDisappeared, "")
SIGNAL_ARG_DESCRIBE("new_graph_version", DBUS_TYPE_UINT64_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("client_id", DBUS_TYPE_UINT64_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("client_name", DBUS_TYPE_STRING_AS_STRING, "")
SIGNAL_ARGS_END
SIGNAL_ARGS_BEGIN(PortAppeared, "")
SIGNAL_ARG_DESCRIBE("new_graph_version", DBUS_TYPE_UINT64_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("client_id", DBUS_TYPE_UINT64_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("client_name", DBUS_TYPE_STRING_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("port_id", DBUS_TYPE_UINT64_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("port_name", DBUS_TYPE_STRING_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("port_flags", DBUS_TYPE_UINT32_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("port_type", DBUS_TYPE_UINT32_AS_STRING, "")
SIGNAL_ARGS_END
SIGNAL_ARGS_BEGIN(PortDisappeared, "")
SIGNAL_ARG_DESCRIBE("new_graph_version", DBUS_TYPE_UINT64_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("client_id", DBUS_TYPE_UINT64_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("client_name", DBUS_TYPE_STRING_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("port_id", DBUS_TYPE_UINT64_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("port_name", DBUS_TYPE_STRING_AS_STRING, "")
SIGNAL_ARGS_END
SIGNAL_ARGS_BEGIN(PortsConnected, "")
SIGNAL_ARG_DESCRIBE("new_graph_version", DBUS_TYPE_UINT64_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("client1_id", DBUS_TYPE_UINT64_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("client1_name", DBUS_TYPE_STRING_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("port1_id", DBUS_TYPE_UINT64_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("port1_name", DBUS_TYPE_STRING_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("client2_id", DBUS_TYPE_UINT64_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("client2_name", DBUS_TYPE_STRING_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("port2_id", DBUS_TYPE_UINT64_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("port2_name", DBUS_TYPE_STRING_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("connection_id", DBUS_TYPE_UINT64_AS_STRING, "")
SIGNAL_ARGS_END
SIGNAL_ARGS_BEGIN(PortsDisconnected, "")
SIGNAL_ARG_DESCRIBE("new_graph_version", DBUS_TYPE_UINT64_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("client1_id", DBUS_TYPE_UINT64_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("client1_name", DBUS_TYPE_STRING_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("port1_id", DBUS_TYPE_UINT64_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("port1_name", DBUS_TYPE_STRING_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("client2_id", DBUS_TYPE_UINT64_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("client2_name", DBUS_TYPE_STRING_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("port2_id", DBUS_TYPE_UINT64_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("port2_name", DBUS_TYPE_STRING_AS_STRING, "")
SIGNAL_ARG_DESCRIBE("connection_id", DBUS_TYPE_UINT64_AS_STRING, "")
SIGNAL_ARGS_END
SIGNALS_BEGIN
SIGNAL_DESCRIBE(GraphChanged)
SIGNAL_DESCRIBE(ClientAppeared)
SIGNAL_DESCRIBE(ClientDisappeared)
SIGNAL_DESCRIBE(PortAppeared)
SIGNAL_DESCRIBE(PortDisappeared)
SIGNAL_DESCRIBE(PortsConnected)
SIGNAL_DESCRIBE(PortsDisconnected)
SIGNALS_END
INTERFACE_BEGIN(g_interface_patchbay, "org.jackaudio.JackPatchbay")
INTERFACE_EXPOSE_METHODS
INTERFACE_EXPOSE_SIGNALS
INTERFACE_END

37
daemon/patchbay.h Normal file
View File

@ -0,0 +1,37 @@
/* -*- Mode: C ; c-basic-offset: 2 -*- */
/*
* LADI Session Handler (ladish)
*
* Copyright (C) 2009 Nedko Arnaudov <nedko@arnaudov.name>
*
**************************************************************************
* This file contains interface to the D-Bus patchbay interface helpers
**************************************************************************
*
* LADI Session Handler is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* LADI Session Handler is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LADI Session Handler. If not, see <http://www.gnu.org/licenses/>
* or write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef PATCHBAY_H__30334B9A_8847_4E8C_AFF9_73DB13406C8E__INCLUDED
#define PATCHBAY_H__30334B9A_8847_4E8C_AFF9_73DB13406C8E__INCLUDED
struct patchbay_implementator
{
void * implementator_ptr;
};
extern const interface_t g_interface_patchbay;
#endif /* #ifndef PATCHBAY_H__30334B9A_8847_4E8C_AFF9_73DB13406C8E__INCLUDED */

View File

@ -26,6 +26,7 @@
#include "common.h"
#include "../jack_proxy.h"
#include "patchbay.h"
extern const interface_t g_interface_studio;
@ -49,6 +50,8 @@ struct studio
struct list_head jack_params; /* list of conf tree leaves */
object_path_t * dbus_object;
struct patchbay_implementator patchbay_implementator;
};
#define JACK_CONF_MAX_ADDRESS_SIZE 1024
@ -441,7 +444,7 @@ studio_activate(
{
object_path_t * object;
object = object_path_new(DBUS_BASE_PATH "/Studio", NULL, 1, &g_interface_studio, NULL);
object = object_path_new(DBUS_BASE_PATH "/Studio", studio, 2, &g_interface_studio, &g_interface_patchbay);
if (object == NULL)
{
lash_error("object_path_new() failed");

View File

@ -69,10 +69,13 @@ object_path_new(const char *name,
va_start(argp, num_ifaces);
iface_pptr = path->interfaces;
*iface_pptr = &g_dbus_interface_dtor_introspectable;
for (++iface_pptr;
(*iface_pptr = va_arg(argp, const interface_t *));
++iface_pptr);
*iface_pptr++ = &g_dbus_interface_dtor_introspectable;
while (num_ifaces > 0)
{
*iface_pptr++ = va_arg(argp, const interface_t *);
num_ifaces--;
}
*iface_pptr = NULL;
va_end(argp);

View File

@ -178,7 +178,8 @@ def build(bld):
'control.c',
'jack.c',
'studio.c',
'catdup.c'
'catdup.c',
'patchbay.c',
]:
daemon.source.append(os.path.join("daemon", source))