uses pushing box to publish to google spreadsheets with a state machine instead of a while loop

Dependents:   DCS_FINAL_CODE

Fork of GSM_PUSHING_BOX_STATE_MACHINE by DCS_TEAM

Revision:
24:7d2ff444d6d8
Parent:
23:5227fb014aad
Child:
29:bc5f53f2922a
--- a/GSMLibrary.h	Tue Mar 24 18:39:13 2015 +0000
+++ b/GSMLibrary.h	Sat Apr 11 23:21:46 2015 +0000
@@ -2,22 +2,28 @@
 #define GSMLIBRARY_H
 
 #include "mbed.h"
-#define MAX_MSG_SIZE 1000
+
+#define TIME_CONST 1
+#define SECONDS_TIMEOUT 30
+#define SMS_END_CHAR "\x1A"
+#define SMS_ESCAPE_CHAR "\x1A"
 
 enum gsm_states{GSM_INITIALIZE, 
                     GSM_AT_OK,      //Make sure communication is stablished betheen fdm and gsm
                     GSM_AT_CSQ,     //Check signal strength if strenght lower than 10 keep trying
                     GSM_AT_CREG,    //Checking if phone is conected to network
+                    GSM_AT_CNMI,    //Turn off incoming SMS notifications
                     GSM_AT_CMGF,    //prepare phone to send message by CMGF=1
+                    GSM_READ_MSG,   //check for a new message. if so will set transmitter mode on.
                     GSM_AT_CMGS,    //input phone number by CMGS= "+phonenumber"
                     GSM_AT_SENDSMS, //write message, finish with alt+z
-                    GSM_SUCCESS     //check if message was send correctly
+                    GSM_DEL_R_MSGS //delete unread messages (if present)   
                 };
 
-
 //GSM state machine
 void gsm_tick();
 bool gsm_timeOut();
+void gsm_printState();
 void gsm_nextStateLogic();
 void gsm_mealyOutputs();
 
@@ -27,12 +33,12 @@
 //returns 1 for eady to send again, 0 for busy.
 bool gsm_ready();
 
-//begin message transmission
-void gsm_send_sms(char message[]);
+//Have the GSM send data - L = long, S = short, hh/mm/ss for time, "lat ns" for latitute, "lon we" for longitude
+void gsm_send_data(float L, float Lref, float S, float Sref, int hh, int mm, int ss, float lat, char ns, float lon, char we);
 
 //Brings state machine back to initialize state (notice this is different than initialize function)
 //this will set flags to initial values and prepare gsm to work anew.
-void reset();
+void gsm_reset();
 
 //used for debuging purposes, it print all main registers from dma0 and uart3
 void print_registers();