首页 > 其他分享 >HCI初始化流程

HCI初始化流程

时间:2023-09-13 18:34:45浏览次数:30  
标签:初始化 LE Read 流程 Supported Write Set HCI

HCI 初始化流程

1、HCI_Reset    初始化的第一步

2、确定bt chip支持的command、feature、地址等

HCI_Read_Local_Version_Information

HCI_Read_Local_Supported_Commands

HCI_Read_Local_Supported_Features

HCI_Read_Local_Extended_Features

HCI_Read_BD_ADDR

 

3、设置接收哪些event

HCI_Set_Event_Mask

 

4、如果支持controller to host的流控(一般不用)

HCI_Set_Controller_To_Host_Flow_Control

HCI_Host_Buffer_Size

 

5、如果支持host to controller的流控(一般不用)

HCI_Read_Buffer_Size

 

6、设置Link key相关(一般用HCI_Delete_Stored_Link_Key,不用bt chip存储link key)

HCI_Read_Stored_Link_Key

HCI_Write_Stored_Link_Key

HCI_Delete_Stored_Link_Key

 

7、设置本地设备名

HCI_Write_Local_Name

设置SCO的配置

HCI_Write_Voice_Setting

 

8、设置cod

HCI_Write_Class_of_Device

 

9、设置IAC(一般不用)

HCI_Write_Current_IAC_LAP

 

10、设置是否可被搜索是否可被连接

HCI_Write_Scan_Enable

 

11、设置搜索相关

HCI_Write_Inquiry_Scan_Type 设置隔行/逐行扫描

HCI_Write_Inquiry_Mode  设置标准搜索/RSSI搜索/RSSI和eir搜索

HCI_Write_Extended_Inquiry_Response 设置eir

 

12、设置page相关

HCI_Write_Page_Timeout     设置page timeout

HCI_Write_Page_Scan_Type    设置逐行/隔行 page scan

 

13、设置是否需要认证

HCI_Write_Authentication_Enable 设置authentication enable

HCI_Write_Simple_Pairing_Mode   设置是否支持bt2.1

HCI_Write_Secure_Connections_Host_Support 设置是否支持secure connection


 

android bluedroid hci 指令定义:

https://cs.android.com/android/platform/superproject/+/master:packages/modules/Bluetooth/system/stack/include/
hcidefs.h;l=267?q=int%20hci_read_bd_addr&ss=android
#define HCI_READ_BD_ADDR (0x0009 | HCI_GRP_INFORMATIONAL_PARAMS)


https://cs.android.com/android/kernel/superproject/+/common-android-mainline:common/net/bluetooth/hci_sync.c;l=3296?q=int%20hci_read_bd_addr&ss=android

/* Read BD Address */
static int hci_read_bd_addr_sync(struct hci_dev *hdev)
{
return __hci_cmd_sync_status(hdev, HCI_OP_READ_BD_ADDR,
0, NULL, HCI_CMD_TIMEOUT);
}


bluez hci 指令定义
https://android.googlesource.com/platform/external/bluetooth/bluez/+/master/lib/bluetooth/hci_lib.h
int hci_read_bd_addr(int dd, bdaddr_t *bdaddr, int to);


 

常见的Android支持的HCI 指令集:

HCI UART:
    HCI Packet Type: Event Packet
