Implementation of 3G USB Modem Huawei E372
PPPIPInterface.h@2:61ac95f0af72, 2015-04-14 (annotated)
- Committer:
- clemounet
- Date:
- Tue Apr 14 13:27:07 2015 +0000
- Revision:
- 2:61ac95f0af72
- Parent:
- 1:fbf17fb09581
.up (working)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
clemounet | 1:fbf17fb09581 | 1 | |
clemounet | 1:fbf17fb09581 | 2 | #ifndef PPPIPINTERFACE_H_ |
clemounet | 1:fbf17fb09581 | 3 | #define PPPIPINTERFACE_H_ |
clemounet | 1:fbf17fb09581 | 4 | |
clemounet | 1:fbf17fb09581 | 5 | #include "core/fwk.h" |
clemounet | 1:fbf17fb09581 | 6 | #include "lwip/sio.h" |
clemounet | 2:61ac95f0af72 | 7 | #include "USBSerialStream.h" |
clemounet | 1:fbf17fb09581 | 8 | |
clemounet | 2:61ac95f0af72 | 9 | class PPPIPInterface { |
clemounet | 2:61ac95f0af72 | 10 | private: |
clemounet | 2:61ac95f0af72 | 11 | char ipAddress[16]; |
clemounet | 2:61ac95f0af72 | 12 | |
clemounet | 2:61ac95f0af72 | 13 | USBSerialStream* pppStream; //Serial stream |
clemounet | 2:61ac95f0af72 | 14 | |
clemounet | 2:61ac95f0af72 | 15 | int cleanupLink(); |
clemounet | 2:61ac95f0af72 | 16 | int pppSession; |
clemounet | 2:61ac95f0af72 | 17 | bool ipInitiated; |
clemounet | 2:61ac95f0af72 | 18 | bool pppInitiated; |
clemounet | 2:61ac95f0af72 | 19 | bool connected; |
clemounet | 1:fbf17fb09581 | 20 | public: |
clemounet | 2:61ac95f0af72 | 21 | PPPIPInterface(USBSerialStream* pStream); |
clemounet | 1:fbf17fb09581 | 22 | virtual ~PPPIPInterface(); |
clemounet | 2:61ac95f0af72 | 23 | |
clemounet | 2:61ac95f0af72 | 24 | void stackInits(const char* user, const char* pw); |
clemounet | 2:61ac95f0af72 | 25 | int dial(void); |
clemounet | 2:61ac95f0af72 | 26 | int escape(void); |
clemounet | 2:61ac95f0af72 | 27 | |
clemounet | 2:61ac95f0af72 | 28 | int connect(const char* user, const char* pw); |
clemounet | 2:61ac95f0af72 | 29 | int disconnect(); |
clemounet | 2:61ac95f0af72 | 30 | |
clemounet | 2:61ac95f0af72 | 31 | void setConnected(bool val); |
clemounet | 2:61ac95f0af72 | 32 | bool isConnected(void); |
clemounet | 2:61ac95f0af72 | 33 | |
clemounet | 2:61ac95f0af72 | 34 | // IP stuffs |
clemounet | 2:61ac95f0af72 | 35 | char *getIPAddress(void); |
clemounet | 2:61ac95f0af72 | 36 | void setIPAddress(char *ip); |
clemounet | 2:61ac95f0af72 | 37 | |
clemounet | 2:61ac95f0af72 | 38 | // PPP implementaion |
clemounet | 1:fbf17fb09581 | 39 | friend u32_t sio_write(sio_fd_t fd, u8_t *data, u32_t len); |
clemounet | 1:fbf17fb09581 | 40 | friend u32_t sio_read(sio_fd_t fd, u8_t *data, u32_t len); |
clemounet | 1:fbf17fb09581 | 41 | friend void sio_read_abort(sio_fd_t fd); |
clemounet | 2:61ac95f0af72 | 42 | |
clemounet | 2:61ac95f0af72 | 43 | // CallBacks |
clemounet | 2:61ac95f0af72 | 44 | static void tcpipInitDoneCb(void *arg); |
clemounet | 2:61ac95f0af72 | 45 | static void linkStatusCb(void *ctx, int errCode, void *arg); |
clemounet | 1:fbf17fb09581 | 46 | }; |
clemounet | 1:fbf17fb09581 | 47 | |
clemounet | 1:fbf17fb09581 | 48 | #endif /* PPPIPINTERFACE_H_ */ |