QrtrNode: libqrtr-glib Reference Manual

## QrtrNode QrtrNode — QRTR node handler. |

## Functions

guint32 | qrtr_node_service_info_get_service ()
guint32 | qrtr_node_service_info_get_port ()
guint32 | qrtr_node_service_info_get_version ()
guint32 | qrtr_node_service_info_get_instance ()
void | qrtr_node_service_info_free ()
guint32 | qrtr_node_get_id ()
QrtrBus * | qrtr_node_peek_bus ()
QrtrBus * | qrtr_node_get_bus ()
GList * | qrtr_node_peek_service_info_list ()
GList * | qrtr_node_get_service_info_list ()
gint32 | qrtr_node_lookup_port ()
gint32 | qrtr_node_lookup_service ()
void | qrtr_node_wait_for_services ()
gboolean | qrtr_node_wait_for_services_finish ()

## Properties

QrtrBus * | bus | Read / Write / Construct Only
guint | node-id | Read / Write / Construct Only

## Signals

void | node-removed | Run Last
void | service-added | Run Last
void | service-removed | Run Last

## Types and Values

| QrtrNodeServiceInfo
#define | QRTR_NODE_BUS
#define | QRTR_NODE_ID
#define | QRTR_NODE_SIGNAL_SERVICE_ADDED
#define | QRTR_NODE_SIGNAL_SERVICE_REMOVED
#define | QRTR_NODE_SIGNAL_REMOVED
struct | QrtrNode

## Object Hierarchy

        GBoxed
        ╰── QrtrNodeServiceInfo
        GObject
        ╰── QrtrNode

## Description

QrtrNode represents a device on the QRTR bus and can be used to look up services published by that device.

## Functions

### qrtr_node_service_info_get_service ()

    guint32
    qrtr_node_service_info_get_service (QrtrNodeServiceInfo *info);

Get the service number from the QrtrNodeServiceInfo.

#### Parameters

info | a QrtrNodeServiceInfo. |

#### Returns

the service number.

Since: 1.0

### qrtr_node_service_info_get_port ()

    guint32
    qrtr_node_service_info_get_port (QrtrNodeServiceInfo *info);

Get the port number from the QrtrNodeServiceInfo.

#### Parameters

info | a QrtrNodeServiceInfo. |

#### Returns

the port number.

Since: 1.0

### qrtr_node_service_info_get_version ()

    guint32
    qrtr_node_service_info_get_version (QrtrNodeServiceInfo *info);

Get the version number from the QrtrNodeServiceInfo.

#### Parameters

info | a QrtrNodeServiceInfo. |

#### Returns

the version number.

Since: 1.0

### qrtr_node_service_info_get_instance ()

    guint32
    qrtr_node_service_info_get_instance (QrtrNodeServiceInfo *info);

Get the instance number from the QrtrNodeServiceInfo.

#### Parameters

info | a QrtrNodeServiceInfo. |

#### Returns

the instance number.

Since: 1.0

### qrtr_node_service_info_free ()

    void
    qrtr_node_service_info_free (QrtrNodeServiceInfo *info);

Frees a single QrtrNodeServiceInfo, as returned by `qrtr_node_get_service_info_list()`.

#### Parameters

info | a QrtrNodeServiceInfo. |

Since: 1.0

### qrtr_node_get_id ()

    guint32
    qrtr_node_get_id (QrtrNode *self);

Gets the node ID in the QRTR bus.

#### Parameters

self | a QrtrNode. |

#### Returns

the node id.

Since: 1.0

### qrtr_node_peek_bus ()

    QrtrBus *
    qrtr_node_peek_bus (QrtrNode *self);

Get the QrtrBus where this node is available, without increasing the reference count on the returned object.

#### Parameters

self | a QrtrNode. |

#### Returns

a QrtrBus. Do not free the returned object, it is owned by `self` .

[transfer none]

Since: 1.0

### qrtr_node_get_bus ()

    QrtrBus *
    qrtr_node_get_bus (QrtrNode *self);

Get the QrtrBus where this node is available.

#### Parameters

self | a QrtrNode. |

#### Returns

a QrtrBus that must be freed with `g_object_unref()`.

[transfer full]

Since: 1.0

### qrtr_node_peek_service_info_list ()

    GList *
    qrtr_node_peek_service_info_list (QrtrNode *self);

Get the list of services currently supported by the QrtrNode.

#### Parameters

self | a QrtrNode. |

#### Returns

a GList of QrtrNodeServiceInfo elements. Do not free the returned object, it is owned by `self` .

[element-type QrtrNodeServiceInfo][transfer none]

Since: 1.0

### qrtr_node_get_service_info_list ()

    GList *
    qrtr_node_get_service_info_list (QrtrNode *self);

Get the list of services currently supported by the QrtrNode.

#### Parameters

