1、Increase the size of the EntmSend function send_buff

2、Optimize ota.c、ota.h and server_tcp.c files
This commit is contained in:
wgzAIIT
2023-06-06 16:48:18 +08:00
parent dcea61d5e0
commit fb9250181f
4 changed files with 127 additions and 115 deletions

View File

@@ -264,23 +264,25 @@ int AtSetReplyCharNum(ATAgentType agent, unsigned int num)
int EntmSend(ATAgentType agent, const char *data, int len)
{
char send_buf[128];
if(len > 128){
printf("send length %d more then max 128 Bytes.\n",len);
if(len > 256){
printf("send length %d more then max 256 Bytes.\n",len);
return -1;
}
char *send_buff = (char *)PrivMalloc(256);
PrivMutexObtain(&agent->lock);
memset(send_buf, 0, 128);
memset(send_buff, 0, 256);
agent->receive_mode = ENTM_MODE;
memcpy(send_buf, data, len);
// memcpy(send_buf + len, "!@", 2);
memcpy(send_buff, data, len);
PrivWrite(agent->fd, send_buf, len);
PrivWrite(agent->fd, send_buff, len);
PrivMutexAbandon(&agent->lock);
printf("entm send %s length %d\n",send_buf, len);
printf("entm send length %d\n", len);
PrivFree(send_buff);
return 0;
}