GSM library for nucleo L152RE
Dependencies: Adafruit_GSM
GSM_Wrapper.h@3:922cf54e97ec, 2015-12-07 (annotated)
- Committer:
- ptcrews
- Date:
- Mon Dec 07 00:05:29 2015 +0000
- Revision:
- 3:922cf54e97ec
- Parent:
- 1:9e13d8a84808
Added comments.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ptcrews | 1:9e13d8a84808 | 1 | #include "Adafruit_FONA.h" |
ptcrews | 1:9e13d8a84808 | 2 | #include "main.h" |
ptcrews | 3:922cf54e97ec | 3 | #include "storage.h" |
ptcrews | 3:922cf54e97ec | 4 | |
ptcrews | 3:922cf54e97ec | 5 | #define FONA_BAUD_RATE 9600 // FONA baud rate |
ptcrews | 3:922cf54e97ec | 6 | #define ENABLE_GPRS_ATTEMPTS 5 // Number of attempts to enable GPRS if it fails |
ptcrews | 1:9e13d8a84808 | 7 | |
ptcrews | 1:9e13d8a84808 | 8 | #ifndef _GSM_WRAPPER_CLASS |
ptcrews | 1:9e13d8a84808 | 9 | #define _GSM_WRAPPER_CLASS |
ptcrews | 1:9e13d8a84808 | 10 | |
ptcrews | 3:922cf54e97ec | 11 | /* Class: GSM_Sensor |
ptcrews | 3:922cf54e97ec | 12 | * ----------------- |
ptcrews | 3:922cf54e97ec | 13 | * A "wrapper" class for the GSM library, abstracting |
ptcrews | 3:922cf54e97ec | 14 | * the Adafruit GSM library for use in this project. |
ptcrews | 3:922cf54e97ec | 15 | */ |
ptcrews | 1:9e13d8a84808 | 16 | class GSM_Sensor { |
ptcrews | 1:9e13d8a84808 | 17 | public: |
ptcrews | 1:9e13d8a84808 | 18 | GSM_Sensor(): fona(FONA_TX, FONA_RX, FONA_RST, FONA_RI), key(FONA_KEY) {} |
ptcrews | 1:9e13d8a84808 | 19 | void changePowerState(); |
ptcrews | 1:9e13d8a84808 | 20 | void setup(); |
ptcrews | 1:9e13d8a84808 | 21 | bool send(uint8_t* data, size_t size); |
ptcrews | 1:9e13d8a84808 | 22 | private: |
ptcrews | 1:9e13d8a84808 | 23 | bool sendOverHTTP(char* url, uint8_t* data, int dlength); |
ptcrews | 1:9e13d8a84808 | 24 | Adafruit_FONA fona; |
ptcrews | 1:9e13d8a84808 | 25 | DigitalOut key; |
ptcrews | 1:9e13d8a84808 | 26 | }; |
ptcrews | 1:9e13d8a84808 | 27 | |
ptcrews | 1:9e13d8a84808 | 28 | #endif |