Includes library modifications to allow access to AIN_4 (AIN_0 / 5)

Committer:
bryantaylor
Date:
Tue Sep 20 21:26:12 2016 +0000
Revision:
0:eafc3fd41f75
hackathon

Who changed what in which revision?

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