diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-01 13:17:12 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-16 14:53:20 +0100 |
commit | cd63df938f4fdf3fb656f715745608a9318d1c74 (patch) | |
tree | c58cdb827c5535fe1505799f838d76b108b72fac | |
parent | bb352d5da30413e70a71d14acb952b7bedfe6f99 (diff) |
libmm-common: `MMSimpleStatus' won't be considered internal any more
Renamed `MMCommonSimpleProperties' to `MMSimpleStatus', and removed the
`MMSimpleStatusProperties' provided in libmm-glib. We'll just use the original
one from libmm-common always.
25 files changed, 264 insertions, 399 deletions
diff --git a/cli/mmcli-modem-simple.c b/cli/mmcli-modem-simple.c index e0e5aa36..65f615b5 100644 --- a/cli/mmcli-modem-simple.c +++ b/cli/mmcli-modem-simple.c @@ -184,7 +184,7 @@ disconnect_ready (MMModemSimple *modem_simple, } static void -status_process_reply (MMModemSimpleStatusProperties *result, +status_process_reply (MMSimpleStatus *result, const GError *error) { MMModemState state; @@ -204,7 +204,7 @@ status_process_reply (MMModemSimpleStatusProperties *result, "%s\n", VALIDATE_UNKNOWN (mm_modem_simple_get_path (ctx->modem_simple))); - state = mm_modem_simple_status_properties_get_state (result); + state = mm_simple_status_get_state (result); g_print (" -------------------------\n" @@ -219,13 +219,13 @@ status_process_reply (MMModemSimpleStatusProperties *result, guint signal_quality; gboolean signal_quality_recent = FALSE; - signal_quality = (mm_modem_simple_status_properties_get_signal_quality ( + signal_quality = (mm_simple_status_get_signal_quality ( result, &signal_quality_recent)); - mm_modem_simple_status_properties_get_bands (result, &bands, &n_bands); + mm_simple_status_get_bands (result, &bands, &n_bands); bands_str = mm_common_build_bands_string (bands, n_bands); access_tech_str = (mm_modem_access_technology_build_string_from_mask ( - mm_modem_simple_status_properties_get_access_technologies (result))); + mm_simple_status_get_access_technologies (result))); g_print (" | signal quality: '%u' (%s)\n" " | bands: '%s'\n" @@ -234,35 +234,34 @@ status_process_reply (MMModemSimpleStatusProperties *result, VALIDATE_UNKNOWN (bands_str), VALIDATE_UNKNOWN (access_tech_str)); - if ((mm_modem_simple_status_properties_get_3gpp_registration_state (result) == + if ((mm_simple_status_get_3gpp_registration_state (result) == MM_MODEM_3GPP_REGISTRATION_STATE_HOME) || - (mm_modem_simple_status_properties_get_3gpp_registration_state (result) == + (mm_simple_status_get_3gpp_registration_state (result) == MM_MODEM_3GPP_REGISTRATION_STATE_ROAMING)) { g_print (" -------------------------\n" " 3GPP | registration: '%s'\n" " | operator code: '%s'\n" " | operator name: '%s'\n", mm_modem_3gpp_registration_state_get_string ( - mm_modem_simple_status_properties_get_3gpp_registration_state (result)), - VALIDATE_UNKNOWN (mm_modem_simple_status_properties_get_3gpp_operator_code (result)), - VALIDATE_UNKNOWN (mm_modem_simple_status_properties_get_3gpp_operator_name (result))); + mm_simple_status_get_3gpp_registration_state (result)), + VALIDATE_UNKNOWN (mm_simple_status_get_3gpp_operator_code (result)), + VALIDATE_UNKNOWN (mm_simple_status_get_3gpp_operator_name (result))); } - if ((mm_modem_simple_status_properties_get_cdma_cdma1x_registration_state (result) != + if ((mm_simple_status_get_cdma_cdma1x_registration_state (result) != MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN) || - (mm_modem_simple_status_properties_get_cdma_evdo_registration_state (result) != + (mm_simple_status_get_cdma_evdo_registration_state (result) != MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN)) { guint sid; guint nid; gchar *sid_str = NULL; gchar *nid_str = NULL; - - sid = mm_modem_simple_status_properties_get_cdma_sid (result); + sid = mm_simple_status_get_cdma_sid (result); sid_str = (sid != MM_MODEM_CDMA_SID_UNKNOWN ? g_strdup_printf ("%u", sid) : NULL); - nid = mm_modem_simple_status_properties_get_cdma_nid (result); + nid = mm_simple_status_get_cdma_nid (result); nid_str = (nid != MM_MODEM_CDMA_NID_UNKNOWN ? g_strdup_printf ("%u", nid) : NULL); @@ -275,9 +274,9 @@ status_process_reply (MMModemSimpleStatusProperties *result, VALIDATE_UNKNOWN (sid_str), VALIDATE_UNKNOWN (nid_str), mm_modem_cdma_registration_state_get_string ( - mm_modem_simple_status_properties_get_cdma_cdma1x_registration_state (result)), + mm_simple_status_get_cdma_cdma1x_registration_state (result)), mm_modem_cdma_registration_state_get_string ( - mm_modem_simple_status_properties_get_cdma_evdo_registration_state (result))); + mm_simple_status_get_cdma_evdo_registration_state (result))); g_free (sid_str); g_free (nid_str); @@ -296,7 +295,7 @@ status_ready (MMModemSimple *modem_simple, GAsyncResult *result, gpointer nothing) { - MMModemSimpleStatusProperties *operation_result; + MMSimpleStatus *operation_result; GError *error = NULL; operation_result = mm_modem_simple_get_status_finish (modem_simple, result, &error); @@ -409,7 +408,7 @@ mmcli_modem_simple_run_synchronous (GDBusConnection *connection) /* Request to get status from the modem? */ if (status_flag) { - MMModemSimpleStatusProperties *result; + MMSimpleStatus *result; g_debug ("Synchronously getting status from the modem..."); diff --git a/libmm-common/Makefile.am b/libmm-common/Makefile.am index b9699726..dcea8779 100644 --- a/libmm-common/Makefile.am +++ b/libmm-common/Makefile.am @@ -149,7 +149,7 @@ $(mm_gdbus_bearer_generated): $(top_srcdir)/introspection/org.freedesktop.ModemM # Additional dependency rules mm-common-helpers.c: mm-errors-types.h mm-enums-types.h -mm-common-simple-properties.c: mm-errors-types.h mm-enums-types.h +mm-simple-status.c: mm-errors-types.h mm-enums-types.h mm-simple-connect-properties.c: mm-errors-types.h mm-bearer-properties.c: mm-errors-types.h mm-sms-properties.c: mm-errors-types.h @@ -163,7 +163,7 @@ include_HEADERS = \ mm-errors-types.h \ mm-enums-types.h \ mm-common-helpers.h \ - mm-common-simple-properties.h \ + mm-simple-status.h \ mm-simple-connect-properties.h \ mm-bearer-properties.h \ mm-sms-properties.h \ @@ -184,8 +184,8 @@ libmm_common_la_SOURCES = \ mm-errors-quarks.c \ mm-common-helpers.h \ mm-common-helpers.c \ - mm-common-simple-properties.h \ - mm-common-simple-properties.c \ + mm-simple-status.h \ + mm-simple-status.c \ mm-simple-connect-properties.h \ mm-simple-connect-properties.c \ mm-bearer-properties.h \ diff --git a/libmm-common/libmm-common.h b/libmm-common/libmm-common.h index 743ad6ec..0499f4b7 100644 --- a/libmm-common/libmm-common.h +++ b/libmm-common/libmm-common.h @@ -26,7 +26,7 @@ #include "mm-errors-types.h" #include "mm-enums-types.h" #include "mm-common-helpers.h" -#include "mm-common-simple-properties.h" +#include "mm-simple-status.h" #include "mm-simple-connect-properties.h" #include "mm-sms-properties.h" #include "mm-bearer-properties.h" diff --git a/libmm-common/mm-common-simple-properties.h b/libmm-common/mm-common-simple-properties.h deleted file mode 100644 index dba25593..00000000 --- a/libmm-common/mm-common-simple-properties.h +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details: - * - * Copyright (C) 2011 Google, Inc. - */ - -#ifndef MM_COMMON_SIMPLE_PROPERTIES_H -#define MM_COMMON_SIMPLE_PROPERTIES_H - -#include <ModemManager.h> -#include <glib-object.h> - -G_BEGIN_DECLS - -#define MM_TYPE_COMMON_SIMPLE_PROPERTIES (mm_common_simple_properties_get_type ()) -#define MM_COMMON_SIMPLE_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_COMMON_SIMPLE_PROPERTIES, MMCommonSimpleProperties)) -#define MM_COMMON_SIMPLE_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_COMMON_SIMPLE_PROPERTIES, MMCommonSimplePropertiesClass)) -#define MM_IS_COMMON_SIMPLE_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_COMMON_SIMPLE_PROPERTIES)) -#define MM_IS_COMMON_SIMPLE_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_COMMON_SIMPLE_PROPERTIES)) -#define MM_COMMON_SIMPLE_PROPERTIES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_COMMON_SIMPLE_PROPERTIES, MMCommonSimplePropertiesClass)) - -#define MM_COMMON_SIMPLE_PROPERTY_STATE "state" -#define MM_COMMON_SIMPLE_PROPERTY_SIGNAL_QUALITY "signal-quality" -#define MM_COMMON_SIMPLE_PROPERTY_BANDS "bands" -#define MM_COMMON_SIMPLE_PROPERTY_ACCESS_TECHNOLOGIES "access-technologies" - -#define MM_COMMON_SIMPLE_PROPERTY_3GPP_REGISTRATION_STATE "m3gpp-registration-state" -#define MM_COMMON_SIMPLE_PROPERTY_3GPP_OPERATOR_CODE "m3gpp-operator-code" -#define MM_COMMON_SIMPLE_PROPERTY_3GPP_OPERATOR_NAME "m3gpp-operator-name" - -#define MM_COMMON_SIMPLE_PROPERTY_CDMA_CDMA1X_REGISTRATION_STATE "cdma-cdma1x-registration-state" -#define MM_COMMON_SIMPLE_PROPERTY_CDMA_EVDO_REGISTRATION_STATE "cdma-evdo-registration-state" -#define MM_COMMON_SIMPLE_PROPERTY_CDMA_SID "cdma-sid" -#define MM_COMMON_SIMPLE_PROPERTY_CDMA_NID "cdma-nid" - -typedef struct _MMCommonSimpleProperties MMCommonSimpleProperties; -typedef struct _MMCommonSimplePropertiesClass MMCommonSimplePropertiesClass; -typedef struct _MMCommonSimplePropertiesPrivate MMCommonSimplePropertiesPrivate; - -struct _MMCommonSimpleProperties { - GObject parent; - MMCommonSimplePropertiesPrivate *priv; -}; - -struct _MMCommonSimplePropertiesClass { - GObjectClass parent; -}; - -GType mm_common_simple_properties_get_type (void); - -MMCommonSimpleProperties *mm_common_simple_properties_new (void); -MMCommonSimpleProperties *mm_common_simple_properties_new_from_dictionary ( - GVariant *dictionary, - GError **error); - -MMModemState mm_common_simple_properties_get_state (MMCommonSimpleProperties *self); -guint32 mm_common_simple_properties_get_signal_quality (MMCommonSimpleProperties *self, - gboolean *recent); -void mm_common_simple_properties_get_bands (MMCommonSimpleProperties *self, - const MMModemBand **bands, - guint *n_bands); -MMModemAccessTechnology mm_common_simple_properties_get_access_technologies (MMCommonSimpleProperties *self); - -MMModem3gppRegistrationState mm_common_simple_properties_get_3gpp_registration_state (MMCommonSimpleProperties *self); -const gchar *mm_common_simple_properties_get_3gpp_operator_code (MMCommonSimpleProperties *self); -const gchar *mm_common_simple_properties_get_3gpp_operator_name (MMCommonSimpleProperties *self); - -MMModemCdmaRegistrationState mm_common_simple_properties_get_cdma_cdma1x_registration_state (MMCommonSimpleProperties *self); -MMModemCdmaRegistrationState mm_common_simple_properties_get_cdma_evdo_registration_state (MMCommonSimpleProperties *self); -guint mm_common_simple_properties_get_cdma_sid (MMCommonSimpleProperties *self); -guint mm_common_simple_properties_get_cdma_nid (MMCommonSimpleProperties *self); - -GVariant *mm_common_simple_properties_get_dictionary (MMCommonSimpleProperties *self); - -G_END_DECLS - -#endif /* MM_COMMON_SIMPLE_PROPERTIES_H */ diff --git a/libmm-common/mm-common-simple-properties.c b/libmm-common/mm-simple-status.c index 023ce285..e54bcb80 100644 --- a/libmm-common/mm-common-simple-properties.c +++ b/libmm-common/mm-simple-status.c @@ -18,12 +18,12 @@ #include "mm-enums-types.h" #include "mm-errors-types.h" #include "mm-common-helpers.h" -#include "mm-common-simple-properties.h" +#include "mm-simple-status.h" #define SID_UNKNOWN 99999 #define NID_UNKNOWN 99999 -G_DEFINE_TYPE (MMCommonSimpleProperties, mm_common_simple_properties, G_TYPE_OBJECT); +G_DEFINE_TYPE (MMSimpleStatus, mm_simple_status, G_TYPE_OBJECT); enum { PROP_0, @@ -43,7 +43,7 @@ enum { static GParamSpec *properties[PROP_LAST]; -struct _MMCommonSimplePropertiesPrivate { +struct _MMSimpleStatusPrivate { /* <--- From the Modem interface ---> */ /* Overall modem state, signature 'u' */ MMModemState state; @@ -77,18 +77,22 @@ struct _MMCommonSimplePropertiesPrivate { /*****************************************************************************/ MMModemState -mm_common_simple_properties_get_state (MMCommonSimpleProperties *self) +mm_simple_status_get_state (MMSimpleStatus *self) { + g_return_val_if_fail (MM_IS_SIMPLE_STATUS (self), MM_MODEM_STATE_UNKNOWN); + return self->priv->state; } guint32 -mm_common_simple_properties_get_signal_quality (MMCommonSimpleProperties *self, - gboolean *recent) +mm_simple_status_get_signal_quality (MMSimpleStatus *self, + gboolean *recent) { guint32 signal_quality = 0; gboolean signal_quality_recent = FALSE; + g_return_val_if_fail (MM_IS_SIMPLE_STATUS (self), 0); + if (self->priv->signal_quality) { g_variant_get (self->priv->signal_quality, "(ub)", @@ -102,10 +106,12 @@ mm_common_simple_properties_get_signal_quality (MMCommonSimpleProperties *self, } void -mm_common_simple_properties_get_bands (MMCommonSimpleProperties *self, - const MMModemBand **bands, - guint *n_bands) +mm_simple_status_get_bands (MMSimpleStatus *self, + const MMModemBand **bands, + guint *n_bands) { + g_return_if_fail (MM_IS_SIMPLE_STATUS (self)); + if (!self->priv->bands_array) self->priv->bands_array = mm_common_bands_variant_to_garray (self->priv->bands); @@ -114,117 +120,138 @@ mm_common_simple_properties_get_bands (MMCommonSimpleProperties *self, } MMModemAccessTechnology -mm_common_simple_properties_get_access_technologies (MMCommonSimpleProperties *self) +mm_simple_status_get_access_technologies (MMSimpleStatus *self) { + g_return_val_if_fail (MM_IS_SIMPLE_STATUS (self), MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN); + return self->priv->access_technologies; } MMModem3gppRegistrationState -mm_common_simple_properties_get_3gpp_registration_state (MMCommonSimpleProperties *self) +mm_simple_status_get_3gpp_registration_state (MMSimpleStatus *self) { + g_return_val_if_fail (MM_IS_SIMPLE_STATUS (self), MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN); + return self->priv->modem_3gpp_registration_state; } const gchar * -mm_common_simple_properties_get_3gpp_operator_code (MMCommonSimpleProperties *self) +mm_simple_status_get_3gpp_operator_code (MMSimpleStatus *self) { + g_return_val_if_fail (MM_IS_SIMPLE_STATUS (self), NULL); + return self->priv->modem_3gpp_operator_code; } const gchar * -mm_common_simple_properties_get_3gpp_operator_name (MMCommonSimpleProperties *self) +mm_simple_status_get_3gpp_operator_name (MMSimpleStatus *self) { + g_return_val_if_fail (MM_IS_SIMPLE_STATUS (self), NULL); + return self->priv->modem_3gpp_operator_name; } MMModemCdmaRegistrationState -mm_common_simple_properties_get_cdma_cdma1x_registration_state (MMCommonSimpleProperties *self) +mm_simple_status_get_cdma_cdma1x_registration_state (MMSimpleStatus *self) { + g_return_val_if_fail (MM_IS_SIMPLE_STATUS (self), MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN); + return self->priv->modem_cdma_cdma1x_registration_state; } MMModemCdmaRegistrationState -mm_common_simple_properties_get_cdma_evdo_registration_state (MMCommonSimpleProperties *self) +mm_simple_status_get_cdma_evdo_registration_state (MMSimpleStatus *self) { + g_return_val_if_fail (MM_IS_SIMPLE_STATUS (self), MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN); + return self->priv->modem_cdma_evdo_registration_state; } guint -mm_common_simple_properties_get_cdma_sid (MMCommonSimpleProperties *self) +mm_simple_status_get_cdma_sid (MMSimpleStatus *self) { + g_return_val_if_fail (MM_IS_SIMPLE_STATUS (self), 0); + return self->priv->modem_cdma_sid; } guint -mm_common_simple_properties_get_cdma_nid (MMCommonSimpleProperties *self) +mm_simple_status_get_cdma_nid (MMSimpleStatus *self) { + g_return_val_if_fail (MM_IS_SIMPLE_STATUS (self), 0); + return self->priv->modem_cdma_nid; } /*****************************************************************************/ GVariant * -mm_common_simple_properties_get_dictionary (MMCommonSimpleProperties *self) +mm_simple_status_get_dictionary (MMSimpleStatus *self) { GVariantBuilder builder; - g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + /* Allow NULL */ + if (!self) + return NULL; + + g_return_val_if_fail (MM_IS_SIMPLE_STATUS (self), NULL); + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); g_variant_builder_add (&builder, "{sv}", - MM_COMMON_SIMPLE_PROPERTY_STATE, + MM_SIMPLE_PROPERTY_STATE, g_variant_new_uint32 (self->priv->state)); /* Next ones, only when registered */ if (self->priv->state >= MM_MODEM_STATE_REGISTERED) { g_variant_builder_add (&builder, "{sv}", - MM_COMMON_SIMPLE_PROPERTY_SIGNAL_QUALITY, + MM_SIMPLE_PROPERTY_SIGNAL_QUALITY, self->priv->signal_quality); g_variant_builder_add (&builder, "{sv}", - MM_COMMON_SIMPLE_PROPERTY_BANDS, + MM_SIMPLE_PROPERTY_BANDS, self->priv->bands); g_variant_builder_add (&builder, "{sv}", - MM_COMMON_SIMPLE_PROPERTY_ACCESS_TECHNOLOGIES, + MM_SIMPLE_PROPERTY_ACCESS_TECHNOLOGIES, g_variant_new_uint32 (self->priv->access_technologies)); g_variant_builder_add (&builder, "{sv}", - MM_COMMON_SIMPLE_PROPERTY_3GPP_REGISTRATION_STATE, + MM_SIMPLE_PROPERTY_3GPP_REGISTRATION_STATE, g_variant_new_uint32 (self->priv->modem_3gpp_registration_state)); if (self->priv->modem_3gpp_operator_code) g_variant_builder_add (&builder, "{sv}", - MM_COMMON_SIMPLE_PROPERTY_3GPP_OPERATOR_CODE, + MM_SIMPLE_PROPERTY_3GPP_OPERATOR_CODE, g_variant_new_string (self->priv->modem_3gpp_operator_code)); if (self->priv->modem_3gpp_operator_name) g_variant_builder_add (&builder, "{sv}", - MM_COMMON_SIMPLE_PROPERTY_3GPP_OPERATOR_NAME, + MM_SIMPLE_PROPERTY_3GPP_OPERATOR_NAME, g_variant_new_string (self->priv->modem_3gpp_operator_name)); if (self->priv->modem_cdma_cdma1x_registration_state != MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN) { g_variant_builder_add (&builder, "{sv}", - MM_COMMON_SIMPLE_PROPERTY_CDMA_CDMA1X_REGISTRATION_STATE, + MM_SIMPLE_PROPERTY_CDMA_CDMA1X_REGISTRATION_STATE, g_variant_new_uint32 (self->priv->modem_cdma_cdma1x_registration_state)); if (self->priv->modem_cdma_sid != SID_UNKNOWN) g_variant_builder_add (&builder, "{sv}", - MM_COMMON_SIMPLE_PROPERTY_CDMA_SID, + MM_SIMPLE_PROPERTY_CDMA_SID, g_variant_new_uint32 (self->priv->modem_cdma_sid)); if (self->priv->modem_cdma_nid != NID_UNKNOWN) g_variant_builder_add (&builder, "{sv}", - MM_COMMON_SIMPLE_PROPERTY_CDMA_NID, + MM_SIMPLE_PROPERTY_CDMA_NID, g_variant_new_uint32 (self->priv->modem_cdma_nid)); } if (self->priv->modem_cdma_evdo_registration_state != MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN) g_variant_builder_add (&builder, "{sv}", - MM_COMMON_SIMPLE_PROPERTY_CDMA_EVDO_REGISTRATION_STATE, + MM_SIMPLE_PROPERTY_CDMA_EVDO_REGISTRATION_STATE, g_variant_new_uint32 (self->priv->modem_cdma_evdo_registration_state)); } @@ -234,20 +261,30 @@ mm_common_simple_properties_get_dictionary (MMCommonSimpleProperties *self) /*****************************************************************************/ -MMCommonSimpleProperties * -mm_common_simple_properties_new_from_dictionary (GVariant *dictionary, - GError **error) +MMSimpleStatus * +mm_simple_status_new_from_dictionary (GVariant *dictionary, + GError **error) { GError *inner_error = NULL; GVariantIter iter; gchar *key; GVariant *value; - MMCommonSimpleProperties *properties; + MMSimpleStatus *properties; - properties = mm_common_simple_properties_new (); + properties = mm_simple_status_new (); if (!dictionary) return properties; + if (!g_variant_is_of_type (dictionary, G_VARIANT_TYPE ("a{sv}"))) { + g_set_error (error, + MM_CORE_ERROR, + MM_CORE_ERROR_INVALID_ARGS, + "Cannot create Simple status from dictionary: " + "invalid variant type received"); + g_object_unref (properties); + return NULL; + } + g_variant_iter_init (&iter, dictionary); while (!inner_error && g_variant_iter_next (&iter, "{sv}", &key, &value)) { @@ -255,25 +292,25 @@ mm_common_simple_properties_new_from_dictionary (GVariant *dictionary, * and just g_object_set()-ing they specific 'key' and value, but we do want * to check which input keys we receive, in order to propagate the error. */ - if (g_str_equal (key, MM_COMMON_SIMPLE_PROPERTY_STATE) || - g_str_equal (key, MM_COMMON_SIMPLE_PROPERTY_ACCESS_TECHNOLOGIES) || - g_str_equal (key, MM_COMMON_SIMPLE_PROPERTY_3GPP_REGISTRATION_STATE) || - g_str_equal (key, MM_COMMON_SIMPLE_PROPERTY_CDMA_CDMA1X_REGISTRATION_STATE) || - g_str_equal (key, MM_COMMON_SIMPLE_PROPERTY_CDMA_EVDO_REGISTRATION_STATE) || - g_str_equal (key, MM_COMMON_SIMPLE_PROPERTY_CDMA_SID) || - g_str_equal (key, MM_COMMON_SIMPLE_PROPERTY_CDMA_NID)) { + if (g_str_equal (key, MM_SIMPLE_PROPERTY_STATE) || + g_str_equal (key, MM_SIMPLE_PROPERTY_ACCESS_TECHNOLOGIES) || + g_str_equal (key, MM_SIMPLE_PROPERTY_3GPP_REGISTRATION_STATE) || + g_str_equal (key, MM_SIMPLE_PROPERTY_CDMA_CDMA1X_REGISTRATION_STATE) || + g_str_equal (key, MM_SIMPLE_PROPERTY_CDMA_EVDO_REGISTRATION_STATE) || + g_str_equal (key, MM_SIMPLE_PROPERTY_CDMA_SID) || + g_str_equal (key, MM_SIMPLE_PROPERTY_CDMA_NID)) { /* uint properties */ g_object_set (properties, key, g_variant_get_uint32 (value), NULL); - } else if (g_str_equal (key, MM_COMMON_SIMPLE_PROPERTY_3GPP_OPERATOR_CODE) || - g_str_equal (key, MM_COMMON_SIMPLE_PROPERTY_3GPP_OPERATOR_NAME)) { + } else if (g_str_equal (key, MM_SIMPLE_PROPERTY_3GPP_OPERATOR_CODE) || + g_str_equal (key, MM_SIMPLE_PROPERTY_3GPP_OPERATOR_NAME)) { /* string properties */ g_object_set (properties, key, g_variant_get_string (value, NULL), NULL); - } else if (g_str_equal (key, MM_COMMON_SIMPLE_PROPERTY_BANDS) || - g_str_equal (key, MM_COMMON_SIMPLE_PROPERTY_SIGNAL_QUALITY)) { + } else if (g_str_equal (key, MM_SIMPLE_PROPERTY_BANDS) || + g_str_equal (key, MM_SIMPLE_PROPERTY_SIGNAL_QUALITY)) { /* remaining complex types, as variant */ g_object_set (properties, key, value, @@ -282,7 +319,7 @@ mm_common_simple_properties_new_from_dictionary (GVariant *dictionary, /* Set inner error, will stop the loop */ inner_error = g_error_new (MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS, - "Invalid properties dictionary, unexpected key '%s'", + "Invalid status dictionary, unexpected key '%s'", key); } @@ -302,11 +339,11 @@ mm_common_simple_properties_new_from_dictionary (GVariant *dictionary, /*****************************************************************************/ -MMCommonSimpleProperties * -mm_common_simple_properties_new (void) +MMSimpleStatus * +mm_simple_status_new (void) { - return (MM_COMMON_SIMPLE_PROPERTIES ( - g_object_new (MM_TYPE_COMMON_SIMPLE_PROPERTIES, NULL))); + return (MM_SIMPLE_STATUS ( + g_object_new (MM_TYPE_SIMPLE_STATUS, NULL))); } static void @@ -315,7 +352,7 @@ set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - MMCommonSimpleProperties *self = MM_COMMON_SIMPLE_PROPERTIES (object); + MMSimpleStatus *self = MM_SIMPLE_STATUS (object); switch (prop_id) { case PROP_STATE: @@ -373,7 +410,7 @@ get_property (GObject *object, GValue *value, GParamSpec *pspec) { - MMCommonSimpleProperties *self = MM_COMMON_SIMPLE_PROPERTIES (object); + MMSimpleStatus *self = MM_SIMPLE_STATUS (object); switch (prop_id) { case PROP_STATE: @@ -416,11 +453,11 @@ get_property (GObject *object, } static void -mm_common_simple_properties_init (MMCommonSimpleProperties *self) +mm_simple_status_init (MMSimpleStatus *self) { self->priv = G_TYPE_INSTANCE_GET_PRIVATE ((self), - MM_TYPE_COMMON_SIMPLE_PROPERTIES, - MMCommonSimplePropertiesPrivate); + MM_TYPE_SIMPLE_STATUS, + MMSimpleStatusPrivate); /* Some defaults */ self->priv->state = MM_MODEM_STATE_UNKNOWN; @@ -437,7 +474,7 @@ mm_common_simple_properties_init (MMCommonSimpleProperties *self) static void finalize (GObject *object) { - MMCommonSimpleProperties *self = MM_COMMON_SIMPLE_PROPERTIES (object); + MMSimpleStatus *self = MM_SIMPLE_STATUS (object); g_variant_unref (self->priv->signal_quality); g_variant_unref (self->priv->bands); @@ -446,15 +483,15 @@ finalize (GObject *object) g_free (self->priv->modem_3gpp_operator_code); g_free (self->priv->modem_3gpp_operator_name); - G_OBJECT_CLASS (mm_common_simple_properties_parent_class)->finalize (object); + G_OBJECT_CLASS (mm_simple_status_parent_class)->finalize (object); } static void -mm_common_simple_properties_class_init (MMCommonSimplePropertiesClass *klass) +mm_simple_status_class_init (MMSimpleStatusClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (object_class, sizeof (MMCommonSimplePropertiesPrivate)); + g_type_class_add_private (object_class, sizeof (MMSimpleStatusPrivate)); /* Virtual methods */ object_class->set_property = set_property; @@ -462,7 +499,7 @@ mm_common_simple_properties_class_init (MMCommonSimplePropertiesClass *klass) object_class->finalize = finalize; properties[PROP_STATE] = - g_param_spec_enum (MM_COMMON_SIMPLE_PROPERTY_STATE, + g_param_spec_enum (MM_SIMPLE_PROPERTY_STATE, "State", "State of the modem", MM_TYPE_MODEM_STATE, @@ -471,7 +508,7 @@ mm_common_simple_properties_class_init (MMCommonSimplePropertiesClass *klass) g_object_class_install_property (object_class, PROP_STATE, properties[PROP_STATE]); properties[PROP_SIGNAL_QUALITY] = - g_param_spec_variant (MM_COMMON_SIMPLE_PROPERTY_SIGNAL_QUALITY, + g_param_spec_variant (MM_SIMPLE_PROPERTY_SIGNAL_QUALITY, "Signal quality", "Signal quality reported by the modem", G_VARIANT_TYPE ("(ub)"), @@ -480,7 +517,7 @@ mm_common_simple_properties_class_init (MMCommonSimplePropertiesClass *klass) g_object_class_install_property (object_class, PROP_SIGNAL_QUALITY, properties[PROP_SIGNAL_QUALITY]); properties[PROP_BANDS] = - g_param_spec_variant (MM_COMMON_SIMPLE_PROPERTY_BANDS, + g_param_spec_variant (MM_SIMPLE_PROPERTY_BANDS, "Bands", "Frequency bands used by the modem", G_VARIANT_TYPE ("au"), @@ -489,7 +526,7 @@ mm_common_simple_properties_class_init (MMCommonSimplePropertiesClass *klass) g_object_class_install_property (object_class, PROP_BANDS, properties[PROP_BANDS]); properties[PROP_ACCESS_TECHNOLOGIES] = - g_param_spec_flags (MM_COMMON_SIMPLE_PROPERTY_ACCESS_TECHNOLOGIES, + g_param_spec_flags (MM_SIMPLE_PROPERTY_ACCESS_TECHNOLOGIES, "Access Technologies", "Access technologies used by the modem", MM_TYPE_MODEM_ACCESS_TECHNOLOGY, @@ -498,7 +535,7 @@ mm_common_simple_properties_class_init (MMCommonSimplePropertiesClass *klass) g_object_class_install_property (object_class, PROP_ACCESS_TECHNOLOGIES, properties[PROP_ACCESS_TECHNOLOGIES]); properties[PROP_3GPP_REGISTRATION_STATE] = - g_param_spec_enum (MM_COMMON_SIMPLE_PROPERTY_3GPP_REGISTRATION_STATE, + g_param_spec_enum (MM_SIMPLE_PROPERTY_3GPP_REGISTRATION_STATE, "3GPP registration state", "Registration state in the 3GPP network", MM_TYPE_MODEM_3GPP_REGISTRATION_STATE, @@ -507,7 +544,7 @@ mm_common_simple_properties_class_init (MMCommonSimplePropertiesClass *klass) g_object_class_install_property (object_class, PROP_3GPP_REGISTRATION_STATE, properties[PROP_3GPP_REGISTRATION_STATE]); properties[PROP_3GPP_OPERATOR_CODE] = - g_param_spec_string (MM_COMMON_SIMPLE_PROPERTY_3GPP_OPERATOR_CODE, + g_param_spec_string (MM_SIMPLE_PROPERTY_3GPP_OPERATOR_CODE, "3GPP operator code", "Code of the current operator in the 3GPP network", NULL, @@ -515,7 +552,7 @@ mm_common_simple_properties_class_init (MMCommonSimplePropertiesClass *klass) g_object_class_install_property (object_class, PROP_3GPP_OPERATOR_CODE, properties[PROP_3GPP_OPERATOR_CODE]); properties[PROP_3GPP_OPERATOR_NAME] = - g_param_spec_string (MM_COMMON_SIMPLE_PROPERTY_3GPP_OPERATOR_NAME, + g_param_spec_string (MM_SIMPLE_PROPERTY_3GPP_OPERATOR_NAME, "3GPP operator name", "Name of the current operator in the 3GPP network", NULL, @@ -523,7 +560,7 @@ mm_common_simple_properties_class_init (MMCommonSimplePropertiesClass *klass) g_object_class_install_property (object_class, PROP_3GPP_OPERATOR_NAME, properties[PROP_3GPP_OPERATOR_NAME]); properties[PROP_CDMA_CDMA1X_REGISTRATION_STATE] = - g_param_spec_enum (MM_COMMON_SIMPLE_PROPERTY_CDMA_CDMA1X_REGISTRATION_STATE, + g_param_spec_enum (MM_SIMPLE_PROPERTY_CDMA_CDMA1X_REGISTRATION_STATE, "CDMA1x registration state", "Registration state in the CDMA1x network", MM_TYPE_MODEM_CDMA_REGISTRATION_STATE, @@ -532,7 +569,7 @@ mm_common_simple_properties_class_init (MMCommonSimplePropertiesClass *klass) g_object_class_install_property (object_class, PROP_CDMA_CDMA1X_REGISTRATION_STATE, properties[PROP_CDMA_CDMA1X_REGISTRATION_STATE]); properties[PROP_CDMA_EVDO_REGISTRATION_STATE] = - g_param_spec_enum (MM_COMMON_SIMPLE_PROPERTY_CDMA_EVDO_REGISTRATION_STATE, + g_param_spec_enum (MM_SIMPLE_PROPERTY_CDMA_EVDO_REGISTRATION_STATE, "EV-DO registration state", "Registration state in the EV-DO network", MM_TYPE_MODEM_CDMA_REGISTRATION_STATE, @@ -541,7 +578,7 @@ mm_common_simple_properties_class_init (MMCommonSimplePropertiesClass *klass) g_object_class_install_property (object_class, PROP_CDMA_EVDO_REGISTRATION_STATE, properties[PROP_CDMA_EVDO_REGISTRATION_STATE]); properties[PROP_CDMA_SID] = - g_param_spec_uint (MM_COMMON_SIMPLE_PROPERTY_CDMA_SID, + g_param_spec_uint (MM_SIMPLE_PROPERTY_CDMA_SID, "CDMA1x SID", "System Identifier of the serving CDMA1x network", 0, @@ -551,7 +588,7 @@ mm_common_simple_properties_class_init (MMCommonSimplePropertiesClass *klass) g_object_class_install_property (object_class, PROP_CDMA_SID, properties[PROP_CDMA_SID]); properties[PROP_CDMA_NID] = - g_param_spec_uint (MM_COMMON_SIMPLE_PROPERTY_CDMA_NID, + g_param_spec_uint (MM_SIMPLE_PROPERTY_CDMA_NID, "CDMA1x NID", "Network Identifier of the serving CDMA1x network", 0, diff --git a/libmm-common/mm-simple-status.h b/libmm-common/mm-simple-status.h new file mode 100644 index 00000000..884b6b95 --- /dev/null +++ b/libmm-common/mm-simple-status.h @@ -0,0 +1,85 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details: + * + * Copyright (C) 2011 Google, Inc. + */ + +#ifndef MM_SIMPLE_STATUS_H +#define MM_SIMPLE_STATUS_H + +#include <ModemManager.h> +#include <glib-object.h> + +G_BEGIN_DECLS + +#define MM_TYPE_SIMPLE_STATUS (mm_simple_status_get_type ()) +#define MM_SIMPLE_STATUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_SIMPLE_STATUS, MMSimpleStatus)) +#define MM_SIMPLE_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_SIMPLE_STATUS, MMSimpleStatusClass)) +#define MM_IS_SIMPLE_STATUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_SIMPLE_STATUS)) +#define MM_IS_SIMPLE_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_SIMPLE_STATUS)) +#define MM_SIMPLE_STATUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_SIMPLE_STATUS, MMSimpleStatusClass)) + +#define MM_SIMPLE_PROPERTY_STATE "state" +#define MM_SIMPLE_PROPERTY_SIGNAL_QUALITY "signal-quality" +#define MM_SIMPLE_PROPERTY_BANDS "bands" +#define MM_SIMPLE_PROPERTY_ACCESS_TECHNOLOGIES "access-technologies" + +#define MM_SIMPLE_PROPERTY_3GPP_REGISTRATION_STATE "m3gpp-registration-state" +#define MM_SIMPLE_PROPERTY_3GPP_OPERATOR_CODE "m3gpp-operator-code" +#define MM_SIMPLE_PROPERTY_3GPP_OPERATOR_NAME "m3gpp-operator-name" + +#define MM_SIMPLE_PROPERTY_CDMA_CDMA1X_REGISTRATION_STATE "cdma-cdma1x-registration-state" +#define MM_SIMPLE_PROPERTY_CDMA_EVDO_REGISTRATION_STATE "cdma-evdo-registration-state" +#define MM_SIMPLE_PROPERTY_CDMA_SID "cdma-sid" +#define MM_SIMPLE_PROPERTY_CDMA_NID "cdma-nid" + +typedef struct _MMSimpleStatus MMSimpleStatus; +typedef struct _MMSimpleStatusClass MMSimpleStatusClass; +typedef struct _MMSimpleStatusPrivate MMSimpleStatusPrivate; + +struct _MMSimpleStatus { + GObject parent; + MMSimpleStatusPrivate *priv; +}; + +struct _MMSimpleStatusClass { + GObjectClass parent; +}; + +GType mm_simple_status_get_type (void); + +MMSimpleStatus *mm_simple_status_new (void); +MMSimpleStatus *mm_simple_status_new_from_dictionary (GVariant *dictionary, + GError **error); + +MMModemState mm_simple_status_get_state (MMSimpleStatus *self); +guint32 mm_simple_status_get_signal_quality (MMSimpleStatus *self, + gboolean *recent); +void mm_simple_status_get_bands (MMSimpleStatus *self, + const MMModemBand **bands, + guint *n_bands); +MMModemAccessTechnology mm_simple_status_get_access_technologies (MMSimpleStatus *self); + +MMModem3gppRegistrationState mm_simple_status_get_3gpp_registration_state (MMSimpleStatus *self); +const gchar *mm_simple_status_get_3gpp_operator_code (MMSimpleStatus *self); +const gchar *mm_simple_status_get_3gpp_operator_name (MMSimpleStatus *self); + +MMModemCdmaRegistrationState mm_simple_status_get_cdma_cdma1x_registration_state (MMSimpleStatus *self); +MMModemCdmaRegistrationState mm_simple_status_get_cdma_evdo_registration_state (MMSimpleStatus *self); +guint mm_simple_status_get_cdma_sid (MMSimpleStatus *self); +guint mm_simple_status_get_cdma_nid (MMSimpleStatus *self); + +GVariant *mm_simple_status_get_dictionary (MMSimpleStatus *self); + +G_END_DECLS + +#endif /* MM_SIMPLE_STATUS_H */ diff --git a/libmm-glib/Makefile.am b/libmm-glib/Makefile.am index f9c18a4a..c9a8e2f1 100644 --- a/libmm-glib/Makefile.am +++ b/libmm-glib/Makefile.am @@ -24,8 +24,6 @@ libmm_glib_la_SOURCES = \ mm-modem-3gpp-ussd.c \ mm-modem-cdma.h \ mm-modem-cdma.c \ - mm-modem-simple-status-properties.h \ - mm-modem-simple-status-properties.c \ mm-modem-simple.h \ mm-modem-simple.c \ mm-modem-location.h \ @@ -50,7 +48,6 @@ include_HEADERS = \ mm-object.h \ mm-modem.h \ mm-modem-3gpp.h \ - mm-modem-simple-status-properties.h \ mm-modem-simple.h \ mm-sim.h \ mm-sms.h \ diff --git a/libmm-glib/mm-modem-simple-status-properties.c b/libmm-glib/mm-modem-simple-status-properties.c deleted file mode 100644 index 464c9d2a..00000000 --- a/libmm-glib/mm-modem-simple-status-properties.c +++ /dev/null @@ -1,115 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details: - * - * Copyright (C) 2011 Aleksander Morgado <aleksander@gnu.org> - */ - -#include "mm-modem-simple-status-properties.h" -#include "mm-modem-cdma.h" - -MMModemState -mm_modem_simple_status_properties_get_state (MMModemSimpleStatusProperties *self) -{ - g_return_val_if_fail (MM_IS_MODEM_SIMPLE_STATUS_PROPERTIES (self), - MM_MODEM_STATE_UNKNOWN); - - return mm_common_simple_properties_get_state (self); -} - -guint32 -mm_modem_simple_status_properties_get_signal_quality (MMModemSimpleStatusProperties *self, - gboolean *recent) -{ - g_return_val_if_fail (MM_IS_MODEM_SIMPLE_STATUS_PROPERTIES (self), 0); - - return mm_common_simple_properties_get_signal_quality (self, recent); -} - -void -mm_modem_simple_status_properties_get_bands (MMModemSimpleStatusProperties *self, - const MMModemBand **bands, - guint *n_bands) -{ - g_return_if_fail (MM_IS_MODEM_SIMPLE_STATUS_PROPERTIES (self)); - - return mm_common_simple_properties_get_bands (self, bands, n_bands); -} - -MMModemAccessTechnology -mm_modem_simple_status_properties_get_access_technologies (MMModemSimpleStatusProperties *self) -{ - g_return_val_if_fail (MM_IS_MODEM_SIMPLE_STATUS_PROPERTIES (self), - MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN); - - return mm_common_simple_properties_get_access_technologies (self); -} - -MMModem3gppRegistrationState -mm_modem_simple_status_properties_get_3gpp_registration_state (MMModemSimpleStatusProperties *self) -{ - g_return_val_if_fail (MM_IS_MODEM_SIMPLE_STATUS_PROPERTIES (self), - MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN); - - return mm_common_simple_properties_get_3gpp_registration_state (self); -} - -const gchar * -mm_modem_simple_status_properties_get_3gpp_operator_code (MMModemSimpleStatusProperties *self) -{ - g_return_val_if_fail (MM_IS_MODEM_SIMPLE_STATUS_PROPERTIES (self), NULL); - - return mm_common_simple_properties_get_3gpp_operator_code (self); -} - -const gchar * -mm_modem_simple_status_properties_get_3gpp_operator_name (MMModemSimpleStatusProperties *self) -{ - g_return_val_if_fail (MM_IS_MODEM_SIMPLE_STATUS_PROPERTIES (self), NULL); - - return mm_common_simple_properties_get_3gpp_operator_name (self); -} - -MMModemCdmaRegistrationState -mm_modem_simple_status_properties_get_cdma_cdma1x_registration_state (MMModemSimpleStatusProperties *self) -{ - g_return_val_if_fail (MM_IS_MODEM_SIMPLE_STATUS_PROPERTIES (self), - MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN); - - return mm_common_simple_properties_get_cdma_cdma1x_registration_state (self); -} - -MMModemCdmaRegistrationState -mm_modem_simple_status_properties_get_cdma_evdo_registration_state (MMModemSimpleStatusProperties *self) -{ - g_return_val_if_fail (MM_IS_MODEM_SIMPLE_STATUS_PROPERTIES (self), - MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN); - - return mm_common_simple_properties_get_cdma_evdo_registration_state (self); -} - -guint -mm_modem_simple_status_properties_get_cdma_sid (MMModemSimpleStatusProperties *self) -{ - g_return_val_if_fail (MM_IS_MODEM_SIMPLE_STATUS_PROPERTIES (self), - MM_MODEM_CDMA_SID_UNKNOWN); - - return mm_common_simple_properties_get_cdma_sid (self); -} - -guint -mm_modem_simple_status_properties_get_cdma_nid (MMModemSimpleStatusProperties *self) -{ - g_return_val_if_fail (MM_IS_MODEM_SIMPLE_STATUS_PROPERTIES (self), - MM_MODEM_CDMA_NID_UNKNOWN); - - return mm_common_simple_properties_get_cdma_nid (self); -} diff --git a/libmm-glib/mm-modem-simple-status-properties.h b/libmm-glib/mm-modem-simple-status-properties.h deleted file mode 100644 index 4c5c8708..00000000 --- a/libmm-glib/mm-modem-simple-status-properties.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details: - * - * Copyright (C) 2011 Aleksander Morgado <aleksander@gnu.org> - */ - -#ifndef MM_MODEM_SIMPLE_STATUS_PROPERTIES_H -#define MM_MODEM_SIMPLE_STATUS_PROPERTIES_H - -#include <ModemManager.h> -#include <glib-object.h> - -#include <libmm-common.h> - -G_BEGIN_DECLS - -typedef MMCommonSimpleProperties MMModemSimpleStatusProperties; -#define MM_TYPE_MODEM_SIMPLE_STATUS_PROPERTIES(o) MM_TYPE_COMMON_SIMPLE_PROPERTIES (o) -#define MM_MODEM_SIMPLE_STATUS_PROPERTIES(o) MM_COMMON_SIMPLE_PROPERTIES(o) -#define MM_IS_MODEM_SIMPLE_STATUS_PROPERTIES(o) MM_IS_COMMON_SIMPLE_PROPERTIES(o) - -MMModemState mm_modem_simple_status_properties_get_state (MMModemSimpleStatusProperties *self); -guint32 mm_modem_simple_status_properties_get_signal_quality (MMModemSimpleStatusProperties *self, - gboolean *recent); -void mm_modem_simple_status_properties_get_bands (MMModemSimpleStatusProperties *self, - const MMModemBand **bands, - guint *n_bands); -MMModemAccessTechnology mm_modem_simple_status_properties_get_access_technologies (MMModemSimpleStatusProperties *self); - -MMModem3gppRegistrationState mm_modem_simple_status_properties_get_3gpp_registration_state (MMModemSimpleStatusProperties *self); -const gchar *mm_modem_simple_status_properties_get_3gpp_operator_code (MMModemSimpleStatusProperties *self); -const gchar *mm_modem_simple_status_properties_get_3gpp_operator_name (MMModemSimpleStatusProperties *self); - -MMModemCdmaRegistrationState mm_modem_simple_status_properties_get_cdma_cdma1x_registration_state (MMModemSimpleStatusProperties *self); -MMModemCdmaRegistrationState mm_modem_simple_status_properties_get_cdma_evdo_registration_state (MMModemSimpleStatusProperties *self); -guint mm_modem_simple_status_properties_get_cdma_sid (MMModemSimpleStatusProperties *self); -guint mm_modem_simple_status_properties_get_cdma_nid (MMModemSimpleStatusProperties *self); - -G_END_DECLS - -#endif /* MM_MODEM_SIMPLE_STATUS_PROPERTIES_H */ diff --git a/libmm-glib/mm-modem-simple.c b/libmm-glib/mm-modem-simple.c index e25ff595..4d5c5645 100644 --- a/libmm-glib/mm-modem-simple.c +++ b/libmm-glib/mm-modem-simple.c @@ -244,12 +244,12 @@ mm_modem_simple_disconnect_sync (MMModemSimple *self, error); } -MMModemSimpleStatusProperties * +MMSimpleStatus * mm_modem_simple_get_status_finish (MMModemSimple *self, GAsyncResult *res, GError **error) { - MMCommonSimpleProperties *properties; + MMSimpleStatus *status; GVariant *dictionary = NULL; g_return_val_if_fail (MM_GDBUS_IS_MODEM_SIMPLE (self), NULL); @@ -257,9 +257,9 @@ mm_modem_simple_get_status_finish (MMModemSimple *self, if (!mm_gdbus_modem_simple_call_get_status_finish (self, &dictionary, res, error)) return NULL; - properties = mm_common_simple_properties_new_from_dictionary (dictionary, error); + status = mm_simple_status_new_from_dictionary (dictionary, error); g_variant_unref (dictionary); - return (MMModemSimpleStatusProperties *)properties; + return status; } void @@ -276,12 +276,12 @@ mm_modem_simple_get_status (MMModemSimple *self, user_data); } -MMModemSimpleStatusProperties * +MMSimpleStatus * mm_modem_simple_get_status_sync (MMModemSimple *self, GCancellable *cancellable, GError **error) { - MMCommonSimpleProperties *properties; + MMSimpleStatus *status; GVariant *dictionary = NULL; g_return_val_if_fail (MM_GDBUS_IS_MODEM_SIMPLE (self), NULL); @@ -289,7 +289,7 @@ mm_modem_simple_get_status_sync (MMModemSimple *self, if (!mm_gdbus_modem_simple_call_get_status_sync (self, &dictionary, cancellable, error)) return NULL; - properties = mm_common_simple_properties_new_from_dictionary (dictionary, error); + status = mm_simple_status_new_from_dictionary (dictionary, error); g_variant_unref (dictionary); - return (MMModemSimpleStatusProperties *)properties; + return status; } diff --git a/libmm-glib/mm-modem-simple.h b/libmm-glib/mm-modem-simple.h index 969ee15d..2f9c3498 100644 --- a/libmm-glib/mm-modem-simple.h +++ b/libmm-glib/mm-modem-simple.h @@ -27,7 +27,6 @@ #include <mm-gdbus-modem.h> #include "mm-bearer.h" -#include "mm-modem-simple-status-properties.h" G_BEGIN_DECLS @@ -65,16 +64,16 @@ gboolean mm_modem_simple_disconnect_sync (MMModemSimple *self, GCancellable *cancellable, GError **error); -void mm_modem_simple_get_status (MMModemSimple *self, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); -MMModemSimpleStatusProperties *mm_modem_simple_get_status_finish (MMModemSimple *self, - GAsyncResult *res, - GError **error); -MMModemSimpleStatusProperties *mm_modem_simple_get_status_sync (MMModemSimple *self, - GCancellable *cancellable, - GError **error); +void mm_modem_simple_get_status (MMModemSimple *self, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +MMSimpleStatus *mm_modem_simple_get_status_finish (MMModemSimple *self, + GAsyncResult *res, + GError **error); +MMSimpleStatus *mm_modem_simple_get_status_sync (MMModemSimple *self, + GCancellable *cancellable, + GError **error); G_END_DECLS #endif /* _MM_MODEM_SIMPLE_H_ */ diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index 6a55096b..01b87795 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -147,7 +147,7 @@ struct _MMBroadbandModemPrivate { /*<--- Modem Simple interface --->*/ /* Properties */ GObject *modem_simple_dbus_skeleton; - MMCommonSimpleProperties *modem_simple_status; + MMSimpleStatus *modem_simple_status; /*<--- Modem Location interface --->*/ /* Properties */ @@ -6431,7 +6431,7 @@ initialize_step (InitializeContext *ctx) * so that interfaces add and bind the properties they want to export. */ if (!ctx->self->priv->modem_simple_status) - ctx->self->priv->modem_simple_status = mm_common_simple_properties_new (); + ctx->self->priv->modem_simple_status = mm_simple_status_new (); /* Fall down to next step */ ctx->step++; diff --git a/src/mm-iface-modem-3gpp-ussd.c b/src/mm-iface-modem-3gpp-ussd.c index a714b2d9..4e6b47f4 100644 --- a/src/mm-iface-modem-3gpp-ussd.c +++ b/src/mm-iface-modem-3gpp-ussd.c @@ -36,7 +36,7 @@ static GQuark supported_quark; void mm_iface_modem_3gpp_ussd_bind_simple_status (MMIfaceModem3gppUssd *self, - MMCommonSimpleProperties *status) + MMSimpleStatus *status) { /* Nothing shown in simple status */ } diff --git a/src/mm-iface-modem-3gpp-ussd.h b/src/mm-iface-modem-3gpp-ussd.h index e8d25de6..3d99185f 100644 --- a/src/mm-iface-modem-3gpp-ussd.h +++ b/src/mm-iface-modem-3gpp-ussd.h @@ -155,6 +155,6 @@ void mm_iface_modem_3gpp_ussd_shutdown (MMIfaceModem3gppUssd *self); /* Bind properties for simple GetStatus() */ void mm_iface_modem_3gpp_ussd_bind_simple_status (MMIfaceModem3gppUssd *self, - MMCommonSimpleProperties *status); + MMSimpleStatus *status); #endif /* MM_IFACE_MODEM_3GPP_USSD_H */ diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c index 84b12cbb..03a86967 100644 --- a/src/mm-iface-modem-3gpp.c +++ b/src/mm-iface-modem-3gpp.c @@ -44,7 +44,7 @@ static GQuark registration_check_context_quark; void mm_iface_modem_3gpp_bind_simple_status (MMIfaceModem3gpp *self, - MMCommonSimpleProperties *status) + MMSimpleStatus *status) { MmGdbusModem3gpp *skeleton; @@ -53,15 +53,15 @@ mm_iface_modem_3gpp_bind_simple_status (MMIfaceModem3gpp *self, NULL); g_object_bind_property (skeleton, "registration-state", - status, MM_COMMON_SIMPLE_PROPERTY_3GPP_REGISTRATION_STATE, + status, MM_SIMPLE_PROPERTY_3GPP_REGISTRATION_STATE, G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); g_object_bind_property (skeleton, "operator-code", - status, MM_COMMON_SIMPLE_PROPERTY_3GPP_OPERATOR_CODE, + status, MM_SIMPLE_PROPERTY_3GPP_OPERATOR_CODE, G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); g_object_bind_property (skeleton, "operator-name", - status, MM_COMMON_SIMPLE_PROPERTY_3GPP_OPERATOR_NAME, + status, MM_SIMPLE_PROPERTY_3GPP_OPERATOR_NAME, G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); g_object_unref (skeleton); diff --git a/src/mm-iface-modem-3gpp.h b/src/mm-iface-modem-3gpp.h index 8c88c05c..3168399c 100644 --- a/src/mm-iface-modem-3gpp.h +++ b/src/mm-iface-modem-3gpp.h @@ -272,6 +272,6 @@ void mm_iface_modem_3gpp_register_in_network (MMIfaceModem3gpp *self, /* Bind properties for simple GetStatus() */ void mm_iface_modem_3gpp_bind_simple_status (MMIfaceModem3gpp *self, - MMCommonSimpleProperties *status); + MMSimpleStatus *status); #endif /* MM_IFACE_MODEM_3GPP_H */ diff --git a/src/mm-iface-modem-cdma.c b/src/mm-iface-modem-cdma.c index 7c305178..c5983ddf 100644 --- a/src/mm-iface-modem-cdma.c +++ b/src/mm-iface-modem-cdma.c @@ -37,7 +37,7 @@ static GQuark registration_check_context_quark; void mm_iface_modem_cdma_bind_simple_status (MMIfaceModemCdma *self, - MMCommonSimpleProperties *status) + MMSimpleStatus *status) { MmGdbusModemCdma *skeleton; @@ -45,21 +45,20 @@ mm_iface_modem_cdma_bind_simple_status (MMIfaceModemCdma *self, MM_IFACE_MODEM_CDMA_DBUS_SKELETON, &skeleton, NULL); - g_object_bind_property (skeleton, "cdma1x-registration-state", - status, MM_COMMON_SIMPLE_PROPERTY_CDMA_CDMA1X_REGISTRATION_STATE, + status, MM_SIMPLE_PROPERTY_CDMA_CDMA1X_REGISTRATION_STATE, G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); g_object_bind_property (skeleton, "sid", - status, MM_COMMON_SIMPLE_PROPERTY_CDMA_SID, + status, MM_SIMPLE_PROPERTY_CDMA_SID, G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); g_object_bind_property (skeleton, "nid", - status, MM_COMMON_SIMPLE_PROPERTY_CDMA_NID, + status, MM_SIMPLE_PROPERTY_CDMA_NID, G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); g_object_bind_property (skeleton, "evdo-registration-state", - status, MM_COMMON_SIMPLE_PROPERTY_CDMA_EVDO_REGISTRATION_STATE, + status, MM_SIMPLE_PROPERTY_CDMA_EVDO_REGISTRATION_STATE, G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); g_object_unref (skeleton); diff --git a/src/mm-iface-modem-cdma.h b/src/mm-iface-modem-cdma.h index 9de17860..f95c733f 100644 --- a/src/mm-iface-modem-cdma.h +++ b/src/mm-iface-modem-cdma.h @@ -212,6 +212,6 @@ gboolean mm_iface_modem_cdma_register_in_network_finish (MMIfaceModemCdma *self, /* Bind properties for simple GetStatus() */ void mm_iface_modem_cdma_bind_simple_status (MMIfaceModemCdma *self, - MMCommonSimpleProperties *status); + MMSimpleStatus *status); #endif /* MM_IFACE_MODEM_CDMA_H */ diff --git a/src/mm-iface-modem-location.c b/src/mm-iface-modem-location.c index 5ff3ef3d..a021a563 100644 --- a/src/mm-iface-modem-location.c +++ b/src/mm-iface-modem-location.c @@ -28,7 +28,7 @@ static GQuark location_context_quark; void mm_iface_modem_location_bind_simple_status (MMIfaceModemLocation *self, - MMCommonSimpleProperties *status) + MMSimpleStatus *status) { } diff --git a/src/mm-iface-modem-location.h b/src/mm-iface-modem-location.h index 4634fd1b..f18ebbb4 100644 --- a/src/mm-iface-modem-location.h +++ b/src/mm-iface-modem-location.h @@ -98,6 +98,6 @@ void mm_iface_modem_location_3gpp_update_lac_ci (MMIfaceModemLocation *self, /* Bind properties for simple GetStatus() */ void mm_iface_modem_location_bind_simple_status (MMIfaceModemLocation *self, - MMCommonSimpleProperties *status); + MMSimpleStatus *status); #endif /* MM_IFACE_MODEM_LOCATION_H */ diff --git a/src/mm-iface-modem-messaging.c b/src/mm-iface-modem-messaging.c index 6a30bd60..2545cdc0 100644 --- a/src/mm-iface-modem-messaging.c +++ b/src/mm-iface-modem-messaging.c @@ -33,7 +33,7 @@ static GQuark storage_context_quark; void mm_iface_modem_messaging_bind_simple_status (MMIfaceModemMessaging *self, - MMCommonSimpleProperties *status) + MMSimpleStatus *status) { } diff --git a/src/mm-iface-modem-messaging.h b/src/mm-iface-modem-messaging.h index 475a8001..c08bf131 100644 --- a/src/mm-iface-modem-messaging.h +++ b/src/mm-iface-modem-messaging.h @@ -159,7 +159,7 @@ void mm_iface_modem_messaging_shutdown (MMIfaceModemMessaging *self); /* Bind properties for simple GetStatus() */ void mm_iface_modem_messaging_bind_simple_status (MMIfaceModemMessaging *self, - MMCommonSimpleProperties *status); + MMSimpleStatus *status); /* Report new SMS part */ gboolean mm_iface_modem_messaging_take_part (MMIfaceModemMessaging *self, diff --git a/src/mm-iface-modem-simple.c b/src/mm-iface-modem-simple.c index 007ab529..5424e11d 100644 --- a/src/mm-iface-modem-simple.c +++ b/src/mm-iface-modem-simple.c @@ -753,18 +753,18 @@ handle_get_status (MmGdbusModemSimple *skeleton, GDBusMethodInvocation *invocation, MMIfaceModemSimple *self) { - MMCommonSimpleProperties *properties = NULL; + MMSimpleStatus *status = NULL; GVariant *dictionary; g_object_get (self, - MM_IFACE_MODEM_SIMPLE_STATUS, &properties, + MM_IFACE_MODEM_SIMPLE_STATUS, &status, NULL); - dictionary = mm_common_simple_properties_get_dictionary (properties); + dictionary = mm_simple_status_get_dictionary (status); mm_gdbus_modem_simple_complete_get_status (skeleton, invocation, dictionary); g_variant_unref (dictionary); - g_object_unref (properties); + g_object_unref (status); return TRUE; } @@ -845,7 +845,7 @@ iface_modem_simple_init (gpointer g_iface) g_param_spec_object (MM_IFACE_MODEM_SIMPLE_STATUS, "Simple status", "Compilation of status values", - MM_TYPE_COMMON_SIMPLE_PROPERTIES, + MM_TYPE_SIMPLE_STATUS, G_PARAM_READWRITE)); initialized = TRUE; diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c index 4eac0416..e3b823c5 100644 --- a/src/mm-iface-modem.c +++ b/src/mm-iface-modem.c @@ -44,7 +44,7 @@ static GQuark access_technologies_check_context_quark; void mm_iface_modem_bind_simple_status (MMIfaceModem *self, - MMCommonSimpleProperties *status) + MMSimpleStatus *status) { MmGdbusModem *skeleton; @@ -53,19 +53,19 @@ mm_iface_modem_bind_simple_status (MMIfaceModem *self, NULL); g_object_bind_property (skeleton, "state", - status, MM_COMMON_SIMPLE_PROPERTY_STATE, + status, MM_SIMPLE_PROPERTY_STATE, G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); g_object_bind_property (skeleton, "signal-quality", - status, MM_COMMON_SIMPLE_PROPERTY_SIGNAL_QUALITY, + status, MM_SIMPLE_PROPERTY_SIGNAL_QUALITY, G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); g_object_bind_property (skeleton, "bands", - status, MM_COMMON_SIMPLE_PROPERTY_BANDS, + status, MM_SIMPLE_PROPERTY_BANDS, G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); g_object_bind_property (skeleton, "access-technologies", - status, MM_COMMON_SIMPLE_PROPERTY_ACCESS_TECHNOLOGIES, + status, MM_SIMPLE_PROPERTY_ACCESS_TECHNOLOGIES, G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); g_object_unref (skeleton); diff --git a/src/mm-iface-modem.h b/src/mm-iface-modem.h index 0800bb31..32afffc1 100644 --- a/src/mm-iface-modem.h +++ b/src/mm-iface-modem.h @@ -403,6 +403,6 @@ MMBearer *mm_iface_modem_create_bearer_finish (MMIfaceModem *self, GError **error); void mm_iface_modem_bind_simple_status (MMIfaceModem *self, - MMCommonSimpleProperties *status); + MMSimpleStatus *status); #endif /* MM_IFACE_MODEM_H */ |