aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2011-05-16 16:07:49 +0200
committerAleksander Morgado <aleksander@lanedo.com>2011-06-06 17:20:16 +0200
commit1e507824c62b7c512f57109ff9b0d395f7d2429f (patch)
tree44eddb689586c8f58f2f016b0fa7552bb7711964 /src
parent85569f77e9328d753ffe1cc9937ef063f6a92bd5 (diff)
gsm: let plugins use their own command for CMER enabling
Diffstat (limited to 'src')
-rw-r--r--src/mm-generic-gsm.c29
-rw-r--r--src/mm-generic-gsm.h2
2 files changed, 28 insertions, 3 deletions
diff --git a/src/mm-generic-gsm.c b/src/mm-generic-gsm.c
index a91da044..29203ab0 100644
--- a/src/mm-generic-gsm.c
+++ b/src/mm-generic-gsm.c
@@ -1358,8 +1358,14 @@ cmer_cb (MMAtSerialPort *port,
priv->cmer_enabled = TRUE;
/* Enable CMER on the secondary port if we can too */
- if (priv->secondary && mm_serial_port_is_open (MM_SERIAL_PORT (priv->secondary)))
- mm_at_serial_port_queue_command (priv->secondary, "+CMER=3,0,0,1", 3, NULL, NULL);
+ if (priv->secondary && mm_serial_port_is_open (MM_SERIAL_PORT (priv->secondary))) {
+ gchar *cmd = NULL;
+
+ g_object_get (G_OBJECT (user_data), MM_GENERIC_GSM_CMER_ENABLE_CMD, &cmd, NULL);
+ if (cmd && strlen (cmd))
+ mm_at_serial_port_queue_command (priv->secondary, cmd, 3, NULL, NULL);
+ g_free (cmd);
+ }
}
}
@@ -1382,6 +1388,7 @@ cind_cb (MMAtSerialPort *port,
indicators = mm_parse_cind_test_response (response->str, NULL);
if (indicators) {
CindResponse *r;
+ gchar *cmd = NULL;
r = g_hash_table_lookup (indicators, "signal");
if (r)
@@ -1395,7 +1402,11 @@ cind_cb (MMAtSerialPort *port,
if (r)
priv->service_ind = cind_response_get_index (r);
- mm_at_serial_port_queue_command (port, "+CMER=3,0,0,1", 3, cmer_cb, self);
+ /* Enable CMER in the primary port */
+ g_object_get (G_OBJECT (user_data), MM_GENERIC_GSM_CMER_ENABLE_CMD, &cmd, NULL);
+ if (cmd && strlen (cmd))
+ mm_at_serial_port_queue_command (port, cmd, 3, cmer_cb, self);
+ g_free (cmd);
g_hash_table_destroy (indicators);
}
}
@@ -5624,6 +5635,7 @@ set_property (GObject *object, guint prop_id,
case MM_GENERIC_GSM_PROP_FLOW_CONTROL_CMD:
case MM_GENERIC_GSM_PROP_SMS_INDICATION_ENABLE_CMD:
case MM_GENERIC_GSM_PROP_SMS_STORAGE_LOCATION_CMD:
+ case MM_GENERIC_GSM_PROP_CMER_ENABLE_CMD:
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -5743,6 +5755,9 @@ get_property (GObject *object, guint prop_id,
/* Use always ME to store SMS */
g_value_set_string (value, "+CPMS=\"ME\",\"ME\",\"ME\"");
break;
+ case MM_GENERIC_GSM_PROP_CMER_ENABLE_CMD:
+ g_value_set_string (value, "+CMER=3,0,0,1");
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -5911,5 +5926,13 @@ mm_generic_gsm_class_init (MMGenericGsmClass *klass)
"SMS storage location command (errors ignored)",
"+CPMS=\"ME\",\"ME\",\"ME\"",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property
+ (object_class, MM_GENERIC_GSM_PROP_CMER_ENABLE_CMD,
+ g_param_spec_string (MM_GENERIC_GSM_CMER_ENABLE_CMD,
+ "CmerEnableCommand",
+ "CMER enable command",
+ "+CMER=3,0,0,1",
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
}
diff --git a/src/mm-generic-gsm.h b/src/mm-generic-gsm.h
index 0e582e98..5afab3c8 100644
--- a/src/mm-generic-gsm.h
+++ b/src/mm-generic-gsm.h
@@ -40,6 +40,7 @@
#define MM_GENERIC_GSM_FLOW_CONTROL_CMD "flow-control-cmd"
#define MM_GENERIC_GSM_SMS_INDICATION_ENABLE_CMD "sms-enable-cmd"
#define MM_GENERIC_GSM_SMS_STORAGE_LOCATION_CMD "sms-storage-cmd"
+#define MM_GENERIC_GSM_CMER_ENABLE_CMD "cmer-enable-cmd"
typedef enum {
MM_GENERIC_GSM_PROP_FIRST = 0x2000,
@@ -63,6 +64,7 @@ typedef enum {
MM_GENERIC_GSM_PROP_FLOW_CONTROL_CMD,
MM_GENERIC_GSM_PROP_SMS_INDICATION_ENABLE_CMD,
MM_GENERIC_GSM_PROP_SMS_STORAGE_LOCATION_CMD,
+ MM_GENERIC_GSM_PROP_CMER_ENABLE_CMD
} MMGenericGsmProp;
typedef enum {