Connecting a Multi-Tech Systems Dragonfly™ to Twilio's Sync for IoT Quickstart. Blink a dev board LED.
Dependencies: MQTT MbedJSONValue mbed mtsas
Fork of DragonflyMQTT by
Code to connect a Multi-Tech® MultiConnect® Dragonfly™ to Twilio's Sync for IoT: https://www.twilio.com/docs/api/devices
Uses MQTT over TLS and subscribes to a topic where you can control an LED. See also our Quickstart using this code, here: https://www.twilio.com/docs/quickstart/sync-iot/mqtt-multi-tech-multiconnect-dragonfly-sync-iot
MTSCellularManager.hpp@1:5a896191c3c4, 2017-05-12 (annotated)
- Committer:
- miaotwilio
- Date:
- Fri May 12 11:49:58 2017 +0000
- Revision:
- 1:5a896191c3c4
- Parent:
- 0:b32fa0c757d7
- Child:
- 2:d4dcf1ebaa99
integrated with UI
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
miaotwilio | 0:b32fa0c757d7 | 1 | #include <mbed.h> |
miaotwilio | 0:b32fa0c757d7 | 2 | #include <mtsas.h> |
miaotwilio | 0:b32fa0c757d7 | 3 | |
miaotwilio | 0:b32fa0c757d7 | 4 | class MTSCellularManager { |
miaotwilio | 0:b32fa0c757d7 | 5 | public: |
miaotwilio | 0:b32fa0c757d7 | 6 | MTSCellularManager(const char* apn_); |
miaotwilio | 0:b32fa0c757d7 | 7 | |
miaotwilio | 0:b32fa0c757d7 | 8 | ~MTSCellularManager(); |
miaotwilio | 0:b32fa0c757d7 | 9 | |
miaotwilio | 0:b32fa0c757d7 | 10 | bool init(); |
miaotwilio | 0:b32fa0c757d7 | 11 | |
miaotwilio | 0:b32fa0c757d7 | 12 | void uninit(); |
miaotwilio | 0:b32fa0c757d7 | 13 | |
miaotwilio | 1:5a896191c3c4 | 14 | struct GPSStatus { |
miaotwilio | 1:5a896191c3c4 | 15 | bool success; |
miaotwilio | 1:5a896191c3c4 | 16 | int fix; |
miaotwilio | 1:5a896191c3c4 | 17 | float speedVal; // mph |
miaotwilio | 1:5a896191c3c4 | 18 | double longitudeVal; |
miaotwilio | 1:5a896191c3c4 | 19 | double latitudeVal; |
miaotwilio | 1:5a896191c3c4 | 20 | }; |
miaotwilio | 1:5a896191c3c4 | 21 | |
miaotwilio | 1:5a896191c3c4 | 22 | void enableGps(); |
miaotwilio | 1:5a896191c3c4 | 23 | |
miaotwilio | 1:5a896191c3c4 | 24 | GPSStatus gpsPollStatus(); |
miaotwilio | 0:b32fa0c757d7 | 25 | |
miaotwilio | 0:b32fa0c757d7 | 26 | private: |
miaotwilio | 0:b32fa0c757d7 | 27 | // An APN is required for GSM radios. |
miaotwilio | 0:b32fa0c757d7 | 28 | const char* apn; |
miaotwilio | 0:b32fa0c757d7 | 29 | // The MTSSerialFlowControl object represents the physical serial link between the processor and the cellular radio. |
miaotwilio | 0:b32fa0c757d7 | 30 | mts::MTSSerialFlowControl* io; |
miaotwilio | 0:b32fa0c757d7 | 31 | // The Cellular object represents the cellular radio. |
miaotwilio | 0:b32fa0c757d7 | 32 | mts::Cellular* radio; |
miaotwilio | 0:b32fa0c757d7 | 33 | }; |