Closed grandinquisitor closed 7 years ago
Ah, I wasn't parsing the return value for the time service. It's actually getting the device name instead.
Hi @grandinquisitor,
From what I remember, the order you add the remote attributes in very important. Please try the following:
blePeripheral.addRemoteAttribute(remoteGenericAttributeService);
blePeripheral.addRemoteAttribute(remoteDeviceNameCharacteristic);
blePeripheral.addRemoteAttribute(timeService);
blePeripheral.addRemoteAttribute(remoteTimeCharacteristic);
The remote characteristic is associated with the last remote service added.
Closing for now due to lack of activity.
I took the remote_service example and modified it to try to also use the current time service.
I found that only one worked at a time - and it depended on the order in which you call addRemoteAttribute() on the characteristic. When you add the time characteristic first it responds but not device name, if you switch the order of the addRemoteAttribute() statements then only device name responds with a value. I looked through the code and didn't find any obvious reason why this should be. I tried adding delay()'s in various places and moving lots of other code pieces around to no effect.
In addition, time service worked if you gave it either the property BLERead or BLENotify exclusively, but would not work if I chose (BLERead | BLENotify).
I'm using a Teensy 3.2 and the Arduino IDE and the Adafruit nrf8001 board.