OSSIA
Open Scenario System for Interactive Application
Device

Device tree management. More...

Detailed Description

Device tree management.

See also
ossia::net::device_base

Functions

OSSIA_EXPORT ossia_device_t ossia_device_create (ossia_protocol_t protocol, const char *name)
 Create a device. More...
 
OSSIA_EXPORT void ossia_device_free (ossia_device_t device)
 Free a device instance. More...
 
OSSIA_EXPORT void ossia_device_reset_static ()
 Free the global device table. More...
 
OSSIA_EXPORT int ossia_device_update_namespace (ossia_device_t device)
 Request the nodes of a server if the protocol handles it. More...
 
OSSIA_EXPORT ossia_node_t ossia_device_get_root_node (ossia_device_t device)
 Get the root node of a device. More...
 
OSSIA_EXPORT const char * ossia_device_get_name (ossia_device_t device)
 Get the name of a device. More...
 
OSSIA_EXPORT ossia_node_callback_idx_t ossia_device_add_node_created_callback (ossia_device_t device, ossia_node_callback_t callback, void *ctx)
 Add a callback called when a node is created in a device. More...
 
OSSIA_EXPORT void ossia_device_remove_node_created_callback (ossia_device_t device, ossia_node_callback_idx_t index)
 Remove a callback added with ossia_device_add_node_created_callback. More...
 
OSSIA_EXPORT ossia_node_callback_idx_t ossia_device_add_node_removing_callback (ossia_device_t device, ossia_node_callback_t callback, void *ctx)
 Add a callback called when a node is removed in a device. More...
 
OSSIA_EXPORT void ossia_device_remove_node_removing_callback (ossia_device_t device, ossia_node_callback_idx_t index)
 Remove a callback added with ossia_device_add_node_removing_callback. More...
 
OSSIA_EXPORT ossia_parameter_callback_idx_t ossia_device_add_parameter_deleting_callback (ossia_device_t device, ossia_parameter_callback_t callback, void *ctx)
 Add a callback called when a parameter is removed in a device. More...
 
OSSIA_EXPORT void ossia_device_remove_parameter_deleting_callback (ossia_device_t device, ossia_parameter_callback_idx_t index)
 Remove a callback added with ossia_device_add_parameter_deleting_callback. More...
 

Function Documentation

◆ ossia_device_create()

OSSIA_EXPORT ossia_device_t ossia_device_create ( ossia_protocol_t  protocol,
const char *  name 
)

Create a device.

ossia_device_create takes ownership of the protocol ; it must not be used afterwards.

See also
ossia::net::device_base
Note
Multithread guarantees: Safe

◆ ossia_device_free()

OSSIA_EXPORT void ossia_device_free ( ossia_device_t  device)

Free a device instance.

Note
Multithread guarantees: Safe

◆ ossia_device_reset_static()

OSSIA_EXPORT void ossia_device_reset_static ( )

Free the global device table.

The devices are automatically registered in a table. This function frees and removes all the registered devices.

Note
Multithread guarantees: Safe

◆ ossia_device_update_namespace()

OSSIA_EXPORT int ossia_device_update_namespace ( ossia_device_t  device)

Request the nodes of a server if the protocol handles it.

Parameters
deviceThe device which must be updated.
See also
ossia::net::protocol_base::update
Note
Multithread guarantees: MT-Safe

◆ ossia_device_get_root_node()

OSSIA_EXPORT ossia_node_t ossia_device_get_root_node ( ossia_device_t  device)

Get the root node of a device.

Note
Never null.
Returns
The node corresponding to the '/' address.
See also
ossia::net::device_base::get_root_node
Note
Multithread guarantees: Data-Safe

◆ ossia_device_get_name()

OSSIA_EXPORT const char* ossia_device_get_name ( ossia_device_t  device)

Get the name of a device.

Note
The caller has the ownership of the returned string. It should be freed with free()
Multithread guarantees: MT-Safe

◆ ossia_device_add_node_created_callback()

OSSIA_EXPORT ossia_node_callback_idx_t ossia_device_add_node_created_callback ( ossia_device_t  device,
ossia_node_callback_t  callback,
void *  ctx 
)

Add a callback called when a node is created in a device.

Parameters
deviceDevice on which the callback must be added.
callbackFunction to be called.
ctxWill be passed to the callback.
Returns
An identifier to be able to remove the callback on a later date.
See also
ossia::net::device_base::on_node_created
Note
Multithread guarantees: MT-Safe. The callback is called from the thread where the modification occurred.

◆ ossia_device_remove_node_created_callback()

OSSIA_EXPORT void ossia_device_remove_node_created_callback ( ossia_device_t  device,
ossia_node_callback_idx_t  index 
)

Remove a callback added with ossia_device_add_node_created_callback.

Parameters
deviceDevice on which the callback must be removed.
indexIndex of the callback to remove.
See also
ossia::net::device_base::on_node_created
Note
Multithread guarantees: MT-Safe.
The callback index must not be used afterwards

◆ ossia_device_add_node_removing_callback()

OSSIA_EXPORT ossia_node_callback_idx_t ossia_device_add_node_removing_callback ( ossia_device_t  device,
ossia_node_callback_t  callback,
void *  ctx 
)

Add a callback called when a node is removed in a device.

Parameters
deviceDevice on which the callback must be added.
callbackFunction to be called.
ctxWill be passed to the callback.
Returns
An identifier to be able to remove the callback on a later date.
See also
ossia::net::device_base::on_node_removing
Note
Multithread guarantees: MT-Safe. The callback is called from the thread where the modification occurred.

◆ ossia_device_remove_node_removing_callback()

OSSIA_EXPORT void ossia_device_remove_node_removing_callback ( ossia_device_t  device,
ossia_node_callback_idx_t  index 
)

Remove a callback added with ossia_device_add_node_removing_callback.

Parameters
deviceDevice on which the callback must be removed.
indexIndex of the callback to remove.
See also
ossia::net::device_base::on_node_created
Note
Multithread guarantees: MT-Safe.
The callback index must not be used afterwards

◆ ossia_device_add_parameter_deleting_callback()

OSSIA_EXPORT ossia_parameter_callback_idx_t ossia_device_add_parameter_deleting_callback ( ossia_device_t  device,
ossia_parameter_callback_t  callback,
void *  ctx 
)

Add a callback called when a parameter is removed in a device.

Parameters
deviceDevice on which the callback must be added.
callbackFunction to be called.
ctxWill be passed to the callback.
Returns
An identifier to be able to remove the callback on a later date.
See also
ossia::net::device_base::on_parameter_removing
Note
Multithread guarantees: MT-Safe. The callback is called from the thread where the modification occurred.

◆ ossia_device_remove_parameter_deleting_callback()

OSSIA_EXPORT void ossia_device_remove_parameter_deleting_callback ( ossia_device_t  device,
ossia_parameter_callback_idx_t  index 
)

Remove a callback added with ossia_device_add_parameter_deleting_callback.

Parameters
deviceDevice on which the callback must be removed.
indexIndex of the callback to remove.
See also
ossia::net::device_base::on_parameter_removing
Note
Multithread guarantees: MT-Safe.
The callback index must not be used afterwards