forked from espressif/arduino-esp32
Consistently change device index to singed integer in BluetoothSerial lib (#6109)
* change parameter to signed int As of wrong paramater, the following problem existed, that will be fixed now with this change. BTScanResultsSet.cpp:67:8: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] if (i < 0) * Change parameter and variable to int As of wrong paramater, the following problem existed, that will be fixed now with this change. BTScanResultsSet.cpp:67:8: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] if (i < 0)
This commit is contained in:
@ -24,14 +24,14 @@ public:
|
|||||||
|
|
||||||
virtual void dump(Print *print = nullptr);
|
virtual void dump(Print *print = nullptr);
|
||||||
virtual int getCount();
|
virtual int getCount();
|
||||||
virtual BTAdvertisedDevice* getDevice(uint32_t i);
|
virtual BTAdvertisedDevice* getDevice(int i);
|
||||||
};
|
};
|
||||||
|
|
||||||
class BTScanResultsSet : public BTScanResults {
|
class BTScanResultsSet : public BTScanResults {
|
||||||
public:
|
public:
|
||||||
void dump(Print *print = nullptr);
|
void dump(Print *print = nullptr);
|
||||||
int getCount();
|
int getCount();
|
||||||
BTAdvertisedDevice* getDevice(uint32_t i);
|
BTAdvertisedDevice* getDevice(int i);
|
||||||
|
|
||||||
bool add(BTAdvertisedDeviceSet advertisedDevice, bool unique = true);
|
bool add(BTAdvertisedDeviceSet advertisedDevice, bool unique = true);
|
||||||
void clear();
|
void clear();
|
||||||
@ -39,4 +39,4 @@ public:
|
|||||||
std::map<std::string, BTAdvertisedDeviceSet> m_vectorAdvertisedDevices;
|
std::map<std::string, BTAdvertisedDeviceSet> m_vectorAdvertisedDevices;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -63,11 +63,11 @@ int BTScanResultsSet::getCount() {
|
|||||||
* @param [in] i The index of the device.
|
* @param [in] i The index of the device.
|
||||||
* @return The device at the specified index.
|
* @return The device at the specified index.
|
||||||
*/
|
*/
|
||||||
BTAdvertisedDevice* BTScanResultsSet::getDevice(uint32_t i) {
|
BTAdvertisedDevice* BTScanResultsSet::getDevice(int i) {
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
uint32_t x = 0;
|
int x = 0;
|
||||||
BTAdvertisedDeviceSet* pDev = &m_vectorAdvertisedDevices.begin()->second;
|
BTAdvertisedDeviceSet* pDev = &m_vectorAdvertisedDevices.begin()->second;
|
||||||
for (auto it = m_vectorAdvertisedDevices.begin(); it != m_vectorAdvertisedDevices.end(); it++) {
|
for (auto it = m_vectorAdvertisedDevices.begin(); it != m_vectorAdvertisedDevices.end(); it++) {
|
||||||
pDev = &it->second;
|
pDev = &it->second;
|
||||||
@ -92,4 +92,4 @@ bool BTScanResultsSet::add(BTAdvertisedDeviceSet advertisedDevice, bool unique)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user