XmmsClient
|
Macros | |
#define | XMMSC_SC_ENTITY_NAME_PATTERN "[_a-zA-Z][_a-zA-Z0-9]*" |
#define | GEN_SC_INTROSPECT_FUNC(entity, type) |
Functions | |
xmmsc_result_t * | xmmsc_sc_call (xmmsc_connection_t *c, int dest, xmmsv_t *method, xmmsv_t *pargs, xmmsv_t *nargs) |
Call a method in another client. More... | |
xmmsc_result_t * | xmmsc_sc_broadcast_subscribe (xmmsc_connection_t *c, int dest, xmmsv_t *broadcast) |
Subscribe to a broadcast from another client. More... | |
bool | xmmsc_sc_broadcast_emit (xmmsc_connection_t *c, xmmsv_t *broadcast, xmmsv_t *value) |
Emit a broadcast. More... | |
GEN_SC_INTROSPECT_FUNC (namespace, XMMSC_SC_INTERFACE_ENTITY_TYPE_NAMESPACE) | |
Introspect into a namespace. More... | |
GEN_SC_INTROSPECT_FUNC (method, XMMSC_SC_INTERFACE_ENTITY_TYPE_METHOD) | |
Introspect into a method. More... | |
GEN_SC_INTROSPECT_FUNC (broadcast, XMMSC_SC_INTERFACE_ENTITY_TYPE_BROADCAST) | |
Introspect into a client-to-client broadcast. More... | |
xmmsc_result_t * | xmmsc_sc_introspect_constant (xmmsc_connection_t *c, int dest, xmmsv_t *nms, const char *key) |
Convenience function to retrieve a constant from a namespace directly. More... | |
xmmsc_result_t * | xmmsc_sc_introspect_docstring (xmmsc_connection_t *c, int dest, xmmsv_t *path) |
Get the docstring from a method, broadcast or namespace. More... | |
xmmsc_sc_namespace_t * | xmmsc_sc_namespace_root (xmmsc_connection_t *c) |
Get the root namespace. More... | |
xmmsc_sc_namespace_t * | xmmsc_sc_namespace_lookup (xmmsc_connection_t *c, xmmsv_t *nms) |
Get an existing namespace from its full path. More... | |
xmmsc_sc_namespace_t * | xmmsc_sc_namespace_new (xmmsc_sc_namespace_t *parent, const char *name, const char *docstring) |
Create a new namespace. More... | |
xmmsc_sc_namespace_t * | xmmsc_sc_namespace_get (xmmsc_sc_namespace_t *parent, const char *name) |
Get an existing sub-namespace. More... | |
bool | xmmsc_sc_namespace_add_method (xmmsc_sc_namespace_t *nms, xmmsc_sc_method_t method, const char *name, const char *docstring, xmmsv_t *positional_args, xmmsv_t *named_args, bool va_positional, bool va_named, void *userdata) |
Create a new method. More... | |
bool | xmmsc_sc_namespace_add_method_noarg (xmmsc_sc_namespace_t *parent, xmmsc_sc_method_t method, const char *name, const char *docstring, void *userdata) |
Convenience wrapper around xmmsc_sc_method_new to declare a method that accepts no arguments. More... | |
bool | xmmsc_sc_namespace_add_broadcast (xmmsc_sc_namespace_t *nms, const char *name, const char *docstring) |
Create a new client-to-client broadcast. More... | |
#define GEN_SC_INTROSPECT_FUNC | ( | entity, | |
type | |||
) |
#define XMMSC_SC_ENTITY_NAME_PATTERN "[_a-zA-Z][_a-zA-Z0-9]*" |
GEN_SC_INTROSPECT_FUNC | ( | namespace | , |
XMMSC_SC_INTERFACE_ENTITY_TYPE_NAMESPACE | |||
) |
Introspect into a namespace.
The result will carry a dictionary of the form:
"name" : the namespace's name.
"docstring" : the namespace's docstring.
"constants" : a dictionary of constants.
"namespaces" : a list of names of subnamespaces.
"methods" : a list of descriptions of the methods in the namespace.
"broadcasts" : a list of descriptions of the broadcasts in the namespace.
c | The connection structure. |
dest | The non-zero id of the destination client. |
namespace | A list of strings forming the path to the remote namespace. Use an empty list to refer to the root namespace. |
GEN_SC_INTROSPECT_FUNC | ( | method | , |
XMMSC_SC_INTERFACE_ENTITY_TYPE_METHOD | |||
) |
Introspect into a method.
The result will carry a dictionary of the form:
"name" : the method's name.
"docstring" : the method's docstring.
"positional arguments" : a list of positional arguments.
"named arguments" : a list of named arguments.
"va positional" : whether or not the method accepts a variable number of positional arguments.
"va named" : whether or not the method accepts a variable number of named arguments.
c | The connection structure. |
dest | The non-zero id of the destination client. |
method | A list of strings forming the path to the remote method. |
GEN_SC_INTROSPECT_FUNC | ( | broadcast | , |
XMMSC_SC_INTERFACE_ENTITY_TYPE_BROADCAST | |||
) |
Introspect into a client-to-client broadcast.
The result will carry a dict of the form:
"name" : the broadcast's name.
"docstring" : the broadcast's docstring.
c | The connection structure. |
dest | The non-zero id of the destination client. |
broadcast | A list of strings forming the path to the remote broadcast. |
bool xmmsc_sc_broadcast_emit | ( | xmmsc_connection_t * | c, |
xmmsv_t * | broadcast, | ||
xmmsv_t * | value | ||
) |
Emit a broadcast.
c | The connection structure. |
broadcast | A non-empty list of strings specifying the broadcast path. |
value | The value to emit. Must not be NULL. |
xmmsc_result_t* xmmsc_sc_broadcast_subscribe | ( | xmmsc_connection_t * | c, |
int | dest, | ||
xmmsv_t * | broadcast | ||
) |
Subscribe to a broadcast from another client.
The returned result can be used to set up notifiers as usual.
c | The connection structuer. |
dest | The client that issues the broadcast. |
broadcast | A non-empty list of strings forming the path to the broadcast. |
xmmsc_result_t* xmmsc_sc_call | ( | xmmsc_connection_t * | c, |
int | dest, | ||
xmmsv_t * | method, | ||
xmmsv_t * | pargs, | ||
xmmsv_t * | nargs | ||
) |
Call a method in another client.
c | The connection structure. |
dest | The destination client's id. |
method | A non-empty list of strings forming the path to the method. |
pargs | A list of positional arguments. May be NULL. |
nargs | A dict of named arguments. May be NULL. |
xmmsc_result_t* xmmsc_sc_introspect_constant | ( | xmmsc_connection_t * | c, |
int | dest, | ||
xmmsv_t * | nms, | ||
const char * | key | ||
) |
Convenience function to retrieve a constant from a namespace directly.
c | The connection structure. |
dest | The nonzero destination client's id. |
nms | The path to the namespace in the remote client. Use an empty list to refer to the root namespace. |
key | The key to the constant. |
xmmsc_result_t* xmmsc_sc_introspect_docstring | ( | xmmsc_connection_t * | c, |
int | dest, | ||
xmmsv_t * | path | ||
) |
Get the docstring from a method, broadcast or namespace.
c | The connection structure. |
dest | The nonzero id of the destination client. |
path | The path to the remote entity. |
bool xmmsc_sc_namespace_add_broadcast | ( | xmmsc_sc_namespace_t * | nms, |
const char * | name, | ||
const char * | docstring | ||
) |
Create a new client-to-client broadcast.
nms | The parent namespace. |
name | The name of the broadcast. Must not be NULL. Must match XMMSC_SC_ENTITY_NAME_PATTERN. |
docstring | The docstring for the broadcast. |
bool xmmsc_sc_namespace_add_method | ( | xmmsc_sc_namespace_t * | nms, |
xmmsc_sc_method_t | method, | ||
const char * | name, | ||
const char * | docstring, | ||
xmmsv_t * | positional_args, | ||
xmmsv_t * | named_args, | ||
bool | va_positional, | ||
bool | va_named, | ||
void * | userdata | ||
) |
Create a new method.
nms | The parent namespace. |
method | The underlying function that will be called. |
name | The name of the method. Must not be NULL. Must match XMMSC_SC_ENTITY_NAME_PATTERN. |
docstring | The docstring of the method. |
positional_args | A list of positional arguments, or NULL to declare none. |
named_args | A list of named arguments, or NULL to declare none. |
va_positional | Whether or not this method accepts a variable number of positional arguments (in addition to positional_args). |
va_named | Whether or not this method accepts a extra named arguments (in addition to named_args). |
userdata | Will be passed to the underlying function. |
Referenced by xmmsc_sc_namespace_add_method_noarg().
bool xmmsc_sc_namespace_add_method_noarg | ( | xmmsc_sc_namespace_t * | parent, |
xmmsc_sc_method_t | method, | ||
const char * | name, | ||
const char * | docstring, | ||
void * | userdata | ||
) |
Convenience wrapper around xmmsc_sc_method_new to declare a method that accepts no arguments.
xmmsc_sc_namespace_t* xmmsc_sc_namespace_get | ( | xmmsc_sc_namespace_t * | parent, |
const char * | name | ||
) |
Get an existing sub-namespace.
parent | The parent namespace. |
nms | The name of the namespace. |
xmmsc_sc_namespace_t* xmmsc_sc_namespace_lookup | ( | xmmsc_connection_t * | c, |
xmmsv_t * | nms | ||
) |
Get an existing namespace from its full path.
c | The connection structure. |
nms | The path to the namespace. |
xmmsc_sc_namespace_t* xmmsc_sc_namespace_new | ( | xmmsc_sc_namespace_t * | parent, |
const char * | name, | ||
const char * | docstring | ||
) |
Create a new namespace.
parent | The parent namespace. |
name | The name of the new namespace. Must match XMMSC_SC_ENTITY_NAME_PATTERN. |
docstring | The docstring of the namespace. |
xmmsc_sc_namespace_t* xmmsc_sc_namespace_root | ( | xmmsc_connection_t * | c | ) |
Get the root namespace.
c | The connection structure. |