Hi,
I am able to successfully run the arduino BLE_Custom_Service example as seen below on my RAK 4630 RUI3 board.
I added a second, custom test service -blood pressure measurement- with its own characteristic, which runs fine on its own (in isolation). Unfortunately, the moment I start both the example heart rate service and my blood pressure measurement service, the code seems to hang.
I was wondering whether there exists any tutorial or example code for running more than one service simultaneously.
beegee
(Bernd Giesecke)
October 11, 2024, 9:03am
2
You can have only one BLE Service and then multiple characteristics in it.
The example code does exactly this (it is just a little bit confusing in the code)
One service:
RAKBleService hrms = RAKBleService(base_uuid);
First characteristic
RAKBleCharacteristic hrmc = RAKBleCharacteristic(UUID16_CHR_HEART_RATE_MEASUREMENT);
Second characteristic
RAKBleCharacteristic bslc = RAKBleCharacteristic(UUID16_CHR_BODY_SENSOR_LOCATION);
Set properites, permissions, callbacks, … for the two characteristics:
hrms.begin();
hrmc.setProperties(RAK_CHR_PROPS_NOTIFY);
hrmc.setPermission(RAK_SET_OPEN);
hrmc.setFixedLen(2);
hrmc.setCccdWriteCallback(cccd_callback);
hrmc.begin();
delay(1000);
uint8_t hrmdata[2] = {0x39, 0x40};
hrmc.notify(hrmdata);
delay(1000);
// Body Sensor Location
// 0 = Other
// 1 = Chest
// 2 = Wrist
// 3 = Finger
// 4 = Hand
// 5 = Ear Lobe
// 6 = Foot
// 7:255 = Reserved
bslc.setProperties(RAK_CHR_PROPS_READ);
bslc.setPermission(RAK_SET_OPEN);
bslc.setFixedLen(1);
bslc.setWriteCallback(send_callback);
bslc.begin();
D.Moniatis
(D.Moniatis)
October 15, 2024, 6:52am
3
Thank you very much for the clarification !
system
(system)
Closed
October 25, 2024, 6:52am
4
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.