ANCS/AMS client (ancs_c)

This section describes the implemented profiles, services, user interactions, and testing methods for the ANCS and AMS Client application.

Implemented profile and services

The ANCS/AMS Client application implements both an ANCS and an AMS Client for the custom ANCS Service and AMS Service available on iOS mobile devices.

Check the documentation available on the iOS website for details about the ANCS or AMS services, their characteristics, and supported features.

The demo application acts as a GAP Peripheral that advertises a service solicitation for the custom ANCS Service, followed by a solicitation to the AMS Service. It also acts as a GATT Client once connected to a device that offers the ANCS/AMS Service. The application offers some services such as the role of GATT Server.

Once connected to a mobile device offering the ANCS/AMS Service, the application displays information about ANCS Notifications received from that device. This information is followed by the AMS track information (Artist, Album, Title, Duration in seconds). The application also displays the possible remote commands that the device state allows (such as Play, Pause, VolumeUp, VolumeDown). The notifications are received via ATT Notifications, for which the ANCS Client must register on the peer ANCS Server. The same must be done for the AMS server. It initially configures the information that it wants to be notified about. The application also retrieves and displays additional information about the received ANCS notifications. For this purpose, it writes commands to specified characteristics on the ANCS/AMS Server and receives responses via ATT Notifications from other characteristics. All information is displayed to the user using a shell available over a serial communications interface.

Accessing the ANCS Service and AMS Service requires Bluetooth LE security to be enabled.

Parent topic:ANCS/AMS client (ancs_c)

Supported platforms

The ANCS/AMS Client application is supported on the following platform:

  • KW45B41Z-EVK

  • K32W148-EVK

  • FRDM-MCXW71

Parent topic:ANCS/AMS client (ancs_c)

User interface

After flashing the board, the device is in idle mode (all LEDs flashing). To start advertising, press the ADVSW button. When in GAP Discoverable Mode, CONNLED is flashing. When the ANCS/AMS Server (Gap Central) connects to the ANCS/AMS Client (GAP Peripheral), CONNLED turns solid. To disconnect, hold the ADVSW for 2-3 seconds. The ANCS/AMS Client then re-enters the advertising state.

For displaying operating information and ANCS Notifications (AMS information and commands), the demo application uses a shell exposed via a serial communication interface.

See Table 1 for hardware references.

Platform

ADVSW

CONNLED

KW45B41Z-EVK / K32W148-EVK

SW2

LED2

FRDM-MCXW71

SW2

Blue LED

KW47-EVK / MCXW72-EVK

SW2

LED1

FRDM-MCXW72

SW4

Blue LED

Parent topic:ANCS/AMS client (ancs_c)

Usage

The ANCS/AMS Client demo application is designed to work with a peer mobile device that exposes the ANCS and AMS service. Also, a serial terminal application is required for displaying ANCS Notifications information and AMS commands and information.

  • Open a serial terminal application on the PC and connect it to the serial port corresponding to the board on which the ANCS/AMS Client runs. See the details in Testing devices, “User Interface”. A start screen is displayed immediately after the board is reset. All LEDs must be flashing as shown in the figure below.

    Start screen for ANCS/AMS Client demo application

  • Press the ADVSW button to start advertising. This instruction is also displayed in the serial terminal as shown in the figure above.

  • The peer device starts scanning for Bluetooth LE devices and connects to the ANCS/AMS Client device that is advertising.

  • Once connected to a peer, the application looks for the ANCS Service and AMS Service and their characteristics. If they are found, the ANCS Client tries to register for receiving notifications and AMS for the tracking data and commands. See Figure 2.

  • If any security-related ATT errors are encountered, then the application automatically performs Pairing and Bonding and retries the failed ATT operations. Depending on the negotiated pairing method, user interaction might be needed to complete the Pairing. Follow the onscreen instructions provided by both the ANCS/AMS Client and the mobile device. If the ANCS/AMS Client generates a passkey, then the default 999999 passkey is used. See the figure below that shows a ‘Pairing is successful’ message.
    Pairing is successful message

  • After bidirectional communication is established via GATT, the ANCS/AMS Client starts displaying ANCS Notifications information as shown in the figure below.
    ANCS Notifications

  • The combination of the two services (ANCS and AMS) is shown in the two figures below.

  • If no media is playing and no player is active, the serial interface looks as shown in the figure below.

    AMS no active player

  • When media is playing, a player is active and the state must look similar to the figure below.
    AMS with player active

Parent topic:ANCS/AMS client (ancs_c)

Parent topic:Bluetooth LE stack and demo applications