From c78da3de7e6bdd82b53268614b997e5a4f3190f6 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Tue, 24 Mar 2020 07:38:00 +0100 Subject: broadband-modem: run +C5GREG state checks The generic CREG parser is improved to also allow parsing +C5GREG responses and URCs. --- src/mm-broadband-modem.c | 172 ++++++++++++++++++++++++----------------- src/mm-modem-helpers.c | 83 ++++++++++++++------ src/mm-modem-helpers.h | 1 + src/tests/test-modem-helpers.c | 139 ++++++++++++++++++++++----------- 4 files changed, 254 insertions(+), 141 deletions(-) (limited to 'src') diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index a485349f..a56ae354 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -4578,6 +4578,7 @@ registration_state_changed (MMPortSerialAt *port, MMModemAccessTechnology act = MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN; gboolean cgreg = FALSE; gboolean cereg = FALSE; + gboolean c5greg = FALSE; GError *error = NULL; if (!mm_3gpp_parse_creg_response (match_info, @@ -4588,6 +4589,7 @@ registration_state_changed (MMPortSerialAt *port, &act, &cgreg, &cereg, + &c5greg, &error)) { mm_obj_warn (self, "error parsing unsolicited registration: %s", error && error->message ? error->message : "(unknown)"); @@ -4598,7 +4600,7 @@ registration_state_changed (MMPortSerialAt *port, /* Report new registration state and fix LAC/TAC. * According to 3GPP TS 27.007: * - If CREG reports 7 (LTE) then the field contains TAC - * - CEREG always reports TAC + * - CEREG/C5GREG always reports TAC */ if (cgreg) mm_iface_modem_3gpp_update_ps_registration_state (MM_IFACE_MODEM_3GPP (self), state); @@ -4606,6 +4608,10 @@ registration_state_changed (MMPortSerialAt *port, tac = lac; lac = 0; mm_iface_modem_3gpp_update_eps_registration_state (MM_IFACE_MODEM_3GPP (self), state); + } else if (c5greg) { + tac = lac; + lac = 0; + mm_iface_modem_3gpp_update_5gs_registration_state (MM_IFACE_MODEM_3GPP (self), state); } else { if (act == MM_MODEM_ACCESS_TECHNOLOGY_LTE) { tac = lac; @@ -4865,43 +4871,62 @@ typedef struct { gboolean is_cs_supported; gboolean is_ps_supported; gboolean is_eps_supported; + gboolean is_5gs_supported; gboolean run_cs; gboolean run_ps; gboolean run_eps; + gboolean run_5gs; gboolean running_cs; gboolean running_ps; gboolean running_eps; - GError *cs_error; - GError *ps_error; - GError *eps_error; + gboolean running_5gs; + GError *error_cs; + GError *error_ps; + GError *error_eps; + GError *error_5gs; } RunRegistrationChecksContext; static void run_registration_checks_context_free (RunRegistrationChecksContext *ctx) { - if (ctx->cs_error) - g_error_free (ctx->cs_error); - if (ctx->ps_error) - g_error_free (ctx->ps_error); - if (ctx->eps_error) - g_error_free (ctx->eps_error); + g_clear_error (&ctx->error_cs); + g_clear_error (&ctx->error_ps); + g_clear_error (&ctx->error_eps); + g_clear_error (&ctx->error_5gs); g_free (ctx); } static gboolean -modem_3gpp_run_registration_checks_finish (MMIfaceModem3gpp *self, - GAsyncResult *res, - GError **error) +modem_3gpp_run_registration_checks_finish (MMIfaceModem3gpp *self, + GAsyncResult *res, + GError **error) { return g_task_propagate_boolean (G_TASK (res), error); } static void run_registration_checks_context_step (GTask *task); +static void +run_registration_checks_context_set_error (RunRegistrationChecksContext *ctx, + GError *error) +{ + g_assert (error != NULL); + if (ctx->running_cs) + ctx->error_cs = error; + else if (ctx->running_ps) + ctx->error_ps = error; + else if (ctx->running_eps) + ctx->error_eps = error; + else if (ctx->running_5gs) + ctx->error_5gs = error; + else + g_assert_not_reached (); +} + static void registration_status_check_ready (MMBroadbandModem *self, - GAsyncResult *res, - GTask *task) + GAsyncResult *res, + GTask *task) { RunRegistrationChecksContext *ctx; const gchar *response; @@ -4909,31 +4934,23 @@ registration_status_check_ready (MMBroadbandModem *self, GMatchInfo *match_info = NULL; guint i; gboolean parsed; - gboolean cgreg; - gboolean cereg; - MMModem3gppRegistrationState state; - MMModemAccessTechnology act; - gulong lac; - gulong tac; - gulong cid; + gboolean cgreg = FALSE; + gboolean cereg = FALSE; + gboolean c5greg = FALSE; + MMModem3gppRegistrationState state = MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN; + MMModemAccessTechnology act = MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN; + gulong lac = 0; + gulong tac = 0; + gulong cid = 0; ctx = g_task_get_task_data (task); /* Only one must be running */ - g_assert ((ctx->running_cs ? 1 : 0) + - (ctx->running_ps ? 1 : 0) + - (ctx->running_eps ? 1 : 0) == 1); + g_assert ((ctx->running_cs + ctx->running_ps + ctx->running_eps + ctx->running_5gs) == 1); response = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error); if (!response) { - g_assert (error != NULL); - if (ctx->running_cs) - ctx->cs_error = error; - else if (ctx->running_ps) - ctx->ps_error = error; - else - ctx->eps_error = error; - + run_registration_checks_context_set_error (ctx, error); run_registration_checks_context_step (task); return; } @@ -4951,8 +4968,7 @@ registration_status_check_ready (MMBroadbandModem *self, for (i = 0; i < self->priv->modem_3gpp_registration_regex->len; i++) { - if (g_regex_match ((GRegex *)g_ptr_array_index ( - self->priv->modem_3gpp_registration_regex, i), + if (g_regex_match ((GRegex *)g_ptr_array_index (self->priv->modem_3gpp_registration_regex, i), response, 0, &match_info)) @@ -4966,24 +4982,11 @@ registration_status_check_ready (MMBroadbandModem *self, MM_CORE_ERROR_FAILED, "Unknown registration status response: '%s'", response); - if (ctx->running_cs) - ctx->cs_error = error; - else if (ctx->running_ps) - ctx->ps_error = error; - else - ctx->eps_error = error; - + run_registration_checks_context_set_error (ctx, error); run_registration_checks_context_step (task); return; } - cgreg = FALSE; - cereg = FALSE; - state = MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN; - act = MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN; - tac = 0; - lac = 0; - cid = 0; parsed = mm_3gpp_parse_creg_response (match_info, self, &state, @@ -4992,6 +4995,7 @@ registration_status_check_ready (MMBroadbandModem *self, &act, &cgreg, &cereg, + &c5greg, &error); g_match_info_free (match_info); @@ -5001,12 +5005,7 @@ registration_status_check_ready (MMBroadbandModem *self, MM_CORE_ERROR_FAILED, "Error parsing registration response: '%s'", response); - if (ctx->running_cs) - ctx->cs_error = error; - else if (ctx->running_ps) - ctx->ps_error = error; - else - ctx->eps_error = error; + run_registration_checks_context_set_error (ctx, error); run_registration_checks_context_step (task); return; } @@ -5021,6 +5020,8 @@ registration_status_check_ready (MMBroadbandModem *self, mm_obj_dbg (self, "got PS registration state when checking CS registration state"); else if (ctx->running_eps) mm_obj_dbg (self, "got PS registration state when checking EPS registration state"); + else if (ctx->running_5gs) + mm_obj_dbg (self, "got PS registration state when checking 5GS registration state"); mm_iface_modem_3gpp_update_ps_registration_state (MM_IFACE_MODEM_3GPP (self), state); } else if (cereg) { tac = lac; @@ -5029,7 +5030,19 @@ registration_status_check_ready (MMBroadbandModem *self, mm_obj_dbg (self, "got EPS registration state when checking CS registration state"); else if (ctx->running_ps) mm_obj_dbg (self, "got EPS registration state when checking PS registration state"); + else if (ctx->running_5gs) + mm_obj_dbg (self, "got EPS registration state when checking 5GS registration state"); mm_iface_modem_3gpp_update_eps_registration_state (MM_IFACE_MODEM_3GPP (self), state); + } else if (c5greg) { + tac = lac; + lac = 0; + if (ctx->running_cs) + mm_obj_dbg (self, "got 5GS registration state when checking CS registration state"); + else if (ctx->running_ps) + mm_obj_dbg (self, "got 5GS registration state when checking PS registration state"); + else if (ctx->running_eps) + mm_obj_dbg (self, "got 5GS registration state when checking EPS registration state"); + mm_iface_modem_3gpp_update_5gs_registration_state (MM_IFACE_MODEM_3GPP (self), state); } else { if (act == MM_MODEM_ACCESS_TECHNOLOGY_LTE) { tac = lac; @@ -5039,6 +5052,8 @@ registration_status_check_ready (MMBroadbandModem *self, mm_obj_dbg (self, "got CS registration state when checking PS registration state"); else if (ctx->running_eps) mm_obj_dbg (self, "got CS registration state when checking EPS registration state"); + else if (ctx->running_5gs) + mm_obj_dbg (self, "got CS registration state when checking 5GS registration state"); mm_iface_modem_3gpp_update_cs_registration_state (MM_IFACE_MODEM_3GPP (self), state); } @@ -5061,6 +5076,7 @@ run_registration_checks_context_step (GTask *task) ctx->running_cs = FALSE; ctx->running_ps = FALSE; ctx->running_eps = FALSE; + ctx->running_5gs = FALSE; if (ctx->run_cs) { ctx->running_cs = TRUE; @@ -5101,22 +5117,35 @@ run_registration_checks_context_step (GTask *task) return; } + if (ctx->run_5gs) { + ctx->running_5gs = TRUE; + ctx->run_5gs = FALSE; + /* Check current 5GS-registration state. */ + mm_base_modem_at_command (MM_BASE_MODEM (self), + "+C5GREG?", + 10, + FALSE, + (GAsyncReadyCallback)registration_status_check_ready, + task); + return; + } + /* If all run checks returned errors we fail */ - if ((ctx->is_cs_supported || ctx->is_ps_supported || ctx->is_eps_supported) && - (!ctx->is_cs_supported || ctx->cs_error) && - (!ctx->is_ps_supported || ctx->ps_error) && - (!ctx->is_eps_supported || ctx->eps_error)) { - /* Prefer the EPS, and then PS error if any */ - if (ctx->eps_error) { - g_propagate_error (&error, ctx->eps_error); - ctx->eps_error = NULL; - } else if (ctx->ps_error) { - g_propagate_error (&error, ctx->ps_error); - ctx->ps_error = NULL; - } else if (ctx->cs_error) { - g_propagate_error (&error, ctx->cs_error); - ctx->cs_error = NULL; - } else + if ((ctx->is_cs_supported || ctx->is_ps_supported || ctx->is_eps_supported || ctx->is_5gs_supported) && + (!ctx->is_cs_supported || ctx->error_cs) && + (!ctx->is_ps_supported || ctx->error_ps) && + (!ctx->is_eps_supported || ctx->error_eps) && + (!ctx->is_5gs_supported || ctx->error_5gs)) { + /* When reporting errors, prefer the 5GS, then EPS, then PS, then CS */ + if (ctx->error_5gs) + error = g_steal_pointer (&ctx->error_5gs); + else if (ctx->error_eps) + error = g_steal_pointer (&ctx->error_eps); + else if (ctx->error_ps) + error = g_steal_pointer (&ctx->error_ps); + else if (ctx->error_cs) + error = g_steal_pointer (&ctx->error_cs); + else g_assert_not_reached (); } @@ -5143,10 +5172,11 @@ modem_3gpp_run_registration_checks (MMIfaceModem3gpp *self, ctx->is_cs_supported = is_cs_supported; ctx->is_ps_supported = is_ps_supported; ctx->is_eps_supported = is_eps_supported; + ctx->is_5gs_supported = is_5gs_supported; ctx->run_cs = is_cs_supported; ctx->run_ps = is_ps_supported; ctx->run_eps = is_eps_supported; - /* TODO: 5gs */ + ctx->run_5gs = is_5gs_supported; task = g_task_new (self, NULL, callback, user_data); g_task_set_task_data (task, ctx, (GDestroyNotify)run_registration_checks_context_free); diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c index 15962d06..5ec38823 100644 --- a/src/mm-modem-helpers.c +++ b/src/mm-modem-helpers.c @@ -821,10 +821,10 @@ mm_flow_control_from_string (const gchar *str, /*************************************************************************/ /* +CREG: (GSM 07.07 CREG=1 unsolicited) */ -#define CREG1 "\\+(CREG|CGREG|CEREG):\\s*0*([0-9])" +#define CREG1 "\\+(CREG|CGREG|CEREG|C5GREG):\\s*0*([0-9])" /* +CREG: , (GSM 07.07 CREG=1 solicited) */ -#define CREG2 "\\+(CREG|CGREG|CEREG):\\s*0*([0-9]),\\s*0*([0-9])" +#define CREG2 "\\+(CREG|CGREG|CEREG|C5GREG):\\s*0*([0-9]),\\s*0*([0-9])" /* +CREG: ,, (GSM 07.07 CREG=2 unsolicited) */ #define CREG3 "\\+(CREG|CGREG|CEREG):\\s*0*([0-9]),\\s*([^,\\s]*)\\s*,\\s*([^,\\s]*)" @@ -853,13 +853,19 @@ mm_flow_control_from_string (const gchar *str, /* +CEREG: ,,,,, (ETSI 27.007 v8.6 CREG=2 solicited with RAC) */ #define CEREG2 "\\+(CEREG):\\s*0*([0-9]),\\s*0*([0-9])\\s*,\\s*([^,\\s]*)\\s*,\\s*([^,\\s]*)\\s*,\\s*([^,\\s]*)\\s*,\\s*0*([0-9])" +/* +C5GREG: ,,,,, (ETSI 27.007 CREG=2 unsolicited) */ +#define C5GREG1 "\\+(C5GREG):\\s*([0-9]+)\\s*,\\s*([^,\\s]*)\\s*,\\s*([^,\\s]*)\\s*,\\s*([0-9]+)\\s*,\\s*([^,\\s]*)\\s*,\\s*([^,\\s]*)" + +/* +C5GREG: ,,,,,, (ETSI 27.007 solicited) */ +#define C5GREG2 "\\+(C5GREG):\\s*([0-9]+)\\s*,\\s*([0-9+])\\s*,\\s*([^,\\s]*)\\s*,\\s*([^,\\s]*)\\s*,\\s*([0-9]+)\\s*,\\s*([^,\\s]*)\\s*,\\s*([^,\\s]*)" + GPtrArray * mm_3gpp_creg_regex_get (gboolean solicited) { GPtrArray *array; GRegex *regex; - array = g_ptr_array_sized_new (12); + array = g_ptr_array_sized_new (14); /* #1 */ if (solicited) @@ -957,6 +963,22 @@ mm_3gpp_creg_regex_get (gboolean solicited) g_assert (regex); g_ptr_array_add (array, regex); + /* C5GREG #1 */ + if (solicited) + regex = g_regex_new (C5GREG1 "$", G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL); + else + regex = g_regex_new ("\\r\\n" C5GREG1 "\\r\\n", G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL); + g_assert (regex); + g_ptr_array_add (array, regex); + + /* C5GREG #2 */ + if (solicited) + regex = g_regex_new (C5GREG2 "$", G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL); + else + regex = g_regex_new ("\\r\\n" C5GREG2 "\\r\\n", G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL); + g_assert (regex); + g_ptr_array_add (array, regex); + return array; } @@ -1962,6 +1984,7 @@ mm_3gpp_parse_creg_response (GMatchInfo *info, MMModemAccessTechnology *out_act, gboolean *out_cgreg, gboolean *out_cereg, + gboolean *out_c5greg, GError **error) { gint n_matches, act = -1; @@ -1970,17 +1993,19 @@ mm_3gpp_parse_creg_response (GMatchInfo *info, guint istat = 0, ilac = 0, ici = 0, iact = 0; gchar *str; - g_return_val_if_fail (info != NULL, FALSE); - g_return_val_if_fail (out_reg_state != NULL, FALSE); - g_return_val_if_fail (out_lac != NULL, FALSE); - g_return_val_if_fail (out_ci != NULL, FALSE); - g_return_val_if_fail (out_act != NULL, FALSE); - g_return_val_if_fail (out_cgreg != NULL, FALSE); - g_return_val_if_fail (out_cereg != NULL, FALSE); + g_assert (info != NULL); + g_assert (out_reg_state != NULL); + g_assert (out_lac != NULL); + g_assert (out_ci != NULL); + g_assert (out_act != NULL); + g_assert (out_cgreg != NULL); + g_assert (out_cereg != NULL); + g_assert (out_c5greg != NULL); str = g_match_info_fetch (info, 1); *out_cgreg = (str && strstr (str, "CGREG")) ? TRUE : FALSE; *out_cereg = (str && strstr (str, "CEREG")) ? TRUE : FALSE; + *out_c5greg = (str && strstr (str, "C5GREG")) ? TRUE : FALSE; g_free (str); /* Normally the number of matches could be used to determine what each @@ -2025,37 +2050,49 @@ mm_3gpp_parse_creg_response (GMatchInfo *info, /* Check if the third item is the LAC to distinguish the two cases */ if (item_is_lac_not_stat (info, 3)) { istat = 2; - ilac = 3; + ilac = 3; } else { istat = 3; - ilac = 4; + ilac = 4; } - ici = 5; + ici = 5; iact = 6; } else { /* Check if the third item is the LAC to distinguish the two cases */ if (item_is_lac_not_stat (info, 3)) { istat = 2; - ilac = 3; - ici = 4; - iact = 5; + ilac = 3; + ici = 4; + iact = 5; } else { istat = 3; - ilac = 4; - ici = 5; - iact = 6; + ilac = 4; + ici = 5; + iact = 6; } } } else if (n_matches == 8) { /* CEREG=2 (solicited with RAC): +CEREG: ,,,,, + * C5GREG=2 (unsolicited): +C5GREG: ,,,,, */ if (*out_cereg) { istat = 3; - ilac = 4; - ici = 6; - iact = 7; + ilac = 4; + ici = 6; + iact = 7; + } else if (*out_c5greg) { + istat = 2; + ilac = 3; + ici = 4; + iact = 5; } - } + } else if (n_matches == 9) { + /* C5GREG=2 (solicited): +C5GREG: ,,,,,, */ + istat = 3; + ilac = 4; + ici = 5; + iact = 6; + } /* Status */ if (!mm_get_uint_from_match_info (info, istat, &stat)) { diff --git a/src/mm-modem-helpers.h b/src/mm-modem-helpers.h index cf60e425..c1a1b2c9 100644 --- a/src/mm-modem-helpers.h +++ b/src/mm-modem-helpers.h @@ -222,6 +222,7 @@ gboolean mm_3gpp_parse_creg_response (GMatchInfo *info, MMModemAccessTechnology *out_act, gboolean *out_cgreg, gboolean *out_cereg, + gboolean *out_c5greg, GError **error); /* AT+CMGF=? (SMS message format) response parser */ diff --git a/src/tests/test-modem-helpers.c b/src/tests/test-modem-helpers.c index 1a0d6078..49cea874 100644 --- a/src/tests/test-modem-helpers.c +++ b/src/tests/test-modem-helpers.c @@ -1094,6 +1094,7 @@ typedef struct { guint regex_num; gboolean cgreg; gboolean cereg; + gboolean c5greg; } CregResult; static void @@ -1109,7 +1110,7 @@ test_creg_match (const char *test, MMModemAccessTechnology access_tech = MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN; gulong lac = 0, ci = 0; GError *error = NULL; - gboolean success, cgreg = FALSE, cereg = FALSE; + gboolean success, cgreg = FALSE, cereg = FALSE, c5greg = FALSE; guint regex_num = 0; GPtrArray *array; @@ -1143,19 +1144,18 @@ test_creg_match (const char *test, g_assert (info != NULL); g_assert_cmpuint (regex_num, ==, result->regex_num); - success = mm_3gpp_parse_creg_response (info, NULL, &state, &lac, &ci, &access_tech, &cgreg, &cereg, &error); + success = mm_3gpp_parse_creg_response (info, NULL, &state, &lac, &ci, &access_tech, &cgreg, &cereg, &c5greg, &error); + g_match_info_free (info); g_assert (success); g_assert_no_error (error); g_assert_cmpuint (state, ==, result->state); - g_assert (lac == result->lac); - g_assert (ci == result->ci); - - g_debug (" access_tech (%d) == result->act (%d)", - access_tech, result->act); + g_assert_cmpuint (lac, ==, result->lac); + g_assert_cmpuint (ci, ==, result->ci); g_assert_cmpuint (access_tech, ==, result->act); g_assert_cmpuint (cgreg, ==, result->cgreg); g_assert_cmpuint (cereg, ==, result->cereg); + g_assert_cmpuint (c5greg, ==, result->c5greg); } static void @@ -1163,7 +1163,7 @@ test_creg1_solicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "+CREG: 1,3"; - const CregResult result = { 3, 0, 0, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 2, FALSE, FALSE }; + const CregResult result = { 3, 0, 0, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 2, FALSE, FALSE, FALSE }; test_creg_match ("CREG=1", TRUE, reply, data, &result); } @@ -1173,7 +1173,7 @@ test_creg1_unsolicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "\r\n+CREG: 3\r\n"; - const CregResult result = { 3, 0, 0, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 1, FALSE, FALSE }; + const CregResult result = { 3, 0, 0, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 1, FALSE, FALSE, FALSE }; test_creg_match ("CREG=1", FALSE, reply, data, &result); } @@ -1183,7 +1183,7 @@ test_creg2_mercury_solicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "+CREG: 0,1,84CD,00D30173"; - const CregResult result = { 1, 0x84cd, 0xd30173, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 4, FALSE, FALSE }; + const CregResult result = { 1, 0x84cd, 0xd30173, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 4, FALSE, FALSE, FALSE }; test_creg_match ("Sierra Mercury CREG=2", TRUE, reply, data, &result); } @@ -1193,7 +1193,7 @@ test_creg2_mercury_unsolicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "\r\n+CREG: 1,84CD,00D30156\r\n"; - const CregResult result = { 1, 0x84cd, 0xd30156, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 3, FALSE, FALSE }; + const CregResult result = { 1, 0x84cd, 0xd30156, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 3, FALSE, FALSE, FALSE }; test_creg_match ("Sierra Mercury CREG=2", FALSE, reply, data, &result); } @@ -1203,7 +1203,7 @@ test_creg2_sek850i_solicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "+CREG: 2,1,\"CE00\",\"01CEAD8F\""; - const CregResult result = { 1, 0xce00, 0x01cead8f, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 4, FALSE, FALSE }; + const CregResult result = { 1, 0xce00, 0x01cead8f, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 4, FALSE, FALSE, FALSE }; test_creg_match ("Sony Ericsson K850i CREG=2", TRUE, reply, data, &result); } @@ -1213,7 +1213,7 @@ test_creg2_sek850i_unsolicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "\r\n+CREG: 1,\"CE00\",\"00005449\"\r\n"; - const CregResult result = { 1, 0xce00, 0x5449, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 3, FALSE, FALSE }; + const CregResult result = { 1, 0xce00, 0x5449, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 3, FALSE, FALSE, FALSE }; test_creg_match ("Sony Ericsson K850i CREG=2", FALSE, reply, data, &result); } @@ -1223,7 +1223,7 @@ test_creg2_e160g_solicited_unregistered (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "+CREG: 2,0,00,0"; - const CregResult result = { 0, 0, 0, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 4, FALSE, FALSE }; + const CregResult result = { 0, 0, 0, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 4, FALSE, FALSE, FALSE }; test_creg_match ("Huawei E160G unregistered CREG=2", TRUE, reply, data, &result); } @@ -1233,7 +1233,7 @@ test_creg2_e160g_solicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "+CREG: 2,1,8BE3,2BAF"; - const CregResult result = { 1, 0x8be3, 0x2baf, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 4, FALSE, FALSE }; + const CregResult result = { 1, 0x8be3, 0x2baf, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 4, FALSE, FALSE, FALSE }; test_creg_match ("Huawei E160G CREG=2", TRUE, reply, data, &result); } @@ -1243,7 +1243,7 @@ test_creg2_e160g_unsolicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "\r\n+CREG: 2,8BE3,2BAF\r\n"; - const CregResult result = { 2, 0x8be3, 0x2baf, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 3, FALSE, FALSE }; + const CregResult result = { 2, 0x8be3, 0x2baf, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 3, FALSE, FALSE, FALSE }; test_creg_match ("Huawei E160G CREG=2", FALSE, reply, data, &result); } @@ -1253,7 +1253,7 @@ test_creg2_tm506_solicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "+CREG: 2,1,\"8BE3\",\"00002BAF\""; - const CregResult result = { 1, 0x8BE3, 0x2BAF, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 4, FALSE, FALSE }; + const CregResult result = { 1, 0x8BE3, 0x2BAF, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 4, FALSE, FALSE, FALSE }; /* Test leading zeros in the CI */ test_creg_match ("Sony Ericsson TM-506 CREG=2", TRUE, reply, data, &result); @@ -1264,7 +1264,7 @@ test_creg2_xu870_unsolicited_unregistered (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "\r\n+CREG: 2,,\r\n"; - const CregResult result = { 2, 0, 0, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 3, FALSE, FALSE }; + const CregResult result = { 2, 0, 0, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 3, FALSE, FALSE, FALSE }; test_creg_match ("Novatel XU870 unregistered CREG=2", FALSE, reply, data, &result); } @@ -1274,7 +1274,7 @@ test_creg2_iridium_solicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "+CREG:002,001,\"18d8\",\"ffff\""; - const CregResult result = { 1, 0x18D8, 0xFFFF, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN, 5, FALSE, FALSE }; + const CregResult result = { 1, 0x18D8, 0xFFFF, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN, 5, FALSE, FALSE, FALSE }; test_creg_match ("Iridium, CREG=2", TRUE, reply, data, &result); } @@ -1284,7 +1284,7 @@ test_creg2_no_leading_zeros_solicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "+CREG:2,1,0001,0010"; - const CregResult result = { 1, 0x0001, 0x0010, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN, 4, FALSE, FALSE }; + const CregResult result = { 1, 0x0001, 0x0010, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN, 4, FALSE, FALSE, FALSE }; test_creg_match ("solicited CREG=2 with no leading zeros in integer fields", TRUE, reply, data, &result); } @@ -1294,7 +1294,7 @@ test_creg2_leading_zeros_solicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "+CREG:002,001,\"0001\",\"0010\""; - const CregResult result = { 1, 0x0001, 0x0010, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN, 5, FALSE, FALSE }; + const CregResult result = { 1, 0x0001, 0x0010, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN, 5, FALSE, FALSE, FALSE }; test_creg_match ("solicited CREG=2 with leading zeros in integer fields", TRUE, reply, data, &result); } @@ -1304,7 +1304,7 @@ test_creg2_no_leading_zeros_unsolicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "\r\n+CREG: 1,0001,0010,0\r\n"; - const CregResult result = { 1, 0x0001, 0x0010, MM_MODEM_ACCESS_TECHNOLOGY_GSM, 6, FALSE, FALSE }; + const CregResult result = { 1, 0x0001, 0x0010, MM_MODEM_ACCESS_TECHNOLOGY_GSM, 6, FALSE, FALSE, FALSE }; test_creg_match ("unsolicited CREG=2 with no leading zeros in integer fields", FALSE, reply, data, &result); } @@ -1314,7 +1314,7 @@ test_creg2_leading_zeros_unsolicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "\r\n+CREG: 001,\"0001\",\"0010\",000\r\n"; - const CregResult result = { 1, 0x0001, 0x0010, MM_MODEM_ACCESS_TECHNOLOGY_GSM, 7, FALSE, FALSE }; + const CregResult result = { 1, 0x0001, 0x0010, MM_MODEM_ACCESS_TECHNOLOGY_GSM, 7, FALSE, FALSE, FALSE }; test_creg_match ("unsolicited CREG=2 with leading zeros in integer fields", FALSE, reply, data, &result); } @@ -1324,7 +1324,7 @@ test_creg2_ublox_solicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const gchar *reply = "\r\n+CREG: 2,6,\"8B37\",\"0A265185\",7\r\n"; - const CregResult result = { MM_MODEM_3GPP_REGISTRATION_STATE_HOME_SMS_ONLY, 0x8B37, 0x0A265185, MM_MODEM_ACCESS_TECHNOLOGY_LTE, 8, FALSE, FALSE }; + const CregResult result = { MM_MODEM_3GPP_REGISTRATION_STATE_HOME_SMS_ONLY, 0x8B37, 0x0A265185, MM_MODEM_ACCESS_TECHNOLOGY_LTE, 8, FALSE, FALSE, FALSE }; test_creg_match ("Ublox Toby-L2 solicited while on LTE", TRUE, reply, data, &result); } @@ -1334,7 +1334,7 @@ test_creg2_ublox_unsolicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const gchar *reply = "\r\n+CREG: 6,\"8B37\",\"0A265185\",7\r\n"; - const CregResult result = { MM_MODEM_3GPP_REGISTRATION_STATE_HOME_SMS_ONLY, 0x8B37, 0x0A265185, MM_MODEM_ACCESS_TECHNOLOGY_LTE, 6, FALSE, FALSE }; + const CregResult result = { MM_MODEM_3GPP_REGISTRATION_STATE_HOME_SMS_ONLY, 0x8B37, 0x0A265185, MM_MODEM_ACCESS_TECHNOLOGY_LTE, 6, FALSE, FALSE, FALSE }; test_creg_match ("Ublox Toby-L2 unsolicited while on LTE", FALSE, reply, data, &result); } @@ -1344,7 +1344,7 @@ test_cgreg1_solicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "+CGREG: 1,3"; - const CregResult result = { 3, 0, 0, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 2, TRUE, FALSE }; + const CregResult result = { 3, 0, 0, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 2, TRUE, FALSE, FALSE }; test_creg_match ("CGREG=1", TRUE, reply, data, &result); } @@ -1354,7 +1354,7 @@ test_cgreg1_unsolicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "\r\n+CGREG: 3\r\n"; - const CregResult result = { 3, 0, 0, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 1, TRUE, FALSE }; + const CregResult result = { 3, 0, 0, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 1, TRUE, FALSE, FALSE }; test_creg_match ("CGREG=1", FALSE, reply, data, &result); } @@ -1364,7 +1364,7 @@ test_cgreg2_f3607gw_solicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "+CGREG: 2,1,\"8BE3\",\"00002B5D\",3"; - const CregResult result = { 1, 0x8BE3, 0x2B5D, MM_MODEM_ACCESS_TECHNOLOGY_EDGE, 8, TRUE, FALSE }; + const CregResult result = { 1, 0x8BE3, 0x2B5D, MM_MODEM_ACCESS_TECHNOLOGY_EDGE, 8, TRUE, FALSE, FALSE }; test_creg_match ("Ericsson F3607gw CGREG=2", TRUE, reply, data, &result); } @@ -1374,7 +1374,7 @@ test_cgreg2_f3607gw_unsolicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "\r\n+CGREG: 1,\"8BE3\",\"00002B5D\",3\r\n"; - const CregResult result = { 1, 0x8BE3, 0x2B5D, MM_MODEM_ACCESS_TECHNOLOGY_EDGE, 6, TRUE, FALSE }; + const CregResult result = { 1, 0x8BE3, 0x2B5D, MM_MODEM_ACCESS_TECHNOLOGY_EDGE, 6, TRUE, FALSE, FALSE }; test_creg_match ("Ericsson F3607gw CGREG=2", FALSE, reply, data, &result); } @@ -1384,7 +1384,7 @@ test_creg2_md400_unsolicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "\r\n+CREG: 2,5,\"0502\",\"0404736D\"\r\n"; - const CregResult result = { 5, 0x0502, 0x0404736D, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 4, FALSE, FALSE }; + const CregResult result = { 5, 0x0502, 0x0404736D, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 4, FALSE, FALSE, FALSE }; test_creg_match ("Sony-Ericsson MD400 CREG=2", FALSE, reply, data, &result); } @@ -1394,7 +1394,7 @@ test_cgreg2_md400_unsolicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "\r\n+CGREG: 5,\"0502\",\"0404736D\",2\r\n"; - const CregResult result = { 5, 0x0502, 0x0404736D, MM_MODEM_ACCESS_TECHNOLOGY_UMTS, 6, TRUE, FALSE }; + const CregResult result = { 5, 0x0502, 0x0404736D, MM_MODEM_ACCESS_TECHNOLOGY_UMTS, 6, TRUE, FALSE, FALSE }; test_creg_match ("Sony-Ericsson MD400 CGREG=2", FALSE, reply, data, &result); } @@ -1404,7 +1404,7 @@ test_creg_cgreg_multi_unsolicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "\r\n+CREG: 5\r\n\r\n+CGREG: 0\r\n"; - const CregResult result = { 5, 0, 0, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN, 1, FALSE, FALSE }; + const CregResult result = { 5, 0, 0, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN, 1, FALSE, FALSE, FALSE }; test_creg_match ("Multi CREG/CGREG", FALSE, reply, data, &result); } @@ -1414,7 +1414,7 @@ test_creg_cgreg_multi2_unsolicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "\r\n+CGREG: 0\r\n\r\n+CREG: 5\r\n"; - const CregResult result = { 0, 0, 0, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN, 1, TRUE, FALSE }; + const CregResult result = { 0, 0, 0, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN, 1, TRUE, FALSE, FALSE }; test_creg_match ("Multi CREG/CGREG #2", FALSE, reply, data, &result); } @@ -1424,7 +1424,7 @@ test_cgreg2_x220_unsolicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "\r\n+CGREG: 2,1, 81ED, 1A9CEB\r\n"; - const CregResult result = { 1, 0x81ED, 0x1A9CEB, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN, 4, TRUE, FALSE }; + const CregResult result = { 1, 0x81ED, 0x1A9CEB, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN, 4, TRUE, FALSE, FALSE }; /* Tests random spaces in response */ test_creg_match ("Alcatel One-Touch X220D CGREG=2", FALSE, reply, data, &result); @@ -1435,7 +1435,7 @@ test_creg2_s8500_wave_unsolicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "\r\n+CREG: 2,1,000B,2816, B, C2816\r\n"; - const CregResult result = { 1, 0x000B, 0x2816, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN, 9, FALSE, FALSE }; + const CregResult result = { 1, 0x000B, 0x2816, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN, 9, FALSE, FALSE, FALSE }; test_creg_match ("Samsung Wave S8500 CREG=2", FALSE, reply, data, &result); } @@ -1445,7 +1445,7 @@ test_creg2_gobi_weird_solicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "\r\n+CREG: 2,1, 0 5, 2715\r\n"; - const CregResult result = { 1, 0x0000, 0x2715, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN, 4, FALSE, FALSE }; + const CregResult result = { 1, 0x0000, 0x2715, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN, 4, FALSE, FALSE, FALSE }; test_creg_match ("Qualcomm Gobi 1000 CREG=2", TRUE, reply, data, &result); } @@ -1455,7 +1455,7 @@ test_cgreg2_unsolicited_with_rac (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "\r\n+CGREG: 1,\"1422\",\"00000142\",3,\"00\"\r\n"; - const CregResult result = { 1, 0x1422, 0x0142, MM_MODEM_ACCESS_TECHNOLOGY_EDGE, 10, TRUE, FALSE }; + const CregResult result = { 1, 0x1422, 0x0142, MM_MODEM_ACCESS_TECHNOLOGY_EDGE, 10, TRUE, FALSE, FALSE }; test_creg_match ("CGREG=2 with RAC", FALSE, reply, data, &result); } @@ -1465,7 +1465,7 @@ test_cereg1_solicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "+CEREG: 1,3"; - const CregResult result = { 3, 0, 0, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 2, FALSE, TRUE }; + const CregResult result = { 3, 0, 0, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 2, FALSE, TRUE, FALSE }; test_creg_match ("CEREG=1", TRUE, reply, data, &result); } @@ -1475,7 +1475,7 @@ test_cereg1_unsolicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "\r\n+CEREG: 3\r\n"; - const CregResult result = { 3, 0, 0, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 1, FALSE, TRUE }; + const CregResult result = { 3, 0, 0, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 1, FALSE, TRUE, FALSE }; test_creg_match ("CEREG=1", FALSE, reply, data, &result); } @@ -1485,7 +1485,7 @@ test_cereg2_solicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "\r\n+CEREG: 2,1, 1F00, 79D903 ,7\r\n"; - const CregResult result = { 1, 0x1F00, 0x79D903, MM_MODEM_ACCESS_TECHNOLOGY_LTE, 8, FALSE, TRUE }; + const CregResult result = { 1, 0x1F00, 0x79D903, MM_MODEM_ACCESS_TECHNOLOGY_LTE, 8, FALSE, TRUE, FALSE }; test_creg_match ("CEREG=2", TRUE, reply, data, &result); } @@ -1495,7 +1495,7 @@ test_cereg2_unsolicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "\r\n+CEREG: 1, 1F00, 79D903 ,7\r\n"; - const CregResult result = { 1, 0x1F00, 0x79D903, MM_MODEM_ACCESS_TECHNOLOGY_LTE, 6, FALSE, TRUE }; + const CregResult result = { 1, 0x1F00, 0x79D903, MM_MODEM_ACCESS_TECHNOLOGY_LTE, 6, FALSE, TRUE, FALSE }; test_creg_match ("CEREG=2", FALSE, reply, data, &result); } @@ -1505,7 +1505,7 @@ test_cereg2_altair_lte_solicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "\r\n+CEREG: 1, 2, 0001, 00000100, 7\r\n"; - const CregResult result = { 2, 0x0001, 0x00000100, MM_MODEM_ACCESS_TECHNOLOGY_LTE, 8, FALSE, TRUE }; + const CregResult result = { 2, 0x0001, 0x00000100, MM_MODEM_ACCESS_TECHNOLOGY_LTE, 8, FALSE, TRUE, FALSE }; test_creg_match ("Altair LTE CEREG=2", FALSE, reply, data, &result); } @@ -1515,7 +1515,7 @@ test_cereg2_altair_lte_unsolicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "\r\n+CEREG: 2, 0001, 00000100, 7\r\n"; - const CregResult result = { 2, 0x0001, 0x00000100, MM_MODEM_ACCESS_TECHNOLOGY_LTE, 6, FALSE, TRUE }; + const CregResult result = { 2, 0x0001, 0x00000100, MM_MODEM_ACCESS_TECHNOLOGY_LTE, 6, FALSE, TRUE, FALSE }; test_creg_match ("Altair LTE CEREG=2", FALSE, reply, data, &result); } @@ -1525,7 +1525,7 @@ test_cereg2_novatel_lte_solicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "\r\n+CEREG: 2,1, 1F00, 20 ,79D903 ,7\r\n"; - const CregResult result = { 1, 0x1F00, 0x79D903, MM_MODEM_ACCESS_TECHNOLOGY_LTE, 12, FALSE, TRUE }; + const CregResult result = { 1, 0x1F00, 0x79D903, MM_MODEM_ACCESS_TECHNOLOGY_LTE, 12, FALSE, TRUE, FALSE }; test_creg_match ("Novatel LTE E362 CEREG=2", TRUE, reply, data, &result); } @@ -1535,7 +1535,7 @@ test_cereg2_novatel_lte_unsolicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "\r\n+CEREG: 1, 1F00, 20 ,79D903 ,7\r\n"; - const CregResult result = { 1, 0x1F00, 0x79D903, MM_MODEM_ACCESS_TECHNOLOGY_LTE, 11, FALSE, TRUE }; + const CregResult result = { 1, 0x1F00, 0x79D903, MM_MODEM_ACCESS_TECHNOLOGY_LTE, 11, FALSE, TRUE, FALSE }; test_creg_match ("Novatel LTE E362 CEREG=2", FALSE, reply, data, &result); } @@ -1545,7 +1545,7 @@ test_cgreg2_thuraya_solicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "+CGREG: 2, 1, \"0426\", \"F00F\""; - const CregResult result = { 1, 0x0426, 0xF00F, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN, 4, TRUE, FALSE }; + const CregResult result = { 1, 0x0426, 0xF00F, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN, 4, TRUE, FALSE, FALSE }; test_creg_match ("Thuraya solicited CREG=2", TRUE, reply, data, &result); } @@ -1555,11 +1555,51 @@ test_cgreg2_thuraya_unsolicited (void *f, gpointer d) { RegTestData *data = (RegTestData *) d; const char *reply = "\r\n+CGREG: 1, \"0426\", \"F00F\"\r\n"; - const CregResult result = { 1, 0x0426, 0xF00F, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN, 3, TRUE, FALSE }; + const CregResult result = { 1, 0x0426, 0xF00F, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN, 3, TRUE, FALSE, FALSE }; test_creg_match ("Thuraya unsolicited CREG=2", FALSE, reply, data, &result); } +static void +test_c5greg1_solicited (void *f, gpointer d) +{ + RegTestData *data = (RegTestData *) d; + const char *reply = "+C5GREG: 1,3"; + const CregResult result = { 3, 0, 0, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 2, FALSE, FALSE, TRUE }; + + test_creg_match ("C5GREG=1", TRUE, reply, data, &result); +} + +static void +test_c5greg1_unsolicited (void *f, gpointer d) +{ + RegTestData *data = (RegTestData *) d; + const char *reply = "\r\n+C5GREG: 3\r\n"; + const CregResult result = { 3, 0, 0, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN , 1, FALSE, FALSE, TRUE }; + + test_creg_match ("C5GREG=1", FALSE, reply, data, &result); +} + +static void +test_c5greg2_solicited (void *f, gpointer d) +{ + RegTestData *data = (RegTestData *) d; + const char *reply = "+C5GREG: 2,1,1F00,79D903,11,6,ABCDEF"; + const CregResult result = { 1, 0x1F00, 0x79D903, MM_MODEM_ACCESS_TECHNOLOGY_5GNR, 14, FALSE, FALSE, TRUE }; + + test_creg_match ("C5GREG=2", TRUE, reply, data, &result); +} + +static void +test_c5greg2_unsolicited (void *f, gpointer d) +{ + RegTestData *data = (RegTestData *) d; + const char *reply = "\r\n+C5GREG: 1,1F00,79D903,11,6,ABCDEF\r\n"; + const CregResult result = { 1, 0x1F00, 0x79D903, MM_MODEM_ACCESS_TECHNOLOGY_5GNR, 13, FALSE, FALSE, TRUE }; + + test_creg_match ("C5GREG=2", FALSE, reply, data, &result); +} + /*****************************************************************************/ /* Test CSCS responses */ @@ -4534,6 +4574,11 @@ int main (int argc, char **argv) g_test_suite_add (suite, TESTCASE (test_cereg2_novatel_lte_solicited, reg_data)); g_test_suite_add (suite, TESTCASE (test_cereg2_novatel_lte_unsolicited, reg_data)); + g_test_suite_add (suite, TESTCASE (test_c5greg1_solicited, reg_data)); + g_test_suite_add (suite, TESTCASE (test_c5greg1_unsolicited, reg_data)); + g_test_suite_add (suite, TESTCASE (test_c5greg2_solicited, reg_data)); + g_test_suite_add (suite, TESTCASE (test_c5greg2_unsolicited, reg_data)); + g_test_suite_add (suite, TESTCASE (test_creg_cgreg_multi_unsolicited, reg_data)); g_test_suite_add (suite, TESTCASE (test_creg_cgreg_multi2_unsolicited, reg_data)); -- cgit v1.2.3-70-g09d2