Mbim.Device

g GObject.GInterface GObject.GInterface Gio.AsyncInitable Gio.AsyncInitable GObject.GInterface->Gio.AsyncInitable GObject.Object GObject.Object Mbim.Device Mbim.Device GObject.Object->Mbim.Device Gio.AsyncInitable->Mbim.Device

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Gio.AsyncInitable (4)

Structs:

GObject.ObjectClass (5)

class

new (file, cancellable, callback, *user_data)

class

new_finish (res)

add_link (session_id, base_ifname, ifname_prefix, cancellable, callback, *user_data)

add_link_finish (res, session_id)

check_link_supported ()

check_ms_mbimex_version (ms_mbimex_version_major, ms_mbimex_version_minor)

close (timeout, cancellable, callback, *user_data)

close_finish (res)

close_force ()

command (message, timeout, cancellable, callback, *user_data)

command_finish (res)

delete_all_links (base_ifname, cancellable, callback, *user_data)

delete_all_links_finish (res)

delete_link (ifname, cancellable, callback, *user_data)

delete_link_finish (res)

get_consecutive_timeouts ()

get_ms_mbimex_version (out_ms_mbimex_version_minor)

get_next_transaction_id ()

get_path ()

get_path_display ()

get_transaction_id ()

is_open ()

list_links (base_ifname)

open (timeout, cancellable, callback, *user_data)

open_finish (res)

open_full (flags, timeout, cancellable, callback, *user_data)

open_full_finish (res)

set_ms_mbimex_version (ms_mbimex_version_major, ms_mbimex_version_minor)

Virtual Methods

Inherited:

GObject.Object (7), Gio.AsyncInitable (2)

Properties

Name

Type

Flags

Short Description

device-consecutive-timeouts

int

r

Number of consecutive timeouts detected in requests sent to the device

device-file

Gio.File

r/w/co

File to the underlying MBIM device

device-in-session

bool

r/w

Flag to specify if the device is within a session

device-transaction-id

int

r/w

Current transaction ID

Signals

Inherited:

GObject.Object (1)

Name

Short Description

device-error

device-indicate-status

device-removed

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class Mbim.Device(**kwargs)
Bases:

GObject.Object, Gio.AsyncInitable

Abstract:

No

Structure:

Mbim.DeviceClass

The Mbim.Device structure contains private data and should only be accessed using the provided API.

New in version 1.0.

classmethod new(file, cancellable, callback, *user_data)
Parameters:

Asynchronously creates a Mbim.Device object to manage file. When the operation is finished, callback will be invoked. You can then call Mbim.Device.new_finish() to get the result of the operation.

New in version 1.0.

classmethod new_finish(res)
Parameters:

res (Gio.AsyncResult) – a Gio.AsyncResult.

Raises:

GLib.Error

Returns:

a newly created Mbim.Device, or None if error is set.

Return type:

Mbim.Device

Finishes an operation started with Mbim.Device.new().

New in version 1.0.

Parameters:

Asynchronously creates a new virtual network device node on top of base_ifname. This allows having multiple net interfaces running on top of another using multiplexing.

If the kernel driver doesn’t allow this functionality, a Mbim.CoreError.UNSUPPORTED error will be returned.

The operation may fail if the given interface name is not associated to the MBIM control port managed by the Mbim.Device.

Depending on the kernel driver in use, the given ifname_prefix may be ignored. The user should not assume that the returned link interface name is prefixed with ifname_prefix as it may not be the case.

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

New in version 1.26.

Parameters:
Raises:

GLib.Error

Returns:

The name of the net interface created, None if error is set.

Return type:

str

Finishes an operation started with Mbim.Device.add_link().

New in version 1.26.

Raises:

GLib.Error

Returns:

True if link management is supported, or False if error is set.

Return type:

bool

Checks whether link management is supported by the kernel.

New in version 1.26.

check_ms_mbimex_version(ms_mbimex_version_major, ms_mbimex_version_minor)
Parameters:
  • ms_mbimex_version_major (int) – major version number of the MS MBIMEx support.

  • ms_mbimex_version_minor (int) – minor version number of the MS MBIMEx support.

Returns:

True if the version of the device instance is the same as or newer than the passed-in version.

Return type:

bool

Checks the version number of the MS MBIMEx support in the device instance against the one given as input.

New in version 1.28.

close(timeout, cancellable, callback, *user_data)
Parameters:

Asynchronously closes a Mbim.Device for I/O.

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

New in version 1.0.

close_finish(res)
Parameters:

res (Gio.AsyncResult) – a Gio.AsyncResult.

Raises:

GLib.Error

Returns:

True if successful, False if error is set.

Return type:

bool

Finishes an asynchronous close operation started with Mbim.Device.close().

New in version 1.0.

close_force()
Raises:

GLib.Error

Returns:

True if self if no error happens, otherwise False and error is set.

Return type:

bool

Forces the Mbim.Device to be closed.

New in version 1.0.

command(message, timeout, cancellable, callback, *user_data)
Parameters:

Asynchronously sends a Mbim.Message to the device.

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

New in version 1.0.

command_finish(res)
Parameters:

res (Gio.AsyncResult) – a Gio.AsyncResult.

Raises:

GLib.Error

Returns:

a Mbim.Message response, or None if error is set. The returned value should be freed with Mbim.Message.unref().

Return type:

Mbim.Message

Finishes an operation started with Mbim.Device.command().

The returned Mbim.Message is ensured to be valid and complete (i.e. not a partial fragment). There is no need to call Mbim.Message.validate() again.

New in version 1.0.

Parameters:

Asynchronously deletes all virtual network interfaces that have been previously created with Mbim.Device.add_link() in base_ifname.

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

There is no guarantee that other processes haven’t created new links by the time this method returns. This method should be used with caution, or in setups where only one single process is expected to do MBIM network interface link management.

