aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/quectel/mm-broadband-modem-qmi-quectel.c15
-rw-r--r--plugins/quectel/mm-broadband-modem-quectel.c14
-rw-r--r--plugins/quectel/mm-shared-quectel.c35
-rw-r--r--plugins/quectel/mm-shared-quectel.h10
4 files changed, 68 insertions, 6 deletions
diff --git a/plugins/quectel/mm-broadband-modem-qmi-quectel.c b/plugins/quectel/mm-broadband-modem-qmi-quectel.c
index 800c2341..067b4601 100644
--- a/plugins/quectel/mm-broadband-modem-qmi-quectel.c
+++ b/plugins/quectel/mm-broadband-modem-qmi-quectel.c
@@ -10,18 +10,21 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details:
*
- * Copyright (C) 2018 Aleksander Morgado <aleksander@aleksander.es>
+ * Copyright (C) 2018-2020 Aleksander Morgado <aleksander@aleksander.es>
*/
#include <config.h>
#include "mm-broadband-modem-qmi-quectel.h"
-#include "mm-shared-quectel.h"
#include "mm-iface-modem-firmware.h"
+#include "mm-iface-modem-location.h"
+#include "mm-iface-modem-time.h"
+#include "mm-shared-quectel.h"
static void iface_modem_init (MMIfaceModem *iface);
static void iface_modem_firmware_init (MMIfaceModemFirmware *iface);
static void iface_modem_location_init (MMIfaceModemLocation *iface);
+static void iface_modem_time_init (MMIfaceModemTime *iface);
static void shared_quectel_init (MMSharedQuectel *iface);
static MMIfaceModemLocation *iface_modem_location_parent;
@@ -30,6 +33,7 @@ G_DEFINE_TYPE_EXTENDED (MMBroadbandModemQmiQuectel, mm_broadband_modem_qmi_quect
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init)
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_FIRMWARE, iface_modem_firmware_init)
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_LOCATION, iface_modem_location_init)
+ G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_TIME, iface_modem_time_init)
G_IMPLEMENT_INTERFACE (MM_TYPE_SHARED_QUECTEL, shared_quectel_init))
/*****************************************************************************/
@@ -89,6 +93,13 @@ peek_parent_location_interface (MMSharedQuectel *self)
}
static void
+iface_modem_time_init (MMIfaceModemTime *iface)
+{
+ iface->check_support = mm_shared_quectel_time_check_support;
+ iface->check_support_finish = mm_shared_quectel_time_check_support_finish;
+}
+
+static void
shared_quectel_init (MMSharedQuectel *iface)
{
iface->peek_parent_location_interface = peek_parent_location_interface;
diff --git a/plugins/quectel/mm-broadband-modem-quectel.c b/plugins/quectel/mm-broadband-modem-quectel.c
index 4fdfdfcf..f6b6e176 100644
--- a/plugins/quectel/mm-broadband-modem-quectel.c
+++ b/plugins/quectel/mm-broadband-modem-quectel.c
@@ -10,19 +10,21 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details:
*
- * Copyright (C) 2018 Aleksander Morgado <aleksander@aleksander.es>
+ * Copyright (C) 2018-2020 Aleksander Morgado <aleksander@aleksander.es>
*/
#include <config.h>
#include "mm-broadband-modem-quectel.h"
-#include "mm-shared-quectel.h"
#include "mm-iface-modem-firmware.h"
#include "mm-iface-modem-location.h"
+#include "mm-iface-modem-time.h"
+#include "mm-shared-quectel.h"
static void iface_modem_init (MMIfaceModem *iface);
static void iface_modem_firmware_init (MMIfaceModemFirmware *iface);
static void iface_modem_location_init (MMIfaceModemLocation *iface);
+static void iface_modem_time_init (MMIfaceModemTime *iface);
static void shared_quectel_init (MMSharedQuectel *iface);
static MMIfaceModemLocation *iface_modem_location_parent;
@@ -31,6 +33,7 @@ G_DEFINE_TYPE_EXTENDED (MMBroadbandModemQuectel, mm_broadband_modem_quectel, MM_
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init)
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_FIRMWARE, iface_modem_firmware_init)
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_LOCATION, iface_modem_location_init)
+ G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_TIME, iface_modem_time_init)
G_IMPLEMENT_INTERFACE (MM_TYPE_SHARED_QUECTEL, shared_quectel_init))
/*****************************************************************************/
@@ -90,6 +93,13 @@ peek_parent_location_interface (MMSharedQuectel *self)
}
static void
+iface_modem_time_init (MMIfaceModemTime *iface)
+{
+ iface->check_support = mm_shared_quectel_time_check_support;
+ iface->check_support_finish = mm_shared_quectel_time_check_support_finish;
+}
+
+static void
shared_quectel_init (MMSharedQuectel *iface)
{
iface->peek_parent_location_interface = peek_parent_location_interface;
diff --git a/plugins/quectel/mm-shared-quectel.c b/plugins/quectel/mm-shared-quectel.c
index e10d581d..cdb7dab3 100644
--- a/plugins/quectel/mm-shared-quectel.c
+++ b/plugins/quectel/mm-shared-quectel.c
@@ -10,7 +10,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details:
*
- * Copyright (C) 2018 Aleksander Morgado <aleksander@aleksander.es>
+ * Copyright (C) 2018-2020 Aleksander Morgado <aleksander@aleksander.es>
*/
#include <config.h>
@@ -574,6 +574,39 @@ mm_shared_quectel_disable_location_gathering (MMIfaceModemLocation *self,
g_object_unref (task);
}
+/*****************************************************************************/
+
+/* Custom time support check because Quectel modems require +CTZU=3 in order to
+ * have the CCLK? time reported in localtime, instead of UTC time. */
+static const MMBaseModemAtCommand time_check_sequence[] = {
+ { "+CTZU=3", 3, TRUE, mm_base_modem_response_processor_no_result_continue },
+ { "+CCLK?", 3, TRUE, mm_base_modem_response_processor_string },
+ { NULL }
+};
+
+gboolean
+mm_shared_quectel_time_check_support_finish (MMIfaceModemTime *self,
+ GAsyncResult *res,
+ GError **error)
+{
+ return !!mm_base_modem_at_sequence_finish (MM_BASE_MODEM (self), res, NULL, error);
+}
+
+void
+mm_shared_quectel_time_check_support (MMIfaceModemTime *self,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ mm_base_modem_at_sequence (MM_BASE_MODEM (self),
+ time_check_sequence,
+ NULL, /* response_processor_context */
+ NULL, /* response_processor_context_free */
+ callback,
+ user_data);
+}
+
+/*****************************************************************************/
+
static void
shared_quectel_init (gpointer g_iface)
{
diff --git a/plugins/quectel/mm-shared-quectel.h b/plugins/quectel/mm-shared-quectel.h
index e628b22c..88023b3b 100644
--- a/plugins/quectel/mm-shared-quectel.h
+++ b/plugins/quectel/mm-shared-quectel.h
@@ -10,7 +10,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details:
*
- * Copyright (C) 2018 Aleksander Morgado <aleksander@aleksander.es>
+ * Copyright (C) 2018-2020 Aleksander Morgado <aleksander@aleksander.es>
*/
#ifndef MM_SHARED_QUECTEL_H
@@ -26,6 +26,7 @@
#include "mm-iface-modem.h"
#include "mm-iface-modem-firmware.h"
#include "mm-iface-modem-location.h"
+#include "mm-iface-modem-time.h"
#define MM_TYPE_SHARED_QUECTEL (mm_shared_quectel_get_type ())
#define MM_SHARED_QUECTEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_SHARED_QUECTEL, MMSharedQuectel))
@@ -78,4 +79,11 @@ gboolean mm_shared_quectel_disable_location_gathering_finish (MMIfa
GAsyncResult *res,
GError **error);
+void mm_shared_quectel_time_check_support (MMIfaceModemTime *self,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+gboolean mm_shared_quectel_time_check_support_finish (MMIfaceModemTime *self,
+ GAsyncResult *res,
+ GError **error);
+
#endif /* MM_SHARED_QUECTEL_H */