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
This commit is contained in:
Daniele Palmas
2015-03-13 16:25:48 +01:00
committed by Aleksander Morgado
parent f9a5848d71
commit a92566ec0e

View File

@@ -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) */
@@ -220,6 +223,46 @@ setup_flow_control (MMIfaceModem *self,
g_free (cmd);
}
/*****************************************************************************/
/* 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 *
@@ -252,6 +295,13 @@ iface_modem_init (MMIfaceModem *iface)
iface->setup_flow_control_finish = setup_flow_control_finish;
}
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)
{