OSSIA
Open Scenario System for Interactive Application
Loading...
Searching...
No Matches
ossia::oscquery_asio::oscquery_server_protocol_base Class Reference

Implementation of an oscquery server. More...

Inheritance diagram for ossia::oscquery_asio::oscquery_server_protocol_base:
ossia::net::protocol_base

Detailed Description

Implementation of an oscquery server.

Public Types

using connection_handler = std::weak_ptr<void>
Public Types inherited from ossia::net::protocol_base
enum  flags { SupportsMultiplex = (1 << 0) }

Public Member Functions

 oscquery_server_protocol_base (ossia::net::network_context_ptr ctx, uint16_t, uint16_t)=delete
 oscquery_server_protocol_base (ossia::net::network_context_ptr ctx, const std::vector< ossia::net::osc_server_configuration > &conf, uint16_t ws_port, bool forceWS)
bool pull (net::parameter_base &) override
 Pulls a value from the server synchronously.
std::future< void > pull_async (net::parameter_base &) override
 Pulls a value from the server asynchronously.
void request (net::parameter_base &) override
 Request an update on a value.
bool push (const net::parameter_base &, const ossia::value &v) override
 Send a value to the network.
bool push_raw (const ossia::net::full_parameter_data &parameter_base) override
 Send a value to the network.
bool push_bundle (const std::vector< const ossia::net::parameter_base * > &) override
 Send many values in one go if the protocol supports it.
bool push_raw_bundle (const std::vector< ossia::net::full_parameter_data > &) override
 Send a value to the network.
bool echo_incoming_message (const ossia::net::message_origin_identifier &, const ossia::net::parameter_base &, const ossia::value &v) override
 called when some protocol on the same device received a message.
bool observe (net::parameter_base &, bool) override
 Notify the network that a parameter should be listened to.
bool observe_quietly (net::parameter_base &, bool) override
 Begin observation without notifying the other computers.
bool update (net::node_base &b) override
 If the protocol supports it, request the namespace corresponding to this node. If the update takes too long, nodes may be dropped as there is a default timeout.
void set_device (net::device_base &dev) override
 It is mandatory to call this function from device implementations, when the protocol is set.
void stop () override
ossia::net::device_base & get_device () const noexcept
int get_ws_port () const noexcept
bool force_ws () const noexcept
void set_force_ws (bool forceWS) noexcept
const std::vector< ossia::net::osc_server_configuration > & get_transports () const noexcept
Public Member Functions inherited from ossia::net::protocol_base
 protocol_base (flags f)
 protocol_base (const protocol_base &)=delete
 protocol_base (protocol_base &&)=delete
protocol_base & operator= (const protocol_base &)=delete
protocol_base & operator= (protocol_base &&)=delete
virtual bool push (const parameter_base &, ossia::value &&v)
bool push (const parameter_base &p)
virtual bool push_bundle (std::span< ossia::bundle_element >)
virtual bool push_bundle_bounded (std::span< ossia::bundle_element >)
virtual bool publish (const parameter_base &)
 Notify the network that a parameter is to be published.
virtual bool unpublish (const parameter_base &)
 Notify the network that a parameter is to be removed.
virtual std::future< void > update_async (node_base &node_base)
 If the protocol supports it, request the namespace corresponding to this node.
virtual void set_logger (const network_logger &l)
 Replace the loggers used.
virtual const network_logger & get_logger () const noexcept
virtual bool connected () const noexcept
virtual void connect ()
virtual void start_execution ()
virtual void stop_execution ()
virtual void pre_tick (std::size_t buffer_size)
virtual void set_feedback (bool feedback)
flags get_flags () const noexcept
bool test_flag (flags f) const noexcept

Public Attributes

Nano::Signal< void(const std::string &)> onClientConnected
Nano::Signal< void(const std::string &)> onClientDisconnected
Public Attributes inherited from ossia::net::protocol_base
Nano::Signal< void()> on_connection_open
Nano::Signal< void()> on_connection_closed
Nano::Signal< void()> on_connection_failure

Protected Member Functions

 oscquery_server_protocol_base (ossia::net::network_context_ptr ctx)=delete
void on_osc_message (const oscpack::ReceivedMessage &m)
void process_raw_osc_data (const char *data, std::size_t sz)
oscquery_client * find_client (const connection_handler &hdl)
void add_node (std::string_view path, const string_map< std::string > &parameters)
void remove_node (std::string_view path, const std::string &node)
void rename_node (std::string_view node, const std::string &new_name)
void on_connectionOpen (const connection_handler &hdl)
void on_connectionClosed (const connection_handler &hdl)
void on_nodeCreated (const ossia::net::node_base &)
void on_nodeRemoved (const ossia::net::node_base &)
void on_parameterChanged (const ossia::net::parameter_base &)
void on_attributeChanged (const ossia::net::node_base &, std::string_view attr)
void on_nodeRenamed (const ossia::net::node_base &n, std::string oldname)
template<typename T>
bool push_impl (const T &addr, const ossia::value &v)
bool write_impl (std::string_view data, bool critical)
void update_zeroconf ()
ossia::net::server_reply on_text_ws_message (const connection_handler &hdl, const std::string &message)
ossia::net::server_reply on_binary_ws_message (const connection_handler &hdl, const std::string &message)

