From 12d7ce39a01d86c0eec931a0988b73c7ace19ab4 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Fri, 25 Feb 2011 12:06:40 -0600 Subject: [PATCH] libnm-glib: add modem device properties Forgot these in 2140dad5e0de0033e5c9bb10bd77ecd80085e5a3 --- libnm-glib/nm-device-modem.c | 54 ++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/libnm-glib/nm-device-modem.c b/libnm-glib/nm-device-modem.c index 46a2fd476f..a871e8ff1e 100644 --- a/libnm-glib/nm-device-modem.c +++ b/libnm-glib/nm-device-modem.c @@ -43,8 +43,8 @@ typedef struct { enum { PROP_0, - PROP_MODEM_CAPABILITIES, - PROP_CURRENT_CAPABILITIES, + PROP_MODEM_CAPS, + PROP_CURRENT_CAPS, LAST_PROP }; @@ -155,6 +155,27 @@ nm_device_modem_init (NMDeviceModem *device) { } +static void +get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + NMDeviceModem *self = NM_DEVICE_MODEM (object); + + switch (prop_id) { + case PROP_MODEM_CAPS: + g_value_set_uint (value, nm_device_modem_get_modem_capabilities (self)); + break; + case PROP_CURRENT_CAPS: + g_value_set_uint (value, nm_device_modem_get_current_capabilities (self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + static void dispose (GObject *object) { @@ -181,6 +202,35 @@ nm_device_modem_class_init (NMDeviceModemClass *device_class) /* virtual methods */ object_class->constructor = constructor; + object_class->get_property = get_property; object_class->dispose = dispose; + + /** + * NMDeviceModem:modem-capabilities: + * + * The generic family of access technologies the modem supports. Not all + * capabilities are available at the same time however; some modems require + * a firmware reload or other reinitialization to switch between eg + * CDMA/EVDO and GSM/UMTS. + **/ + g_object_class_install_property (object_class, PROP_MODEM_CAPS, + g_param_spec_uint (NM_DEVICE_MODEM_MODEM_CAPABILITIES, + "Modem capabilities", + "Modem capabilities", + 0, G_MAXUINT32, 0, + G_PARAM_READABLE)); + + /** + * NMDeviceModem:current-capabilities: + * + * The generic family of access technologies the modem currently supports + * without a firmware reload or reinitialization. + **/ + g_object_class_install_property (object_class, PROP_CURRENT_CAPS, + g_param_spec_uint (NM_DEVICE_MODEM_CURRENT_CAPABILITIES, + "Current capabilities", + "Current capabilities", + 0, G_MAXUINT32, 0, + G_PARAM_READABLE)); }