api,bearer: new 'BearerType' property
Until now we have only allowed to use and setup 'default bearers' (in 4G) or 'primary contexts' (in 2G/3G). We can define a couple of additional bearer types, though: * The 'dedicated bearers' (in 4G) or 'secondary contexts' (in 2G/3G), which are associated to a specific default/primary one, but which provide specific QoS settings configured via traffic flow templates. * The 'initial default EPS bearer', which is a special case of default bearer in LTE, which is automatically created and connected when the modem is registered in the LTE network. This commit introduces a new 'MMBearerType' enumeration that will be associated to each bearer through a 'BearerType' property in the org.freedesktop.ModemManager1.Bearer interface, showing what kind of bearer/context this is. By default, right now, all bearer objects created are 'default' bearers.
This commit is contained in:

committed by
Dan Williams

parent
46d627ff83
commit
dc154cf005
@@ -144,6 +144,7 @@ print_bearer_info (MMBearer *bearer)
|
|||||||
stats = mm_bearer_get_stats (bearer);
|
stats = mm_bearer_get_stats (bearer);
|
||||||
|
|
||||||
mmcli_output_string (MMC_F_BEARER_GENERAL_DBUS_PATH, mm_bearer_get_path (bearer));
|
mmcli_output_string (MMC_F_BEARER_GENERAL_DBUS_PATH, mm_bearer_get_path (bearer));
|
||||||
|
mmcli_output_string (MMC_F_BEARER_GENERAL_TYPE, mm_bearer_type_get_string (mm_bearer_get_bearer_type (bearer)));
|
||||||
|
|
||||||
mmcli_output_string (MMC_F_BEARER_STATUS_CONNECTED, mm_bearer_get_connected (bearer) ? "yes" : "no");
|
mmcli_output_string (MMC_F_BEARER_STATUS_CONNECTED, mm_bearer_get_connected (bearer) ? "yes" : "no");
|
||||||
mmcli_output_string (MMC_F_BEARER_STATUS_SUSPENDED, mm_bearer_get_suspended (bearer) ? "yes" : "no");
|
mmcli_output_string (MMC_F_BEARER_STATUS_SUSPENDED, mm_bearer_get_suspended (bearer) ? "yes" : "no");
|
||||||
|
@@ -184,6 +184,7 @@ static FieldInfo field_infos[] = {
|
|||||||
[MMC_F_LOCATION_CDMABS_LAT] = { "modem.location.cdma-bs.latitude", "latitude", MMC_S_MODEM_LOCATION_CDMABS, },
|
[MMC_F_LOCATION_CDMABS_LAT] = { "modem.location.cdma-bs.latitude", "latitude", MMC_S_MODEM_LOCATION_CDMABS, },
|
||||||
[MMC_F_FIRMWARE_LIST] = { "modem.firmware-list", "list", MMC_S_MODEM_FIRMWARE, },
|
[MMC_F_FIRMWARE_LIST] = { "modem.firmware-list", "list", MMC_S_MODEM_FIRMWARE, },
|
||||||
[MMC_F_BEARER_GENERAL_DBUS_PATH] = { "bearer.dbus-path", "dbus path", MMC_S_BEARER_GENERAL, },
|
[MMC_F_BEARER_GENERAL_DBUS_PATH] = { "bearer.dbus-path", "dbus path", MMC_S_BEARER_GENERAL, },
|
||||||
|
[MMC_F_BEARER_GENERAL_TYPE] = { "bearer.type", "type", MMC_S_BEARER_GENERAL, },
|
||||||
[MMC_F_BEARER_STATUS_CONNECTED] = { "bearer.status.connected", "connected", MMC_S_BEARER_STATUS, },
|
[MMC_F_BEARER_STATUS_CONNECTED] = { "bearer.status.connected", "connected", MMC_S_BEARER_STATUS, },
|
||||||
[MMC_F_BEARER_STATUS_SUSPENDED] = { "bearer.status.suspended", "suspended", MMC_S_BEARER_STATUS, },
|
[MMC_F_BEARER_STATUS_SUSPENDED] = { "bearer.status.suspended", "suspended", MMC_S_BEARER_STATUS, },
|
||||||
[MMC_F_BEARER_STATUS_INTERFACE] = { "bearer.status.interface", "interface", MMC_S_BEARER_STATUS, },
|
[MMC_F_BEARER_STATUS_INTERFACE] = { "bearer.status.interface", "interface", MMC_S_BEARER_STATUS, },
|
||||||
|
@@ -197,6 +197,7 @@ typedef enum {
|
|||||||
MMC_F_FIRMWARE_LIST,
|
MMC_F_FIRMWARE_LIST,
|
||||||
/* Bearer general section */
|
/* Bearer general section */
|
||||||
MMC_F_BEARER_GENERAL_DBUS_PATH,
|
MMC_F_BEARER_GENERAL_DBUS_PATH,
|
||||||
|
MMC_F_BEARER_GENERAL_TYPE,
|
||||||
/* Bearer status section */
|
/* Bearer status section */
|
||||||
MMC_F_BEARER_STATUS_CONNECTED,
|
MMC_F_BEARER_STATUS_CONNECTED,
|
||||||
MMC_F_BEARER_STATUS_SUSPENDED,
|
MMC_F_BEARER_STATUS_SUSPENDED,
|
||||||
|
@@ -10,6 +10,7 @@ MM_CHECK_VERSION
|
|||||||
<SECTION>
|
<SECTION>
|
||||||
<FILE>mm-enums</FILE>
|
<FILE>mm-enums</FILE>
|
||||||
<TITLE>Flags and Enumerations</TITLE>
|
<TITLE>Flags and Enumerations</TITLE>
|
||||||
|
MMBearerType
|
||||||
MMBearerIpFamily
|
MMBearerIpFamily
|
||||||
MMBearerIpMethod
|
MMBearerIpMethod
|
||||||
MMBearerAllowedAuth
|
MMBearerAllowedAuth
|
||||||
|
@@ -984,6 +984,7 @@ mm_bearer_dup_interface
|
|||||||
mm_bearer_get_connected
|
mm_bearer_get_connected
|
||||||
mm_bearer_get_suspended
|
mm_bearer_get_suspended
|
||||||
mm_bearer_get_ip_timeout
|
mm_bearer_get_ip_timeout
|
||||||
|
mm_bearer_get_bearer_type
|
||||||
mm_bearer_peek_ipv4_config
|
mm_bearer_peek_ipv4_config
|
||||||
mm_bearer_get_ipv4_config
|
mm_bearer_get_ipv4_config
|
||||||
mm_bearer_peek_ipv6_config
|
mm_bearer_peek_ipv6_config
|
||||||
@@ -1385,6 +1386,7 @@ mm_call_audio_format_get_type
|
|||||||
<SECTION>
|
<SECTION>
|
||||||
<FILE>mm-enums-types</FILE>
|
<FILE>mm-enums-types</FILE>
|
||||||
<TITLE>Flags and Enumerations</TITLE>
|
<TITLE>Flags and Enumerations</TITLE>
|
||||||
|
mm_bearer_type_get_string
|
||||||
mm_bearer_ip_method_get_string
|
mm_bearer_ip_method_get_string
|
||||||
mm_bearer_ip_family_get_string
|
mm_bearer_ip_family_get_string
|
||||||
mm_bearer_allowed_auth_build_string_from_mask
|
mm_bearer_allowed_auth_build_string_from_mask
|
||||||
@@ -1445,6 +1447,7 @@ mm_sms_cdma_service_category_build_string_from_mask
|
|||||||
mm_modem_location_source_get_string
|
mm_modem_location_source_get_string
|
||||||
mm_modem_location_assistance_data_type_get_string
|
mm_modem_location_assistance_data_type_get_string
|
||||||
mm_modem_contacts_storage_build_string_from_mask
|
mm_modem_contacts_storage_build_string_from_mask
|
||||||
|
mm_bearer_type_build_string_from_mask
|
||||||
mm_bearer_ip_family_build_string_from_mask
|
mm_bearer_ip_family_build_string_from_mask
|
||||||
mm_bearer_ip_method_build_string_from_mask
|
mm_bearer_ip_method_build_string_from_mask
|
||||||
mm_bearer_allowed_auth_get_string
|
mm_bearer_allowed_auth_get_string
|
||||||
@@ -1467,6 +1470,7 @@ mm_call_direction_build_string_from_mask
|
|||||||
mm_call_state_build_string_from_mask
|
mm_call_state_build_string_from_mask
|
||||||
mm_call_state_reason_build_string_from_mask
|
mm_call_state_reason_build_string_from_mask
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
|
MM_TYPE_BEARER_TYPE
|
||||||
MM_TYPE_BEARER_IP_FAMILY
|
MM_TYPE_BEARER_IP_FAMILY
|
||||||
MM_TYPE_BEARER_IP_METHOD
|
MM_TYPE_BEARER_IP_METHOD
|
||||||
MM_TYPE_BEARER_ALLOWED_AUTH
|
MM_TYPE_BEARER_ALLOWED_AUTH
|
||||||
@@ -1507,6 +1511,7 @@ MM_TYPE_OMA_SESSION_TYPE
|
|||||||
MM_TYPE_CALL_DIRECTION
|
MM_TYPE_CALL_DIRECTION
|
||||||
MM_TYPE_CALL_STATE
|
MM_TYPE_CALL_STATE
|
||||||
MM_TYPE_CALL_STATE_REASON
|
MM_TYPE_CALL_STATE_REASON
|
||||||
|
mm_bearer_type_get_type
|
||||||
mm_bearer_ip_family_get_type
|
mm_bearer_ip_family_get_type
|
||||||
mm_bearer_ip_method_get_type
|
mm_bearer_ip_method_get_type
|
||||||
mm_bearer_allowed_auth_get_type
|
mm_bearer_allowed_auth_get_type
|
||||||
@@ -1596,6 +1601,7 @@ mm_gdbus_bearer_get_properties
|
|||||||
mm_gdbus_bearer_dup_properties
|
mm_gdbus_bearer_dup_properties
|
||||||
mm_gdbus_bearer_get_connected
|
mm_gdbus_bearer_get_connected
|
||||||
mm_gdbus_bearer_get_suspended
|
mm_gdbus_bearer_get_suspended
|
||||||
|
mm_gdbus_bearer_get_bearer_type
|
||||||
mm_gdbus_bearer_get_stats
|
mm_gdbus_bearer_get_stats
|
||||||
mm_gdbus_bearer_dup_stats
|
mm_gdbus_bearer_dup_stats
|
||||||
<SUBSECTION Methods>
|
<SUBSECTION Methods>
|
||||||
@@ -1614,6 +1620,7 @@ mm_gdbus_bearer_set_ip6_config
|
|||||||
mm_gdbus_bearer_set_ip_timeout
|
mm_gdbus_bearer_set_ip_timeout
|
||||||
mm_gdbus_bearer_set_properties
|
mm_gdbus_bearer_set_properties
|
||||||
mm_gdbus_bearer_set_suspended
|
mm_gdbus_bearer_set_suspended
|
||||||
|
mm_gdbus_bearer_set_bearer_type
|
||||||
mm_gdbus_bearer_set_stats
|
mm_gdbus_bearer_set_stats
|
||||||
mm_gdbus_bearer_override_properties
|
mm_gdbus_bearer_override_properties
|
||||||
mm_gdbus_bearer_complete_connect
|
mm_gdbus_bearer_complete_connect
|
||||||
|
@@ -970,6 +970,28 @@ typedef enum { /*< underscore_name=mm_modem_contacts_storage >*/
|
|||||||
MM_MODEM_CONTACTS_STORAGE_MT = 3,
|
MM_MODEM_CONTACTS_STORAGE_MT = 3,
|
||||||
} MMModemContactsStorage;
|
} MMModemContactsStorage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MMBearerType:
|
||||||
|
* @MM_BEARER_TYPE_UNKNOWN: Unknown bearer.
|
||||||
|
* @MM_BEARER_TYPE_DEFAULT: Primary context (2G/3G) or default bearer (4G),
|
||||||
|
* defined by the user of the API.
|
||||||
|
* @MM_BEARER_TYPE_DEFAULT_ATTACH: The initial default bearer established
|
||||||
|
* during LTE attach procedure, automatically connected as long as the device is
|
||||||
|
* regitered in the LTE network.
|
||||||
|
* @MM_BEARER_TYPE_DEDICATED: Secondary context (2G/3G) or dedicated bearer
|
||||||
|
* (4G), defined by the user of the API. These bearers use the same IP address
|
||||||
|
* used by a primary context or default bearer and provide a dedicated flow for
|
||||||
|
* specific traffic with different QoS settings.
|
||||||
|
*
|
||||||
|
* Type of context (2G/3G) or bearer (4G).
|
||||||
|
*/
|
||||||
|
typedef enum { /*< underscore_name=mm_bearer_type >*/
|
||||||
|
MM_BEARER_TYPE_UNKNOWN = 0,
|
||||||
|
MM_BEARER_TYPE_DEFAULT = 1,
|
||||||
|
MM_BEARER_TYPE_DEFAULT_ATTACH = 2,
|
||||||
|
MM_BEARER_TYPE_DEDICATED = 3,
|
||||||
|
} MMBearerType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MMBearerIpMethod:
|
* MMBearerIpMethod:
|
||||||
* @MM_BEARER_IP_METHOD_UNKNOWN: Unknown method.
|
* @MM_BEARER_IP_METHOD_UNKNOWN: Unknown method.
|
||||||
|
@@ -279,6 +279,13 @@
|
|||||||
-->
|
-->
|
||||||
<property name="IpTimeout" type="u" access="read" />
|
<property name="IpTimeout" type="u" access="read" />
|
||||||
|
|
||||||
|
<!--
|
||||||
|
BearerType:
|
||||||
|
|
||||||
|
A <link linkend="MMBearerType">MMBearerType</link>
|
||||||
|
-->
|
||||||
|
<property name="BearerType" type="u" access="read" />
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Properties:
|
Properties:
|
||||||
|
|
||||||
|
@@ -259,7 +259,9 @@
|
|||||||
<!--
|
<!--
|
||||||
MaxActiveBearers:
|
MaxActiveBearers:
|
||||||
|
|
||||||
The maximum number of active packet data bearers the modem supports.
|
The maximum number of active
|
||||||
|
<link linkend="MM-BEARER-TYPE-DEFAULT:CAPS"><constant>MM_BEARER_TYPE_DEFAULT</constant></link>
|
||||||
|
bearers that may be explicitly enabled by the user.
|
||||||
|
|
||||||
POTS and CDMA2000-only devices support one active bearer, while GSM/UMTS
|
POTS and CDMA2000-only devices support one active bearer, while GSM/UMTS
|
||||||
and LTE-capable devices (including LTE/CDMA devices) typically support
|
and LTE-capable devices (including LTE/CDMA devices) typically support
|
||||||
|
@@ -204,6 +204,24 @@ mm_bearer_get_ip_timeout (MMBearer *self)
|
|||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mm_bearer_get_bearer_type:
|
||||||
|
* @self: A #MMBearer.
|
||||||
|
*
|
||||||
|
* Gets the type of bearer.
|
||||||
|
*
|
||||||
|
* Returns: a #MMBearerType.
|
||||||
|
*/
|
||||||
|
MMBearerType
|
||||||
|
mm_bearer_get_bearer_type (MMBearer *self)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (MM_IS_BEARER (self), MM_BEARER_TYPE_UNKNOWN);
|
||||||
|
|
||||||
|
return mm_gdbus_bearer_get_bearer_type (MM_GDBUS_BEARER (self));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ipv4_config_updated (MMBearer *self,
|
ipv4_config_updated (MMBearer *self,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
|
@@ -67,17 +67,19 @@ struct _MMBearerClass {
|
|||||||
|
|
||||||
GType mm_bearer_get_type (void);
|
GType mm_bearer_get_type (void);
|
||||||
|
|
||||||
const gchar *mm_bearer_get_path (MMBearer *self);
|
const gchar *mm_bearer_get_path (MMBearer *self);
|
||||||
gchar *mm_bearer_dup_path (MMBearer *self);
|
gchar *mm_bearer_dup_path (MMBearer *self);
|
||||||
|
|
||||||
const gchar *mm_bearer_get_interface (MMBearer *self);
|
const gchar *mm_bearer_get_interface (MMBearer *self);
|
||||||
gchar *mm_bearer_dup_interface (MMBearer *self);
|
gchar *mm_bearer_dup_interface (MMBearer *self);
|
||||||
|
|
||||||
gboolean mm_bearer_get_connected (MMBearer *self);
|
gboolean mm_bearer_get_connected (MMBearer *self);
|
||||||
|
|
||||||
gboolean mm_bearer_get_suspended (MMBearer *self);
|
gboolean mm_bearer_get_suspended (MMBearer *self);
|
||||||
|
|
||||||
guint mm_bearer_get_ip_timeout (MMBearer *self);
|
guint mm_bearer_get_ip_timeout (MMBearer *self);
|
||||||
|
|
||||||
|
MMBearerType mm_bearer_get_bearer_type (MMBearer *self);
|
||||||
|
|
||||||
void mm_bearer_connect (MMBearer *self,
|
void mm_bearer_connect (MMBearer *self,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
|
@@ -1365,15 +1365,16 @@ mm_base_bearer_init (MMBaseBearer *self)
|
|||||||
self->priv->default_ip_family = MM_BEARER_IP_FAMILY_IPV4;
|
self->priv->default_ip_family = MM_BEARER_IP_FAMILY_IPV4;
|
||||||
|
|
||||||
/* Set defaults */
|
/* Set defaults */
|
||||||
mm_gdbus_bearer_set_interface (MM_GDBUS_BEARER (self), NULL);
|
mm_gdbus_bearer_set_interface (MM_GDBUS_BEARER (self), NULL);
|
||||||
mm_gdbus_bearer_set_connected (MM_GDBUS_BEARER (self), FALSE);
|
mm_gdbus_bearer_set_connected (MM_GDBUS_BEARER (self), FALSE);
|
||||||
mm_gdbus_bearer_set_suspended (MM_GDBUS_BEARER (self), FALSE);
|
mm_gdbus_bearer_set_suspended (MM_GDBUS_BEARER (self), FALSE);
|
||||||
mm_gdbus_bearer_set_properties (MM_GDBUS_BEARER (self), NULL);
|
mm_gdbus_bearer_set_properties (MM_GDBUS_BEARER (self), NULL);
|
||||||
mm_gdbus_bearer_set_ip_timeout (MM_GDBUS_BEARER (self), BEARER_IP_TIMEOUT_DEFAULT);
|
mm_gdbus_bearer_set_ip_timeout (MM_GDBUS_BEARER (self), BEARER_IP_TIMEOUT_DEFAULT);
|
||||||
mm_gdbus_bearer_set_ip4_config (MM_GDBUS_BEARER (self),
|
mm_gdbus_bearer_set_bearer_type (MM_GDBUS_BEARER (self), MM_BEARER_TYPE_DEFAULT);
|
||||||
mm_bearer_ip_config_get_dictionary (NULL));
|
mm_gdbus_bearer_set_ip4_config (MM_GDBUS_BEARER (self),
|
||||||
mm_gdbus_bearer_set_ip6_config (MM_GDBUS_BEARER (self),
|
mm_bearer_ip_config_get_dictionary (NULL));
|
||||||
mm_bearer_ip_config_get_dictionary (NULL));
|
mm_gdbus_bearer_set_ip6_config (MM_GDBUS_BEARER (self),
|
||||||
|
mm_bearer_ip_config_get_dictionary (NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Reference in New Issue
Block a user