HCI:
    HCI Event
        Event: HCI_Command_Complete
        Total Length: 68
        Num_HCI_Command_Packets: 1
        Command_Opcode
            Opcode: 0x1002
            Opcode Group (OGF): Informational Parameters command
            Command: HCI_Read_Local_Supported_Commands
        Return_Parameter(s)
            Status: Success
            HCI_Create_Connection_Cancel : Supported
            HCI_Disconnect: Supported
            HCI_Create_Connection: Supported
            HCI_Exit_Periodic_Inquiry_Mode: Supported
            HCI_Periodic_Inquiry_Mode: Supported
            HCI_Inquiry_Cancel: Supported
            HCI_Inquiry: Supported
            HCI_Authentication_Requested : Supported
            HCI_Change_Connection_Packet_Type: Supported
            HCI_PIN_Code_Request_Negative_Reply: Supported
            HCI_PIN_Code_Request_Reply: Supported
            HCI_Link_Key_Request_Negative_Reply: Supported
            HCI_Link_Key_Request_Reply: Supported
            HCI_Reject_Connection_Request: Supported
            HCI_Accept_Connection_Request: Supported
            HCI_Read_Remote_Version_Information: Supported
            HCI_Read_Remote_Extended_Features: Supported
            HCI_Read_Remote_Supported_Features: Supported
            HCI_Remote_Name_Request_Cancel : Supported
            HCI_Remote_Name_Request: Supported
            HCI_Master_Link_Key: Supported
            HCI_Change_Connection_Link_Key: Supported
            HCI_Set_Connection_Encryption: Supported
            HCI_Read_LMP_Handle: Supported
            HCI_Read_Clock_Offset: Supported
            HCI_Role_Discovery: Supported
            HCI_QoS_Setup: Supported
            HCI_Exit_Sniff_Mode: Supported
            HCI_Sniff_Mode: Supported
            HCI_Reset: Supported
            HCI_Set_Event_Mask: Supported
            HCI_Flow_Specification: Supported
            HCI_Write_Default_Link_Policy_Settings: Supported
            HCI_Read_Default_Link_Policy_Settings: Supported
            HCI_Write_Link_Policy_Settings: Supported
            HCI_Read_Link_Policy_Settings: Supported
            HCI_Switch_Role: Supported
            HCI_Delete_Stored_Link_Key: Supported
            HCI_Write_Stored_Link_Key: Supported
            HCI_Read_Stored_Link_Key: Supported
            Previously used: Supported
            HCI_Write_PIN_Type: Supported
            HCI_Read_PIN_Type: Supported
            HCI_Flush: Supported
            HCI_Set_Event_Filter: Supported
            HCI_Write_Scan_Enable: Supported
            HCI_Read_Scan_Enable: Supported
            HCI_Write_Page_Timeout: Supported
            HCI_Read_Page_Timeout: Supported
            HCI_Write_Connection_Accept_Timeout: Supported
            HCI_Read_Connection_Accept_Timeout: Supported
            HCI_Read_Local_Name: Supported
            HCI_Write_Local_Name: Supported
            HCI_Write_Authentication_Enable: Supported
            HCI_Read_Authentication_Enable: Supported
            HCI_Write_Inquiry_Scan_Activity: Supported
            HCI_Read_Inquiry_Scan_Activity: Supported
            HCI_Write_Page_Scan_Activity: Supported
            HCI_Read_Page_Scan_Activity: Supported
            HCI_Write_Num_Broadcast_Retransmissions: Supported
            HCI_Read_Num_Broadcast_Retransmissions: Supported
            HCI_Write_Automatic_Flush_Timeout: Supported
            HCI_Read_Automatic_Flush_Timeout: Supported
            HCI_Write_Voice_Setting: Supported
            HCI_Read_Voice_Setting: Supported
            HCI_Write_Class_Of_Device: Supported
            HCI_Read_Class_Of_Device: Supported
            HCI_Host_Number_Of_Completed_Packets: Supported
            HCI_Host_Buffer_Size: Supported
            HCI_Set_Controller_To_Host_Flow_Control: Supported
            HCI_Write_Synchronous_Flow_Control_Enable: Supported
            HCI_Read_Synchronous_Flow_Control_Enable: Supported
            HCI_Read_Transmit_Power_Level: Supported
            HCI_Write_Current_IAC_LAP: Supported
            HCI_Read_Current_IAC_LAP: Supported
            HCI_Read_Number_Of_Supported_IAC: Supported
            HCI_Write_Link_Supervision_Timeout: Supported
            HCI_Read_Link_Supervision_Timeout: Supported
            HCI_Write_Inquiry_Mode: Supported
            HCI_Read_Inquiry_Mode: Supported
            HCI_Write_Inquiry_Scan_Type: Supported
            HCI_Read_Inquiry_Scan_Type: Supported
            HCI_Set_AFH_Host_Channel_Classification : Supported
            HCI_Write_AFH_Channel_Assessment_Mode: Supported
            HCI_Read_AFH_Channel_Assessment_Mode: Supported
            HCI_Write_Page_Scan_Type: Supported
            HCI_Read_Page_Scan_Type: Supported
            HCI_Read_Buffer_Size: Supported
            HCI_Read_Local_Extended_Features: Supported
            HCI_Read_Local_Supported_Features: Supported
            HCI_Read_Local_Version_Information: Supported
            HCI_Read_Clock: Supported
            HCI_Read_AFH_Channel_Map: Supported
            HCI_Read_RSSI: Supported
            HCI_Read_Link_Quality: Supported
            HCI_Reset_Failed_Contact_Counter: Supported
            HCI_Read_Failed_Contact_Counter: Supported
            HCI_Read_BD_ADDR: Supported
            HCI_Reject_Synchronous_Connection_Request: Supported
            HCI_Accept_Synchronous_Connection_Request: Supported
            HCI_Setup_Synchronous_Connection_Request: Supported
            HCI_Enable_Device-Under_Test_Mode: Supported
            HCI_Write_Loopback_Mode: Supported
            HCI_Read_Loopback_Mode: Supported
            HCI_Read_Local_OOB_Data: Supported
            HCI_Write_Simple_Pairing_Mode: Supported
            HCI_Read_Simple_Pairing_Mode: Supported
            HCI_Sniff_Subrating: Supported
            HCI_Refresh_Encryption_Key: Supported
            HCI_Write_Extended_Inquiry_Response: Supported
            HCI_Read_Extended_Inquiry_Response: Supported
            HCI_IO_Capability_Request_Reply: Supported
            HCI_Write_Inquiry_Transmit_Power_Level: Supported
            HCI_Read_Inquiry_Response_Transmit_Power_Level: Supported
            HCI_Remote_OOB_Data_Request_Negative_Reply: Supported
            HCI_Enhanced_Flush: Supported
            HCI_Write_Simple_Pairing_Debug_Mode: Supported
            HCI_Remote_OOB_Data_Request_Reply: Supported
            HCI_User_Passkey_Request_Negative_Reply: Supported
            HCI_User_Passkey_Request_Reply: Supported
            HCI_User_Confirmation_Request_Negative_Reply: Supported
            HCI_User_Confirmation_Request_Reply : Supported
            HCI_Read_Encryption_Key_Size: Supported
            HCI_IO_Capability_Request_Negative_Reply: Supported
            HCI_Send_Keypress_Notification: Supported
            HCI_Set_Event_Mask_Page_2: Supported
            HCI_Read_Data_Block_Size: Supported
            HCI_Write_Flow_Control_Mode: Supported
            HCI_Read_Flow_Control_Mode: Supported
            HCI_Write_LE_Host_Support: Supported
            HCI_Read_LE_Host_Support: Supported
            HCI_Read_Enhanced_Transmit_Power_Level: Supported
            HCI_LE_Set_Advertising_Data: Supported
            HCI_LE_Read_Advertising_Physical_Channel_Tx_Power: Supported
            HCI_LE_Set_Advertising_Parameters: Supported
            HCI_LE_Set_Random_Address: Supported
            HCI_LE_Read_Local_Supported_Features: Supported
            HCI_LE_Read_Buffer_Size [v1]: Supported
            HCI_LE_Set_Event_Mask: Supported
            HCI_LE_Clear_White_List: Supported
            HCI_LE_Read_White_List_Size: Supported
            HCI_LE_Create_Connection_Cancel: Supported
            HCI_LE_Create_Connection: Supported
            HCI_LE_Set_Scan_Enable: Supported
            HCI_LE_Set_Scan_Parameters: Supported
            HCI_LE_Set_Advertising_Enable: Supported
            HCI_LE_Set_Scan_Response_Data: Supported
            HCI_LE_Rand: Supported
            HCI_LE_Encrypt: Supported
            HCI_LE_Read_Remote_Features: Supported
            HCI_LE_Read_Channel_Map: Supported
            HCI_LE_Set_Host_Channel_Classification: Supported
            HCI_LE_Connection_Update: Supported
            HCI_LE_Remove_Device_From_White_List: Supported
            HCI_LE_Add_Device_To_White_List: Supported
            HCI_LE_Test_End: Supported
            HCI_LE_Transmitter_Test: Supported
            HCI_LE_Receiver_Test: Supported
            HCI_LE_Read_Supported_States: Supported
            HCI_LE_Long_Term_Key_Request_Negative_Reply: Supported
            HCI_LE_Long_Term_Key_Request_Reply: Supported
            HCI_LE_Enable_Encryption: Supported
            HCI_Read_Local_Supported_Codecs [v1]: Supported
            HCI_Enhanced_Accept_Synchronous_Connection: Supported
            HCI_Enhanced_Setup_Synchronous_Connection: Supported
            HCI_Write_Secure_Connections_Test_Mode: Supported
            HCI_Read_Local_OOB_Extended_Data: Supported
            HCI_Write_Authenticated_Payload_Timeout: Supported
            HCI_Read_Authenticated_Payload_Timeout: Supported
            HCI_Write_Secure_Connections_Host_Support: Supported
            HCI_Read_Secure_Connections_Host_Support: Supported
            HCI_Remote_OOB_Extended_Data_Request_Reply: Supported
            HCI_LE_Read_Suggested_Default_Data_Length: Supported
            HCI_LE_Set_Data_Length: Supported
            HCI_LE_Read_Peer_Resolvable_Address: Supported
            HCI_LE_Read_Resolving_List_Size: Supported
            HCI_LE_Clear_Resolving_List: Supported
            HCI_LE_Remove_Device_From_Resolving_List: Supported
            HCI_LE_Add_Device_To_Resolving_List: Supported
            HCI_LE_Generate_DHKey [v1]: Supported
            HCI_LE_Read_Local_P-256_Public_Key: Supported
            HCI_LE_Write_Suggested_Default_Data_Length: Supported
            HCI_LE_Receiver_Test: Supported
            HCI_LE_Set_PHY: Supported
            HCI_LE_Set_Default_PHY: Supported
            HCI_LE_Read_PHY: Supported
            HCI_LE_Read_Maximum_Data_Length: Supported
            HCI_LE_Set_Resolvable_Private_Address_Timeout: Supported
            HCI_LE_Set_Address_Resolution_Enable: Supported
            HCI_LE_Read_Local_Resolvable_Address: Supported
            HCI_LE_Read_Number_of_Supported_Advertising_Sets: Supported
            HCI_LE_Read_Maximum_Advertising_Data_Length: Supported
            HCI_LE_Set_Extended_Advertising_Enable: Supported
            HCI_LE_Set_Extended_Scan_Response_Data: Supported
            HCI_LE_Set_Extended_Advertising_Data: Supported
            HCI_LE_Set_Extended_Advertising_Parameters: Supported
            HCI_LE_Set_Advertising_Set_Random_Address: Supported
            HCI_LE_Transmitter_Test: Supported
            HCI_LE_Extended_Create_Connection: Supported
            HCI_LE_Set_Extended_Scan_Enable: Supported
            HCI_LE_Set_Extended_Scan_Parameters: Supported
            HCI_LE_Set_Periodic_Advertising_Enable: Supported
            HCI_LE_Set_Periodic_Advertising_Data: Supported
            HCI_LE_Set_Periodic_Advertising_Parameters: Supported
            HCI_LE_Clear_Advertising_Sets: Supported
            HCI_LE_Remove_Advertising_Set: Supported
            HCI_LE_Read_Transmit_Power: Supported
            HCI_LE_Read_Periodic_Advertiser_List_Size: Supported
            HCI_LE_Clear_Periodic_Advertiser_List: Supported
            HCI_LE_Remove_Device_From_Periodic_Advertiser_List: Supported
            HCI_LE_Add_Device_To_Periodic_Advertiser_List: Supported
            HCI_LE_Periodic_Advertising_Terminate_Sync: Supported
            HCI_LE_Periodic_Advertising_Create_Sync_Cancel: Supported
            HCI_LE_Periodic_Advertising_Create_Sync: Supported
            HCI_LE_Set_Privacy_Mode: Supported
            HCI_LE_Write_RF_Path_Compensation: Supported
            HCI_LE_Read_RF_Path_Compensation: Supported
            HCI_LE_Periodic_Advertising_Set_Info_Transfer: Supported
            HCI_LE_Periodic_Advertising_Sync_Transfer: Supported
            HCI_LE_Set_Periodic_Advertising_Receive_Enable: Supported
            HCI_LE_Set_CIG_Parameters: Supported
            HCI_LE_Read_ISO_TX_Sync: Supported
            HCI_LE_Read_Buffer_Size [v2]: Supported
            HCI_LE_Modify_Sleep_Clock_Accuracy: Supported
            HCI_Read_Local_Simple_Pairing_Options: Supported
            HCI_LE_Generate_DHKey[v2]: Supported
            HCI_LE_Set_Default_Periodic_Advertising_Sync_Transfer_Parameters: Supported
            HCI_LE_Set_Periodic_Advertising_Sync_Transfer_Parameters: Supported
            HCI_LE_Terminate_BIG: Supported
            HCI_LE_Create_BIG_Test: Supported
            HCI_LE_Create_BIG: Supported
            HCI_LE_Reject_CIS_Request: Supported
            HCI_LE_Accept_CIS_Request: Supported
            HCI_LE_Remove_CIG: Supported
            HCI_LE_Create_CIS: Supported
            HCI_LE_Set_CIG_Parameters_Test: Supported
            HCI_LE_ISO_Read_Test_Counters: Supported
            HCI_LE_ISO_Receive_Test: Supported
            HCI_LE_ISO_Transmit_Test: Supported
            HCI_LE_Remove_ISO_Data_Path: Supported
            HCI_LE_Setup_ISO_Data_Path: Supported
            HCI_LE_Request_Peer_SCA: Supported
            HCI_LE_BIG_Terminate_Sync: Supported
            HCI_LE_BIG_Create_Sync: Supported
            HCI_LE_Read_ISO_Link_Quality: Supported
            HCI_LE_Set_Host_Feature: Supported
            HCI_LE_ISO_Test_End: Supported
            HCI_Configure_Data_Path: Supported
            HCI_Read_Local_Supported_Controller_Delay: Supported
            HCI_Read_Local_Supported_Codec_Capabilities: Supported
            HCI_Read_Local_Supported_Codecs [v2]: Supported
            Unassigned Bits: 0x 00 00 00 00 00 00 00 00 00 00 ...

