diff options
author | David Robillard <d@drobilla.net> | 2008-11-09 01:32:38 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-11-09 01:32:38 +0000 |
commit | 5d1f579900182f283a1c21ad4e59daf7f035e219 (patch) | |
tree | e73066002177cf48a31eef91712aa74839dfc555 /src/client | |
parent | 23bb407a4f0db71eb15cbf8bbb8e82e02088a998 (diff) | |
download | ingen-5d1f579900182f283a1c21ad4e59daf7f035e219.tar.gz ingen-5d1f579900182f283a1c21ad4e59daf7f035e219.tar.bz2 ingen-5d1f579900182f283a1c21ad4e59daf7f035e219.zip |
Move patch to /patch via HTTP to give a place for RESTful access to other things.
Implement HTTP access to plugins.
Work towards client being able to use HTTP to connect.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1712 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/HTTPClientReceiver.cpp | 45 | ||||
-rw-r--r-- | src/client/HTTPEngineSender.cpp | 44 | ||||
-rw-r--r-- | src/client/PluginModel.hpp | 17 |
3 files changed, 58 insertions, 48 deletions
diff --git a/src/client/HTTPClientReceiver.cpp b/src/client/HTTPClientReceiver.cpp index 4773b7ce..5d4a8660 100644 --- a/src/client/HTTPClientReceiver.cpp +++ b/src/client/HTTPClientReceiver.cpp @@ -53,11 +53,35 @@ void HTTPClientReceiver::message_callback(SoupSession* session, SoupMessage* msg, void* ptr) { HTTPClientReceiver* me = (HTTPClientReceiver*)ptr; - cout << "RECEIVED ASYNC MESSAGE: " << msg->response_body->data << endl; - me->_target->response_ok(0); - me->_target->enable(); - me->_parser->parse_string(me->_world, me->_target.get(), Glib::ustring(msg->response_body->data), - Glib::ustring("/"), Glib::ustring("")); + //cout << "RECEIVED ASYNC MESSAGE: " << msg->response_body->data << endl; + const string path = soup_message_get_uri(msg)->path; + if (path == "/") { + cout << "RECEIVED ROOT" << endl; + me->_target->response_ok(0); + me->_target->enable(); + } else if (path == "/plugins") { + cout << "RECIEVED PLUGINS" << endl; + if (msg->response_body->data == NULL) { + cout << "NO RESPONSE?!" << endl; + } else { + me->_target->response_ok(0); + me->_target->enable(); + me->_parser->parse_string(me->_world, me->_target.get(), + Glib::ustring(msg->response_body->data), + Glib::ustring("."), Glib::ustring("")); + } + } else if (path == "/patch") { + cout << "RECEIVED OBJECTS" << endl; + if (msg->response_body->data == NULL) { + cout << "NO RESPONSE?!" << endl; + } else { + me->_target->response_ok(0); + me->_target->enable(); + me->_parser->parse_string(me->_world, me->_target.get(), + Glib::ustring(msg->response_body->data), + Glib::ustring("/patch/"), Glib::ustring("")); + } + } } @@ -75,8 +99,17 @@ HTTPClientReceiver::start(bool dump) _parser = SharedPtr<Parser>(new_parser()); } } + _session = soup_session_async_new(); - SoupMessage* msg = soup_message_new("GET", _url.c_str()); + SoupMessage* msg; + + msg = soup_message_new("GET", _url.c_str()); + soup_session_queue_message (_session, msg, message_callback, this); + + msg = soup_message_new("GET", (_url + "/plugins").c_str()); + soup_session_queue_message (_session, msg, message_callback, this); + + msg = soup_message_new("GET", (_url + "/patch").c_str()); soup_session_queue_message (_session, msg, message_callback, this); } diff --git a/src/client/HTTPEngineSender.cpp b/src/client/HTTPEngineSender.cpp index 733e0ac7..312c10ba 100644 --- a/src/client/HTTPEngineSender.cpp +++ b/src/client/HTTPEngineSender.cpp @@ -63,14 +63,12 @@ HTTPEngineSender::attach(int32_t ping_id, bool block) void HTTPEngineSender::register_client(ClientInterface* client) { - } void HTTPEngineSender::unregister_client(const string& uri) { - } @@ -78,28 +76,24 @@ HTTPEngineSender::unregister_client(const string& uri) void HTTPEngineSender::load_plugins() { - } void HTTPEngineSender::activate() { - } void HTTPEngineSender::deactivate() { - } void HTTPEngineSender::quit() { - } @@ -108,23 +102,23 @@ HTTPEngineSender::quit() void HTTPEngineSender::new_patch(const string& path, - uint32_t poly) + uint32_t poly) { } void HTTPEngineSender::new_port(const string& path, - uint32_t index, - const string& data_type, - bool is_output) + uint32_t index, + const string& data_type, + bool is_output) { } void HTTPEngineSender::new_node(const string& path, - const string& plugin_uri) + const string& plugin_uri) { } @@ -135,16 +129,16 @@ HTTPEngineSender::new_node(const string& path, */ void HTTPEngineSender::new_node_deprecated(const string& path, - const string& plugin_type, - const string& library_name, - const string& plugin_label) + const string& plugin_type, + const string& library_name, + const string& plugin_label) { } void HTTPEngineSender::rename(const string& old_path, - const string& new_name) + const string& new_name) { } @@ -163,44 +157,44 @@ HTTPEngineSender::clear_patch(const string& patch_path) void HTTPEngineSender::connect(const string& src_port_path, - const string& dst_port_path) + const string& dst_port_path) { } void HTTPEngineSender::disconnect(const string& src_port_path, - const string& dst_port_path) + const string& dst_port_path) { } void HTTPEngineSender::disconnect_all(const string& parent_patch_path, - const string& node_path) + const string& node_path) { } void HTTPEngineSender::set_port_value(const string& port_path, - const Raul::Atom& value) + const Raul::Atom& value) { } void HTTPEngineSender::set_voice_value(const string& port_path, - uint32_t voice, - const Raul::Atom& value) + uint32_t voice, + const Raul::Atom& value) { } void HTTPEngineSender::set_program(const string& node_path, - uint32_t bank, - uint32_t program) + uint32_t bank, + uint32_t program) { } @@ -213,8 +207,8 @@ HTTPEngineSender::midi_learn(const string& node_path) void HTTPEngineSender::set_variable(const string& obj_path, - const string& predicate, - const Raul::Atom& value) + const string& predicate, + const Raul::Atom& value) { } diff --git a/src/client/PluginModel.hpp b/src/client/PluginModel.hpp index f27bb232..3d25cb5e 100644 --- a/src/client/PluginModel.hpp +++ b/src/client/PluginModel.hpp @@ -66,23 +66,6 @@ public: const string& uri() const { return _uri; } const string& name() const { return _name; } - /** DEPRECATED */ - Type type_from_string(const string& type_string) { - if (type_string == "LV2") return LV2; - else if (type_string == "LADSPA") return LADSPA; - else if (type_string == "Internal") return Internal; - else if (type_string == "Patch") return Patch; - else return Internal; // ? - } - - Type type_from_uri(const string& type_uri) { - if (type_uri.substr(0, 6) != "ingen:") { - return Plugin::Internal; // ? - } else { - return type_from_string(type_uri.substr(6)); - } - } - string default_node_symbol(); string human_name(); string port_human_name(uint32_t index); |