The beta version of the Vodafone K3770 dongle driver
This library is deprecated. Please use the newest production branch of the library from https://mbed.org/users/mbed_official/code/VodafoneUSBModem/
USBHostWANDongleLib/USB3GModule/IUSBHostSerial.h@1:4b33ffe61bfa, 2012-11-01 (annotated)
- Committer:
- donatien
- Date:
- Thu Nov 01 10:03:50 2012 +0000
- Revision:
- 1:4b33ffe61bfa
- Parent:
- 0:0ac66acdfdc0
Deprecating library, pointing out at new one
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
donatien | 0:0ac66acdfdc0 | 1 | /* IUSBHostSerial.h */ |
donatien | 0:0ac66acdfdc0 | 2 | /* |
donatien | 0:0ac66acdfdc0 | 3 | Copyright (C) 2012 ARM Limited. |
donatien | 0:0ac66acdfdc0 | 4 | |
donatien | 0:0ac66acdfdc0 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of |
donatien | 0:0ac66acdfdc0 | 6 | this software and associated documentation files (the "Software"), to deal in |
donatien | 0:0ac66acdfdc0 | 7 | the Software without restriction, including without limitation the rights to |
donatien | 0:0ac66acdfdc0 | 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies |
donatien | 0:0ac66acdfdc0 | 9 | of the Software, and to permit persons to whom the Software is furnished to do |
donatien | 0:0ac66acdfdc0 | 10 | so, subject to the following conditions: |
donatien | 0:0ac66acdfdc0 | 11 | |
donatien | 0:0ac66acdfdc0 | 12 | The above copyright notice and this permission notice shall be included in all |
donatien | 0:0ac66acdfdc0 | 13 | copies or substantial portions of the Software. |
donatien | 0:0ac66acdfdc0 | 14 | |
donatien | 0:0ac66acdfdc0 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
donatien | 0:0ac66acdfdc0 | 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
donatien | 0:0ac66acdfdc0 | 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
donatien | 0:0ac66acdfdc0 | 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
donatien | 0:0ac66acdfdc0 | 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
donatien | 0:0ac66acdfdc0 | 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
donatien | 0:0ac66acdfdc0 | 21 | SOFTWARE. |
donatien | 0:0ac66acdfdc0 | 22 | */ |
donatien | 0:0ac66acdfdc0 | 23 | |
donatien | 0:0ac66acdfdc0 | 24 | |
donatien | 0:0ac66acdfdc0 | 25 | #ifndef IUSBHOSTSERIAL_H_ |
donatien | 0:0ac66acdfdc0 | 26 | #define IUSBHOSTSERIAL_H_ |
donatien | 0:0ac66acdfdc0 | 27 | |
donatien | 0:0ac66acdfdc0 | 28 | /** |
donatien | 0:0ac66acdfdc0 | 29 | * Generic interface to abstract 3G dongles' impl |
donatien | 0:0ac66acdfdc0 | 30 | */ |
donatien | 0:0ac66acdfdc0 | 31 | |
donatien | 0:0ac66acdfdc0 | 32 | #include "IUSBHostSerialListener.h" |
donatien | 0:0ac66acdfdc0 | 33 | |
donatien | 0:0ac66acdfdc0 | 34 | class IUSBHostSerial { |
donatien | 0:0ac66acdfdc0 | 35 | public: |
donatien | 0:0ac66acdfdc0 | 36 | |
donatien | 0:0ac66acdfdc0 | 37 | enum IrqType { |
donatien | 0:0ac66acdfdc0 | 38 | RxIrq, |
donatien | 0:0ac66acdfdc0 | 39 | TxIrq |
donatien | 0:0ac66acdfdc0 | 40 | }; |
donatien | 0:0ac66acdfdc0 | 41 | |
donatien | 0:0ac66acdfdc0 | 42 | /* |
donatien | 0:0ac66acdfdc0 | 43 | * Get a char from the dongle's serial interface |
donatien | 0:0ac66acdfdc0 | 44 | */ |
donatien | 0:0ac66acdfdc0 | 45 | virtual int getc() = 0; |
donatien | 0:0ac66acdfdc0 | 46 | |
donatien | 0:0ac66acdfdc0 | 47 | /* |
donatien | 0:0ac66acdfdc0 | 48 | * Put a char to the dongle's serial interface |
donatien | 0:0ac66acdfdc0 | 49 | */ |
donatien | 0:0ac66acdfdc0 | 50 | virtual int putc(int c) = 0; |
donatien | 0:0ac66acdfdc0 | 51 | |
donatien | 0:0ac66acdfdc0 | 52 | /* |
donatien | 0:0ac66acdfdc0 | 53 | * Read a packet from the dongle's serial interface, to be called after multiple getc() calls |
donatien | 0:0ac66acdfdc0 | 54 | */ |
donatien | 0:0ac66acdfdc0 | 55 | virtual int readPacket() = 0; |
donatien | 0:0ac66acdfdc0 | 56 | |
donatien | 0:0ac66acdfdc0 | 57 | /* |
donatien | 0:0ac66acdfdc0 | 58 | * Write a packet to the dongle's serial interface, to be called after multiple putc() calls |
donatien | 0:0ac66acdfdc0 | 59 | */ |
donatien | 0:0ac66acdfdc0 | 60 | virtual int writePacket() = 0; |
donatien | 0:0ac66acdfdc0 | 61 | |
donatien | 0:0ac66acdfdc0 | 62 | /** |
donatien | 0:0ac66acdfdc0 | 63 | * Check the number of bytes available. |
donatien | 0:0ac66acdfdc0 | 64 | * |
donatien | 0:0ac66acdfdc0 | 65 | * @returns the number of bytes available |
donatien | 0:0ac66acdfdc0 | 66 | */ |
donatien | 0:0ac66acdfdc0 | 67 | virtual int readable() = 0; |
donatien | 0:0ac66acdfdc0 | 68 | |
donatien | 0:0ac66acdfdc0 | 69 | /** |
donatien | 0:0ac66acdfdc0 | 70 | * Check the free space in output. |
donatien | 0:0ac66acdfdc0 | 71 | * |
donatien | 0:0ac66acdfdc0 | 72 | * @returns the number of bytes available |
donatien | 0:0ac66acdfdc0 | 73 | */ |
donatien | 0:0ac66acdfdc0 | 74 | virtual int writeable() = 0; |
donatien | 0:0ac66acdfdc0 | 75 | |
donatien | 0:0ac66acdfdc0 | 76 | /** |
donatien | 0:0ac66acdfdc0 | 77 | * Attach a handler to call when a packet is received / when a packet has been transmitted. |
donatien | 0:0ac66acdfdc0 | 78 | * |
donatien | 0:0ac66acdfdc0 | 79 | * @param pListener instance of the listener deriving from the IUSBHostSerialListener |
donatien | 0:0ac66acdfdc0 | 80 | */ |
donatien | 0:0ac66acdfdc0 | 81 | virtual void attach(IUSBHostSerialListener* pListener) = 0; |
donatien | 0:0ac66acdfdc0 | 82 | |
donatien | 0:0ac66acdfdc0 | 83 | /** |
donatien | 0:0ac66acdfdc0 | 84 | * Enable or disable readable/writeable callbacks |
donatien | 0:0ac66acdfdc0 | 85 | */ |
donatien | 0:0ac66acdfdc0 | 86 | virtual void setupIrq(bool en, IrqType irq = RxIrq) = 0; |
donatien | 0:0ac66acdfdc0 | 87 | |
donatien | 0:0ac66acdfdc0 | 88 | }; |
donatien | 0:0ac66acdfdc0 | 89 | |
donatien | 0:0ac66acdfdc0 | 90 | #endif /* IUSBHOSTSERIAL_H_ */ |