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

📄 bt_ddi.h

📁 在PDA上应用的EVC环境中蓝牙设备处理应用程序
💻 H
📖 第 1 页 / 共 5 页
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
//------------------------------------------------------------------------------
// 
//      Bluetooth Layered Device Driver Interface
// 
// 
// Module Name:
// 
//      bt_ddi.h
// 
// Abstract:
// 
//      This file defines interfaces between layers of Bluetooth device driver
// 
// 
//------------------------------------------------------------------------------
#if ! defined (__bt_ddi_H__)
#define __bt_ddi_H__		1

//
//	------------------------------------ BD_ADDR------------------------------------
//
#define __BD_ADDR_DEFINED__	1
#pragma pack(push, 1)
typedef struct	__bd_addr {
	union {
		struct {
			unsigned int LAP : 24;	// Lower address part
			unsigned int UAP : 8;	// Upper address part
		};
		unsigned int SAP;			// Significant address part
	};

	unsigned short NAP;				// Non-significant address part
} BD_ADDR;
#pragma pack(pop)

#if defined (__cplusplus)
inline BOOL operator==(BD_ADDR& a, BD_ADDR& b) {
	return (a.SAP == b.SAP) && (a.NAP == b.NAP);
}

inline BOOL operator!=(BD_ADDR& a, BD_ADDR& b) {
	return (a.SAP != b.SAP) || (a.NAP != b.NAP);
}
#endif

#define BLUETOOTH_TRANSPORT_NAME    TEXT("MSBT")

//
//	------------------------------------ Stack Common ------------------------------------
//

// Control-down
#define BTH_HCI_IOCTL_GET_BD_FOR_HANDLE 		0x00000001
#define BTH_HCI_IOCTL_GET_HANDLE_FOR_BD 		0x00000002
#define BTH_HCI_IOCTL_GET_NUM_UNSENT			0x00000003
#define BTH_HCI_IOCTL_GET_NUM_ONDEVICE			0x00000004
#define BTH_HCI_IOCTL_GET_NUM_PENDING			0x00000005
#define BTH_HCI_IOCTL_GET_INQUIRY				0x00000006
#define BTH_HCI_IOCTL_GET_PERIODIC_INQUIRY		0x00000007
#define BTH_HCI_IOCTL_GET_LOOPBACK				0x00000008
#define BTH_HCI_IOCTL_GET_ERRORS				0x00000009
#define BTH_HCI_IOCTL_GET_FLOW					0x0000000a
#define BTH_HCI_IOCTL_GET_COMMANDSIZE			0x0000000b
#define BTH_HCI_IOCTL_HANDLE_AUTHENTICATED		0x0000000c
#define BTH_HCI_IOCTL_HANDLE_ENCRYPTED			0x0000000d
#define BTH_HCI_IOCTL_GET_UNDER_TEST			0x0000000e
#define BTH_HCI_IOCTL_GET_LAST_INQUIRY_DATA 	0x0000000f
#define BTH_HCI_IOCTL_GET_BASEBAND_HANDLES		0x00000010
#define BTH_HCI_IOCTL_GET_HANDLE_MODE			0x00000011
#define BTH_HCI_IOCTL_GET_SCO_PARAMETERS		0x00000012
#define BTH_HCI_IOCTL_GET_BASEBAND_CONNECTIONS	0x00000013
#define BTH_HCI_IOCTL_GET_HARDWARE_STATUS		0x00000014

#define BTH_STACK_IOCTL_GET_CONNECTED		0x80000001
#define BTH_STACK_IOCTL_RESERVE_PORT		0x80000002
#define BTH_STACK_IOCTL_FREE_PORT			0x80000003

#define BTH_L2CAP_IOCTL_DROP_IDLE			0xc0000001
#define BTH_L2CAP_IOCTL_SET_PACKET_TYPE		0xc0000002
#define BTH_L2CAP_IOCTL_LOCK_BASEBAND       0x00000003
#define BTH_L2CAP_IOCTL_UNLOCK_BASEBAND     0x00000004

typedef int (*BT_LAYER_IO_CONTROL)        (HANDLE hDeviceContext, int fSelector, int cInBuffer, char *pInBuffer, int cOutBuffer, char *pOutBuffer, int *pcDataReturned);

//	Control-up
#define BTH_STACK_NONE								0
#define BTH_STACK_RESET								1
#define BTH_STACK_DOWN								2
#define BTH_STACK_UP								3
#define BTH_STACK_DISCONNECT						4
#define BTH_STACK_FLOW_ON  							5
#define BTH_STACK_FLOW_OFF							6
#define BTH_STACK_HOST_BUFFER						7
#define BTH_STACK_EVENT_MASK_SET					8
#define BTH_STACK_LOOPBACK_ON						9
#define BTH_STACK_LOOPBACK_OFF						10
#define BTH_STACK_UNDER_TEST						11
#define BTH_STACK_HCI_HARDWARE_EVENT				12

