NCS 3.1.0 - at_parser and +CEINFO

I currently evaluated the use of the "<modem/at_parser.h>" (at_parser module).

Using it with the at-cmd "at+CEINFO?" is very irritating.

I 07.324 : CEINFO: +CEINFO: 0,1,C,8,1,-103,7

I 07.323 : AT[0] := "+CEINFO"
I 07.323 : AT[1] := 0
I 07.323 : AT[2] := 1
I 07.323 : AT[3] := "C"
I 07.323 : AT[4] := error -61 (No data)
I 07.323 : AT[5] := 8
I 07.323 : AT[6] := 1
I 07.324 : AT[7] := -103
I 07.324 : AT[8] := 7

it seems to insert an error after the parameter 3 (C). But that doesn't make too much sense. Looks like a single character parameter is handled wrong. Inserting such an wrong error will then be very dangerous, once the error gets fixed, though that shifts also all indexes afterwards.

(code snippet to easy reproduce the result:

void modem_at_dump_parser(const char *at_response)
{
   struct at_parser parser;
   int result = 0;
   int value_int = 0;
   char value_text[32] = {0};
   size_t value_text_len = 0;
   size_t count = 0;

   result = at_parser_init(&parser, at_response);
   __ASSERT_NO_MSG(result == 0);

   result = at_parser_cmd_count_get(&parser, &count);
   if (result) {
      LOG_ERR("AT command count failed, error: %d (%s)", result, strerror(-result));
      return;
   }
   for (size_t index = 0; index < count; ++index) {
      result = at_parser_num_get(&parser, index, &value_int);
      if (!result) {
         LOG_INF("AT[%d] := %d", index, value_int);
      } else {
         value_text_len = sizeof(value_text);
         result = at_parser_string_get(&parser, index, value_text, &value_text_len);
         if (!result) {
            LOG_INF("AT[%d] := \"%s\"", index, value_text);
         } else {
            LOG_INF("AT[%d] := error %d (%s)", index, result, strerror(-result));
         }
      }
   }
}

Parents Reply Children
Related