summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/common/interface/ClientKey.hpp86
-rw-r--r--src/common/interface/EngineInterface.hpp7
-rw-r--r--src/common/interface/Makefile.am1
-rw-r--r--src/common/interface/Responder.hpp13
-rw-r--r--src/libs/client/OSCEngineSender.cpp15
-rw-r--r--src/libs/client/OSCEngineSender.hpp7
-rw-r--r--src/libs/engine/ClientBroadcaster.cpp106
-rw-r--r--src/libs/engine/ClientBroadcaster.hpp21
-rw-r--r--src/libs/engine/OSCEngineReceiver.cpp27
-rw-r--r--src/libs/engine/OSCEngineReceiver.hpp1
-rw-r--r--src/libs/engine/OSCResponder.cpp3
-rw-r--r--src/libs/engine/OSCResponder.hpp4
-rw-r--r--src/libs/engine/QueuedEngineInterface.cpp14
-rw-r--r--src/libs/engine/QueuedEngineInterface.hpp8
-rw-r--r--src/libs/engine/events/RegisterClientEvent.cpp17
-rw-r--r--src/libs/engine/events/RegisterClientEvent.hpp6
-rw-r--r--src/libs/engine/events/RequestAllObjectsEvent.cpp2
-rw-r--r--src/libs/engine/events/RequestMetadataEvent.cpp2
-rw-r--r--src/libs/engine/events/RequestObjectEvent.cpp2
-rw-r--r--src/libs/engine/events/RequestPluginEvent.cpp2
-rw-r--r--src/libs/engine/events/RequestPluginsEvent.cpp2
-rw-r--r--src/libs/engine/events/RequestPortValueEvent.cpp2
-rw-r--r--src/libs/engine/events/UnregisterClientEvent.cpp6
-rw-r--r--src/libs/engine/events/UnregisterClientEvent.hpp7
-rw-r--r--src/libs/gui/ConnectWindow.cpp3
25 files changed, 121 insertions, 243 deletions
diff --git a/src/common/interface/ClientKey.hpp b/src/common/interface/ClientKey.hpp
deleted file mode 100644
index b007a647..00000000
--- a/src/common/interface/ClientKey.hpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/* This file is part of Ingen.
- * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
- * Ingen 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.
- *
- * Ingen 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 details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef CLIENTKEY_H
-#define CLIENTKEY_H
-
-#include <string>
-
-namespace Ingen {
-namespace Shared {
-
-
-/** Key for looking up clients.
- *
- * This might actually be a lookup key (as in OSC clients) or a direct handle
- * of some kind (eg pointer) (for in-process or shared memory clients).
- *
- * This is shared code, nothing client or server code specific should be here.
- */
-class ClientKey
-{
-public:
- /** A key to identify a particular ClientInterface.
- *
- * There are two different OSC key types because one is for server side,
- * and one is for client side. A client can not identify it's own URL to
- * the host (for NAT traversal, etc) so it can only know the outgoing UDP
- * port it's sending on. The server however identifies that client by the
- * full incoming URL.
- */
- enum Type {
- NIL, ///< A NULL key (represents no client)
- OSC_URL, ///< An OSC URL (remote host/client)
- OSC_PORT, ///< A local OSC port
- DIRECT ///< A direct in-process function call client
- };
-
- ClientKey()
- : _type(NIL),
- _uri("")
- {}
-
- ClientKey(Type type, const std::string& uri)
- : _type(type)
- , _uri(uri)
- {}
-
- /*ClientKey(Type type, int port)
- : _type(OSC_PORT)
- , _port(port)
- {}*/
-
- inline bool
- operator==(const ClientKey& key) const
- {
- return (_type == key._type && _uri == key._uri);
- }
-
- inline Type type() const { return _type; }
- inline const std::string& uri() const { return _uri; }
-
-protected:
- Type _type;
- const std::string _uri; ///< URL for OSC_URL, (string) port number for OSC_PORT
-};
-
-
-} // namespace Shared
-} // namespace Ingen
-
-#endif // CLIENTKEY_H
-
diff --git a/src/common/interface/EngineInterface.hpp b/src/common/interface/EngineInterface.hpp
index af662f82..f727b1be 100644
--- a/src/common/interface/EngineInterface.hpp
+++ b/src/common/interface/EngineInterface.hpp
@@ -28,7 +28,6 @@ namespace Ingen {
/** Shared code used on both client side and engine side (abstract interfaces). */
namespace Shared {
-class ClientKey;
class Responder;
@@ -47,8 +46,8 @@ public:
virtual void disable_responses() = 0;
// Client registration
- virtual void register_client(ClientKey key, SharedPtr<ClientInterface> client) = 0;
- virtual void unregister_client(ClientKey key) = 0;
+ virtual void register_client(const string& uri, SharedPtr<ClientInterface> client) = 0;
+ virtual void unregister_client(const string& uri) = 0;
// Engine commands
@@ -125,6 +124,8 @@ public:
virtual void request_object(const string& path) = 0;
virtual void request_port_value(const string& port_path) = 0;
+
+ virtual void request_metadata(const string& path, const string& key) = 0;
virtual void request_plugins() = 0;
diff --git a/src/common/interface/Makefile.am b/src/common/interface/Makefile.am
index 7a8f641d..7b9f1f53 100644
--- a/src/common/interface/Makefile.am
+++ b/src/common/interface/Makefile.am
@@ -1,6 +1,5 @@
EXTRA_DIST = \
README \
ClientInterface.hpp \
- ClientKey.hpp \
Responder.hpp \
EngineInterface.hpp
diff --git a/src/common/interface/Responder.hpp b/src/common/interface/Responder.hpp
index fc8cdcf7..0ae0972a 100644
--- a/src/common/interface/Responder.hpp
+++ b/src/common/interface/Responder.hpp
@@ -21,15 +21,11 @@
#include <inttypes.h>
#include <string>
#include <raul/SharedPtr.hpp>
-#include "interface/ClientKey.hpp"
#include "interface/ClientInterface.hpp"
namespace Ingen {
namespace Shared {
-using Shared::ClientKey;
-using Shared::ClientInterface;
-
/** Class to handle responding to clients.
*
@@ -39,8 +35,8 @@ using Shared::ClientInterface;
* Note that this class only handles sending responses to commands from
* clients, (ie OK or an error), <b>not</b> notifications (ie new node,
* disconnection) - that's what ClientInterface is for. If a command is
- * a request, the ClientKey of the Responder can be used to find the
- * ClientInterface which should receive the response.
+ * a request, the Responder can be used to find the ClientInterface
+ * (by URI) which should receive the response.
*
* ClientInterface and Responder are seperate because responding might not
* actually get exposed to the client interface (eg in simulated blocking
@@ -57,8 +53,9 @@ public:
Responder() {}
virtual ~Responder() {}
- virtual ClientKey client_key() { return ClientKey(); }
- virtual SharedPtr<ClientInterface> client() { return SharedPtr<ClientInterface>(); }
+ virtual std::string client_uri() { return ""; }
+
+ virtual SharedPtr<ClientInterface> client() { return SharedPtr<ClientInterface>(); }
virtual void set_id(int32_t id) {}
diff --git a/src/libs/client/OSCEngineSender.cpp b/src/libs/client/OSCEngineSender.cpp
index 2e49eac3..988f2c5e 100644
--- a/src/libs/client/OSCEngineSender.cpp
+++ b/src/libs/client/OSCEngineSender.cpp
@@ -17,7 +17,6 @@
#include <iostream>
#include "OSCEngineSender.hpp"
-#include "interface/ClientKey.hpp"
#include <raul/AtomLiblo.hpp>
using std::cout; using std::cerr; using std::endl;
@@ -108,7 +107,7 @@ OSCEngineSender::attach(int32_t ping_id, bool block)
* traversal. It is a parameter to remain compatible with EngineInterface.
*/
void
-OSCEngineSender::register_client(ClientKey key, SharedPtr<ClientInterface> client)
+OSCEngineSender::register_client(const string& uri, SharedPtr<ClientInterface> client)
{
// FIXME: use parameters.. er, somehow.
assert(_engine_addr);
@@ -117,7 +116,7 @@ OSCEngineSender::register_client(ClientKey key, SharedPtr<ClientInterface> clien
void
-OSCEngineSender::unregister_client(ClientKey key)
+OSCEngineSender::unregister_client(const string& uri)
{
assert(_engine_addr);
lo_send(_engine_addr, "/ingen/unregister_client", "i", next_id());
@@ -426,6 +425,16 @@ OSCEngineSender::request_port_value(const string& port_path)
port_path.c_str());
}
+void
+OSCEngineSender::request_metadata(const string& object_path, const string& key)
+{
+ assert(_engine_addr);
+ lo_send(_engine_addr, "/ingen/request_metadata", "iss",
+ next_id(),
+ object_path.c_str(),
+ key.c_str());
+}
+
void
OSCEngineSender::request_plugins()
diff --git a/src/libs/client/OSCEngineSender.hpp b/src/libs/client/OSCEngineSender.hpp
index c9b37ec8..ea804d59 100644
--- a/src/libs/client/OSCEngineSender.hpp
+++ b/src/libs/client/OSCEngineSender.hpp
@@ -26,7 +26,6 @@
using std::string;
using Ingen::Shared::EngineInterface;
using Ingen::Shared::ClientInterface;
-using Ingen::Shared::ClientKey;
using Ingen::Shared::Responder;
namespace Ingen {
@@ -62,8 +61,8 @@ public:
/* *** EngineInterface implementation below here *** */
// Client registration
- void register_client(ClientKey key, SharedPtr<ClientInterface> client);
- void unregister_client(ClientKey key);
+ void register_client(const string& uri, SharedPtr<ClientInterface> client);
+ void unregister_client(const string& uri);
// Engine commands
@@ -140,6 +139,8 @@ public:
void request_object(const string& path);
void request_port_value(const string& port_path);
+
+ void request_metadata(const string& path, const string& key);
void request_plugins();
diff --git a/src/libs/engine/ClientBroadcaster.cpp b/src/libs/engine/ClientBroadcaster.cpp
index 311e8792..8547543a 100644
--- a/src/libs/engine/ClientBroadcaster.cpp
+++ b/src/libs/engine/ClientBroadcaster.cpp
@@ -18,7 +18,6 @@
#include <cassert>
#include <iostream>
#include <unistd.h>
-#include "interface/ClientKey.hpp"
#include "interface/ClientInterface.hpp"
#include "ClientBroadcaster.hpp"
#include "ObjectStore.hpp"
@@ -42,59 +41,34 @@ namespace Ingen {
/** Register a client to receive messages over the notification band.
*/
void
-ClientBroadcaster::register_client(const ClientKey key, SharedPtr<ClientInterface> client)
+ClientBroadcaster::register_client(const string& uri, SharedPtr<ClientInterface> client)
{
- bool found = false;
- for (ClientList::iterator i = _clients.begin(); i != _clients.end(); ++i)
- if ((*i).first == key)
- found = true;
-
- if (!found) {
- _clients.push_back(pair<ClientKey, SharedPtr<ClientInterface> >(key, client));
- cout << "[ClientBroadcaster] Registered client " << key.uri()
- << " (" << _clients.size() << " clients)" << endl;
+ ClientMap::iterator i = _clients.find(uri);
+
+ if (i == _clients.end()) {
+ _clients[uri] = client;
+ cout << "[ClientBroadcaster] Registered client: " << uri << endl;
} else {
- cout << "[ClientBroadcaster] Client already registered." << endl;
+ cout << "[ClientBroadcaster] Client already registered: " << uri << endl;
}
}
/** Remove a client from the list of registered clients.
*
- * The removed client is returned (not deleted). It is the caller's
- * responsibility to delete the returned pointer, if it's not NULL.
- *
- * @return true if client was found and removed (and refcount decremented).
+ * @return true if client was found and removed.
*/
bool
-ClientBroadcaster::unregister_client(const ClientKey& key)
+ClientBroadcaster::unregister_client(const string& uri)
{
- cerr << "FIXME: unregister broken\n";
- return false;
-
-#if 0
- if (responder == NULL)
- return NULL;
-
- // FIXME: remove filthy cast
- const string url = lo_address_get_url(((OSCResponder*)responder)->source());
- ClientInterface* r = NULL;
-
- for (ClientList::iterator i = _clients.begin(); i != _clients.end(); ++i) {
- if ((*i).second->url() == url) {
- r = *i;
- _clients.erase(i);
- break;
- }
- }
+ size_t erased = _clients.erase(uri);
- if (r != NULL)
- cout << "[OSC] Unregistered client " << r->url() << " (" << _clients.size() << " clients)" << endl;
+ if (erased > 0)
+ cout << "Unregistered client: " << uri << endl;
else
- cerr << "[OSC] ERROR: Unable to find client to unregister!" << endl;
-
- return r;
-#endif
+ cout << "Failed to find client to unregister: " << uri << endl;
+
+ return (erased > 0);
}
@@ -106,22 +80,22 @@ ClientBroadcaster::unregister_client(const ClientKey& key)
* events, in anticipation of libom and multiple ways of responding to clients).
*/
SharedPtr<ClientInterface>
-ClientBroadcaster::client(const ClientKey& key)
+ClientBroadcaster::client(const string& uri)
{
- for (ClientList::iterator i = _clients.begin(); i != _clients.end(); ++i)
- if ((*i).first == key)
- return (*i).second;
-
- cerr << "[ClientBroadcaster] Failed to find client " << key.uri() << endl;
-
- return SharedPtr<ClientInterface>();
+ ClientMap::iterator i = _clients.find(uri);
+ if (i != _clients.end()) {
+ return (*i).second;
+ } else {
+ cerr << "[ClientBroadcaster] Failed to find client: " << uri << endl;
+ return SharedPtr<ClientInterface>();
+ }
}
void
ClientBroadcaster::send_error(const string& msg)
{
- for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
+ for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->error(msg);
}
@@ -187,7 +161,7 @@ ClientBroadcaster::send_plugins_to(SharedPtr<ClientInterface> client, const list
void
ClientBroadcaster::send_plugins(const list<Plugin*>& plugin_list)
{
- for (ClientList::const_iterator c = _clients.begin(); c != _clients.end(); ++c)
+ for (ClientMap::const_iterator c = _clients.begin(); c != _clients.end(); ++c)
send_plugins_to((*c).second, plugin_list);
}
@@ -195,7 +169,7 @@ ClientBroadcaster::send_plugins(const list<Plugin*>& plugin_list)
void
ClientBroadcaster::send_node(const Node* node, bool recursive)
{
- for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
+ for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
ObjectSender::send_node((*i).second.get(), node, recursive);
}
@@ -203,7 +177,7 @@ ClientBroadcaster::send_node(const Node* node, bool recursive)
void
ClientBroadcaster::send_port(const Port* port)
{
- for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
+ for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
ObjectSender::send_port((*i).second.get(), port);
}
@@ -212,21 +186,21 @@ void
ClientBroadcaster::send_destroyed(const string& path)
{
assert(path != "/");
- for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
+ for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->object_destroyed(path);
}
void
ClientBroadcaster::send_patch_cleared(const string& patch_path)
{
- for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
+ for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->patch_cleared(patch_path);
}
void
ClientBroadcaster::send_connection(const Connection* const c)
{
- for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
+ for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->connection(c->src_port()->path(), c->dst_port()->path());
}
@@ -234,7 +208,7 @@ ClientBroadcaster::send_connection(const Connection* const c)
void
ClientBroadcaster::send_disconnection(const string& src_port_path, const string& dst_port_path)
{
- for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
+ for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->disconnection(src_port_path, dst_port_path);
}
@@ -242,7 +216,7 @@ ClientBroadcaster::send_disconnection(const string& src_port_path, const string&
void
ClientBroadcaster::send_patch_enable(const string& patch_path)
{
- for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
+ for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->patch_enabled(patch_path);
}
@@ -250,7 +224,7 @@ ClientBroadcaster::send_patch_enable(const string& patch_path)
void
ClientBroadcaster::send_patch_disable(const string& patch_path)
{
- for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
+ for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->patch_disabled(patch_path);
}
@@ -262,7 +236,7 @@ ClientBroadcaster::send_patch_disable(const string& patch_path)
void
ClientBroadcaster::send_metadata_update(const string& node_path, const string& key, const Atom& value)
{
- for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
+ for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->metadata_update(node_path, key, value);
}
@@ -276,7 +250,7 @@ ClientBroadcaster::send_metadata_update(const string& node_path, const string& k
void
ClientBroadcaster::send_control_change(const string& port_path, float value)
{
- for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
+ for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->control_change(port_path, value);
}
@@ -284,7 +258,7 @@ ClientBroadcaster::send_control_change(const string& port_path, float value)
void
ClientBroadcaster::send_program_add(const string& node_path, int bank, int program, const string& name)
{
- for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
+ for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->program_add(node_path, bank, program, name);
}
@@ -292,7 +266,7 @@ ClientBroadcaster::send_program_add(const string& node_path, int bank, int progr
void
ClientBroadcaster::send_program_remove(const string& node_path, int bank, int program)
{
- for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
+ for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->program_remove(node_path, bank, program);
}
@@ -304,7 +278,7 @@ ClientBroadcaster::send_program_remove(const string& node_path, int bank, int pr
void
ClientBroadcaster::send_patch(const Patch* const p, bool recursive)
{
- for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
+ for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
ObjectSender::send_patch((*i).second.get(), p, recursive);
}
@@ -314,7 +288,7 @@ ClientBroadcaster::send_patch(const Patch* const p, bool recursive)
void
ClientBroadcaster::send_rename(const string& old_path, const string& new_path)
{
- for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
+ for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->object_renamed(old_path, new_path);
}
@@ -326,7 +300,7 @@ ClientBroadcaster::send_all_objects()
{
cerr << "FIXME: send_all" << endl;
- //for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
+ //for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
// (*i).second->send_all_objects();
}
diff --git a/src/libs/engine/ClientBroadcaster.hpp b/src/libs/engine/ClientBroadcaster.hpp
index 87e321bb..3103c4d9 100644
--- a/src/libs/engine/ClientBroadcaster.hpp
+++ b/src/libs/engine/ClientBroadcaster.hpp
@@ -19,16 +19,17 @@
#define CLIENTBROADCASTER_H
#include <string>
-#include <iostream>
-#include <utility>
#include <list>
+#include <map>
#include <lo/lo.h>
#include <pthread.h>
#include <raul/SharedPtr.hpp>
#include "interface/ClientInterface.hpp"
#include "types.hpp"
-using std::list; using std::string; using std::pair;
+using std::map;
+using std::string;
+using std::list;
namespace Ingen {
@@ -37,8 +38,7 @@ class Port;
class Plugin;
class Patch;
class Connection;
-namespace Shared { class ClientKey; class Responder; }
-using Shared::ClientKey;
+namespace Shared { class Responder; }
using Shared::ClientInterface;
@@ -55,10 +55,10 @@ using Shared::ClientInterface;
class ClientBroadcaster
{
public:
- void register_client(const ClientKey key, SharedPtr<ClientInterface> client);
- bool unregister_client(const ClientKey& key);
+ void register_client(const string& uri, SharedPtr<ClientInterface> client);
+ bool unregister_client(const string& uri);
- SharedPtr<ClientInterface> client(const ClientKey& key);
+ SharedPtr<ClientInterface> client(const string& uri);
// Notification band:
@@ -91,9 +91,8 @@ public:
void send_plugins_to(SharedPtr<ClientInterface>, const list<Plugin*>& plugin_list);
private:
- typedef list<pair<ClientKey, SharedPtr<ClientInterface> > > ClientList;
- //list<pair<ClientKey, ClientInterface* const> > _clients;
- ClientList _clients;
+ typedef std::map<string, SharedPtr<ClientInterface> > ClientMap;
+ ClientMap _clients;
};
diff --git a/src/libs/engine/OSCEngineReceiver.cpp b/src/libs/engine/OSCEngineReceiver.cpp
index d3d1b666..011f950c 100644
--- a/src/libs/engine/OSCEngineReceiver.cpp
+++ b/src/libs/engine/OSCEngineReceiver.cpp
@@ -22,7 +22,6 @@
#include "types.hpp"
#include <raul/SharedPtr.hpp>
#include <raul/AtomLiblo.hpp>
-#include "interface/ClientKey.hpp"
#include "interface/ClientInterface.hpp"
#include "OSCEngineReceiver.hpp"
#include "QueuedEventSource.hpp"
@@ -34,8 +33,6 @@ using std::cerr; using std::cout; using std::endl;
namespace Ingen {
-using Shared::ClientKey;
-
/*! \page engine_osc_namespace Engine OSC Namespace Documentation
*
@@ -255,8 +252,7 @@ OSCEngineReceiver::set_response_address_cb(const char* path, const char* types,
// Don't respond
} else {
me->disable_responses();
- SharedPtr<ClientInterface> client = me->_engine.broadcaster()->client(
- ClientKey(ClientKey::OSC_URL, (const char*)url));
+ SharedPtr<ClientInterface> client = me->_engine.broadcaster()->client(url);
if (client)
client->disable();
else
@@ -334,7 +330,7 @@ OSCEngineReceiver::_register_client_cb(const char* path, const char* types, lo_a
char* const url = lo_address_get_url(addr);
SharedPtr<ClientInterface> client(new OSCClientSender((const char*)url));
- register_client(ClientKey(ClientKey::OSC_URL, (const char*)url), client);
+ register_client(url, client);
free(url);
return 0;
@@ -351,7 +347,7 @@ OSCEngineReceiver::_unregister_client_cb(const char* path, const char* types, lo
lo_address addr = lo_message_get_source(msg);
char* url = lo_address_get_url(addr);
- unregister_client(ClientKey(ClientKey::OSC_URL, url));
+ unregister_client(url);
free(url);
return 0;
@@ -757,12 +753,12 @@ OSCEngineReceiver::_metadata_set_cb(const char* path, const char* types, lo_arg*
if (argc != 4 || types[0] != 'i' || types[1] != 's' || types[2] != 's')
return 1;
- const char* node_path = &argv[1]->s;
+ const char* object_path = &argv[1]->s;
const char* key = &argv[2]->s;
Raul::Atom value = Raul::AtomLiblo::lo_arg_to_atom(types[3], argv[3]);
- set_metadata(node_path, key, value);
+ set_metadata(object_path, key, value);
return 0;
}
@@ -779,18 +775,11 @@ OSCEngineReceiver::_metadata_set_cb(const char* path, const char* types, lo_arg*
int
OSCEngineReceiver::_metadata_get_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
- /*
- const char* node_path = &argv[1]->s;
+ const char* object_path = &argv[1]->s;
const char* key = &argv[2]->s;
- */
- cerr << "FIXME: OSC metadata request\n";
- // FIXME: Equivalent?
- /*
- RequestMetadataEvent* ev = new RequestMetadataEvent(
- new OSCResponder(ClientKey(addr)),
- node_path, key);
- */
+ request_metadata(object_path, key);
+
return 0;
}
diff --git a/src/libs/engine/OSCEngineReceiver.hpp b/src/libs/engine/OSCEngineReceiver.hpp
index 40a3801b..478af249 100644
--- a/src/libs/engine/OSCEngineReceiver.hpp
+++ b/src/libs/engine/OSCEngineReceiver.hpp
@@ -108,6 +108,7 @@ private:
LO_HANDLER(request_plugin);
LO_HANDLER(request_object);
LO_HANDLER(request_port_value);
+ LO_HANDLER(request_metadata);
LO_HANDLER(request_plugins);
LO_HANDLER(request_all_objects);
diff --git a/src/libs/engine/OSCResponder.cpp b/src/libs/engine/OSCResponder.cpp
index 71104be4..a966a2d3 100644
--- a/src/libs/engine/OSCResponder.cpp
+++ b/src/libs/engine/OSCResponder.cpp
@@ -17,7 +17,6 @@
#include "OSCResponder.hpp"
#include "ClientBroadcaster.hpp"
-#include "interface/ClientKey.hpp"
#include <cstdlib>
#include <iostream>
#include <inttypes.h>
@@ -90,7 +89,7 @@ SharedPtr<ClientInterface>
OSCResponder::client()
{
if (_broadcaster)
- return _broadcaster->client(client_key());
+ return _broadcaster->client(client_uri());
else
return SharedPtr<ClientInterface>();
}
diff --git a/src/libs/engine/OSCResponder.hpp b/src/libs/engine/OSCResponder.hpp
index a7b0968d..b536c169 100644
--- a/src/libs/engine/OSCResponder.hpp
+++ b/src/libs/engine/OSCResponder.hpp
@@ -19,6 +19,7 @@
#define OSCRESPONDER_H
#include <inttypes.h>
+#include <string>
#include <memory>
#include <lo/lo.h>
#include "interface/Responder.hpp"
@@ -51,8 +52,7 @@ public:
const char* url() const { return _url; }
- Shared::ClientKey client_key()
- { return Shared::ClientKey(Shared::ClientKey::OSC_URL, _url); }
+ std::string client_uri() { return _url; }
SharedPtr<Shared::ClientInterface> client();
diff --git a/src/libs/engine/QueuedEngineInterface.cpp b/src/libs/engine/QueuedEngineInterface.cpp
index 2abb5a1c..f54f850a 100644
--- a/src/libs/engine/QueuedEngineInterface.cpp
+++ b/src/libs/engine/QueuedEngineInterface.cpp
@@ -25,9 +25,9 @@
namespace Ingen {
QueuedEngineInterface::QueuedEngineInterface(Engine& engine, size_t queued_size, size_t stamped_size)
-: QueuedEventSource(queued_size, stamped_size)
-, _responder(SharedPtr<Shared::Responder>(new Shared::Responder())) // NULL responder
-, _engine(engine)
+ : QueuedEventSource(queued_size, stamped_size)
+ , _responder(SharedPtr<Shared::Responder>(new Shared::Responder())) // NULL responder
+ , _engine(engine)
{
}
@@ -74,16 +74,16 @@ QueuedEngineInterface::disable_responses()
void
-QueuedEngineInterface::register_client(ClientKey key, SharedPtr<ClientInterface> client)
+QueuedEngineInterface::register_client(const string& uri, SharedPtr<ClientInterface> client)
{
- push_queued(new RegisterClientEvent(_engine, _responder, now(), key, client));
+ push_queued(new RegisterClientEvent(_engine, _responder, now(), uri, client));
}
void
-QueuedEngineInterface::unregister_client(ClientKey key)
+QueuedEngineInterface::unregister_client(const string& uri)
{
- push_queued(new UnregisterClientEvent(_engine, _responder, now(), key));
+ push_queued(new UnregisterClientEvent(_engine, _responder, now(), uri));
}
diff --git a/src/libs/engine/QueuedEngineInterface.hpp b/src/libs/engine/QueuedEngineInterface.hpp
index 204338bf..889b8f8e 100644
--- a/src/libs/engine/QueuedEngineInterface.hpp
+++ b/src/libs/engine/QueuedEngineInterface.hpp
@@ -24,7 +24,6 @@
#include <raul/SharedPtr.hpp>
#include "interface/EngineInterface.hpp"
#include "interface/ClientInterface.hpp"
-#include "interface/ClientKey.hpp"
#include "interface/Responder.hpp"
#include "QueuedEventSource.hpp"
#include "Engine.hpp"
@@ -32,7 +31,6 @@ using std::string;
namespace Ingen {
-using Shared::ClientKey;
using Shared::ClientInterface;
using Shared::EngineInterface;
class Engine;
@@ -70,8 +68,8 @@ public:
virtual void disable_responses();
// Client registration
- virtual void register_client(ClientKey key, SharedPtr<ClientInterface> client);
- virtual void unregister_client(ClientKey key);
+ virtual void register_client(const string& uri, SharedPtr<ClientInterface> client);
+ virtual void unregister_client(const string& uri);
// Engine commands
@@ -148,6 +146,8 @@ public:
virtual void request_object(const string& path);
virtual void request_port_value(const string& port_path);
+
+ virtual void request_metadata(const string& path, const string& key);
virtual void request_plugins();
diff --git a/src/libs/engine/events/RegisterClientEvent.cpp b/src/libs/engine/events/RegisterClientEvent.cpp
index ace2b3e0..ac2dbbc3 100644
--- a/src/libs/engine/events/RegisterClientEvent.cpp
+++ b/src/libs/engine/events/RegisterClientEvent.cpp
@@ -23,13 +23,14 @@
namespace Ingen {
-RegisterClientEvent::RegisterClientEvent(Engine& engine, SharedPtr<Shared::Responder> responder,
- SampleCount timestamp,
- ClientKey key,
- SharedPtr<ClientInterface> client)
-: QueuedEvent(engine, responder, timestamp)
-, _key(key)
-, _client(client)
+RegisterClientEvent::RegisterClientEvent(Engine& engine,
+ SharedPtr<Shared::Responder> responder,
+ SampleCount timestamp,
+ const string& uri,
+ SharedPtr<ClientInterface> client)
+ : QueuedEvent(engine, responder, timestamp)
+ , _uri(uri)
+ , _client(client)
{
}
@@ -37,7 +38,7 @@ RegisterClientEvent::RegisterClientEvent(Engine& engine, SharedPtr<Shared::Respo
void
RegisterClientEvent::pre_process()
{
- _engine.broadcaster()->register_client(_key, _client);
+ _engine.broadcaster()->register_client(_uri, _client);
QueuedEvent::pre_process();
}
diff --git a/src/libs/engine/events/RegisterClientEvent.hpp b/src/libs/engine/events/RegisterClientEvent.hpp
index be02fd41..90528956 100644
--- a/src/libs/engine/events/RegisterClientEvent.hpp
+++ b/src/libs/engine/events/RegisterClientEvent.hpp
@@ -19,12 +19,10 @@
#define REGISTERCLIENTEVENT_H
#include "QueuedEvent.hpp"
-#include "interface/ClientKey.hpp"
#include "interface/ClientInterface.hpp"
#include <string>
using std::string;
using Ingen::Shared::ClientInterface;
-using Ingen::Shared::ClientKey;
using Ingen::Shared::Responder;
namespace Ingen {
@@ -40,14 +38,14 @@ public:
RegisterClientEvent(Engine& engine,
SharedPtr<Shared::Responder> responder,
SampleCount timestamp,
- ClientKey key,
+ const string& uri,
SharedPtr<ClientInterface> client);
void pre_process();
void post_process();
private:
- ClientKey _key;
+ string _uri;
SharedPtr<ClientInterface> _client;
};
diff --git a/src/libs/engine/events/RequestAllObjectsEvent.cpp b/src/libs/engine/events/RequestAllObjectsEvent.cpp
index a6940442..4b068536 100644
--- a/src/libs/engine/events/RequestAllObjectsEvent.cpp
+++ b/src/libs/engine/events/RequestAllObjectsEvent.cpp
@@ -34,7 +34,7 @@ RequestAllObjectsEvent::RequestAllObjectsEvent(Engine& engine, SharedPtr<Shared:
void
RequestAllObjectsEvent::pre_process()
{
- _client = _engine.broadcaster()->client(_responder->client_key());
+ _client = _engine.broadcaster()->client(_responder->client_uri());
QueuedEvent::pre_process();
}
diff --git a/src/libs/engine/events/RequestMetadataEvent.cpp b/src/libs/engine/events/RequestMetadataEvent.cpp
index 5000256f..b9696c4a 100644
--- a/src/libs/engine/events/RequestMetadataEvent.cpp
+++ b/src/libs/engine/events/RequestMetadataEvent.cpp
@@ -41,7 +41,7 @@ RequestMetadataEvent::RequestMetadataEvent(Engine& engine, SharedPtr<Shared::Res
void
RequestMetadataEvent::pre_process()
{
- _client = _engine.broadcaster()->client(_responder->client_key());
+ _client = _engine.broadcaster()->client(_responder->client_uri());
if (_client) {
_object = _engine.object_store()->find(_path);
diff --git a/src/libs/engine/events/RequestObjectEvent.cpp b/src/libs/engine/events/RequestObjectEvent.cpp
index 25f95d00..8efe37b7 100644
--- a/src/libs/engine/events/RequestObjectEvent.cpp
+++ b/src/libs/engine/events/RequestObjectEvent.cpp
@@ -43,7 +43,7 @@ RequestObjectEvent::RequestObjectEvent(Engine& engine, SharedPtr<Shared::Respond
void
RequestObjectEvent::pre_process()
{
- _client = _engine.broadcaster()->client(_responder->client_key());
+ _client = _engine.broadcaster()->client(_responder->client_uri());
_object = _engine.object_store()->find(_path);
QueuedEvent::pre_process();
diff --git a/src/libs/engine/events/RequestPluginEvent.cpp b/src/libs/engine/events/RequestPluginEvent.cpp
index 4e1a1660..981c98e7 100644
--- a/src/libs/engine/events/RequestPluginEvent.cpp
+++ b/src/libs/engine/events/RequestPluginEvent.cpp
@@ -42,7 +42,7 @@ RequestPluginEvent::RequestPluginEvent(Engine& engine, SharedPtr<Shared::Respond
void
RequestPluginEvent::pre_process()
{
- _client = _engine.broadcaster()->client(_responder->client_key());
+ _client = _engine.broadcaster()->client(_responder->client_uri());
_plugin = _engine.node_factory()->plugin(_uri);
QueuedEvent::pre_process();
diff --git a/src/libs/engine/events/RequestPluginsEvent.cpp b/src/libs/engine/events/RequestPluginsEvent.cpp
index 3976dd08..50271b7f 100644
--- a/src/libs/engine/events/RequestPluginsEvent.cpp
+++ b/src/libs/engine/events/RequestPluginsEvent.cpp
@@ -33,7 +33,7 @@ RequestPluginsEvent::RequestPluginsEvent(Engine& engine, SharedPtr<Shared::Respo
void
RequestPluginsEvent::pre_process()
{
- _client = _engine.broadcaster()->client(_responder->client_key());
+ _client = _engine.broadcaster()->client(_responder->client_uri());
// Take a copy to send in the post processing thread (to avoid problems
// because std::list isn't thread safe)
diff --git a/src/libs/engine/events/RequestPortValueEvent.cpp b/src/libs/engine/events/RequestPortValueEvent.cpp
index 7444068e..113369b3 100644
--- a/src/libs/engine/events/RequestPortValueEvent.cpp
+++ b/src/libs/engine/events/RequestPortValueEvent.cpp
@@ -42,7 +42,7 @@ RequestPortValueEvent::RequestPortValueEvent(Engine& engine, SharedPtr<Shared::R
void
RequestPortValueEvent::pre_process()
{
- _client = _engine.broadcaster()->client(_responder->client_key());
+ _client = _engine.broadcaster()->client(_responder->client_uri());
_port = _engine.object_store()->find_port(_port_path);
QueuedEvent::pre_process();
diff --git a/src/libs/engine/events/UnregisterClientEvent.cpp b/src/libs/engine/events/UnregisterClientEvent.cpp
index be03f151..11424003 100644
--- a/src/libs/engine/events/UnregisterClientEvent.cpp
+++ b/src/libs/engine/events/UnregisterClientEvent.cpp
@@ -24,9 +24,9 @@
namespace Ingen {
-UnregisterClientEvent::UnregisterClientEvent(Engine& engine, SharedPtr<Shared::Responder> responder, SampleCount timestamp, ClientKey key)
+UnregisterClientEvent::UnregisterClientEvent(Engine& engine, SharedPtr<Shared::Responder> responder, SampleCount timestamp, const string& uri)
: QueuedEvent(engine, responder, timestamp)
-, _key(key)
+, _uri(uri)
{
}
@@ -34,7 +34,7 @@ UnregisterClientEvent::UnregisterClientEvent(Engine& engine, SharedPtr<Shared::R
void
UnregisterClientEvent::post_process()
{
- if (_engine.broadcaster()->unregister_client(_key))
+ if (_engine.broadcaster()->unregister_client(_uri))
_responder->respond_ok();
else
_responder->respond_error("Unable to unregister client");
diff --git a/src/libs/engine/events/UnregisterClientEvent.hpp b/src/libs/engine/events/UnregisterClientEvent.hpp
index 17d85b93..500c1250 100644
--- a/src/libs/engine/events/UnregisterClientEvent.hpp
+++ b/src/libs/engine/events/UnregisterClientEvent.hpp
@@ -19,7 +19,6 @@
#define UNREGISTERCLIENTEVENT_H
#include "QueuedEvent.hpp"
-#include "interface/ClientKey.hpp"
#include <string>
using std::string;
@@ -27,10 +26,8 @@ namespace Ingen {
namespace Shared {
class ClientInterface;
- class ClientKey;
}
using Shared::ClientInterface;
-using Shared::ClientKey;
/** Unregisters an OSC client so it no longer receives notifications.
@@ -43,12 +40,12 @@ public:
UnregisterClientEvent(Engine& engine,
SharedPtr<Shared::Responder> responder,
SampleCount timestamp,
- ClientKey key);
+ const string& uri);
void post_process();
private:
- ClientKey _key;
+ string _uri;
};
diff --git a/src/libs/gui/ConnectWindow.cpp b/src/libs/gui/ConnectWindow.cpp
index f643b059..86660d40 100644
--- a/src/libs/gui/ConnectWindow.cpp
+++ b/src/libs/gui/ConnectWindow.cpp
@@ -23,7 +23,6 @@
#include <sys/resource.h>
#include <raul/Process.hpp>
#include "../../../../config/config.h"
-#include "interface/ClientKey.hpp"
#include "interface/EngineInterface.hpp"
#include "engine/tuning.hpp"
#include "engine/Engine.hpp"
@@ -372,7 +371,7 @@ ConnectWindow::gtk_callback()
//App::instance().engine()->register_client(App::instance().engine()->client_hooks());
// FIXME
//auto_ptr<ClientInterface> client(new ThreadedSigClientInterface();
- App::instance().engine()->register_client(ClientKey(), App::instance().client());
+ App::instance().engine()->register_client("FIXME_CLIENT_URI", App::instance().client());
App::instance().engine()->load_plugins();
++_connect_stage;
} else if (_connect_stage == 3) {