Base library for cellular modem implementations

Dependencies:   Socket lwip-sys lwip

Dependents:   CellularUSBModem CellularUSBModem

Deprecated

This is an mbed 2 networking library. For mbed 5, the networking libraries have been revised to better support additional network stacks and thread safety here.

Committer:
mbed_official
Date:
Thu May 08 11:00:26 2014 +0100
Revision:
8:944cd194963e
Parent:
3:317b007abdec
Synchronized with git revision df12bf01ac7dbb50751e2b16a351c894994e1dcf

Full URL: https://github.com/mbedmicro/mbed/commit/df12bf01ac7dbb50751e2b16a351c894994e1dcf/

Who changed what in which revision?

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