Ble for smart sOlutions

Dependencies:   Adafruit_WS2801

Revision:
11:d6ed1437c2ee
Parent:
10:d845189d146e
diff -r d845189d146e -r d6ed1437c2ee source/BleDevice.h
--- a/source/BleDevice.h	Fri Jun 14 10:24:57 2019 +0200
+++ b/source/BleDevice.h	Thu Jun 20 13:20:24 2019 +0200
@@ -123,7 +123,7 @@
             _event_queue(event_queue),
             _handle(0),
             _is_connecting(false),
-            hi(false){ };
+            has_interest_char(false){ };
 
     virtual ~BleDevice()
     {
@@ -230,33 +230,7 @@
                discovered_service->getEndHandle()
         );
     }
-    /**
-       * Add a discovered characteristic into the list of discovered characteristics.
-       */
-//    bool add_characteristic(const DiscoveredCharacteristic *characteristic)
-//    {
-//        //TODO: If char UUID == UUID, store char for reading
-//        if
-//        printf("Adding char");
-//
-////        if (new_node == false) {
-////            printf("Error while allocating a new characteristic.\r\n");
-////            return false;
-////        }
-//        printf("Added char");
-//
-//        if (_characteristics == NULL) {
-//            _characteristics = const_cast<DiscoveredCharacteristic *>(characteristic);
-//        } else {
-//            DiscoveredCharacteristic* c = _characteristics;
-//            while() {
-//                c = c->next;
-//            }
-//            c->next = new_node;
-//        }
-//        delete new_node;
-//        return true;
-//    }
+
     /**
      * Handle characteristics discovered.
      *
@@ -271,7 +245,6 @@
         printf("\tCharacteristic discovered: uuid = ");
         print_uuid(discovered_characteristic->getUUID());
         printf(", properties = ");
-//        print_properties(discovered_characteristic->getProperties());
         printf(
                 ", decl handle = %u, value handle = %u, last handle = %u.\r\n",
                 discovered_characteristic->getDeclHandle(),
@@ -280,7 +253,7 @@
         );
         if(discovered_characteristic->getUUID() == CustomUUIDs::UUID_INTEREST_CHAR){
             printf("You have the interest char!");
-            hi = true;
+            has_interest_char = true;
             _interest_characteristic = discovered_characteristic;
         }
     }
@@ -295,7 +268,7 @@
      */
     void when_service_discovery_ends(Gap::Handle_t connection_handle)
     {
-        if (!hi) {
+        if (!has_interest_char) {
             printf("No characteristics discovered, end of the process.\r\n");
             return;
         }
@@ -369,8 +342,7 @@
         }
         printf(".\r\n");
 
-//        Characteristic value at 6 equal to: 0xFF 0x00 0xFF 0x04 0xFF 0x55 0xFF 0x01 0x05 0x05 0x05 0x07 0xFF 0xFF 0xFF 0x06 0xFF 0xEE 0xFF 0x09 .
-        //TODO: Nummer op pos 3, 7, 11, 15, 19 vergelijken met mijn interesses. Als er eentje overeen komt, licht dan op.
+        //TODO: Lelijke code ombouwen naar loop
         for(int i = 3; i < 20; i += 4){
             int targetInterest = read_event->data[i];
             printf("Let's see if there's a match between you guys..\r\n");
@@ -440,9 +412,6 @@
         _event_queue.break_dispatch();
         //And/or resume advertising?
     };
-    virtual void compareInterests(const GattReadCallbackParams *read_event){
-
-    }
 
     virtual void onAdvertisingEnd(const ble::AdvertisingEndEvent &)
     {
@@ -480,7 +449,7 @@
     events::EventQueue &_event_queue;
     ble::connection_handle_t _handle;
     bool _is_connecting;
-    bool hi;
+    bool has_interest_char;
     const DiscoveredCharacteristic *_interest_characteristic;
 
 };