aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniele Palmas <dnlplm@gmail.com>2015-03-13 16:25:48 +0100
committerAleksander Morgado <aleksander@aleksander.es>2015-03-13 19:04:02 +0100
commita92566ec0e01bc606fd3673276eb5f7ece3b8291 (patch)
tree681756c6bf2a969b07b6535cfed7c36f41f76582
parentf9a5848d71972797a2871c6ccceaa6d9123eb8de (diff)
telit: adding 3gpp unsolicited events support for Telit modems
Mobile Equipment Event Reporting command for Telit modems (+CMER) does not support <ind>=1. Changing to <ind>=2
-rw-r--r--plugins/telit/mm-broadband-modem-telit.c52
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)
{
}