diff options
Diffstat (limited to 'src/server/OSCEngineReceiver.cpp')
-rw-r--r-- | src/server/OSCEngineReceiver.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/server/OSCEngineReceiver.cpp b/src/server/OSCEngineReceiver.cpp index 338fb985..ad59c490 100644 --- a/src/server/OSCEngineReceiver.cpp +++ b/src/server/OSCEngineReceiver.cpp @@ -98,6 +98,10 @@ OSCEngineReceiver::OSCEngineReceiver(Engine& engine, uint16_t port) lo_server_add_method(_server, "/register_client", "i", register_client_cb, this); lo_server_add_method(_server, "/unregister_client", "i", unregister_client_cb, this); lo_server_add_method(_server, "/put", NULL, put_cb, this); + lo_server_add_method(_server, "/delta_begin", NULL, delta_begin_cb, this); + lo_server_add_method(_server, "/delta_remove", NULL, delta_remove_cb, this); + lo_server_add_method(_server, "/delta_add", NULL, delta_add_cb, this); + lo_server_add_method(_server, "/delta_end", NULL, delta_end_cb, this); lo_server_add_method(_server, "/move", "iss", move_cb, this); lo_server_add_method(_server, "/delete", "is", del_cb, this); lo_server_add_method(_server, "/connect", "iss", connect_cb, this); @@ -346,6 +350,39 @@ OSCEngineReceiver::_put_cb(const char* path, const char* types, lo_arg** argv, i return 0; } +int +OSCEngineReceiver::_delta_begin_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) +{ + const char* obj_path = &argv[1]->s; + assert(_delta_remove.empty()); + assert(_delta_add.empty()); + _delta_uri = obj_path; + return 0; +} + +int +OSCEngineReceiver::_delta_remove_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) +{ + _delta_remove.insert(make_pair(&argv[1]->s, + AtomLiblo::lo_arg_to_atom(types[2], argv[2]))); + return 0; +} + +int +OSCEngineReceiver::_delta_add_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) +{ + _delta_add.insert(make_pair(&argv[1]->s, + AtomLiblo::lo_arg_to_atom(types[2], argv[2]))); + return 0; +} + +int +OSCEngineReceiver::_delta_end_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) +{ + delta(_delta_uri, _delta_remove, _delta_add); + return 0; +} + /** @page engine_osc_namespace * <h2>/move</h2> * @arg @p response-id :: Integer |