diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-02-16 20:50:07 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-15 14:15:06 +0100 |
commit | 5589df8946793f14159bc1b341999fea1428e709 (patch) | |
tree | 72981fb73f61f515dc640fba774e889eced94db0 | |
parent | f0d516e556d19376bd24cc446f05a6354c20b4e8 (diff) |
cinterion: implement custom SMS indication enabling
-rw-r--r-- | plugins/mm-broadband-modem-cinterion.c | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/plugins/mm-broadband-modem-cinterion.c b/plugins/mm-broadband-modem-cinterion.c index cf4c6d5b..97a650a1 100644 --- a/plugins/mm-broadband-modem-cinterion.c +++ b/plugins/mm-broadband-modem-cinterion.c @@ -36,10 +36,12 @@ static void iface_modem_init (MMIfaceModem *iface); static void iface_modem_3gpp_init (MMIfaceModem3gpp *iface); +static void iface_modem_messaging_init (MMIfaceModemMessaging *iface); G_DEFINE_TYPE_EXTENDED (MMBroadbandModemCinterion, mm_broadband_modem_cinterion, MM_TYPE_BROADBAND_MODEM, 0, G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init) - G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_3GPP, iface_modem_3gpp_init)); + G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_3GPP, iface_modem_3gpp_init) + G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_MESSAGING, iface_modem_messaging_init)); struct _MMBroadbandModemCinterionPrivate { /* Flag to know if we should try AT^SIND or not to get psinfo */ @@ -87,6 +89,35 @@ enable_unsolicited_events (MMIfaceModem3gpp *self, } /*****************************************************************************/ +/* Enable unsolicited events (SMS indications) (Messaging interface) */ + +static gboolean +messaging_enable_unsolicited_events_finish (MMIfaceModemMessaging *self, + GAsyncResult *res, + GError **error) +{ + return !!mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, error); +} + +static void +messaging_enable_unsolicited_events (MMIfaceModemMessaging *self, + GAsyncReadyCallback callback, + gpointer user_data) +{ + /* AT+CNMI=<mode>,[<mt>[,<bm>[,<ds>[,<bfr>]]]] + * but <bfr> should be either not set, or equal to 1; + * and <ds> can be only either 0 or 2 (EGS5) + */ + mm_base_modem_at_command (MM_BASE_MODEM (self), + "+CNMI=2,1,2,2,1", + 3, + FALSE, + NULL, /* cancellable */ + callback, + user_data); +} + +/*****************************************************************************/ /* MODEM POWER DOWN */ static gboolean @@ -836,6 +867,13 @@ iface_modem_3gpp_init (MMIfaceModem3gpp *iface) } static void +iface_modem_messaging_init (MMIfaceModemMessaging *iface) +{ + iface->enable_unsolicited_events = messaging_enable_unsolicited_events; + iface->enable_unsolicited_events_finish = messaging_enable_unsolicited_events_finish; +} + +static void mm_broadband_modem_cinterion_class_init (MMBroadbandModemCinterionClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); |