欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 科技 > 能源 > GFPS扩展技术原理(七)-音频切换消息流

GFPS扩展技术原理(七)-音频切换消息流

2025/2/24 22:01:29 来源:https://blog.csdn.net/Jzj1234555/article/details/144524393  浏览:    关键词:GFPS扩展技术原理(七)-音频切换消息流

音频切换消息流

Seeker和Provider通过消息流来同步音频切换能力,触发连接做切换,获取或设置音频切换偏好,通知连接状态等等。为此专门定义了音频切换消息流Message Group 为0x07,Message codes如下:
在这里插入图片描述

MAC of Audio switch Messages

所有的从seeker发送到Provider的消息都需要加上MAC,这样Provider应答这些消息的时候也需要带上MAC:

  • Provider应答ACK的消息流格式如下:
    在这里插入图片描述
  • Provider应答NAK的消息流格式如下:
    在这里插入图片描述

Get capability of Audio switch

这个消息可以由audio switch provider或者seeker发送,用于查询对方是否支持audio switch,消息流格式如下:
在这里插入图片描述

Notify capability of Audio switch

在收到get capability of Audio switch消息之后,Seeker或者Provider需要回复这个消息,格式如下:
在这里插入图片描述
这里我们主要关注一下Audio switch capability flags,只有Provider发送的时候,这两个字节才有效。这两个字节是标注音频切换能力的:

  1. Bit 0 (octet 6, MSB): Audio switch state

    1, if Audio switch state is on
    0, otherwise
    
  2. Bit 1: multipoint configurability

    1, if the device supports multipoint and it can be switched between on and off
    0, otherwise (does not support multipoint or multipoint is always on)
    
  3. Bit 2: multipoint current state

    1, if multipoint is on
    0, otherwise
    
  4. Bit 3: on-head detection

    1, if this device supports on-head detection (even if on-head detection is turned off now)
    0, otherwise
    
  5. Bit 4: on-head detection current state

    1, if on-head detection is turned on
    0, otherwise (does not support on-head detection or on-head detection is disabled)
    

Set multipoint state

这个是audio switch seeker用来打开或关闭Provider multipoint功能的消息,消息流格式如下:
在这里插入图片描述

Set switching preference

这个是audio switch seeker用来设置Provider multipoint音频切换偏好的,消息流格式如下:
在这里插入图片描述
这里我们主要注意multipoint switching preference flag:

  • Bit 0 (MSB): A2DP vs A2DP (default 0)
  • Bit 1: HFP vs HFP (default 0)
  • Bit 2: A2DP vs HFP (default 0)
  • Bit 3: HFP vs A2DP (default 1)
  • Bit 4 - 7: reserved

上面表示的形式是“新profile”VS"旧profiler",如果那个bit置上0,代表不能切换,如果置上1,表示可以切换。举个例子Bit 3置上1,表示如果有HFP连接进来,那么需要从原来的A2DP切换到HFP。

Get switching preference

Seeker可以发送Get switching preference消息给Provider,主动获取音频切换偏好,消息流格式如下:
在这里插入图片描述

Notify switching preference

在这里插入图片描述

Switch active audio source (to connected device)

Audio switch Seekers 可以请求multipoint Provider在连接的设备中切换活跃音频源,消息流格式如下:
在这里插入图片描述
这里我们主要关注Switching active audio source event flags这个字节:

  • Bit 0 (MSB): 1 切换到当前设备, 0 切换到另外设备
  • Bit 1: 1 在切换后恢复播放, 0 反着来。注意: 恢复播放意味着Provider需要通过AVRCP发送一个PLAY notification 给Seeker,如果seeker之前的状态就是停播,那么Provider就要忽略这个标志。
  • Bit 2: 1 在切换出去的设备拒绝SCO 连接。 0 反着来。
  • Bit 3: 1 在切换出去的设备断开蓝牙连接。0 反着来.
  • Bit 4 - 7: 这几个bit保留未用.

如果Audio switch seeker已经是当前活跃音频设备了,然后又发送了switch active audio device 消息给Provider,那么Provider需要回复NAK,理由是0x04-Redundant device action。
对于LE Audio Provider,如果是被切换出去的设备,那么需要断开所有的协调集成员的连接。

Switch back (to disconnected device)

如果用户想切回原来的设备,那么可以发送如下格式消息:
在这里插入图片描述
需要注意的是switch back event:

  • 0x01:switch back,就是简单的切回去连接上。
  • 0x02:切回去然后恢复播放,这里有个前提就是断开的设备,在被断开前的状态也是播放状态才行,否则Provider会忽略这个标志。

Notify multipoint-switch event

audio switch Provider通知Seeker发生的切换事件,消息格式如下:
在这里插入图片描述

Get connection status

Seeker从Provider获取当前连接状态,消息格式如下:
在这里插入图片描述

Notify connection status

连接状态的改变,除了需要修改BLE广播,还有就是Provider需要通知当前使用共同accout key的连接的audio switch seeker。如果provider连接一个audio switch seeker和一个non-audio switch seeker,并且当前活跃设备是non-audio switch seeker,那么provider也要通知audio switch seeker。Provider发送给Seeker的连接状态的消息,格式如下:
在这里插入图片描述
这里注意一下Encrypted connection status,跟之前音频切换广播里的connection status一样:

encrypted_connection_status = connection_status_raw_data ^ AES(Key, IV)

其中:

  • clike Key = HKDF(account_key, NULL, UTF8("SASS-RRD-KEY"),16)
  • IV is concat(Session_nonce, Message_nonce)
  • connection_status_raw_data = concat(connection_state, custom_data, connected_devices)

Notify Audio switch initiated connection

这个是Seeker告诉Provider,此连接是audio switch发起的连接,消息格式如下:
在这里插入图片描述

Indicate in use account key

如果同一个Seeker上多个account key 账户连接着同一个Provider,那么Seeker使用如下格式消息告诉Provider当前使用哪个account key:
在这里插入图片描述
Provider收到消息后,通过校验MAC能够得知当前使用哪个account key。

Send custom data

活跃Audio switch Seeker能够封装音频流信息在custom data里发送给Provider,消息格式如下:
在这里插入图片描述
Provider收到custom data之后,会更新广播数据包含custom data。如果是multipoint Provider,它也需要使用相同的account key通知连接状态的改变给另外连接的seeker。

Set drop connection target

在 multipoint headsets, 如果想要断开的连接不是最近常用的连接,那么需要audio switch Seekers 告诉Provider需要断开哪个设备,数据格式如下:
在这里插入图片描述

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词