summaryrefslogtreecommitdiff
path: root/libnm
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2019-05-06 17:47:01 +0200
committerLubomir Rintel <lkundrak@v3.sk>2019-06-05 18:37:17 +0200
commit8e270de05e64ca8967ac8d456edeff30a78dd726 (patch)
tree0ccd7b84cf3039834c17020ec83b7117cac95f35 /libnm
parentb5b8b23c4bae269541e3388135a21462105beaf2 (diff)
downloadNetworkManager-lr/modem-properties.tar.gz
libnm/modem: add APN getterlr/modem-properties
Diffstat (limited to 'libnm')
-rw-r--r--libnm/libnm.ver1
-rw-r--r--libnm/nm-device-modem.c36
-rw-r--r--libnm/nm-device-modem.h4
3 files changed, 41 insertions, 0 deletions
diff --git a/libnm/libnm.ver b/libnm/libnm.ver
index 526ec0529d..36bdacdedb 100644
--- a/libnm/libnm.ver
+++ b/libnm/libnm.ver
@@ -1607,6 +1607,7 @@ global:
libnm_1_20_0 {
global:
+ nm_device_modem_get_apn;
nm_device_modem_get_device_id;
nm_device_modem_get_operator_code;
} libnm_1_18_0;
diff --git a/libnm/nm-device-modem.c b/libnm/nm-device-modem.c
index 4565d80228..97445d6f87 100644
--- a/libnm/nm-device-modem.c
+++ b/libnm/nm-device-modem.c
@@ -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 },
};
@@ -225,6 +246,7 @@ finalize (GObject *object)
g_free (priv->device_id);
g_free (priv->operator_code);
+ g_free (priv->apn);
G_OBJECT_CLASS (nm_device_modem_parent_class)->finalize (object);
}
@@ -250,6 +272,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;
@@ -329,4 +354,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));
}
diff --git a/libnm/nm-device-modem.h b/libnm/nm-device-modem.h
index c0f9886906..21d0ab77a1 100644
--- a/libnm/nm-device-modem.h
+++ b/libnm/nm-device-modem.h
@@ -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__ */