当前位置: 首页 > article >正文

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 );

http://www.kler.cn/a/521320.html

相关文章:

  • 10 外观(Facade)模式
  • 基于先验领域知识的归纳式多实例多标签学习用于牙周病分类| 文献速递 -医学影像人工智能进展
  • 【Django DRF Apps】【文件上传】【断点上传】从零搭建一个普通文件上传,断点续传的App应用
  • 游戏策划的分类
  • 性能测试丨JVM 性能数据采集
  • 【2024年华为OD机试】 (C卷,100分)- 爱吃蟠桃的孙悟空(JavaScriptJava PythonC/C++)
  • SpringSecurity相关面试试题及答案解析
  • Flutter解决macbook M芯片Android Studio中不显示IOS真机的问题
  • 【漫话机器学习系列】062.向前逐步选择法(Forward Stepwise Selection)
  • Django网站搭建流程
  • “破冰”探索两周年,AI和媒体碰撞出了什么火花?
  • 第二十一周:Mask R-CNN
  • 数据结构--树
  • 深入解析 VPN、URL 和堡垒机的原理与应用
  • 小偷之打家劫舍
  • /opt安装软件,就可以使用man xx命令是为什么
  • webview_flutter_wkwebview 3.17.0使用指南
  • Vue2 项目目录说明与配置
  • ubuntu解决普通用户无法进入root
  • 高级IO__