Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5d10cba

Browse files
Use case insensitive comparison for UUID or address string inputs
1 parent 458ae5e commit 5d10cba

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

‎src/BLECharacteristic.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ bool BLECharacteristic::hasDescriptor(const char* uuid, int index) const
382382
for (int i = 0; i < numDescriptors; i++) {
383383
BLERemoteDescriptor* d = _remote->descriptor(i);
384384

385-
if (strcmp(uuid, d->uuid()) == 0) {
385+
if (strcasecmp(uuid, d->uuid()) == 0) {
386386
if (count == index) {
387387
return true;
388388
}
@@ -418,7 +418,7 @@ BLEDescriptor BLECharacteristic::descriptor(const char * uuid, int index) const
418418
for (int i = 0; i < numDescriptors; i++) {
419419
BLERemoteDescriptor* d = _remote->descriptor(i);
420420

421-
if (strcmp(uuid, d->uuid()) == 0) {
421+
if (strcasecmp(uuid, d->uuid()) == 0) {
422422
if (count == index) {
423423
return BLEDescriptor(d);
424424
}

‎src/BLEDevice.cpp‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ bool BLEDevice::hasService(const char* uuid, int index) const
310310
for (int i = 0; i < numServices; i++) {
311311
BLERemoteService* s = device->service(i);
312312

313-
if (strcmp(uuid, s->uuid()) == 0) {
313+
if (strcasecmp(uuid, s->uuid()) == 0) {
314314
if (count == index) {
315315
return true;
316316
}
@@ -352,7 +352,7 @@ BLEService BLEDevice::service(const char * uuid, int index) const
352352
for (int i = 0; i < numServices; i++) {
353353
BLERemoteService* s = device->service(i);
354354

355-
if (strcmp(uuid, s->uuid()) == 0) {
355+
if (strcasecmp(uuid, s->uuid()) == 0) {
356356
if (count == index) {
357357
return BLEService(s);
358358
}
@@ -405,7 +405,7 @@ bool BLEDevice::hasCharacteristic(const char* uuid, int index) const
405405
BLERemoteCharacteristic* c = s->characteristic(j);
406406

407407

408-
if (strcmp(c->uuid(), uuid) == 0) {
408+
if (strcasecmp(c->uuid(), uuid) == 0) {
409409
if (count == index) {
410410
return true;
411411
}
@@ -468,7 +468,7 @@ BLECharacteristic BLEDevice::characteristic(const char * uuid, int index) const
468468
for (int j = 0; j < numCharacteristics; j++) {
469469
BLERemoteCharacteristic* c = s->characteristic(j);
470470

471-
if (strcmp(c->uuid(), uuid) == 0) {
471+
if (strcasecmp(c->uuid(), uuid) == 0) {
472472
if (count == index) {
473473

474474
return BLECharacteristic(c);

‎src/BLEService.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ bool BLEService::hasCharacteristic(const char* uuid, int index) const
122122
for (int i = 0; i < numCharacteristics; i++) {
123123
BLERemoteCharacteristic* c = _remote->characteristic(i);
124124

125-
if (strcmp(uuid, c->uuid()) == 0) {
125+
if (strcasecmp(uuid, c->uuid()) == 0) {
126126
if (count == index) {
127127
return true;
128128
}
@@ -158,7 +158,7 @@ BLECharacteristic BLEService::characteristic(const char * uuid, int index) const
158158
for (int i = 0; i < numCharacteristics; i++) {
159159
BLERemoteCharacteristic* c = _remote->characteristic(i);
160160

161-
if (strcmp(uuid, c->uuid()) == 0) {
161+
if (strcasecmp(uuid, c->uuid()) == 0) {
162162
if (count == index) {
163163
return BLECharacteristic(c);
164164
}

‎src/utility/ATT.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ bool ATTClass::discoverAttributes(uint8_t peerBdaddrType, uint8_t peerBdaddr[6],
193193
for (int i = 0; i < serviceCount; i++) {
194194
BLERemoteService* service = device->service(i);
195195

196-
if (strcmp(service->uuid(), serviceUuidFilter) == 0) {
196+
if (strcasecmp(service->uuid(), serviceUuidFilter) == 0) {
197197
// found an existing service with same UUID
198198
return true;
199199
}

‎src/utility/GAP.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,11 +328,11 @@ void GAPClass::handleLeAdvertisingReport(uint8_t type, uint8_t addressType, uint
328328

329329
bool GAPClass::matchesScanFilter(const BLEDevice& device)
330330
{
331-
if (_scanAddressFilter.length() > 0 && _scanAddressFilter != device.address()) {
331+
if (_scanAddressFilter.length() > 0 && !(_scanAddressFilter.equalsIgnoreCase(device.address()))) {
332332
return false; // drop doesn't match
333333
} else if (_scanNameFilter.length() > 0 && _scanNameFilter != device.localName()) {
334334
return false; // drop doesn't match
335-
} else if (_scanUuidFilter.length() > 0 && _scanUuidFilter != device.advertisedServiceUuid()) {
335+
} else if (_scanUuidFilter.length() > 0 && !(_scanUuidFilter.equalsIgnoreCase(device.advertisedServiceUuid()))) {
336336
return false; // drop doesn't match
337337
}
338338

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /