MMBearer: libmm-glib Reference Manual

## MMBearer MMBearer — The Bearer interface |

## Functions

const gchar * | mm_bearer_get_path ()
gchar * | mm_bearer_dup_path ()
const gchar * | mm_bearer_get_interface ()
gchar * | mm_bearer_dup_interface ()
gboolean | mm_bearer_get_connected ()
gboolean | mm_bearer_get_suspended ()
gboolean | mm_bearer_get_multiplexed ()
guint | mm_bearer_get_ip_timeout ()
MMBearerType | mm_bearer_get_bearer_type ()
gint | mm_bearer_get_profile_id ()
MMBearerIpConfig * | mm_bearer_peek_ipv4_config ()
MMBearerIpConfig * | mm_bearer_get_ipv4_config ()
MMBearerIpConfig * | mm_bearer_peek_ipv6_config ()
MMBearerIpConfig * | mm_bearer_get_ipv6_config ()
MMBearerProperties * | mm_bearer_peek_properties ()
MMBearerProperties * | mm_bearer_get_properties ()
MMBearerStats * | mm_bearer_peek_stats ()
MMBearerStats * | mm_bearer_get_stats ()
GError * | mm_bearer_get_connection_error ()
GError * | mm_bearer_peek_connection_error ()
gboolean | mm_bearer_get_reload_stats_supported ()
void | mm_bearer_connect ()
gboolean | mm_bearer_connect_finish ()
gboolean | mm_bearer_connect_sync ()
void | mm_bearer_disconnect ()
gboolean | mm_bearer_disconnect_finish ()
gboolean | mm_bearer_disconnect_sync ()

## Types and Values

struct | MMBearer

## Object Hierarchy

        GObject
        ╰── GDBusProxy
            ╰── MmGdbusBearerProxy
                ╰── MMBearer

## Implemented Interfaces

MMBearer implements GDBusInterface, GInitable, GAsyncInitable and MmGdbusBearer.

## Description

The MMBearer is an object providing access to the methods, signals and properties of the Bearer interface.

When the bearer is exposed and available in the bus, it is ensured that at least this interface is also available.

## Functions

### mm_bearer_get_path ()

    const gchar *
    mm_bearer_get_path (MMBearer *self);

Gets the DBus path of the MMBearer object.

#### Parameters

self | A MMBearer. |

#### Returns

The DBus path of the MMBearer object.

[transfer none]

Since: 1.0

### mm_bearer_dup_path ()

    gchar *
    mm_bearer_dup_path (MMBearer *self);

Gets a copy of the DBus path of the MMBearer object.

#### Parameters

self | A MMBearer. |

#### Returns

The DBus path of the MMBearer object. The returned value should be freed with `g_free()`.

[transfer full]

Since: 1.0

### mm_bearer_get_interface ()

    const gchar *
    mm_bearer_get_interface (MMBearer *self);

Gets the operating system name for the network data interface that provides packet data using this MMBearer. This will only be available once the MMBearer is in connected state.

The returned value is only valid until the property changes so it is only safe to use this function on the thread where `self` was constructed. Use `mm_bearer_dup_interface()` if on another thread.

#### Parameters

self | A MMBearer. |

#### Returns

The name of the interface, or `NULL` if it couldn't be retrieved.

[transfer none]

Since: 1.0

### mm_bearer_dup_interface ()

    gchar *
    mm_bearer_dup_interface (MMBearer *self);

Gets a copy of the operating system name for the network data interface that provides packet data using this MMBearer. This will only be available once the MMBearer is in connected state.

#### Parameters

self | A MMBearer. |

#### Returns

The name of the interface, or `NULL` if it couldn't be retrieved. The returned value should be freed with `g_free()`.

[transfer full]

Since: 1.0

### mm_bearer_get_connected ()

    gboolean
    mm_bearer_get_connected (MMBearer *self);

Checks whether or not the MMBearer is connected and thus whether packet data communication is possible.

