diff options
-rw-r--r-- | plugins/telit/mm-broadband-modem-telit.c | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/plugins/telit/mm-broadband-modem-telit.c b/plugins/telit/mm-broadband-modem-telit.c index 2f44a4bd..971e85e7 100644 --- a/plugins/telit/mm-broadband-modem-telit.c +++ b/plugins/telit/mm-broadband-modem-telit.c @@ -29,12 +29,15 @@ #include "mm-modem-helpers.h" #include "mm-base-modem-at.h" #include "mm-iface-modem.h" +#include "mm-iface-modem-3gpp.h" #include "mm-broadband-modem-telit.h" static void iface_modem_init (MMIfaceModem *iface); +static void iface_modem_3gpp_init (MMIfaceModem3gpp *iface); G_DEFINE_TYPE_EXTENDED (MMBroadbandModemTelit, mm_broadband_modem_telit, 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)); /*****************************************************************************/ /* Load access technologies (Modem interface) */ @@ -221,6 +224,46 @@ setup_flow_control (MMIfaceModem *self, } /*****************************************************************************/ +/* Enabling unsolicited events (3GPP interface) */ + +static gboolean +modem_3gpp_enable_unsolicited_events_finish (MMIfaceModem3gpp *self, + GAsyncResult *res, + GError **error) +{ + /* Ignore errors */ + mm_base_modem_at_sequence_full_finish (MM_BASE_MODEM (self), + res, + NULL, + NULL); + return TRUE; +} + +static const MMBaseModemAtCommand unsolicited_enable_sequence[] = { + /* Enable +CIEV only for: signal, service, roam */ + { "AT+CIND=0,1,1,0,0,0,1,0,0", 5, FALSE, NULL }, + /* Telit modems +CMER command supports only <ind>=2 */ + { "+CMER=3,0,0,2", 5, FALSE, NULL }, + { NULL } +}; + +static void +modem_3gpp_enable_unsolicited_events (MMIfaceModem3gpp *self, + GAsyncReadyCallback callback, + gpointer user_data) +{ + mm_base_modem_at_sequence_full ( + MM_BASE_MODEM (self), + mm_base_modem_peek_port_secondary (MM_BASE_MODEM (self)), + unsolicited_enable_sequence, + NULL, /* response_processor_context */ + NULL, /* response_processor_context_free */ + NULL, /* cancellable */ + callback, + user_data); +} + +/*****************************************************************************/ MMBroadbandModemTelit * mm_broadband_modem_telit_new (const gchar *device, @@ -253,6 +296,13 @@ iface_modem_init (MMIfaceModem *iface) } static void +iface_modem_3gpp_init (MMIfaceModem3gpp *iface) +{ + iface->enable_unsolicited_events = modem_3gpp_enable_unsolicited_events; + iface->enable_unsolicited_events_finish = modem_3gpp_enable_unsolicited_events_finish; +} + +static void mm_broadband_modem_telit_class_init (MMBroadbandModemTelitClass *klass) { } |