Integrating the ublox LISA C200 modem
Fork of SprintUSBModemHTTPClientTest by
SprintUSBModem/USBHostWANDongleSprint/USB3GModule/WANDongle.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 | /* Copyright (c) 2010-2012 mbed.org, MIT License |
sam_grove | 5:3f93dd1d4cb3 | 2 | * |
sam_grove | 5:3f93dd1d4cb3 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
sam_grove | 5:3f93dd1d4cb3 | 4 | * and associated documentation files (the "Software"), to deal in the Software without |
sam_grove | 5:3f93dd1d4cb3 | 5 | * restriction, including without limitation the rights to use, copy, modify, merge, publish, |
sam_grove | 5:3f93dd1d4cb3 | 6 | * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the |
sam_grove | 5:3f93dd1d4cb3 | 7 | * Software is furnished to do so, subject to the following conditions: |
sam_grove | 5:3f93dd1d4cb3 | 8 | * |
sam_grove | 5:3f93dd1d4cb3 | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
sam_grove | 5:3f93dd1d4cb3 | 10 | * substantial portions of the Software. |
sam_grove | 5:3f93dd1d4cb3 | 11 | * |
sam_grove | 5:3f93dd1d4cb3 | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
sam_grove | 5:3f93dd1d4cb3 | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
sam_grove | 5:3f93dd1d4cb3 | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
sam_grove | 5:3f93dd1d4cb3 | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
sam_grove | 5:3f93dd1d4cb3 | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
sam_grove | 5:3f93dd1d4cb3 | 17 | */ |
sam_grove | 5:3f93dd1d4cb3 | 18 | |
sam_grove | 5:3f93dd1d4cb3 | 19 | #ifndef WANDONGLE_H |
sam_grove | 5:3f93dd1d4cb3 | 20 | #define WANDONGLE_H |
sam_grove | 5:3f93dd1d4cb3 | 21 | |
sam_grove | 5:3f93dd1d4cb3 | 22 | #include "USBHost.h" |
sam_grove | 5:3f93dd1d4cb3 | 23 | #include "IUSBHostSerial.h" |
sam_grove | 5:3f93dd1d4cb3 | 24 | |
sam_grove | 5:3f93dd1d4cb3 | 25 | #include "rtos.h" |
sam_grove | 5:3f93dd1d4cb3 | 26 | |
sam_grove | 5:3f93dd1d4cb3 | 27 | #include "WANDongleSerialPort.h" |
sam_grove | 5:3f93dd1d4cb3 | 28 | #include "WANDongleInitializer.h" |
sam_grove | 5:3f93dd1d4cb3 | 29 | #include "IUSBEnumerator.h" |
sam_grove | 5:3f93dd1d4cb3 | 30 | |
sam_grove | 5:3f93dd1d4cb3 | 31 | #define WANDONGLE_MAX_OUTEP_SIZE 64 |
sam_grove | 5:3f93dd1d4cb3 | 32 | #define WANDONGLE_MAX_INEP_SIZE 64 |
sam_grove | 5:3f93dd1d4cb3 | 33 | |
sam_grove | 5:3f93dd1d4cb3 | 34 | #define WANDONGLE_MAX_SERIAL_PORTS 2 |
sam_grove | 5:3f93dd1d4cb3 | 35 | |
sam_grove | 5:3f93dd1d4cb3 | 36 | /** A class to use a WAN (3G/LTE) access dongle |
sam_grove | 5:3f93dd1d4cb3 | 37 | * |
sam_grove | 5:3f93dd1d4cb3 | 38 | */ |
sam_grove | 5:3f93dd1d4cb3 | 39 | class WANDongle : public IUSBEnumerator { |
sam_grove | 5:3f93dd1d4cb3 | 40 | public: |
sam_grove | 5:3f93dd1d4cb3 | 41 | /* |
sam_grove | 5:3f93dd1d4cb3 | 42 | * Constructor |
sam_grove | 5:3f93dd1d4cb3 | 43 | * |
sam_grove | 5:3f93dd1d4cb3 | 44 | * @param rootdir mount name |
sam_grove | 5:3f93dd1d4cb3 | 45 | */ |
sam_grove | 5:3f93dd1d4cb3 | 46 | WANDongle(); |
sam_grove | 5:3f93dd1d4cb3 | 47 | |
sam_grove | 5:3f93dd1d4cb3 | 48 | /* |
sam_grove | 5:3f93dd1d4cb3 | 49 | * Check if a serial port device is connected |
sam_grove | 5:3f93dd1d4cb3 | 50 | * |
sam_grove | 5:3f93dd1d4cb3 | 51 | * @return true if a serial device is connected |
sam_grove | 5:3f93dd1d4cb3 | 52 | */ |
sam_grove | 5:3f93dd1d4cb3 | 53 | bool connected(); |
sam_grove | 5:3f93dd1d4cb3 | 54 | |
sam_grove | 5:3f93dd1d4cb3 | 55 | /* |
sam_grove | 5:3f93dd1d4cb3 | 56 | * Try to connect device |
sam_grove | 5:3f93dd1d4cb3 | 57 | * |
sam_grove | 5:3f93dd1d4cb3 | 58 | * * @return true if connection was successful |
sam_grove | 5:3f93dd1d4cb3 | 59 | */ |
sam_grove | 5:3f93dd1d4cb3 | 60 | bool tryConnect(); |
sam_grove | 5:3f93dd1d4cb3 | 61 | |
sam_grove | 5:3f93dd1d4cb3 | 62 | /* |
sam_grove | 5:3f93dd1d4cb3 | 63 | * Disconnect device |
sam_grove | 5:3f93dd1d4cb3 | 64 | * |
sam_grove | 5:3f93dd1d4cb3 | 65 | * * @return true if disconnection was successful |
sam_grove | 5:3f93dd1d4cb3 | 66 | */ |
sam_grove | 5:3f93dd1d4cb3 | 67 | bool disconnect(); |
sam_grove | 5:3f93dd1d4cb3 | 68 | |
sam_grove | 5:3f93dd1d4cb3 | 69 | WAN_DONGLE_TYPE getDongleType(); |
sam_grove | 5:3f93dd1d4cb3 | 70 | |
sam_grove | 5:3f93dd1d4cb3 | 71 | IUSBHostSerial& getSerial(int index); |
sam_grove | 5:3f93dd1d4cb3 | 72 | int getSerialCount(); |
sam_grove | 5:3f93dd1d4cb3 | 73 | |
sam_grove | 5:3f93dd1d4cb3 | 74 | //From IUSBEnumerator |
sam_grove | 5:3f93dd1d4cb3 | 75 | |
sam_grove | 5:3f93dd1d4cb3 | 76 | virtual void setVidPid(uint16_t vid, uint16_t pid); |
sam_grove | 5:3f93dd1d4cb3 | 77 | |
sam_grove | 5:3f93dd1d4cb3 | 78 | virtual bool parseInterface(uint8_t intf_nb, uint8_t intf_class, uint8_t intf_subclass, uint8_t intf_protocol); //Must return true if the interface should be parsed |
sam_grove | 5:3f93dd1d4cb3 | 79 | |
sam_grove | 5:3f93dd1d4cb3 | 80 | virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir); //Must return true if the endpoint will be used |
sam_grove | 5:3f93dd1d4cb3 | 81 | |
sam_grove | 5:3f93dd1d4cb3 | 82 | protected: |
sam_grove | 5:3f93dd1d4cb3 | 83 | USBHost * host; |
sam_grove | 5:3f93dd1d4cb3 | 84 | USBDeviceConnected * dev; |
sam_grove | 5:3f93dd1d4cb3 | 85 | bool dev_connected; |
sam_grove | 5:3f93dd1d4cb3 | 86 | |
sam_grove | 5:3f93dd1d4cb3 | 87 | WANDongleInitializer* m_pInitializer; |
sam_grove | 5:3f93dd1d4cb3 | 88 | |
sam_grove | 5:3f93dd1d4cb3 | 89 | void init(); |
sam_grove | 5:3f93dd1d4cb3 | 90 | |
sam_grove | 5:3f93dd1d4cb3 | 91 | WANDongleSerialPort m_serial[WANDONGLE_MAX_SERIAL_PORTS]; |
sam_grove | 5:3f93dd1d4cb3 | 92 | int m_serialCount; |
sam_grove | 5:3f93dd1d4cb3 | 93 | }; |
sam_grove | 5:3f93dd1d4cb3 | 94 | |
sam_grove | 5:3f93dd1d4cb3 | 95 | #endif |