Microsoft定义的蓝牙 HCI 扩展

蓝牙 Host-Controller 接口(HCI)指定主机和蓝牙无线电控制器之间的所有交互。 蓝牙规范允许供应商定义的 HCI 命令和事件在主机和控制器之间启用非标准交互。 Microsoft定义 Windows 使用的特定于供应商的 HCI 命令和事件。 蓝牙控制器实现者可以使用这些扩展来实现特殊功能。

Requirements

蓝牙 HCI 命令由 16 位命令代码标识。 蓝牙组织通过0xFBFF定义范围中的值0x0000。 供应商通过0xFFFF定义范围0xFC00中的值,允许 1024 个不同的供应商分配的命令代码。

供应商必须选择Microsoft定义的命令代码的值。 Microsoft不能选择命令代码,并且假定没有其他供应商将代码用于冲突目的。 发出特定于供应商的命令是不安全的,如果控制器不了解命令,则依赖于控制器拒绝该命令。 控制器可以将命令解释为破坏性作,例如更新控制器的固件。

供应商必须通过控制器以外的方法传达所选值。 Microsoft未指定如何获取所选代码。

通知 Windows 蓝牙堆栈供应商特定的命令代码

Windows 蓝牙堆栈从注册表项 VsMsftOpCode中读取供应商特定的命令代码。

VsMsftOpCode注册表项具有REG_DWORD类型,密钥数据是供应商特定的作码。

To specify the vendor specific opcode, use the AddReg directive under DDInstall.HW section in the driver's INF. 添加注册表部分应包含:

HKR,,"VsMsftOpCode",0x00010001,<Vendor Specific Opcode>

Example:

[radio.NTamd64.HW]
AddReg=radio.NTamd64.HW.AddReg
[radio.NTamd64.HW.AddReg]
HKR,,"VsMsftOpCode",0x00010001,<Vendor Specific Opcode>

Microsoft定义的 HCI 命令

HCI Commands Description
HCI_VS_MSFT_Read_Supported_Features 提供一个位图,描述控制器支持哪些Microsoft定义功能,并指定控制器返回的Microsoft定义的事件的前缀。
HCI_VS_MSFT_Monitor_Rssi 请求控制器开始监视指定连接的测量链接 RSSI,并在连接的测量链接 RSSI 超出指定边界时生成事件。
HCI_VS_MSFT_Cancel_Monitor_Rssi Cancels a previously issued HCI_VS_MSFT_Monitor_Rssi command.
HCI_VS_MSFT_LE_Monitor_Advertisement 控制器开始监视属于指定 RSSI 范围内的播发并满足其他要求的请求。
HCI_VS_MSFT_LE_Cancel_Monitor_Advertisement Cancels a previously issued HCI_VS_MSFT_LE_Monitor_Advertisement command.
HCI_VS_MSFT_LE_Set_Advertisement_Filter_Enable 设置广告筛选器的状态。
HCI_VS_MSFT_Read_Absolute_RSSI 从控制器读取 BR/EDR 连接的绝对接收信号强度指示 (RSSI) 值。

Microsoft定义的 HCI 命令和子命令

控制器理解只有一个特定于Microsoft HCI 命令。 使用作码扩展特定于Microsoft命令集。 Microsoft定义的 HCI 命令的第一个命令参数是指定子命令的作码。

Controllers must support HCI_VS_MSFT_Read_Supported_Features in order to support any other Microsoft HCI subcommands. 对其他命令的支持是可选的,取决于HCI_VS_MSFT_Read_Supported_Features返回的值。 除非控制器通过响应HCI_VS_MSFT_Read_Supported_Features指示对子命令的支持,否则 Windows 不会发送任何Microsoft定义的子命令。

HCI_VS_MSFT_Read_Supported_Features

HCI_VS_MSFT_Read_Supported_Features提供了一个位图,用于描述控制器支持哪些Microsoft定义的功能,并指定控制器返回的Microsoft定义的事件的前缀。

控制器应始终使用 Command Completed 事件及时完成此命令。

Command Code Command parameters Return parameters
HCI_VS_MSFT_Read_Supported_Features 所选基代码 Subcommand_opcode Status,
Subcommand_opcode,
Supported_features,
Microsoft_event_prefix_length,
Microsoft_event_prefix

Command_parameters

Subcommand_opcode (1 octet):

Value Parameter description
0x00 The subcommand opcode for HCI_VS_MSFT_Read_Supported_Features.

Return_parameters

Status (1 octet):

Value Parameter description
0x00 命令成功。
0x01 0xFF 命令失败。 See Error Codes in the Bluetooth Core specification for details.

Subcommand_opcode (1 octet):

Value Parameter description
0x00 The subcommand opcode for HCI_VS_MSFT_Read_Supported_Features.

Supported_features (8 octets):

Value Parameter description
0x00000000 00000001 控制器支持 BR/EDR 连接的 RSSI 监视功能。 In addition, the controller supports HCI_VS_MSFT_Read_Absolute_RSSI to read the absolute RSSI metric of a BR/EDR connection.
0x00000000 00000002 控制器支持 LE 连接的 RSSI 监视功能。
0x00000000 00000004 控制器支持 LE 旧播发的 RSSI 监视。
0x00000000 00000008 控制器支持 LE 旧广告的广告监视。
0x00000000 00000010 控制器支持在 P-192 和 P-256 的安全简单配对过程中验证曲线上公共 X 和 Y 坐标的有效性。
有关详细信息,请参阅 蓝牙核心规范 Erratum 10734
0x00000000 00000020 Controller supports Continuous Advertising Monitoring of LE advertisements performed concurrently with other radio activities, using HCI_VS_MSFT_LE_Monitor_Advertisement [v1].
0x00000000 00000040 Reserved.
0x00000000 00000080 控制器支持 AVDTP 卸载和本文档中所述的 HCI_VS_MSFT_Avdtp_* 命令。
0x00000000 00000100 Reserved.
0x00000000 00000200 Reserved.
0x00000000 00000400 Controller supports HCI_VS_MSFT_LE_Monitor_Advertisement [v2]. Additionally, the Controller supports Continuous Advertising Monitoring of LE advertisements performed concurrently with other radio activities, using HCI_VS_MSFT_LE_Monitor_Advertisement [v2].
0xFFFFFFFF FFFFFF00 为将来的定义保留的位。 必须为零。

Microsoft_event_prefix_length (1 octet):

Value Parameter description
0x00到0x20 Number of bytes in the Microsoft event prefix field as specified in the returned Microsoft_event_prefix. 这是每个Microsoft指定 HCI 事件开头的常量信息的字节数。

Microsoft_event_prefix (variable length):

Value Parameter description
事件前缀值 每个Microsoft定义的事件的开头所期望的常量信息。 此信息用于区分Microsoft定义的事件与其他自定义事件。

HCI_VS_MSFT_Monitor_Rssi

HCI_VS_MSFT_Monitor_Rssi请求控制器开始监视指定连接的测量链接 RSSI,并在连接的测量链接 RSSI 超出指定边界时生成事件。

Command Code Command parameters Return parameters
HCI_VS_MSFT_Monitor_Rssi 所选基代码 Subcommand_opcode,
Connection_Handle,
RSSI_threshold_high,
RSSI_threshold_low,
RSSI_threshold_low_time_interval,
RSSI_sampling_period
Status,
Subcommand_opcode

The controller shall notify the host of the RSSI value with a periodically generated event (based on the RSSI_sampling_period). The measured link RSSI shall be the absolute receiver signal strength value in dBm for the BR/EDR connection.

为了响应 HCI_VS_MSFT_Monitor_Rssi 命令,如果控制器可以开始监视或非零状态,控制器应生成一个命令完成事件,其状态为零。 If the status value is nonzero, the controller shall not generate an HCI_VS_MSFT_Rssi_Event in response to this command.

The controller shall refuse the command if another HCI_VS_MSFT_Monitor_Rssi command with the same Connection_Handle is outstanding, or if the specified connection handle is invalid. 控制器也可能出于其他原因(如资源耗尽)拒绝该命令。

此状态图显示监视连接的 RSSI 时控制器上的转换状态。

