gsm: add regex for unsolicited CREG/CGREG response with RAC

This commit is contained in:
Dan Williams
2011-10-27 15:13:30 -05:00
parent 58aa172b4e
commit ccad4aaa9d
2 changed files with 22 additions and 0 deletions

View File

@@ -245,6 +245,9 @@ mm_gsm_destroy_scan_data (gpointer data)
/* '<CR><LF>+CREG: 2,1,000B,2816, B, C2816<CR><LF><CR><LF>OK<CR><LF>' */
#define CREG7 "\\+(CREG|CGREG):\\s*(\\d{1}),\\s*(\\d{1})\\s*,\\s*([^,\\s]*)\\s*,\\s*([^,\\s]*)\\s*,\\s*([^,\\s]*)\\s*,\\s*[^,\\s]*"
/* +CREG: <stat>,<lac>,<ci>,<AcT>,<RAC> (ETSI 27.007 v9.20 CREG=2 unsolicited with RAC) */
#define CREG8 "\\+(CREG|CGREG):\\s*(\\d{1})\\s*,\\s*([^,\\s]*)\\s*,\\s*([^,\\s]*)\\s*,\\s*(\\d{1,2})\\s*,\\s*([^,\\s]*)"
GPtrArray *
mm_gsm_creg_regex_get (gboolean solicited)
{
@@ -307,6 +310,14 @@ mm_gsm_creg_regex_get (gboolean solicited)
g_assert (regex);
g_ptr_array_add (array, regex);
/* #8 */
if (solicited)
regex = g_regex_new (CREG8 "$", G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);
else
regex = g_regex_new ("\\r\\n" CREG8 "\\r\\n", G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);
g_assert (regex);
g_ptr_array_add (array, regex);
return array;
}