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:
ashleymills
Date:
Wed Jan 09 16:13:50 2013 +0000
Revision:
79:a6ac8206a58d
Parent:
22:06fb2a93a1f6
Experimental MU509 Support

Who changed what in which revision?

UserRevisionLine numberNew contents of line
donatien 8:04b6a042595f 1 /* PPPIPInterface.h */
donatien 22:06fb2a93a1f6 2 /* Copyright (C) 2012 mbed.org, MIT License
donatien 22:06fb2a93a1f6 3 *
donatien 22:06fb2a93a1f6 4 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
donatien 22:06fb2a93a1f6 5 * and associated documentation files (the "Software"), to deal in the Software without restriction,
donatien 22:06fb2a93a1f6 6 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
donatien 22:06fb2a93a1f6 7 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
donatien 22:06fb2a93a1f6 8 * furnished to do so, subject to the following conditions:
donatien 22:06fb2a93a1f6 9 *
donatien 22:06fb2a93a1f6 10 * The above copyright notice and this permission notice shall be included in all copies or
donatien 22:06fb2a93a1f6 11 * substantial portions of the Software.
donatien 22:06fb2a93a1f6 12 *
donatien 22:06fb2a93a1f6 13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
donatien 22:06fb2a93a1f6 14 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
donatien 22:06fb2a93a1f6 15 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
donatien 22:06fb2a93a1f6 16 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
donatien 22:06fb2a93a1f6 17 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
donatien 22:06fb2a93a1f6 18 */
donatien 8:04b6a042595f 19
donatien 8:04b6a042595f 20 #ifndef PPPIPINTERFACE_H_
donatien 8:04b6a042595f 21 #define PPPIPINTERFACE_H_
donatien 8:04b6a042595f 22
donatien 8:04b6a042595f 23 #include "core/fwk.h"
donatien 8:04b6a042595f 24
donatien 8:04b6a042595f 25 #include "LwIPInterface.h"
donatien 8:04b6a042595f 26
donatien 8:04b6a042595f 27 #include "lwip/sio.h"
ashleymills 79:a6ac8206a58d 28 #include "at/ATCommandsInterface.h"
donatien 8:04b6a042595f 29
donatien 8:04b6a042595f 30 namespace rtos {
donatien 8:04b6a042595f 31 class Semaphore;
donatien 8:04b6a042595f 32 }
donatien 8:04b6a042595f 33 using namespace rtos;
donatien 8:04b6a042595f 34
donatien 8:04b6a042595f 35 /** Interface using PPP to connect to an IP-based network
donatien 8:04b6a042595f 36 *
donatien 8:04b6a042595f 37 */
donatien 8:04b6a042595f 38 class PPPIPInterface : public LwIPInterface
donatien 8:04b6a042595f 39 {
donatien 8:04b6a042595f 40 public:
ashleymills 79:a6ac8206a58d 41 PPPIPInterface(IOStream* pStream, IOStream* atStream, ATCommandsInterface* pIf, bool hangupViaATPort);
ashleymills 79:a6ac8206a58d 42 ATCommandsInterface* m_pIf;
donatien 8:04b6a042595f 43 virtual ~PPPIPInterface();
donatien 8:04b6a042595f 44
donatien 8:04b6a042595f 45 int init(); //Init PPP-specific stuff, create the right bindings, etc
donatien 8:04b6a042595f 46 int setup(const char* user, const char* pw); //Setup authentication
ashleymills 79:a6ac8206a58d 47
ashleymills 79:a6ac8206a58d 48 // should the modem hangup via AT port or PPP port? true for AT port
ashleymills 79:a6ac8206a58d 49 void setHangupViaATPort(bool val);
donatien 12:66dc2c8eba2d 50 virtual int connect();
donatien 8:04b6a042595f 51 virtual int disconnect();
donatien 8:04b6a042595f 52
donatien 8:04b6a042595f 53 private:
donatien 18:1789a11d1892 54 int cleanupLink();
donatien 18:1789a11d1892 55
donatien 8:04b6a042595f 56 static void linkStatusCb(void *ctx, int errCode, void *arg); //PPP link status
donatien 8:04b6a042595f 57 Semaphore m_linkStatusSphre;
donatien 8:04b6a042595f 58 int m_pppErrCode;
donatien 8:04b6a042595f 59
donatien 8:04b6a042595f 60 IOStream* m_pStream; //Serial stream
ashleymills 79:a6ac8206a58d 61
ashleymills 79:a6ac8206a58d 62 IOStream* m_atStream;
donatien 8:04b6a042595f 63 bool m_streamAvail;
ashleymills 79:a6ac8206a58d 64
ashleymills 79:a6ac8206a58d 65 // if this is true, then PPP connection must be terminated using AT virtual serial port
ashleymills 79:a6ac8206a58d 66 // this is usually because the ppp stream doesn't support +++ escape sequence
ashleymills 79:a6ac8206a58d 67 bool m_hangupViaATPort;
donatien 8:04b6a042595f 68 int m_pppd;
donatien 8:04b6a042595f 69
donatien 8:04b6a042595f 70 friend u32_t sio_write(sio_fd_t fd, u8_t *data, u32_t len);
donatien 8:04b6a042595f 71 friend u32_t sio_read(sio_fd_t fd, u8_t *data, u32_t len);
donatien 8:04b6a042595f 72 friend void sio_read_abort(sio_fd_t fd);
donatien 8:04b6a042595f 73 };
donatien 8:04b6a042595f 74
donatien 8:04b6a042595f 75 #endif /* PPPIPINTERFACE_H_ */