Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: aconno_I2C Lis2dh12 WatchdogTimer
modem.h@42:f482f4cdb319, 2019-01-18 (annotated)
- Committer:
- pathfindr
- Date:
- Fri Jan 18 00:07:45 2019 +0000
- Revision:
- 42:f482f4cdb319
- Parent:
- 40:4270e09e59f2
- Child:
- 48:64b1613941d5
state engine fix
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| pathfindr | 7:e9a19750700d | 1 | #ifndef MODEM_H |
| pathfindr | 7:e9a19750700d | 2 | #define MODEM_H |
| pathfindr | 7:e9a19750700d | 3 | |
| pathfindr | 7:e9a19750700d | 4 | #include "main.h" |
| pathfindr | 7:e9a19750700d | 5 | |
| pathfindr | 7:e9a19750700d | 6 | namespace mbed { |
| pathfindr | 7:e9a19750700d | 7 | |
| pathfindr | 7:e9a19750700d | 8 | #define UC20_BAUDRATE 115200 |
| pathfindr | 7:e9a19750700d | 9 | #define SIM7600_BAUDRATE 115200 |
| pathfindr | 16:3bf5f1a5f869 | 10 | #define USSD_MAXLENGTH 160 |
| pathfindr | 42:f482f4cdb319 | 11 | #define ATTIMEOUT_VERYSHORT 3000 |
| pathfindr | 34:4493c9f6d707 | 12 | #define ATTIMEOUT_SHORT 5000 |
| pathfindr | 22:810425eb76e1 | 13 | #define ATTIMEOUT_MED 10000 |
| pathfindr | 22:810425eb76e1 | 14 | #define ATTIMEOUT_LONG 20000 |
| pathfindr | 7:e9a19750700d | 15 | |
| pathfindr | 7:e9a19750700d | 16 | class Modem |
| pathfindr | 7:e9a19750700d | 17 | { |
| pathfindr | 7:e9a19750700d | 18 | public: |
| pathfindr | 34:4493c9f6d707 | 19 | Modem(PinName pwrkey, PinName vreg_en, PinName w_disable); |
| pathfindr | 7:e9a19750700d | 20 | ~Modem(); |
| pathfindr | 7:e9a19750700d | 21 | |
| pathfindr | 7:e9a19750700d | 22 | //control |
| pathfindr | 38:476a9b5629a1 | 23 | bool on(bool force2G); |
| pathfindr | 7:e9a19750700d | 24 | void off(bool soft); |
| pathfindr | 12:8345612bf867 | 25 | |
| pathfindr | 12:8345612bf867 | 26 | //funcs |
| pathfindr | 12:8345612bf867 | 27 | bool registerOnNetwork(int maxAttempts, uint32_t timeout); |
| pathfindr | 12:8345612bf867 | 28 | bool USSDsend(char* message, int maxAttempts); |
| pathfindr | 14:9a54b1b65bc8 | 29 | char* USSDreceive(int messageIndex); |
| pathfindr | 15:7aad9a7f970c | 30 | char* USSDmessage(char* message, bool needResponse, int maxAttempts, char* api); |
| pathfindr | 22:810425eb76e1 | 31 | char* getLocation(uint8_t accuracy, uint16_t timeout_seconds); //accuracy is 1,2,3 low, med, high |
| pathfindr | 23:a3b0ccf75ca5 | 32 | long long getIMEI(void); |
| pathfindr | 23:a3b0ccf75ca5 | 33 | char* getModemModel(void); |
| pathfindr | 7:e9a19750700d | 34 | |
| pathfindr | 12:8345612bf867 | 35 | //AT |
| pathfindr | 7:e9a19750700d | 36 | void ATsendCMD(char* cmd); |
| pathfindr | 12:8345612bf867 | 37 | bool ATwaitForWord(char* word, uint32_t timeout); |
| pathfindr | 34:4493c9f6d707 | 38 | bool ATgetResponse(char terminator, uint32_t timeout); |
| pathfindr | 7:e9a19750700d | 39 | private: |
| pathfindr | 34:4493c9f6d707 | 40 | |
| pathfindr | 7:e9a19750700d | 41 | |
| pathfindr | 7:e9a19750700d | 42 | protected: |
| pathfindr | 7:e9a19750700d | 43 | DigitalOut _pwrkey; |
| pathfindr | 7:e9a19750700d | 44 | DigitalOut _vreg_en; |
| pathfindr | 21:e0b866630c27 | 45 | DigitalOut _w_disable; |
| pathfindr | 7:e9a19750700d | 46 | }; |
| pathfindr | 7:e9a19750700d | 47 | |
| pathfindr | 7:e9a19750700d | 48 | } //Namespace |
| pathfindr | 7:e9a19750700d | 49 | #endif |