1.2 AMS(Apple Media Service) Profile 描述及应用

用于对接苹果多媒体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 Attribute1.当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会重新下发通知。

MR向MS发送的Remote Command 格式
RemoteCommandID
1Byte
remote命令,每次只发送一个命令
MS端下发的Remote Command 列表格式
RemoteCommandID 1RemoteCommandID 2RemoteCommandID Other ......
1Byte1Byte1Byte        ......
remote命令remote命令remote命令 ......

 Entity Update

        MR以特征写的方式向MS发送通知,订阅MR感兴趣的信息,例如音乐名、音量、艺术家、music app名等,写成功后MS会发回响应,此后当订阅信息发生变化之后,MS会主动以通知的方式发送变化后信息。

        默认情况下,MR不订阅任何信息,需要MR向MS发送订阅命令,MS才会下发信息。

MR向MS发送的订阅信息更新的命令格式
EntityIDAttributeID 1AttributeID 2 ......
1Byte1Byte1Byte......
想要订阅的实体对象订阅命令订阅命令......
MS订阅信息更新时通知格式
EntityIDAttributeIDEntityUpdateFlagsValue
1Byte1Byte1ByteN Byete
发生更新的实体对象属性ID位掩码,是否被截断(是否应该要拼接下条数据?)更新后的字符串数据(ASSIC)

Entity Attribute

        当Entity Update通知信息被截断时,MS想获取该条信息被截断后的所有信息,可以通过此特征属性向MS发送EntityID和AttributeID(对象和该对象内的属性ID),MS随后会向MR发送该对象属性的值,MR可以自行读取。

EntityIDAttributeID
1Byte1Byte
MR想追加的实体对象ID属性ID

所有命令项的可能值列表

Remote Command ID List

Name

Value

RemoteCommandIDPlay

0

RemoteCommandIDPause

1

RemoteCommandIDTogglePlayPause

2

RemoteCommandIDNextTrack

3

RemoteCommandIDPreviousTrack

4

RemoteCommandIDVolumeUp

5

RemoteCommandIDVolumeDown

6

RemoteCommandIDAdvanceRepeatMode

7

RemoteCommandIDAdvanceShuffleMode

8

RemoteCommandIDSkipForward

9

RemoteCommandIDSkipBackward

10

RemoteCommandIDLikeTrack

11

RemoteCommandIDDislikeTrack

12

RemoteCommandIDBookmarkTrack

13

Reserved

14-255

Player 对象所有的属性特征 ID 列表

Name

Value

Format

PlayerAttributeIDName

0

A string containing the localized name of the app.

PlayerAttributeIDPlaybackInfo

1

A concatenation of three comma-separated values:

  • PlaybackState: a string that represents the integer value of the playback state:

    • PlaybackStatePaused = 0

    • PlaybackStatePlaying = 1

    • PlaybackStateRewinding = 2

    • PlaybackStateFastForwarding = 3

  • PlaybackRate: a string that represents the floating point value of the playback rate.

  • ElapsedTime: a string that represents the floating point value of the elapsed time of the current track, in seconds, at the moment the value was sent to the MR.

  • CurrentElapsedTime = ElapsedTime + ((TimeNow – TimePlaybackInfoWasReceived) * PlaybackRate)

  • 当前已播放进度 = 已播放时长 + (当前时间 - 接收信息的起始时间)*播放速率

PlayerAttributeIDVolume

2

A string that represents the floating point value of the volume, ranging from 0 (silent) to 1 (full volume).

Reserved

3-255

Entity ID List

Name

Value

EntityIDPlayer

0

EntityIDQueue

1

EntityIDTrack

2

Reserved

3-255

EntityUpdateFlag Value List

Name

Value

EntityUpdateFlagTruncated

(1 << 0)

Reserved

(1 << 1) - (1 << 7)

Queue对象的所有属性特征ID列表

Name

Value

Format

QueueAttributeIDIndex

0

A string containing the integer value of the queue index, zero-based.

QueueAttributeIDCount

1

A string containing the integer value of the total number of items in the queue.

QueueAttributeIDShuffleMode

2

A string containing the integer value of the shuffle mode. Table A-6 lists the shuffle mode constants.

QueueAttributeIDRepeatMode

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

ShuffleModeOff

0

ShuffleModeOne

1

ShuffleModeAll

2

Reserved

3-255

重复播放的可能值

Name

Value

RepeatModeOff

0

RepeatModeOne

1

RepeatModeAll

2

Reserved

3-255

Track对象所有的属性特征ID列表

Name

Value

Format

TrackAttributeIDArtist

0

A string containing the name of the artist.

TrackAttributeIDAlbum

1

A string containing the name of the album.

TrackAttributeIDTitle

2

A string containing the title of the track.

TrackAttributeIDDuration

3

A string containing the floating point value of the total duration of the track in seconds.

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值