added debugging

Fork of BLE_nRF8001 by RedBearLab

Files at this revision

API Documentation at this revision

Comitter:
jn80842
Date:
Mon Nov 10 01:24:23 2014 +0000
Parent:
1:e9a412d69201
Commit message:
just added debugging

Changed in this revision

BLE_nRF8001/BLEPeripheral.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r e9a412d69201 -r 7805a5595aab BLE_nRF8001/BLEPeripheral.cpp
--- a/BLE_nRF8001/BLEPeripheral.cpp	Mon Oct 20 14:33:43 2014 +0800
+++ b/BLE_nRF8001/BLEPeripheral.cpp	Mon Nov 10 01:24:23 2014 +0000
@@ -39,6 +39,7 @@
 }
 
 void BLEPeripheral::begin() {
+  serial.printf("called to begin\r\n");
   unsigned char advertisementData[20];
   unsigned char scanData[20];
 
@@ -46,6 +47,7 @@
   unsigned char scanDataLength = 0;
 
   if (this->_advertisedServiceUuid){
+    serial.printf("we have an advertised service uuid\r\n");
     BLEUuid advertisedServiceUuid = BLEUuid(this->_advertisedServiceUuid);
     unsigned char advertisedServiceUuidLength = advertisedServiceUuid.length();
 
@@ -68,33 +70,38 @@
   }
 
   if (this->_localName){
+    serial.printf("we have a local name\r\n");
     unsigned char originalLocalNameLength = strlen(this->_localName);
     unsigned char localNameLength = originalLocalNameLength;
-
+    serial.printf("ok local name variables set up\r\n");
     if (localNameLength > sizeof(scanData)) {
       localNameLength = sizeof(scanData);
     }
-
+    serial.printf("set scan length\r\n");
     scanDataLength = 2 + localNameLength;
 
     scanData[0] = (originalLocalNameLength > sizeof(scanData)) ? 0x08 : 0x09;
     scanData[1] = localNameLength;
-
+    serial.printf("set up scanData arr\r\n");
     memcpy(&scanData[2], this->_localName, localNameLength);
+    serial.printf("done dealing with local name\r\n");
   }
-
+  serial.printf("ok look at %d attributes now\r\n", this->_numAttributes);
   for (int i = 0; i < this->_numAttributes; i++) {
+    //serial.printf("cycled through attribute %d\r\n",i);
     BLEAttribute* attribute = this->_attributes[i];
     if (attribute->type() == BLETypeCharacteristic) {
+     // serial.printf("found a characteristic\r\n");
       BLECharacteristic* characteristic = (BLECharacteristic*)attribute;
 
       characteristic->setValueChangeListener(*this);
     }
   }
-
+  serial.printf("now really beginning\r\n");
   this->_nRF8001.begin(advertisementData, advertisementDataLength, scanData, scanDataLength, this->_attributes, this->_numAttributes);
-
+  serial.printf("now request address\r\n");
   this->_nRF8001.requestAddress();
+  serial.printf("we are done beginning!\r\n");
 }
 
 void BLEPeripheral::poll() {