Removed references to specific initializers from the code

pull/93/head
Bogdan Marinescu 2013-10-16 15:47:46 +03:00
parent ae2e7c3051
commit a4da762016
3 changed files with 10 additions and 114 deletions

View File

@ -130,7 +130,7 @@ bool WANDongle::disconnect()
return true;
}
WAN_DONGLE_TYPE WANDongle::getDongleType()
int WANDongle::getDongleType()
{
if( m_pInitializer != NULL )
{
@ -221,7 +221,7 @@ void WANDongle::init()
bool WANDongle::addInitializer(WANDongleInitializer* pInitializer)
{
if (m_totalInitializers >= MAX_DEVICE_CONNECTED)
if (m_totalInitializers >= WANDONGLE_MAX_INITIALIZERS)
return false;
m_Initializers[m_totalInitializers++] = pInitializer;
return true;

View File

@ -73,7 +73,7 @@ public:
*/
bool disconnect();
WAN_DONGLE_TYPE getDongleType();
int getDongleType();
IUSBHostSerial& getSerial(int index);
int getSerialCount();
@ -100,7 +100,7 @@ protected:
int m_serialCount;
int m_totalInitializers;
WANDongleInitializer* m_Initializers[MAX_DEVICE_CONNECTED];
WANDongleInitializer* m_Initializers[WANDONGLE_MAX_INITIALIZERS];
};
#endif /* USBHOST_3GMODULE */

View File

@ -30,20 +30,16 @@ using std::uint32_t;
#include "USBHost.h"
#include "IUSBEnumerator.h"
enum WAN_DONGLE_TYPE
{
WAN_DONGLE_TYPE_UNKNOWN = -1,
WAN_DONGLE_TYPE_VODAFONEK3770 = 0,
WAN_DONGLE_TYPE_VODAFONEK3772Z = 1,
WAN_DONGLE_TYPE_UBX = 2,
};
// [TODO] move these declarations to a proper place
#define WANDONGLE_MAX_SERIAL_PORTS 2
#define WANDONGLE_MAX_INITIALIZERS 6
#define WAN_DONGLE_TYPE_UNKNOWN (-1)
class WANDongleInitializer : public IUSBEnumerator
{
protected:
WANDongleInitializer(USBHost* pHost);
WANDongleInitializer(USBHost* pHost) { m_pHost = pHost; }
USBHost* m_pHost;
uint8_t m_serialIntfMap[WANDONGLE_MAX_SERIAL_PORTS];
@ -68,109 +64,9 @@ public:
virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir) = 0; //Must return true if the endpoint will be used
virtual WAN_DONGLE_TYPE getType() = 0;
virtual int getType() = 0;
virtual uint8_t getSerialIntf(int index) { return m_serialIntfMap[index]; }
static WANDongleInitializer** getInitializers(USBHost* pHost);
};
class VodafoneK3770Initializer : public WANDongleInitializer
{
public:
VodafoneK3770Initializer(USBHost* pHost);
virtual uint16_t getMSDVid();
virtual uint16_t getMSDPid();
virtual uint16_t getSerialVid();
virtual uint16_t getSerialPid();
virtual bool switchMode(USBDeviceConnected* pDev);
virtual USBEndpoint* getEp(USBDeviceConnected* pDev, int serialPortNumber, bool tx);
virtual int getSerialPortCount();
virtual void setVidPid(uint16_t vid, uint16_t pid);
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
virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir); //Must return true if the endpoint will be used
virtual WAN_DONGLE_TYPE getType();
private:
bool m_hasSwitched;
int m_currentSerialIntf;
int m_endpointsToFetch;
};
class VodafoneK3772ZInitializer : public WANDongleInitializer
{
public:
VodafoneK3772ZInitializer(USBHost* pHost);
virtual uint16_t getMSDVid();
virtual uint16_t getMSDPid();
virtual uint16_t getSerialVid();
virtual uint16_t getSerialPid();
virtual bool switchMode(USBDeviceConnected* pDev);
virtual USBEndpoint* getEp(USBDeviceConnected* pDev, int serialPortNumber, bool tx);
virtual int getSerialPortCount();
virtual void setVidPid(uint16_t vid, uint16_t pid);
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
virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir); //Must return true if the endpoint will be used
virtual WAN_DONGLE_TYPE getType();
private:
bool m_hasSwitched;
int m_currentSerialIntf;
int m_endpointsToFetch;
};
//-----------------------------------------------------------------------
// mamm, u-blox Modem
//-----------------------------------------------------------------------
class UbxInitializer : public WANDongleInitializer
{
public:
UbxInitializer(USBHost* pHost);
virtual uint16_t getMSDVid();
virtual uint16_t getMSDPid();
virtual uint16_t getSerialVid();
virtual uint16_t getSerialPid();
virtual bool switchMode(USBDeviceConnected* pDev);
virtual int getSerialPortCount();
virtual void setVidPid(uint16_t vid, uint16_t pid);
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
virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir); //Must return true if the endpoint will be used
virtual WAN_DONGLE_TYPE getType();
private:
bool m_hasSwitched;
int m_currentSerialIntf;
int m_endpointsToFetch;
};
#endif /* USBHOST_3GMODULE */