1 Reply Latest reply on Sep 11, 2019 5:53 AM by PY_21

    Problem to read local attributes

    DaGa_4352226

      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

        • 1. Re: Problem to read local attributes
          PY_21

          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.