cancel
Showing results for 
Search instead for 
Did you mean: 

How to sent variable len BLE message?

Lwang1
Associate II

I have set the data length as variable. The code generate in custom_stm.c also aci_gatt_add_char as CHAR_VALUE_LEN_VARIABLE. But in the Custom_STM_App_Update_char function, it always sent and static const charValueLen.

I fix it by cloning Custom_STM_App_Update_char and add length parameter. It works, The data I sent is not alway const length. But I don't know how to sent a variable data normally.

3 REPLIES 3
Remy ISSALYS
ST Employee

Hello,

Indeed, in the code generate, in the Custom_STM_App_Update_char function, it always sent and static const charValueLen. I think, in aci_gatt_update_char_value function you can use a sizeof(pPayload) for charValueLen in your variable length characteristic, depending how your payload is defined.

I will checked this point with the development team, to improve the feature for the next release.

Best Regards

Ugilten
Associate III

Hi @Remy ISSALYS​ ,

Unfortunately, this won't work, since you just get the size of the pointer.

the payload variable is defined as uint_8 *pPayload.

Regards

Hello,

Yes, you have right, in this case the best way is to add length parameter in Custom_STM_App_Update_char function.

Best Regards