Lines Matching refs:resp
66 at_response_t resp = RT_NULL; in at_create_resp() local
68 resp = (at_response_t)rt_calloc(1, sizeof(struct at_response)); in at_create_resp()
69 if (resp == RT_NULL) in at_create_resp()
75 resp->buf = (char *)rt_calloc(1, buf_size); in at_create_resp()
76 if (resp->buf == RT_NULL) in at_create_resp()
79 rt_free(resp); in at_create_resp()
83 resp->buf_size = buf_size; in at_create_resp()
84 resp->line_num = line_num; in at_create_resp()
85 resp->line_counts = 0; in at_create_resp()
86 resp->timeout = timeout; in at_create_resp()
88 return resp; in at_create_resp()
96 void at_delete_resp(at_response_t resp) in at_delete_resp() argument
98 if (resp && resp->buf) in at_delete_resp()
100 rt_free(resp->buf); in at_delete_resp()
103 if (resp) in at_delete_resp()
105 rt_free(resp); in at_delete_resp()
106 resp = RT_NULL; in at_delete_resp()
123 at_response_t at_resp_set_info(at_response_t resp, rt_size_t buf_size, rt_size_t line_num, rt_int32… in at_resp_set_info() argument
126 RT_ASSERT(resp); in at_resp_set_info()
128 if (resp->buf_size != buf_size) in at_resp_set_info()
130 resp->buf_size = buf_size; in at_resp_set_info()
132 p_temp = (char *)rt_realloc(resp->buf, buf_size); in at_resp_set_info()
140 resp->buf = p_temp; in at_resp_set_info()
144 resp->line_num = line_num; in at_resp_set_info()
145 resp->timeout = timeout; in at_resp_set_info()
147 return resp; in at_resp_set_info()
159 const char *at_resp_get_line(at_response_t resp, rt_size_t resp_line) in at_resp_get_line() argument
161 char *resp_buf = resp->buf; in at_resp_get_line()
164 RT_ASSERT(resp); in at_resp_get_line()
166 if (resp_line > resp->line_counts || resp_line <= 0) in at_resp_get_line()
172 for (line_num = 1; line_num <= resp->line_counts; line_num++) in at_resp_get_line()
194 const char *at_resp_get_line_by_kw(at_response_t resp, const char *keyword) in at_resp_get_line_by_kw() argument
196 char *resp_buf = resp->buf; in at_resp_get_line_by_kw()
199 RT_ASSERT(resp); in at_resp_get_line_by_kw()
202 for (line_num = 1; line_num <= resp->line_counts; line_num++) in at_resp_get_line_by_kw()
226 int at_resp_parse_line_args(at_response_t resp, rt_size_t resp_line, const char *resp_expr, ...) in at_resp_parse_line_args() argument
232 RT_ASSERT(resp); in at_resp_parse_line_args()
235 resp_line_buf = at_resp_get_line(resp, resp_line); in at_resp_parse_line_args()
261 int at_resp_parse_line_args_by_kw(at_response_t resp, const char *keyword, const char *resp_expr, .… in at_resp_parse_line_args_by_kw() argument
267 RT_ASSERT(resp); in at_resp_parse_line_args_by_kw()
270 resp_line_buf = at_resp_get_line_by_kw(resp, keyword); in at_resp_parse_line_args_by_kw()
297 int at_obj_exec_cmd(at_client_t client, at_response_t resp, const char *cmd_expr, ...) in at_obj_exec_cmd() argument
311 if (client->status == AT_STATUS_CLI && resp) in at_obj_exec_cmd()
320 if (resp != RT_NULL) in at_obj_exec_cmd()
322 resp->buf_len = 0; in at_obj_exec_cmd()
323 resp->line_counts = 0; in at_obj_exec_cmd()
326 client->resp = resp; in at_obj_exec_cmd()
337 if (resp != RT_NULL) in at_obj_exec_cmd()
339 …nt, at_client_resp_notice_event, RT_EVENT_FLAG_AND | RT_EVENT_FLAG_CLEAR, resp->timeout, NULL) != … in at_obj_exec_cmd()
341 …xecute command (%.*s) timeout (%d ticks)!", client->last_cmd_len, client->send_buf, resp->timeout); in at_obj_exec_cmd()
352 client->resp = RT_NULL; in at_obj_exec_cmd()
375 int at_obj_exec_cmd_format(at_client_t client, at_response_t resp, const char *format, const char *… in at_obj_exec_cmd_format() argument
389 if (client->status == AT_STATUS_CLI && resp) in at_obj_exec_cmd_format()
398 if (resp != RT_NULL) in at_obj_exec_cmd_format()
400 resp->buf_len = 0; in at_obj_exec_cmd_format()
401 resp->line_counts = 0; in at_obj_exec_cmd_format()
404 client->resp = resp; in at_obj_exec_cmd_format()
428 if (resp != RT_NULL) in at_obj_exec_cmd_format()
430 …nt, at_client_resp_notice_event, RT_EVENT_FLAG_AND | RT_EVENT_FLAG_CLEAR, resp->timeout, NULL) != … in at_obj_exec_cmd_format()
432 …xecute command (%.*s) timeout (%d ticks)!", client->last_cmd_len, client->send_buf, resp->timeout); in at_obj_exec_cmd_format()
443 client->resp = RT_NULL; in at_obj_exec_cmd_format()
463 at_response_t resp = RT_NULL; in at_client_obj_wait_connect() local
472 resp = at_create_resp(64, 0, rt_tick_from_millisecond(300)); in at_client_obj_wait_connect()
473 if (resp == RT_NULL) in at_client_obj_wait_connect()
491 if (at_obj_exec_cmd(client, resp, "AT") == RT_EOK) in at_client_obj_wait_connect()
497 at_delete_resp(resp); in at_client_obj_wait_connect()
855 else if (client->resp != RT_NULL) in client_parser()
857 at_response_t resp = client->resp; in client_parser() local
863 if (resp->buf_len + client->recv_line_len < resp->buf_size) in client_parser()
866 … rt_memcpy(resp->buf + resp->buf_len, client->recv_line_buf, client->recv_line_len); in client_parser()
869 resp->buf_len += client->recv_line_len; in client_parser()
870 resp->line_counts++; in client_parser()
875 …Read response buffer failed. The Response buffer size is out of buffer size(%d)!", resp->buf_size); in client_parser()
878 … if ((client->end_sign != 0) && (end_ch == client->end_sign) && (resp->line_num == 0)) in client_parser()
884 && resp->line_num == 0) in client_parser()
894 else if (resp->line_counts == resp->line_num && resp->line_num) in client_parser()
904 client->resp = RT_NULL; in client_parser()