]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/net/cellular/CellularModem/sms/SMSInterface.h
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / net / cellular / CellularModem / sms / SMSInterface.h
1 /* SMSInterface.h */
2 /* Copyright (C) 2012 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 ISMSINTERFACE_H_
21 #define ISMSINTERFACE_H_
22
23 #include "core/fwk.h"
24
25 #include "rtos.h"
26
27 #include "at/ATCommandsInterface.h"
28
29 #define MAX_SM 8
30
31 /** Component to use the Short Messages Service (SMS)
32  *
33  */
34 class ISMSInterface
35 {
36 public:
37   /** Initialize interface
38     Configure SMS commands & register for SMS-related unsolicited result codes
39    */
40   virtual int init() = 0;
41
42
43   /** Send a SM
44      @param number The receiver's phone number
45      @param message The message to send
46      @return 0 on success, error code on failure
47    */
48   virtual int send(const char* number, const char* message) = 0;
49
50
51   /** Receive a SM
52      @param number Pointer to a buffer to store the sender's phone number (must be at least 17 characters-long, including the space for the null-terminating char)
53      @param message Pointer to a buffer to store the the incoming message
54      @param maxLength Maximum message length that can be stored in buffer (including null-terminating character)
55      @return 0 on success, error code on failure
56    */
57   virtual int get(char* number, char* message, size_t maxLength) = 0;
58
59
60   /** Get the number of SMs in the incoming box
61      @param pCount pointer to store the number of unprocessed SMs on
62      @return 0 on success, error code on failure
63    */
64   virtual int getCount(size_t* pCount) = 0;
65 };
66
67 #endif /* ISMSINTERFACE_H_ */