Bmag incl gps rettelse
Dependencies: mbed WDT MODSERIAL BME280
USBHost/USBHost3GModule/WANDongle.h@64:06b9b8ffd5a6, 2019-07-09 (annotated)
- Committer:
- gert_lauritsen
- Date:
- Tue Jul 09 09:54:41 2019 +0000
- Branch:
- MbedBMAGThrRev
- Revision:
- 64:06b9b8ffd5a6
- Parent:
- 61:52a6d0ffd8e5
dataline version to 4 and fw til 1.0.0.7
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gert_lauritsen | 61:52a6d0ffd8e5 | 1 | /* Copyright (c) 2010-2012 mbed.org, MIT License |
gert_lauritsen | 61:52a6d0ffd8e5 | 2 | * |
gert_lauritsen | 61:52a6d0ffd8e5 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
gert_lauritsen | 61:52a6d0ffd8e5 | 4 | * and associated documentation files (the "Software"), to deal in the Software without |
gert_lauritsen | 61:52a6d0ffd8e5 | 5 | * restriction, including without limitation the rights to use, copy, modify, merge, publish, |
gert_lauritsen | 61:52a6d0ffd8e5 | 6 | * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the |
gert_lauritsen | 61:52a6d0ffd8e5 | 7 | * Software is furnished to do so, subject to the following conditions: |
gert_lauritsen | 61:52a6d0ffd8e5 | 8 | * |
gert_lauritsen | 61:52a6d0ffd8e5 | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
gert_lauritsen | 61:52a6d0ffd8e5 | 10 | * substantial portions of the Software. |
gert_lauritsen | 61:52a6d0ffd8e5 | 11 | * |
gert_lauritsen | 61:52a6d0ffd8e5 | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
gert_lauritsen | 61:52a6d0ffd8e5 | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
gert_lauritsen | 61:52a6d0ffd8e5 | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
gert_lauritsen | 61:52a6d0ffd8e5 | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
gert_lauritsen | 61:52a6d0ffd8e5 | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
gert_lauritsen | 61:52a6d0ffd8e5 | 17 | */ |
gert_lauritsen | 61:52a6d0ffd8e5 | 18 | |
gert_lauritsen | 61:52a6d0ffd8e5 | 19 | #ifndef WANDONGLE_H |
gert_lauritsen | 61:52a6d0ffd8e5 | 20 | #define WANDONGLE_H |
gert_lauritsen | 61:52a6d0ffd8e5 | 21 | |
gert_lauritsen | 61:52a6d0ffd8e5 | 22 | #include "USBHostConf.h" |
gert_lauritsen | 61:52a6d0ffd8e5 | 23 | |
gert_lauritsen | 61:52a6d0ffd8e5 | 24 | #ifdef USBHOST_3GMODULE |
gert_lauritsen | 61:52a6d0ffd8e5 | 25 | |
gert_lauritsen | 61:52a6d0ffd8e5 | 26 | #include "USBHost.h" |
gert_lauritsen | 61:52a6d0ffd8e5 | 27 | #include "IUSBHostSerial.h" |
gert_lauritsen | 61:52a6d0ffd8e5 | 28 | |
gert_lauritsen | 61:52a6d0ffd8e5 | 29 | #include "rtos.h" |
gert_lauritsen | 61:52a6d0ffd8e5 | 30 | |
gert_lauritsen | 61:52a6d0ffd8e5 | 31 | #include "WANDongleSerialPort.h" |
gert_lauritsen | 61:52a6d0ffd8e5 | 32 | #include "WANDongleInitializer.h" |
gert_lauritsen | 61:52a6d0ffd8e5 | 33 | #include "IUSBEnumerator.h" |
gert_lauritsen | 61:52a6d0ffd8e5 | 34 | |
gert_lauritsen | 61:52a6d0ffd8e5 | 35 | #define WANDONGLE_MAX_OUTEP_SIZE 64 |
gert_lauritsen | 61:52a6d0ffd8e5 | 36 | #define WANDONGLE_MAX_INEP_SIZE 64 |
gert_lauritsen | 61:52a6d0ffd8e5 | 37 | |
gert_lauritsen | 61:52a6d0ffd8e5 | 38 | /** A class to use a WAN (3G/LTE) access dongle |
gert_lauritsen | 61:52a6d0ffd8e5 | 39 | * |
gert_lauritsen | 61:52a6d0ffd8e5 | 40 | */ |
gert_lauritsen | 61:52a6d0ffd8e5 | 41 | class WANDongle : public IUSBEnumerator { |
gert_lauritsen | 61:52a6d0ffd8e5 | 42 | public: |
gert_lauritsen | 61:52a6d0ffd8e5 | 43 | /* |
gert_lauritsen | 61:52a6d0ffd8e5 | 44 | * Constructor |
gert_lauritsen | 61:52a6d0ffd8e5 | 45 | * |
gert_lauritsen | 61:52a6d0ffd8e5 | 46 | * @param rootdir mount name |
gert_lauritsen | 61:52a6d0ffd8e5 | 47 | */ |
gert_lauritsen | 61:52a6d0ffd8e5 | 48 | WANDongle(); |
gert_lauritsen | 61:52a6d0ffd8e5 | 49 | |
gert_lauritsen | 61:52a6d0ffd8e5 | 50 | /* |
gert_lauritsen | 61:52a6d0ffd8e5 | 51 | * Destructor |
gert_lauritsen | 61:52a6d0ffd8e5 | 52 | */ |
gert_lauritsen | 61:52a6d0ffd8e5 | 53 | virtual ~WANDongle(); |
gert_lauritsen | 61:52a6d0ffd8e5 | 54 | |
gert_lauritsen | 61:52a6d0ffd8e5 | 55 | /* |
gert_lauritsen | 61:52a6d0ffd8e5 | 56 | * Check if a serial port device is connected |
gert_lauritsen | 61:52a6d0ffd8e5 | 57 | * |
gert_lauritsen | 61:52a6d0ffd8e5 | 58 | * @return true if a serial device is connected |
gert_lauritsen | 61:52a6d0ffd8e5 | 59 | */ |
gert_lauritsen | 61:52a6d0ffd8e5 | 60 | bool connected(); |
gert_lauritsen | 61:52a6d0ffd8e5 | 61 | |
gert_lauritsen | 61:52a6d0ffd8e5 | 62 | /* |
gert_lauritsen | 61:52a6d0ffd8e5 | 63 | * Try to connect device |
gert_lauritsen | 61:52a6d0ffd8e5 | 64 | * |
gert_lauritsen | 61:52a6d0ffd8e5 | 65 | * * @return true if connection was successful |
gert_lauritsen | 61:52a6d0ffd8e5 | 66 | */ |
gert_lauritsen | 61:52a6d0ffd8e5 | 67 | bool tryConnect(); |
gert_lauritsen | 61:52a6d0ffd8e5 | 68 | |
gert_lauritsen | 61:52a6d0ffd8e5 | 69 | /* |
gert_lauritsen | 61:52a6d0ffd8e5 | 70 | * Disconnect device |
gert_lauritsen | 61:52a6d0ffd8e5 | 71 | * |
gert_lauritsen | 61:52a6d0ffd8e5 | 72 | * * @return true if disconnection was successful |
gert_lauritsen | 61:52a6d0ffd8e5 | 73 | */ |
gert_lauritsen | 61:52a6d0ffd8e5 | 74 | bool disconnect(); |
gert_lauritsen | 61:52a6d0ffd8e5 | 75 | |
gert_lauritsen | 61:52a6d0ffd8e5 | 76 | int getDongleType(); |
gert_lauritsen | 61:52a6d0ffd8e5 | 77 | |
gert_lauritsen | 61:52a6d0ffd8e5 | 78 | IUSBHostSerial& getSerial(int index); |
gert_lauritsen | 61:52a6d0ffd8e5 | 79 | int getSerialCount(); |
gert_lauritsen | 61:52a6d0ffd8e5 | 80 | bool addInitializer(WANDongleInitializer* pInitializer); |
gert_lauritsen | 61:52a6d0ffd8e5 | 81 | |
gert_lauritsen | 61:52a6d0ffd8e5 | 82 | //From IUSBEnumerator |
gert_lauritsen | 61:52a6d0ffd8e5 | 83 | |
gert_lauritsen | 61:52a6d0ffd8e5 | 84 | virtual void setVidPid(uint16_t vid, uint16_t pid); |
gert_lauritsen | 61:52a6d0ffd8e5 | 85 | |
gert_lauritsen | 61:52a6d0ffd8e5 | 86 | 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 |
gert_lauritsen | 61:52a6d0ffd8e5 | 87 | |
gert_lauritsen | 61:52a6d0ffd8e5 | 88 | virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir); //Must return true if the endpoint will be used |
gert_lauritsen | 61:52a6d0ffd8e5 | 89 | |
gert_lauritsen | 61:52a6d0ffd8e5 | 90 | protected: |
gert_lauritsen | 61:52a6d0ffd8e5 | 91 | USBHost * host; |
gert_lauritsen | 61:52a6d0ffd8e5 | 92 | USBDeviceConnected * dev; |
gert_lauritsen | 61:52a6d0ffd8e5 | 93 | bool dev_connected; |
gert_lauritsen | 61:52a6d0ffd8e5 | 94 | |
gert_lauritsen | 61:52a6d0ffd8e5 | 95 | WANDongleInitializer* m_pInitializer; |
gert_lauritsen | 61:52a6d0ffd8e5 | 96 | |
gert_lauritsen | 61:52a6d0ffd8e5 | 97 | void init(); |
gert_lauritsen | 61:52a6d0ffd8e5 | 98 | |
gert_lauritsen | 61:52a6d0ffd8e5 | 99 | WANDongleSerialPort m_serial[WANDONGLE_MAX_SERIAL_PORTS]; |
gert_lauritsen | 61:52a6d0ffd8e5 | 100 | int m_serialCount; |
gert_lauritsen | 61:52a6d0ffd8e5 | 101 | |
gert_lauritsen | 61:52a6d0ffd8e5 | 102 | int m_totalInitializers; |
gert_lauritsen | 61:52a6d0ffd8e5 | 103 | WANDongleInitializer* m_Initializers[WANDONGLE_MAX_INITIALIZERS]; |
gert_lauritsen | 61:52a6d0ffd8e5 | 104 | }; |
gert_lauritsen | 61:52a6d0ffd8e5 | 105 | |
gert_lauritsen | 61:52a6d0ffd8e5 | 106 | #endif /* USBHOST_3GMODULE */ |
gert_lauritsen | 61:52a6d0ffd8e5 | 107 | |
gert_lauritsen | 61:52a6d0ffd8e5 | 108 | #endif |