Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistently change device index to singed integer in BluetoothSerial lib #6109

Merged
merged 2 commits into from
Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions libraries/BluetoothSerial/src/BTScan.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ class BTScanResults {

virtual void dump(Print *print = nullptr);
virtual int getCount();
virtual BTAdvertisedDevice* getDevice(uint32_t i);
virtual BTAdvertisedDevice* getDevice(int i);
};

class BTScanResultsSet : public BTScanResults {
public:
void dump(Print *print = nullptr);
int getCount();
BTAdvertisedDevice* getDevice(uint32_t i);
BTAdvertisedDevice* getDevice(int i);

bool add(BTAdvertisedDeviceSet advertisedDevice, bool unique = true);
void clear();

std::map<std::string, BTAdvertisedDeviceSet> m_vectorAdvertisedDevices;
};

#endif
#endif
6 changes: 3 additions & 3 deletions libraries/BluetoothSerial/src/BTScanResultsSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ int BTScanResultsSet::getCount() {
* @param [in] i The index of the device.
* @return The device at the specified index.
*/
BTAdvertisedDevice* BTScanResultsSet::getDevice(uint32_t i) {
BTAdvertisedDevice* BTScanResultsSet::getDevice(int i) {
if (i < 0)
return nullptr;

uint32_t x = 0;
int x = 0;
BTAdvertisedDeviceSet* pDev = &m_vectorAdvertisedDevices.begin()->second;
for (auto it = m_vectorAdvertisedDevices.begin(); it != m_vectorAdvertisedDevices.end(); it++) {
pDev = &it->second;
Expand All @@ -92,4 +92,4 @@ bool BTScanResultsSet::add(BTAdvertisedDeviceSet advertisedDevice, bool unique)
return false;
}

#endif
#endif