a quick look at ancs (apple notification center service)

34
A Quick look at ANCS (Apple Notification Center Service) Johnny Sung

Upload: johnny-sung

Post on 28-Jul-2015

502 views

Category:

Technology


1 download

TRANSCRIPT

A Quick look at ANCS(Apple Notification Center Service)

Johnny Sung

How about

?

不只 AndroidWear 其他 BLE 開發版也可以做

其實不只AndroidWear 其他BLE開發版也可以做

http://lukeberndt.com/wp-content/uploads/2014/09/ancs-1024x641.jpg

ANCS

ANCS = Apple Notification Center Service

ANCS is to give Bluetooth accessories (that connect to iOS devices through a Bluetooth low-energy link) a simple and convenient way to access many kinds of notifications that are

generated on iOS devices.

BLE

BLE 的⾓角⾊色

以 ANCS 為例

AndroidWear iPhone

Notification Consumer (NC)

Notification Provider (NP)

ANCS Service7905F431-B5CE-4E99-A40F-4B1E122D00D0

Notification Source

Control Point

Data Source

9FBF120D-6301-42D9-8C58-25E699A21DBD

69D1D8F3-45E1-49A8-9821-9BBDFDAAD9D9

22EAC6E9-24D6-4BB5-BE44-B36ACE7C7BFB

(writeable)

(notifiable)

(notifiable)

Register Flow

Notification Source 回傳封包

• Notification Added = 0 • Notification Modified = 1 • Notification Removed = 2

EventIDNotification Source

• Other = 0 • IncomingCall = 1 • MissedCall = 2 • Voicemail = 3 • Social = 4 • Schedule = 5 • Email = 6 • News = 7 • HealthAndFitness = 8 • BusinessAndFinance = 9 • Location = 10 • Entertainment = 11

CategoryIDNotification Source

http://l8smartlight.com/

https://www.youtube.com/watch?v=is8KMmE5030https://www.youtube.com/watch?v=GV21uziG_OM

傳送

接收

0

0

傳送

AttributeID

• AppIdentifier = 0 • Title = 1 • Subtitle = 2 • Message = 3 • MessageSize = 4 • Date = 5

0

接收

• AppIdentifier = 0 • Title = 1 • Subtitle = 2 • Message = 3 • MessageSize = 4 • Date = 5

"com.apple.AppStore"

"已更新「Adobe Photoshop Mix」和其他 6 個應⽤用程式"

"App Store"

"20150324T225555"

nil

36

AttributeID

0

範例Request AttributeID

• AppIdentifier = 0 • Title = 1 • Subtitle = 2 • Message = 3 • MessageSize = 4 • Date = 5

"com.JohnnyWorks.SHRS-Radio"

"⺟母親像⽉月亮⼀一樣~古典逍遙遊祝全天下的媽媽,⺟母親節快樂!"

"世新廣播電臺"

"20150510T100002"

nil

28

Response

App Identifier = "com.apple.AppStore"

傳送

接收

AttributeID

• DisplayName = 01

1

Attribute Value = "App Store"

App Identifier = "com.apple.AppStore"

0

0

Attribute Length = 9

AttributeID = 0

AttributeID = 0

ANCS 注意事項• 字串資料都會以 UTF-8 的編碼傳遞

• 數值資料都會以 Little-endian 的⽅方式傳遞

MessageHorn

AndroidWear

References• Apple Notification Center Service (ANCS)

Specification • https://developer.apple.com/library/ios/documentation/CoreBluetooth/Reference/

AppleNotificationCenterServiceSpecification/Introduction/Introduction.html

• Core Bluetooth Programming Guide

• https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/AboutCoreBluetooth/Introduction.html

• INDANCSClient • https://github.com/indragiek/INDANCSClient

https://www.facebook.com/groups/353660298163446/

穿戴式裝置開發者社群

歡迎您的加⼊入