gsm: let plugins use their own commands for SMS indications and storage configuration

This commit is contained in:
Aleksander Morgado
2011-05-16 15:22:23 +02:00
parent 8c1430763f
commit 85569f77e9
2 changed files with 47 additions and 10 deletions

View File

@@ -1439,9 +1439,16 @@ mm_generic_gsm_enable_complete (MMGenericGsm *self,
g_free (cmd);
/* Enable SMS notifications */
mm_at_serial_port_queue_command (priv->primary, "+CNMI=2,1,2,1,0", 3, NULL, NULL);
/* Set SMS storage location to ME */
mm_at_serial_port_queue_command (priv->primary, "+CPMS=\"ME\",\"ME\",\"ME\"", 3, NULL, NULL);
g_object_get (G_OBJECT (info->modem), MM_GENERIC_GSM_SMS_INDICATION_ENABLE_CMD, &cmd, NULL);
if (cmd && strlen (cmd))
mm_at_serial_port_queue_command (priv->primary, cmd, 3, NULL, NULL);
g_free (cmd);
/* Set SMS storage locations */
g_object_get (G_OBJECT (info->modem), MM_GENERIC_GSM_SMS_STORAGE_LOCATION_CMD, &cmd, NULL);
if (cmd && strlen (cmd))
mm_at_serial_port_queue_command (priv->primary, cmd, 3, NULL, NULL);
g_free (cmd);
mm_at_serial_port_queue_command (priv->primary, "+CIND=?", 3, cind_cb, self);
@@ -5615,6 +5622,8 @@ set_property (GObject *object, guint prop_id,
case MM_GENERIC_GSM_PROP_USSD_NETWORK_REQUEST:
case MM_GENERIC_GSM_PROP_USSD_NETWORK_NOTIFICATION:
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:
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -5726,6 +5735,14 @@ get_property (GObject *object, guint prop_id,
/* By default, try to set XOFF/XON flow control */
g_value_set_string (value, "+IFC=1,1");
break;
case MM_GENERIC_GSM_PROP_SMS_INDICATION_ENABLE_CMD:
/* Enable SMS notifications */
g_value_set_string (value, "+CNMI=2,1,2,1,0");
break;
case MM_GENERIC_GSM_PROP_SMS_STORAGE_LOCATION_CMD:
/* Use always ME to store SMS */
g_value_set_string (value, "+CPMS=\"ME\",\"ME\",\"ME\"");
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -5878,5 +5895,21 @@ mm_generic_gsm_class_init (MMGenericGsmClass *klass)
"Flow control configuration command (errors ignored)",
"+IFC=1,1",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property
(object_class, MM_GENERIC_GSM_PROP_SMS_INDICATION_ENABLE_CMD,
g_param_spec_string (MM_GENERIC_GSM_SMS_INDICATION_ENABLE_CMD,
"SmsIndicationEnableCommand",
"SMS indication enable command (errors ignored)",
"+CNMI=2,1,2,1,0",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property
(object_class, MM_GENERIC_GSM_PROP_SMS_STORAGE_LOCATION_CMD,
g_param_spec_string (MM_GENERIC_GSM_SMS_STORAGE_LOCATION_CMD,
"SmsStorageLocationCommand",
"SMS storage location command (errors ignored)",
"+CPMS=\"ME\",\"ME\",\"ME\"",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
}

View File

@@ -38,6 +38,8 @@
#define MM_GENERIC_GSM_INIT_CMD "init-cmd"
#define MM_GENERIC_GSM_INIT_CMD_OPTIONAL "init-cmd-optional"
#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"
typedef enum {
MM_GENERIC_GSM_PROP_FIRST = 0x2000,
@@ -58,7 +60,9 @@ typedef enum {
MM_GENERIC_GSM_PROP_USSD_STATE,
MM_GENERIC_GSM_PROP_USSD_NETWORK_REQUEST,
MM_GENERIC_GSM_PROP_USSD_NETWORK_NOTIFICATION,
MM_GENERIC_GSM_PROP_FLOW_CONTROL_CMD
MM_GENERIC_GSM_PROP_FLOW_CONTROL_CMD,
MM_GENERIC_GSM_PROP_SMS_INDICATION_ENABLE_CMD,
MM_GENERIC_GSM_PROP_SMS_STORAGE_LOCATION_CMD,
} MMGenericGsmProp;
typedef enum {