状态图显示监视连接的 RSSI 时控制器上的转换状态。

The controller shall generate an HCI_VS_MSFT_Rssi_Event when the received RSSI is greater than or equal to the specified RSSI_threshold_high. After this event has been generated, the controller shall not generate a new HCI_VS_MSFT_Rssi_Event to specify that the RSSI_threshold_high has been exceeded until it generates an HCI_VS_MSFT_Rssi_Event that specifies the RSSI has fallen below RSSI_threshold_low.

The controller shall generate an HCI_VS_MSFT_Rssi_Event when the received RSSI equals or falls below the specified RSSI_threshold_low over the specified RSSI_threshold_low_time_interval. After this event has been generated, the controller shall not generate a new HCI_VS_MSFT_Rssi_Event to specify that the RSSI has fallen below the RSSI_threshold_low until an HCI_VS_MSFT_Rssi_Event event is generated to specify that RSSI_threshold_high has been reached or exceeded.

If the RSSI_sampling_period is between 0x01 and 0xFE, the controller shall generate an HCI_VS_MSFT_Rssi_Event periodically every RSSI_sampling_period. This event shall contain the average of the RSSI calculated over the RSSI_sampling_period. If the RSSI_sampling_period is 0x00 or 0xFF, the controller shall not notify the host periodically with HCI_VS_MSFT_Rssi_Event.

Command_parameters

Subcommand_opcode (1 八进制):

Value Parameter description
0x01 The subcommand opcode for HCI_VS_MSFT_Monitor_Rssi.

Connection_Handle(2 个八进制):

Value Parameter description
0xXXXX 必须监视其 RSSI 的连接句柄。

RSSI_threshold_high (1 八进制):

Value Parameter description
0xXX 预期的最大 RSSI 值。 如果观察到的 RSSI 大于或等于此值,控制器将生成事件。
Unit: dBm
BR/EDR 范围:-128 到 127(带符号整数)
LE 范围:-127 到 20(带符号整数)

RSSI_threshold_low (1 八进制):

Value Parameter description
0xXX 所需的最小 RSSI 值。 如果观察到的 RSSI 小于或等于此值,控制器将生成事件。
Unit: dBm
BR/EDR 强制范围:-128 到 127(带符号整数)
LE 强制范围:-127 到 20(带符号整数)

RSSI_threshold_low_time_interval (1 八进制):

Value Parameter description
0x00 Reserved value.
N = 0xXX The time in seconds over which the RSSI value should be below RSSI_threshold_low before an HCI_VS_MSFT_Rssi_Event is generated.
Time period = N * 1 second
必需范围:0x01到0x3C

RSSI_sampling_period (1 八进制):

Value Parameter description
0x00 Reserved value.
N = 0xXX 采样间隔(以 100 毫秒为单位)。
Time period = N * 100 milliseconds
必需范围:0x01到0xFE
0xFF Reserved value.

Return_parameters

状态(1 个八进制):

Value Parameter description
0x00 命令成功。
0x01 0xFF 命令失败。 See Error Codes in the Bluetooth Core specification for details.
0x07 如果控制器没有足够的内存来处理命令,则控制器应返回超出的内存 容量
Error code 命令失败。 See Error Codes in the Bluetooth Core specification for details.

Subcommand_opcode (1 八进制):

Value Parameter description
0x01 HCI_VS_MSFT_Monitor_Rssi的子命令作码。

除非屏蔽离开,否则生成的事件

The controller shall promptly generate a Command Complete event when the HCI_VS_MSFT_Monitor_Rssi command is received. If the Command Complete event returns a status of 0, the controller shall generate an HCI_VS_MSFT_Rssi_Event when one of the following conditions occurs.

  • The observed RSSI for the device over RSSI_threshold_low_time_interval becomes equal to or less than the specified RSSI_threshold_low value.
  • The observed RSSI for the device becomes greater than or equal to the specified RSSI_threshold_high value.
  • The RSSI_sampling_period is valid and the sampling period expires.

如果与指定设备的连接丢失,控制器应执行所有必要的清理。 In this case, an HCI_VS_MSFT_Cancel_Monitor_Rssi command isn't sent to the controller.

HCI_VS_MSFT_Cancel_Monitor_Rssi

HCI_VS_MSFT_Cancel_Monitor_Rssi cancels a previously issued HCI_VS_MSFT_Monitor_Rssi command. 控制器应立即生成 Command Completed 事件,以响应此命令。

Command Code Command parameters Return parameters
HCI_VS_MSFT_Cancel_Monitor_Rssi 所选基代码 Subcommand_opcode,
Connection_Handle
Status,
Subcommand_opcode

Command_parameters

Subcommand_opcode (1 八进制):

Value Parameter description
0x02 The subcommand opcode for HCI_VS_MSFT_Cancel_Monitor_Rssi.

Connection_Handle(2 个八进制):

Value Parameter description
0xXXXX 必须取消其 RSSI 的连接句柄。

Return_parameters

状态(1 个八进制):

Value Parameter description
0x00 命令成功。
0x01 0xFF 命令失败。 See Error Codes in the Bluetooth Core specification for details.

Subcommand_opcode (1 八进制):

Value Parameter description
0x02 The subcommand opcode for HCI_VS_MSFT_Cancel_Monitor_Rssi.

除非屏蔽离开,否则生成的事件

The controller shall generate a Command Complete event when the HCI_VS_MSFT_Cancel_Monitor_RSSI command is received.

HCI_VS_MSFT_LE_Monitor_Advertisement

HCI_VS_MSFT_LE_Monitor_Advertisement请求控制器开始监视属于指定 RSSI 范围内的播发,同时满足以下条件之一:

  • 指定的模式可以匹配收到的播发数据包。
  • 指定的 UUID 可以匹配收到的播发数据包。
  • 指定的标识解析密钥(IRK)可用于解析来自播发数据包的设备专用地址。
  • 指定的蓝牙地址可以匹配收到的播发数据包。

v2 命令允许主机将上述一些条件与管理广告源和定向广告目标的选项相结合,以进一步优化监视哪些广告。 v2 命令还允许主机筛选受监视播发导致控制器生成播发报告。

Command Code Command parameters Return parameters
HCI_VS_MSFT_LE_Monitor_Advertisement [v2] 所选基代码 Subcommand_opcode_v2,
RSSI_threshold_high,
RSSI_threshold_low,
RSSI_threshold_low_time_interval,
RSSI_sampling_period,
Monitor_options,
Advertisement_report_filtering_options,
Peer_device_address,
Peer_device_address_type,
Peer_device_IRK,
Condition_type,
<条件参数>
Status,
Subcommand_opcode,
Monitor_Handle
HCI_VS_MSFT_LE_Monitor_Advertisement [v1] 所选基代码 Subcommand_opcode_v1,
RSSI_threshold_high,
RSSI_threshold_low,
RSSI_threshold_low_time_interval,
RSSI_sampling_period,
Condition_type,
<条件参数>
Status,
Subcommand_opcode,
Monitor_Handle

控制器应生成命令完成事件,以响应此命令。 如果控制器可以开始监视或非零状态,则状态值应设置为零。 If the controller doesn't support RSSI monitoring for LE Advertisements, it shall ignore the RSSI_threshold_high, RSSI_threshold_low, RSSI_threshold_low_time_interval, and RSSI_sampling_period parameter values.

此状态图显示监视播发 RSSI 时控制器上的转换状态。

显示HCI_VS_MSFT_LE_Monitor_Advertisement转换状态的状态关系图。

The controller shall begin monitoring an advertisement only when the received RSSI is greater than or equal to RSSI_threshold_high for a particular device and the Monitor_options match (see below). The controller shall generate an HCI_VS_MSFT_LE_Monitor_Device_Event with Monitor_state set to 1 and Monitor_handle set to the handle for this Condition, to notify the host that the controller is monitoring this particular device for Condition. Additionally, the Controller shall propagate the first advertisement report of a monitored advertisement to the Host only when the Advertisement_report_filter_options match (see below).

The Monitor_options for a filter are considered a match based on the following logic (in pseudocode):

MatchesCondition = (PDU Matches Condition Parameters)

