欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 房产 > 家装 > windows蓝牙驱动开发-生成和发送蓝牙请求块 (BRB)

windows蓝牙驱动开发-生成和发送蓝牙请求块 (BRB)

2025/2/3 1:32:25 来源:https://blog.csdn.net/m0_72813396/article/details/145368812  浏览:    关键词:windows蓝牙驱动开发-生成和发送蓝牙请求块 (BRB)

以下过程概述了配置文件驱动程序生成和发送蓝牙请求块 (BRB) 应遵循的一般流程。 BRB 是描述要执行的蓝牙操作的数据块。

生成和发送 BRB
  • 分配 IRP。
  • 分配BRB,请调用蓝牙驱动程序堆栈导出以供配置文件驱动程序使用的 BthAllocateBrb 函数。;
  • 初始化 BRB 的参数。 每个 BRB 都使用相应的结构。 根据预期用途设置结构的成员;
  • 初始化 IRP 的参数。 将 IRP 的 MajorFunction 成员设置为 IRP_MJ_INTERNAL_DEVICE_CONTROL。 将 Parameters.DeviceIoControl.IoControlCode 成员设置为 IOCTL_INTERNAL_BTH_SUBMIT_BRB。 将 Parameters.Others.Argument1 成员设置为指向 BRB;
  • 沿着驱动程序堆栈向下方向传递 IRP。 调用 IoCallDriver 以将 IRP 发送到下一个较低的驱动程序;

以下伪代码示例演示了如何为要处理的蓝牙驱动程序堆栈设置 L2CAP Ping BRB。 为了提高可读性,该示例不演示错误处理。

#include <bthddi.h>// Code for obtaining the BthInterface pointer// Define a custom pool tag to identify your profile driver's dynamic memory allocations.
// You should change this tag to easily identify your driver's allocations from other drivers.
#define PROFILE_DRIVER_POOL_TAG '_htB'PIRP Irp;
Irp = IoAllocateIrp( DeviceExtension->ParentDeviceObject->StackSize, FALSE );PBRB_L2CA_PING BrbPing; // Define storage for a L2CAP Ping BRB// Allocate the Ping BRB
BrbPing = BthInterface->BthAllocateBrb( BRB_L2CA_PING, PROFILE_DRIVER_POOL_TAG );// Set up the next IRP stack location
PIO_STACK_LOCATION NextIrpStack;
NextIrpStack = IoGetNextIrpStackLocation( Irp );
NextIrpStack->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;
NextIrpStack->Parameters.DeviceIoControl.IoControlCode = IOCTL_INTERNAL_BTH_SUBMIT_BRB;
NextIrpStack->Parameters.Others.Argument1 = BrbPing;// Pass the IRP down the driver stack
NTSTATUS Status;
Status = IoCallDriver( DeviceExtension->NextLowerDriver, Irp );

版权声明:

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

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