aboutsummaryrefslogtreecommitdiff
path: root/libmm-common/mm-common-helpers.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-01-08 16:04:58 +0100
committerAleksander Morgado <aleksander@lanedo.com>2012-03-15 14:14:47 +0100
commit1c447ba85b4ec22a42e1c9f5d3e0bb7ae2c11bdc (patch)
treee1fb5e7f84f0d3238b21924202d9942bf61b2ec1 /libmm-common/mm-common-helpers.c
parentfa0dba6a6e797d532a7f130f5b1f9a2561e72989 (diff)
libmm-common: expect 'rm-protocol' in the common bearer properties
Diffstat (limited to 'libmm-common/mm-common-helpers.c')
-rw-r--r--libmm-common/mm-common-helpers.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/libmm-common/mm-common-helpers.c b/libmm-common/mm-common-helpers.c
index fb52b475..5410a313 100644
--- a/libmm-common/mm-common-helpers.c
+++ b/libmm-common/mm-common-helpers.c
@@ -375,6 +375,29 @@ mm_common_get_boolean_from_string (const gchar *value,
return FALSE;
}
+MMModemCdmaRmProtocol
+mm_common_get_rm_protocol_from_string (const gchar *str,
+ GError **error)
+{
+ GEnumClass *enum_class;
+ guint i;
+
+ enum_class = G_ENUM_CLASS (g_type_class_ref (MM_TYPE_MODEM_CDMA_RM_PROTOCOL));
+
+
+ for (i = 0; enum_class->values[i].value_nick; i++) {
+ if (!g_ascii_strcasecmp (str, enum_class->values[i].value_nick))
+ return enum_class->values[i].value;
+ }
+
+ g_set_error (error,
+ MM_CORE_ERROR,
+ MM_CORE_ERROR_INVALID_ARGS,
+ "Couldn't match '%s' with a valid MMModemCdmaRmProtocol value",
+ str);
+ return MM_MODEM_CDMA_RM_PROTOCOL_UNKNOWN;
+}
+
GVariant *
mm_common_build_bands_unknown (void)
{