QrtrClient: libqrtr-glib Reference Manual

## QrtrClient QrtrClient — The QRTR client. |

## Functions

QrtrClient * | qrtr_client_new ()
QrtrNode * | qrtr_client_peek_node ()
QrtrNode * | qrtr_client_get_node ()
guint32 | qrtr_client_get_port ()
gboolean | qrtr_client_send ()

## Properties

QrtrNode * | client-node | Read / Write / Construct Only
guint | client-port | Read / Write / Construct Only

## Signals

void | client-message | Run Last

## Types and Values

#define | QRTR_CLIENT_NODE
#define | QRTR_CLIENT_PORT
#define | QRTR_CLIENT_SIGNAL_MESSAGE
struct | QrtrClient

## Object Hierarchy

        GObject
        ╰── QrtrClient

## Implemented Interfaces

QrtrClient implements GInitable.

## Description

The QrtrClient object represents a channel that can be used to communicate with a QrtrNode in a given port.

## Functions

### qrtr_client_new ()

    QrtrClient *
    qrtr_client_new (QrtrNode *node,
                     guint32 port,
                     GCancellable *cancellable,
                     GError **error);

Creates a new QrtrClient to communicate with `port` at QrtrNode.

#### Parameters

node | a QrtrNode. |
port | a node port. |
cancellable | optional GCancellable object, `NULL` to ignore. |
error | rReturn location for error or `NULL`. |

#### Returns

a newly allocated QrtrClient, or `NULL` if `error` is set.

[transfer full]

Since: 1.0

### qrtr_client_peek_node ()

    QrtrNode *
    qrtr_client_peek_node (QrtrClient *self);

Get the QrtrNode that this client refers to, without increasing the reference count on the returned object.

#### Parameters

self | a QrtrClient. |

#### Returns

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

[transfer none]

Since: 1.0

### qrtr_client_get_node ()

    QrtrNode *
    qrtr_client_get_node (QrtrClient *self);

Get the QrtrNode that this client refers to.

#### Parameters

self | a QrtrClient. |

#### Returns

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

[transfer full]

Since: 1.0

### qrtr_client_get_port ()

    guint32
    qrtr_client_get_port (QrtrClient *self);

Gets the node port where this client communicates.

#### Parameters

self | a QrtrClient. |

#### Returns

the node port.

Since: 1.0

### qrtr_client_send ()

    gboolean
    qrtr_client_send (QrtrClient *self,
                      GByteArray *message,
                      GCancellable *cancellable,
                      GError **error);

Sends a message to the port at the node.

#### Parameters

self | a QrtrClient. |
message | the message. |
cancellable | a GCancellable. |
error | Return location for GError or `NULL`. |

#### Returns

`TRUE` if the message is sent, or `FALSE` if `error` is set.

Since: 1.0

## Types and Values

### QRTR_CLIENT_NODE

    #define QRTR_CLIENT_NODE "client-node"

The QRTR node this client refers to.

Since: 1.0

### QRTR_CLIENT_PORT

    #define QRTR_CLIENT_PORT "client-port"

The QRTR node port this client refers to.

Since: 1.0

### QRTR_CLIENT_SIGNAL_MESSAGE

    #define QRTR_CLIENT_SIGNAL_MESSAGE "client-message"

Symbol defining the “client-message” signal.

Since: 1.0

### struct QrtrClient

    struct QrtrClient;

## Property Details

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

      “client-node”              QrtrNode *

The QRTR node.

Owner: QrtrClient

Flags: Read / Write / Construct Only

Since: 1.0

### The `“client-port”` property

      “client-port”              guint

The QRTR node port.

Owner: QrtrClient

Flags: Read / Write / Construct Only

Default value: 0

Since: 1.0

## Signal Details

### The `“client-message”` signal

    void
    user_function (QrtrClient *self,
                   GByteArray *message,
                   gpointer    user_data)

The ::client-message signal is emitted when a message is received from the port in the node.

There must be one single user connected to this signal, because it is not guaranteed that the contents of the `message` byte array aren't modified by multiple users. In other words, the user connected to this signal may modify the contents of the `message` byte array if needed.

#### Parameters

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

Flags: Run Last

Since: 1.0