Dependencies: BLE_API WIFI_API_32kRAM mbed nRF51822
Fork of NNN40_CLI by
Diff: CLI_Source/wifi_cli.cpp
- Revision:
- 13:7eaec228ad23
- Parent:
- 12:a91455702763
--- a/CLI_Source/wifi_cli.cpp Thu Feb 18 07:59:26 2016 +0000 +++ b/CLI_Source/wifi_cli.cpp Thu Feb 25 07:22:37 2016 +0000 @@ -11,8 +11,8 @@ #define AP_SSID_MAX_LEN 33 #define AP_PW_MAX_LEN 64 #define STATIC_IP_MAX_LEN 15 -#define TCP_SEND_MAX_LEN 128 -#define UDP_SEND_MAX_LEN 128 +#define TCP_SEND_MAX_LEN 1400 +#define UDP_SEND_MAX_LEN 1400 //#define DELTA_WIFI_DEBUG #define WIFI_MAX_AP_NUMBER 15 // WiFI_API_32kRAM ver. 8 @@ -697,11 +697,11 @@ char msg[TCP_SEND_MAX_LEN+1]; int sendData; uint8_t * argAllBuf = cyntecGetCommandTotalBuffer(); - uint8_t sendLen = 0; - uint8_t sendLenCharNum = 0; - uint8_t *sendLeng = cyntecGetCommandArgument(0,&sendLenCharNum); - sendLen = cyntecAtoi(sendLeng,sendLenCharNum); - if (sendLen > TCP_SEND_MAX_LEN) { + int sendLen = 0; // Maximum 1400 + uint8_t sendLenCharNum = 0; // Maximum 4 + uint8_t *argLeng = cyntecGetCommandArgument(0,&sendLenCharNum); + sendLen = cyntecAtoInt(argLeng,sendLenCharNum); + if (sendLen > TCP_SEND_MAX_LEN || sendLen < 0) { cyntecPrintError(CYNTEC_CMD_ERR_ARGUMENT_OUT_OF_RANGE); return; } @@ -739,10 +739,10 @@ char msg[TCP_SEND_MAX_LEN+1]; int sendData; uint8_t * argAllBuf = cyntecGetCommandTotalBuffer(); - uint8_t sendLen = 0; - uint8_t sendLenCharNum = 0; - uint8_t *sendLeng = cyntecGetCommandArgument(0,&sendLenCharNum); - sendLen = cyntecAtoi(sendLeng,sendLenCharNum); + int sendLen = 0; // Maximum 1400 + uint8_t sendLenCharNum = 0; // Maximum 4 + uint8_t *argLeng = cyntecGetCommandArgument(0,&sendLenCharNum); + sendLen = cyntecAtoi(argLeng,sendLenCharNum); if (sendLen > TCP_SEND_MAX_LEN) { cyntecPrintError(CYNTEC_CMD_ERR_ARGUMENT_OUT_OF_RANGE); return; @@ -992,11 +992,11 @@ char msg[UDP_SEND_MAX_LEN+1]; int sendData; uint8_t * argAllBuf = cyntecGetCommandTotalBuffer(); - uint8_t sendLen = 0; - uint8_t sendLenCharNum = 0; - uint8_t *sendLeng = cyntecGetCommandArgument(0,&sendLenCharNum); - sendLen = cyntecAtoi(sendLeng,sendLenCharNum); - if (sendLen > UDP_SEND_MAX_LEN) { + int sendLen = 0; // Maximum 1400, need to be integer + uint8_t sendLenCharNum = 0; // Maximum 4 + uint8_t *argLeng = cyntecGetCommandArgument(0,&sendLenCharNum); + sendLen = cyntecAtoInt(argLeng,sendLenCharNum); + if (sendLen > UDP_SEND_MAX_LEN || sendLen < 0) { cyntecPrintError(CYNTEC_CMD_ERR_ARGUMENT_OUT_OF_RANGE); return; } @@ -1011,7 +1011,7 @@ console.printf("sendLen:%i,Buf:%s,Index:%i\r\n",sendLen,&argAllBuf[18+sendLenCharNum],cyntecGetTotalIndex()); #endif memset( msg, 0, UDP_SEND_MAX_LEN+1); - for (uint8_t i=0; i<sendLen; i++) + for (int i=0; i<sendLen; i++) msg[i] = argAllBuf[18+sendLenCharNum+i]; #ifdef DELTA_WIFI_DEBUG console.printf("msg:%s\r\n",msg);