Test

Committer:
JohnnyK
Date:
Fri Apr 08 22:00:00 2022 +0000
Revision:
8:f5e79684b53c
sample library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JohnnyK 8:f5e79684b53c 1 #ifndef A9G_H
JohnnyK 8:f5e79684b53c 2 #define A9G_H
JohnnyK 8:f5e79684b53c 3 #define DEBUG 1
JohnnyK 8:f5e79684b53c 4 #include <stdio.h>
JohnnyK 8:f5e79684b53c 5 #include "mbed.h"
JohnnyK 8:f5e79684b53c 6
JohnnyK 8:f5e79684b53c 7 #define DEFAULT_TIMEOUT 5
JohnnyK 8:f5e79684b53c 8 #define SMS_MAX_LENGTH 16
JohnnyK 8:f5e79684b53c 9
JohnnyK 8:f5e79684b53c 10 class A9G
JohnnyK 8:f5e79684b53c 11 {
JohnnyK 8:f5e79684b53c 12 public:
JohnnyK 8:f5e79684b53c 13 /** Create GSM instance
JohnnyK 8:f5e79684b53c 14 * @param tx uart transmit pin to communicate with GSM module
JohnnyK 8:f5e79684b53c 15 * @param rx uart receive pin to communicate with GSM module
JohnnyK 8:f5e79684b53c 16 * @param atDebug enable/disable debug output of ATCmdParser - default false
JohnnyK 8:f5e79684b53c 17 * @param baudRate baud rate of uart communication - default 115200
JohnnyK 8:f5e79684b53c 18 */
JohnnyK 8:f5e79684b53c 19 A9G(PinName tx, PinName rx, bool atDebug = false, int baudRate = 115200) ;
JohnnyK 8:f5e79684b53c 20
JohnnyK 8:f5e79684b53c 21 /** It Initializes/establish communication with module, unlock Sim card if it is necessary and wait for Network connection
JohnnyK 8:f5e79684b53c 22 * @param simPin Pin code of Sim card for its unlocking if it necessary
JohnnyK 8:f5e79684b53c 23 * @returns
JohnnyK 8:f5e79684b53c 24 * true on success,
JohnnyK 8:f5e79684b53c 25 * false on error
JohnnyK 8:f5e79684b53c 26 */
JohnnyK 8:f5e79684b53c 27 bool init(int simPin = 0);
JohnnyK 8:f5e79684b53c 28
JohnnyK 8:f5e79684b53c 29 /** It set text mode and send specific text to specific phone number
JohnnyK 8:f5e79684b53c 30 * @param *number phone number as destination of SMS
JohnnyK 8:f5e79684b53c 31 * @returns *text text to be send via SMS
JohnnyK 8:f5e79684b53c 32 * true on success,
JohnnyK 8:f5e79684b53c 33 * false on error
JohnnyK 8:f5e79684b53c 34 */
JohnnyK 8:f5e79684b53c 35 bool sendSMS(const char *number, const char *text);
JohnnyK 8:f5e79684b53c 36 private:
JohnnyK 8:f5e79684b53c 37 BufferedSerial _uart;
JohnnyK 8:f5e79684b53c 38 ATCmdParser _module;
JohnnyK 8:f5e79684b53c 39 };
JohnnyK 8:f5e79684b53c 40 #endif