New in version 1.26.

Parameters:

res (Gio.AsyncResult) – a Gio.AsyncResult.

Raises:

GLib.Error

Returns:

True if successful, False if error is set.

Return type:

bool

Finishes an operation started with Mbim.Device.delete_all_links().

New in version 1.26.

Parameters:

Asynchronously deletes a virtual network interface that has been previously created with Mbim.Device.add_link().

If the kernel driver doesn’t allow this functionality, a Mbim.CoreError.UNSUPPORTED error will be returned.

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

New in version 1.26.

Parameters:

res (Gio.AsyncResult) – a Gio.AsyncResult.

Raises:

GLib.Error

Returns:

True if successful, False if error is set.

Return type:

bool

Finishes an operation started with Mbim.Device.delete_link().

New in version 1.26.

get_consecutive_timeouts()
Returns:

a int.

Return type:

int

Gets the number of consecutive transaction timeouts in the device.

New in version 1.28.

get_ms_mbimex_version(out_ms_mbimex_version_minor)
Parameters:

out_ms_mbimex_version_minor (int) – output location for the minor version number of the MS MBIMEx support, or None if not needed.

Returns:

the major version number of the MS MBIMEx support.

Return type:

int

Get the version number of the MS MBIMEx support.

The reported version will be 1 if the initialization sequence to agree on which version to use hasn’t been run (e.g. with Mbim.Device.open_full() and the explicit Mbim.DeviceOpenFlags.MS_MBIMEX_V2 or Mbim.DeviceOpenFlags.MS_MBIMEX_V3 flag).

New in version 1.28.

get_next_transaction_id()
Returns:

the next transaction ID.

Return type:

int

Acquire the next transaction ID of this Mbim.Device. The internal transaction ID gets incremented.

New in version 1.0.

get_path()
Returns:

the system path of the device.

Return type:

str

Get the system path of the underlying MBIM device.

New in version 1.0.

get_path_display()
Returns:

UTF-8 encoded system path of the device.

Return type:

str

Get the system path of the underlying MBIM device in UTF-8.

New in version 1.0.

get_transaction_id()
Returns:

the current transaction ID.

Return type:

int

Acquire the transaction ID of this Mbim.Device without incrementing the internal transaction ID.

New in version 1.24.4.

is_open()
Returns:

True if self is open, False otherwise.

Return type:

bool

Checks whether the Mbim.Device is open for I/O.

New in version 1.0.

Parameters:

base_ifname (str) – the base interface.

Raises:

GLib.Error

Returns:

True if successful, False if error is set.

out_links:

a placeholder for the output GLib.PtrArray of link names.

Return type:

(bool, out_links: [str])

Synchronously lists all virtual network interfaces that have been previously created with Mbim.Device.add_link() in base_ifname.

New in version 1.26.

open(timeout, cancellable, callback, *user_data)
Parameters:

Asynchronously opens a Mbim.Device for I/O.

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

New in version 1.0.

open_finish(res)
Parameters:

res (Gio.AsyncResult) – a Gio.AsyncResult.

Raises:

GLib.Error

Returns:

True if successful, False if error is set.

Return type:

bool

Finishes an asynchronous open operation started with Mbim.Device.open().

New in version 1.0.

open_full(flags, timeout, cancellable, callback, *user_data)
Parameters:

Asynchronously opens a Mbim.Device for I/O.

This method is an extension of the generic Mbim.Device.open(), which allows launching the Mbim.Device with proxy support.

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

New in version 1.10.

open_full_finish(res)
Parameters:

res (Gio.AsyncResult) – a Gio.AsyncResult.

Raises:

GLib.Error

Returns:

True if successful, False if error is set.

Return type:

bool

Finishes an asynchronous open operation started with Mbim.Device.open_full().

New in version 1.10.

set_ms_mbimex_version(ms_mbimex_version_major, ms_mbimex_version_minor)
Parameters:
  • ms_mbimex_version_major (int) – major version number of the MS MBIMEx support.

  • ms_mbimex_version_minor (int) – minor version number of the MS MBIMEx support.

Raises:

GLib.Error

Returns:

True if successful, False if error is set.

Return type:

bool

Set the version number of the MS MBIMEx support assumed in the device instance, which may have been set already by a different process or device instance.

If this operation specifies the wrong MBIMEx version agreed between host and device, the message processing on this device instance may fail.

This operation does not do any MBIMEx version exchange with the device, the only way to do that is with Mbim.Device.open_full() and the explicit Mbim.DeviceOpenFlags.MS_MBIMEX_V2 or Mbim.DeviceOpenFlags.MS_MBIMEX_V3 flag.

New in version 1.28.

Signal Details

Mbim.Device.signals.device_error(device, object)
Signal Name:

device-error

Flags:

RUN_LAST

Parameters:
Mbim.Device.signals.device_indicate_status(device, object)
Signal Name:

device-indicate-status

Flags:

RUN_LAST

Parameters:
Mbim.Device.signals.device_removed(device)
Signal Name:

device-removed

Flags:

RUN_LAST

Parameters:

device (Mbim.Device) – The object which received the signal

Property Details

Mbim.Device.props.device_consecutive_timeouts
Name:

device-consecutive-timeouts

Type:

int

Default Value:

0

Flags:

READABLE

Number of consecutive timeouts detected in requests sent to the device

Mbim.Device.props.device_file
Name:

device-file

Type:

Gio.File

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

File to the underlying MBIM device

Mbim.Device.props.device_in_session
Name:

device-in-session

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Flag to specify if the device is within a session

Mbim.Device.props.device_transaction_id
Name:

device-transaction-id

Type:

int

Default Value:

1

Flags:

READABLE, WRITABLE

Current transaction ID