Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

PSoC™ 6 Forum Discussions

PaSw_2578827
Level 4
Level 4
25 replies posted 10 replies posted 10 questions asked

I have an AIOS service with multiple Analog characteristics. I registered a service callback and I want to handle the data that's getting written to the Analog service, it seems as though there is no way to tell which specific characteristic is being written.

In the callback I get the following: 
cy_stc_ble_conn_handle_t connHandle;         // < Peer device handle
cy_en_ble_aios_char_index_t charIndex;       // < Index of service characteristic
uint8_t charInstance;                                                // < Instance of specific service characteristic
cy_stc_ble_gatt_value_t *value;                          // < Characteristic value
cy_en_ble_gatt_err_code_t gattErrorCode;   // < GATT error code for access control  

 

It seems as though charInstance should change but it is always 0x00 regardless of which characteristic I'm writing.

0 Likes
1 Solution

I take this back, after digging through the code I saw where the correct characteristic index should be set (Cy_BLE_AIOSS_WriteEventHandler() in cy_ble_aios.c). It turns out that the app I was using was actually not sending to the correct characteristic regardless of which one I selected in the list. I used a different app and the charInstance is correctly being set, so it is doing what it's supposed to be.

View solution in original post

0 Likes
3 Replies
Charles_Lai
Moderator
Moderator
Moderator
250 replies posted 100 solutions authored 100 replies posted

Hi,

Try to follow the correct Write command flow. It requires both the central and the peripheral to deal with the Write_Event to finally have the value changed. See:
https://iotexpert.com/ble-write-request-write-command-signed-write-command-prepare-write/

And you can use the CySmart suite to test the Read/Write operations.

Best regards

0 Likes

I'm not sure that anything in that link you sent is applicable to the question I asked. I have no problem getting the value from within the PSoC application, I just can't tell which characteristic the server was trying to write too.

I've used CySmart but it doesn't recognise the Automation IO service so I was using LightBlue but it doesn't recognise multiple characteristics of the same type within a single service, so I've been using GattBrowser from Renesas which works well. Using the app can write to all of the characteristics within that single service without issue but in my event handler the BLE stack isn't telling me which characteristic is being written.

0 Likes

I take this back, after digging through the code I saw where the correct characteristic index should be set (Cy_BLE_AIOSS_WriteEventHandler() in cy_ble_aios.c). It turns out that the app I was using was actually not sending to the correct characteristic regardless of which one I selected in the list. I used a different app and the charInstance is correctly being set, so it is doing what it's supposed to be.

0 Likes