电池通知
当提供程序包含多个组件时,通知 查找每个组件的电池电量。例如, 当入耳式耳机充电盒打开且搜寻者需要知道耳机充电时 以及充电盒本身
为此,提供商可以在 广告,是基于上文所述的快速配对账号数据构建的, 广告:在无法被发现时。
除账号数据外,提供商还应包含一个额外的字段 指定电池值数据包应包含以下信息:
| 八位字节 | 数据类型 | 说明 | 值 | 是否必需? | 
|---|---|---|---|---|
| 0 | uint8 | 标志 | 0x00 (所有保留以供日后使用) | 强制 | 
| 1 - 秒 | 账号密钥数据 | 强制 | ||
| 秒 + 1 | uint8 | 电池电量长度和类型 0bLLLLTTTT 
 | 0bLLTTTT 
 | 可选 | 
| s + 2、s + 3、s + 4 | uint8 | 电池值 0bSVVVVVVV 
 | 0bSVVVVVVV 
 | 可选 | 
为防止篡改,上述账号密钥数据应稍微 修改为在包含电池值时包含电池信息 。通常,在构建账号密钥时 过滤器,那么将此账号合并后可生成一个值 V 密钥替换为盐。相反,当电池信息也正在通告中时, 值 V 应按如下方式构造:
- 生成一个值 V,其中:
<ph type="x-smartling-placeholder">- </ph>
- 前 16 个字节为 K。
- 接下来的字节是 Salt 字节。
- 剩余字节是电池信息(从 s + 1 到 s + 4) (包括上表中的长度和类型字节)。
 
如上面的电池长度和类型字段中所述,类型可以是
0b0011 或 0b0100。
- 0b0011 - 当提供者希望寻找者在 界面中的电池值;
- 0b0100 - 当提供程序希望寻找器隐藏指示(如果它已隐藏)时使用 已经展示。
一种常见的使用情形是在案例已打开且使用 0b0011 时
如果耳机已从充电盒中取出或再次关闭,则0b0100。
  //The sample code demonstrates that the headset only reports the battery level.
  #define FASTPAIR_ACCOUNT_KEY_SIZE 16
  // In the sample code, the size of salt is 2 bytes.
  #define SALT_SIZE 2
  // 1st byte - Battery level length and type
  // 2nd~4th bytes - Battery values
  #define BAT_LEVEL_SIZE 3
  uint8_t V[FASTPAIR_ACCOUNT_KEY_SIZE + SALT_SIZE + BAT_LEVEL_SIZE + 1] = {0};
  int v_index = 0;
  // The first 16 bytes are K.
  uint8_t K[FASTPAIR_ACCOUNT_KEY_SIZE] = {0};
  fastpair_get_account_key_by_index(keyIndex, K);
  memcpy(V, K, FASTPAIR_ACCOUNT_KEY_SIZE);
  v_index = v_index + FASTPAIR_ACCOUNT_KEY_SIZE;
  // The next byte is the Salt.
  uint8_t randomSalt = (uint8_t)rand();
  V[v_index] = randomSalt;
  v_index = v_index + SALT_SIZE;
  // The remaining bytes are the battery information (from s + 1 to s + 4 including the length and type bytes).
  uint8_t battery_level_len = 0;
  uint8_t battery_level[BAT_LEVEL_SIZE] = {0};
  fastpair_get_bat_level(&battery_level_len, battery_level);
  // type = 0b0011 (show UI indication) or 0b0100 (hide UI indication)
  V[v_index] = (battery_level_len << 4 | (is_show_ui ? 0x3 : 0x4));
  v_index = v_index + 1;
  for (int idx = 0; idx < battery_level_len; idx++) {
          V[v_index++] = battery_level[idx];
  }
为防止跟踪,提供商不得在 所有广告。它可以在连接到 RFCOMM 后改为通过 RFCOMM 发送, 寻道者,请参阅消息流:设备信息。