Qmi.Device.command_abortable

### Method

# Qmi Devicecommand_abortable

since: 1.24

#### Declaration [src]

    void
    qmi_device_command_abortable (
      QmiDevice* self,
      QmiMessage* message,
      QmiMessageContext* message_context,
      guint timeout,
      QmiDeviceCommandAbortableBuildRequestFn abort_build_request_fn,
      QmiDeviceCommandAbortableParseResponseFn abort_parse_response_fn,
      gpointer abort_user_data,
      GDestroyNotify abort_user_data_free,
      GCancellable* cancellable,
      GAsyncReadyCallback callback,
      gpointer user_data
    )

#### Description [src]

Asynchronously sends a `QmiMessage` to the device.

The message will be processed according to the specific `message_context` given.

If the operation is cancelled via `cancellable`, an abort message will be sent to the device in order to really abort the ongoing operation. The `qmi_device_command_abortable()` method will not finish until either a successful reply is received from the device or otherwise the command abortion is confirmed.

If a successful command response arrives before the abort is processed by the device, the operation will succeed even if `cancellable` has been set, so that upper layers can do whatever they need to do to properly tear down the operation.

If an error command reponse arrives before the abort is processed by the device, the operation will fail with the error returned by the device.

The `QMI_PROTOCOL_ERROR_ABORTED` error will only be returned as a result of this operation if the command request was truly aborted by the device, and so, the user of the method should not assume that cancelling the `cancellable` will always make the method return a `QMI_PROTOCOL_ERROR_ABORTED` error.

The `build_request_fn` and `parse_response_fn` callbacks are required in order to build the abort requests and parse the abort responses, because these are both service and client specific.

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

Available since: 1.24

This method completes asynchronously. Use `qmi_device_command_abortable_finish()` inside the `GAsyncReadyCallback` to obtain the result of the operation.

This method is not directly available to language bindings.

#### Parameters

`message`

  Type: `QmiMessage`

  The message to send.

  The data is owned by the caller of the method.

`message_context`

  Type: `QmiMessageContext`

  The context of the message.

  The data is owned by the caller of the method.

`timeout`

  Type: `guint`

  Maximum time, in seconds, to wait for the response.

`abort_build_request_fn`

  Type: `QmiDeviceCommandAbortableBuildRequestFn`

  Callback to build an abort request.

`abort_parse_response_fn`

  Type: `QmiDeviceCommandAbortableParseResponseFn`

  Callback to parse an abort response.

`abort_user_data`

  Type: `gpointer`

  User data to pass to `abort_build_request_fn` and `abort_parse_response_fn`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`abort_user_data_free`

  Type: `GDestroyNotify`

  A `GDestroyNotify` to free `abort_user_data`.

`cancellable`

  Type: `GCancellable`

  A `GCancellable`, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`callback`

  Type: `GAsyncReadyCallback`

  A `GAsyncReadyCallback` to call when the operation is finished.

  The argument can be `NULL`.

`user_data`

  Type: `gpointer`

  The data to pass to callback function.

  The argument can be `NULL`.
  The data is owned by the caller of the method.