cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 6

DaGa_4352226
New Contributor II

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

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

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
Top labels