modem-helpers: improve and fix COPS=? numeric fields parsing

The numeric fields in the +COPS=? response were relying on a very weak
parsing logic, assuming that they were single-digit numeric values and
not using the common string to integer conversion utilities.

This commit improves the conversion from the 3GPP/ETSI defined network
availability and access technology values to the MM defined ones,
providing enum-based matches even if the numeric values are the same.

The commit also fixes the parsing of access technology values > 10,
required to report 5G related values.
This commit is contained in:
Aleksander Morgado
2022-03-16 11:04:06 +00:00
parent 5ba67aff82
commit 2c8cfb4768
5 changed files with 54 additions and 48 deletions
@@ -1018,6 +1018,7 @@ modem_3gpp_load_operator_code_finish (MMIfaceModem3gpp *self,
NULL, /* format */
&operator_code,
NULL, /* act */
self,
error))
return NULL;
@@ -1064,6 +1065,7 @@ modem_3gpp_load_operator_name_finish (MMIfaceModem3gpp *self,
NULL, /* format */
&operator_name,
NULL, /* act */
self,
error))
return NULL;