Top |
void | qrtr_bus_new () |
QrtrBus * | qrtr_bus_new_finish () |
QrtrNode * | qrtr_bus_peek_node () |
QrtrNode * | qrtr_bus_get_node () |
GList * | qrtr_bus_get_nodes () |
GList * | qrtr_bus_peek_nodes () |
void | qrtr_bus_wait_for_node () |
QrtrNode * | qrtr_bus_wait_for_node_finish () |
#define | QRTR_BUS_LOOKUP_TIMEOUT |
#define | QRTR_BUS_SIGNAL_NODE_ADDED |
#define | QRTR_BUS_SIGNAL_NODE_REMOVED |
QrtrBus |
QrtrBus sets up a socket that uses the QRTR IPC protocol and can call back into a client to tell them when new devices have appeared on the QRTR bus. It holds QrtrNodes that can be used to look up service and port information.
void qrtr_bus_new (guint lookup_timeout_ms
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Asynchronously creates a QrtrBus object.
This method will fail if the access to the QRTR bus is not possible, or if the initial lookup doesn't finish on time.
When lookup_timeout_ms
is 0, this method does not guarantee that the
initial bus lookup has already finished, the user should wait for the required
“node-added” and “service-added” signals before assuming the
nodes are accessible.
When the operation is finished, callback
will be invoked. You can then call
qrtr_bus_new_finish()
to get the result of the operation.
lookup_timeout_ms |
the timeout, in milliseconds, to wait for the initial bus lookup to complete. A zero timeout disables the lookup. |
|
cancellable |
optional GCancellable object, |
|
callback |
a GAsyncReadyCallback to call when the initialization is finished. |
|
user_data |
the data to pass to callback function. |
Since: 1.0
QrtrBus * qrtr_bus_new_finish (GAsyncResult *res
,GError **error
);
Finishes an operation started with qrtr_bus_new()
.
Since: 1.0
QrtrNode * qrtr_bus_peek_node (QrtrBus *self
,guint32 node_id
);
Get the QrtrNode with node ID node_id
, without increasing the reference count
on the returned object.
This method will fail if there is no node with the given node_id
in the QRTR bus.
a QrtrNode, or NULL
if none available.
Do not free the returned object, it is owned by self
.
[transfer none]
Since: 1.0
QrtrNode * qrtr_bus_get_node (QrtrBus *self
,guint32 node_id
);
Get the QrtrNode with node ID node_id
.
This method will fail if there is no node with the given node_id
in the QRTR bus.
a QrtrNode that must be freed with g_object_unref()
,
or NULL
if none available.
[transfer full]
Since: 1.0
GList *
qrtr_bus_get_nodes (QrtrBus *self
);
Gets a list of all the QrtrNode objects in the bus.
a list of
QrtrNode elements. The caller should free the result by using
g_list_free_full()
with g_object_unref()
as GDestroyNotify.
[transfer full][nullable][element-type QrtrNode]
Since: 1.0
GList *
qrtr_bus_peek_nodes (QrtrBus *self
);
Gets a list of all the QrtrNode objects in the bus, without increasing the reference count on the returned object or the list.
a list of
QrtrNode elements. The caller should not free the result, it is
owned by self
.
[transfer none][nullable][element-type QrtrNode]
Since: 1.0
void qrtr_bus_wait_for_node (QrtrBus *self
,guint32 node_id
,guint timeout_ms
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Asynchronously waits for the node with ID node_id
.
When the operation is finished callback
will be called. You can then call
qrtr_bus_wait_for_node_finish()
to get the result of the
operation.
self |
a QrtrBus. |
|
node_id |
the QRTR bus node ID to lookup. |
|
timeout_ms |
the timeout, in milliseconds, to wait for the node to appear in the bus. |
|
cancellable |
a GCancellable, or NULL. |
|
callback |
a GAsyncReadyCallback to call when the request is satisfied. |
|
user_data |
user data to pass to |
Since: 1.0
QrtrNode * qrtr_bus_wait_for_node_finish (QrtrBus *self
,GAsyncResult *res
,GError **error
);
Finishes an operation started with qrtr_bus_wait_for_node()
.
Since: 1.0
#define QRTR_BUS_LOOKUP_TIMEOUT "lookup-timeout"
Symbol defining the “lookup-timeout” property.
Since: 1.0
#define QRTR_BUS_SIGNAL_NODE_ADDED "node-added"
Symbol defining the “node-added” signal.
Since: 1.0
#define QRTR_BUS_SIGNAL_NODE_REMOVED "node-removed"
Symbol defining the “node-removed” signal.
Since: 1.0
“node-added”
signalvoid user_function (QrtrBus *self, guint node, gpointer user_data)
The ::node-added signal is emitted when a new node registers a service on the QRTR bus.
self |
the QrtrBus |
|
node |
the node ID of the node that has been added |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
Since: 1.0
“node-removed”
signalvoid user_function (QrtrBus *self, guint node, gpointer user_data)
The ::node-removed signal is emitted when a node deregisters all services from the QRTR bus.
self |
the QrtrBus |
|
node |
the node ID of the node that was removed |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
Since: 1.0