IsAdvAMatch = ((Monitor_options bit 0 is set) && ((AdvA == Peer_device_address) && (TxAdd == Peer_device_address_type))) ||
    ((Monitor_options bit 1 is set) && (AdvA resolvable with Peer_device_IRK))

IsDirectedAdvAMatch = (TargetA is permitted based on the Scanning Filter Policy) &&
    (((Monitor_options bit 2 is set) && ((AdvA == Peer_device_address) && (TxAdd == Peer_device_address_type))) ||
        ((Monitor_options bit 3 is set) && (AdvA resolvable with Peer_device_IRK)))

IsDirectedTargetAMatch = (Monitor_options bit 4 is set) &&
    (TargetA is permitted based on the Scanning Filter Policy)

MonitorOptionsMatch = (MatchesCondition && IsAdvAMatch) ||
    IsDirectedAdvAMatch ||
    IsDirectedTargetAMatch ||
    ((Monitor_options bit 5 is set) && MatchesCondition)

And for a monitored advertisement, the Advertisement_report_filter_options are considered a match based on the following logic (in pseudocode):

IsDuplicateFilterSatisfied = (Advertisement_report_filter_options bit 0 is NOT set || PDU is not a duplicate)

ShouldGenerateLegacyReport = (Advertisement_report_filter_options bit 1 is set) &&
    (PDU is Legacy) &&
    MonitorOptionsMatch

ShouldGenerateExtendedReport = (Advertisement_report_filter_options bit 2 is set) &&
    (PDU is Extended) &&
    MonitorOptionsMatch

ShouldGenerateDirectedReport = (Advertisement_report_filter_options bit 3 is set) &&
    (PDU is Directed) &&
    MonitorOptionsMatch

AdvertisementReportFilterOptionsMatch = IsDuplicateFilterSatisfied &&
    (ShouldGenerateLegacyReport || ShouldGenerateExtendedReport || ShouldGenerateDirectedReport)

The controller shall stop monitoring for Condition if the RSSI of the received advertisements equals or falls below RSSI_threshold_low over RSSI_threshold_low_interval for the particular device. The controller shall generate an HCI_VS_MSFT_LE_Monitor_Device_Event with Monitor_state set to 0 to notify the host that the controller has stopped monitoring the particular device for the Condition. After the controller specifies the HCI_VS_MSFT_LE_Monitor_Device_Event with Monitor_state set to 0, the controller shall not allow further advertisement packets to flow to the host for the device until the controller has notified the host that the RSSI for the particular device has risen to or above RSSI_threshold_high for the particular device for the Condition.

Additionally, the controller shall generate an HCI_VS_MSFT_LE_Monitor_Device_Event with Monitor_state set to 0 to notify the host that the controller has stopped monitoring the device for the Condition if the specified RSSI_threshold_low_time_interval expires without receiving any advertising packets from the device. 如果控制器正在监视特定条件的设备,则以下语句为 true。

If the controller supports the RSSI monitoring of LE extended advertisements without sampling, the controller shall propagate anonymous advertisement packets to the host if the RSSI value for the packet is greater than or equal to RSSI_threshold_high. Anonymous advertisements shall not be tracked and the HCI_VS_MSFT_LE_Monitor_Device_Event event shall not be generated.

如果控制器支持无采样的 LE 广告的 RSSI 监视,则控制器应在广告收到的片段匹配的情况下生成截断的广告报告,但在未成功接收整个广告的情况下生成截断的广告报告。

控制器应至少支持 30 个同时Monitor_handles、至少 30 个同时跟踪的设备,以及至少 20 个同时跟踪的重复广告。 控制器还应能够在 10 个% 负载周期执行连续 LE 扫描。

如果在控制器中启用了地址解析,并且主机打算监视远程设备,其 IRK 已成功存储在控制器的解析列表中,则主机应提供远程设备的解析列表条目中的Peer_Identity_Address和Peer_Identity_Address_Type参数作为Peer_device_address和Peer_device_address_type参数, 分别。

RSSI_sampling_period Legacy Advertisements 扩展广告 (非匿名) 扩展广告 (匿名)
0x00 The controller shall propagate all received advertisement packets to the host for the device for this Condition unless the controller previously received an HCI_VS_MSFT_LE_Set_Advertisement_Filter_Enable command with Enable set to 0x00. The controller shall propagate an advertisement packet to the host even if the received RSSI is less than or equal to RSSI_threshold_low as long as RSSI_threshold_low_time_interval hasn't expired for the particular device for this Condition. 此播发数据包的 RSSI 值应为收到的播发的 RSSI 值。 If the controller supports the RSSI monitoring of LE extended advertisements without sampling, same behavior as Legacy Advertisements column except that an advertisement packet is defined as all PDUs in the advertising chain. If the controller supports the RSSI monitoring of LE extended advertisements without sampling, the controller shall propagate all received advertisement packets to the host for the device for this Condition unless the controller previously received an HCI_VS_MSFT_LE_Set_Advertisement_Filter_Enable command with Enable set to 0x00.
0x01到0xFE The controller shall propagate legacy advertisement packets to the host every RSSI_sampling_period specified unless the controller previously received an HCI_VS_MSFT_LE_Set_Advertisement_Filter_Enable command with Enable set to 0x00. 为播发指定的 RSSI 值应是在此采样间隔期间收到的 RSSI 值的平均值。 如果控制器在采样期间未收到播发数据包,则不应将播发传播到主机。 It's possible that RSSI_sampling_period is less than RSSI_threshold_low_time_interval and all advertisements received during the RSSI_sampling_period have RSSI below RSSI_threshold_low. 控制器仍应传播播发,并传播在此采样间隔期间收到的 RSSI 值的平均值。 If the controller supports the RSSI monitoring of LE extended advertisements without sampling, the controller shall behave as if the RSSI_sampling_period was 0x00. If the controller supports the RSSI monitoring of LE extended advertisements without sampling, the controller shall behave as if the RSSI_sampling_period was 0x00.
0xFF The controller shall not allow further advertisement packets to flow to the host for the device for the Condition until the controller has notified the host that the particular device's RSSI has fallen below RSSI_threshold_low for RSSI_threshold_low_time_interval for the particular device for this Condition. This notification is done by generating an HCI_VS_MSFT_LE_Monitor_Device_Event with Monitor_state set to 0. If the controller supports the RSSI monitoring of LE extended advertisements without sampling, same behavior as Legacy Advertisements column. If the controller supports the RSSI monitoring of LE extended advertisements without sampling, the controller shall behave as if the RSSI_sampling_period was 0x00.

If the controller previously received an HCI_VS_MSFT_LE_Set_Advertisement_Filter_Enable command with Enable set to 0x00, the sampling period timer shall not be stopped. 有关详细信息,请参阅示例:使用采样周期对筛选器HCI_VS_MSFT_LE_Set_Advertisement_Filter_Enable。 如果控制器从同一设备接收非重复广告数据包,则它应与控制器上存储的条件匹配每个播发数据包。

If the controller receives an advertisement packet from a device that matches multiple Conditions, then the controller shall generate an HCI_VS_MSFT_LE_Monitor_Device_Event for each Condition that matched, with Monitor_handle set to the Condition that matched.

If the controller is unable to monitor the RSSI values for all devices in range that match the Condition, it keeps monitoring as many devices as it can. 应监视哪些设备的决定取决于收到的播发的 RSSI 值。 控制器应监视接收信号强度较大的设备。

If the controller has notified the host about a particular device (A) and it's monitoring devices at maximum hardware capacity, and if another device (B) comes into range with a higher RSSI value, then the controller shall notify the host that it has stopped monitoring the device (A) by generating an HCI_VS_MSFT_LE_Monitor_Device_Event with Monitor_state set to 0. The controller shall also generate an HCI_VS_MSFT_LE_Monitor_Device_Event with Monitor_state set to 1 to notify the host that the device (B) is now being monitored.

条件类型和条件参数

The Condition_type parameter specifies whether the Condition parameter specifies a pattern, UUID, IRK, or BD_ADDR.

If the Condition_type parameter specifies a pattern, the Condition contains two sections that contain the number of patterns present within the Condition, and the pattern data.

