This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Not sure how to use sd_ble_gattc_write in Central

I want to enable Notifications in my Central for a particular characteristic advertised by my Peripheral. There's example code that is supposed to do this in the BLE Central tutorial but my version isn't working and I can't find any documentation that explains how this works.

Parents
  • Hello!

    All client examples include this action. For example the ble_nus_c example. (Either from github or SDK 10)

    I will try to break it down for you.

    When discovering services, you save the handle of cccd descriptors of the discovered characteristics. You should use the db_discovery module for discovering services. Doing this manually (with sd_ble_gattc_primary_services_discover) is possible, but is a lot of work.

    When you want to turn on notifications on a characterisic, you write the cccd of that characterisitc to "1". You write it using the sd_ble_gattc_write function. After turning on notifications, the peripheral is able to send you notifications of new values on the characteristic.

    Let me know if anything is unclear, or if you want a more detailed explanation.

    -Anders

Reply
  • Hello!

    All client examples include this action. For example the ble_nus_c example. (Either from github or SDK 10)

    I will try to break it down for you.

    When discovering services, you save the handle of cccd descriptors of the discovered characteristics. You should use the db_discovery module for discovering services. Doing this manually (with sd_ble_gattc_primary_services_discover) is possible, but is a lot of work.

    When you want to turn on notifications on a characterisic, you write the cccd of that characterisitc to "1". You write it using the sd_ble_gattc_write function. After turning on notifications, the peripheral is able to send you notifications of new values on the characteristic.

    Let me know if anything is unclear, or if you want a more detailed explanation.

    -Anders

Children
No Data
Related