PHS module SMA-01 library. see: https://developer.mbed.org/users/phsfan/notebook/abitusbmodem/
Dependencies: Socket lwip-sys lwip
Dependents: AbitUSBModem_HTTPTest AbitUSBModem_MQTTTest AbitUSBModem_WebsocketTest AbitUSBModem_SMSTest
Fork of VodafoneUSBModem by
AbitUSBModem.h
00001 /* AbitUSBModem.h */ 00002 /* Modified by 2015 phsfan 00003 * for ABIT SMA-01 00004 */ 00005 /* VodafoneUSBModem.h */ 00006 /* Copyright (C) 2012 mbed.org, MIT License 00007 * 00008 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 00009 * and associated documentation files (the "Software"), to deal in the Software without restriction, 00010 * including without limitation the rights to use, copy, modify, merge, publish, distribute, 00011 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 00012 * furnished to do so, subject to the following conditions: 00013 * 00014 * The above copyright notice and this permission notice shall be included in all copies or 00015 * substantial portions of the Software. 00016 * 00017 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 00018 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00019 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00020 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00021 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00022 */ 00023 00024 #ifndef _ABITUSBMODEM_H_ 00025 #define _ABITUSBMODEM_H_ 00026 00027 #include "core/fwk.h" 00028 00029 #include "USBHostPhs.h" 00030 #include "at/ATCommandsInterface.h" 00031 #include "serial/usb/USBSerialStream.h" 00032 #include "ip/PPPIPInterface.h" 00033 #include "sms/SMSInterface.h" 00034 00035 class AbitUSBModem { 00036 public: 00037 AbitUSBModem (); 00038 00039 /** Open a 3G internet connection 00040 @return 0 on success, error code on failure 00041 */ 00042 int connect(const char* user = NULL, const char* password = NULL); 00043 00044 /** Close the internet connection 00045 @return 0 on success, error code on failure 00046 */ 00047 int disconnect(); 00048 00049 /** Send a SM 00050 @param number The receiver's phone number 00051 @param message The message to send 00052 @return 0 on success, error code on failure 00053 */ 00054 int sendSM(const char* number, const char* message); 00055 00056 /** Receive a SM 00057 @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) 00058 @param message Pointer to a buffer to store the the incoming message 00059 @param maxLength Maximum message length that can be stored in buffer (including null-terminating character) 00060 @return 0 on success, error code on failure 00061 */ 00062 int getSM(char* number, char* message, size_t maxLength); 00063 00064 /** Get the IP address of a connected device 00065 @return A pointer to a string containing the IP address. 00066 */ 00067 char* getIPAddress(); 00068 00069 protected: 00070 int init(); 00071 00072 private: 00073 USBHostPhs m_dongle; //< Interface to USB connected WAN dongle 00074 00075 USBSerialStream m_pppStream; //< Serial interface to PPP channel on modem 00076 00077 ATCommandsInterface m_at; //< Interface to AT commands processing 00078 00079 SMSInterface m_sms; //< Interface to SMS manager (send/receive etc) 00080 00081 PPPIPInterface m_ppp; //< Interface to PPP conection manager (IP assignment etc) 00082 00083 bool m_dongleConnected; //< Is the dongle physically connected (does the USB stack respond)? true/false 00084 bool m_ipInit; //< Has PPIPInterface object (m_ppp) been initialised? true/false 00085 bool m_smsInit; //< Has SMSInterface object (m_sms) been initialised? true/false 00086 bool m_atOpen; //< Is the interface to the ATCommandsInterface open? true/false 00087 00088 }; 00089 00090 #endif
Generated on Wed Jul 13 2022 01:40:22 by 1.7.2