aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-01-22 00:14:39 +0100
committerAleksander Morgado <aleksander@lanedo.com>2012-03-15 14:14:56 +0100
commit6d5c98b30c6cc19ae7bac33171e33244358fd746 (patch)
tree4d987edbc17acb32d86d4fb702019d31f7f42d90
parent5667339ead6df6d4877e7c15233227da1e090a32 (diff)
cinterion: implement custom unsolicited events enabling command
-rw-r--r--plugins/mm-broadband-modem-cinterion.c46
1 files changed, 44 insertions, 2 deletions
diff --git a/plugins/mm-broadband-modem-cinterion.c b/plugins/mm-broadband-modem-cinterion.c
index 937b81c6..d518005e 100644
--- a/plugins/mm-broadband-modem-cinterion.c
+++ b/plugins/mm-broadband-modem-cinterion.c
@@ -29,13 +29,16 @@
#include "mm-log.h"
#include "mm-errors-types.h"
#include "mm-iface-modem.h"
+#include "mm-iface-modem-3gpp.h"
#include "mm-base-modem-at.h"
#include "mm-broadband-modem-cinterion.h"
-static void iface_modem_init (MMIfaceModem *iface);
+static void iface_modem_init (MMIfaceModem *iface);
+static void iface_modem_3gpp_init (MMIfaceModem3gpp *iface);
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)
+ G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_3GPP, iface_modem_3gpp_init));
struct _MMBroadbandModemCinterionPrivate {
/* Command to go into sleep mode */
@@ -48,6 +51,38 @@ struct _MMBroadbandModemCinterionPrivate {
};
/*****************************************************************************/
+/* Unsolicited events enabling */
+
+static gboolean
+enable_unsolicited_events_finish (MMIfaceModem3gpp *self,
+ GAsyncResult *res,
+ GError **error)
+{
+ return !!mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, error);
+}
+
+static void
+enable_unsolicited_events (MMIfaceModem3gpp *self,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ mm_base_modem_at_command_in_port (
+ MM_BASE_MODEM (self),
+ /* Only primary port is expected in the Cinterion modems */
+ mm_base_modem_get_port_primary (MM_BASE_MODEM (self)),
+ /* AT=CMER=[<mode>[,<keyp>[,<disp>[,<ind>[,<bfr>]]]]]
+ * but <ind> should be either not set, or equal to 0 or 2.
+ * Enabled with 2.
+ */
+ "+CMER=3,0,0,2",
+ 3,
+ FALSE,
+ NULL, /* cancellable */
+ callback,
+ user_data);
+}
+
+/*****************************************************************************/
/* MODEM POWER DOWN */
static gboolean
@@ -337,6 +372,13 @@ iface_modem_init (MMIfaceModem *iface)
}
static void
+iface_modem_3gpp_init (MMIfaceModem3gpp *iface)
+{
+ iface->enable_unsolicited_events = enable_unsolicited_events;
+ iface->enable_unsolicited_events_finish = enable_unsolicited_events_finish;
+}
+
+static void
mm_broadband_modem_cinterion_class_init (MMBroadbandModemCinterionClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);