summaryrefslogtreecommitdiff
path: root/libnm/nm-device-modem.c
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/nm-device-modem.c
parentb5b8b23c4bae269541e3388135a21462105beaf2 (diff)
downloadNetworkManager-8e270de05e64ca8967ac8d456edeff30a78dd726.tar.gz
libnm/modem: add APN getterlr/modem-properties
Diffstat (limited to 'libnm/nm-device-modem.c')
-rw-r--r--libnm/nm-device-modem.c36
1 files changed, 36 insertions, 0 deletions
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));
}