gsm: add regex for unsolicited CREG/CGREG response with RAC
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -742,6 +742,16 @@ test_creg2_gobi_weird_solicited (void *f, gpointer d)
|
||||
test_creg_match ("Qualcomm Gobi 1000 CREG=2", TRUE, reply, data, &result);
|
||||
}
|
||||
|
||||
static void
|
||||
test_creg2_unsolicited_with_rac (void *f, gpointer d)
|
||||
{
|
||||
TestData *data = (TestData *) d;
|
||||
const char *reply = "\r\n+CGREG: 1,\"1422\",\"00000142\",3,\"00\"\r\n";
|
||||
const CregResult result = { 1, 0x1422, 0x0142, 3, 8, FALSE };
|
||||
|
||||
test_creg_match ("CREG=2 with RAC", FALSE, reply, data, &result);
|
||||
}
|
||||
|
||||
static void
|
||||
test_cscs_icon225_support_response (void *f, gpointer d)
|
||||
{
|
||||
@@ -1262,6 +1272,7 @@ int main (int argc, char **argv)
|
||||
g_test_suite_add (suite, TESTCASE (test_creg2_md400_unsolicited, data));
|
||||
g_test_suite_add (suite, TESTCASE (test_creg2_s8500_wave_unsolicited, data));
|
||||
g_test_suite_add (suite, TESTCASE (test_creg2_gobi_weird_solicited, data));
|
||||
g_test_suite_add (suite, TESTCASE (test_creg2_unsolicited_with_rac, data));
|
||||
|
||||
g_test_suite_add (suite, TESTCASE (test_cgreg1_solicited, data));
|
||||
g_test_suite_add (suite, TESTCASE (test_cgreg1_unsolicited, data));
|
||||
|
Reference in New Issue
Block a user