写入长characteristic value

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
2 posts / 0 new
Last post
jarirenejensen
Offline
Last seen:1 year 1 month ago
加入:2017-02-05 14:44
写入长characteristic value

Reading the "Training_02_custom_profile_example_v1.1" it states that the long characteristic in user_custs1_def.h "Demonstrate writes to long characteristic value". It is defined as being 50 bytes long. But I do not see code handling the writes to this characteristic.
Form
https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bl...
It seems that the stack should be able to handle characteristic of up to 512 bytes in size.
I can of cause R/W 20 bytes but not more. I am using the user_catch_rest_hndl() function of the example and catching SVC1_IDX_CONTROL_POINT_VAL. In the example this calls an empty function. The signal contains only the first 20 bytes.
To test I have ben using Bluegiga GUI tool to send the data 50bytes, that seems happy writing 50 bytes but not 51 bytes which is OK as the size is 50. Reading using read or read long yields only 20 bytes.
Where do you hide the code "demonstrating writes to long characteristic value"?

Best Regards

Device:
PM_Dialog
Offline
Last seen:2 days 13 hours ago
工作人员
加入:2018-02-08 11:03
嗨jarirenejensen,

嗨jarirenejensen,

The ble_app_peripheral example of the SDK implements the Write Long Characteristic Value. Please, take a look at this example of the SDK. If the length of the characteristic value to be written is greater than 20 bytes, then the user_svc1_long_val_att_info_req_handler() in the user_catch_rest_hndl() function will be triggered. If the length is less than 20 bytes the user_svc1_long_val_wr_ind_handler () will be executed. So, if you want to send more than 20 bytes without MTU exchange, you should do the same implementation as in the user_svc1_long_val_att_info_req_handler() function of the ble_app_peripheral example. Since you do that, the master will send a “Prepare Write Request” and the slave will response with a “Prepare Write Response”. Otherwise, if you want to do a simple write request and send more than 20 bytes, you should increase the MTU size.

Thanks, PM_Dialog