fork of VodafoneUSBModem with updated USBHost library

Dependencies:   Socket USBHost lwip-sys lwip

Dependents:   VodafoneUSBModemSMSTest

Committer:
donatien
Date:
Tue Jun 26 13:44:59 2012 +0000
Revision:
8:04b6a042595f
Child:
9:3f077dde13c9
Bleeding edge - test with two different interfaces

Who changed what in which revision?

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