说明HCI_VS_MSFT_LE_Monitor_Advertisement模式条件数据布局的关系图。

模式数 指定需要匹配的模式数。

Pattern Data has the following format.

  • Length specifies the length of this pattern include the data type and start byte of the pattern.
  • AD Type specifies the AD Type field.
  • 模式的开始 指定紧跟 AD 类型的模式的起始字节位置。
  • Pattern has a size of (Length - 0x2) and is the pattern to be matched for the specified AD Type within the advertisement packet from the specified starting byte.

如果指定了多个模式,控制器应确保至少有一个模式与收到的播发匹配。

如果控制器支持在没有采样的情况下监视 LE 扩展播发的 RSSI 监视:

  • 控制器应查找主机广告数据的前 251 个八进制数中的模式,并可能查找主机广告数据的任何剩余八进制数。 如果 AD 部分超出了主机广告数据的前 251 个八进制数,则控制器应查找位于主机广告数据前 251 个八进制数的 AD 部分内的模式,并可能查找主机广告数据剩余的八进制数。 注意:根据广告商的碎片,主机广告数据的前 251 个八进制数可以扩展到多个广告 PDU 的 AdvData 中。 扫描程序应注意限制其遵循的 AuxPtrs 数量,以避免遵循过多的 PDU 链。

  • 控制器应基于每个广告集的每个设备地址进行跟踪。 The controller shall propagate a HCI_VS_MSFT_LE_Monitor_Device_Event for each advertising set that matches the pattern even if the advertisement comes from the same device address.

If the Condition_type parameter specifies a UUID, the Condition parameter contains a UUID Type and a UUID. UUID 类型指定 UUID 是 16 位、32 位还是 128 位。 控制器应分析播发数据包的服务 UUID,以检查指定的 UUID。 如果 UUID 类型定义为0x01,则控制器应分析 16 位服务 UUID 不完整列表,并完成服务 UUID 类型中指定的 16 位服务 UUID 列表。 如果 UUID 类型定义为0x02,控制器应分析 32 位服务 UUID 不完整列表,并完成服务 UUID 类型中指定的 32 位 UUID 列表。 如果指定的 UUID 类型0x03,控制器应分析 128 位服务 UUID 不完整列表,并完成服务 UUID 类型中指定的 128 位服务 UUID 列表。

如果控制器支持在没有采样的情况下监视 LE 扩展播发的 RSSI 监视:

  • 控制器应在主机广告数据的前 251 个八进制数中查找服务 UUID,并可在主机广告数据的任何剩余八进制数中查找。 如果 AD 部分超出了主机广告数据的前 251 个八进制数,则控制器应在主机广告数据的前 251 个八进制数的 AD 部分内查找服务 UUID,并可能查找主机广告数据剩余的八进制数。 注意:根据广告商的碎片,主机广告数据的前 251 个八进制数可以跨越多个广告 PDU 的 AdvData。 扫描程序应注意限制其遵循的 AuxPtrs 数量,以避免遵循过多的 PDU 链。

  • 控制器应基于每个广告集的每个设备地址进行跟踪。 The controller shall propagate a HCI_VS_MSFT_LE_Monitor_Device_Event for each advertising set that matches the Service UUID even if the advertisement comes from the same device.

If the Condition_type parameter specifies an IRK, the Condition parameter contains the IRK.

If the Condition_type parameter specifies a Bluetooth Address, the Condition parameter contains the address type and BD_ADDR.

即使启用了扫描(主动或被动),控制器也应根据条件保持监视。 启用活动扫描后,应将筛选器匹配的播发扫描响应传播到主机。

If the controller receives a HCI_VS_MSFT_LE_Monitor_Advertisement command when the filters are disabled (due to a previously received HCI_VS_MSFT_LE_Set_Advertisement_Filter_Enable command with Enable set to 0x00), the controller shall accept the command if it can, but set it to a disabled state. 控制器也可能出于其他原因(如资源耗尽)拒绝该命令。

如果Monitor_options的所有位都清楚,控制器应返回错误代码 “HCI 命令参数无效 ”(0x12)。

如果设置了第 1 位或位 3 Monitor_options,并且Peer_device_IRK设置为无效的 IRK,或者未设置任何Monitor_options位,控制器应返回错误代码 “HCI 命令参数无效 ”(0x12)。

如果Monitor_options的位 0 位或位 1 位或位 2 或位 3 设置为0x03或0x04 Condition_type,则控制器应返回错误代码 “HCI 命令参数无效 ”(0x12)。

如果设置了Advertisement_report_filter_options位 0 并且RSSI_sampling_period是除0x00以外的任何值,控制器应返回错误代码 “HCI 命令参数无效 ”(0x12)。

Missing parameters

发出不包含所有参数的此命令版本时,应使用以下内容:

Parameter Value
Monitor_options 位 5 设置;清除所有其他位
Advertisement_report_filter_options 位 1 和 2 设置;清除所有其他位
Peer_device_IRK 0x0000000000000000 0000000000000000
Peer_device_address 0x000000000000
Peer_device_address_type 0x00

Command_parameters

Subcommand_opcode_v1 (1 八进制):

Value Parameter description
0x03 The subcommand opcode for HCI_VS_MSFT_LE_Monitor_Advertisement [v1].

Subcommand_opcode_v2 (1 八进制):

Value Parameter description
0x0F The subcommand opcode for HCI_VS_MSFT_LE_Monitor_Advertisement [v2].

RSSI_threshold_high (1 八进制):

Value Parameter description
0xXX 预期的最大 RSSI 值。 如果观察到的 RSSI 大于或等于此值,控制器将生成事件。
Unit: dBm
必需范围:-127 到 20(带符号整数)

RSSI_threshold_low (1 八进制):

Value Parameter description
0xXX 所需的最小 RSSI 值。 如果观察到的 RSSI 小于或等于此值,控制器将生成事件。
Unit: dBm
必需范围:-127 到 20(带符号整数)

RSSI_threshold_low_time_interval (1 八进制):

Value Parameter description
0x00 Reserved value.
N = 0xXX The time in seconds over which the RSSI value should be below RSSI_threshold_low before an HCI_VS_MSFT_Rssi_Event is generated
Time period = N * 1 second
必需范围:0x01 0x3C。

RSSI_sampling_period (1 八进制):

Value Parameter description
0x00 控制器应将所有收到的播发传播到主机。
N = 0xXX 采样间隔(以 100 毫秒为单位)。
Time period = N * 100 milliseconds.
必需范围:0x01到0xFE
0xFF 控制器不应将接收的任何播发传播到主机。

Monitor_options (1 八进制):

Bit number Parameter description
0 如果 AdvA 或其解析的标识地址与Peer_device_address和Peer_device_address_type匹配,并且 TargetA 不存在,或者如果存在,则允许根据扫描筛选器策略(如果这些 PDU 与Condition_Type中指定的条件匹配)来监视目标 A。
1 如果 AdvA 与 Peer_device_IRK Condition_Type中指定的条件匹配,控制器应监视 AdvA 可解析的播发 PDU;如果 TargetA 不存在,或者如果存在,则允许 TargetA 基于扫描筛选器策略。 如果在控制器中使用链接层隐私,则不应设置此位。
2 控制器应根据扫描筛选器策略监视允许 TargetA 的定向广告 PDU,以及 AdvA 或其解析的标识地址与Peer_device_address和Peer_device_address_type匹配的位置。 无论 PDU 是否与Condition_Type中指定的条件匹配,都是这样。
3 控制器应根据扫描筛选器策略监视允许 TargetA 的定向广告 PDU,以及 AdvA 可通过Peer_device_IRK解析的位置。 无论 PDU 是否与Condition_Type中指定的条件匹配,都是这样。 如果在控制器中使用链接层隐私,则不应设置此位。
4 控制器应根据扫描筛选器策略监视允许 TargetA 的定向广告 PDU,无论Peer_device_address、Peer_device_address_type或Peer_device_IRK的值,以及 PDU 是否与Condition_Type中指定的条件匹配。
5 如果这些 PDU 与Condition_Type中指定的条件匹配,控制器应监视来自目标A 不存在的任何 AdvA 的播发 PDU,或者如果存在,则允许根据扫描筛选器策略对 TargetA 进行播发。
所有其他位 保留以供将来使用

