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
gsmqueue.h@24:7d2ff444d6d8, 2015-04-11 (annotated)
- Committer:
- es_marble
- Date:
- Sat Apr 11 23:21:46 2015 +0000
- Revision:
- 24:7d2ff444d6d8
- Parent:
- 23:5227fb014aad
added final GSM_Library code
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
danilob | 0:41904adca656 | 1 | #ifndef GSMQUEUE_H |
danilob | 0:41904adca656 | 2 | #define GSMQUEUE_H |
danilob | 0:41904adca656 | 3 | |
es_marble | 24:7d2ff444d6d8 | 4 | /* gsmqueue.h |
danilob | 0:41904adca656 | 5 | * Contains functions to read from the DMA buffer in a queue fashion |
danilob | 0:41904adca656 | 6 | */ |
danilob | 0:41904adca656 | 7 | |
danilob | 0:41904adca656 | 8 | //Memory block of char size alocated for DMA |
es_marble | 24:7d2ff444d6d8 | 9 | #define BUFFER_LENGTH 2000 |
es_marble | 24:7d2ff444d6d8 | 10 | #define MAX_SMS_LENGTH 700 //Absolute SMS length max = 900 (let's do 700 to be safe) |
danilob | 0:41904adca656 | 11 | #define QUEUETAIL (char*)DMA_TCD0_DADDR |
danilob | 0:41904adca656 | 12 | |
danilob | 0:41904adca656 | 13 | |
es_marble | 24:7d2ff444d6d8 | 14 | //Public functions ------------------------------------------------------------------------------ |
danilob | 0:41904adca656 | 15 | //Initialize variables |
danilob | 0:41904adca656 | 16 | void queueInit(); |
danilob | 0:41904adca656 | 17 | |
es_marble | 24:7d2ff444d6d8 | 18 | //Send gsm a command |
es_marble | 24:7d2ff444d6d8 | 19 | void sendCommand(char* sPtr); |
es_marble | 24:7d2ff444d6d8 | 20 | |
es_marble | 24:7d2ff444d6d8 | 21 | //Return 1 if queue has data and the GSM is done transmitting its response |
es_marble | 24:7d2ff444d6d8 | 22 | bool queueHasResponse(); |
danilob | 0:41904adca656 | 23 | |
es_marble | 24:7d2ff444d6d8 | 24 | //Find an occurrence of the given string in the buffer. |
es_marble | 24:7d2ff444d6d8 | 25 | //If advanceQueueHead is true, advance queueHead just until a matching string is found. |
es_marble | 24:7d2ff444d6d8 | 26 | bool findInQueue(char* str, bool advanceQueueHead); |
danilob | 0:41904adca656 | 27 | |
es_marble | 24:7d2ff444d6d8 | 28 | //Parse through characters until first integer is found |
es_marble | 24:7d2ff444d6d8 | 29 | int parseInt(); |
danilob | 0:41904adca656 | 30 | |
danilob | 0:41904adca656 | 31 | //Print queue elements |
danilob | 0:41904adca656 | 32 | void printQueue(); //for debugging |
danilob | 0:41904adca656 | 33 | |
es_marble | 24:7d2ff444d6d8 | 34 | |
es_marble | 24:7d2ff444d6d8 | 35 | //Internal functions ------------------------------------------------------------------------------ |
es_marble | 24:7d2ff444d6d8 | 36 | //Get the GSM DMA idle bit (if 1, indicates we aren't in the process of receiving a response) |
es_marble | 24:7d2ff444d6d8 | 37 | bool getGSMIdleBit(); |
danilob | 0:41904adca656 | 38 | |
es_marble | 3:dac922a18af6 | 39 | //Returns true if the character is numeric |
es_marble | 3:dac922a18af6 | 40 | bool isNumeric(char* qPos); |
es_marble | 3:dac922a18af6 | 41 | |
es_marble | 24:7d2ff444d6d8 | 42 | //Increment queue position by 1 (Note: this function is only used by gsmqueue.cpp) |
es_marble | 24:7d2ff444d6d8 | 43 | char* incrementIndex(char* pointerToIncrement); |
es_marble | 24:7d2ff444d6d8 | 44 | |
es_marble | 24:7d2ff444d6d8 | 45 | //Increment queue position by n (Note: this function is only used by gsmqueue.cpp) |
es_marble | 24:7d2ff444d6d8 | 46 | char* incrementIndex(char* pointerToIncrement, int n); |
es_marble | 1:c1458b739eb6 | 47 | |
es_marble | 24:7d2ff444d6d8 | 48 | //Get size of the queue from reference point of tail parameter |
es_marble | 24:7d2ff444d6d8 | 49 | int queueSize(char* tail); |
es_marble | 1:c1458b739eb6 | 50 | |
es_marble | 24:7d2ff444d6d8 | 51 | //Clear queue (Note: this function is only used by gsmqueue.cpp) |
es_marble | 24:7d2ff444d6d8 | 52 | void flushQueue(); |
danilob | 2:8352ad91f2ee | 53 | |
danilob | 0:41904adca656 | 54 | #endif |