Apple Notification Center service--ancs "Turn"

Source: Internet
Author: User
Tags notification center

Apple Notification Center Service

Transferred from: http://studentdeng.github.io/blog/2014/03/22/ancs/

MAR 22ND, 2014 | COMMENTS

noun explanation and agreement
    • Apple Notification Center Service is referred to as ANCS.
    • Publisher of ANCS Services (iOS devices, such as IPHONE,IPAD, etc.) is known as Notification Provider.
    • The client (Hardware device, accessory) of any ANCs service is called Notification Consumer.
    • Generic Attribute profile short for GATT.
    • Notifications that are displayed in iOS notificationcenter are called iOS notification.
    • Notices issued through GATT characteristic are called GATT notification.
    • IPhone, ipad, and other devices running iOS systems are called iOS devices
Conventions

The contents of the text file are covered by the Little-endian (small-end mode), except for the special description, which is related to the byte order. The content covered by the text file is UTF-8 except for the special description, which is related to string passing.

Note: ANCS is not guaranteed to be always there, the service is on, the shutdown mechanism is determined by the iOS system, and the Device needs to be checked to find out if ANCS exists.

Agreement content

ANCs UART profile UUID: "7905f431-b5ce-4e99-a40f-4b1e122d00d0"

The UART profile includes 3 characteristic

    • Notification Source UUID: "9FBF120D-6301-42D9-8C58-25E699A21DBD" (notifiable)
    • Control point UUID: ' 69d1d8f3-45e1-49a8-9821-9bbdfdaad9d9 ' (write with response)
    • Data Source UUID: "22EAC6E9-24D6-4BB5-BE44-B36ACE7C7BFB" (notifiable)

Device-side notification Source must be implemented. Centrol Point and Data Source are optional.

Notification Source Characteristic

Notification Source characteristic consists of 3 functions

    • New iOS device notifications
    • iOS Device Notification modification
    • iOS Device notification removal

When the device side subscribes Notification Source characteristic, the GATT Notification is distributed immediately. Therefore, Notification consumer (Device) needs to be ready to accept and process messages immediately before subscribe.

Notification Source Response Format

Figure 2-1 Notification Source characteristic through the format of the GATT Notification.

    • EventID: Describes whether the notifications above the iOS device are added, deleted, or modified.
    • EventFlags: Flag bit, description iOS device notification (important, silent)
    • Categoryid:ios Device Notification type
    • Categorycount: The number of notifications for a given type, such as 2 unread email notifications, with a new unread message notification push to the iOS device, Categorycount = 3 Notificationuid: The only indication of the notification, This field is used with control point characteristic to retrieve more information.

Description of Table 3-1:categoryid

Notification Source Response Example

The data that Device obtains for this notification source is "00 01 00 01 43 00 00 00"

Figure 2-2 The life cycle of an iOS notification.

For example, when an iOS device (such as an iphone) receives a imessage message, iOS Notificationcenter generates a notification,ancs that notifies the device that there is a new notification. iOS not Ificationcenter will remove this notification after the iOS device reads the imessage message, ANCs push the delete notification to device

Control Point and Data Source characteristic

Just notification source does not get enough information, Control Point and Data Source characteristic are used to solve this problem. Device writes a command to control point characteristic and, if successful, obtains response from datasource characteristic.

Get Notification Properties command

This command finds the details of the notification based on NOTIFICATIONUID (notification properties).

Figure 2-3 Get notification Properties command format CommandID: must be set to 0 NOTIFICATIONUID: Notification unique (Notification Source obtained) Attributeids: need to retrieve information list

Figure 3-5 can retrieve a list of notification properties, where title, subtitle, and Message need to add 2 bytes for the field representation length.

Get Notification Properties Command example "FF FF 05"

Get Notification Properties command Response message Format

Figure 2-4 Get notification Properties command return data format

commandid:0 Notificationuid: Unique indication of the notification AttributeList: The specific property returns a list of data. If the returned property is empty, the length is 0

If the returned data is longer than the GATT MTU, the data is transferred in several segments. Device needs to splice data.

Notification Properties command Response message Format example

Find Notificationuid 2 for Appidentifier, Title, SubTitle, Message date property to return data

Get App Properties command

This command finds the properties of the app installed on your iOS device through Appidentifier.

Figure 2-5 Getting the app Properties command format

CommandID: Must be set to 1 Appidentifier: the string ' \ "ends. Attributeids: Find list of IDs

Get App Properties Command Example

Find app Properties for Appidentifier "Com.apple.mobilemail"

Get App Properties command Response message Format

Figure 2-6 Get App Properties command return data format

    • CommandID: Must be 1
    • Appidentifier: String ' \ ' ends
    • AttributeList: The specific property returns a list of data. If the returned property is empty, the length is 0

If the returned data is longer than the GATT MTU, the data is transferred in several segments. Device needs to splice data.

Get App Properties command Response message Format example

Find app Properties appidentifier for "Com.apple.mobilemail" Return data kanji "mail"

Sessions session

The ANCS session starts with the device subscription characteristic to cancel the subscription or the disconnect ends. All identifier, such as Notificationuid,appidentifier, are valid only at the current session.

When the session is finished, the device needs to remove all identifier information obtained during the session, which notifies the device again when the session is established.

Error code
    • Unknown command: (0xA0)
    • Invalid command: (0XA1)
    • Invalid parameter (0XA2): For example, Notificationuid could not find

Note: If the above error is generated, no more GATT notifications will be received.

Reference content

Apple Notification Center Service (ANCS) specification

Posted by Studentdeng Mar 22nd, IOS

Apple Notification Center service--ancs "Turn"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.