diff --git a/class/air720/at_socket_air720.c b/class/air720/at_socket_air720.c index f223096..acfec66 100644 --- a/class/air720/at_socket_air720.c +++ b/class/air720/at_socket_air720.c @@ -88,22 +88,14 @@ static int air720_socket_close(struct at_socket *socket) { uint32_t event = 0; int result = RT_EOK; - at_response_t resp = RT_NULL; int device_socket = (int)socket->user_data; struct at_device *device = (struct at_device *)socket->device; - resp = at_create_resp(64, 0, rt_tick_from_millisecond(300)); - if (resp == RT_NULL) - { - LOG_E("no memory for air720 device(%s) response structure.", device->name); - return -RT_ENOMEM; - } - /* clear socket close event */ event = SET_EVENT(device_socket, AIR720_EVNET_CLOSE_OK); air720_socket_event_recv(device, event, 0, RT_EVENT_FLAG_OR); - if (at_obj_exec_cmd(device->client, resp, "AT+CIPCLOSE=%d", device_socket) < 0) + if (at_obj_exec_cmd(device->client, NULL, "AT+CIPCLOSE=%d", device_socket) < 0) { result = -RT_ERROR; goto __exit; @@ -117,11 +109,6 @@ static int air720_socket_close(struct at_socket *socket) } __exit: - if (resp) - { - at_delete_resp(resp); - } - return result; } diff --git a/class/m26/at_socket_m26.c b/class/m26/at_socket_m26.c index 89e5013..75906f6 100644 --- a/class/m26/at_socket_m26.c +++ b/class/m26/at_socket_m26.c @@ -84,21 +84,13 @@ static int m26_socket_event_recv(struct at_device *device, uint32_t event, uint3 static int m26_socket_close(struct at_socket *socket) { int result = 0; - at_response_t resp = RT_NULL; int device_socke = (int) socket->user_data; struct at_device *device = (struct at_device *) socket->device; - - resp = at_create_resp(64, 0, rt_tick_from_millisecond(300)); - if (resp == RT_NULL) - { - LOG_E("no memory for resp create.", device->name); - return -RT_ENOMEM; - } - + /* clear socket close event */ m26_socket_event_recv(device, SET_EVENT(device_socke, M26_EVNET_CLOSE_OK), 0, RT_EVENT_FLAG_OR); - if (at_obj_exec_cmd(device->client, resp, "AT+QICLOSE=%d", device_socke) < 0) + if (at_obj_exec_cmd(device->client, NULL, "AT+QICLOSE=%d", device_socke) < 0) { result = -RT_ERROR; goto __exit; @@ -113,11 +105,6 @@ static int m26_socket_close(struct at_socket *socket) } __exit: - if (resp) - { - at_delete_resp(resp); - } - return result; } diff --git a/class/sim800c/at_socket_sim800c.c b/class/sim800c/at_socket_sim800c.c index 48cf9ce..06bffe7 100644 --- a/class/sim800c/at_socket_sim800c.c +++ b/class/sim800c/at_socket_sim800c.c @@ -84,22 +84,14 @@ static int sim800c_socket_close(struct at_socket *socket) { uint32_t event = 0; int result = RT_EOK; - at_response_t resp = RT_NULL; int device_socket = (int) socket->user_data; struct at_device *device = (struct at_device *) socket->device; - - resp = at_create_resp(64, 0, rt_tick_from_millisecond(300)); - if (resp == RT_NULL) - { - LOG_E("no memory for resp create."); - return -RT_ENOMEM; - } - + /* clear socket close event */ event = SET_EVENT(device_socket, SIM800C_EVNET_CLOSE_OK); sim800c_socket_event_recv(device, event, 0, RT_EVENT_FLAG_OR); - - if (at_obj_exec_cmd(device->client, resp, "AT+CIPCLOSE=%d", device_socket) < 0) + + if (at_obj_exec_cmd(device->client, NULL, "AT+CIPCLOSE=%d", device_socket) < 0) { result = -RT_ERROR; goto __exit; @@ -112,12 +104,7 @@ static int sim800c_socket_close(struct at_socket *socket) goto __exit; } -__exit: - if (resp) - { - at_delete_resp(resp); - } - +__exit: return result; }