使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
提供商可以通过消息流向查找者发送设备信息。
设备信息代码名称 |
值 |
模型 ID |
0x01 |
BLE 地址已更新 |
0x02 |
电池已更新 |
0x03 |
剩余电池续航时间 |
0x04 |
有效组件请求 |
0x05 |
活跃组件响应 |
0x06 |
(已废弃)功能 |
0x07 |
平台类型 |
0x08 |
固件版本 |
0x09 |
当前的 FHN 暂时标识符 |
0x0B |
模型 ID
在 RFCOMM 连接时,应将模型 ID 信息(用于回溯写入 AccountKey)发送给 Seeker。例如,0x03010003AABBCC
将为:
- 0x03:设备信息事件
- 0x01:模型 ID 值
- 0x0003:其他数据,长度为 3
- 0xAABBCC:其他数据、模型 ID
BLE 地址
在 RFCOMM 连接时以及每次轮替地址时,还应向 Seeker 发送 BLE 地址信息(用于回溯写入 AccountKey),如果有的话。例如,0x03020006AABBCCDDEEFF
将为:
- 0x03:设备信息事件
- 0x02:BLE 地址值
- 0x0006:其他数据,长度为 6
- 0xAABBCCDDEEFF:其他数据,BLE 地址
电池已更新
对于支持电池通知的提供程序,还可以通过 RFCOMM 发送电池信息。当 RFCOMM 连接或电池值发生变化时,应发送更新。通过 BLE 广告电池数据时,数据包的额外数据部分应包含与字节 s + 2、s + 3、s + 4 相同的数据。例如,0x0303000357417F
将为:
- 0x03:设备信息事件
- 0x03:电池电量
- 0x0003:其他数据,长度为 3
- 0x57417F:其他数据、电池值
- 0x57:左侧耳机值,未在充电,电池电量为 87%
- 0x41:右侧耳机值,未在充电,电池电量为 65%
- 0x7F:充电盒值,未充电,电池电量未知
提供程序还可以更新剩余电池电量(如果已知)。例如,0x03040001F0
将为:
- 0x03:设备信息事件
- 0x04:电池剩余时间
- 0x0001:其他数据,长度为 1(如有需要,uint16 可以为 2)。
- 0xF0:其他数据,电池剩余时间(以分钟为单位),240 分钟
有效组件
查找者有时可能希望了解哪些组件当前处于活动状态,也就是说,可以对这些组件执行操作(请参阅设备操作)。当提供程序收到包含活动组件请求代码 (0x05) 的请求时,应在 1 秒内返回一个响应,指明提供程序的当前状态。响应将使用有效组件响应代码 (0x06),并包含指示哪些组件可用的其他数据。
对于只有一个组件的提供程序,如果没有额外数据,则应将其设置为 0x00。例如,在不会执行媒体播放的低功耗模式下。否则,应将其他数据设置为 0x01。
对于包含多个组件(例如左侧和右侧耳机)的耳机,额外数据中的每个位都表示相应组件的活动状态。非活跃组件的示例可能是处于耳机盒中且未使用的耳机。具体而言,左侧耳机和右侧耳机的耳机盒:
- 0x00 (0b00000000):两个耳机均未处于活动状态
- 0x01 (0b00000001):右耳机处于活动状态,左耳机处于非活动状态
- 0x02 (0b00000010):左侧耳机处于活动状态,右侧耳机处于非活动状态
- 0x03 (0b00000011):两侧耳机均处于开启状态
提供商可能希望根据其关联的平台执行不同的操作。快速配对目前仅通过 Android 执行,但未来可能会扩大支持范围。
该消息将包含额外数据中用于标识平台类型的第一字节:
第二个字节将根据平台进行自定义。在 Android 中,它将引用 SDK 版本。例如,Android Pie 的值为 28 (0x1C)。
固件版本
提供商的固件版本(采用 UTF-8 编码的字符串)。
此信息与固件修订版本特征中的信息相同。
当前 FHN 暂时标识符
通告 FHN 帧的提供程序应报告当前的 FHN 暂时标识符 (EID) 及其当前的时钟值,以便在时钟漂移(例如因电池电量耗尽而导致)时与 Seeker 同步。
例如:
- 0x03:设备信息事件
- 0x0B:当前 FHN 暂时性标识符消息
- 0x0018:额外数据,长度为 24 或 36 字节
- 0x13F9EA80:其他数据(时钟值;4 字节)
- 0x1122334455667788990011223344556677889900:其他数据(当前 EID;20 或 32 字节)
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-13。
[null,null,["最后更新时间 (UTC):2025-08-13。"],[[["\u003cp\u003eProviders can notify a Seeker about device information like Model ID, BLE address, battery status, and active components using a dedicated message stream.\u003c/p\u003e\n"],["\u003cp\u003eDevice information is communicated using specific event codes and additional data formats, allowing Seekers to understand the Provider's state.\u003c/p\u003e\n"],["\u003cp\u003eProviders can share details like platform type and firmware version for compatibility checks and tailored interactions.\u003c/p\u003e\n"],["\u003cp\u003eBattery information can be communicated using the Battery Updated event and include details such as battery level, charging status, and remaining time.\u003c/p\u003e\n"],["\u003cp\u003eActive components information helps Seekers to understand which device functionalities are available at the given time.\u003c/p\u003e\n"]]],[],null,["Device information\n------------------\n\nProviders can notify a Seeker about device information via the\n[message stream](#MessageStream).\n\n| Message Group Name | Value |\n|--------------------------|-------|\n| Device information event | 0x03 |\n\n| Device Information Code Name | Value |\n|----------------------------------|-------|\n| Model ID | 0x01 |\n| BLE address updated | 0x02 |\n| Battery updated | 0x03 |\n| Remaining battery time | 0x04 |\n| Active components request | 0x05 |\n| Active components response | 0x06 |\n| (Deprecated)Capabilities | 0x07 |\n| Platform type | 0x08 |\n| Firmware version | 0x09 |\n| Current FHN ephemeral identifier | 0x0B |\n\n### Model ID\n\nModel ID information (for\n[Retroactively Writing AccountKey](/nearby/fast-pair/specifications/extensions/retroactiveacctkey#RetroactivelyWritingAccountKey \"Retroactively Writing Account key\")) should be\nsent to the Seeker when RFCOMM connects. For example, `0x03010003AABBCC`\nwould be:\n\n- 0x03: Device information event\n- 0x01: Model ID value\n- 0x0003: Additional data, length 3\n- 0xAABBCC: Additional data, model ID\n\n### BLE address\n\nBLE address information (for\n[Retroactively Writing AccountKey](/nearby/fast-pair/specifications/extensions/retroactiveacctkey#RetroactivelyWritingAccountKey \"Retroactively Writing Account key\")) , if\navailable, should also be sent to the Seeker when RFCOMM connects and whenever\nthe address is rotated. For example, `0x03020006AABBCCDDEEFF` would be:\n\n- 0x03: Device information event\n- 0x02: BLE address value\n- 0x0006: Additional data, length 6\n- 0xAABBCCDDEEFF: Additional data, BLE address\n\n### Battery updated\n\nFor Providers that support [battery notifications](/nearby/fast-pair/specifications/extensions/batterynotification#BatteryNotification \"Battery Notification\"),\nbattery information can also be sent via RFCOMM. When RFCOMM connects or the\nbattery value changes, an update should be sent. The additional data section of\nthe packet should contain identical data to bytes *s + 2* , *s + 3* , *s + 4* when\nadvertising battery data over BLE. For example,`0x0303000357417F` would be:\n\n- 0x03: Device information event\n- 0x03: Battery value\n- 0x0003: Additional data, length 3\n- 0x57417F: Additional data, battery values\n - 0x57: Left bud value, not charging, 87% battery\n - 0x41: Right bud value, not charging, 65% battery\n - 0x7F: Case value, not charging, unknown battery\n\nProviders can also update remaining battery time (if known), For example,\n`0x03040001F0` would be:\n\n- 0x03: Device information event\n- 0x04: Remaining battery time\n- 0x0001: Additional data, length 1 (could be 2 for uint16 if needed.)\n- 0xF0: Additional data, remaining battery time in minutes, 240 minutes\n\n### Active components\n\nSeekers may sometimes desire to know which components are currently active,\nmeaning that an action can be taken on them (see [Device actions](/nearby/fast-pair/specifications/extensions/deviceaction#DeviceAction \"Message Stream: Device Actions\")).\nWhen the Provider receives a request containing the\n*active components request* code (0x05), a response should be returned within 1\nsecond indicating the Provider's current state. The response will use the\n*active components response* code (0x06) and contain additional data indicating\nwhich components are available.\n\nFor a Provider with a single component, the additional data should be set to\n0x00 if it is not available. An example of this might be a low power mode where\nmedia playback will not be performed. Otherwise, additional data should be set\nto 0x01.\n\nFor headsets with multiple components (for example, a left and right bud), each\nbit in the additional data represents whether that component is active. An\nexample of an inactive component might be a bud which is in the case and not in\nuse. Specifically for the left and right bud case:\n\n- 0x00 (0b00000000): Neither bud active\n- 0x01 (0b00000001): Right bud active, left inactive\n- 0x02 (0b00000010): Left bud active, right inactive\n- 0x03 (0b00000011): Both buds active\n\n### Platform Type\n\nProviders may want to perform differently based on the platform that they are\nconnected to. Fast Pair is currently only performed through Android, but support\nmay be expanded in the future.\n\nThe message will contain a first byte identifying platform type in the\nadditional data:\n\n| Platform Name | Value |\n|---------------|-------|\n| Android | 0x01 |\n\nThe second byte will be customized per platform. In Android, it will refer to the\n[SDK version](https://source.android.com/setup/start/build-numbers). For\nexample, Android Pie will have a value of 28 (0x1C).\n\n### Firmware version\n\nThe provider's firmware version as a string in utf-8 encoding.\nIt's the same information as in the [Firmware revision characteristic](/nearby/fast-pair/specifications/characteristics#FirmwareRevision \"Firmware revision characteristic\").\n\n### Current FHN Ephemeral Identifier\n\nProviders that advertise FHN frames should report the current FHN Ephemeral\nIdentifier (EID) with their current clock value to sync with the Seeker in case\nof a clock drift (for example, due to drained battery).\n\nFor example:\n\n- 0x03: Device information event\n- 0x0B: Current FHN ephemeral identifier message\n- 0x0018: Additional data, length 24 or 36 bytes\n- 0x13F9EA80: Additional data (clock value; 4 bytes)\n- 0x1122334455667788990011223344556677889900: Additional data (current EID; 20 or 32 bytes)"]]