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

Committer:
bogdanm
Date:
Thu Oct 17 13:06:33 2013 +0300
Revision:
1:71286b99c1cb
Child:
2:4be5e62433b1
Initial release of the UbloxUSBModem library

Who changed what in which revision?

UserRevisionLine numberNew 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 1:71286b99c1cb 30 uint16_t UbloxCDMAModemInitializer::getMSDVid()
bogdanm 1:71286b99c1cb 31 {
bogdanm 1:71286b99c1cb 32 return 0x05C6;
bogdanm 1:71286b99c1cb 33 }
bogdanm 1:71286b99c1cb 34 uint16_t UbloxCDMAModemInitializer::getMSDPid()
bogdanm 1:71286b99c1cb 35 {
bogdanm 1:71286b99c1cb 36 return 0x0000; //No MSD mode (presumably)
bogdanm 1:71286b99c1cb 37 }
bogdanm 1:71286b99c1cb 38
bogdanm 1:71286b99c1cb 39 uint16_t UbloxCDMAModemInitializer::getSerialVid()
bogdanm 1:71286b99c1cb 40 {
bogdanm 1:71286b99c1cb 41 return 0x05C6;
bogdanm 1:71286b99c1cb 42 }
bogdanm 1:71286b99c1cb 43 uint16_t UbloxCDMAModemInitializer::getSerialPid()
bogdanm 1:71286b99c1cb 44 {
bogdanm 1:71286b99c1cb 45 return 0x9004;
bogdanm 1:71286b99c1cb 46 }
bogdanm 1:71286b99c1cb 47
bogdanm 1:71286b99c1cb 48 bool UbloxCDMAModemInitializer::switchMode(USBDeviceConnected* pDev)
bogdanm 1:71286b99c1cb 49 {
bogdanm 1:71286b99c1cb 50 return true;
bogdanm 1:71286b99c1cb 51 }
bogdanm 1:71286b99c1cb 52
bogdanm 1:71286b99c1cb 53 int UbloxCDMAModemInitializer::getSerialPortCount()
bogdanm 1:71286b99c1cb 54 {
bogdanm 1:71286b99c1cb 55 return 2;
bogdanm 1:71286b99c1cb 56 }
bogdanm 1:71286b99c1cb 57
bogdanm 1:71286b99c1cb 58 /*virtual*/ void UbloxCDMAModemInitializer::setVidPid(uint16_t vid, uint16_t pid)
bogdanm 1:71286b99c1cb 59 {
bogdanm 1:71286b99c1cb 60 m_currentSerialIntf = 0;
bogdanm 1:71286b99c1cb 61 m_currentEndpoint = 0;
bogdanm 1:71286b99c1cb 62 }
bogdanm 1:71286b99c1cb 63
bogdanm 1:71286b99c1cb 64 /*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 65 {
bogdanm 1:71286b99c1cb 66 DBG("Interface #%d; Class:%02x; SubClass:%02x; Protocol:%02x", intf_nb, intf_class, intf_subclass, intf_protocol);
bogdanm 1:71286b99c1cb 67
bogdanm 1:71286b99c1cb 68 if( intf_class == 0xFF ) {
bogdanm 1:71286b99c1cb 69 if( m_currentSerialIntf == 0 || m_currentSerialIntf == 1) {
bogdanm 1:71286b99c1cb 70 m_serialIntfMap[m_currentSerialIntf++] = intf_nb;
bogdanm 1:71286b99c1cb 71 return true;
bogdanm 1:71286b99c1cb 72 }
bogdanm 1:71286b99c1cb 73 m_currentSerialIntf++;
bogdanm 1:71286b99c1cb 74 }
bogdanm 1:71286b99c1cb 75
bogdanm 1:71286b99c1cb 76 return false;
bogdanm 1:71286b99c1cb 77 }
bogdanm 1:71286b99c1cb 78
bogdanm 1:71286b99c1cb 79 /*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 80 {
bogdanm 1:71286b99c1cb 81 DBG("USBEndpoint on Interface #%d; Type:%d; Direction:%d Current %d", intf_nb, type, dir, m_currentEndpoint);
bogdanm 1:71286b99c1cb 82 if(type == BULK_ENDPOINT) {
bogdanm 1:71286b99c1cb 83 if( intf_nb == 1 || intf_nb == 0) {
bogdanm 1:71286b99c1cb 84 m_currentEndpoint++;
bogdanm 1:71286b99c1cb 85 return true;
bogdanm 1:71286b99c1cb 86 } else {
bogdanm 1:71286b99c1cb 87 m_currentEndpoint++;
bogdanm 1:71286b99c1cb 88 }
bogdanm 1:71286b99c1cb 89 }
bogdanm 1:71286b99c1cb 90
bogdanm 1:71286b99c1cb 91 /*
bogdanm 1:71286b99c1cb 92 if(type == INTERRUPT_ENDPOINT) {
bogdanm 1:71286b99c1cb 93 if( intf_nb == 1) {
bogdanm 1:71286b99c1cb 94 m_currentEndpoint++;
bogdanm 1:71286b99c1cb 95 return true;
bogdanm 1:71286b99c1cb 96 } else {
bogdanm 1:71286b99c1cb 97 m_currentEndpoint++;
bogdanm 1:71286b99c1cb 98 }
bogdanm 1:71286b99c1cb 99 }
bogdanm 1:71286b99c1cb 100 */
bogdanm 1:71286b99c1cb 101
bogdanm 1:71286b99c1cb 102 return false;
bogdanm 1:71286b99c1cb 103 }
bogdanm 1:71286b99c1cb 104
bogdanm 1:71286b99c1cb 105
bogdanm 1:71286b99c1cb 106 /*virtual*/ int UbloxCDMAModemInitializer::getType()
bogdanm 1:71286b99c1cb 107 {
bogdanm 1:71286b99c1cb 108 return WAN_DONGLE_TYPE_UBLOXC200;
bogdanm 1:71286b99c1cb 109 }
bogdanm 1:71286b99c1cb 110