Skip to content

Commit a4da762

Browse files
committed
Removed references to specific initializers from the code
1 parent ae2e7c3 commit a4da762

File tree

3 files changed

+10
-114
lines changed

3 files changed

+10
-114
lines changed

libraries/USBHost/USB3GModule/WANDongle.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ bool WANDongle::disconnect()
130130
return true;
131131
}
132132

133-
WAN_DONGLE_TYPE WANDongle::getDongleType()
133+
int WANDongle::getDongleType()
134134
{
135135
if( m_pInitializer != NULL )
136136
{
@@ -221,7 +221,7 @@ void WANDongle::init()
221221

222222
bool WANDongle::addInitializer(WANDongleInitializer* pInitializer)
223223
{
224-
if (m_totalInitializers >= MAX_DEVICE_CONNECTED)
224+
if (m_totalInitializers >= WANDONGLE_MAX_INITIALIZERS)
225225
return false;
226226
m_Initializers[m_totalInitializers++] = pInitializer;
227227
return true;

libraries/USBHost/USB3GModule/WANDongle.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class WANDongle : public IUSBEnumerator {
7373
*/
7474
bool disconnect();
7575

76-
WAN_DONGLE_TYPE getDongleType();
76+
int getDongleType();
7777

7878
IUSBHostSerial& getSerial(int index);
7979
int getSerialCount();
@@ -100,7 +100,7 @@ class WANDongle : public IUSBEnumerator {
100100
int m_serialCount;
101101

102102
int m_totalInitializers;
103-
WANDongleInitializer* m_Initializers[MAX_DEVICE_CONNECTED];
103+
WANDongleInitializer* m_Initializers[WANDONGLE_MAX_INITIALIZERS];
104104
};
105105

106106
#endif /* USBHOST_3GMODULE */

libraries/USBHost/USB3GModule/WANDongleInitializer.h

Lines changed: 6 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,16 @@ using std::uint32_t;
3030
#include "USBHost.h"
3131
#include "IUSBEnumerator.h"
3232

33-
enum WAN_DONGLE_TYPE
34-
{
35-
WAN_DONGLE_TYPE_UNKNOWN = -1,
36-
WAN_DONGLE_TYPE_VODAFONEK3770 = 0,
37-
WAN_DONGLE_TYPE_VODAFONEK3772Z = 1,
38-
WAN_DONGLE_TYPE_UBX = 2,
39-
};
40-
33+
// [TODO] move these declarations to a proper place
4134
#define WANDONGLE_MAX_SERIAL_PORTS 2
35+
#define WANDONGLE_MAX_INITIALIZERS 6
36+
37+
#define WAN_DONGLE_TYPE_UNKNOWN (-1)
4238

4339
class WANDongleInitializer : public IUSBEnumerator
4440
{
4541
protected:
46-
WANDongleInitializer(USBHost* pHost);
42+
WANDongleInitializer(USBHost* pHost) { m_pHost = pHost; }
4743
USBHost* m_pHost;
4844
uint8_t m_serialIntfMap[WANDONGLE_MAX_SERIAL_PORTS];
4945

@@ -68,109 +64,9 @@ class WANDongleInitializer : public IUSBEnumerator
6864

6965
virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir) = 0; //Must return true if the endpoint will be used
7066

71-
virtual WAN_DONGLE_TYPE getType() = 0;
67+
virtual int getType() = 0;
7268

7369
virtual uint8_t getSerialIntf(int index) { return m_serialIntfMap[index]; }
74-
75-
static WANDongleInitializer** getInitializers(USBHost* pHost);
76-
};
77-
78-
class VodafoneK3770Initializer : public WANDongleInitializer
79-
{
80-
public:
81-
VodafoneK3770Initializer(USBHost* pHost);
82-
83-
virtual uint16_t getMSDVid();
84-
virtual uint16_t getMSDPid();
85-
86-
virtual uint16_t getSerialVid();
87-
virtual uint16_t getSerialPid();
88-
89-
virtual bool switchMode(USBDeviceConnected* pDev);
90-
91-
virtual USBEndpoint* getEp(USBDeviceConnected* pDev, int serialPortNumber, bool tx);
92-
93-
virtual int getSerialPortCount();
94-
95-
virtual void setVidPid(uint16_t vid, uint16_t pid);
96-
97-
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
98-
99-
virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir); //Must return true if the endpoint will be used
100-
101-
virtual WAN_DONGLE_TYPE getType();
102-
103-
private:
104-
105-
bool m_hasSwitched;
106-
int m_currentSerialIntf;
107-
int m_endpointsToFetch;
108-
};
109-
110-
class VodafoneK3772ZInitializer : public WANDongleInitializer
111-
{
112-
public:
113-
VodafoneK3772ZInitializer(USBHost* pHost);
114-
115-
virtual uint16_t getMSDVid();
116-
virtual uint16_t getMSDPid();
117-
118-
virtual uint16_t getSerialVid();
119-
virtual uint16_t getSerialPid();
120-
121-
virtual bool switchMode(USBDeviceConnected* pDev);
122-
123-
virtual USBEndpoint* getEp(USBDeviceConnected* pDev, int serialPortNumber, bool tx);
124-
125-
virtual int getSerialPortCount();
126-
127-
virtual void setVidPid(uint16_t vid, uint16_t pid);
128-
129-
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
130-
131-
virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir); //Must return true if the endpoint will be used
132-
133-
virtual WAN_DONGLE_TYPE getType();
134-
135-
private:
136-
137-
bool m_hasSwitched;
138-
int m_currentSerialIntf;
139-
int m_endpointsToFetch;
140-
};
141-
142-
//-----------------------------------------------------------------------
143-
// mamm, u-blox Modem
144-
//-----------------------------------------------------------------------
145-
146-
class UbxInitializer : public WANDongleInitializer
147-
{
148-
public:
149-
UbxInitializer(USBHost* pHost);
150-
151-
virtual uint16_t getMSDVid();
152-
virtual uint16_t getMSDPid();
153-
154-
virtual uint16_t getSerialVid();
155-
virtual uint16_t getSerialPid();
156-
157-
virtual bool switchMode(USBDeviceConnected* pDev);
158-
159-
virtual int getSerialPortCount();
160-
161-
virtual void setVidPid(uint16_t vid, uint16_t pid);
162-
163-
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
164-
165-
virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir); //Must return true if the endpoint will be used
166-
167-
virtual WAN_DONGLE_TYPE getType();
168-
169-
private:
170-
171-
bool m_hasSwitched;
172-
int m_currentSerialIntf;
173-
int m_endpointsToFetch;
17470
};
17571

17672
#endif /* USBHOST_3GMODULE */

0 commit comments

Comments
 (0)