我的代码如下:
retval = http_sendCommand(parser,"AT+HTTPINIT","OK",timeout+timeout);
if(retval){printf("AT+HTTPINIT OK\n");}
else{ printf("AT+HTTPINIT 2 FAILED\n"); return -1;}
SystemController::delayMilliseconds(delay);
/////////////////////////////////////////////////////////////////////////
retval = http_sendCommand(parser,"AT+HTTPPARA=\"CID\",1","OK",timeout+timeout);
if(retval){printf("AT+HTTPPARA 1 OK\n");}
else{ printf("AT+HTTPPARA 1 FAILED\n"); return -1;}
SystemController::delayMilliseconds(delay);
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
char urlbuffer[50];
strcpy(urlbuffer,"AT+HTTPPARA=\"URL\",");
strcat(urlbuffer,"\"");
strcat(urlbuffer,url);
strcat(urlbuffer,"\"");
retval = http_sendCommand(parser,urlbuffer,"OK",timeout+timeout);
if(retval){printf("AT+HTTPPARA 2 OK\n");}
else{ printf("AT+HTTPPARA 2 FAILED\n"); return -1;}
SystemController::delayMilliseconds(delay);
/////////////////////////////////////////////////////////////////////////
retval = http_sendCommand(parser,"AT+HTTPPARA=\"CONTENT\",\"application/json\"","OK",timeout+timeout);
if(retval){printf("AT+HTTPPARA 3 OK\n");}
else{ printf("AT+HTTPPARA 3 FAILED\n"); return -1;}
SystemController::delayMilliseconds(delay);
//////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
char buffer[30];
char num[10];
sprintf(num, "%d", strlen(data));
strcpy(buffer,"AT+HTTPDATA=");
strcat(buffer,num);
strcat(buffer,",25000");
printf("Datalength :%s\n",num);
///////////////////////////////////////////////////////////////////////////
retval = http_sendCommand(parser,buffer,"DOWNLOAD",timeout+timeout);
if(retval){printf("AT+HTTPDATA OK START DOWNLOAD...\n");}
else{ printf("AT+HTTPDATA FAILED"); return -1;}
SystemController::delayMilliseconds(delay);
/////////////////////////////////////////////////////////////////////////
const char* ptr = data;
uint8_t mod=0;
uint8_t bytessend=0;
while(*ptr!='\0'){
_uart.transmitByte(*ptr);
ptr++;
bytessend++;
SystemController::delayMilliseconds(50);
if(++mod==20){
mod=0;
SystemController::delayMilliseconds(5000);
printf("new Packet \n");
}
}
printf("Bytes Send %d",bytessend);
SystemController::delayMilliseconds(delay);
/////////////////////////////////////////////////////////////////////////
bool actionsucc=false;
retval = http_sendCommand(parser,"AT+HTTPACTION=1","+HTTPACTION:",timeout);
if(retval){printf("AT+HTTPACTION OK\n");actionsucc=true;}
else{ printf("AT+HTTPACTION FAILED\n");}
SystemController::delayMilliseconds(1000);
retval = http_sendCommand(parser,"AT+HTTPSTATUS? ","OK",timeout);
现在服务器日志说...。
type=REQUEST
from=80.xxx.80.2
url=http:xxxxx
method=POST
filtered-headers={content-length=0,host=dev4.mobile2b.de,content-type=application/json,connection=Keep-Alive,accept=*/*}
INFO=the headers: accept-language, user-agent, pragma, cache-controle are filtered out
RequestBody= <- EMPTY!!!
我想念某事吗?我已经重新设计了AT + HTTPDATA部分,以减慢数据传输到模块的速度。但这也不起作用。
如果有人能帮助我会很高兴。
谢谢!