Commit 7cfceab1 authored by Lubomir Rintel's avatar Lubomir Rintel 🥕

libnm/modem: add APN getter

parent 51e8e0f6
Pipeline #35487 canceled with stages
in 34 minutes and 50 seconds
......@@ -38,6 +38,7 @@ typedef struct {
NMDeviceModemCapabilities current_caps;
char *device_id;
char *operator_code;
char *apn;
} NMDeviceModemPrivate;
enum {
......@@ -46,6 +47,7 @@ enum {
PROP_CURRENT_CAPS,
PROP_DEVICE_ID,
PROP_OPERATOR_CODE,
PROP_APN,
LAST_PROP
};
......@@ -124,6 +126,24 @@ nm_device_modem_get_operator_code (NMDeviceModem *self)
return NM_DEVICE_MODEM_GET_PRIVATE (self)->operator_code;
}
/**
* nm_device_modem_get_apn:
* @self: a #NMDeviceModem
*
* The access point name the modem is connected to.
*
* Returns: the APN name or %NULL if disconnected
*
* Since: 1.20
**/
const char *
nm_device_modem_get_apn (NMDeviceModem *self)
{
g_return_val_if_fail (NM_IS_DEVICE_MODEM (self), NULL);
return NM_DEVICE_MODEM_GET_PRIVATE (self)->apn;
}
static const char *
get_type_description (NMDevice *device)
{
......@@ -208,6 +228,7 @@ init_dbus (NMObject *object)
{ NM_DEVICE_MODEM_CURRENT_CAPABILITIES, &priv->current_caps },
{ NM_DEVICE_MODEM_DEVICE_ID, &priv->device_id },
{ NM_DEVICE_MODEM_OPERATOR_CODE, &priv->operator_code },
{ NM_DEVICE_MODEM_APN, &priv->apn },
{ NULL },
};
......@@ -239,6 +260,9 @@ get_property (GObject *object,
case PROP_OPERATOR_CODE:
g_value_set_string (value, nm_device_modem_get_operator_code (self));
break;
case PROP_APN:
g_value_set_string (value, nm_device_modem_get_apn (self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -317,4 +341,15 @@ nm_device_modem_class_init (NMDeviceModemClass *modem_class)
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
/**
* NMDeviceModem:apn:
*
* Since: 1.20
**/
g_object_class_install_property
(object_class, PROP_CURRENT_CAPS,
g_param_spec_string (NM_DEVICE_MODEM_APN, "", "",
NULL,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
}
......@@ -41,6 +41,7 @@ G_BEGIN_DECLS
#define NM_DEVICE_MODEM_CURRENT_CAPABILITIES "current-capabilities"
#define NM_DEVICE_MODEM_DEVICE_ID "device-id"
#define NM_DEVICE_MODEM_OPERATOR_CODE "operator-code"
#define NM_DEVICE_MODEM_APN "apn"
/**
* NMDeviceModem:
......@@ -67,6 +68,9 @@ const char *nm_device_modem_get_device_id (NMDeviceModem *self);
NM_AVAILABLE_IN_1_20
const char *nm_device_modem_get_operator_code (NMDeviceModem *self);
NM_AVAILABLE_IN_1_20
const char *nm_device_modem_get_apn (NMDeviceModem *self);
G_END_DECLS
#endif /* __NM_DEVICE_MODEM_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment