Commit Graph

76 Commits

Author SHA1 Message Date
Aleksander Morgado
61fbab286c modem-helpers: new CGACT? response parser 2016-10-12 11:29:52 +02:00
Aleksander Morgado
467b3c57f0 modem-helpers: new COPS? response parser
Split into two different actions the actual COPS? response parsing and the
operator name normalization process.

Also, allow parsing not only the operator string, but also the format, mode
and the optional access technology value.
2016-10-12 11:29:52 +02:00
Aleksander Morgado
654f718b06 modem-helpers: new +CGCONTRDP=N response parser 2016-10-12 11:29:52 +02:00
Dan Williams
0a9cbf65ea modem-helpers: fix handling split PDP context ID reporting in CGDCONT=? response
Cinterion PHS8-US devices send split PDP context ID like "(1-17,101-112)" and
that caused the modem-helpers to choke.
2016-03-15 10:34:28 -05:00
Carlo Lobrano
be317e8b80 broadband-modem: fix +CPMS empty parameter support
* Add new async virtual method init_current_storages to
  MMIfaceModemMessaging
* Add logic of init_current_storages to MMBroadbandModem
* Add step "INIT_CURRENT_STORAGES" in MMIfaceModemMessaging
  initialization in order to load and store current SMS
  storages for mem1 and mem2.
* Add usage of current sms storage value for mem1 in place
  of an empty string parameter when the command AT+CPMS
  is used.

https://bugs.freedesktop.org/show_bug.cgi?id=93135
2016-03-09 14:43:08 +01:00
Thomas Sailer
95876c6f57 helpers: move +CRSM parsing to mm_3gpp_parse_crsm_response
Also added test cases.

Signed-off-by: Thomas Sailer <t.sailer@alumni.ethz.ch>
2016-02-13 14:27:51 +01:00
Thomas Sailer
a33615d6cb helpers: allow optional quotes in +CREG: <stat>,"<lac>","<ci>"
GSM 07.07 CREG=2 unsolicited pattern.

Added testcase for Thuraya XT.

Signed-off-by: Thomas Sailer <t.sailer@alumni.ethz.ch>
2016-02-13 14:24:54 +01:00
Thomas Sailer
4442173dcf modem-helpers: allow optional whitespace in +CGDCONT response
Add testcase for Thuraya XT.

Signed-off-by: Thomas Sailer <t.sailer@alumni.ethz.ch>
2016-02-11 15:34:25 +01:00
Aleksander Morgado
508a37a891 modem-helpers: fix parsing CPMS=? responses without groups
The CPMS test parser was expecting 3 groups (parenthesis enclosed lists) of
memory IDs, e.g.:

   +CPMS: ("SM","ME"),("SM","ME"),("SM","ME")

But some modems like the Huawei MU609 may just report single elements, not
groups, e.g.:

   +CPMS: "SM","SM","SM"

This patch avoids using g_strsplit() to split the groups, as that is unaware
of the possible replies without groups. Instead, a new helper method is
implemented which does the group/item split itself, considering also the
possibility of a reply with mixed groups and non-groups, like e.g.:

   +CPMS: ("SM","ME"),"SM","SM"

Additionally, we also now support the case where the groups are empty, e.g.:

   +CPMS: (),(),()

https://bugs.freedesktop.org/show_bug.cgi?id=92243
2015-12-02 22:34:37 +01:00
Aleksander Morgado
585320e0b4 tests: plug memleak in +CMGR response parser 2015-09-22 09:34:22 +02:00
Nick Stevens
eaf65ed98d core: process SMS +CGMR response with regex
Variability in the response style from certain modems causes the parsing
of the +CGMR response to fail. For example, the Telit HE910 inserts an
empty string ("") in the second field of the response, causing the
sscanf implementation to fail.

This patch converts the parsing of the CGMR response to a regex that
allows for more flexibility and robustness, and adds unit tests around
the parsing call.

Signed-off-by: Nick Stevens <Nick.Stevens@digi.com>
2015-09-22 09:24:18 +02:00
Jason Simmons
3ad64c8f5a broadband-modem: default implementation of the network time interface
Add a default implementation that queries the real-time clock using the
AT+CCLK? command.  Also set AT+CTZU=1 in case a modem requires it.
2015-03-23 11:31:32 +01:00
Aleksander Morgado
e0f3716d26 modem-helpers: don't return any result if an error happens when parsing CPMS=?
We shouldn't rely on the caller to cleanup intermediate results when returning
an error.
2014-06-27 09:20:40 +02:00
Ben Chan
7c389511d8 tests: fix more memory leaks 2014-06-03 10:51:51 +02:00
Ben Chan
6e7bae9dc5 tests: fix memory leaks
This patch fixes memory leaks in unit tests detected by LeakSanitizer.
2014-05-30 13:31:41 +02:00
Ben Chan
37b0402ee5 core: minor coding style fixes 2014-05-20 09:32:29 +02:00
Aleksander Morgado
1b3114a0f9 modem-helpers: handle +CGDCONT=? replies with single context
https://bugzilla.gnome.org/show_bug.cgi?id=708983
2013-11-01 15:50:12 +01:00
Aleksander Morgado
04b52d590f tests: enable logging if 'ENABLE_TEST_MESSAGE_TRACES' is defined 2013-11-01 15:50:09 +01:00
Ben Chan
b5ef861d12 modem-helpers,sim: auto-detect if ICCID response is character swapped
This patch modifies mm_3gpp_parse_iccid() to auto-detect if an ICCID
response is character swapped or not by comparsing the major industry
identifier part of the ICCID response to the known value (89) for
telecommunication purposes. This addresses the issue where the same AT
command (e.g. AT^ICCID used by the huawei plugin) does not report ICCID
in a consistent format.
2013-09-26 20:23:51 +02:00
Dan Williams
11a7e3dfdf core: add helper for parsing and validating the ICCID 2013-09-10 09:42:36 +02:00
Ben Chan
ffac6f17b5 modem-helpers: fix parsing of CREG/CGREG/CEREG responses
The format of CREG/CGREG/CEREG responses is not very precisely defined
in or strictly enforced by the 3GPP specifications. That leads to the
fact that some modems put leading zeros in integer type fields (e.g.
<n>, <stat>, <AcT>), and not all modems put double quotes around string
type fields (e.g. <lac>, <ci>) in those C*REG responses.

For example, 0001 can be a valid value for both <stat> and <lac>. The
original C*REG parsing code in ModemManager could potentially interpret
'+CREG: <stat>,<lac>,<ci>,<AcT>' as '+CREG: <n>,<stat>,<lac>,<ci>'. This
patch addresses this issue by refining the regular expressions returned
by mm_3gpp_creg_regex_get() with the following assumptions:

1. If a modem puts leading zeros in integer type fields, it puts double
   quotes around string type fields.
2. If a modem omits double quotes around string type fields, it does not
   put leading zeros in integer type fields.
2013-08-06 16:14:35 -05:00
Aleksander Morgado
6a01e51a5c tests: avoid printing in stdout by default
Tests had either their own g_print()s or they would enable a _mm_log() method to
get all g_debug()s from the libraries printed. In order to cleanup the result of
the tests run, avoid this stdout dumps by default, and only enable them if
explicitly enabled in CFLAGS, e.g.:

  $> ./configure CFLAGS="-DENABLE_TEST_MESSAGE_TRACES"
2013-06-18 17:15:03 +02:00
Aleksander Morgado
700ebc5c07 api,introspection: rename 'ModemCapabilities' to 'SupportedCapabilities'
And also make it a list of masks, specifying which are the specific combinations
supported, not just one mask with all.

E.g.:
  -------------------------
  Hardware |   manufacturer: 'Sierra Wireless, Incorporated'
           |          model: 'MC7710'
           |       revision: 'SWI9200X_03.05.19.04ap r5475 carmd-en-10527 2012/09/17 17:57:14'
           |      supported: 'gsm-umts
           |                  gsm-umts, lte'
           |        current: 'gsm-umts, lte'
           |   equipment id: '358178040668164'
2013-06-05 19:15:15 +02:00
Aleksander Morgado
45ceba7692 api,introspection: 'SupportedModes' is now a list of possible combinations
Instead of just a mask of MMModemMode values, we now provide a list of the
allowed and preferred mode combinations supported by the modem. E.g.:

$> sudo mmcli -m 0
  -------------------------
  Modes    |      supported: 'allowed: 2g; preferred: none
           |                  allowed: 3g; preferred: none
           |                  allowed: 2g, 3g; preferred: none
           |                  allowed: 2g, 3g; preferred: 2g
           |                  allowed: 2g, 3g; preferred: 3g
           |                  allowed: 4g; preferred: none
           |                  allowed: 2g, 3g, 4g; preferred: none'
