Problem to read local attributes

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

cross mob
DaGa_4352226
Level 2
Level 2
10 questions asked 5 replies posted 5 questions asked

Hello Community

I am trying to read attributes values local from my server in order to process a write value peer but when the sever runs the method Cy_BLE_GATTS_ReadAttributeValueLocal, the  server/app stop and I dont give any cy_en_ble_gatt_err_code_t.

my code is the following

bool CheckRemainingTreatments(cy_stc_ble_gatts_write_cmd_req_param_t* writeReq)

{

    cy_en_ble_gatt_err_code_t apiResult;

    cy_stc_ble_gatt_handle_value_pair_t attributeInfo =  { .attrHandle = CY_BLE_TREATMENT_REMAINING_TREAMENTS_CHAR_HANDLE,

                                                          .value.len = CY_BLE_REMAINING_TREATMENTS_SIZE};

    apiResult = Cy_BLE_GATTS_ReadAttributeValueLocal(&writeReq->connHandle, &attributeInfo);

    if (apiResult != CY_BLE_GATT_ERR_NONE)

    {

        DBG_PRINTF("Cy_BLE_GATTS_ReadAttributeValueLocal, error %0x \r\n", apiResult);

        return false;

    }

    else

    {

         DBG_PRINTF("Treatements %p", attributeInfo.value.val);

        return true;

    }

}

Am I using correctly the ReadAttributeValueLocal() method? The PsOC is a 6 and Kit CY8CKIT-062-BLE

Thanks, regards

David

0 Likes
1 Solution
Yugandhar
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 5 likes given

Hello David,

Please define the Output Data buffer where you want to store the data. Please add the below code.

cy_stc_ble_gatt_handle_value_pair_t attributeInfo =  { .attrHandle = CY_BLE_TREATMENT_REMAINING_TREAMENTS_CHAR_HANDLE,

                                                                                        .value.val=dataBuf,  //Array where we want to store the data

                                                                                        .value.len = CY_BLE_REMAINING_TREATMENTS_SIZE};

Thanks,

P Yugandhar.

View solution in original post

0 Likes
1 Reply
Yugandhar
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 5 likes given

Hello David,

Please define the Output Data buffer where you want to store the data. Please add the below code.

cy_stc_ble_gatt_handle_value_pair_t attributeInfo =  { .attrHandle = CY_BLE_TREATMENT_REMAINING_TREAMENTS_CHAR_HANDLE,

                                                                                        .value.val=dataBuf,  //Array where we want to store the data

                                                                                        .value.len = CY_BLE_REMAINING_TREATMENTS_SIZE};

Thanks,

P Yugandhar.

0 Likes