Hello! I have been doing some research and testing with BLE on the Argon and I have ran into a compile error that I cannot track down. Below is the portion of my code that I am having trouble with…the two lines commented out:
if (svcCount > 0 && foundServiceUuid == “10AB”){
peer = BLE.connect(scanResults[ii].address, true);
BLE.stopScanning();
}
if (peer.connected()) {
Log.trace("LightBlue device is connected");
Vector<BleCharacteristic> ble_peer_all_chars = peer.discoverAllCharacteristics();
if (ble_peer_all_chars.size()) {
Log.trace("Found %u Services", ble_peer_all_chars.size());
for (int i = 0; i < ble_peer_all_chars.size(); i++){
//String CharacteristicUUID = ble_peer_all_chars[i].UUID.toString().c_str());
//Log.trace("Service : %s", (const char*)CharacteristicUUID);
}
}
} else {
Log.trace("LightBlue device NOT connected");
}
This is the compile error:
/Users/markingle/Downloads/IoTCode/Argon_BLE_Example/src/Argon_BLE_Example.ino:165:47: error: ‘ble_peer_all_services.spark::Vector<T, AllocatorT>::operator[]<particle::BleService, spark::DefaultAllocator>(i).particle::BleService::UUID’ does not have class type
String servicesUUID = ble_peer_all_services[i].UUID.toString().c_str());
The compile error is one that I am familiar with but I cannot track down the problem…I have even reviewed the spark_wire lib.
With two problematic lines commented out so that the code will compile my BLE.scan is successful with 5 devices being found and connecting to the peripheral with the service ID (10AB) I am interesting in:
0000115111 [app] TRACE: BLE.scan found 5 devices
0000115112 [app] TRACE: MAC: DA:A3:DA:39:32:6F | RSSI: -37Bm Services: 1
0000115114 [app] TRACE: LighBlue Virtual Device
0000115115 [app] TRACE: Found 1 services
0000115116 [app] TRACE: Service 0, UUID: 10AB
0000115134 [wiring.ble] TRACE: New peripheral is connected.
0000115136 [wiring.ble] TRACE: Start discovering services.
0000116261 [wiring.ble] TRACE: Start discovering characteristics.
0000122830 [app] TRACE: LightBlue device is connected
0000122832 [app] TRACE: Found 10 Services
0000122832 [app] TRACE: MAC: 23:80:B0:EC:B9:7F | RSSI: -59Bm Services: 0
0000122834 [app] TRACE:
0000122834 [app] TRACE: Found 0 services
0000122835 [app] TRACE: LightBlue device is connected
0000122837 [app] TRACE: Found 10 Services
0000122837 [app] TRACE: MAC: 45:31:98:EF:49:4D | RSSI: -72Bm Services: 0
0000122839 [app] TRACE:
0000122839 [app] TRACE: Found 0 services
0000122840 [app] TRACE: LightBlue device is connected
0000122841 [app] TRACE: Found 10 Services
0000122842 [app] TRACE: MAC: A1:2C:DA:00:F7:74 | RSSI: -69Bm Services: 0
0000122844 [app] TRACE:
0000122845 [app] TRACE: Found 0 services
0000122845 [app] TRACE: LightBlue device is connected
0000122847 [app] TRACE: Found 10 Services
0000122847 [app] TRACE: MAC: DD:6C:93:33:4A:77 | RSSI: -91Bm Services: 0
0000122849 [app] TRACE:
0000122849 [app] TRACE: Found 0 services
0000122850 [app] TRACE: LightBlue device is connected
0000122851 [app] TRACE: Found 10 Services
0000122852 [app] TRACE: Looking for characteristic
After reviewing the lib I found that the discoverAllServices AND discoverAllCharacteristics are already being called but there is no documentation on how to address any objects that have been created. The evidence that they are called is in the log trace…
0000115134 [wiring.ble] TRACE: New peripheral is connected.
0000115136 [wiring.ble] TRACE: Start discovering services.
0000116261 [wiring.ble] TRACE: Start discovering characteristics.
Does anyone have any recommendations on what to troubleshoot or examples that would clear this up? Thanks in advance for any help!