mbed-os
Fork of mbed-os by
features/unsupported/net/cellular/UbloxUSBModem/UbloxCDMAModemInitializer.cpp@1:3deb71413561, 2017-07-20 (annotated)
- Committer:
- xuaner
- Date:
- Thu Jul 20 14:26:57 2017 +0000
- Revision:
- 1:3deb71413561
- Parent:
- 0:f269e3021894
mbed_os
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
elessair | 0:f269e3021894 | 1 | /* Copyright (c) 2010-2012 mbed.org, MIT License |
elessair | 0:f269e3021894 | 2 | * |
elessair | 0:f269e3021894 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
elessair | 0:f269e3021894 | 4 | * and associated documentation files (the "Software"), to deal in the Software without |
elessair | 0:f269e3021894 | 5 | * restriction, including without limitation the rights to use, copy, modify, merge, publish, |
elessair | 0:f269e3021894 | 6 | * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the |
elessair | 0:f269e3021894 | 7 | * Software is furnished to do so, subject to the following conditions: |
elessair | 0:f269e3021894 | 8 | * |
elessair | 0:f269e3021894 | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
elessair | 0:f269e3021894 | 10 | * substantial portions of the Software. |
elessair | 0:f269e3021894 | 11 | * |
elessair | 0:f269e3021894 | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
elessair | 0:f269e3021894 | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
elessair | 0:f269e3021894 | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
elessair | 0:f269e3021894 | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
elessair | 0:f269e3021894 | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
elessair | 0:f269e3021894 | 17 | */ |
elessair | 0:f269e3021894 | 18 | |
elessair | 0:f269e3021894 | 19 | #define __DEBUG__ 4 |
elessair | 0:f269e3021894 | 20 | #ifndef __MODULE__ |
elessair | 0:f269e3021894 | 21 | #define __MODULE__ "UbloxCDMAModemInitializer.cpp" |
elessair | 0:f269e3021894 | 22 | #endif |
elessair | 0:f269e3021894 | 23 | |
elessair | 0:f269e3021894 | 24 | #include "core/dbg.h" |
elessair | 0:f269e3021894 | 25 | |
elessair | 0:f269e3021894 | 26 | #include <stdint.h> |
elessair | 0:f269e3021894 | 27 | |
elessair | 0:f269e3021894 | 28 | #include "UbloxCDMAModemInitializer.h" |
elessair | 0:f269e3021894 | 29 | |
elessair | 0:f269e3021894 | 30 | UbloxCDMAModemInitializer::UbloxCDMAModemInitializer(USBHost* pHost) : WANDongleInitializer(pHost) |
elessair | 0:f269e3021894 | 31 | { |
elessair | 0:f269e3021894 | 32 | } |
elessair | 0:f269e3021894 | 33 | |
elessair | 0:f269e3021894 | 34 | uint16_t UbloxCDMAModemInitializer::getMSDVid() |
elessair | 0:f269e3021894 | 35 | { |
elessair | 0:f269e3021894 | 36 | return 0x05C6; |
elessair | 0:f269e3021894 | 37 | } |
elessair | 0:f269e3021894 | 38 | uint16_t UbloxCDMAModemInitializer::getMSDPid() |
elessair | 0:f269e3021894 | 39 | { |
elessair | 0:f269e3021894 | 40 | return 0x0000; //No MSD mode (presumably) |
elessair | 0:f269e3021894 | 41 | } |
elessair | 0:f269e3021894 | 42 | |
elessair | 0:f269e3021894 | 43 | uint16_t UbloxCDMAModemInitializer::getSerialVid() |
elessair | 0:f269e3021894 | 44 | { |
elessair | 0:f269e3021894 | 45 | return 0x05C6; |
elessair | 0:f269e3021894 | 46 | } |
elessair | 0:f269e3021894 | 47 | uint16_t UbloxCDMAModemInitializer::getSerialPid() |
elessair | 0:f269e3021894 | 48 | { |
elessair | 0:f269e3021894 | 49 | return 0x9004; |
elessair | 0:f269e3021894 | 50 | } |
elessair | 0:f269e3021894 | 51 | |
elessair | 0:f269e3021894 | 52 | bool UbloxCDMAModemInitializer::switchMode(USBDeviceConnected* pDev) |
elessair | 0:f269e3021894 | 53 | { |
elessair | 0:f269e3021894 | 54 | return true; |
elessair | 0:f269e3021894 | 55 | } |
elessair | 0:f269e3021894 | 56 | |
elessair | 0:f269e3021894 | 57 | int UbloxCDMAModemInitializer::getSerialPortCount() |
elessair | 0:f269e3021894 | 58 | { |
elessair | 0:f269e3021894 | 59 | return 2; |
elessair | 0:f269e3021894 | 60 | } |
elessair | 0:f269e3021894 | 61 | |
elessair | 0:f269e3021894 | 62 | /*virtual*/ void UbloxCDMAModemInitializer::setVidPid(uint16_t vid, uint16_t pid) |
elessair | 0:f269e3021894 | 63 | { |
elessair | 0:f269e3021894 | 64 | m_currentSerialIntf = 0; |
elessair | 0:f269e3021894 | 65 | m_currentEndpoint = 0; |
elessair | 0:f269e3021894 | 66 | } |
elessair | 0:f269e3021894 | 67 | |
elessair | 0:f269e3021894 | 68 | /*virtual*/ bool UbloxCDMAModemInitializer::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 |
elessair | 0:f269e3021894 | 69 | { |
elessair | 0:f269e3021894 | 70 | DBG("Interface #%d; Class:%02x; SubClass:%02x; Protocol:%02x", intf_nb, intf_class, intf_subclass, intf_protocol); |
elessair | 0:f269e3021894 | 71 | |
elessair | 0:f269e3021894 | 72 | if( intf_class == 0xFF ) { |
elessair | 0:f269e3021894 | 73 | if( m_currentSerialIntf == 0 || m_currentSerialIntf == 1) { |
elessair | 0:f269e3021894 | 74 | m_serialIntfMap[m_currentSerialIntf++] = intf_nb; |
elessair | 0:f269e3021894 | 75 | return true; |
elessair | 0:f269e3021894 | 76 | } |
elessair | 0:f269e3021894 | 77 | m_currentSerialIntf++; |
elessair | 0:f269e3021894 | 78 | } |
elessair | 0:f269e3021894 | 79 | |
elessair | 0:f269e3021894 | 80 | return false; |
elessair | 0:f269e3021894 | 81 | } |
elessair | 0:f269e3021894 | 82 | |
elessair | 0:f269e3021894 | 83 | /*virtual*/ bool UbloxCDMAModemInitializer::useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir) //Must return true if the endpoint will be used |
elessair | 0:f269e3021894 | 84 | { |
elessair | 0:f269e3021894 | 85 | DBG("USBEndpoint on Interface #%d; Type:%d; Direction:%d Current %d", intf_nb, type, dir, m_currentEndpoint); |
elessair | 0:f269e3021894 | 86 | if(type == BULK_ENDPOINT) { |
elessair | 0:f269e3021894 | 87 | if( intf_nb == 1 || intf_nb == 0) { |
elessair | 0:f269e3021894 | 88 | m_currentEndpoint++; |
elessair | 0:f269e3021894 | 89 | return true; |
elessair | 0:f269e3021894 | 90 | } else { |
elessair | 0:f269e3021894 | 91 | m_currentEndpoint++; |
elessair | 0:f269e3021894 | 92 | } |
elessair | 0:f269e3021894 | 93 | } |
elessair | 0:f269e3021894 | 94 | |
elessair | 0:f269e3021894 | 95 | /* |
elessair | 0:f269e3021894 | 96 | if(type == INTERRUPT_ENDPOINT) { |
elessair | 0:f269e3021894 | 97 | if( intf_nb == 1) { |
elessair | 0:f269e3021894 | 98 | m_currentEndpoint++; |
elessair | 0:f269e3021894 | 99 | return true; |
elessair | 0:f269e3021894 | 100 | } else { |
elessair | 0:f269e3021894 | 101 | m_currentEndpoint++; |
elessair | 0:f269e3021894 | 102 | } |
elessair | 0:f269e3021894 | 103 | } |
elessair | 0:f269e3021894 | 104 | */ |
elessair | 0:f269e3021894 | 105 | |
elessair | 0:f269e3021894 | 106 | return false; |
elessair | 0:f269e3021894 | 107 | } |
elessair | 0:f269e3021894 | 108 | |
elessair | 0:f269e3021894 | 109 | |
elessair | 0:f269e3021894 | 110 | /*virtual*/ int UbloxCDMAModemInitializer::getType() |
elessair | 0:f269e3021894 | 111 | { |
elessair | 0:f269e3021894 | 112 | return WAN_DONGLE_TYPE_UBLOX_LISAC200; |
elessair | 0:f269e3021894 | 113 | } |
elessair | 0:f269e3021894 | 114 |