请问这个例程能用HCITester控制着发广播吗,我按着低功耗蓝牙开发权威指南上面的步骤来,总是在设置广播参数的地方超时报错?
下面是我全部脚本
#主机->链路层:设置广播参数 #链路层->主机:命令完成 #主机->链路层:读取广播信道发射功率 #链路层->主机:命令完成 #主机->链路层:设置广播数据包 #链路层->主机:命令完成 #主机->链路层:设置扫描响应数据 #链路层->主机:命令完成 #主机->链路层:启动广播 #链路层->主机:命令完成 #Note right of 链路层:发送广播数据包 #Note right of 链路层:发送广播数据包 #主机->链路层:关闭广播 #链路层->主机:命令完成 #本过程在低功耗蓝牙开发权威指南8.5.1小节有,113页 Send_HCI_Set_Event_Mask 0x28bffffffffb9fff Wait_HCI_Command_Complete_Event 5000, any, , 0x00 #The event mask to determine which LE events are supported. Send_HCI_LE_Set_Event_Mask 0x000000000000001f Wait_HCI_Command_Complete_LE_Set_Event_Mask_Event 5000, any, HCI_LE_Set_Event_Mask, 0x00 #Determine the maximum ACL data packet size allowed by the Controller. Send_HCI_LE_Read_Buffer_Size Wait_HCI_Command_Complete_LE_Read_Buffer_Size_Event 5000, any, HCI_LE_Read_Buffer_Size, , , #读取本地支持的特性 Send_HCI_LE_Read_Local_Supported_Features Wait_HCI_Command_Complete_LE_Read_Local_Supported_Features_Event 5000, any, HCI_LE_Read_Local_Supported_Features, 0x00, #设置随机地址 Send_HCI_LE_Set_Random_Address "01:02:03:04:05:06" Wait_HCI_Command_Complete_LE_Set_Random_Address_Event 5000, any, HCI_LE_Set_Random_Address, #设置广播地址 Send_HCI_EXT_SetBDADDRCmd "01:00:01:00:01:00" Wait_HCI_Vendor_Specific_Event 5000, #设置发射功率 Send_HCI_EXT_SetTxPowerCmd 2 Wait_HCI_Vendor_Specific_Event 5000, #读取广播地址 Send_HCI_Read_BD_ADDR Wait_HCI_Command_Complete_Read_BD_ADDR_Event 5000, any, HCI_Read_BD_ADDR, 0x00, #Read the LE locally supported features. Send_HCI_LE_Read_Local_Supported_Features Wait_HCI_Command_Complete_LE_Read_Local_Supported_Features_Event 5000, any, HCI_LE_Read_Local_Supported_Features, 0x00, #读取广播信道发射功率 Send_HCI_LE_Read_Adv_Channel_TX_Power Wait_HCI_Command_Complete_LE_Read_Adv_Channel_TX_Power_Event 5000, any, HCI_LE_Read_Adv_Channel_TX_Power, , #以上均测试通过,但是设置广播参数这里没有通过 #可能的解决思路:www.wowotech.net/.../ble_white_list.html #前面需要先关闭广播? Send_HCI_LE_Set_Advertise_Enable 0x00 Wait_HCI_Command_Complete_LE_Set_Advertise_Enable_Event 5000, any, HCI_LE_Set_Advertise_Enable, #设置广播参数 #依次是:广播的最小间隔,广播的最大间隔,在20ms-10.24s之间 #广播的类型:包括0x00可连接的非定向广播,0x01可连接的定向广播,0x02可扫描的非定向广播,0x03不可连接的非定向广播 #自身的和目标地址类型:0x00公共的,0x01随机的 #当使用定向广播时制定的目标地址 #广播信道:37,38,39或者是ALL(37|38|39) #过滤规则:0x00:HCI_ADV_WL_POLICY_ANY_REQ 任何请求 0x01:HCI_ADV_WL_POLICY_WL_ALL_REQ 所有请求 0x02:HCI_ADV_WL_POLICY_WL_CONNECT_IND 连接消息,0x03:HCI_ADV_WL_POLICY_WL_SCAN_REQ扫描请求 Send_HCI_LE_Set_Advertising_Parameters 0x0800, 0x0800, 0x00, 0x00, 0x00, "00:00:00:00:00:00", "0x07", "0x00" Wait_HCI_Command_Complete_Event 5000, any #设置广播数据 Send_HCI_LE_Set_Advertising_Data 0x00, "00:01:02:03:04:05:06:07:08:09:0A:0B:0C:0D:0E:0F" #等待命令完成 Wait_HCI_Command_Complete_LE_Set_Advertising_Data_Event 5000, any, HCI_LE_Set_Advertising_Data, 0x00 #设置扫描回复 Send_HCI_LE_Set_Scan_Response_Data 0x0008, 123 #等待扫描回复完成 Wait_HCI_Command_Complete_LE_Set_Scan_Response_Data_Event 5000, any, HCI_LE_Set_Scan_Response_Data, 0x00 #设置广播使能 Send_HCI_LE_Set_Advertise_Enable 0x01 #等待广播使能 Wait_HCI_Command_Complete_LE_Set_Advertise_Enable_Event 5000, any, HCI_LE_Set_Advertise_Enable,0x00
# 主机->链路层:设置广播参数# 链路层->主机:命令完成# 主机->链路层:读取广播信道发射功率# 链路层->主机:命令完成# 主机->链路层:设置广播数据包# 链路层->主机:命令完成# 主机->链路层:设置扫描响应数据# 链路层->主机:命令完成# 主机->链路层:启动广播# 链路层->主机:命令完成# Note right of 链路层:发送广播数据包 # Note right of 链路层:发送广播数据包 # 主机->链路层:关闭广播# 链路层->主机:命令完成#本过程在低功耗蓝牙开发权威指南8.5.1小节有,113页
Send_HCI_Set_Event_Mask 0x28bffffffffb9fffWait_HCI_Command_Complete_Event 5000, any, , 0x00
#The event mask to determine which LE events are supported.Send_HCI_LE_Set_Event_Mask 0x000000000000001fWait_HCI_Command_Complete_LE_Set_Event_Mask_Event 5000, any, HCI_LE_Set_Event_Mask, 0x00
#Determine the maximum ACL data packet size allowed by the Controller.Send_HCI_LE_Read_Buffer_SizeWait_HCI_Command_Complete_LE_Read_Buffer_Size_Event 5000, any, HCI_LE_Read_Buffer_Size, , ,
#读取本地支持的特性Send_HCI_LE_Read_Local_Supported_FeaturesWait_HCI_Command_Complete_LE_Read_Local_Supported_Features_Event 5000, any, HCI_LE_Read_Local_Supported_Features, 0x00,
#设置随机地址Send_HCI_LE_Set_Random_Address "01:02:03:04:05:06"Wait_HCI_Command_Complete_LE_Set_Random_Address_Event 5000, any, HCI_LE_Set_Random_Address,
#设置广播地址Send_HCI_EXT_SetBDADDRCmd "01:00:01:00:01:00"
Wait_HCI_Vendor_Specific_Event 5000,
#设置发射功率Send_HCI_EXT_SetTxPowerCmd 2
Wait_HCI_Vendor_Specific_Event 5000,
#读取广播地址Send_HCI_Read_BD_ADDRWait_HCI_Command_Complete_Read_BD_ADDR_Event 5000, any, HCI_Read_BD_ADDR, 0x00,
#Read the LE locally supported features.Send_HCI_LE_Read_Local_Supported_FeaturesWait_HCI_Command_Complete_LE_Read_Local_Supported_Features_Event 5000, any, HCI_LE_Read_Local_Supported_Features, 0x00,
#读取广播信道发射功率Send_HCI_LE_Read_Adv_Channel_TX_PowerWait_HCI_Command_Complete_LE_Read_Adv_Channel_TX_Power_Event 5000, any, HCI_LE_Read_Adv_Channel_TX_Power, ,
#以上均测试通过,但是设置广播参数这里没有通过#可能的解决思路:www.wowotech.net/…/ble_white_list.html
#前面需要先关闭广播?Send_HCI_LE_Set_Advertise_Enable 0x00Wait_HCI_Command_Complete_LE_Set_Advertise_Enable_Event 5000, any, HCI_LE_Set_Advertise_Enable,
#设置广播参数 #依次是:广播的最小间隔,广播的最大间隔,在20ms-10.24s之间#广播的类型:包括0x00可连接的非定向广播,0x01可连接的定向广播,0x02可扫描的非定向广播,0x03不可连接的非定向广播#自身的和目标地址类型:0x00公共的,0x01随机的#当使用定向广播时制定的目标地址#广播信道:37,38,39或者是ALL(37|38|39)#过滤规则:0x00:HCI_ADV_WL_POLICY_ANY_REQ 任何请求 0x01:HCI_ADV_WL_POLICY_WL_ALL_REQ 所有请求 0x02:HCI_ADV_WL_POLICY_WL_CONNECT_IND 连接消息,0x03:HCI_ADV_WL_POLICY_WL_SCAN_REQ扫描请求 Send_HCI_LE_Set_Advertising_Parameters 0x0800, 0x0800, 0x00, 0x00, 0x00, "00:00:00:00:00:00", "0x07", "0x00"
Wait_HCI_Command_Complete_Event 5000, any
#设置广播数据Send_HCI_LE_Set_Advertising_Data 0x00, "00:01:02:03:04:05:06:07:08:09:0A:0B:0C:0D:0E:0F"#等待命令完成Wait_HCI_Command_Complete_LE_Set_Advertising_Data_Event 5000, any, HCI_LE_Set_Advertising_Data, 0x00#设置扫描回复Send_HCI_LE_Set_Scan_Response_Data 0x0008, 123#等待扫描回复完成Wait_HCI_Command_Complete_LE_Set_Scan_Response_Data_Event 5000, any, HCI_LE_Set_Scan_Response_Data, 0x00#设置广播使能Send_HCI_LE_Set_Advertise_Enable 0x01#等待广播使能Wait_HCI_Command_Complete_LE_Set_Advertise_Enable_Event 5000, any, HCI_LE_Set_Advertise_Enable,0x00
Viki Shi:
设置或修改广播参数前需要关闭广播再操作
user5338031:
回复 Viki Shi:
是前面加上这个嘛,但是仍然超时报错
Alvin Chen:
回复 user5338031:
请参照如下:
processors.wiki.ti.com/…/LPRF_BLE_HCITester
user5338031:
回复 Alvin Chen:
谢谢,已经看过了,但我想解决的是怎么利用HCITester发送HCI指令,控制烧录了HostTest例程的设备(CC2640R2F)作为从设备发出广播,并且能被sniffer等工具捕捉到,你有什么好的建议吗