### Function

# Qmi message_new_from_data

since: 1.24

#### Declaration [src]

    QmiMessage*
    qmi_message_new_from_data (
      QmiService service,
      guint8 client_id,
      GByteArray* qmi_data,
      GError** error
    )

#### Description [src]

Create a new `QmiMessage` for the given `service` and `client_id` and including the given QMI data buffer.

Whenever a complete QMI message is read, its data gets removed from the `qmi_data` buffer.

This method should be used instead of `qmi_message_new_from_raw()` if the input data doesn’t have QMUX headers.

Available since: 1.24

#### Parameters

`service`

  Type: `QmiService`

  A `QmiService`.

`client_id`

  Type: `guint8`

  Client ID of the originating control point.

`qmi_data`

  Type: An array of `guint8`

  Data buffer containing only the QMI part of the message.

  The argument will be modified by the function.
  The caller of the function takes ownership of the returned data, and is responsible for freeing it.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the function if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `QmiMessage`

A newly created `QmiMessage`, which should be freed with qmi_message_unref(). If `qmi_data` doesn’t contain a complete QMI data payload `NULL` is returned. If there is a complete QMI data payload but it appears not to be valid, `NULL` is returned and `error` is set.

The caller of the function takes ownership of the data, and is responsible for freeing it.