新手入门
- 积分
- 7
- 金钱
- 7
- 注册时间
- 2020-12-3
- 在线时间
- 0 小时
|
使用库函数:int32_t esp8266_CIP_mode(int m)
{
char cmd[64] = {0};
snprintf(cmd, 64, "%s=%d", AT_CMD_CIPMODE, (int)m);
return esp8266_cmd((int8_t *)cmd, strlen(cmd), "OK", NULL, NULL);
}
int32_t esp8266_send(int32_t id , const uint8_t *buf, uint32_t len)
{
int32_t ret = AT_FAILED;
char cmd[64] = {0};
if (AT_MUXMODE_SINGLE == at.mux_mode)
{
snprintf(cmd, 64, "%s=%ld,\"%s\",%d", AT_CMD_SEND,len,at.linkid[0].remote_ip, at.linkid[0].remote_port);
}
else
{
snprintf(cmd, 64, "%s=%ld,%lu,\"%s\",%d", AT_CMD_SEND, id, len,at.linkid[id].remote_ip, at.linkid[id].remote_port);
}
//at.cmd(cmd, strlen(cmd), ">", NULL,NULL);
ret = at.write((int8_t *)cmd, (int8_t *)"SEND OK\r\n", (int8_t *)buf, len);
return ret;
}
调用函数
esp8266_CIP_mode(1);
LOS_TaskDelay(2000);
esp8266_send(1,(uint8_t*)"123456",strlen("123456"));
串口打印数据:
[4][at_recv_task:528][I]at recv msg sent done
[4][at_cmd_multi_suffix:289][I]cmd:AT+CIPMODE_CUR=1 len -1, 00000000,0
[4][at_recv_task:541][D]recv len = 9 buf =
ERROR
[14][at_recv_task:528][I]at recv msg sent done
[14][at_cmd_multi_suffix:310][I]LOS_SemPend for listener.resp_sem failed(ret = 2000707, cmd = AT+CIPMODE_CUR=1)!
[16][at_recv_task:541][D]recv len = 18 buf = no tail
ERROR
[26][at_recv_task:528][I]at recv msg sent done
[26][at_write:372][I]LOS_SemPend for listener.resp_sem failed(ret = 2000707)!
|
|