This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Add CTS current time service

Hi all,

i want to add a cts service to my project. i started with ble_cts example of sdk 11.0, but it's not clear what is the correct procedure to do it. I add the service in service init and the db_ event_handler and cts_event_handler in my project. But the problem is that softdevice don't receive the BLE_GATTC_EVT_CHAR_DISC_RSP. There is other thing that i must done? What is the correct procedure to add a service current time?

Thank you!!

  • I don't understand if it's necessary to add a characteristics gatt or not. Because in the example don't use it. Also, i use a peer manager for the connection and not device_manager. Regards.

  • FormerMember
    0 FormerMember

    In general, when adding a service, what you need to add is everything that is specific for that service. From looking at ble_app_cts_c, it should a least be the following:

    • Services_init()
    • The discovery module:
    • db_discovery_init()
    • db_disc_handler(..)
    • ble_db_discovery_on_ble_evt(..): should be added in ble_evt_dispatch(..)
    • ble_cts_c_on_ble_evt(..): should bed added in ble_evt_dispatch(..)
    • on_cts_c_evt() :

    Functions that you may consider to take a look at:

    • on_ble_evt(..)
    • current_time_print()

    Let me know if it still doesn't work after adding everything from the above list.

  • Hy Krisitin,

    thank you for the answer. I add all things about the service:

    • initialization of service cts in service_init();
    • initialization of db disc discovery in my main();
    • add db_disc_handler
    • Add ble_conn_state_on_ble_evt and ble_cts_c_on_ble_evt in my ble_evt_dispatch
    • Finally the on_cts_c_evt().

    I debug the example ble_app_cts_c and i see that after the connection softdevice send event BLE_GATTC_EVT_CHAR_DISC_RSP to db_discovery_on_ble_evt. The problem is that MY progect this events not oocurs... And i don't know why. It's not clear how the sfotdevice send a events that are processed from ble_evt_dispatch...

    One different from my project and ble_app_cts_c is that i use a peer manager and in the example use a device_manager_init.

    Thank you, Anna

  • FormerMember
    0 FormerMember in reply to FormerMember

    Do you have an extra nRF51-DK or a nRF51-Dongle? If so, could you use the sniffer to check how/if the service/characteristic discovery takes place? And upload then sniffer trace here?

    The sniffer should be used with Wireshark, and it works best with version 1.10, not one of the newer versions. Wireshark can be downloaded here:

  • I understand what happens. I don't start the db_discovery_manager (ble_db_discovery_start), that is implemented in the device_manager but not in peer_manager. I add it and now seems that it works... Thank you!!

Related