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

ANCS with NUS on nRF51822

I saw an ANCS examples in sdk5.1.0(softdevice=6.0.0), and then I put this example to port to sdk4.4.2 (softdevice=5.2.1) and the example worked perfectly. But when I put the case into a complex project including many services, ANCS is not working properly.

Problems is in the step of searching service: when it run sd_ble_gattc_primary_services_discover(), the event's gatt_status in event_discover_rsp() of ble_ancs_c.c is 0x010a after running sd_ble_gattc_primary_services_discover() . And then, when I donot intial the NUS service or Initial ANCS before NUS, ANCS is running normally. What is the reason?

Attached here is my project. Sdk=4.4.2, softdevice=5.2.1

tcl_ancs.rar

  • All ATT Error codes are defined in ble_gatt.h, and as you can see there, 0x010A is BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_FOUND. This means that the GATT Client can't find the ANCS service in the attribute table of the iPhone. I've seen this happen right after the iPhone has been restarted, but I wouldn't expect this to happen when the iPhone is already running. Also, which iOS version do you run on your phone?

    However, beware that it will not be possible to implement a complete ANCS client with S110 version 5.2.1, primarily becaues it doesn't support doing Long Write as a GATT Client, and this is required to do the Get App Attributes command. This is not yet implemented in the ANCS example of the SDK, but will probably be in future releases.

Related