Lines Matching refs:buf
24 if (at->buf[at->pos] == ',') { in next_list()
29 int at_check_byte(struct net_buf *buf, char check_byte) in at_check_byte() argument
31 const unsigned char *str = buf->data; in at_check_byte()
36 net_buf_pull(buf, 1); in at_check_byte()
43 while (at->buf[at->pos] == ' ') { in skip_space()
55 isdigit((unsigned char)at->buf[at->pos]); in at_get_number()
57 *val = *val * 10U + at->buf[at->pos] - '0'; in at_get_number()
77 static int at_parse_result(const char *str, struct net_buf *buf, in at_parse_result() argument
81 if ((!strncmp(str, "OK", 2)) && (at_check_byte(buf, '\n') == 0)) { in at_parse_result()
86 if ((!strncmp(str, "ERROR", 5)) && (at_check_byte(buf, '\n')) == 0) { in at_parse_result()
94 static int get_cmd_value(struct at_client *at, struct net_buf *buf, in get_cmd_value() argument
99 const char *str = (char *)buf->data; in get_cmd_value()
101 while (cmd_len < buf->len && at->pos != at->buf_max_len) { in get_cmd_value()
103 at->buf[at->pos++] = *str; in get_cmd_value()
109 at->buf[at->pos] = '\0'; in get_cmd_value()
115 net_buf_pull(buf, cmd_len); in get_cmd_value()
124 static int get_response_string(struct at_client *at, struct net_buf *buf, in get_response_string() argument
129 const char *str = (char *)buf->data; in get_response_string()
131 while (cmd_len < buf->len && at->pos != at->buf_max_len) { in get_response_string()
133 at->buf[at->pos++] = *str; in get_response_string()
139 at->buf[at->pos] = '\0'; in get_response_string()
145 net_buf_pull(buf, cmd_len); in get_response_string()
156 (void)memset(at->buf, 0, at->buf_max_len); in reset_buffer()
160 static int at_state_start(struct at_client *at, struct net_buf *buf) in at_state_start() argument
164 err = at_check_byte(buf, '\r'); in at_state_start()
173 static int at_state_start_cr(struct at_client *at, struct net_buf *buf) in at_state_start_cr() argument
177 err = at_check_byte(buf, '\n'); in at_state_start_cr()
186 static int at_state_start_lf(struct at_client *at, struct net_buf *buf) in at_state_start_lf() argument
189 if (at_check_byte(buf, '+') == 0) { in at_state_start_lf()
192 } else if (isalpha(*buf->data)) { in at_state_start_lf()
200 static int at_state_get_cmd_string(struct at_client *at, struct net_buf *buf) in at_state_get_cmd_string() argument
202 return get_response_string(at, buf, ':', AT_STATE_PROCESS_CMD); in at_state_get_cmd_string()
207 if (strncmp(at->buf, "CME ERROR", 9) == 0) { in is_cmer()
214 static int at_state_process_cmd(struct at_client *at, struct net_buf *buf) in at_state_process_cmd() argument
222 at->resp(at, buf); in at_state_process_cmd()
230 static int at_state_get_result_string(struct at_client *at, struct net_buf *buf) in at_state_get_result_string() argument
232 return get_response_string(at, buf, '\r', AT_STATE_PROCESS_RESULT); in at_state_get_result_string()
237 if (strncmp(at->buf, "RING", 4) == 0) { in is_ring()
244 static int at_state_process_result(struct at_client *at, struct net_buf *buf) in at_state_process_result() argument
254 if (at_parse_result(at->buf, buf, &result) == 0) { in at_state_process_result()
289 static int at_state_process_ag_nw_err(struct at_client *at, struct net_buf *buf) in at_state_process_ag_nw_err() argument
292 return at_parse_cmd_input(at, buf, NULL, cme_handle, in at_state_process_ag_nw_err()
296 static int at_state_unsolicited_cmd(struct at_client *at, struct net_buf *buf) in at_state_unsolicited_cmd() argument
299 return at->unsolicited(at, buf); in at_state_unsolicited_cmd()
318 int at_parse_input(struct at_client *at, struct net_buf *buf) in at_parse_input() argument
322 while (buf->len) { in at_parse_input()
326 ret = parser_cb[at->state](at, buf); in at_parse_input()
338 static int at_cmd_start(struct at_client *at, struct net_buf *buf, in at_cmd_start() argument
342 if (!str_has_prefix(at->buf, prefix)) { in at_cmd_start()
361 static int at_cmd_get_value(struct at_client *at, struct net_buf *buf, in at_cmd_get_value() argument
367 return get_cmd_value(at, buf, '\r', AT_CMD_PROCESS_VALUE); in at_cmd_get_value()
370 static int at_cmd_process_value(struct at_client *at, struct net_buf *buf, in at_cmd_process_value() argument
382 static int at_cmd_state_end_lf(struct at_client *at, struct net_buf *buf, in at_cmd_state_end_lf() argument
388 err = at_check_byte(buf, '\n'); in at_cmd_state_end_lf()
406 int at_parse_cmd_input(struct at_client *at, struct net_buf *buf, in at_parse_cmd_input() argument
412 while (buf->len) { in at_parse_cmd_input()
417 ret = cmd_parser_cb[at->cmd_state](at, buf, prefix, func, type); in at_parse_cmd_input()
432 return at->buf[at->pos] != '\0'; in at_has_next_list()
440 if (at->buf[at->pos] != '(') { in at_open_list()
452 if (at->buf[at->pos] != ')') { in at_close_list()
468 if (at->buf[at->pos] != '"') { in at_list_get_string()
473 while (at->buf[at->pos] != '\0' && at->buf[at->pos] != '"') { in at_list_get_string()
477 name[i++] = at->buf[at->pos++]; in at_list_get_string()
486 if (at->buf[at->pos] != '"') { in at_list_get_string()
507 if (at->buf[at->pos] == '-') { in at_list_get_range()
512 if (!isdigit((unsigned char)at->buf[at->pos])) { in at_list_get_range()