MCPcopy Create free account
hub / github.com/BruceDevices/firmware / addDevice

Method addDevice

src/modules/ble/BLE_Suite.cpp:40–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40void ScannerData::addDevice(
41 const String &name, const String &address, int rssi, bool fastPair, bool hasHFP, uint8_t type
42) {
43 if (xSemaphoreTake(mutex, portMAX_DELAY)) {
44 bool isDuplicate = false;
45 for (size_t i = 0; i < deviceAddresses.size(); i++) {
46 if (deviceAddresses[i] == address) {
47 isDuplicate = true;
48 deviceRssi[i] = rssi;
49 break;
50 }
51 }
52 if (!isDuplicate) {
53 deviceNames.push_back(name);
54 deviceAddresses.push_back(address);
55 deviceRssi.push_back(rssi);
56 deviceFastPair.push_back(fastPair);
57 deviceHasHFP.push_back(hasHFP);
58 deviceTypes.push_back(type);
59 foundCount++;
60 }
61 xSemaphoreGive(mutex);
62 }
63}
64
65void ScannerData::clear() {
66 if (xSemaphoreTake(mutex, portMAX_DELAY)) {

Callers 1

selectTargetFromScanFunction · 0.45

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected