Implement network monitoring driver for gemalto modems that
are able to provide serving cell information and basic
measurements using AT+CQS and AT^SMONI commands.
---
Makefile.am | 3 +-
drivers/gemaltomodem/gemaltomodem.c | 2 +
drivers/gemaltomodem/gemaltomodem.h | 3 +
drivers/gemaltomodem/netmon.c | 609
4 files changed, 616 insertions(+), 1 deletion(-)
create mode 100644 drivers/gemaltomodem/netmon.c
diff --git a/Makefile.am b/Makefile.am
index c0631081..5e7614c1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -483,7 +483,8 @@ builtin_sources += drivers/atmodem/atutil.h \
drivers/gemaltomodem/gemaltomodem.c \
drivers/gemaltomodem/location-reporting.c \
drivers/gemaltomodem/voicecall.c \
- drivers/gemaltomodem/gprs-context.c
+ drivers/gemaltomodem/gprs-context.c \
+ drivers/gemaltomodem/netmon.c
builtin_modules += xmm7modem
builtin_sources += drivers/atmodem/atutil.h \
diff --git a/drivers/gemaltomodem/gemaltomodem.c
b/drivers/gemaltomodem/gemaltomodem.c
index 4b20dd1b..f7e4ff3e 100644
--- a/drivers/gemaltomodem/gemaltomodem.c
+++ b/drivers/gemaltomodem/gemaltomodem.c
@@ -38,6 +38,7 @@ static int gemaltomodem_init(void)
gemalto_location_reporting_init();
gemalto_gprs_context_init();
gemalto_voicecall_init();
+ gemalto_netmon_init();
return 0;
}
@@ -47,6 +48,7 @@ static void gemaltomodem_exit(void)
gemalto_location_reporting_exit();
gemalto_gprs_context_exit();
gemalto_voicecall_exit();
+ gemalto_netmon_exit();
}
OFONO_PLUGIN_DEFINE(gemaltomodem, "Gemalto modem driver", VERSION,
diff --git a/drivers/gemaltomodem/gemaltomodem.h
b/drivers/gemaltomodem/gemaltomodem.h
index dc0d346b..ae8f2141 100644
--- a/drivers/gemaltomodem/gemaltomodem.h
+++ b/drivers/gemaltomodem/gemaltomodem.h
@@ -30,3 +30,6 @@ extern void gemalto_voicecall_exit();
extern void gemalto_gprs_context_init();
extern void gemalto_gprs_context_exit();
+
+extern void gemalto_netmon_init(void);
+extern void gemalto_netmon_exit(void);
diff --git a/drivers/gemaltomodem/netmon.c b/drivers/gemaltomodem/netmon.c
new file mode 100644
index ..93e6d02f
--- /dev/null
+++ b/drivers/gemaltomodem/netmon.c
@@ -0,0 +1,609 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include
+#endif
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+#include
+#include
+#include
+#include
+
+#include "gatchat.h"
+#include "gatresult.h"
+
+#include "common.h"
+#include "gemaltomodem.h"
+#include "drivers/atmodem/vendor.h"
+
+static const char *smoni_prefix[] = { "^SMONI:", NULL };
+static const char *csq_prefix[] = { "+CSQ:", NULL };
+
+struct netmon_driver_data {
+ GAtChat *chat;
+};
+
+struct req_cb_data {
+ gint ref_count; /* Ref count */
+
+ struct ofono_netmon *netmon;
+ ofono_netmon_cb_t cb;
+ void *data;
+
+ struct ofono_network_operator op;
+
+ int rssi; /* CSQ: received signal strength indicator (RSSI) */
+
+ union {
+ struct {
+ int arfcn; /* SMONI: Absolute Radio Frequency
Channel Number */
+ int bcch; /* SMONI: Receiving level of the BCCH
carrier in dBm */
+ int lac;/* SMONI: Location Area Code */
+ int ci; /* SMONI: Cell ID */
+ } gsm;
+ struct {
+ int uarfcn; /* SMONI: UTRAN Absolute Radio
Frequency Channel Number */
+ int psc;/* SMONI: Primary Scrambling Code */
+ int ecn0; /* SMONI: Carrier to noise ratio in dB
*/
+ int rscp; /* SMONI: Received Signal Code Power in
dBm */
+ int lac;/* SMONI: Location Area Code */
+ int ci; /* SMONI: Cell ID */
+ } umts;
+ struct {
+ int euarfcn;/* SMONI: E-UTRA Absolute Radio
Frequency Channel Number */
+ int rsrp; /* SMONI: Reference Signal