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