uses pushing box to publish to google spreadsheets with a state machine instead of a while loop
Fork of GSM_PUSHING_BOX_STATE_MACHINE by
Diff: gsmqueue.h
- Revision:
- 24:7d2ff444d6d8
- Parent:
- 23:5227fb014aad
diff -r 5227fb014aad -r 7d2ff444d6d8 gsmqueue.h --- a/gsmqueue.h Tue Mar 24 18:39:13 2015 +0000 +++ b/gsmqueue.h Sat Apr 11 23:21:46 2015 +0000 @@ -1,43 +1,54 @@ #ifndef GSMQUEUE_H #define GSMQUEUE_H -/* gsmqueue.cpp +/* gsmqueue.h * Contains functions to read from the DMA buffer in a queue fashion */ //Memory block of char size alocated for DMA -#define BUFFER_LENGTH 1000//cannot exeede an int max value - +#define BUFFER_LENGTH 2000 +#define MAX_SMS_LENGTH 700 //Absolute SMS length max = 900 (let's do 700 to be safe) #define QUEUETAIL (char*)DMA_TCD0_DADDR +//Public functions ------------------------------------------------------------------------------ //Initialize variables void queueInit(); -//Find an occurrence of the given string in the buffer. -//Only advance queueHead until a matching string is found. -bool findInQueue(char* str); +//Send gsm a command +void sendCommand(char* sPtr); + +//Return 1 if queue has data and the GSM is done transmitting its response +bool queueHasResponse(); -//Increment queue index by 1, auxiliar function -char* incrementIndex(char* pointerToIncrement); +//Find an occurrence of the given string in the buffer. +//If advanceQueueHead is true, advance queueHead just until a matching string is found. +bool findInQueue(char* str, bool advanceQueueHead); -//will eliminate all elements form queue. -void flushQueue(); +//Parse through characters until first integer is found +int parseInt(); //Print queue elements void printQueue(); //for debugging -//Parse through characters until first integer is found -int parseInt(); + +//Internal functions ------------------------------------------------------------------------------ +//Get the GSM DMA idle bit (if 1, indicates we aren't in the process of receiving a response) +bool getGSMIdleBit(); //Returns true if the character is numeric bool isNumeric(char* qPos); -//Reset the GSM DMA idle bit to 0 -void resetGSMIdleBit(); +//Increment queue position by 1 (Note: this function is only used by gsmqueue.cpp) +char* incrementIndex(char* pointerToIncrement); + +//Increment queue position by n (Note: this function is only used by gsmqueue.cpp) +char* incrementIndex(char* pointerToIncrement, int n); -//Get the GSM DMA idle bit (if 1, indicates we already received a response) -bool getGSMIdleBit(); +//Get size of the queue from reference point of tail parameter +int queueSize(char* tail); +//Clear queue (Note: this function is only used by gsmqueue.cpp) +void flushQueue(); #endif \ No newline at end of file