OSSIA
Open Scenario System for Interactive Application
|
The oscquery_mirror class allows to create a mirror image of a remote OSCQuery server. More...
The oscquery_mirror class allows to create a mirror image of a remote OSCQuery server.
Remote devices are mirror images of local devices on other applications: remote controls, mobile apps, etc. Every parameter in a local device will be synchronized with the remote devices that connected to it.
Public Member Functions | |
oscquery_mirror (std::string name, std::string host="ws://127.0.0.1:5678") | |
create an OSCQuery mirror device and connect it to a remote device More... | |
~oscquery_mirror () | |
OSCQuery Mirror default destructor. | |
node | get_root_node () const |
get this server's root opp::node More... | |
void | refresh () |
refresh the Mirror's namespace More... | |
void | update () |
update mirror's namespace with changes since last update() call More... | |
void | reconnect (std::string name="", std::string host="") |
reconnect to the remote device More... | |
bool | is_connected () const |
is_connected More... | |
void | set_parameter_created_callback (parameter_callback c, void *ctx) |
set a callback to be called when a parameter is created More... | |
void | remove_parameter_created_callback () |
remove the previously set parameter_callback | |
void | set_parameter_removed_callback (parameter_callback c, void *ctx) |
set a callback to be called when a parameter is removed More... | |
void | remove_parameter_removed_callback () |
remove the previously set parameter_callback | |
void | set_node_created_callback (node_callback c, void *ctx) |
set a callback to be called when a node is created More... | |
void | remove_node_created_callback () |
remove the previously set node_callback | |
void | set_node_removed_callback (node_callback c, void *ctx) |
set a callback to be called when a node is removed More... | |
void | remove_node_removed_callback () |
remove the previously set node_callback | |
void | set_node_renamed_callback (node_rn_callback c, void *ctx) |
set a callback to be called when a node is renamed More... | |
void | remove_node_renamed_callback () |
remove the previously set node_callback | |
void | set_message_callback (message_callback c, void *ctx) |
set a callback to be called when a message is received More... | |
void | remove_message_callback () |
remove the previously set node_callback | |
void | set_unhandled_message_callback (unhandled_message_callback c, void *ctx) |
set a callback to be called when an unhandled message is received More... | |
void | remove_unhandled_message_callback () |
remove the previously set node_callback | |
void | set_attribute_modified_callback (attribute_modified_callback c, void *ctx) |
set a callback to be called when an attribute is modified More... | |
void | remove_attribute_modified_callback () |
remove the previously set node_callback | |
void | set_zombie_on_remove (bool b) |
Set on removed behavior. More... | |
bool | get_zombie_on_remove () const |
get_zombie_on_removed More... | |
void | request_add_node (node parent, const std::string &name) |
request adding a node under the parent on the server with the given name More... | |
void | request_remove_node (node node_to_be_removed) |
request removing the given node More... | |
void | request_rename_node (node node, std::string new_name) |
request renaming of given node More... | |
ossia::net::device_base * | get_raw_device_pointer () |
Get the raw device pointer. More... | |
opp::oscquery_mirror::oscquery_mirror | ( | std::string | name, |
std::string | host = "ws://127.0.0.1:5678" |
||
) |
create an OSCQuery mirror device and connect it to a remote device
It is possible to create a OSCQuery mirror and to connect it to a remote device.
This will allow to build a tree of opp::node s, the structure of which can be discovered by using get_root_node() and the opp::node::get_namespace(), opp::node::get_children() and opp::node::find_child() methods.
See the CPP98 tutorial example of the Documentation folder at the root of the libossia repository for an example of this.
name | the name of the remote device (server) |
host | the IP of the remote device (server) |
node opp::oscquery_mirror::get_root_node | ( | ) | const |
get this server's root opp::node
Use get_root_node() in combination with opp::node::get_namespace(), opp::node::get_children() and opp::node::find_child() to build the mirror node tree.
void opp::oscquery_mirror::refresh | ( | ) |
refresh the Mirror's namespace
Refresh the whole namespace, useful right after connecting This will deleta and recreate all nodes on mirror namespace.
void opp::oscquery_mirror::update | ( | ) |
update mirror's namespace with changes since last update() call
Apply the device's tree changes on the mirrored tree.
void opp::oscquery_mirror::reconnect | ( | std::string | name = "" , |
std::string | host = "" |
||
) |
reconnect to the remote device
When the connection the remote server we're mirroring has been lost, we need to reconnect to it in order to go on with the operations.
name | the name of the remote device (server) |
host | the IP of the remote device (server) |
|
inline |
is_connected
void opp::oscquery_mirror::set_parameter_created_callback | ( | parameter_callback | c, |
void * | ctx | ||
) |
set a callback to be called when a parameter is created
c | the parameter_callback |
ctx | the callback context as a void* |
void opp::oscquery_mirror::set_parameter_removed_callback | ( | parameter_callback | c, |
void * | ctx | ||
) |
set a callback to be called when a parameter is removed
c | the parameter_callback |
ctx | the callback context as a void* |
void opp::oscquery_mirror::set_node_created_callback | ( | node_callback | c, |
void * | ctx | ||
) |
set a callback to be called when a node is created
c | the parameter_callback |
ctx | the callback context as a void* |
void opp::oscquery_mirror::set_node_removed_callback | ( | node_callback | c, |
void * | ctx | ||
) |
set a callback to be called when a node is removed
c | the parameter_callback |
ctx | the callback context as a void* |
void opp::oscquery_mirror::set_node_renamed_callback | ( | node_rn_callback | c, |
void * | ctx | ||
) |
set a callback to be called when a node is renamed
c | the parameter_callback |
ctx | the callback context as a void* |
void opp::oscquery_mirror::set_message_callback | ( | message_callback | c, |
void * | ctx | ||
) |
set a callback to be called when a message is received
c | the parameter_callback |
ctx | the callback context as a void* |
void opp::oscquery_mirror::set_unhandled_message_callback | ( | unhandled_message_callback | c, |
void * | ctx | ||
) |
set a callback to be called when an unhandled message is received
c | the parameter_callback |
ctx | the callback context as a void* |
void opp::oscquery_mirror::set_attribute_modified_callback | ( | attribute_modified_callback | c, |
void * | ctx | ||
) |
set a callback to be called when an attribute is modified
c | the parameter_callback |
ctx | the callback context as a void* |
void opp::oscquery_mirror::set_zombie_on_remove | ( | bool | b | ) |
Set on removed behavior.
mode | : delete node when removed if false, mark it as zombie instead (default) |
bool opp::oscquery_mirror::get_zombie_on_remove | ( | ) | const |
get_zombie_on_removed
void opp::oscquery_mirror::request_add_node | ( | node | parent, |
const std::string & | name | ||
) |
request adding a node under the parent on the server with the given name
parent | |
name |
void opp::oscquery_mirror::request_remove_node | ( | node | node_to_be_removed | ) |
request removing the given node
node | to be removed |
void opp::oscquery_mirror::request_rename_node | ( | node | node, |
std::string | new_name | ||
) |
request renaming of given node
node | to be renamed |
new | name |
|
inline |
Get the raw device pointer.
Be careful, this gives you great power and with great power comes... It's useful to make use of ossia feature that are not available in opp:: namespace (but requires some more computer skill)