使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
可穿戴设备控制
快速配对的耳戴式设备控件旨在为 Android 设备上的重要耳戴式设备功能提供更好的访问控制。为此,我们在消息流中添加了一个新的消息组“Hearable controls”。
主动降噪
主动降噪功能正逐渐成为高端头戴式耳机的一项重要功能。在搜索器端,快速配对将具有用于设置、获取和保存状态的界面和逻辑,并且状态将存储在提供器端。当事件流连接时,提供方必须发送 Session Nonce。
为实现此目的,我们定义了以下消息代码:
消息代码名称 |
值 |
发件人 |
回复者 |
MAC |
ACK |
获取 ANC 状态 |
0x11 |
Seeker |
提供商 |
否 |
否 |
设置 ANC 状态 |
0x12 |
Seeker |
提供商 |
是 |
是 |
通知 ANC 状态 |
0x13 |
提供商 |
Seeker |
否 |
否 |
当 Seeker 连接到 Provider 时,或者当 Provider 收到“Get ANC state”消息时,Provider 可以通知 ANC 状态,以便让 Seeker 了解其 ANC 功能和存储的状态。消息如下所示:
字节 |
数据类型 |
说明 |
值 |
0 |
uint8 |
可穿戴设备控制 |
0x08 |
1 |
uint8 |
通知 ANC 状态 |
0x13 |
2 - 3 |
uint16 |
其他数据长度 |
0x04 |
4 - 7 |
|
ANC 控制数据 |
各不相同 |
ANC 控制数据
字节 |
数据类型 |
说明 |
值 |
0 |
uint8 |
版本号 |
可变,此版本为 0x02 |
1 |
标志 |
界面切换 根据标志位的值,每个模式均处于启用 (1) 或停用 (0) 状态,如下所示: 位 0(最高有效位):透明 位 1:自适应(如果不支持,则为 0) 位 2:关闭 位 3:预留(将位设置为 0) 位 4:ANC |
各不相同 |
2 |
标志 |
可设置的切换开关 上述任何或所有界面切换开关位也可在此处设置,以指明哪些目前处于启用状态。 |
各不相同 |
3 |
标志 |
当前状态 只能设置一位,且此字节的值不得为零。 |
各不相同 |
Seeker 将根据 ANC 控制数据显示切换界面。
示例 1:提供方支持 3 向 ANC:通透 - 关闭 - ANC,耳机处于佩戴状态,所有模式均可设置,当前状态为关闭:
字节 |
数据类型 |
说明 |
值 |
0 |
uint8 |
版本号 |
0x01 |
1 |
标志 |
界面切换开关 |
0b10101000 |
2 |
标志 |
可设置的切换开关 |
0b10101000 |
3 |
标志 |
当前状态 |
0b00100000 |
示例 2:提供程序支持 3 向 ANC:通透 - 关闭 - ANC,现在只有一只耳机戴在头上或没有耳机戴在头上,因此无法设置模式,当前状态为关闭:
字节 |
数据类型 |
说明 |
值 |
0 |
uint8 |
版本号 |
0x01 |
1 |
标志 |
界面切换开关 |
0b10101000 |
2 |
标志 |
可设置的切换开关 |
0b00000000 |
3 |
标志 |
当前状态 |
0b00100000 |
如果用户切换开关,Seeker 会将当前状态设置为 Provider,如下所示:
字节 |
数据类型 |
说明 |
值 |
0 |
uint8 |
可穿戴设备控制 |
0x08 |
1 |
uint8 |
设置 ANC 状态 |
0x12 |
2 - 3 |
uint16 |
其他数据长度 |
因设备而异,0x04 或 0x14 |
4 |
uint8 |
Seeker 版本代码 |
可变,0x01 或 0x02 |
5 |
标志 |
可设置的主动降噪模式(界面切换) |
各不相同 |
6 |
标志 |
已启用 ANC 的模式(可设置的切换开关) |
各不相同 |
7 |
标志 |
新的 ANC 模式索引(新状态) |
各不相同 |
8 - 23 |
|
已预留 |
各不相同 |
字节 4-7 实际上是来自 Seeker 端的 ANC 控制数据。如果将附加长度值设置为 0x14,则保留字节 8-23 将存在,并且提供程序在收到这些字节时应忽略它们。如果将附加长度值设置为 0x04,则不存在任何预留字节。
当提供程序收到“设置 ANC 状态”消息时,应确认,并向所有已连接的搜索者通知 ANC 状态。
如果用户通过耳机手势或配套应用更改了设置,提供程序也应向所有已连接的搜索者发送通知。
示例 3:提供方支持 4 向 ANC:通透 - 自适应 - 关闭 - ANC,耳机处于佩戴状态,所有模式现在都可设置,当前状态为自适应:
字节 |
数据类型 |
说明 |
值 |
0 |
uint8 |
版本号 |
0x01 |
1 |
标志 |
界面切换开关 |
0b11101000 |
2 |
标志 |
可设置的切换开关 |
0b11101000 |
3 |
标志 |
当前状态 |
0b01000000 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-28。
[null,null,["最后更新时间 (UTC):2025-08-28。"],[[["\u003cp\u003eHearable Controls utilize Message Stream to enhance access to headphone features on Android.\u003c/p\u003e\n"],["\u003cp\u003eActive Noise Control (ANC) functionality allows for setting, retrieving, and saving noise cancellation preferences.\u003c/p\u003e\n"],["\u003cp\u003eANC state is communicated between devices, allowing the user interface to reflect available and current noise control modes.\u003c/p\u003e\n"],["\u003cp\u003eANC state can be controlled by the user via device UI and is synchronized across connected devices through notifications.\u003c/p\u003e\n"]]],["Hearable controls are added within the Message Stream for better access to hearable features. Active Noise Control (ANC) functionality is implemented, allowing the Seeker to get, set, and save the ANC state, which is stored by the Provider. The Provider can notify the Seeker of ANC capabilities and stored state. UI toggles for ANC are managed via flags, including transparent, off, and ANC modes. The Seeker sends a \"Set ANC state\" message to update the current ANC mode. The Provider must acknowledge these messages and notify connected Seekers.\n"],null,["Hearable Controls\n\nHearable controls on Fast Pair aim to provide better access controls for\nimportant Hearable features on Android. A new message group Hearable\ncontrols inside [Message Stream](/nearby/fast-pair/specifications/extensions/messagestream#MessageStream \"Message Stream\") has been added to achieve this.\n\n| Message Group Name | Value |\n|--------------------|-------|\n| Hearable control | 0x08 |\n\nActive noise control\n\nActive noise control is becoming a prominent feature for premium headphones. On\nthe Seeker side, Fast Pair will have the UI and logic to set, get and save the\nstate, and the state will be stored on the Provider side.\nIt is mandatory for provider to send [Session Nonce](/nearby/fast-pair/specifications/extensions/mac#SessionAndMessageNonce \"Session Nonce\") when event\nstream is connected.\nTo achieve this, below message codes are defined:\n\n| Message Code Name | Value | Sender | Responder | MAC | ACK |\n|-------------------|-------|----------|-----------|-----|-----|\n| Get ANC state | 0x11 | Seeker | Provider | N | N |\n| Set ANC state | 0x12 | Seeker | Provider | Y | Y |\n| Notify ANC state | 0x13 | Provider | Seeker | N | N |\n\nWhen a Seeker connects to a Provider, or when a Provider receives a \"Get ANC\nstate\" message, the Provider\ncan Notify the ANC state to let the Seeker know its ANC capability and its\nstored state. The message is as follow:\n\n| Byte | Data Type | Description | Value |\n|-------|-----------|-------------------------------------|----------|\n| 0 | uint8 | Hearable control | 0x08 |\n| 1 | uint8 | Notify ANC state | 0x13 |\n| 2 - 3 | uint16 | Additional data length | 0x04 |\n| 4 - 7 | | [ANC control data](#ANCControlData) | *varies* |\n\nANC control data\n\n| Byte | Data Type | Description | Value |\n|------|-----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------|\n| 0 | uint8 | Version code | *varies*, 0x02 for this version |\n| 1 | Flags | UI toggles Each mode is enabled (1) or disabled (0) according to the value of its flag bit, as follows: Bit 0 (MSB): transparent Bit 1: adaptive (or 0 if it is not supported) Bit 2: off Bit 3: Reserved (Set bit to 0) Bit 4: ANC | *varies* |\n| 2 | Flags | Settable toggles Any or all of the UI toggle bits above may also be set here, to indicate which are currently enabled. | *varies* |\n| 3 | Flags | Current state Only one bit can be set and value of this byte shall be non zero. | *varies* |\n\nThe Seeker will show the toggle UI according to the ANC control data.\n\nExample 1: The Provider supports 3-way ANC: transparent - off - ANC \\& buds are\non-head, all modes are settable now, and current state is off:\n\n| Byte | Data Type | Description | Value |\n|------|-----------|------------------|------------|\n| 0 | uint8 | Version code | 0x01 |\n| 1 | Flags | UI toggles | 0b10101000 |\n| 2 | Flags | Settable toggles | 0b10101000 |\n| 3 | Flags | Current state | 0b00100000 |\n\nExample 2: The Provider supports 3-way ANC: transparent - off - ANC, only one\nbud is on-head now or no buds is on-head, so no modes are settable, and the\ncurrent state is off:\n\n| Byte | Data Type | Description | Value |\n|------|-----------|-----------------|------------|\n| 0 | uint8 | Version code | 0x01 |\n| 1 | Flags | UI toggle | 0b10101000 |\n| 2 | Flags | Settable toggle | 0b00000000 |\n| 3 | Flags | Current state | 0b00100000 |\n\nIf the user switches the toggle, the Seeker will set the current state to the\nProvider as follow:\n\n| Byte | Data Type | Description | Value |\n|--------|-----------|-------------------------------------|------------------------|\n| 0 | uint8 | Hearable control | 0x08 |\n| 1 | uint8 | Set ANC state | 0x12 |\n| 2 - 3 | uint16 | Additional data length | *varies*, 0x04 or 0x14 |\n| 4 | uint8 | Seeker Version code | *varies*, 0x01 or 0x02 |\n| 5 | Flags | ANC Settable modes (UI toggle) | *varies* |\n| 6 | Flags | ANC Enabled modes (Settable toggle) | *varies* |\n| 7 | Flags | New ANC mode index (New state) | *varies* |\n| 8 - 23 | | Reserved | *varies* |\n\nThe byte 4 - 7 is actually [ANC control data](#ANCControlData) sent from\nSeeker side. If additional length value is set as 0x14, the reserved bytes 8-23\nwould be present and on receipt of these bytes, the provider should ignore them.\nIf additional length value is set as 0x04, there are no reserved bytes present.\n\nWhen a Provider receives a \"Set ANC state\" message, it should [Acknowledge](/nearby/fast-pair/specifications/extensions/acknowledgement#MessageStreamAcknowledgements \"Message Stream Acknowledgements\"),\nand Notify ANC state to all connected Seekers.\nIf the user changes the setting via headset gesture or companion application,\nthe Provider should also send notification to all connected Seekers.\n\nExample 3: The Provider supports 4-way ANC: transparent - adaptive - off - ANC,\nbuds are on-head, all modes are settable now, and current state is adaptive:\n\n| Byte | Data Type | Description | Value |\n|------|-----------|-----------------|------------|\n| 0 | uint8 | Version code | 0x01 |\n| 1 | Flags | UI toggle | 0b11101000 |\n| 2 | Flags | Settable toggle | 0b11101000 |\n| 3 | Flags | Current state | 0b01000000 |"]]