telit: remove custom +CMER enabling

This is now managed directly in the generic plugin.
This commit is contained in:
Aleksander Morgado
2017-05-21 14:54:41 +02:00
parent ec98b9e956
commit 2b8a7e4c16
2 changed files with 60 additions and 26 deletions

View File

@@ -46,6 +46,7 @@ static void iface_modem_messaging_init (MMIfaceModemMessaging *iface);
static void iface_modem_location_init (MMIfaceModemLocation *iface); static void iface_modem_location_init (MMIfaceModemLocation *iface);
static MMIfaceModem *iface_modem_parent; static MMIfaceModem *iface_modem_parent;
static MMIfaceModem3gpp *iface_modem_3gpp_parent;
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)
@@ -1800,6 +1801,7 @@ iface_modem_init (MMIfaceModem *iface)
static void static void
iface_modem_3gpp_init (MMIfaceModem3gpp *iface) iface_modem_3gpp_init (MMIfaceModem3gpp *iface)
{ {
iface_modem_3gpp_parent = g_type_interface_peek_parent (iface);
iface->register_in_network = register_in_network; iface->register_in_network = register_in_network;
iface->register_in_network_finish = register_in_network_finish; iface->register_in_network_finish = register_in_network_finish;
} }

View File

@@ -37,6 +37,7 @@ static void iface_modem_init (MMIfaceModem *iface);
static void iface_modem_3gpp_init (MMIfaceModem3gpp *iface); static void iface_modem_3gpp_init (MMIfaceModem3gpp *iface);
static MMIfaceModem *iface_modem_parent; static MMIfaceModem *iface_modem_parent;
static MMIfaceModem3gpp *iface_modem_3gpp_parent;
G_DEFINE_TYPE_EXTENDED (MMBroadbandModemTelit, mm_broadband_modem_telit, MM_TYPE_BROADBAND_MODEM, 0, 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)
@@ -1220,40 +1221,69 @@ load_supported_modes (MMIfaceModem *self,
/* Enabling unsolicited events (3GPP interface) */ /* Enabling unsolicited events (3GPP interface) */
static gboolean static gboolean
modem_3gpp_enable_unsolicited_events_finish (MMIfaceModem3gpp *self, modem_3gpp_enable_unsolicited_events_finish (MMIfaceModem3gpp *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
/* Ignore errors */ return g_task_propagate_boolean (G_TASK (res), error);
mm_base_modem_at_sequence_full_finish (MM_BASE_MODEM (self),
res,
NULL,
NULL);
return TRUE;
} }
static const MMBaseModemAtCommand unsolicited_enable_sequence[] = { static void
/* Enable +CIEV only for: signal, service, roam */ cind_set_ready (MMBaseModem *self,
{ "AT+CIND=0,1,1,0,0,0,1,0,0", 5, FALSE, NULL }, GAsyncResult *res,
/* Telit modems +CMER command supports only <ind>=2 */ GTask *task)
{ "+CMER=3,0,0,2", 5, FALSE, NULL }, {
{ NULL } GError *error = NULL;
};
if (!mm_base_modem_at_command_finish (self, res, &error)) {
mm_warn ("Couldn't enable custom +CIND settings: %s", error->message);
g_error_free (error);
}
g_task_return_boolean (task, TRUE);
g_object_unref (task);
}
static void static void
modem_3gpp_enable_unsolicited_events (MMIfaceModem3gpp *self, parent_enable_unsolicited_events_ready (MMIfaceModem3gpp *self,
GAsyncReadyCallback callback, GAsyncResult *res,
gpointer user_data) GTask *task)
{ {
mm_base_modem_at_sequence_full ( GError *error = NULL;
if (!iface_modem_3gpp_parent->enable_unsolicited_events_finish (self, res, &error)) {
mm_warn ("Couldn't enable parent 3GPP unsolicited events: %s", error->message);
g_error_free (error);
}
/* Our own enable now */
mm_base_modem_at_command_full (
MM_BASE_MODEM (self), MM_BASE_MODEM (self),
mm_base_modem_peek_port_secondary (MM_BASE_MODEM (self)), mm_base_modem_peek_port_secondary (MM_BASE_MODEM (self)),
unsolicited_enable_sequence, /* Enable +CIEV only for: signal, service, roam */
NULL, /* response_processor_context */ "AT+CIND=0,1,1,0,0,0,1,0,0",
NULL, /* response_processor_context_free */ 5,
NULL, /* cancellable */ FALSE,
callback, FALSE,
user_data); NULL, /* cancellable */
(GAsyncReadyCallback)cind_set_ready,
task);
}
static void
modem_3gpp_enable_unsolicited_events (MMIfaceModem3gpp *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
GTask *task;
task = g_task_new (self, NULL, callback, user_data);
/* Chain up parent's enable */
iface_modem_3gpp_parent->enable_unsolicited_events (
self,
(GAsyncReadyCallback)parent_enable_unsolicited_events_ready,
task);
} }
/*****************************************************************************/ /*****************************************************************************/
@@ -1319,6 +1349,8 @@ iface_modem_init (MMIfaceModem *iface)
static void static void
iface_modem_3gpp_init (MMIfaceModem3gpp *iface) iface_modem_3gpp_init (MMIfaceModem3gpp *iface)
{ {
iface_modem_3gpp_parent = g_type_interface_peek_parent (iface);
iface->enable_unsolicited_events = modem_3gpp_enable_unsolicited_events; iface->enable_unsolicited_events = modem_3gpp_enable_unsolicited_events;
iface->enable_unsolicited_events_finish = modem_3gpp_enable_unsolicited_events_finish; iface->enable_unsolicited_events_finish = modem_3gpp_enable_unsolicited_events_finish;
} }