QmiMessageContext: libqmi-glib Reference Manual

## QmiMessageContext QmiMessageContext — the QMI message context |

## Functions

QmiMessageContext * | qmi_message_context_new ()
QmiMessageContext * | qmi_message_context_ref ()
void | qmi_message_context_unref ()
void | qmi_message_context_set_vendor_id ()
guint16 | qmi_message_context_get_vendor_id ()

## Types and Values

#define | QMI_MESSAGE_VENDOR_GENERIC
| QmiMessageContext

## Object Hierarchy

        GBoxed
        ╰── QmiMessageContext

## Description

The QmiMessageContext defines non-standard features of the QMI message associated with it, which may be required for a correct processing.

The main purpose of this type is to provide a common context when processing the request sent and the response received, so that the reception logic can know in advance the type of response expected. Therefore, when a context is given when sending a request with `qmi_device_command_full()`, the same context will then be applied for the associated response.

If there are multiple types of messages using the same service and command id, the context is flagged as vendor-specific automatically, by assigning a specific vendor id in the QmiMessageContext. This does not mean that the command will only be available for that specific vendor id, it is just a way to make a difference among commands that have the same command id and a totally different meaning. The actual vendor id value given in the context is therefore really irrelevant, as long as the vendor id is different to the other vendor ids specified for other commands reusing the same command id. In order to simplify the selection of the vendor id, the library will use the standard vendor-specific USB vendor id.

## Functions

### qmi_message_context_new ()

    QmiMessageContext *
    qmi_message_context_new (void);

Create a new empty QmiMessageContext.

#### Returns

a newly created QmiMessageContext. The returned value should be freed with `qmi_message_context_unref()`.

[transfer full]

Since: 1.18

### qmi_message_context_ref ()

    QmiMessageContext *
    qmi_message_context_ref (QmiMessageContext *self);

Atomically increments the reference count of `self` by one.

#### Parameters

self | a QmiMessageContext. |

#### Returns

the new reference to `self` .

[transfer full]

Since: 1.18

### qmi_message_context_unref ()

    void
    qmi_message_context_unref (QmiMessageContext *self);

Atomically decrements the reference count of `self` by one. If the reference count drops to 0, `self` is completely disposed.

#### Parameters

self | a QmiMessageContext. |

Since: 1.18

### qmi_message_context_set_vendor_id ()

    void
    qmi_message_context_set_vendor_id (QmiMessageContext *self,
                                       guint16 vendor_id);

Sets the vendor ID associated to the message.

#### Parameters

self | a QmiMessageContext. |
vendor_id | the vendor ID. |

Since: 1.18

### qmi_message_context_get_vendor_id ()

    guint16
    qmi_message_context_get_vendor_id (QmiMessageContext *self);

Gets the vendor ID associated to the message.

#### Parameters

self | a QmiMessageContext. |

#### Returns

the vendor ID.

Since: 1.18

## Types and Values

### QMI_MESSAGE_VENDOR_GENERIC

    #define QMI_MESSAGE_VENDOR_GENERIC 0x0000

Generic vendor id (0x0000).

Since: 1.18

### QmiMessageContext

    typedef struct _QmiMessageContext QmiMessageContext;

An opaque type representing a QMI message context.

Since: 1.18