Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue adding Descriptors to Arduino Nano 33 BLE #312

Open
dntpannik opened this issue Jul 23, 2023 · 1 comment
Open

Issue adding Descriptors to Arduino Nano 33 BLE #312

dntpannik opened this issue Jul 23, 2023 · 1 comment
Labels
type: imperfection Perceived defect in any part of project

Comments

@dntpannik
Copy link

dntpannik commented Jul 23, 2023

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.

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.

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

@dntpannik
Copy link
Author

I've done some more investigating via my iOS app, and I'm finding that the descriptor exists, but the value isn't being set. Seems like it's nul.

@per1234 per1234 added the type: imperfection Perceived defect in any part of project label Jul 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

2 participants