Lines Matching full:buf

16 #include <zephyr/net/buf.h>
22 if (at->buf[at->pos] == ',') { in next_list()
27 int at_check_byte(struct net_buf *buf, char check_byte) in at_check_byte() argument
29 const unsigned char *str = buf->data; in at_check_byte()
34 net_buf_pull(buf, 1); in at_check_byte()
41 while (at->buf[at->pos] == ' ') { in skip_space()
53 isdigit((unsigned char)at->buf[at->pos]) != 0; in at_get_number()
55 *val = *val * 10U + at->buf[at->pos] - '0'; in at_get_number()
75 static int at_parse_result(const char *str, struct net_buf *buf, in at_parse_result() argument
79 if ((!strncmp(str, "OK", 2)) && (at_check_byte(buf, '\n') == 0)) { in at_parse_result()
84 if ((!strncmp(str, "ERROR", 5)) && (at_check_byte(buf, '\n')) == 0) { in at_parse_result()
92 static int get_cmd_value(struct at_client *at, struct net_buf *buf, in get_cmd_value() argument
97 const char *str = (char *)buf->data; in get_cmd_value()
99 while (cmd_len < buf->len && at->pos != at->buf_max_len) { in get_cmd_value()
101 at->buf[at->pos++] = *str; in get_cmd_value()
107 at->buf[at->pos] = '\0'; in get_cmd_value()
113 net_buf_pull(buf, cmd_len); in get_cmd_value()
122 static int get_response_string(struct at_client *at, struct net_buf *buf, in get_response_string() argument
127 const char *str = (char *)buf->data; in get_response_string()
129 while (cmd_len < buf->len && at->pos != at->buf_max_len) { in get_response_string()
131 at->buf[at->pos++] = *str; in get_response_string()
137 at->buf[at->pos] = '\0'; in get_response_string()
143 net_buf_pull(buf, cmd_len); in get_response_string()
154 (void)memset(at->buf, 0, at->buf_max_len); in reset_buffer()
158 static int at_state_start(struct at_client *at, struct net_buf *buf) in at_state_start() argument
162 err = at_check_byte(buf, '\r'); in at_state_start()
171 static int at_state_start_cr(struct at_client *at, struct net_buf *buf) in at_state_start_cr() argument
175 err = at_check_byte(buf, '\n'); in at_state_start_cr()
184 static int at_state_start_lf(struct at_client *at, struct net_buf *buf) in at_state_start_lf() argument
187 if (at_check_byte(buf, '+') == 0) { in at_state_start_lf()
190 } else if (isalpha(*buf->data) != 0) { in at_state_start_lf()
198 static int at_state_get_cmd_string(struct at_client *at, struct net_buf *buf) in at_state_get_cmd_string() argument
200 return get_response_string(at, buf, ':', AT_STATE_PROCESS_CMD); in at_state_get_cmd_string()
205 if (strncmp(at->buf, "CME ERROR", 9) == 0) { in is_cmer()
212 static int at_state_process_cmd(struct at_client *at, struct net_buf *buf) in at_state_process_cmd() argument
220 at->resp(at, buf); in at_state_process_cmd()
228 static int at_state_get_result_string(struct at_client *at, struct net_buf *buf) in at_state_get_result_string() argument
230 return get_response_string(at, buf, '\r', AT_STATE_PROCESS_RESULT); in at_state_get_result_string()
235 if (strncmp(at->buf, "RING", 4) == 0) { in is_ring()
242 static int at_state_process_result(struct at_client *at, struct net_buf *buf) in at_state_process_result() argument
252 if (at_parse_result(at->buf, buf, &result) == 0) { in at_state_process_result()
287 static int at_state_process_ag_nw_err(struct at_client *at, struct net_buf *buf) in at_state_process_ag_nw_err() argument
290 return at_parse_cmd_input(at, buf, NULL, cme_handle, in at_state_process_ag_nw_err()
294 static int at_state_unsolicited_cmd(struct at_client *at, struct net_buf *buf) in at_state_unsolicited_cmd() argument
297 return at->unsolicited(at, buf); in at_state_unsolicited_cmd()
316 int at_parse_input(struct at_client *at, struct net_buf *buf) in at_parse_input() argument
320 while (buf->len) { in at_parse_input()
324 ret = parser_cb[at->state](at, buf); in at_parse_input()
336 static int at_cmd_start(struct at_client *at, struct net_buf *buf, in at_cmd_start() argument
340 if (!str_has_prefix(at->buf, prefix)) { in at_cmd_start()
359 static int at_cmd_get_value(struct at_client *at, struct net_buf *buf, in at_cmd_get_value() argument
365 return get_cmd_value(at, buf, '\r', AT_CMD_PROCESS_VALUE); in at_cmd_get_value()
368 static int at_cmd_process_value(struct at_client *at, struct net_buf *buf, in at_cmd_process_value() argument
380 static int at_cmd_state_end_lf(struct at_client *at, struct net_buf *buf, in at_cmd_state_end_lf() argument
386 err = at_check_byte(buf, '\n'); in at_cmd_state_end_lf()
404 int at_parse_cmd_input(struct at_client *at, struct net_buf *buf, in at_parse_cmd_input() argument
410 while (buf->len) { in at_parse_cmd_input()
415 ret = cmd_parser_cb[at->cmd_state](at, buf, prefix, func, type); in at_parse_cmd_input()
430 return at->buf[at->pos] != '\0'; in at_has_next_list()
438 if (at->buf[at->pos] != '(') { in at_open_list()
450 if (at->buf[at->pos] != ')') { in at_close_list()
466 if (at->buf[at->pos] != '"') { in at_list_get_string()
471 while (at->buf[at->pos] != '\0' && at->buf[at->pos] != '"') { in at_list_get_string()
475 name[i++] = at->buf[at->pos++]; in at_list_get_string()
484 if (at->buf[at->pos] != '"') { in at_list_get_string()
505 if (at->buf[at->pos] == '-') { in at_list_get_range()
510 if (isdigit((unsigned char)at->buf[at->pos]) == 0) { in at_list_get_range()