0

I'm writing some bluetooth application using the Nano 33 BLE. I was trying to use the addDescriptor method as described in the ArduinoBLE documentation but I'm finding that the descriptor isn't actually being added. Library

I found an example on stack overflow where a user posted their code and a screenshot from a scanner like nRF connect showing the descriptors. Example

I copied this code and am still not finding the descriptors. Here is the code in question.

#include <ArduinoBLE.h>

BLEService echoService("00000000-0000-1000-8000-00805f9b34fb");
BLEStringCharacteristic charac ("741c12b9-e13c-4992-8a5e-fce46dec0bff", BLERead | BLEWrite | BLENotify,40);
BLEDescriptor Descriptor("beca6057-955c-4f8a-e1e3-56a1633f04b1","Descriptor");
String var = "";


void setup() {
  // put your setup code here, to run once:
 Serial.begin(9600);
  while(!Serial);

  if(!BLE.begin()){
    Serial.println("starting BLE failed.");
    while(1);
  }

  
  BLE.setLocalName("Arduino BLE Echo");
  BLE.setAdvertisedService(echoService);
  charac.addDescriptor(Descriptor);
  echoService.addCharacteristic(charac);
  BLE.addService(echoService);
  BLE.advertise();

  Serial.print("Descriptor Count: ");
  Serial.println(charac.descriptorCount());
  
  Serial.println("Bluetooth device active, waiting for connections...");
  Serial.println(" ");
}

void loop() {
  // put your main code here, to run repeatedly:

}

I'm outputting the number of descriptors and that's coming back as zero. Connecting to the device in nRF connect shows the expected service/characteristic, but no descriptors. I've verified this with 2 different BLE scanner apps and with my iOS app.

I'm really unsure what I'm doing wrong. Hopefully someone can point me in a direction.

Thanks

I've tried creating this code in several different ways from scratch, first myself using the library documentation, and then several other times using examples I found online. I've verified the lack of descriptor using 3 different BLE scanning apps and via the iOS app I'm creating. In all instances the Service/Characteristic are present, but no descriptors.

With my code I'm expecting to see descriptors in the BLE scanners, in the output from the arduino sketch, and via my app.

DntPannik
  • 31
  • 6
  • I've done some more investigating via my iOS app and it seems like the descriptor exists, but its value is null. – DntPannik Jul 23 '23 at 18:24

0 Answers0