cinterion: implement custom SMS indication enabling

This commit is contained in:
Aleksander Morgado
2012-02-16 20:50:07 +01:00
parent f0d516e556
commit 5589df8946

View File

@@ -36,10 +36,12 @@
static void iface_modem_init (MMIfaceModem *iface); static void iface_modem_init (MMIfaceModem *iface);
static void iface_modem_3gpp_init (MMIfaceModem3gpp *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_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, 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 { struct _MMBroadbandModemCinterionPrivate {
/* Flag to know if we should try AT^SIND or not to get psinfo */ /* Flag to know if we should try AT^SIND or not to get psinfo */
@@ -86,6 +88,35 @@ enable_unsolicited_events (MMIfaceModem3gpp *self,
user_data); user_data);
} }
/*****************************************************************************/
/* 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 */ /* MODEM POWER DOWN */
@@ -835,6 +866,13 @@ iface_modem_3gpp_init (MMIfaceModem3gpp *iface)
iface->enable_unsolicited_events_finish = enable_unsolicited_events_finish; iface->enable_unsolicited_events_finish = enable_unsolicited_events_finish;
} }
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 static void
mm_broadband_modem_cinterion_class_init (MMBroadbandModemCinterionClass *klass) mm_broadband_modem_cinterion_class_init (MMBroadbandModemCinterionClass *klass)
{ {