Services BLE RAK11720

i try use BLE custom service with de API, but the propiertis for characteristics only accept CHR_PROPS_NOTIFY/CHR_PROPS_READ, I don’t know if with the new firmware the API can accept write characteristics or is it under development.

I need help,

thanks

Hello @and-tecnipak,

You are right. You cannot create a write characteristic with current firmware. You must change these two files to fix problem.

…/cores/apollo3/component/core/mcu/apollo3/uhal/uhal_cus.c
…/cores/apollo3/component/rui_v3_api/RAKBleUart.h

fixes.zip (5.6 KB)

You can add a write characteristic like below:

    bslc.setProperties((RAK_CHARS_PROPERTIES) (RAK_CHR_PROPS_WRITE | RAK_CHR_PROPS_READ));
    bslc.setPermission(RAK_SET_OPEN);
    bslc.setFixedLen(1);
    bslc.setWriteCallback(send_callback);
    bslc.begin();
    delay(1000);
    uint8_t sensor_location = 2;
    bslc.write(&sensor_location);	// Set the characteristic to 'Wrist' (2)

Please be aware that these additions can cause problems. Testing is your responsibility. Also, I will inform R&D team to add this feature for next releases.

Best regards,
Sercan.

Hello Sercan,

Thanks for your response, can you explain me where’s this files to replace, I use de vscode for programming RAK, this files is a files for library of RAK11720 or how I will to replace this files?

For calling the write characteristic I use .setWriteCallback(send_callback);? Can you explain me with a example plis?

thanks, regards

Hello Andres,

Firstly, please install board support package according to this link: RAK11720 WisDuo LPWAN+BLE Module Quick Start Guide

After that, please check this link to find your Arduino15 folder.

You can find RAK11720 board support package inside “…/Arduino15/packages/rak_rui/hardware/apollo3/” folder.

At the end, you must change following files with my version (I shared previously.):
…/cores/apollo3/component/core/mcu/apollo3/uhal/uhal_cus.c
…/cores/apollo3/component/rui_v3_api/RAKBleUart.h

Again, the better way is to wait following RUI3 versions.

Please check custom service example to get more detailed information: BLE Custom Service | RAKwireless Documentation Center

Best regards,
Sercan.