Andrew Boyson
/
iot
Backing up an unused program in case of future need
Diff: at.cpp
- Revision:
- 6:be97d38e0b01
- Parent:
- 4:e076884ef8bd
--- a/at.cpp Wed May 11 16:42:35 2016 +0000 +++ b/at.cpp Tue May 31 07:35:28 2016 +0000 @@ -18,9 +18,6 @@ #define WAIT_FOR_SEND_OK 7 static int wait_for; -#define RESP_LENGTH 256 -static char resp[RESP_LENGTH]; - static int * pFeedback; static void startCommand(int* pStatus, int waitfor) { @@ -45,12 +42,12 @@ void AtConnect(const char *ssid, const char *password, int *pStatus) { startCommand(pStatus, WAIT_FOR_OK); - EspSendStringF(resp, RESP_LENGTH, "AT+CWJAP=\"%s\",\"%s\"\r\n", ssid, password); + EspSendCommandF("AT+CWJAP=\"%s\",\"%s\"\r\n", ssid, password); } void AtAt(int *pStatus) { startCommand(pStatus, WAIT_FOR_OK); - EspSendString(resp, RESP_LENGTH, "AT\r\n"); + EspSendCommand("AT\r\n"); } void AtConnectId(int id, char * type, char * addr, int port, void * buffer, int bufferlength, int *pStatus) @@ -60,34 +57,34 @@ EspIpdBuffer[id] = buffer; EspIpdBufferLen[id] = bufferlength; - EspSendStringF(resp, RESP_LENGTH, "AT+CIPSTART=%d,\"%s\",\"%s\",%d\r\n", id, type, addr, port); + EspSendCommandF("AT+CIPSTART=%d,\"%s\",\"%s\",%d\r\n", id, type, addr, port); } void AtStartServer(int port, int *pStatus) { startCommand(pStatus, WAIT_FOR_OK); - EspSendStringF(resp, RESP_LENGTH, "AT+CIPSERVER=1,%d\r\n", port); + EspSendCommandF("AT+CIPSERVER=1,%d\r\n", port); } void AtClose(int id, int *pStatus) { startCommand(pStatus, WAIT_FOR_OK); - EspSendStringF(resp, RESP_LENGTH, "AT+CIPCLOSE=%d\r\n", id); + EspSendCommandF("AT+CIPCLOSE=%d\r\n", id); } void AtMux(int *pStatus) { startCommand(pStatus, WAIT_FOR_OK); - EspSendString(resp, RESP_LENGTH, "AT+CIPMUX=1\r\n"); + EspSendCommand("AT+CIPMUX=1\r\n"); } void AtBaud(int baud, int *pStatus) { startCommand(pStatus, WAIT_FOR_OK); - EspSendStringF(resp, RESP_LENGTH, "AT+CIOBAUD=%d\r\n", baud); + EspSendCommandF("AT+CIOBAUD=%d\r\n", baud); } int AtEspStatus; void AtGetEspStatus(int *pStatus) { AtEspStatus = 0; startCommand(pStatus, WAIT_FOR_STATUS); - EspSendString(resp, RESP_LENGTH, "AT+CIPSTATUS\r\n"); + EspSendCommand("AT+CIPSTATUS\r\n"); } char AtEspVersion[20]; static int versionlinecount; @@ -95,7 +92,7 @@ { AtEspVersion[0] = '\0'; startCommand(pStatus, WAIT_FOR_VERSION); - EspSendString(resp, RESP_LENGTH, "AT+GMR\r\n"); + EspSendCommand("AT+GMR\r\n"); versionlinecount = 0; } void AtSendData(int id, int length, const void * pdata, int *pStatus) @@ -103,7 +100,7 @@ startCommand(pStatus, WAIT_FOR_SEND_OK); EspLengthToSend = length; EspDataToSend = pdata; - EspSendStringF(resp, RESP_LENGTH, "AT+CIPSEND=%d,%d\r\n", id, length); + EspSendCommandF("AT+CIPSEND=%d,%d\r\n", id, length); } int AtBusy()