ok

Revision:
11:c93524a12e92
Parent:
10:24671d8aa0c9
Child:
12:d7269702ee7d
--- a/GSM.h	Tue May 13 14:43:57 2014 +0000
+++ b/GSM.h	Sat Oct 03 14:43:26 2020 +0000
@@ -36,7 +36,6 @@
     MESSAGE_ERROR
 };
 
-
 /** GSM class.
  *  Used for mobile communication. attention that GSM module communicate with MCU in serial protocol
  */
@@ -49,12 +48,42 @@
      *  @param baudRate baud rate of uart communication
      *  @param number default phone number during mobile communication
      */
-    GSM(PinName tx, PinName rx, int baudRate,char *number) : gprsSerial(tx, rx) {
+    GSM(PinName tx, PinName rx, int baudRate, char *number, PinName PWK_pin = NC, PinName Status_pin = NC, PinName Sonnette_pin = NC) : PWK(PWK_pin), Status(Status_pin), Sonnette(Sonnette_pin), gprsSerial(tx, rx) {
         //gprsSerial.baud(baudRate);
         phoneNumber = number;
+       //_reset(reset)
     };
     
+     /** Unlock the SIM card
+      *  @param PIN     PIN code to unlock the SIM card
+      *  @returns
+      *      0 on success,
+      *      -1 on error
+      */
+    int unlock(char *PIN);
+
+    /** Power the GSM module
+     *      @returns
+     *          0 on success
+     *          -1 on error
+     *
+     */
+    int powerOn(void);
+    
+    /** Turn the GSM module off
+     *      @returns
+     *          0 on success
+     *          -1 on error
+     */
+    int powerOff(void);
+    
+    /** Check via an AT command if the module is turned on
+     *      @returns
+     *          0 : module is on
+     *          -1 : the module is off
+     */
     int powerCheck(void);
+    
     /** init GSM module including SIM card check & signal strength & network check
      *  @returns
      *      0 on success,
@@ -62,7 +91,7 @@
      */
     int init(void);
 
-    /** Check SIM card' Status
+    /** Check SIM card's Status
      *  @returns
      *      0 on success,
      *      -1 on error
@@ -136,14 +165,14 @@
      *      -1 on error
      */
     int loopHandle(void);
-
+    
     /** GSM network init
      *  @param *apn Access  Point Name to connect network
      *  @param *userName    general is empty
      *  @param *passWord    general is empty
      */
-
     int networkInit(char* apn, char* userName = NULL, char* passWord = NULL);
+    
     /** Build TCP connect
      *  @param  *ip    ip address which will connect to
      *  @param  *port   TCP server' port number
@@ -175,6 +204,10 @@
      */
     int shutTCP(void);
 
+
+    DigitalOut PWK;
+    DigitalIn Status;
+    InterruptIn Sonnette;
     Serial gprsSerial;
     //USBSerial pc;
 
@@ -200,7 +233,7 @@
      *      0 on success,
      *      -1 on error
      */
-    int waitForResp(char *resp, int timeout);
+    int waitForResp(char *resp, int timeout = DEFAULT_TIMEOUT);
 
     /** Send AT command to GSM module and wait for correct response
      *  @param  *cmd    AT command which will be send to GSM module
@@ -210,7 +243,7 @@
      *      0 on success,
      *      -1 on error
      */
-    int sendCmdAndWaitForResp(char *cmd, char *resp, int timeout);
+    int sendCmdAndWaitForResp(char *cmd, char *resp, int timeout = DEFAULT_TIMEOUT);
 
     Timer timeCnt;
     char *phoneNumber;