self | a QrtrNode. |

#### Returns

a GList of QrtrNodeServiceInfo elements, that must be freed with `g_list_free_full()` using `qrtr_node_service_info_free()` as GDestroyNotify.

[element-type QrtrNodeServiceInfo][transfer full]

Since: 1.0

### qrtr_node_lookup_port ()

    gint32
    qrtr_node_lookup_port (QrtrNode *self,
                           guint32 service);

If a server has announced itself for the given node and service number, return the port number of that service.

If multiple instances are registered, this method returns the port number for the service with the highest version number.

#### Parameters

self | a QrtrNode. |
service | a service number. |

#### Returns

the port number of the service in the node, or -1 if not found.

Since: 1.0

### qrtr_node_lookup_service ()

    gint32
    qrtr_node_lookup_service (QrtrNode *self,
                              guint32 port);

If a server has announced itself for the given node and port number, return the service it serves.

#### Parameters

self | a QrtrNode. |
port | a port number. |

#### Returns

the service number, or -1 if not found.

Since: 1.0

### qrtr_node_wait_for_services ()

    void
    qrtr_node_wait_for_services (QrtrNode *self,
                                 GArray *services,
                                 guint timeout_ms,
                                 GCancellable *cancellable,
                                 GAsyncReadyCallback callback,
                                 gpointer user_data);

Asynchronously waits until all the services listed in `services` are present on the node.

The operation may fail if any of the requested services isn't notified, or if the node is removed from the bus while waiting.

When the operation is finished `callback` will be called. You can then call `qrtr_node_wait_for_services_finish()` to get the result of the operation.

#### Parameters

self | a QrtrNode. |
services | a GArray of service types. | [in][element-type guint32]
timeout_ms | the timeout, in milliseconds, to wait for the the services to be exposed in the node. |
cancellable | a GCancellable, or NULL. |
callback | a GAsyncReadyCallback to call when the request is satisfied. |
user_data | user data to pass to `callback` . |

Since: 1.0

### qrtr_node_wait_for_services_finish ()

    gboolean
    qrtr_node_wait_for_services_finish (QrtrNode *self,
                                        GAsyncResult *result,
                                        GError **error);

Finishes an operation started with `qrtr_node_wait_for_services()`.

#### Parameters

self | a QrtrNode. |
result | a GAsyncResult. |
error | Return location for GError or `NULL`. |

#### Returns

`TRUE` if all requested services are present on this node, or `FALSE` if `error` is set.

Since: 1.0

## Types and Values

### QrtrNodeServiceInfo

    typedef struct _QrtrNodeServiceInfo QrtrNodeServiceInfo;

Information for a service instance in the QrtrNode.

Since: 1.0

### QRTR_NODE_BUS

    #define QRTR_NODE_BUS "bus"

The QRTR bus.

Since: 1.0

### QRTR_NODE_ID

    #define QRTR_NODE_ID "node-id"

The node id.

Since: 1.0

### QRTR_NODE_SIGNAL_SERVICE_ADDED

    #define QRTR_NODE_SIGNAL_SERVICE_ADDED "service-added"

Symbol defining the “service-added” signal.

Since: 1.0

### QRTR_NODE_SIGNAL_SERVICE_REMOVED

    #define QRTR_NODE_SIGNAL_SERVICE_REMOVED "service-removed"

Symbol defining the “service-removed” signal.

Since: 1.0

### QRTR_NODE_SIGNAL_REMOVED

    #define QRTR_NODE_SIGNAL_REMOVED "node-removed"

Symbol defining the “node-removed” signal.

Since: 1.0

### struct QrtrNode

    struct QrtrNode;

## Property Details

### The `“bus”` property

      “bus”                      QrtrBus *

QRTR bus.

Owner: QrtrNode

Flags: Read / Write / Construct Only

Since: 1.0

### The `“node-id”` property

      “node-id”                  guint

ID of the QRTR node.

Owner: QrtrNode

Flags: Read / Write / Construct Only

Default value: 0

Since: 1.0

## Signal Details

### The `“node-removed”` signal

    void
    user_function (QrtrNode *self,
                   gpointer  user_data)

The ::node-removed signal is emitted when the node fully disappears from the QRTR bus.

#### Parameters

self | the QrtrNode |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.0

### The `“service-added”` signal

    void
    user_function (QrtrNode *self,
                   guint     service,
                   gpointer  user_data)

The ::service-added signal is emitted when a new service registers on the QRTR node.

#### Parameters

self | the QrtrNode |
service | the service ID of the service that has been added |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.0

### The `“service-removed”` signal

    void
    user_function (QrtrNode *self,
                   guint     service,
                   gpointer  user_data)

The ::service-removed signal is emitted when a service deregisters from the QRTR node.

#### Parameters

self | the QrtrNode |
service | the service ID of the service that was removed |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.0