标签:初始化,LE,Read,流程,Supported,Write,Set,HCI
From: https://www.cnblogs.com/bluestorm/p/17700422.html

相关文章

  • Spring容器跳过指定对象初始化扫
    在Spring容器中,如果你希望跳过指定对象的初始化扫描,你可以使用`@ComponentScan`注解的`excludeFilters`属性来实现。`excludeFilters`属性可以指定扫描时需要排除的类或接口。例如,假设你有一个名为`MyBean`的对象,你不希望它被Spring容器初始化扫描。你可以创建一个自定义的过滤器来......
  • 国内的工作流厂商谨记初心,以理想的低代码产品实现流程化办公!
    有不少粉丝一直在询问我们:什么样的国内的工作流厂商能以客户为中心,专注于研发低代码技术产品,实现提质增效的办公效果?当前,国内涌现出了非常多研发低代码技术产品的服务商,但是选择一家适合自己企业运营的国内的工作流厂商服务商是非常有必要的,可以助力实现流程化办公,一起进入数字化......
  • 13-变量的申明-初始化-删除变量-垃圾回收机制
       需要先定义,做一个初始化,不然直接输入ddd会报错,没有被定义 此处a已经被删除了,3仍然在 通过垃圾回收机制把不用的对象进行回收,释放内存 ......
  • 10 分析类的初始化
    packageannotate;//分析类的初始化,取决于是否实例化对象?publicclassTest10{static{System.out.println("main被初始化");}publicstaticvoidmain(String[]args)throwsClassNotFoundException{//被初始化//Class.forNa......
  • Postman 接口测试:优化你的接口测试工作流程
    在现代软件开发生命周期中,接口测试是一个至关重要的部分。使用Postman这一工具,可以轻松地进行接口测试。以下是一份简单的使用教程,帮助你快速上手。安装Postman首先,你需要在电脑上安装Postman。你可以从官网上下载并安装它。安装完成后,你可以打开应用并创建一个新的请求。创建......
  • Apk反编译及重新打包流程
    一、反编译代码1、反编译java代码首先需要下载dex2jar这个工具,下载地址:https://sourceforge.net/projects/dex2jar/files/目前最新版是2.0,下载完后并解压缩。2、将要反编译的apk文件重命名为zip格式并解压缩,注意其中的classes.dex文件,它存放了全部的java代码,将classes.dex文件拷......
  • OpenHarmony:全流程讲解如何编写GPIO平台驱动以及应用程序
    1、案例简介该程序是基于OpenHarmony标准系统编写的基础外设类:GPIO驱动。目前已在凌蒙派-RK3568开发板跑通。详细资料请参考官网:https://gitee.com/Lockzhiner-Electronics/lockzhiner-rk3568-openharmony/tree/master/samples/b03_platform_device_gpio详细资料请参考OpenHarmo......
  • 一、day1,项目初始化
    一、前端初始化1、配置前端环境2、创建项目,使用命令vuecreatexiangoj-fontend3、创建vue3.0项目4、在IDEA打开项目并且运行5、设置pretier,让代码更规范,否则会运行报错,快捷键是ctrl+alt+L二、引入arco.design1、进入arcodesign官方文档(vue版本),地址是https://arc......
  • win11查看系统日志详细流程(附图片)
    详细流程如下所示:``打开控制面板。搜索时间查看器(EventView),点击进入查看事件日志。进入事件查看器,选择系统日志。日志界面信息如下图,包括系统全部运行日志基本信息以及详细信息。如需筛选日志类型,可点击筛选当前日志(filterlogs)。输入任务ID或者类型等信息进行......
  • systemd病毒遏制流程参考
    systemd挖矿病毒遏制流程参考top查看进程占用情况systemctlstatus128724找出占用较高的恶意进程的相关进程killSTOP128724121095停止对应恶意PID进程,为服务器CPU降压(注:这里不推荐直接删除进程,因为挖矿往往存在定时任务,删除后还会自动生成,但停止恶意进程会使其陷......