1 Reply Latest reply on Aug 17, 2018 4:34 AM by PY_21

    Democode for PSoC6  BLE central reading value from custom service

    PeDo_1397011

      Hello,

       

      my PSoC 6 acts  as a central, connects with a peripheral and try to read its data (array with 20 byte)

      with

      ****************************************

      cy_stc_ble_gattc_read_req_t   myVal;

      printf("Start reading\n\r");

       

      myVal.attrHandle = cy_ble_customCServ[CY_BLE_CUSTOMC_HEAT_COST_ALLOCATOR_SERVICE_SERVICE_INDEX].customServChar[CY_BLE_CUSTOMC_HEAT_COST_ALLOCATOR_SERVICE_SENSORDATA_CHAR_INDEX].customServCharHandle[0];

       

      myVal.connHandle = cy_ble_connHandle[0];

       

      while(Cy_BLE_GATTC_ReadCharacteristicValue(&myVal ) != CY_BLE_SUCCESS);

          printf("BLE GATTC read success\n\r");

      *********************************************

      This works without error, but where is the data?

      How to connect my empty array with the result of Cy_BLE_GATTC_ReadCharacteristicValue() ?

       

      I found only one Example for an PSoC6 Central which writes data to an peripheral.

       

      Do you have a democode for using this function ?

       

      Thanks for help!

        • 1. Re: Democode for PSoC6  BLE central reading value from custom service
          PY_21

          Hello Peter,

           

          After calling the function Cy_BLE_GATTC_ReadCharacteristicValue()  Internally, Read Request is sent to the peer GATT Server. If the read operation is successful, GATT Server sends a Read Response. This response results in CY_BLE_EVT_GATTC_READ_RSP event at GATT Client's end. This event indicates that the 'Read Response' is received from GATT Server device. The event parameter is a pointer to a structure of type cy_stc_ble_gattc_read_rsp_param_t where we can get the actual value.

           

          struct cy_stc_ble_gattc_read_rsp_param_t.

          Read response parameter type received from server. 

          Data fields:

             cy_stc_ble_gatt_value_t    value

                                          Attribute Value.

            cy_stc_ble_conn_handle_t connHandle

                                        Connection handle.

           

           

          Thanks,

          P Yugandhar.