⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bt_ddi.h

📁 在PDA上应用的EVC环境中蓝牙设备处理应用程序
💻 H
📖 第 1 页 / 共 5 页
字号:
#define BT_PACKET_TYPE_DH5								0x8000

#define BT_PAGE_SCAN_REP_MODE_R0						0x00
#define BT_PAGE_SCAN_REP_MODE_R1						0x01
#define BT_PAGE_SCAN_REP_MODE_R2						0x02

#define BT_PAGE_SCAN_MODE_M								0x00
#define BT_PAGE_SCAN_MODE_O1							0x01
#define BT_PAGE_SCAN_MODE_O2							0x02
#define BT_PAGE_SCAN_MODE_O3							0x03

#define BT_SCAN_INQUIRY									0x01
#define BT_SCAN_PAGE									0x02

#define BD_MAXNAME										248

#define BT_GIAC											0x9e8b33
#define BT_LIAC											0x9e8b00

#define BT_HCI_INVALID_HANDLE							0xffff

#define HCI_MAX_COMMAND_LENGTH							257

#define HCI_MAX_ERR										0

int StatusToError (unsigned char status, int iGeneric);

typedef struct _HCI_EVENT_INDICATION		HCI_EVENT_INDICATION,	*PHCI_EVENT_INDICATION;
typedef struct _HCI_INTERFACE				HCI_INTERFACE,			*PHCI_INTERFACE;
typedef struct _HCI_CALLBACKS				HCI_CALLBACKS,			*PHCI_CALLBACKS;

