I need to develop a small batch of items with the Arduino Nano BLE 33 with the ArduinoBLE library. Does anybody know the best way to name the things in a batch?
I tried to set up a BLE characteristic with no success:
void changeNameCharWritten(BLEDevice central, BLECharacteristic characteristic)
{
BLE.setLocalName(changeNameChar.value);
BLE.setDeviceName(changeNameChar.value);
}
The argument is static.
Is there any other way to do it or do I need to write a specific firmware for each device?
The documentation does not suggest that changing the name is not possible.
Looking at the implementation of BLELocalDevice::advertise()
I would assume that you need to call BLE.advertise()
to update the name after you did set it.
To extend your example:
void changeNameCharWritten(BLEDevice central, BLECharacteristic characteristic)
{
BLE.setLocalName(changeNameChar.value);
BLE.setDeviceName(changeNameChar.value);
// BLE.stopAdvertise() might be needed before
BLE.advertise()
}