added debugging

Fork of BLE_nRF8001 by RedBearLab

Revision:
2:7805a5595aab
Parent:
0:075ea2812998
--- 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() {