typedef int (*HCI_InquiryCompleteEvent)             (void *pUserContext, void *pCallContext, unsigned char status);
typedef int (*HCI_InquiryResultEvent)               (void *pUserContext, void *pCallContext, BD_ADDR *pba, unsigned char page_scan_repetition_mode, unsigned char page_scan_period_mode, unsigned char page_scan_mode, unsigned int class_of_device, unsigned short clock_offset);
typedef int (*HCI_ConnectionCompleteEvent)          (void *pUserContext, void *pCallContext, unsigned char status, unsigned short connection_handle, BD_ADDR *pba, unsigned char link_type, unsigned char encryption_mode);
typedef int (*HCI_ConnectionRequestEvent)           (void *pUserContext, void *pCallContext, BD_ADDR *pba, unsigned int class_of_device, unsigned char link_type);
typedef int (*HCI_DisconnectionCompleteEvent)       (void *pUserContext, void *pCallContext, unsigned char status, unsigned short connection_handle, unsigned char reason);
typedef int (*HCI_AuthenticationCompleteEvent)      (void *pUserContext, void *pCallContext, unsigned char status, unsigned short connection_handle);
typedef int (*HCI_RemoteNameRequestCompleteEvent)   (void *pUserContext, void *pCallContext, unsigned char status, BD_ADDR *pba, unsigned char utf_name[248]);
typedef int (*HCI_EncryptionChangeEvent)            (void *pUserContext, void *pCallContext, unsigned char status, unsigned short connection_handle, unsigned char encryption_enable);
typedef int (*HCI_ChangeConnectionLinkKeyCompleteEvent) (void *pUserContext, void *pCallContext, unsigned char status, unsigned short connection_handle);
typedef int (*HCI_MasterLinkKeyCompleteEvent)       (void *pUserContext, void *pCallContext, unsigned char status, unsigned short connection_handle, unsigned char key_flag);
typedef int (*HCI_ReadRemoteSupportedFeaturesCompleteEvent) (void *pUserContext, void *pCallContext, unsigned char status, unsigned short connection_handle, unsigned char lmp_features[8]);
typedef int (*HCI_ReadRemoteVersionInformationCompleteEvent) (void *pUserContext, void *pCallContext, unsigned char status, unsigned short connection_handle, unsigned char lmp_version, unsigned short manufacturers_name, unsigned short lmp_subversion);
typedef int (*HCI_QoSSetupCompleteEvent)            (void *pUserContext, void *pCallContext, unsigned char status, unsigned short connection_handle, unsigned char flags, unsigned char service_type, unsigned int token_rate, unsigned int peak_bandwidth, unsigned int latency, unsigned int delay_variation);
typedef int (*HCI_CommandCompleteEvent)             (void *pUserContext, void *pCallContext, unsigned char num_hci_command_packets, unsigned short command_opcode, unsigned char *pReturnParameters);	// Not propagated up...
typedef int (*HCI_CommandStatusEvent)               (void *pUserContext, void *pCallContext, unsigned char status, unsigned char num_hci_command_packets, unsigned short command_opcode); // Not propagated up
typedef int (*HCI_HardwareErrorEvent)               (void *pUserContext, void *pCallContext, unsigned char hardware_code);
typedef int (*HCI_FlushOccuredEvent)                (void *pUserContext, void *pCallContext, unsigned short connection_handle);
typedef int (*HCI_RoleChangeEvent)                  (void *pUserContext, void *pCallContext, unsigned char status, BD_ADDR *pba, unsigned char new_role);
typedef int (*HCI_NumberOfCompletedPacketsEvent)    (void *pUserContext, void *pCallContext, unsigned short connection_handle, unsigned short num_of_completed_packets);
typedef int (*HCI_ModeChangeEvent)                  (void *pUserContext, void *pCallContext, unsigned char status, unsigned short connection_handle, unsigned char current_mode, unsigned short interval);
typedef int (*HCI_ReturnLinkKeysEvent)              (void *pUserContext, void *pCallContext, BD_ADDR *pba, unsigned char link_key[16]);
typedef int (*HCI_PINCodeRequestEvent)              (void *pUserContext, void *pCallContext, BD_ADDR *pba);
typedef int (*HCI_LinkKeyRequestEvent)              (void *pUserContext, void *pCallContext, BD_ADDR *pba);
typedef int (*HCI_LinkKeyNotificationEvent)         (void *pUserContext, void *pCallContext, BD_ADDR *pba, unsigned char link_key[16], unsigned char key_type);
typedef int (*HCI_LoopbackCommandEvent)             (void *pUserContext, void *pCallContext, unsigned char cLength, unsigned char *pHCICommandPacket);
typedef int (*HCI_DataBufferOverflowEvent)          (void *pUserContext, void *pCallContext, unsigned char link_type);
typedef int (*HCI_MaxSlotsChangeEvent)              (void *pUserContext, void *pCallContext, unsigned short connection_handle, unsigned char lmp_max_slots);
typedef int (*HCI_ReadClockOffsetCompleteEvent)     (void *pUserContext, void *pCallContext, unsigned char status, unsigned short connection_handle, unsigned short clock_offset);
typedef int (*HCI_ConnectionPacketTypeChangedEvent) (void *pUserContext, void *pCallContext, unsigned char status, unsigned short connection_handle, unsigned short packet_type);
typedef int (*HCI_QoSViolationEvent)                (void *pUserContext, void *pCallContext, unsigned short connection_handle);
typedef int (*HCI_PageScanModeChangeEvent)          (void *pUserContext, void *pCallContext, BD_ADDR *pba, unsigned char page_scan_mode);
typedef int (*HCI_PageScanRepetitionModeChangeEvent)(void *pUserContext, void *pCallContext, BD_ADDR *pba, unsigned char page_scan_repetition_mode);
typedef int (*HCI_CustomCodeEvent)                  (void *pUserContext, void *pCallContext, unsigned char cEventCode, unsigned char cEventLength, unsigned char *pEvent);

typedef struct _host_buffer_size {
	unsigned short ACL_Data_Packet_Length;
	unsigned char  SCO_Data_Packet_Length;
	unsigned short Total_Num_ACL_Data_Packets;
	unsigned short Total_Num_SCO_Data_Packets;
} HCI_Buffer_Size;

typedef struct _controller_event_packet {
	int				cSize;
	unsigned char	*pData;
} ControllerEvent;

typedef union _event_context {
	HCI_Buffer_Size		Host_Buffer;
	ControllerEvent		Event;
} HCIEventContext;