#### Parameters

self | A MMBearer. |

#### Returns

`TRUE` if the MMBearer is connected, FALSE otherwise.

Since: 1.0

### mm_bearer_get_suspended ()

    gboolean
    mm_bearer_get_suspended (MMBearer *self);

Checks whether or not the MMBearer is suspended (but not deactivated) while the device is handling other communications, like a voice call.

#### Parameters

self | A MMBearer. |

#### Returns

`TRUE` if packet data service is suspended in the MMBearer, FALSE otherwise.

Since: 1.0

### mm_bearer_get_multiplexed ()

    gboolean
    mm_bearer_get_multiplexed (MMBearer *self);

Checks whether or not the MMBearer is connected through a multiplexed network likn.

#### Parameters

self | A MMBearer. |

#### Returns

`TRUE` if packet data service is connected via a multiplexed network link in the MMBearer, FALSE otherwise.

Since: 1.18

### mm_bearer_get_ip_timeout ()

    guint
    mm_bearer_get_ip_timeout (MMBearer *self);

Gets the maximum time to wait for the bearer to retrieve a valid IP address.

#### Parameters

self | A MMBearer. |

#### Returns

The IP timeout, or 0 if no specific one given.

Since: 1.0

### mm_bearer_get_bearer_type ()

    MMBearerType
    mm_bearer_get_bearer_type (MMBearer *self);

Gets the type of bearer.

#### Parameters

self | A MMBearer. |

#### Returns

a MMBearerType.

Since: 1.0

### mm_bearer_get_profile_id ()

    gint
    mm_bearer_get_profile_id (MMBearer *self);

Gets profile ID associated to the bearer connection, if known.

If the bearer is disconnected or the modem doesn't support profile management features, `MM_3GPP_PROFILE_ID_UNKNOWN`.

#### Parameters

self | A MMBearer. |

#### Returns

a profile id.

Since: 1.18

### mm_bearer_peek_ipv4_config ()

    MMBearerIpConfig *
    mm_bearer_peek_ipv4_config (MMBearer *self);

Gets a MMBearerIpConfig object specifying the IPv4 configuration to use in the bearer.

The returned value is only valid until the property changes so it is only safe to use this function on the thread where `self` was constructed. Use `mm_bearer_get_ipv4_config()` if on another thread.

#### Parameters

self | A MMBearer. |

#### Returns

A MMBearerIpConfig. Do not free the returned value, it belongs to `self` .

[transfer none]

Since: 1.0

### mm_bearer_get_ipv4_config ()

    MMBearerIpConfig *
    mm_bearer_get_ipv4_config (MMBearer *self);

Gets a MMBearerIpConfig object specifying the IPv4 configuration to use in the bearer.

The values reported by `self` are not updated when the values in the interface change. Instead, the client is expected to call `mm_bearer_get_ipv4_config()` again to get a new MMBearerIpConfig with the new values.

#### Parameters

self | A MMBearer. |

#### Returns

A MMBearerIpConfig that must be freed with `g_object_unref()` or `NULL` if unknown.

[transfer full]

Since: 1.0

### mm_bearer_peek_ipv6_config ()

    MMBearerIpConfig *
    mm_bearer_peek_ipv6_config (MMBearer *self);

Gets a MMBearerIpConfig object specifying the IPv6 configuration to use in the bearer.

The returned value is only valid until the property changes so it is only safe to use this function on the thread where `self` was constructed. Use `mm_bearer_get_ipv6_config()` if on another thread.

#### Parameters

self | A MMBearer. |

#### Returns

A MMBearerIpConfig. Do not free the returned value, it belongs to `self` .

[transfer none]

Since: 1.0

### mm_bearer_get_ipv6_config ()

    MMBearerIpConfig *
    mm_bearer_get_ipv6_config (MMBearer *self);

Gets a MMBearerIpConfig object specifying the IPv6 configuration to use in the bearer.

