Apple Notification Center Service (ANCS) Client

The ANCS Client library is used for implementation of the Apple Notification Center Service (ANCS) client.

Note

Disclaimer: Nordic Semiconductor ASA can change the client implementation of the Apple Notification Center Service at any time. Apple can change the server implementations such as the ones found in iOS at any time, which may cause this client implementation to stop working.

Overview

The ANCS client can be used as a Notification Consumer (NC) that receives data notifications from a Notification Provider (NP). The NP is typically an iOS device that is acting as a server. For detailed information about the Apple Notification Center Service, see Apple Developer Documentation.

In this library, iOS notifications are received through the GATT notifications.

Note

The term notification is used in two different meanings:

  • An iOS notification is the data received from the Notification Provider.

  • A GATT notification is a way to transfer data with Bluetooth® Low Energy.

iOS notification and GATT notification are used where required to avoid confusion.

Configuration

Upon initializing the library, add different iOS notification attributes you want to receive for iOS notifications (see bt_ancs_register_attr()).

Once a connection is established with a central device, the library needs a service discovery to discover the ANCS server handles. If this succeeds, the handles for the ANCS server must be assigned to an ANCS client instance using the bt_ancs_handles_assign() function.

The application can now subscribe to iOS notifications with bt_ancs_subscribe_notification_source().

Usage

The notifications arrive through the callback function of the notification source subscription.

Use the following functions to perform activities related to notifications:

msc {
hscale = "2.0";
Application, ANCS_Client;
|||;
Application=>ANCS_Client   [label = "bt_ancs_client_init(ancs_instance)"];
Application=>ANCS_Client   [label = "bt_ancs_register_attr(attribute)"];
...;
Application=>ANCS_Client   [label = "bt_ancs_handles_assign(dm, ancs_instance)"];
Application=>ANCS_Client   [label = "bt_ancs_subscribe_notification_source(ancs_instance, callback)"];
Application=>ANCS_Client   [label = "bt_ancs_subscribe_data_source(ancs_instance, callback)"];
|||;
...;
|||;
Application<<=ANCS_Client  [label = "notification_source callback(notif)"];
|||;
...;
|||;
Application=>ANCS_Client   [label = "bt_ancs_request_attrs(notif)"];
Application<<=ANCS_Client  [label = "data_source callback(attr_response)"];
|||;
}

Samples using the library

The Bluetooth: Peripheral ANCS client sample uses this library.

Dependencies

There are no dependencies for using this library.

API documentation

Header file: include/bluetooth/services/ancs_client.h
Source files:
  • subsys/bluetooth/services/ancs_client.c

  • subsys/bluetooth/services/ancs_attr_parser.c

  • subsys/bluetooth/services/ancs_app_attr_get.c

Apple Notification Service Client