//
//	Commands
//
typedef int (*HCI_Inquiry_In)                       (HANDLE hDeviceContext, void *pCallContext, unsigned int LAP, unsigned char length, unsigned char num_responses);
typedef int (*HCI_Inquiry_Out)                      (void *pCallContext, unsigned char status);
typedef int (*HCI_InquiryCancel_In)                 (HANDLE hDeviceContext, void *pCallContext);
typedef int (*HCI_InquiryCancel_Out)                (void *pCallContext, unsigned char status);
typedef int (*HCI_PeriodicInquiryMode_In)           (HANDLE hDeviceContext, void *pCallContext, unsigned short max_period_len, unsigned short min_period_len, unsigned int LAP, unsigned char length, unsigned char num_responses);
typedef int (*HCI_PeriodicInquiryMode_Out)          (void *pCallContext, unsigned char status);
typedef int (*HCI_ExitPeriodicInquiryMode_In)       (HANDLE hDeviceContext, void *pCallContext);
typedef int (*HCI_ExitPeriodicInquiryMode_Out)      (void *pCallContext, unsigned char status);
typedef int (*HCI_CreateConnection_In)              (HANDLE hDeviceContext, void *pCallContext, BD_ADDR *pba, unsigned short packet_type, unsigned char page_scan_repetition_mode, unsigned char page_scan_mode, unsigned short clock_offset, unsigned char allow_role_switch);
typedef int (*HCI_CreateConnection_Out)             (void *pCallContext, unsigned char status);
typedef int (*HCI_Disconnect_In)                    (HANDLE hDeviceContext, void *pCallContext, unsigned short connection_handle, unsigned char reason);
typedef int (*HCI_Disconnect_Out)                   (void *pCallContext, unsigned char status);
typedef int (*HCI_AddSCOConnection_In)              (HANDLE hDeviceContext, void *pCallContext, unsigned short connection_handle, unsigned short packet_type);
typedef int (*HCI_AddSCOConnection_Out)             (void *pCallContext, unsigned char status);
typedef int (*HCI_AcceptConnectionRequest_In)       (HANDLE hDeviceContext, void *pCallContext, BD_ADDR *pba, unsigned char role);
typedef int (*HCI_AcceptConnectionRequest_Out)      (void *pCallContext, unsigned char status);
typedef int (*HCI_RejectConnectionRequest_In)       (HANDLE hDeviceContext, void *pCallContext, BD_ADDR *pba, unsigned char reason);
typedef int (*HCI_RejectConnectionRequest_Out)      (void *pCallContext, unsigned char status);
typedef int (*HCI_LinkKeyRequestReply_In)           (HANDLE hDeviceContext, void *pCallContext, BD_ADDR *pba, unsigned char link_key[16]);
typedef int (*HCI_LinkKeyRequestReply_Out)          (void *pCallContext, unsigned char status, BD_ADDR *pba);
typedef int (*HCI_LinkKeyRequestNegativeReply_In)   (HANDLE hDeviceContext, void *pCallContext, BD_ADDR *pba);
typedef int (*HCI_LinkKeyRequestNegativeReply_Out)  (void *pCallContext, unsigned char status, BD_ADDR *pba);
typedef int (*HCI_PINCodeRequestReply_In)           (HANDLE hDeviceContext, void *pCallContext, BD_ADDR *pba, unsigned char PIN_length, unsigned char *PIN_code);
typedef int (*HCI_PINCodeRequestReply_Out)          (void *pCallContext, unsigned char status, BD_ADDR *pba);
typedef int (*HCI_PINCodeRequestNegativeReply_In)   (HANDLE hDeviceContext, void *pCallContext, BD_ADDR *pba);
typedef int (*HCI_PINCodeRequestNegativeReply_Out)  (void *pCallContext, unsigned char status, BD_ADDR *pba);
typedef int (*HCI_ChangeConnectionPacketType_In)    (HANDLE hDeviceContext, void *pCallContext, unsigned short connection_handle, unsigned short packet_type);
typedef int (*HCI_ChangeConnectionPacketType_Out)   (void *pCallContext, unsigned char status);
typedef int (*HCI_AuthenticationRequested_In)       (HANDLE hDeviceContext, void *pCallContext, unsigned short connection_handle);
typedef int (*HCI_AuthenticationRequested_Out)      (void *pCallContext, unsigned char status);
typedef int (*HCI_SetConnectionEncryption_In)       (HANDLE hDeviceContext, void *pCallContext, unsigned short connection_handle, unsigned char encryption_enable);
typedef int (*HCI_SetConnectionEncryption_Out)      (void *pCallContext, unsigned char status);
typedef int (*HCI_ChangeConnectionLinkKey_In)       (HANDLE hDeviceContext, void *pCallContext, unsigned short connection_handle);
typedef int (*HCI_ChangeConnectionLinkKey_Out)      (void *pCallContext, unsigned char status);
typedef int (*HCI_MasterLinkKey_In)                 (HANDLE hDeviceContext, void *pCallContext, unsigned char key_flag);
typedef int (*HCI_MasterLinkKey_Out)                (void *pCallContext, unsigned char status);
typedef int (*HCI_RemoteNameRequest_In)             (HANDLE hDeviceContext, void *pCallContext, BD_ADDR *pba, unsigned char page_scan_repetition_mode, unsigned char page_scan_mode, unsigned short clock_offset);
typedef int (*HCI_RemoteNameRequest_Out)            (void *pCallContext, unsigned char status);
typedef int (*HCI_ReadRemoteSupportedFeatures_In)   (HANDLE hDeviceContext, void *pCallContext, unsigned short connection_handle);
typedef int (*HCI_ReadRemoteSupportedFeatures_Out)  (void *pCallContext, unsigned char status);
typedef int (*HCI_ReadRemoteVersionInformation_In)  (HANDLE hDeviceContext, void *pCallContext, unsigned short connection_handle);
typedef int (*HCI_ReadRemoteVersionInformation_Out) (void *pCallContext, unsigned char status);
typedef int (*HCI_ReadClockOffset_In)               (HANDLE hDeviceContext, void *pCallContext, unsigned short connection_handle);
typedef int (*HCI_ReadClockOffset_Out)              (void *pCallContext, unsigned char status);
typedef int (*HCI_HoldMode_In)                      (HANDLE hDeviceContext, void *pCallContext, unsigned short connection_handle, unsigned short hold_mode_max_interval, unsigned short hold_mode_min_interval);
typedef int (*HCI_HoldMode_Out)                     (void *pCallContext, unsigned char status);
typedef int (*HCI_SniffMode_In)                     (HANDLE hDeviceContext, void *pCallContext, unsigned short connection_handle, unsigned short sniff_max_interval, unsigned short sniff_min_interval, unsigned short sniff_attempt, unsigned short sniff_timeout);
typedef int (*HCI_SniffMode_Out)                    (void *pCallContext, unsigned char status);
typedef int (*HCI_ExitSniffMode_In)                 (HANDLE hDeviceContext, void *pCallContext, unsigned short connection_handle);
typedef int (*HCI_ExitSniffMode_Out)                (void *pCallContext, unsigned char status);
typedef int (*HCI_ParkMode_In)                      (HANDLE hDeviceContext, void *pCallContext, unsigned short connection_handle, unsigned short beacon_max_interval, unsigned short beacon_min_interval);
typedef int (*HCI_ParkMode_Out)                     (void *pCallContext, unsigned char status);
typedef int (*HCI_ExitParkMode_In)                  (HANDLE hDeviceContext, void *pCallContext, unsigned short connection_handle);
typedef int (*HCI_ExitParkMode_Out)                 (void *pCallContext, unsigned char status);
typedef int (*HCI_QoSSetup_In)                      (HANDLE hDeviceContext, void *pCallContext, unsigned short connection_handle, unsigned char flags, unsigned char service_type, unsigned int token_rate, unsigned int peak_bandwidth, unsigned int latency, unsigned int delay_variation);
typedef int (*HCI_QoSSetup_Out)                     (void *pCallContext, unsigned char status);
typedef int (*HCI_RoleDiscovery_In)                 (HANDLE hDeviceContext, void *pCallContext, unsigned short connection_handle);
typedef int (*HCI_RoleDiscovery_Out)                (void *pCallContext, unsigned char status, unsigned short connection_handle, unsigned char current_role);
typedef int (*HCI_SwitchRole_In)                    (HANDLE hDeviceContext, void *pCallContext, BD_ADDR *pba, unsigned char role);
typedef int (*HCI_SwitchRole_Out)                   (void *pCallContext, unsigned char status);
typedef int (*HCI_ReadLinkPolicySettings_In)        (HANDLE hDeviceContext, void *pCallContext, unsigned short connection_handle);
typedef int (*HCI_ReadLinkPolicySettings_Out)       (void *pCallContext, unsigned char status, unsigned short connection_handle, unsigned short link_policy_settings);
typedef int (*HCI_WriteLinkPolicySettings_In)       (HANDLE hDeviceContext, void *pCallContext, unsigned short connection_handle, unsigned short link_policy_settings);
typedef int (*HCI_WriteLinkPolicySettings_Out)      (void *pCallContext, unsigned char status, unsigned short connection_handle);
typedef int (*HCI_SetEventMask_In)                  (HANDLE hDeviceContext, void *pCallContext, unsigned char event_mask[8]);
typedef int (*HCI_SetEventMask_Out)                 (void *pCallContext, unsigned char status);
typedef int (*HCI_Reset_In)                         (HANDLE hDeviceContext, void *pCallContext);
typedef int (*HCI_Reset_Out)                        (void *pCallContext, unsigned char status);
typedef int (*HCI_SetEventFilter_In)                (HANDLE hDeviceContext, void *pCallContext, unsigned char filter_type, unsigned char filter_condition_type, unsigned char condition[7]);
typedef int (*HCI_SetEventFilter_Out)               (void *pCallContext, unsigned char status);
typedef int (*HCI_Flush_In)                         (HANDLE hDeviceContext, void *pCallContext, unsigned short connection_handle);
typedef int (*HCI_Flush_Out)                        (void *pCallContext, unsigned char status, unsigned short connection_handle);
typedef int (*HCI_ReadPINType_In)                   (HANDLE hDeviceContext, void *pCallContext);
typedef int (*HCI_ReadPINType_Out)                  (void *pCallContext, unsigned char status, unsigned char PIN_type);
typedef int (*HCI_WritePINType_In)                  (HANDLE hDeviceContext, void *pCallContext, char PIN_type);
typedef int (*HCI_WritePINType_Out)                 (void *pCallContext, unsigned char status);
typedef int (*HCI_CreateNewUnitKey_In)              (HANDLE hDeviceContext, void *pCallContext);
typedef int (*HCI_CreateNewUnitKey_Out)             (void *pCallContext, unsigned char status);
typedef int (*HCI_ReadStoredLinkKey_In)             (HANDLE hDeviceContext, void *pCallContext, BD_ADDR *pba, unsigned char read_all_flag);
typedef int (*HCI_ReadStoredLinkKey_Out)            (void *pCallContext, unsigned char status, unsigned short max_num_keys, unsigned short num_keys_read);
typedef int (*HCI_WriteStoredLinkKey_In)            (HANDLE hDeviceContext, void *pCallContext, unsigned char num_keys_to_write, BD_ADDR *pba_list, unsigned char *link_key_list_16bytes_each);
typedef int (*HCI_WriteStoredLinkKey_Out)           (void *pCallContext, unsigned char status, unsigned char num_keys_written);
typedef int (*HCI_DeleteStoredLinkKey_In)           (HANDLE hDeviceContext, void *pCallContext, BD_ADDR *pba, unsigned char delete_all_flag);
typedef int (*HCI_DeleteStoredLinkKey_Out)          (void *pCallContext, unsigned char status, unsigned short num_keys_deleted);
typedef int (*HCI_ChangeLocalName_In)               (HANDLE hDeviceContext, void *pCallContext, unsigned char utf_name[248]);
typedef int (*HCI_ChangeLocalName_Out)              (void *pCallContext, unsigned char status);
typedef int (*HCI_ReadLocalName_In)                 (HANDLE hDeviceContext, void *pCallContext);
typedef int (*HCI_ReadLocalName_Out)                (void *pCallContext, unsigned char status, unsigned char utf_name[248]);
typedef int (*HCI_ReadConnectionAcceptTimeout_In)   (HANDLE hDeviceContext, void *pCallContext);
typedef int (*HCI_ReadConnectionAcceptTimeout_Out)  (void *pCallContext, unsigned char status, unsigned short conn_accept_timeout);
typedef int (*HCI_WriteConnectionAcceptTimeout_In)  (HANDLE hDeviceContext, void *pCallContext, unsigned short conn_accept_timeout);
typedef int (*HCI_WriteConnectionAcceptTimeout_Out) (void *pCallContext, unsigned char status);
typedef int (*HCI_ReadPageTimeout_In)               (HANDLE hDeviceContext, void *pCallContext);
typedef int (*HCI_ReadPageTimeout_Out)              (void *pCallContext, unsigned char status, unsigned short page_timeout);
typedef int (*HCI_WritePageTimeout_In)              (HANDLE hDeviceContext, void *pCallContext, unsigned short page_timeout);
typedef int (*HCI_WritePageTimeout_Out)             (void *pCallContext, unsigned char status);
typedef int (*HCI_ReadScanEnable_In)                (HANDLE hDeviceContext, void *pCallContext);
typedef int (*HCI_ReadScanEnable_Out)               (void *pCallContext, unsigned char status, unsigned char scan_enable);
typedef int (*HCI_WriteScanEnable_In)               (HANDLE hDeviceContext, void *pCallContext, unsigned char scan_enable);
typedef int (*HCI_WriteScanEnable_Out)              (void *pCallContext, unsigned char status);
typedef int (*HCI_ReadPageScanActivity_In)          (HANDLE hDeviceContext, void *pCallContext);
typedef int (*HCI_ReadPageScanActivity_Out)         (void *pCallContext, unsigned char status, unsigned short page_scan_interval, unsigned short page_scan_window);
typedef int (*HCI_WritePageScanActivity_In)         (HANDLE hDeviceContext, void *pCallContext, unsigned short page_scan_interval, unsigned short page_scan_window);
typedef int (*HCI_WritePageScanActivity_Out)        (void *pCallContext, unsigned char status);
typedef int (*HCI_ReadInquiryScanActivity_In)       (HANDLE hDeviceContext, void *pCallContext);
typedef int (*HCI_ReadInquiryScanActivity_Out)      (void *pCallContext, unsigned char status, unsigned short inquiry_scan_interval, unsigned short inquiry_scan_window);
typedef int (*HCI_WriteInquiryScanActivity_In)      (HANDLE hDeviceContext, void *pCallContext, unsigned short inquiry_scan_interval, unsigned short inquiry_scan_window);
typedef int (*HCI_WriteInquiryScanActivity_Out)     (void *pCallContext, unsigned char status);
typedef int (*HCI_ReadAuthenticationEnable_In)      (HANDLE hDeviceContext, void *pCallContext);
typedef int (*HCI_ReadAuthenticationEnable_Out)     (void *pCallContext, unsigned char status, unsigned char authentication_enable);
typedef int (*HCI_WriteAuthenticationEnable_In)     (HANDLE hDeviceContext, void *pCallContext, unsigned char authentication_enable);
typedef int (*HCI_WriteAuthenticationEnable_Out)    (void *pCallContext, unsigned char status);
typedef int (*HCI_ReadEncryptionMode_In)            (HANDLE hDeviceContext, void *pCallContext);
typedef int (*HCI_ReadEncryptionMode_Out)           (void *pCallContext, unsigned char status, unsigned char encryption_mode);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -