u-blox USB modems (GSM and CDMA)
Dependencies: CellularUSBModem
Dependents: C027_CANInterfaceComm C027_ModemTransparentUSBCDC_revb UbloxModemHTTPClientTest C027_HTTPClientTest ... more
UbloxUSBCDMAModem.h
00001 /* UbloxUSBCDMAModem.h */ 00002 /* Copyright (C) 2012 mbed.org, MIT License 00003 * 00004 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 00005 * and associated documentation files (the "Software"), to deal in the Software without restriction, 00006 * including without limitation the rights to use, copy, modify, merge, publish, distribute, 00007 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 00008 * furnished to do so, subject to the following conditions: 00009 * 00010 * The above copyright notice and this permission notice shall be included in all copies or 00011 * substantial portions of the Software. 00012 * 00013 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 00014 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00015 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00016 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00017 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00018 */ 00019 00020 #ifndef UBLOXUSBCDMAMODEM_H_ 00021 #define UBLOXUSBCDMAMODEM_H_ 00022 00023 #include "core/fwk.h" 00024 00025 #include "WANDongle.h" 00026 #include "at/ATCommandsInterface.h" 00027 #include "USBSerialStream.h" 00028 #include "ip/PPPIPInterface.h" 00029 #include "sms/CDMASMSInterface.h" 00030 #include "CellularModem.h" 00031 00032 /** u-blox LISA-C200 modem 00033 */ 00034 class UbloxUSBCDMAModem: public CellularModem 00035 { 00036 public: 00037 /** Create Sprint USB Modem (Sierra Wireless 598U) API instance 00038 @param powerGatingPin Optional pin commanding a power gating transistor on the modem's power line 00039 @param powerGatingOnWhenPinHigh true if the pin needs to be high to power the dongle, defaults to true 00040 */ 00041 UbloxUSBCDMAModem(PinName powerGatingPin = NC, bool powerGatingOnWhenPinHigh = true, int serial = 0); 00042 00043 //Internet-related functions 00044 00045 /** Open a 3G internet connection 00046 @return 0 on success, error code on failure 00047 */ 00048 virtual int connect(const char* apn = NULL, const char* user = NULL, const char* password = NULL); 00049 00050 /** Close the internet connection 00051 @return 0 on success, error code on failure 00052 */ 00053 virtual int disconnect(); 00054 00055 00056 /** Send a SM 00057 @param number The receiver's phone number 00058 @param message The message to send 00059 @return 0 on success, error code on failure 00060 */ 00061 virtual int sendSM(const char* number, const char* message); 00062 00063 00064 /** Receive a SM 00065 @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) 00066 @param message Pointer to a buffer to store the the incoming message 00067 @param maxLength Maximum message length that can be stored in buffer (including null-terminating character) 00068 @return 0 on success, error code on failure 00069 */ 00070 virtual int getSM(char* number, char* message, size_t maxLength); 00071 00072 /** Get the number of SMs in the incoming box 00073 @param pCount pointer to store the number of unprocessed SMs on 00074 @return 0 on success, error code on failure 00075 */ 00076 virtual int getSMCount(size_t* pCount); 00077 00078 /** Get the ATCommandsInterface instance 00079 @return Pointer to the ATCommandsInterface instance 00080 */ 00081 virtual ATCommandsInterface* getATCommandsInterface(); 00082 00083 /** Switch power on or off 00084 In order to use this function, a pin name must have been entered in the constructor 00085 @param enable true to switch the dongle on, false to switch it off 00086 @return 0 on success, error code on failure 00087 */ 00088 virtual int power(bool enable); 00089 00090 protected: 00091 bool power(); 00092 00093 int init(); 00094 int cleanup(); 00095 00096 private: 00097 WANDongle m_dongle; 00098 00099 USBSerialStream m_stream; 00100 00101 ATCommandsInterface m_at; 00102 00103 CDMASMSInterface m_sms; 00104 00105 PPPIPInterface m_ppp; 00106 00107 bool m_dongleConnected; 00108 bool m_ipInit; 00109 bool m_smsInit; 00110 bool m_atOpen; 00111 00112 PinName m_powerGatingPin; 00113 bool m_powerGatingOnWhenPinHigh; 00114 }; 00115 00116 00117 #endif /* UBLOXUSBCDMAMODEM_H_ */ 00118
Generated on Tue Jul 12 2022 19:17:01 by 1.7.2