Arduino Nana 33 BLE and ArduinoBLE using setEventHandler function for BLERead

Hello

Using a Arduino Nano 33 BLE for a Fitness Machine Service on a Bike Trainer
Library in question is ArduinoBLE

I have no problems using the setEventHander to call a function when one of my characteristics is written to. This same characteristic I am required to write a response and in the Service Specification I am required to confirm that the client (central) has read my response (in the specification this is termed Handle Value Verification).

I have tried to use the setEventHandler with the BLERead property with my routine to call but this, from what I can tell, it is never called.

My characteristic is setup a

BLEService FitnessMachineService("1826");
BLECharacteristic myCharacteristic("1826", BLERead | BLEBroadcast, 3);
BLECharacteristic fitMachFeaturesChars("2ACC", BLERead,8);
BLECharacteristic indBikeChar("2AD2", BLERead | BLENotify,bikedata);
BLECharacteristic trngStatusChar("2AD3", BLENotify | BLERead, 2);
BLECharacteristic fitMachCtrlPntChar("2AD9", BLEIndicate | BLEWrite,19);
BLECharacteristic fitnessMachineStatusCharacteristic("2ADA", BLENotify, 7);

and my set event handler that works fine (on the client write) is calling my routine fitMachCtrlPntCharWritten

// Set Event Handler for Client Write in Fitness Machine Control Point
fitMachCtrlPntChar.setEventHandler(BLEWritten, fitMachCtrlPntCharWritten);

I have tried to add a similar event handler for read confirmation after I modify the characteristic with a response using the item below but the fitMachCtrlPntCharRead routine is never called.

// Set Event Handler for Client Read in Fitness Machine Control Point
fitMachCtrlPntChar.setEventHandler(BLERead, fitMachCtrlPntCharRead);

Am I missing something in the characteristic attributes when trying to use the BLERead as an event handler?

This is also required in the User Data Specification where I need to send a long list of users through a single characteristic in chunks of data and with the only acknowledgement from the client being this Handle Value Confirmation (that the read the chunk).

Thanks

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.