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 mbed official

/media/uploads/phsfan/sma01_003.png

Committer:
phsfan
Date:
Wed Feb 18 09:40:07 2015 +0000
Revision:
96:b50f5f795684
Child:
97:7d9cc95e2ea7
1st build.; ABIT SMA-01

Who changed what in which revision?

UserRevisionLine numberNew contents of line
phsfan 96:b50f5f795684 1 /* AbitUSBModem.h
phsfan 96:b50f5f795684 2 * modifyed by Suga
phsfan 96:b50f5f795684 3 */
phsfan 96:b50f5f795684 4 /* VodafoneUSBModem.h */
phsfan 96:b50f5f795684 5 /* Copyright (C) 2012 mbed.org, MIT License
phsfan 96:b50f5f795684 6 *
phsfan 96:b50f5f795684 7 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
phsfan 96:b50f5f795684 8 * and associated documentation files (the "Software"), to deal in the Software without restriction,
phsfan 96:b50f5f795684 9 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
phsfan 96:b50f5f795684 10 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
phsfan 96:b50f5f795684 11 * furnished to do so, subject to the following conditions:
phsfan 96:b50f5f795684 12 *
phsfan 96:b50f5f795684 13 * The above copyright notice and this permission notice shall be included in all copies or
phsfan 96:b50f5f795684 14 * substantial portions of the Software.
phsfan 96:b50f5f795684 15 *
phsfan 96:b50f5f795684 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
phsfan 96:b50f5f795684 17 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
phsfan 96:b50f5f795684 18 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
phsfan 96:b50f5f795684 19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
phsfan 96:b50f5f795684 20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
phsfan 96:b50f5f795684 21 */
phsfan 96:b50f5f795684 22
phsfan 96:b50f5f795684 23 #ifndef _ABITUSBMODEM_H_
phsfan 96:b50f5f795684 24 #define _ABITUSBMODEM_H_
phsfan 96:b50f5f795684 25
phsfan 96:b50f5f795684 26 #include "core/fwk.h"
phsfan 96:b50f5f795684 27
phsfan 96:b50f5f795684 28 #include "USBHostPhs.h"
phsfan 96:b50f5f795684 29 #include "serial/usb/USBSerialStream.h"
phsfan 96:b50f5f795684 30 #include "ip/PPPIPInterface.h"
phsfan 96:b50f5f795684 31
phsfan 96:b50f5f795684 32 class AbitUSBModem {
phsfan 96:b50f5f795684 33 public:
phsfan 96:b50f5f795684 34 AbitUSBModem ();
phsfan 96:b50f5f795684 35
phsfan 96:b50f5f795684 36 /** Open a 3G internet connection
phsfan 96:b50f5f795684 37 @return 0 on success, error code on failure
phsfan 96:b50f5f795684 38 */
phsfan 96:b50f5f795684 39 int connect(const char* user = NULL, const char* password = NULL);
phsfan 96:b50f5f795684 40
phsfan 96:b50f5f795684 41 /** Close the internet connection
phsfan 96:b50f5f795684 42 @return 0 on success, error code on failure
phsfan 96:b50f5f795684 43 */
phsfan 96:b50f5f795684 44 int disconnect();
phsfan 96:b50f5f795684 45
phsfan 96:b50f5f795684 46 /** Get the IP address of a connected device
phsfan 96:b50f5f795684 47 @return A pointer to a string containing the IP address.
phsfan 96:b50f5f795684 48 */
phsfan 96:b50f5f795684 49 char* getIPAddress();
phsfan 96:b50f5f795684 50
phsfan 96:b50f5f795684 51 protected:
phsfan 96:b50f5f795684 52 int init();
phsfan 96:b50f5f795684 53
phsfan 96:b50f5f795684 54 private:
phsfan 96:b50f5f795684 55 USBHostPhs m_dongle; //< Interface to USB connected WAN dongle
phsfan 96:b50f5f795684 56
phsfan 96:b50f5f795684 57 USBSerialStream m_pppStream; //< Serial interface to PPP channel on modem
phsfan 96:b50f5f795684 58
phsfan 96:b50f5f795684 59 ATCommandsInterface m_at; //< Interface to AT commands processing
phsfan 96:b50f5f795684 60
phsfan 96:b50f5f795684 61 PPPIPInterface m_ppp; //< Interface to PPP conection manager (IP assignment etc)
phsfan 96:b50f5f795684 62
phsfan 96:b50f5f795684 63 bool m_dongleConnected; //< Is the dongle physically connected (does the USB stack respond)? true/false
phsfan 96:b50f5f795684 64 bool m_ipInit; //< Has PPIPInterface object (m_ppp) been initialised? true/false
phsfan 96:b50f5f795684 65 bool m_atOpen; //< Is the interface to the ATCommandsInterface open? true/false
phsfan 96:b50f5f795684 66
phsfan 96:b50f5f795684 67 };
phsfan 96:b50f5f795684 68
phsfan 96:b50f5f795684 69 #endif