skaner

Dependencies:   BLE_API TextLCD mbed nRF51822

Fork of BLE_LEDBlinker by Bluetooth Low Energy

Revision:
1:1db45b17552e
Parent:
0:415d7f24cb91
Child:
2:3e1e967035cb
diff -r 415d7f24cb91 -r 1db45b17552e main.cpp
--- a/main.cpp	Fri Jun 05 14:40:15 2015 +0000
+++ b/main.cpp	Mon Jun 08 06:26:18 2015 +0000
@@ -22,7 +22,7 @@
 BLEDevice  ble;
 DigitalOut led1(LED1);
 
-bool ledCharacteristicDiscovered = false;
+bool triggerLedCharacteristic = false;
 DiscoveredCharacteristic ledCharacteristic;
 
 void periodicCallback(void) {
@@ -55,9 +55,9 @@
 
 void characteristicDiscoveryCallback(const DiscoveredCharacteristic *characteristicP) {
     printf("  C UUID-%x valueAttr[%u] props[%x]\r\n", characteristicP->getShortUUID(), characteristicP->getValueHandle(), (uint8_t)characteristicP->getProperties().broadcast());
-    if (characteristicP->getShortUUID() == 0xa001) {
-        ledCharacteristic           = *characteristicP;
-        ledCharacteristicDiscovered = true;
+    if (characteristicP->getShortUUID() == 0xa001) { /* !ALERT! Alter this filter to suit your device. */
+        ledCharacteristic        = *characteristicP;
+        triggerLedCharacteristic = true;
     }
 }
 
@@ -113,8 +113,8 @@
     ble.startScan(advertisementCallback);
 
     while (true) {
-        if (ledCharacteristicDiscovered && !ble.isServiceDiscoveryActive()) {
-            ledCharacteristicDiscovered = false;
+        if (triggerLedCharacteristic && !ble.isServiceDiscoveryActive()) {
+            triggerLedCharacteristic = false;
             ledCharacteristic.read(); /* We could have issued this read just as easily from
                                        * characteristicDiscoveryCallback(); but
                                        * this demonstrates the use of