OSSIA
Open Scenario System for Interactive Application
Loading...
Searching...
No Matches
ossia::net::hid_protocol Class Referencefinal
Inheritance diagram for ossia::net::hid_protocol:
ossia::net::protocol_base

Detailed Description

Generic HID device.

Where the report descriptor can be read, each input and output usage gets a parameter under /input and /output. Raw reports are always available under /raw:

  • /raw/input: every input report, as a list of bytes (report id first when the device numbers its reports)
  • /raw/output: a list of bytes, report id first, written as an output report
  • /raw/feature/send: a list of bytes, report id first, sent as a feature report
  • /raw/feature/get: a report id; the report read back lands in /raw/feature/value

Public Member Functions

 hid_protocol (ossia::net::network_context_ptr ctx, const hid_device_configuration &conf)
 hid_protocol (const hid_protocol &)=delete
hid_protocol & operator= (const hid_protocol &)=delete
void set_device (ossia::net::device_base &dev) override
 It is mandatory to call this function from device implementations, when the protocol is set.
bool pull (ossia::net::parameter_base &) override
 Pulls a value from the server synchronously.
bool push (const ossia::net::parameter_base &, const ossia::value &v) override
 Send a value to the network.
bool push_raw (const ossia::net::full_parameter_data &) override
 Send a value to the network.
bool observe (ossia::net::parameter_base &, bool) override
 Notify the network that a parameter should be listened to.
bool update (ossia::net::node_base &) 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.
bool connected () const noexcept override
void stop () override
const hid_device_info & info () const noexcept
const hid::report_descriptor & descriptor () 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 std::future< void > pull_async (parameter_base &)
 Pulls a value from the server asynchronously.
virtual void request (parameter_base &)
 Request an update on a value.
virtual bool push (const parameter_base &, ossia::value &&v)
bool push (const parameter_base &p)
virtual bool echo_incoming_message (const message_origin_identifier &, const parameter_base &, const ossia::value &v)
 called when some protocol on the same device received a message.
virtual bool push_bundle (const std::vector< const ossia::net::parameter_base * > &)
 Send many values in one go if the protocol supports it.
virtual bool push_bundle (std::span< ossia::bundle_element >)
virtual bool push_bundle_bounded (std::span< ossia::bundle_element >)
virtual bool push_raw_bundle (const std::vector< full_parameter_data > &)
 Send a value to the network.
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 bool observe_quietly (parameter_base &, bool)
 Begin observation without notifying the other computers.
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 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

Additional Inherited Members

Public Types inherited from ossia::net::protocol_base
enum  flags { SupportsMultiplex = (1 << 0) }
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 Attributes inherited from ossia::net::protocol_base
const flags m_flags {}
network_logger m_logger

Member Function Documentation

◆ set_device()

void ossia::net::hid_protocol::set_device ( ossia::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.

◆ pull()

bool ossia::net::hid_protocol::pull ( ossia::net::parameter_base & )
overridevirtual

Pulls a value from the server synchronously.

Returns
True if the value was correctly retrieved.

Implements ossia::net::protocol_base.

◆ push()

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

Send a value to the network.

Implements ossia::net::protocol_base.

◆ push_raw()

bool ossia::net::hid_protocol::push_raw ( const ossia::net::full_parameter_data & )
overridevirtual

Send a value to the network.

Implements ossia::net::protocol_base.

◆ observe()

bool ossia::net::hid_protocol::observe ( ossia::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.

◆ update()

bool ossia::net::hid_protocol::update ( ossia::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.

◆ connected()

bool ossia::net::hid_protocol::connected ( ) const
overridevirtualnoexcept

Reimplemented from ossia::net::protocol_base.

◆ stop()

void ossia::net::hid_protocol::stop ( )
overridevirtual

Reimplemented from ossia::net::protocol_base.