Advertisement_report_filtering_options (1 八进制):

Bit number Parameter description
0 筛选重复广告 PDU。 仅当0x00 RSSI_sampling_period时,才应设置此位。
1 如果这些 PDU 与指定的Monitor_options匹配,控制器应生成HCI_LE_Advertising_Report事件或HCI_LE_Directed_Advertising_Report事件,或者为旧版广告 PDU 生成HCI_LE_Extended_Advertising_Report事件。
2 如果这些 PDU 与指定的Monitor_options匹配,控制器应为扩展广告 PDU 生成HCI_LE_Extended_Advertising_Report事件。
3 如果这些 PDU 与指定的Monitor_options匹配,控制器应生成HCI_LE_Advertising_Report事件或HCI_LE_Directed_Advertising_Report事件或HCI_LE_Extended_Advertising_Report事件。
所有其他位 保留以供将来使用

Peer_device_address(6 个八进制):

Value Parameter description
0xXXXXXXXXXXXX 要匹配的公共设备地址或随机设备地址。

Peer_device_address_type (1 八进制):

Value Parameter description
0x00 公共设备地址
0x01 随机设备地址
所有其他值 保留以供将来使用

Peer_device_IRK(16 个八进制):

Value Parameter description
0x0000000000000000 0000000000000000 Invalid IRK. 设置Monitor_options位 1 或设置Monitor_options位 3 时,不应为值。
0xXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 要匹配的设备 IRK。 应填充Peer_device_address和Peer_device_address_type。

Condition_type (1 八进制):

Value Parameter description
0x01 条件是必须在播发上匹配的模式。
0x02 条件为 UUID 类型和 UUID。
0x03 条件是 IRK 的解析。 如果设置了任何Monitor_options位 0、1、2 或 3,则排除。
0x04 条件是蓝牙地址类型和蓝牙地址。 如果设置了任何Monitor_options位 0、1、2 或 3,则排除。

条件:条件的适用字段取决于Condition_type的值。 有关详细信息,请参阅Condition_type和条件参数部分。

Number_of_patterns (1 八进制):

Value Parameter description
0xXX Pattern_data 参数中指定的模式数。

Pattern_data(>3 个八进制):

Value Parameter description
Length 此模式的长度。
Data type 播发部分的数据类型。 这些值列在蓝牙分配号码文档中。
Start byte 要为指定的数据类型匹配的模式的起始位置。
Pattern 要匹配的模式(长度大小 - 0x2字节)。

UUID_type (1 八进制):

Value Parameter description
0x01 UUID 是一个 16 位服务。
0x02 UUID 是一个 32 位服务。
0x03 UUID 是一个 128 位服务。

UUID (2、4 或 16 八进制):

Value Parameter description
0xXXXX 如果UUID_type 0x01,则为 2 个字节。
如果UUID_type 0x02,则为 4 个字节。
如果UUID_type 0x03,则为 16 字节。

IRK (16 个八进制):

Value Parameter description
0xXXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX 用于解析专用地址的 IRK。

Address_type (1 八进制):

Value Parameter description
0x00 公共设备地址。
0x01 随机设备地址。
0xFF 0x02 保留值供将来使用。

BD_ADDR(6 个八进制):

Value Parameter description
0xXXXXXXXXXXXX 要监视的设备蓝牙地址。

Return_parameters

状态(1 个八进制):

Value Parameter description
0x00 命令成功。
0x07 如果控制器没有足够的内存来处理命令,则控制器应返回超出的内存容量。
Error code 命令失败。 See Error Codes in the Bluetooth Core specification for details.

Subcommand_opcode (1 八进制):

Value Parameter description
0x03或0x0F The subcommand opcode for HCI_VS_MSFT_LE_Monitor_Advertisement [v1] or HCI_VS_MSFT_LE_Monitor_Advertisement [v2], depending on which command was submitted.

Monitor_handle (1 八进制):

Value Parameter description
0x00 0xFF 此规则的句柄。 This handle is used as a parameter for HCI_VS_MSFT_LE_Cancel_Monitor_Advertisement to cancel monitoring the advertisement.
仅当状态0x00时,此参数才有效。

除非屏蔽离开,否则生成的事件

When the HCI_VS_MSFT_LE_Monitor_Advertisement command is received, the controller shall generate a Command Complete event.

HCI_VS_MSFT_LE_Cancel_Monitor_Advertisement

HCI_VS_MSFT_LE_Cancel_Monitor_Advertisement cancels a previously issued HCI_VS_MSFT_LE_Monitor_Advertisement command.

Command Code Command parameters Return parameters
HCI_VS_MSFT_LE_Cancel_Monitor_Advertisement 所选基代码 Subcommand_opcode,
Monitor_handle
Status,
Subcommand_opcode

控制器应立即生成 Command Completed 事件,以响应此命令。

Command_parameters

Subcommand_opcode (1 八进制):

Value Parameter description
0x04 The subcommand opcode for HCI_VS_MSFT_LE_Cancel_Monitor_Advertisement.

Connection_Handle (1 八进制):

Value Parameter description
0xXX 正在取消的筛选器的句柄。

Return_parameters

状态(1 个八进制):

Value Parameter description
0x00 命令成功。
0x07 如果控制器没有足够的内存来处理命令,则控制器应返回超出的内存容量。
Error code 命令失败。 See Error Codes in the Bluetooth Core specification for details.

Subcommand_opcode (1 八进制):

Value Parameter description
0x04 The subcommand opcode for HCI_VS_MSFT_LE_Cancel_Monitor_Advertisement.

除非屏蔽离开,否则生成的事件

The controller shall generate a Command Complete event when the HCI_VS_MSFT_LE_Cancel_Monitor_Advertisement command is received.

HCI_VS_MSFT_LE_Set_Advertisement_Filter_Enable

HCI_VS_MSFT_LE_Set_Advertisement_Filter_Enable设置播发筛选器的状态。

Command Code Command parameters Return parameters
HCI_VS_MSFT_LE_Set_Advertisement_Filter_Enable 所选基代码 Subcommand_opcode,
Enable
Status,
Subcommand_opcode

If Enable is set to 0x00, the controller shall propagate received advertisements to the host based on existing filter accept list settings. The controller shall continue monitoring the devices that are currently being monitored and generate an HCI_VS_MSFT_LE_Monitor_Device_Event with Monitor_state set to 0 if the device is no longer being monitored. The controller shall generate an HCI_VS_MSFT_LE_Monitor_Device_Event with Monitor_state set to 1 if a new device is being monitored. The host may issue HCI_VS_MSFT_LE_Set_Advertisement_Filter_Enable with Enable set to 0x01 to reenable all the filter conditions.

If Enable is set to 0x01, this command enables all filters that were set with a previously issued HCI_VS_MSFT_LE_Monitor_Advertisement command. 如果控制器未切换筛选器状态,控制器应拒绝HCI_VS_MSFT_LE_Set_Advertisement_Filter_Enable命令:

  • The controller shall reject an HCI_VS_MSFT_LE_Set_Advertisement_Filter_Enable command with Enable set to 0x01 if it previously received an HCI_VS_MSFT_LE_Set_Advertisement_Filter_Enable command with Enable set to 0x01.
  • The controller shall reject the HCI_VS_MSFT_LE_Set_Advertisement_Filter_Enable command with Enable set to 0x00 if it previously received an HCI_VS_MSFT_LE_Set_Advertisement_Filter_Enable command with Enable set to 0x00.

广告筛选器的默认状态应处于关闭状态。 This state is equivalent to the controller previously receiving a HCI_VS_MSFT_LE_Set_Advertisement_Filter_Enable command with Enable set to 0x00. 控制器应立即生成 Command Completed 事件,以响应此命令。

Command_parameters

Subcommand_opcode (1 八进制):

Value Parameter description
0x05 The subcommand opcode for HCI_VS_MSFT_LE_Set_Advertisement_Filter_Enable.

启用(1 个八进制):

