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