An Interface for SIMCOM modules.
Dependencies: ATCommand Azure_HTTPS_SIMCOM
Dependents: Azure_SIM800_HelloWorld
Fork of SIMInterface by
SIMInterface.h@0:f0ed40fee75d, 2017-08-10 (annotated)
- Committer:
- BorjaTarazona
- Date:
- Thu Aug 10 10:46:40 2017 +0000
- Revision:
- 0:f0ed40fee75d
Creation;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
BorjaTarazona | 0:f0ed40fee75d | 1 | #ifndef _SIMInterface_H |
BorjaTarazona | 0:f0ed40fee75d | 2 | #define _SIMInterface_H |
BorjaTarazona | 0:f0ed40fee75d | 3 | |
BorjaTarazona | 0:f0ed40fee75d | 4 | #include "mbed.h" |
BorjaTarazona | 0:f0ed40fee75d | 5 | #include "ATCommand.h" |
BorjaTarazona | 0:f0ed40fee75d | 6 | |
BorjaTarazona | 0:f0ed40fee75d | 7 | /** An Interface for SIMCOM modules |
BorjaTarazona | 0:f0ed40fee75d | 8 | * |
BorjaTarazona | 0:f0ed40fee75d | 9 | * @brief Currently tested on SIM900, SIM800, SIM800L and SIM800F |
BorjaTarazona | 0:f0ed40fee75d | 10 | * |
BorjaTarazona | 0:f0ed40fee75d | 11 | */ |
BorjaTarazona | 0:f0ed40fee75d | 12 | |
BorjaTarazona | 0:f0ed40fee75d | 13 | class SIMInterface |
BorjaTarazona | 0:f0ed40fee75d | 14 | { |
BorjaTarazona | 0:f0ed40fee75d | 15 | |
BorjaTarazona | 0:f0ed40fee75d | 16 | protected: |
BorjaTarazona | 0:f0ed40fee75d | 17 | /** Serial port for UART Communication |
BorjaTarazona | 0:f0ed40fee75d | 18 | **/ |
BorjaTarazona | 0:f0ed40fee75d | 19 | ATSerial sim800Interface; |
BorjaTarazona | 0:f0ed40fee75d | 20 | |
BorjaTarazona | 0:f0ed40fee75d | 21 | /** Digital pin to turn on and off |
BorjaTarazona | 0:f0ed40fee75d | 22 | **/ |
BorjaTarazona | 0:f0ed40fee75d | 23 | DigitalOut PWRKEY; |
BorjaTarazona | 0:f0ed40fee75d | 24 | |
BorjaTarazona | 0:f0ed40fee75d | 25 | public: |
BorjaTarazona | 0:f0ed40fee75d | 26 | /** Create a SIMCOM Interface |
BorjaTarazona | 0:f0ed40fee75d | 27 | * |
BorjaTarazona | 0:f0ed40fee75d | 28 | * @param tx Tx pin for the UART, rx RX pin for the UART, baudrate Baudrate for the UART, pwr PWRKEY pin of the SIM module |
BorjaTarazona | 0:f0ed40fee75d | 29 | * |
BorjaTarazona | 0:f0ed40fee75d | 30 | **/ |
BorjaTarazona | 0:f0ed40fee75d | 31 | SIMInterface(PinName tx, PinName rx, int baudrate, PinName pwr); |
BorjaTarazona | 0:f0ed40fee75d | 32 | |
BorjaTarazona | 0:f0ed40fee75d | 33 | /** Function to wake up the SIM module |
BorjaTarazona | 0:f0ed40fee75d | 34 | **/ |
BorjaTarazona | 0:f0ed40fee75d | 35 | void wakeUp(); |
BorjaTarazona | 0:f0ed40fee75d | 36 | |
BorjaTarazona | 0:f0ed40fee75d | 37 | /** Function to reset the module |
BorjaTarazona | 0:f0ed40fee75d | 38 | **/ |
BorjaTarazona | 0:f0ed40fee75d | 39 | void reset(); |
BorjaTarazona | 0:f0ed40fee75d | 40 | |
BorjaTarazona | 0:f0ed40fee75d | 41 | /** Function to set the date on the module |
BorjaTarazona | 0:f0ed40fee75d | 42 | * |
BorjaTarazona | 0:f0ed40fee75d | 43 | * @param Date is a char in the format "17/08/10,10:27:00+00" |
BorjaTarazona | 0:f0ed40fee75d | 44 | * |
BorjaTarazona | 0:f0ed40fee75d | 45 | **/ |
BorjaTarazona | 0:f0ed40fee75d | 46 | void setDateRTC(char* Date); |
BorjaTarazona | 0:f0ed40fee75d | 47 | |
BorjaTarazona | 0:f0ed40fee75d | 48 | /** Function to get the date from the module |
BorjaTarazona | 0:f0ed40fee75d | 49 | **/ |
BorjaTarazona | 0:f0ed40fee75d | 50 | char* getDateRTC(); |
BorjaTarazona | 0:f0ed40fee75d | 51 | |
BorjaTarazona | 0:f0ed40fee75d | 52 | /** Function to turn the module off |
BorjaTarazona | 0:f0ed40fee75d | 53 | **/ |
BorjaTarazona | 0:f0ed40fee75d | 54 | void turnOff(); |
BorjaTarazona | 0:f0ed40fee75d | 55 | |
BorjaTarazona | 0:f0ed40fee75d | 56 | /** Function to check if the module is on |
BorjaTarazona | 0:f0ed40fee75d | 57 | * |
BorjaTarazona | 0:f0ed40fee75d | 58 | * @param timeout is the time in ms that we will wait for the module to answer |
BorjaTarazona | 0:f0ed40fee75d | 59 | * |
BorjaTarazona | 0:f0ed40fee75d | 60 | **/ |
BorjaTarazona | 0:f0ed40fee75d | 61 | int SIMOnOff(int timeout); |
BorjaTarazona | 0:f0ed40fee75d | 62 | |
BorjaTarazona | 0:f0ed40fee75d | 63 | private: |
BorjaTarazona | 0:f0ed40fee75d | 64 | }; |
BorjaTarazona | 0:f0ed40fee75d | 65 | |
BorjaTarazona | 0:f0ed40fee75d | 66 | #endif |
BorjaTarazona | 0:f0ed40fee75d | 67 |