Value Parameter description
0x00 Revert to current filter accept list behavior, but continue monitoring devices based on the Condition from HCI_VS_MSFT_LE_Monitor_Advertisement commands.
0x01 Enable all issued HCI_VS_MSFT_LE_Monitor_Advertisement commands on the controller.

Return_parameter

状态(1 个八进制):

Value Parameter description
0x00 命令成功。
0x0C The controller shall return Command Disallowed if the controller rejected the command because it previously saw an HCI_VS_MSFT_LE_Set_Advertisement_Filter_Enable command with Enable set to the same value as this command.
Error code 命令失败。 See Error Codes in the Bluetooth Core specification for details.

Subcommand_opcode (1 八进制):

Value Parameter description
0x05 The subcommand opcode for HCI_VS_MSFT_LE_Set_Advertisement_Filter_Enable.

除非屏蔽离开,否则生成的事件

The controller shall generate a Command Complete event when the HCI_VS_MSFT_LE_Set_Advertisement_Filter_Enable command is received.

HCI_VS_MSFT_Read_Absolute_RSSI

HCI_VS_MSFT_Read_Absolute_RSSI reads the absolute Received Signal Strength Indication (RSSI) value for a BR/EDR connection from the controller.

Command Code Command parameters Return parameters
HCI_VS_MSFT_Read_Absolute_RSSI 所选基代码 Subcommand_opcode,
Connection_Handle
Status,
Subcommand_opcode,
Connection_Handle,
RSSI

连接句柄作为命令提供,并返回参数用于标识其 RSSI 正在读取的 ACL 连接。 The RSSI metric is the absolute receiver signal strength in dBm to ± 6 dB accuracy. 如果无法读取 RSSI,则 RSSI 指标应设置为 127。 控制器应始终使用 Command Completed 事件及时完成此命令。

Command_parameters

Subcommand_opcode (1 八进制):

Value Parameter description
0x06 HCI_VS_MSFT_Read_Absolute_RSSI的子命令作码。

Connection_Handle(2 个八进制):

Value Parameter description
0xXXXX 必须读取其 RSSI 的 BR/EDR 连接的句柄。

Return_parameters

状态(1 个八进制):

Value Parameter description
0x00 命令成功。
0x01 0xFF 命令失败。 See Error Codes in the Bluetooth Core specification for details.

Subcommand_opcode (1 八进制):

Value Parameter description
0x06 The subcommand opcode for HCI_VS_MSFT_Read_Absolute_RSSI.

Connection_Handle(2 个八进制):

Value Parameter description
0xXXXX 读取 RSSI 的 BR/EDR 连接的句柄。

RSSI (1 八进制):

Value Parameter description
N = 0xXX BR/EDR 连接的 RSSI 值。
Unit: dBm
必需范围:-128 到 127(带符号整数)

除非屏蔽离开,否则生成的事件

The controller shall generate a Command Complete event when the HCI_VS_MSFT_Read_Absolute_RSSI command has completed.

Microsoft定义的蓝牙 HCI 事件

所有Microsoft定义的蓝牙 HCI 事件都是供应商定义的事件,并使用事件代码0xFF。 Microsoft事件的事件数据始终以常量字符串开头,以区分Microsoft定义的事件与其他供应商定义的事件。 The length and value of the constant string are defined by the controller implementer and returned in response to HCI_VS_MSFT_Read_Supported_Features.

HCI event Description
HCI_VS_MSFT_Rssi_Event HCI_VS_MSFT_RSSI_Event indicates that an HCI_VS_MSFT_Monitor_Rssi command has completed.
HCI_VS_MSFT_LE_Monitor_Device_Event HCI_VS_MSFT_LE_Monitor_Device_Event指示控制器已启动或停止监视蓝牙 LE 设备。

HCI_VS_MSFT_RSSI_Event

HCI_VS_MSFT_RSSI_Event indicates that an HCI_VS_MSFT_Monitor_Rssi command has completed. If the Status parameter is zero, the command completed because the RSSI value for the remote device changed to a value outside of the specified range. If the Status parameter is nonzero, the command completed because the RSSI value of the connection can no longer be monitored.

Event Event Code Microsoft事件代码 Event parameters
HCI_VS_MSFT_RSSI_Event 0xFF 0x01 Event_prefix,
Microsoft_event_code,
Status,
Connection_Handle,
RSSI

Event_parameters

Event_prefix(可变大小):

Value Parameter description
Event prefix 将此事件标记为Microsoft定义的事件前缀。 The size and value are as returned by the HCI_VS_MSFT_Read_Supported_Features command.

Microsoft_event_code (1 octet):

Value Parameter description
0x01 The event code for HCI_VS_MSFT_RSSI_Event.

状态(1 个八进制):

Value Parameter description
0x00 Success. 连接的 RSSI 值满足以下条件之一。 The RSSI reached or exceeded RSSI_threshold_high.
The RSSI reached or dropped below RSSI_threshold_low over RSSI_threshold_low_time_interval seconds.
The RSSI_sampling_period has expired and this event was generated to notify the host of the RSSI value.
0x01 0xFF Failure. 无法再监视连接的 RSSI 值。 错误代码通常是描述基础 ACL 连接丢失的原因的代码之一。

Connection_Handle(2 个八进制):

Value Parameter description
0xXXXX 要监视其 RSSI 的连接句柄。

RSSI (1 八进制):

Value Parameter description
0xXX 连接的测量链接 RSSI 值。
Unit: dBm
BR/EDR 范围:-128 到 127(带符号整数)
LE 范围:-127 到 20(带符号整数)

HCI_VS_MSFT_LE_Monitor_Device_Event

HCI_VS_MSFT_LE_Monitor_Device_Event指示控制器已启动或停止监视蓝牙 LE 设备。

If the Monitor_state parameter value is 1, the controller started monitoring the Bluetooth device with the specified BD_ADDR. If the Monitor_state parameter value is 0, the controller stopped monitoring the Bluetooth device with the specified BD_ADDR.

Event Event Code Microsoft事件代码 Event parameters
HCI_VS_MSFT_LE_Monitor_Device_Event 0xFF 0x02 Event_prefix,
Microsoft_event_code,
Address_type,
BD_ADDR,
Monitor_handle,
Monitor_state

The controller shall not generate an HCI_VS_MSFT_LE_Monitor_Device_Event with the Monitor_state parameter set to 0 if it hasn't already generated an HCI_VS_MSFT_LE_Monitor_Device_Event with Monitor_state set to 1.

Event_parameters

Event_prefix(可变大小):

Value Parameter description
Event prefix 将此事件标记为Microsoft定义的事件前缀。 The size and value are as returned by the HCI_VS_MSFT_Read_Supported_Features command.

Microsoft_event_code (1 octet):

Value Parameter description
0x02 The event code for HCI_VS_MSFT_LE_Monitor_Device_Event.

Address_type (1 八进制):

Value Parameter description
0x00 公共设备地址。
0x01 随机设备地址。
0xFF 0x02 保留值供将来使用。

BD_ADDR(6 个八进制):

Value Parameter description
0xXXXXXXXXXXXX 设备的蓝牙地址。

Monitor_handle (1 八进制):

Value Parameter description
0xXX The handle to the filter that was specified for the HCI_VS_MSFT_LE_Monitor_Advertisement command.

Monitor_state (1 八进制):

Value Parameter description
0x00 The controller stopped monitoring the device specified by BD_ADDR and Monitor_handle.
0x01 The controller started monitoring the device specified by BD_ADDR and Monitor_handle.

Microsoft定义的 AVDTP HCI 命令

以下 AVDTP HCI 命令为音频旁带 A2DP 卸载提供支持。 有关详细信息,请参阅 音频旁带 A2DP 卸载

HCI AVDTP 命令 Description
HCI_VS_MSFT_Avdtp_Capabilities_Configuration 配置音频传输接口并返回蓝牙控制器的编解码器功能,这是编解码器信息块的列表。
HCI_VS_MSFT_Avdtp_Open 在控制器中分配和配置 AVDTP 卸载资源。
HCI_VS_MSFT_Avdtp_Start 开始从音频传输到传输的 AVDTP 媒体数据包的音频流式传输。
HCI_VS_MSFT_Avdtp_Suspend 停止由HCI_VS_MSFT_Avdtp_Start启动的流式处理活动。
HCI_VS_MSFT_Avdtp_Close 释放由HCI_VS_MSFT_Avdtp_Open分配的 AVDTP 卸载资源。

