summaryrefslogtreecommitdiffstats
path: root/src/osc/OSCClientReceiver.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-10-22 00:21:43 +0000
committerDavid Robillard <d@drobilla.net>2011-10-22 00:21:43 +0000
commit14ab4dcff7f8461dfed27b6352249b683c1f4bae (patch)
treef263ecca5c5c2a220bd00c69bba11a03ad266dc5 /src/osc/OSCClientReceiver.hpp
parent91bd13d3767452ba0575d69447f23eed1c508603 (diff)
downloadingen-14ab4dcff7f8461dfed27b6352249b683c1f4bae.tar.gz
ingen-14ab4dcff7f8461dfed27b6352249b683c1f4bae.tar.bz2
ingen-14ab4dcff7f8461dfed27b6352249b683c1f4bae.zip
Move *all* OSC and HTTP stuff to their respective modules.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3578 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/osc/OSCClientReceiver.hpp')
-rw-r--r--src/osc/OSCClientReceiver.hpp90
1 files changed, 90 insertions, 0 deletions
diff --git a/src/osc/OSCClientReceiver.hpp b/src/osc/OSCClientReceiver.hpp
new file mode 100644
index 00000000..46afc81a
--- /dev/null
+++ b/src/osc/OSCClientReceiver.hpp
@@ -0,0 +1,90 @@
+/* This file is part of Ingen.
+ * Copyright 2007-2011 David 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 INGEN_CLIENT_OSCCLIENTRECEIVER_HPP
+#define INGEN_CLIENT_OSCCLIENTRECEIVER_HPP
+
+#include <cstdlib>
+
+#include <boost/utility.hpp>
+#include <lo/lo.h>
+
+#include "ingen/ClientInterface.hpp"
+#include "raul/Deletable.hpp"
+#include "raul/SharedPtr.hpp"
+
+#include "macros.h"
+
+namespace Ingen {
+namespace Client {
+
+/** Client-side receiver for OSC messages from the engine.
+ *
+ * \ingroup IngenClient
+ */
+class OSCClientReceiver : public boost::noncopyable, public Raul::Deletable
+{
+public:
+ OSCClientReceiver(int listen_port, SharedPtr<ClientInterface> target);
+ ~OSCClientReceiver();
+
+ std::string uri() const { return lo_server_thread_get_url(_st); }
+
+ void start(bool dump_osc);
+ void stop();
+
+ int listen_port() { return _listen_port; }
+ std::string listen_url() { return lo_server_thread_get_url(_st); }
+
+private:
+ void setup_callbacks();
+
+ static void lo_error_cb(int num, const char* msg, const char* path);
+
+ static int generic_cb(const char* path, const char* types, lo_arg** argv, int argc, void* data, void* user_data);
+ static int unknown_cb(const char* path, const char* types, lo_arg** argv, int argc, void* data, void* osc_receiver);
+
+ SharedPtr<ClientInterface> _target;
+ lo_server_thread _st;
+ Raul::URI _delta_uri;
+ Resource::Properties _delta_remove;
+ Resource::Properties _delta_add;
+ int _listen_port;
+
+ LO_HANDLER(OSCClientReceiver, error);
+ LO_HANDLER(OSCClientReceiver, response_ok);
+ LO_HANDLER(OSCClientReceiver, response_error);
+ LO_HANDLER(OSCClientReceiver, plugin);
+ LO_HANDLER(OSCClientReceiver, plugin_list_end);
+ LO_HANDLER(OSCClientReceiver, new_patch);
+ LO_HANDLER(OSCClientReceiver, del);
+ LO_HANDLER(OSCClientReceiver, move);
+ LO_HANDLER(OSCClientReceiver, connection);
+ LO_HANDLER(OSCClientReceiver, disconnection);
+ LO_HANDLER(OSCClientReceiver, put);
+ LO_HANDLER(OSCClientReceiver, delta_begin);
+ LO_HANDLER(OSCClientReceiver, delta_remove);
+ LO_HANDLER(OSCClientReceiver, delta_add);
+ LO_HANDLER(OSCClientReceiver, delta_end);
+ LO_HANDLER(OSCClientReceiver, set_property);
+ LO_HANDLER(OSCClientReceiver, activity);
+};
+
+} // namespace Client
+} // namespace Ingen
+
+#endif // INGEN_CLIENT_OSCCLIENTRECEIVER_HPP