How to read characteristics with a GATT client?

I am currently using an nrf52840 to write to a service with 3 different characteristics with goal of using another dongle to read those characteristics. The first dongle is writing characteristics using the ble_gatts_hvx_params_t struct and I am able to view the characteristic value using the nrf connect app. When I try to receive using a dongle, however, I based everything off of the central examples from the SDK. From what I see, however, is that every example uses its own client file that has many structures and functions defined to be able to create an event handler. Looking at the gattc header file, however, it does not seem to have the same structs and functions to handle the event. Right now I am struggling to extract the data values from the characteristics. 

Parents
  • Hello,

    You can chek our peripheral_uart and central_uart samples. I hope you would get the idea how to read characteristics from a GATT client. 

    I would like to explain a bit details on Monday.

    Thanks.

    Have a nice weekend.

    Best Regards,

    Kazi Afroza Sultana

  • Hi Kazi,

    I took a look at those examples you suggested, and I still have the same confusion of understanding the handler function. It seemed like with the uart examples still uses structs and functions defined in the nus client file which is designed specifically for the example. I guess I am still having confusion on how to extract from the GATT client file and how it relates to the uart example.

  • Hello,

    We have a basic training document for Bluetooth Low Energy  which shows how to create custom service with custom value characteristics. There you can find the use of structures and functions and use of call back functions.  GitHub - edvinand/custom_ncs_ble_service_sample .You can look at this training document. Though it has one peripheral but it helps to understand how NUS client works. 

    Thanks.

    Best Regards,

    Kazi Afroza Sultana

  • Hi Kazi,

    I already understand how to create a service with custom characteristic values. I currently have one nrf52840 dongle doing that and accomplishing everything as desired. My issue I'm running to right now is using another dongle or devkit to be able to receive those characteristics. My teammate wrote the service and characteristics using the ble_gatts_hvx_params_t struct found in the ble_gatts.h file, and using the nrfconnect app I can see the following: . My goal is to be able to store the hex values from each characteristic in a separate dongle that is receiving the ble signal. I am still confused how to go about this because both the uart examples and the link you sent me do not make it clear how to read custom characteristics. Any future insight would be appreciated and sorry for any inconvenience.

  • Hello,

    You have one DK and one Dongle. You want to read the characteristics from dongle to DK. You can run the application currently developing on he DK. Now you want to develop the central, you have to flash the peripheral on the dongle and central on the DK. It is easier to debug in this way. 

    You also can look at the ble_app_uart_c example. If you want can send us the project and show which part is not clear to understand.

    Thanks.

    Best Regards,

    Kazi Afroza Sultana

Reply
  • Hello,

    You have one DK and one Dongle. You want to read the characteristics from dongle to DK. You can run the application currently developing on he DK. Now you want to develop the central, you have to flash the peripheral on the dongle and central on the DK. It is easier to debug in this way. 

    You also can look at the ble_app_uart_c example. If you want can send us the project and show which part is not clear to understand.

    Thanks.

    Best Regards,

    Kazi Afroza Sultana

Children
No Data
Related