HCI_VS_MSFT_Avdtp_Capabilities_Configuration

HCI_VS_MSFT_Avdtp_Capabilities_Configuration配置音频传输接口并返回蓝牙控制器的编解码器功能,这是编解码器信息块列表。 每个编解码器信息块描述一个受支持的编解码器。

下面的一些参数是具有可变长度的结构数组,因此假定所有这些参数仍适合一个 HCI 命令和一个相应的 HCI 事件。

Command_parameters

External_codec_count (1 八进制):

Value Parameter description
0x00-0xFF 以下Codec_capability块的计数。

External_codec_capability(可变长度):

Value Parameter description
编解码器功能块 编解码器功能信息块,如编解码器功能信息中所述。 这描述了附加到音频接口的设备支持的单个编解码器。

This data structure repeats External_codec_count times.

Audio_interface_parameter_count (1 八进制):

Value Parameter description
0x00-0xFF 后面的Audio_interface_parameters计数。

Audio_interface_parameter (可变长度)

Value Parameter description
音频接口参数 如上所述的音频接口参数,由连接到音频接口的设备设置。

This data structure repeats Audio_interface_parameter_count times.

Return_parameters

状态(1 个八进制):

Value Parameter description
0x00 命令成功。
0x01-0xFF 命令失败。 有关详细信息,请参阅蓝牙核心规范中的错误代码。

Subcommand_opcode _ (1 八进制):

Value Parameter description
0x07 HCI_VS_MSFT_Avdtp_Capabilities_Configuration的子命令作码。

Internal_codec_count (1 八进制):

Value Parameter description
0x00-0xFF 以下Internal_codec_capability块的计数。

Internal_codec_capability(可变长度):

Value Parameter description
编解码器功能块 音频旁带 A2DP 卸载中所述的编解码器功能信息块。 这描述了蓝牙控制器支持的单个编解码器。

此数据结构重复Internal_codec_count次。

Audio_interface_parameter_count (1 八进制):

Value Parameter description
0x00-0xFF 后面的Audio_interface_parameters计数。

Audio_interface_parameter (可变长度)

Value Parameter description
音频接口参数 如上所述的音频接口参数。 主机软件将此参数传递给连接到音频接口的设备。

此数据结构重复Audio_interface_parameter_count次。

HCI_VS_MSFT_Avdtp_Open

在控制器中分配和配置 AVDTP 卸载资源。

下面的一些参数是具有可变长度的结构数组,因此假定所有这些参数仍适合一个 HCI 命令和一个相应的 HCI 事件。

Command_parameters

Connection_handle (2 个八进制)

Value Parameter description
0xXXXX IIdentifs AVDTP 媒体 L2CAP 通道连接到远程设备。

L2cap_destination_cid (2 个八进制)

Value Parameter description
0xXXXX AVDTP 媒体通道的 L2CAP 目标 CID

L2cap_mtu (2 个八进制)

Value Parameter description
0xXXXX L2CAP AVDTP 媒体通道 MTU

Configured_codec_capability(可变长度):

Value Parameter description
编解码器功能块 音频旁带 A2DP 卸载中所述的编解码器功能信息块。 这描述了为 AVDTP 媒体配置的编解码器。

Audio_interface_parameter_count (1 八进制):

Value Parameter description
0x00-0xFF 后面的Audio_interface_parameters计数。

Audio_interface_parameter (可变长度)

Value Parameter description
音频接口参数 如上所述的音频接口参数。 连接到音频接口的设备为特定流实例指定这些参数。

此数据结构重复Audio_interface_parameter_count次。

Return_parameters

状态(1 个八进制):

Value Parameter description
0x00 命令成功。
0x01-0xFF 命令失败。 有关详细信息,请参阅蓝牙核心规范中的错误代码。

Subcommand_opcode (1 八进制):

Value Parameter description
0x08 HCI_VS_MSFT_Avdtp_Open的子命令作码。

Avdtp_offload_handle(2 个八进制):

Value Parameter description
0xXXXX 标识为卸载的流分配的资源。

Audio_interface_parameter_count (1 八进制):

Value Parameter description
0x00-0xFF 后面的Audio_interface_parameters计数。

Audio_interface_parameter (可变长度)

Value Parameter description
音频接口参数 如上所述的音频接口参数。 主机软件将此参数传递给连接到流实例音频接口的设备。

此数据结构重复Audio_interface_parameter_count次。

HCI_VS_MSFT_Avdtp_Start

此命令开始从音频传输到传输的 AVDTP 媒体数据包的音频流式传输。 执行此命令后,蓝牙控制器将开始以下活动。

  • 从音频传输接收音频数据
  • 如果编码器位于蓝牙控制器中,则对从音频传输接收的数据进行编码以生成编码帧
  • 如果编码器位于音频 DSP 中,请从音频传输中提取编码的帧
  • 将编码的帧组合到 AVDTP 媒体有效负载中
  • 构造和传输包含媒体有效负载的 AVDTP 媒体数据包

Command_parameters

Avdtp_offload_handle(2 个八进制):

Value Parameter description
0xXXXX 标识为卸载的流分配的资源。

Return_parameters

状态(1 个八进制):

Value Parameter description
0x00 命令成功。
0x01-0xFF 命令失败。 有关详细信息,请参阅蓝牙核心规范中的错误代码。

Subcommand_opcode (1 八进制):

Value Parameter description
0x09 HCI_VS_MSFT_Avdtp_Start的子命令作码。

HCI_VS_MSFT_Avdtp_Suspend

停止由HCI_VS_MSFT_Avdtp_Start启动的流式处理活动。

Command_parameters

Avdtp_offload_handle(2 个八进制):

Value Parameter description
0xXXXX 标识为卸载流分配的资源

Return_parameters

状态(1 个八进制):

Value Parameter description
0x00 命令成功。
0x01-0xFF 命令失败。 有关详细信息,请参阅蓝牙核心规范中的错误代码。

Subcommand_opcode (1 八进制):

Value Parameter description
0x0A HCI_VS_MSFT_Avdtp_Suspend的子命令作码。

HCI_VS_MSFT_Avdtp_Close

释放由HCI_VS_MSFT_Avdtp_Open分配的 AVDTP 卸载资源。

Command_parameters

Avdtp_offload_handle(2 个八进制):

Value Parameter description
0xXXXX 注意:此命令完成后,此值不再有效。

Return_parameters

状态(1 个八进制):

Value Parameter description
0x00 命令成功。
0x01-0xFF 命令失败。 有关详细信息,请参阅蓝牙核心规范中的错误代码。

Subcommand_opcode (1 八进制):

Value Parameter description
0x0B HCI_VS_MSFT_Avdtp_Close的子命令作码。
Value Parameter description
0x00
0x01 The controller started monitoring the device specified by BD_ADDR and Monitor_handle.

Appendix

本部分包含Microsoft定义的蓝牙 HCI 扩展示例和关系图。

示例:HCI_VS_MSFT_LE_Monitor_Advertisement的匹配模式

This example shows a received HCI_VS_MSFT_LE_Monitor_Advertisement command and the evaluations of three different advertisement packets against the command parameters.

Received HCI_VS_MSFT_LE_Monitor_Advertisement command An HCI_VS_MSFT_LE_Monitor_Advertisement command is received by the controller and contains the following parameters.

Parameter Value Notes
Subcommand_opcode 0x03 Subcommand opcode for HCI_VS_MSFT_LE_Monitor_Advertisement
RSSI_threshold_high 0x01 1dB
RSSI_threshold_low 0xCE -50dB
RSSI_threshold_low_time_interval 0x05 5 seconds
RSSI_sampling_period 0xFF No sampling
Condition_type 0x01 Condition
Condition 0x02 应匹配两种模式
0x03 第一个模式的长度,包括 AD 类型和起始位置
0x01 AD Type
0x00 AD 类型后面的起始位置
0x01 要匹配的第一个模式
0x06 第二个模式的长度,包括 AD 类型和起始位置
0xFF AD 类型(制造商特定数据)
0x00 AD 类型后面的起始位置
0x00 要匹配的第二种模式
0x06
0xFF
0xFF