2013-06-05 19:15:14 +02:00
Aleksander Morgado
2acb125819 modem-helpers: new CGDCONT=? test response parser 2013-06-05 19:15:13 +02:00
Aleksander Morgado
7ad30ecce1 modem-helpers: rename CGDCONT? tests
Adding the 'read' suffix, as they are for CGDCONT? read responses.
2013-06-05 19:15:13 +02:00
Dan Williams
93fcaf93ce modem-helpers: handle commas within +COPS response items (bgo #701329)
Modems can probably put whatever they want between the quotes for
the operator name, including commas.  Handle that.

https://bugzilla.gnome.org/show_bug.cgi?id=701329
2013-05-31 13:13:09 -05:00
Aleksander Morgado
c1e70924d8 broadband-modem: update CMGL parsing logic
Pantech UMW190 modem uses a custom +CMGL response which includes only
three fields before the actual PDU, e.g:

  +CMGL: <index>,<status>,<something>\r\n<PDU>

instead of what we had before:

  +CMGL: <index>,<status>,<alpha>,<length>\r\n<PDU>

The CMGL parsing logic is now updated to use a regex to match the reply, and
also considering the UMW190 specific case.

Actually, we end up reading only the two first fields (index and status) which
are the ones we really need, so we skip the <length> and the <alpha> if given.

Added also unit tests to cover all these known cases.

Partially fixes https://bugzilla.gnome.org/show_bug.cgi?id=696723 (missing the
actual PDU parsing fixes).
2013-04-02 09:53:46 +02:00
Dan Williams
3b3326bdf0 broadband-modem: parse +GSN response for IMEI, MEID, and ESN (bgo #696596)
+GSN response differs widely between modems.  Some prefix the
MEID and/or ESN with 0x, some have leading zeros, some return the
MEID and the ESN, and some append the serial number to the end of
the IMEI.  Handle that and make the ESN, MEID, IMEI, and
EquipmentIdentifier parsing consistent.
2013-03-27 08:23:52 -05:00
Ben Chan
85b67ed8d9 modem: use +CEREG to determine EPS network registration status
This patch adds the support for solicited/unsolicited EPS network
registration status via AT+CEREG, which is configurable via the
'iface-modem-3gpp-eps-network-supported' property of the
MMIfaceModem3gpp interface and is disabled by default.
2013-02-15 08:53:45 +01:00
Aleksander Morgado
675d8aeeea tests: add PDP context reply parser test for Samsung/Icera replies 2012-10-25 16:19:28 +02:00
Aleksander Morgado
af4f23a1d2 test: new tester for +CDS unsolicited messages 2012-09-14 07:05:24 +02:00
Aleksander Morgado
51678e141b modem-helpers: new method to validate and/or parse MCC/MNC operator ID string 2012-08-29 17:26:44 +02:00
Aleksander Morgado
1ac18a06bb api,dbus: 'ip-type' property now given as a MMBearerIpFamily (u)
Instead of using a predefined set of string values for 'ip-type' in
Modem.CreateBearer() and Simple.Connect(), we'll use an enumeration. The
implementation will then need to convert the requested IP family type to e.g.
the correct PDP type in 3GPP modems.

This change also consolidates the use of enums in dictionary properties when
possible to do so, as with the Rm Protocol.
2012-08-22 09:38:21 +02:00
Aleksander Morgado
1f250585dd modem-helpers: refactor and reorganize sources 2012-03-16 14:53:21 +01:00
Aleksander Morgado
51c28d0f79 modem-helpers: new +CNUM response parser and tests 2012-03-16 14:53:21 +01:00
Aleksander Morgado
4a52a19c41 tests,modem-helpers: cleanup tests
Properly order the tests in blocks, and ensure that the common data for
registration tests is not passed to other non-registration related tests.
2012-03-16 14:53:21 +01:00
Aleksander Morgado
4c38ab4864 test,modem-helpers: remove conditional compilation
We require already GLib 2.30
2012-03-16 14:53:21 +01:00
Aleksander Morgado
21c0731ad9 tests: fix CGDCONT reply test, NULL expected instead of empty string 2012-03-16 14:53:17 +01:00
Aleksander Morgado
680e292914 build: fix header dependencies
We shouldn't depend on any header file from the previous implementation.
2012-03-16 14:28:15 +01:00
Aleksander Morgado
2a12322a80 modem-helpers: allow leading zeroes in CREG/CGREG responses 2012-03-15 14:15:06 +01:00
Aleksander Morgado
cd184f33f9 test: new tester for CPMS=? results 2012-03-15 14:15:03 +01:00
Aleksander Morgado
516b097331 api,enums: renamed MMModemAccessTech' to MMModemAccessTechnology'
This one was the last enum without full name.
2012-03-15 14:14:35 +01:00
Aleksander Morgado
b6a3ccd578 modem-helpers: renamed 3GPP registration related helpers with `mm_3gpp' prefix 2012-03-15 14:14:35 +01:00
Aleksander Morgado
5f4655c574 helpers: implement CGDCONT reply parsing
New method to parse the PDP query reply, and build a list of structs with the
found info.
2012-03-15 14:14:33 +01:00
Aleksander Morgado
a92e9c59c1 modem-helpers: provide list of scanned networks in a list of structs
We provide the result of the +COPS=? parsing in a GList of MM3gppNetworkInfo
structures. We avoid the previous hash table, or using a dictionary, as a
list of structs with a predefined set of elements, which should be easier for
plugins wanting to make their own version
2012-03-15 14:14:30 +01:00
Aleksander Morgado
b3389ff2d4 test-modem-helpers: fix C(G)REG parsing tests 2012-03-15 14:14:29 +01:00
Aleksander Morgado
5805a931e6 modem-helpers: use MMModemAccessTech when parsing C(G)REG responses 2012-03-15 14:14:29 +01:00
Aleksander Morgado
26d69ca0f2 gsm: allow leading zeroes in numbers in CREG/CGREG responses 2012-02-17 13:25:02 +01:00
Dan Williams
889ae2fb4b gsm: fix parsing of unsolicited CREG/CGREG response with RAC 2011-10-27 16:38:11 -05:00