//  L2CAP events
#define BTH_STACK_L2CAP_DROP_COMPLETE				0xc0000001

typedef int (*BT_LAYER_STACK_EVENT_IND)   (void *pUserContext, int iEvent, void *pEventContext);

//	Call control
typedef int (*BT_LAYER_ABORT_CALL)        (HANDLE hDeviceContext, void *pCallContext);
typedef int (*BT_LAYER_CALL_ABORTED)      (void *pCallContext, int iError);

#if defined (DEBUG) || defined (_DEBUG)
#define BTH_CONSOLE		1
#endif

// Link types
#define BTH_LINK_TYPE_SCO			0
#define BTH_LINK_TYPE_ACL			1


//
//	------------------------------------ SDP NS ------------------------------------
//
int bthns_InitializeOnce(void);
int bthns_CreateDriverInstance(void);
int bthns_CloseDriverInstance(void);
int bthns_UninitializeOnce(void);

//
//	------------------------------------ SDP ------------------------------------
//
typedef struct _SdpAttributeRange SdpAttributeRange;
typedef struct _SdpQueryUuid      SdpQueryUuid;
typedef struct _SdpServiceSearch  SdpServiceSearch;

typedef int (*SDP_AddRecord)                   (HANDLE hDeviceContext, UCHAR *pStream, ULONG streamSize, HANDLE *pId);
typedef int (*SDP_RemoveRecord)                (HANDLE hDeviceContext, HANDLE Id);
typedef int (*SDP_Connect_In)                  (HANDLE hDeviceContext, void *pCallContext, BD_ADDR *pba);
typedef int (*SDP_Disconnect_In)               (HANDLE hDeviceContext, void *pCallContext, unsigned short cid);
typedef int (*SDP_ServiceSearch_In)            (HANDLE hDeviceContext, void *pCallContext, unsigned short cid, SdpQueryUuid* pUUIDs, unsigned short cMaxHandles);
typedef int (*SDP_AttributeSearch_In)          (HANDLE hDeviceContext, void *pCallContext, unsigned short cid, unsigned long recordHandle, SdpAttributeRange *pAttribRange, int numAttributes);
typedef int (*SDP_ServiceAttributeSearch_In)   (HANDLE hDeviceContext, void *pCallContext, unsigned short cid, SdpQueryUuid* pUUIDs, SdpAttributeRange *pAttribRange, int numAttributes);

struct SDP_INTERFACE {
	SDP_AddRecord                   sdp_AddRecord;
	SDP_RemoveRecord                sdp_RemoveRecord;
	SDP_Connect_In                  sdp_Connect_In;
	SDP_Disconnect_In               sdp_Disconnect_In;
	SDP_ServiceSearch_In            sdp_ServiceSearch_In;
	SDP_AttributeSearch_In          sdp_AttributeSearch_In;
	SDP_ServiceAttributeSearch_In   sdp_ServiceAttributeSearch_In;

	BT_LAYER_IO_CONTROL             sdp_ioctl;
	BT_LAYER_ABORT_CALL             sdp_AbortCall;
};

typedef int (*SDP_Connect_Out)                  (void *pCallContext, unsigned long status, unsigned short cid);
typedef int (*SDP_Disonnect_Out)                (void *pCallContext, unsigned long status);
typedef int (*SDP_ServiceSearch_Out)            (void *pCallContext, unsigned long status, unsigned short cReturnedHandles, unsigned long *pHandles);
typedef int (*SDP_AttributeSearch_Out)          (void *pCallContext, unsigned long status, unsigned char *pOutBuf, unsigned long cOutBuf);
typedef int (*SDP_ServiceAttributeSearch_Out)   (void *pCallContext, unsigned long status, unsigned char *pOutBuf, unsigned long cOutBuf);


struct SDP_CALLBACKS {
	SDP_Connect_Out                 sdp_Connect_Out;
	SDP_Disonnect_Out               sdp_Disconnect_Out;	
	SDP_ServiceSearch_Out           sdp_ServiceSearch_Out;
	SDP_AttributeSearch_Out         sdp_AttributeSearch_Out;
	SDP_ServiceAttributeSearch_Out  sdp_ServiceAttributeSearch_Out;
	BT_LAYER_CALL_ABORTED           sdp_CallAborted;
};

struct SDP_EVENT_INDICATION {
	BT_LAYER_STACK_EVENT_IND        sdp_StackEvent;
};

int SDP_EstablishDeviceContext
(
void					*pUserContext,		/* IN */
SDP_EVENT_INDICATION    *pInd,              /* IN */
SDP_CALLBACKS           *pCall,             /* IN */
SDP_INTERFACE           *pInt,              /* OUT */
HANDLE					*phDeviceContext	/* OUT */
);

int SDP_CloseDeviceContext
(
HANDLE					hDeviceContext		/* IN */
);

int sdp_InitializeOnce (void);

⌨️ 快捷键说明

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