OSSIA
Open Scenario System for Interactive Application
opp::oscquery_server Class Reference

The oscquery_server class allows to create a local OSCQuery server. More...

Detailed Description

The oscquery_server class allows to create a local OSCQuery server.

A device represents a tree of parameters.
Local devices map to real parameters on the executable libossia is used with. For instance the frequency of a filter, etc.
Devices can be mapped to different protocols: OSC, OSCQuery, Midi, etc.
For the sake of simplicity, the safeC++ (opp) binding ties together device and protocol implementation: OSCQuery protocol here.
Once a device has been created, it is possible to check what's in it by going to http://localhost:5678.
For more information on the OSCQuery protocol, please refer to the proposal: https://github.com/mrRay/OSCQueryProposal

Public Member Functions

 oscquery_server ()
 declares a (yet to be configured) OSCQuery server More...
 
 oscquery_server (std::string name, int oscPort=1234, int wsPort=5678)
 declares and configures an OSCQuery server More...
 
 ~oscquery_server ()
 OSCQuery Server default destructor.
 
void setup (std::string name, int oscPort=1234, int wsPort=5678)
 sets up an OSCQuery Server with the appropriate device name and ports More...
 
node get_root_node () const
 get this server's root opp::node More...
 
void set_echo (bool echo)
 enable/disable this server's echo More...
 
bool get_echo ()
 get this server's echo More...
 
void set_connection_callback (connection_callback c, void *ctx)
 set a callback to be called when a connection is made to this device More...
 
void remove_connection_callback ()
 remove the previously set connection_callback
 
void set_disconnection_callback (disconnection_callback c, void *ctx)
 set a callback to be called when a connection to this device is closed More...
 
void remove_disconnection_callback ()
 remove the previously set disconnection_callback
 
void set_add_node_callback (add_node_callback c, void *ctx)
 set a callback to be called when a client request a node creation More...
 
void remove_add_node_callback ()
 
void set_remove_node_callback (remove_node_callback c, void *ctx)
 set a callback to be called when a client request a node deletion More...
 
void remove_remove_node_callback ()
 
void set_rename_node_callback (rename_node_callback c, void *ctx)
 set a callback to be called when a client request a node renaming More...
 
void remove_rename_node_callback ()
 
bool connected () const
 Returns true if the server is connected.
 
ossia::net::device_baseget_raw_device_pointer ()
 Get the raw device pointer. More...
 

Constructor & Destructor Documentation

◆ oscquery_server() [1/2]

opp::oscquery_server::oscquery_server ( )

declares a (yet to be configured) OSCQuery server

A server can be created without arguments. It will then have to be configured later on with opp::oscquery_server::setup

◆ oscquery_server() [2/2]

opp::oscquery_server::oscquery_server ( std::string  name,
int  oscPort = 1234,
int  wsPort = 5678 
)

declares and configures an OSCQuery server

A server can be created and directly exposed using the OSCQuery protocol by giving it a name and std::optional OSC and websocket port numbers.

Parameters
namethe name of the OSCQuery server
oscPortthe OSC port to receive messages from (defaults to 1234)
wsPortthe websocket port the server uses to manage queries (defaults to 5678)

Member Function Documentation

◆ setup()

void opp::oscquery_server::setup ( std::string  name,
int  oscPort = 1234,
int  wsPort = 5678 
)

sets up an OSCQuery Server with the appropriate device name and ports

When created without arguments, a server can be exposed using the OSCQuery protocol by giving it a name and std::optional OSC and websocket port numbers.

Parameters
namethe name of the OSCQuery server
oscPortthe OSC port to receive messages from (defaults to 1234)
wsPortthe websocket port the server uses to manage queries (defaults to 5678)

◆ get_root_node()

node opp::oscquery_server::get_root_node ( ) const

get this server's root opp::node

The root node of the server can be useful to create sub_nodes, with opp::node::create_child and all opp::node::create_* methods.

Returns
this server's root opp::node

◆ set_echo()

void opp::oscquery_server::set_echo ( bool  echo)

enable/disable this server's echo

If echo is on, incoming values from the network will be reflected at the output of the device

◆ get_echo()

bool opp::oscquery_server::get_echo ( )

get this server's echo

If echo is on, incoming values from the network will be reflected at the output of the device

Returns
a boolean indicating if this server's echo is enabled

◆ set_connection_callback()

void opp::oscquery_server::set_connection_callback ( connection_callback  c,
void *  ctx 
)

set a callback to be called when a connection is made to this device

Parameters
cthe connection_callback
ctxthe callback context as a void*

◆ set_disconnection_callback()

void opp::oscquery_server::set_disconnection_callback ( disconnection_callback  c,
void *  ctx 
)

set a callback to be called when a connection to this device is closed

Parameters
cthe connection_callback
ctxthe callback context as a void*

◆ set_add_node_callback()

void opp::oscquery_server::set_add_node_callback ( add_node_callback  c,
void *  ctx 
)

set a callback to be called when a client request a node creation

Parameters
cthe node removing callback
ctxthe callback context as void*

◆ set_remove_node_callback()

void opp::oscquery_server::set_remove_node_callback ( remove_node_callback  c,
void *  ctx 
)

set a callback to be called when a client request a node deletion

Parameters
cthe node creation callback
ctxthe callback context as void*

◆ set_rename_node_callback()

void opp::oscquery_server::set_rename_node_callback ( rename_node_callback  c,
void *  ctx 
)

set a callback to be called when a client request a node renaming

Parameters
cthe node renaming callback
ctxthe callback context as void*

◆ get_raw_device_pointer()

ossia::net::device_base* opp::oscquery_server::get_raw_device_pointer ( )
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)

Returns
ossia::net::device_base*