2 Replies Latest reply on Jul 26, 2019 8:18 PM by BrSg_4288716

    How to read and write in a BLE server using PCOC 4 as client (custom Profile)

    BrSg_4288716

      Hello,

       

      I'm currently building a BLE CLIENT in PSOC 4 BLE.

      Using the tutorials and examples provided here i was able to make the full GAP communication and connect to my peripheral device making it a GAT server.

       

      But currently i not sure how to start exchanging information, like writing in the server, reading information or subscribing for notifications.

      As i'm using a Custom profile i saw comments saying that i should use functions like: CyBle_GattcReadCharacteristicValue() and  CyBle_GattcWriteCharacteristicValue().

       

      But the keep returning CYBLE_GATT_ERR_INVALID_HANDLE. How do i write the characteristic handle in these functions?

       

      For example i have a characteristic i want to read at 0x0201.

       

      How do i transform this in the in the right format?

       

       

       

      @Edit:

       

      After some more looking in to it i found the way i should do this but have no ideia on how to implement this, the steps should be:

      1) Discover the services and Characteristics using the functions: CyBle_GattcDiscoverAllPrimaryServices() and CyBle_GattcDiscoverAllCharacteristics().

      2) This should create some sort of handle for each of the services and Characteristics.

      3) I have to put this handle inside some sort of structure and send it as the second parameter of the read and write functions.

       

      Is this right? Could anyone more experienced shed some light?

       

       

      @Edit2:

       

      There may be another way that i also am not able to make it work by using CyBle_GattcReadUsingCharacteristicUuid() and etc.

      It also does not acept my CYBLE_GATTC_READ_BY_TYPE_REQ_T as a valid parameter an returns invalid parameter.

       

       

      Thanks!