iridium: implement custom SMS indication enabling

This commit is contained in:
Aleksander Morgado
2012-02-16 20:45:25 +01:00
parent 4e55b16f9a
commit 6d8404a6ab

View File

@@ -35,10 +35,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 (MMBroadbandModemIridium, mm_broadband_modem_iridium, 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));
/*****************************************************************************/
/* Initializing the modem (Modem interface) */
@@ -171,6 +173,38 @@ load_operator_name_or_code (MMIfaceModem3gpp *self,
g_object_unref (result);
}
/*****************************************************************************/
/* 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 <bm> can only be 0,
* and <ds> can only be either 0 or 1
*
* Note: Modem may return +CMS ERROR:322, which indicates Memory Full,
* not a big deal
*/
mm_base_modem_at_command (MM_BASE_MODEM (self),
"+CNMI=2,1,0,0,1",
3,
FALSE,
NULL, /* cancellable */
callback,
user_data);
}
/*****************************************************************************/
/* Signal quality (Modem interface) */
@@ -393,6 +427,13 @@ iface_modem_3gpp_init (MMIfaceModem3gpp *iface)
iface->scan_networks_finish = NULL;
}
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_iridium_class_init (MMBroadbandModemIridiumClass *klass)
{