然后,控制器会收到以下播发数据包。

  • 播发数据包 [A]

    0x02 0x01 0x01 0x07 0x09 0x54 0x61 0x62 0x6C 0x65 0x74 0x05 0xFF 0x00 0x06 0xFF 0xFF

  • 播发数据包 [B]

    0x02 0x01 0x01 0x07 0x09 0x54 0x61 0x62 0x6C 0x65 0x74 0x04 0xFF 0x00 0x06 0xFF

  • 播发数据包 [C]

    0x07 0x09 0x54 0x61 0x62 0x6C 0x65 0x74 0x05 0xFF 0x00 0x06 0xFF 0xFF

  • 播发数据包 [D]

    0x02 0x01 0x02 0x05 0xFF 0x00 0x06 0xFF 0x01

评估播发数据包的匹配 [A]

Description Value
要匹配的第一个模式的 AD 类型 0x01
要匹配的第一个模式的长度 0x03 - 0x02 = 0x01 字节
在 AD 类型0x01的位置0x00匹配的模式 0x01
AD 类型0x01的位置0x00字节数 0x01 (MATCH!)
要匹配的第二种模式的 AD 类型 0xFF(制造商特定数据)
要匹配的第二个模式的长度 0x06 - 0x02 = 0x04 字节
在 AD 类型0xFF的位置0x00匹配的模式 0x00 0x06 0xFF 0xFF
AD 类型0xFF的位置0x00字节 0x00 0x06 0xFF 0xFF (MATCH!)

Verdict: PASS (both patterns match)

评估播发数据包的匹配 [B]

Description Value
要匹配的第一个模式的 AD 类型 0x01
要匹配的第一个模式的长度 0x03 - 0x02 = 0x01 字节
在 AD 类型0x01的位置0x00匹配的模式 0x01
AD 类型0x01的位置0x00字节数 0x01 (MATCH!)
要匹配的第二种模式的 AD 类型 0xFF(制造商特定数据)
要匹配的第二个模式的长度 0x06 - 0x02 = 0x04 字节
在 AD 类型0xFF的位置0x00匹配的模式 0x00 0x06 0xFF 0xFF
AD 类型0xFF的位置0x00字节 0x00 0x06 0xFF (no match)

Verdict: PASS (only first pattern matches)

评估播发数据包的匹配 [C]

Description Value
要匹配的第一个模式的 AD 类型 0x01
要匹配的第一个模式的长度 0x03 - 0x02 = 0x01 字节
在 AD 类型0x01的位置0x00匹配的模式 0x01
AD 类型0x01的位置0x00字节数 Undefined. 广告没有 AD 类型0x01的数据。
要匹配的第二种模式的 AD 类型 0xFF(制造商特定数据)
要匹配的第二个模式的长度 0x06 - 0x02 = 0x04 字节
在 AD 类型0xFF的位置0x00匹配的模式 0x00 0x06 0xFF 0xFF
AD 类型0xFF的位置0x00字节 0x00 0x06 0xFF 0xFF (MATCH!)

Verdict: PASS (only second pattern matches)

评估播发数据包的匹配 [D]

Description Value
要匹配的第一个模式的 AD 类型 0x01
要匹配的第一个模式的长度 0x03 - 0x02 = 0x01 字节
在 AD 类型0x01的位置0x00匹配的模式 0x01
AD 类型0x01的位置0x00字节数 0x02 (no match)
要匹配的第二种模式的 AD 类型 0xFF(制造商特定数据)
要匹配的第二个模式的长度 0x06 - 0x02 = 0x04 字节
在 AD 类型0xFF的位置0x00匹配的模式 0x00 0x06 0xFF 0xFF
AD 类型0xFF的位置0x00字节 0x00 0x06 0xFF 0x01 (no match)

Verdict: FAIL (neither pattern matches)

示例:播发监视

此示例演示 RSSI 播发监视。 下面显示了与指定条件匹配的已接收播发的 RSSI 值。

Time (s) RSSI (dB)
1 -100
2 -90
3 -5
4 -15
5 -30
6 -15
7 -45
8 -20
9 -35
10 -45
11 -70
12 -85
13 -85
14 -85
15 -90
16 -90
17 -70
Parameter Value
RSSI_threshold_high -10dB
RSSI_threshold_low -80dB
RSSI_threshold_low_time_interval 3 seconds
RSSI_sampling_period 2 seconds

显示一段时间内具有 RSSI 值的播发监视的图。

The advertisement RSSI is greater than RSSI_threshold_high at time 3. 采样的定期计时器从时间 3 开始。 每隔 2 秒,定期计时器过期,接收播发的平均 RSSI 值将传播到堆栈。

当定期计时器在 5 时过期时,在此期间(-23dB)收到的广告 RSSIs 的平均值将传播到堆栈。

When the periodic timer expires at time 13, the average of the advertisement RSSIs received during this timeframe is below RSSI_threshold_low (-80dB). 广告 RSSI(-85 dB)的平均值应传播到主机。

When RSSI_threshold_low_time_interval expires at instant 15, an advertisement is propagated to the host with RSSI of -85dB. 在此示例中,不会向主机发送进一步广告。

示例:监视来自设备的 BAP 公告

虽然与 CAP 接受器绑定,但未连接,但主机可以监视来自该设备的 BAP 公告。

Parameter Value
Subcommand_opcode_v2 0x0F
RSSI_threshold_high -127
RSSI_threshold_low -127
RSSI_threshold_low_time_interval 0x05
RSSI_sampling_period 0x00
Monitor_options 位 0 设置;如果设备分发了 IRK,则设置位 1
Advertisement_report_filtering_options 位 0、1 和 2 集
Peer_device_address <地址>
Peer_device_address_type <地址类型>
Peer_device_IRK <如果设置了位 1,则为 IRK>
Condition_type 0x01
Number_of_patterns 0x01
Pattern_data 0x04 (length)
0x16 (服务数据 – 16 位 UUID)
0x00 (起始字节)
0x4E(ASCS UUID 的低字节)
0x18 (ASCS UUID 的高字节)

示例:从设备监视 CAP 公告

虽然与 CAP 指挥官绑定,但未连接,但主机可以从该设备监视 CAP 公告。

Parameter Value
Subcommand_opcode_v2 0x0F
RSSI_threshold_high -127
RSSI_threshold_low -127
RSSI_threshold_low_time_interval 0x05
RSSI_sampling_period 0x00
Monitor_options 位 0 设置;如果设备分发了 IRK,则设置位 1
Advertisement_report_filtering_options 位 0、1 和 2 集
Peer_device_address <地址>
Peer_device_address_type <地址类型>
Peer_device_IRK <如果设置了位 1,则为 IRK>
Condition_type 0x01
Number_of_patterns 0x01
Pattern_data 0x04 (length)
0x16 (服务数据 – 16 位 UUID)
0x00 (起始字节)
0x53 (CAS UUID 的低字节)
0x18 (CAS UUID 的高字节)

流程图:播发和筛选接受列表筛选

此流程图提供播发筛选的示例控制器实现,并在收到播发时筛选接受列表筛选。

A controller can implement this logic differently, as long as the host is notified of the advertisement or HCI_VS_MSFT_LE_Monitor_Device_Event as specified by the flowchart.

显示Microsoft HCI 扩展筛选过程的流程图。

序列图:传播与播发关联的扫描响应

序列图:传播与播发关联的扫描响应

此序列图显示了一个传播扫描响应,该响应与启用活动扫描时满足播发筛选器的广告相关联。 此图仅显示控制器和主机之间的预期事件序列,并且不显示控制器和特定设备之间的事件。 Assume that there's an advertisement A that satisfies an advertisement filter, and an advertisement B that doesn't satisfy the advertisement filter.

显示 HCI 传播与播发关联的扫描响应的序列图。