]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/net/cellular/CellularModem/CellularModem.h
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / net / cellular / CellularModem / CellularModem.h
1 /* CellularModem.h */
2 /* Copyright (C) 2013 mbed.org, MIT License
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
5  * and associated documentation files (the "Software"), to deal in the Software without restriction,
6  * including without limitation the rights to use, copy, modify, merge, publish, distribute,
7  * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
8  * furnished to do so, subject to the following conditions:
9  *
10  * The above copyright notice and this permission notice shall be included in all copies or
11  * substantial portions of the Software.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
14  * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
16  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18  */
19
20 #ifndef CELLULARMODEM_H_
21 #define CELLULARMODEM_H_
22
23 #include "core/fwk.h"
24 #include "at/ATCommandsInterface.h"
25
26 class CellularModem
27 {
28 public:
29   //Internet-related functions
30
31   /** Open a 3G internet connection
32       @return 0 on success, error code on failure
33   */
34   virtual int connect(const char* apn = NULL, const char* user = NULL, const char* password = NULL) = 0;
35
36   /** Close the internet connection
37      @return 0 on success, error code on failure
38   */
39   virtual int disconnect() = 0;
40
41
42   /** Send a SM
43      @param number The receiver's phone number
44      @param message The message to send
45      @return 0 on success, error code on failure
46    */
47   virtual int sendSM(const char* number, const char* message) = 0;
48
49
50   /** Receive a SM
51      @param number Pointer to a buffer to store the sender's phone number (must be at least 17 characters-long, including the sapce for the null-terminating char)
52      @param message Pointer to a buffer to store the the incoming message
53      @param maxLength Maximum message length that can be stored in buffer (including null-terminating character)
54      @return 0 on success, error code on failure
55    */
56   virtual int getSM(char* number, char* message, size_t maxLength) = 0;
57
58   /** Get the number of SMs in the incoming box
59      @param pCount pointer to store the number of unprocessed SMs on
60      @return 0 on success, error code on failure
61    */
62   virtual int getSMCount(size_t* pCount) = 0;
63
64   /** Get the ATCommandsInterface instance
65     @return Pointer to the ATCommandsInterface instance
66    */
67   virtual ATCommandsInterface* getATCommandsInterface() = 0;
68   
69   /** Switch power on or off
70     In order to use this function, a pin name must have been entered in the constructor
71     @param enable true to switch the dongle on, false to switch it off
72     @return 0 on success, error code on failure
73   */
74   virtual int power(bool enable) = 0;
75 };
76
77
78 #endif /* CELLULARMODEM_H_ */