works through pushing box to log data to google spreadsheet
Dependencies: MBed_Adafruit-GPS-Library SDFileSystem mbed
Fork of GPR_Interface by
Diff: GPRS/GPRS.cpp
- Revision:
- 10:8c55dfcc9a7c
- Parent:
- 8:180feb3ebe62
- Child:
- 11:045cb766d9a5
--- a/GPRS/GPRS.cpp Fri Jul 25 10:42:42 2014 +0000 +++ b/GPRS/GPRS.cpp Fri Sep 25 04:10:56 2015 +0000 @@ -42,7 +42,51 @@ } return checkSIMStatus(); } +// added by Noah Milam +void GPRS::start_server() +{ + sendCmdResp("AT+CGATT?\r\n"); + + sendCmdResp("AT+CIPSERVER=1,8080\r\n"); + listen_server(); +} +void GPRS::listen_server() +{ + gprs_response(); +} + +void GPRS::send_SMS(char* IPAdress) +{ + printf("sending at command\n"); + sendCmdAndWaitForResp("AT+CMGF=1\r\n","OK",DEFAULT_TIMEOUT,CMD); + wait(2); + //printf("\032\n"); + sendCmdAndWaitForResp("AT+CMGS=\"+18183977481\"\r\n",">",DEFAULT_TIMEOUT,CMD); + printf("sent at cmgf\n"); + wait(2); + //printf("032"); + sendCmd(IPAdress); // sends the address + sendCmd("\x1a"); // this is like pressing control - z to end the send command + wait(10); // giving the send enough time to do its thing + printf("should have been received"); +} +char* GPRS::read_SMS() +{ + wait(1); + sendCmd("AT+CMGF=1\r\n"); // sms mode + wait(2); + sendCmd("AT+CMGD=1\r\n"); // delete the frist message so incoming message is spot 1 + wait(1); + wait_for_sms(); + wait(10); + sendCmd("AT+CMGR=1\r\n"); + storeResp(); + char temp[30]; + return get_server_IP(); +} + +// end of what Noah Milam added bool GPRS::checkSIMStatus(void) { char gprsBuffer[32];