用于对接苹果多媒体BLE服务,Apple Media Service (MS-MR)。
Meadia Source(多媒体源:apple)。
Meadia Remote(多媒体无线端:ble clent device)。
官网地址:Apple.com
整个Profile共三个特征,这三个特征主要围绕三个对象服务,比较简单。
Service and Characteristics
AMS UUID :
89D3502B-0F36-433A-8EF4-C502AD55F8DC
Characteristics
Remote Command :
UUID 9B3C81D8-57B1-4A8A-B8DF-0E56F7CA51C2
(writeable, notifiable)Entity Update:
UUID 2F7CABCE-808D-411F-9A0C-BB92BA96C102
(writeable with response, notifiable)Entity Attribute:
UUID C6B2F38C-23AB-46D8-A6AB-A3A870BBD5D7
(readable, writeable)
ble设备端作为客户端连接APPLE设备之后,启动GATT服务发现,通过UUID查找AMS服务。
Profile通过三个对象及其预定义属性,广播当前的多媒体信息:
-
Player: 当前启动的多媒体APP信息,信息包括APP名、播放状态,音量值。
-
Queue: 当前的播放队列,包括音乐的大小、顺序或重复的播放模式。
-
Track: 当前曲目信息,包括艺术家、标题、进度条当前值。
Profile共以下三个特征,BLE设备端通过下述特征与MS命令交互及获取多媒体的更新信息:
Remote Command | 1.MR向MS发送控制命令,用于影响Music APP播放状态,例如下一首,音量加减、播放暂停等。 2.MS向MR发送通知,给出MR可用控制命令列表,MR拿到列表后选择订阅,控制命令列表发生变化时,MS会重新下发通知。 |
Entity Update | 1.MR以特征写的方式向MS发送通知,订阅MR感兴趣的信息,例如音乐名、音量、艺术家、music app名等,写成功后MS会发回响应,此后当订阅信息发生变化之后,MS会主动以通知的方式发送变化后信息。 2.默认情况下,MR不订阅任何信息,需要MR向MS发送订阅命令,MS才会下发信息。 |
Entity Attribute | 1.当Entity Update通知信息被截断时,MS想获取该条信息被截断后的所有信息,可以通过此特征属性向MS发送EntityID和AttributeID(对象和该对象内的属性ID),MS随后会向MR发送该对象属性的值,MR可以自行读取。 |
Profile Service Characteristics CMD Communication
MS可能会发生的CMD Error Code
-
Invalid State (0xA0): MR未正确配置订阅对象属性,却发送了获取信息的指令,可能会遇到此错误。
-
Invalid Command (0xA1): MR发送的命令格式错误。
-
Absent Attribute (0xA2): 错误的订阅了意外的对象或属性。
Remote Command
MR向MS发送控制命令,用于影响Music APP播放状态,例如下一首,音量加减、播放暂停等。
MS向MR发送通知,给出MR可用控制命令列表,MR拿到列表后选择订阅,控制命令列表发生变化时,MS会重新下发通知。
RemoteCommandID |
1Byte |
remote命令,每次只发送一个命令 |
RemoteCommandID 1 | RemoteCommandID 2 | RemoteCommandID Other ...... |
1Byte | 1Byte | 1Byte ...... |
remote命令 | remote命令 | remote命令 ...... |
Entity Update
MR以特征写的方式向MS发送通知,订阅MR感兴趣的信息,例如音乐名、音量、艺术家、music app名等,写成功后MS会发回响应,此后当订阅信息发生变化之后,MS会主动以通知的方式发送变化后信息。
默认情况下,MR不订阅任何信息,需要MR向MS发送订阅命令,MS才会下发信息。
EntityID | AttributeID 1 | AttributeID 2 | ...... |
1Byte | 1Byte | 1Byte | ...... |
想要订阅的实体对象 | 订阅命令 | 订阅命令 | ...... |
EntityID | AttributeID | EntityUpdateFlags | Value |
1Byte | 1Byte | 1Byte | N Byete |
发生更新的实体对象 | 属性ID | 位掩码,是否被截断(是否应该要拼接下条数据?) | 更新后的字符串数据(ASSIC) |
Entity Attribute
当Entity Update通知信息被截断时,MS想获取该条信息被截断后的所有信息,可以通过此特征属性向MS发送EntityID和AttributeID(对象和该对象内的属性ID),MS随后会向MR发送该对象属性的值,MR可以自行读取。
EntityID | AttributeID |
1Byte | 1Byte |
MR想追加的实体对象ID | 属性ID |
所有命令项的可能值列表
Name | Value |
---|---|
| 0 |
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
| 7 |
| 8 |
| 9 |
| 10 |
| 11 |
| 12 |
| 13 |
Reserved | 14-255 |
Name | Value | Format |
---|---|---|
| 0 | A string containing the localized name of the app. |
| 1 | A concatenation of three comma-separated values:
|
| 2 | A string that represents the floating point value of the volume, ranging from 0 (silent) to 1 (full volume). |
Reserved | 3-255 |
Name | Value |
---|---|
| 0 |
| 1 |
| 2 |
Reserved | 3-255 |
Name | Value |
---|---|
| (1 << 0) |
Reserved | (1 << 1) - (1 << 7) |
Name | Value | Format |
---|---|---|
| 0 | A string containing the integer value of the queue index, zero-based. |
| 1 | A string containing the integer value of the total number of items in the queue. |
| 2 | A string containing the integer value of the shuffle mode. Table A-6 lists the shuffle mode constants. |
| 3 | A string containing the integer value value of the repeat mode. Table A-7 lists the repeat mode constants. |
Reserved | 3-255 |
Name | Value |
---|---|
| 0 |
| 1 |
| 2 |
Reserved | 3-255 |
Name | Value |
---|---|
| 0 |
| 1 |
| 2 |
Reserved | 3-255 |
Name | Value | Format |
---|---|---|
| 0 | A string containing the name of the artist. |
| 1 | A string containing the name of the album. |
| 2 | A string containing the title of the track. |
| 3 | A string containing the floating point value of the total duration of the track in seconds. |