improve ec20 driver

This commit is contained in:
mculover666
2020-08-10 16:18:16 +08:00
parent 0608bcf257
commit c0cde5d290

View File

@@ -173,7 +173,7 @@ static int ec20_set_apn(void)
} }
tos_at_cmd_exec(&echo, 3000, "AT+QIACT=1\r\n"); tos_at_cmd_exec_until(&echo, 3000, "AT+QIACT=1\r\n");
if (echo.status != AT_ECHO_STATUS_OK) if (echo.status != AT_ECHO_STATUS_OK)
{ {
return -1; return -1;
@@ -242,6 +242,8 @@ static int ec20_connect(const char *ip, const char *port, sal_proto_t proto)
return -1; return -1;
} }
tos_at_cmd_exec(NULL, 1000, "AT+QICLOSE=%d\r\n", id);
tos_at_echo_create(&echo, NULL, 0, "CONNECT OK"); tos_at_echo_create(&echo, NULL, 0, "CONNECT OK");
tos_at_cmd_exec(&echo, 4000, "AT+QIOPEN=1,%d,\"%s\",\"%s\",%d,0,1\r\n", tos_at_cmd_exec(&echo, 4000, "AT+QIOPEN=1,%d,\"%s\",\"%s\",%d,0,1\r\n",
id, proto == TOS_SAL_PROTO_UDP ? "UDP" : "TCP", ip, atoi(port)); id, proto == TOS_SAL_PROTO_UDP ? "UDP" : "TCP", ip, atoi(port));