summaryrefslogtreecommitdiffstats
path: root/src/osc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-03-12 02:28:21 +0000
committerDavid Robillard <d@drobilla.net>2012-03-12 02:28:21 +0000
commite9d9569271ee962c09ab66c6babed1ca5655a6c6 (patch)
treef77142b08c2bf2488eb382e993da1477c0b94307 /src/osc
parent7835b3d8c9b5b4a6f4959f56083d62826e6f7b8e (diff)
downloadingen-e9d9569271ee962c09ab66c6babed1ca5655a6c6.tar.gz
ingen-e9d9569271ee962c09ab66c6babed1ca5655a6c6.tar.bz2
ingen-e9d9569271ee962c09ab66c6babed1ca5655a6c6.zip
Unify event response mechanism and make it more appropriate for wire transmission.
The downside being more cryptic error messages until the client side error reporting stuff gets more fancy, but the important part is that belongs client side. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4053 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/osc')
-rw-r--r--src/osc/OSCClientReceiver.cpp19
-rw-r--r--src/osc/OSCClientReceiver.hpp3
-rw-r--r--src/osc/OSCClientSender.cpp33
-rw-r--r--src/osc/OSCClientSender.hpp3
4 files changed, 13 insertions, 45 deletions
diff --git a/src/osc/OSCClientReceiver.cpp b/src/osc/OSCClientReceiver.cpp
index 249cf2a4..a0cd58b7 100644
--- a/src/osc/OSCClientReceiver.cpp
+++ b/src/osc/OSCClientReceiver.cpp
@@ -137,8 +137,7 @@ OSCClientReceiver::setup_callbacks()
if (!_target)
return;
- lo_server_thread_add_method(_st, "/ok", "i", response_ok_cb, this);
- lo_server_thread_add_method(_st, "/error", "is", response_error_cb, this);
+ lo_server_thread_add_method(_st, "/response", "ii", response_cb, this);
lo_server_thread_add_method(_st, "/plugin", "sss", plugin_cb, this);
lo_server_thread_add_method(_st, "/put", NULL, put_cb, this);
lo_server_thread_add_method(_st, "/delta_begin", NULL, delta_begin_cb, this);
@@ -282,20 +281,10 @@ OSCClientReceiver::_activity_cb(const char* path, const char* types, lo_arg** ar
}
int
-OSCClientReceiver::_response_ok_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCClientReceiver::_response_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
- assert(!strcmp(types, "i"));
- _target->response_ok(argv[0]->i);
-
- return 0;
-}
-
-int
-OSCClientReceiver::_response_error_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- assert(!strcmp(types, "is"));
- _target->response_error(argv[0]->i, &argv[1]->s);
-
+ assert(!strcmp(types, "ii"));
+ _target->response(argv[0]->i, (Status)argv[1]->i);
return 0;
}
diff --git a/src/osc/OSCClientReceiver.hpp b/src/osc/OSCClientReceiver.hpp
index 46afc81a..a04ed5f5 100644
--- a/src/osc/OSCClientReceiver.hpp
+++ b/src/osc/OSCClientReceiver.hpp
@@ -66,8 +66,7 @@ private:
int _listen_port;
LO_HANDLER(OSCClientReceiver, error);
- LO_HANDLER(OSCClientReceiver, response_ok);
- LO_HANDLER(OSCClientReceiver, response_error);
+ LO_HANDLER(OSCClientReceiver, response);
LO_HANDLER(OSCClientReceiver, plugin);
LO_HANDLER(OSCClientReceiver, plugin_list_end);
LO_HANDLER(OSCClientReceiver, new_patch);
diff --git a/src/osc/OSCClientSender.cpp b/src/osc/OSCClientSender.cpp
index a0b7979c..1a6289f4 100644
--- a/src/osc/OSCClientSender.cpp
+++ b/src/osc/OSCClientSender.cpp
@@ -39,41 +39,22 @@ namespace Server {
*/
/** @page client_osc_namespace
- * <h2>/ok</h2>
+ * <h2>/response</h2>
* @arg @p response-id :: Integer
+ * @arg @p status :: Integer
*
* @par
- * Successful response to some command.
+ * Response to some command.
*/
void
-OSCClientSender::response_ok(int32_t id)
-{
- if (!_enabled)
- return;
-
- if (lo_send(_address, "/ok", "i", id, LO_ARGS_END) < 0) {
- Raul::error << "Unable to send OK " << id << "! ("
- << lo_address_errstr(_address) << ")" << endl;
- }
-}
-
-/** @page client_osc_namespace
- * <h2>/error</h2>
- * @arg @p response-id :: Integer
- * @arg @p message :: String
- *
- * @par
- * Unsuccessful response to some command.
- */
-void
-OSCClientSender::response_error(int32_t id, const std::string& msg)
+OSCClientSender::response(int32_t id, Status status)
{
if (!_enabled)
return;
- if (lo_send(_address, "/error", "is", id, msg.c_str(), LO_ARGS_END) < 0) {
- Raul::error << "Unable to send error " << id << "! ("
- << lo_address_errstr(_address) << ")" << endl;
+ if (lo_send(_address, "/response", "ii", id, status, LO_ARGS_END) < 0) {
+ Raul::error << "Unable to send response " << id << "! ("
+ << lo_address_errstr(_address) << ")" << endl;
}
}
diff --git a/src/osc/OSCClientSender.hpp b/src/osc/OSCClientSender.hpp
index c391e54a..67e76fee 100644
--- a/src/osc/OSCClientSender.hpp
+++ b/src/osc/OSCClientSender.hpp
@@ -66,8 +66,7 @@ public:
/* *** ClientInterface Implementation Below *** */
- void response_ok(int32_t id);
- void response_error(int32_t id, const std::string& msg);
+ void response(int32_t id, Status status);
void error(const std::string& msg);