The values reported by `self` are not updated when the values in the interface change. Instead, the client is expected to call `mm_bearer_get_ipv6_config()` again to get a new MMBearerIpConfig with the new values.

#### Parameters

self | A MMBearer. |

#### Returns

A MMBearerIpConfig that must be freed with `g_object_unref()` or `NULL` if unknown.

[transfer full]

Since: 1.0

### mm_bearer_peek_properties ()

    MMBearerProperties *
    mm_bearer_peek_properties (MMBearer *self);

Gets a MMBearerProperties object specifying the properties which were used to create the bearer.

The returned value is only valid until the property changes so it is only safe to use this function on the thread where `self` was constructed. Use `mm_bearer_get_properties()` if on another thread.

#### Parameters

self | A MMBearer. |

#### Returns

A MMBearerProperties. Do not free the returned value, it belongs to `self` .

[transfer none]

Since: 1.0

### mm_bearer_get_properties ()

    MMBearerProperties *
    mm_bearer_get_properties (MMBearer *self);

Gets a MMBearerProperties object specifying the properties which were used to create the bearer.

The values reported by `self` are not updated when the values in the interface change. Instead, the client is expected to call `mm_bearer_get_properties()` again to get a new MMBearerProperties with the new values.

#### Parameters

self | A MMBearer. |

#### Returns

A MMBearerProperties that must be freed with `g_object_unref()` or `NULL` if unknown.

[transfer full]

Since: 1.0

### mm_bearer_peek_stats ()

    MMBearerStats *
    mm_bearer_peek_stats (MMBearer *self);

Gets a MMBearerStats object specifying the statistics of the current bearer connection.

The returned value is only valid until the property changes so it is only safe to use this function on the thread where `self` was constructed. Use `mm_bearer_get_stats()` if on another thread.

#### Parameters

self | A MMBearer. |

#### Returns

A MMBearerStats. Do not free the returned value, it belongs to `self` .

[transfer none]

Since: 1.6

### mm_bearer_get_stats ()

    MMBearerStats *
    mm_bearer_get_stats (MMBearer *self);

Gets a MMBearerStats object specifying the statistics of the current bearer connection.

The values reported by `self` are not updated when the values in the interface change. Instead, the client is expected to call `mm_bearer_get_stats()` again to get a new MMBearerStats with the new values.

#### Parameters

self | A MMBearer. |

#### Returns

A MMBearerStats that must be freed with `g_object_unref()` or `NULL` if unknown.

[transfer full]

Since: 1.6

### mm_bearer_get_connection_error ()

    GError *
    mm_bearer_get_connection_error (MMBearer *self);

Gets a GError specifying the connection error details, if any.

The values reported by `self` are not updated when the values in the interface change. Instead, the client is expected to call `mm_bearer_get_connection_error()` again to get a new GError with the new values.

#### Parameters

self | A MMBearer. |

#### Returns

A GError that must be freed with `g_error_free()` or `NULL` if none.

[transfer full]

Since: 1.18

### mm_bearer_peek_connection_error ()

    GError *
    mm_bearer_peek_connection_error (MMBearer *self);

Gets a GError specifying the connection error details, if any.

The returned value is only valid until the property changes so it is only safe to use this function on the thread where `self` was constructed. Use `mm_bearer_get_connection_error()` if on another thread.

#### Parameters

self | A MMBearer. |

#### Returns

A GError, or `NULL` if none. Do not free the returned value, it belongs to `self` .

[transfer none]

Since: 1.18

### mm_bearer_get_reload_stats_supported ()

    gboolean
    mm_bearer_get_reload_stats_supported (MMBearer *self);

Checks whether or not the MMBearer supporting stats reload (to have RX and TX bytes of the ongoing connection).

#### Parameters

self | A MMBearer. |

#### Returns

`TRUE` if the MMBearer supports these stats, FALSE otherwise.

Since: 1.20