Protected Attributes

ossia::net::network_context_ptr m_context
std::unique_ptr< ossia::net::websocket_server > m_websocketServer
net::zeroconf_server m_zeroconfServerWS
std::vector< ossia::net::osc_server_configuration > m_oscConf
net::listened_parameters m_listening
clients m_clients
std::atomic_int m_clientCount {}
ossia::net::device_base * m_device {}
mutex_t m_clientsMutex
uint16_t m_wsPort {}
std::atomic_bool m_forceWS {}
Protected Attributes inherited from ossia::net::protocol_base
const flags m_flags {}
network_logger m_logger

Member Function Documentation

◆ pull()

bool ossia::oscquery_asio::oscquery_server_protocol_base::pull ( net::parameter_base & )
overridevirtual

Pulls a value from the server synchronously.

Returns
True if the value was correctly retrieved.

The server cannot pull because it can have multiple clients.

Implements ossia::net::protocol_base.

◆ pull_async()

std::future< void > ossia::oscquery_asio::oscquery_server_protocol_base::pull_async ( net::parameter_base & )
overridevirtual

Pulls a value from the server asynchronously.

Returns
A future that will be set when the value is received.

Reimplemented from ossia::net::protocol_base.

◆ request()

void ossia::oscquery_asio::oscquery_server_protocol_base::request ( net::parameter_base & )
overridevirtual

Request an update on a value.

Reimplemented from ossia::net::protocol_base.

◆ push()

bool ossia::oscquery_asio::oscquery_server_protocol_base::push ( const net::parameter_base & ,
const ossia::value & v )
overridevirtual

Send a value to the network.

Implements ossia::net::protocol_base.

◆ push_raw()

bool ossia::oscquery_asio::oscquery_server_protocol_base::push_raw ( const ossia::net::full_parameter_data & )
overridevirtual

Send a value to the network.

Implements ossia::net::protocol_base.

◆ push_bundle()

bool ossia::oscquery_asio::oscquery_server_protocol_base::push_bundle ( const std::vector< const ossia::net::parameter_base * > & v)
overridevirtual

Send many values in one go if the protocol supports it.

Reimplemented from ossia::net::protocol_base.

◆ push_raw_bundle()

bool ossia::oscquery_asio::oscquery_server_protocol_base::push_raw_bundle ( const std::vector< ossia::net::full_parameter_data > & v)
overridevirtual

Send a value to the network.

Reimplemented from ossia::net::protocol_base.

◆ echo_incoming_message()

bool ossia::oscquery_asio::oscquery_server_protocol_base::echo_incoming_message ( const ossia::net::message_origin_identifier & ,
const ossia::net::parameter_base & ,
const ossia::value & v )
overridevirtual

called when some protocol on the same device received a message.

This can be used to echo the message to other protocols on the same device.

Reimplemented from ossia::net::protocol_base.

◆ observe()

bool ossia::oscquery_asio::oscquery_server_protocol_base::observe ( net::parameter_base & ,
bool  )
overridevirtual

Notify the network that a parameter should be listened to.

In some protocols (Minuit, OSCQuery), this may send a message to the other client so that it regularly sends values of this parameter to the local computer.

If a parameter is listened to, when a message is received, parameter_base::setValue will be called, which will notify the local signals. Else, parameter_base::setValueQuiet will be called : the value will be updated but the signals won't be notified.

Implements ossia::net::protocol_base.

◆ observe_quietly()

bool ossia::oscquery_asio::oscquery_server_protocol_base::observe_quietly ( net::parameter_base & ,
bool  )
overridevirtual

Begin observation without notifying the other computers.

Reimplemented from ossia::net::protocol_base.

◆ update()

bool ossia::oscquery_asio::oscquery_server_protocol_base::update ( net::node_base & node_base)
overridevirtual

If the protocol supports it, request the namespace corresponding to this node. If the update takes too long, nodes may be dropped as there is a default timeout.

Implements ossia::net::protocol_base.

◆ set_device()

void ossia::oscquery_asio::oscquery_server_protocol_base::set_device ( net::device_base & dev)
overridevirtual

It is mandatory to call this function from device implementations, when the protocol is set.

Reimplemented from ossia::net::protocol_base.

◆ stop()

void ossia::oscquery_asio::oscquery_server_protocol_base::stop ( )
overridevirtual

Reimplemented from ossia::net::protocol_base.