### mm_bearer_connect ()

    void
    mm_bearer_connect (MMBearer *self,
                       GCancellable *cancellable,
                       GAsyncReadyCallback callback,
                       gpointer user_data);

Asynchronously requests activation of a packet data connection with the network using this MMBearer properties.

When the operation is finished, `callback` will be invoked in the

thread-default main loop

of the thread you are calling this method from. You can then call `mm_bearer_connect_finish()` to get the result of the operation.

See `mm_bearer_connect_sync()` for the synchronous, blocking version of this method.

#### Parameters

self | A MMBearer. |
cancellable | A GCancellable or `NULL`. | [allow-none]
callback | A GAsyncReadyCallback to call when the request is satisfied or `NULL`. |
user_data | User data to pass to `callback` . |

Since: 1.0

### mm_bearer_connect_finish ()

    gboolean
    mm_bearer_connect_finish (MMBearer *self,
                              GAsyncResult *res,
                              GError **error);

Finishes an operation started with `mm_bearer_connect()`.

#### Parameters

self | A MMBearer. |
res | The GAsyncResult obtained from the GAsyncReadyCallback passed to `mm_bearer_connect()`. |
error | Return location for error or `NULL`. |

#### Returns

`TRUE` if the operation succeeded, `FALSE` if `error` is set.

Since: 1.0

### mm_bearer_connect_sync ()

    gboolean
    mm_bearer_connect_sync (MMBearer *self,
                            GCancellable *cancellable,
                            GError **error);

Synchronously requests activation of a packet data connection with the network using this MMBearer properties.

The calling thread is blocked until a reply is received. See `mm_bearer_connect()` for the asynchronous version of this method.

#### Parameters

self | A MMBearer. |
cancellable | A GCancellable or `NULL`. | [allow-none]
error | Return location for error or `NULL`. |

#### Returns

`TRUE` if the operation succeeded, `FALSE` if `error` is set.

Since: 1.0

### mm_bearer_disconnect ()

    void
    mm_bearer_disconnect (MMBearer *self,
                          GCancellable *cancellable,
                          GAsyncReadyCallback callback,
                          gpointer user_data);

Synchronously requests disconnection and deactivation of the packet data connection.

When the operation is finished, `callback` will be invoked in the

thread-default main loop

of the thread you are calling this method from. You can then call `mm_bearer_disconnect_finish()` to get the result of the operation.

See `mm_bearer_disconnect_sync()` for the synchronous, blocking version of this method.

#### Parameters

self | A MMBearer. |
cancellable | A GCancellable or `NULL`. | [allow-none]
callback | A GAsyncReadyCallback to call when the request is satisfied or `NULL`. |
user_data | User data to pass to `callback` . |

Since: 1.0

### mm_bearer_disconnect_finish ()

    gboolean
    mm_bearer_disconnect_finish (MMBearer *self,
                                 GAsyncResult *res,
                                 GError **error);

Finishes an operation started with `mm_bearer_disconnect()`.

#### Parameters

self | A MMBearer. |
res | The GAsyncResult obtained from the GAsyncReadyCallback passed to `mm_bearer_disconnect()`. |
error | Return location for error or `NULL`. |

#### Returns

`TRUE` if the operation succeeded, `FALSE` if `error` is set.

Since: 1.0

### mm_bearer_disconnect_sync ()

    gboolean
    mm_bearer_disconnect_sync (MMBearer *self,
                               GCancellable *cancellable,
                               GError **error);

Synchronously requests disconnection and deactivation of the packet data connection.

The calling thread is blocked until a reply is received. See `mm_bearer_disconnect()` for the asynchronous version of this method.

#### Parameters

self | A MMBearer. |
cancellable | A GCancellable or `NULL`. | [allow-none]
error | Return location for error or `NULL`. |

#### Returns

`TRUE` if the operation succeeded, `FALSE` if `error` is set.

Since: 1.0

## Types and Values

### struct MMBearer

    struct MMBearer;

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