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

📄 bt_ddi.h

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

#define TDIR_CREDITS_LOW	10
#define TDIR_CREDITS_LOWEST	3

int tdiR_InitializeOnce (void);
int tdiR_CreateDriverInstance (void);
int tdiR_CloseDriverInstance (void);
int tdiR_UninitializeOnce (void);

int tdiR_ProcessConsoleCommand (WCHAR *pString);

//
//	------------------------------------ L2CAP ------------------------------------
//
typedef struct _L2CAP_EVENT_INDICATION		L2CAP_EVENT_INDICATION,	*PL2CAP_EVENT_INDICATION;
typedef struct _L2CAP_INTERFACE				L2CAP_INTERFACE,		*PL2CAP_INTERFACE;
typedef struct _L2CAP_CALLBACKS				L2CAP_CALLBACKS,		*PL2CAP_CALLBACKS;

struct btFLOWSPEC {
	unsigned char	flags;
	unsigned char	service_type;
	unsigned int	token_rate;
	unsigned int	token_bucket_size;
	unsigned int	peak_bandwidth;
	unsigned int	latency;
	unsigned int	delay_variation;
};

struct btCONFIGEXTENSION {
	unsigned char type;
	unsigned char length;
	unsigned char ucData[1];
};

#define INVALID_CID		0

typedef int (*L2CA_ConnectInd)            (void *pUserContext, BD_ADDR *pba, unsigned short cid, unsigned char id, unsigned short psm);
typedef int (*L2CA_ConfigInd)             (void *pUserContext, unsigned char id, unsigned short cid, unsigned short usOutMTU, unsigned short usInFlushTO, struct btFLOWSPEC *pInFlow, int cOptNum, struct btCONFIGEXTENSION **ppExtendedOptions);
typedef int (*L2CA_DisconnectInd)         (void *pUserContext, unsigned short cid, int iErr);
typedef int (*L2CA_QoSViolationInd)       (void *pUserContext, BD_ADDR *pba);
typedef int (*L2CA_DataUpInd)             (void *pUserContext, unsigned short cid, BD_BUFFER *pBuffer);

typedef int (*L2CA_ConnectReq_In)         (HANDLE hDeviceContext, void *pCallContext, unsigned short psm, BD_ADDR *pba);
typedef int (*L2CA_ConnectReq_Out)        (void *pCallContext, unsigned short cid, unsigned short result, unsigned short status);
typedef int (*L2CA_ConnectResponse_In)    (HANDLE hDeviceContext, void *pCallContext, BD_ADDR *pba, unsigned char id, unsigned short cid, unsigned short response, unsigned short status);
typedef int (*L2CA_ConnectResponse_Out)   (void *pCallContext, unsigned short result);
typedef int (*L2CA_ConfigReq_In)          (HANDLE hDeviceContext, void *pCallContext, unsigned short cid, unsigned short usInMTU, unsigned short usOutFlushTO, struct btFLOWSPEC *pOutFlow, int cOptNum, struct btCONFIGEXTENSION **ppExtendedOptions);
typedef int (*L2CA_ConfigReq_Out)         (void *pCallContext, unsigned short usResult, unsigned short usInMTU, unsigned short usOutFlushTO, struct btFLOWSPEC *pOutFlow, int cOptNum, struct btCONFIGEXTENSION **ppExtendedOptions);
typedef int (*L2CA_ConfigResponse_In)     (HANDLE hDeviceContext, void *pCallContext, unsigned char id, unsigned short cid, unsigned short result, unsigned short usOutMTU, unsigned short usInFlushTO, struct btFLOWSPEC *pInFlow, int cOptNum, struct btCONFIGEXTENSION **pExtendedOptions);
typedef int (*L2CA_ConfigResponse_Out)    (void *pCallContext, unsigned short result);
typedef int (*L2CA_Disconnect_In)         (HANDLE hDeviceContext, void *pCallContext, unsigned short cid);
typedef int (*L2CA_Disconnect_Out)        (void *pCallContext, unsigned short result);
typedef int (*L2CA_DataDown_In)           (HANDLE hDeviceContext, void *pCallContext, unsigned short cid, BD_BUFFER *pBuffer);
typedef int (*L2CA_DataDown_Out)          (void *pCallContext, unsigned short result);
typedef int (*L2CA_GroupCreate_In)        (HANDLE hDeviceContext, void *pCallContext, unsigned short psm);
typedef int (*L2CA_GroupCreate_Out)       (void *pCallContext, unsigned short cid);
typedef int (*L2CA_GroupClose_In)         (HANDLE hDeviceContext, void *pCallContext, unsigned short cid);
typedef int (*L2CA_GroupClose_Out)        (void *pCallContext, unsigned short result);
typedef int (*L2CA_GroupAddMember_In)     (HANDLE hDeviceContext, void *pCallContext, unsigned short cid, BD_ADDR *pba);
typedef int (*L2CA_GroupAddMember_Out)    (void *pCallContext, unsigned short result);
typedef int (*L2CA_GroupRemoveMember_In)  (HANDLE hDeviceContext, void *pCallContext, unsigned short cid, BD_ADDR *pba);
typedef int (*L2CA_GroupRemoveMember_Out) (void *pCallContext, unsigned short result);
typedef int (*L2CA_GroupMembership_In)    (HANDLE hDeviceContext, void *pCallContext, unsigned short cid);
typedef int (*L2CA_GroupMembership_Out)   (void *pCallContext, unsigned short result, unsigned short n, BD_ADDR *pList);
typedef int (*L2CA_Ping_In)               (HANDLE hDeviceContext, void *pCallContext, BD_ADDR *pba, unsigned char *pInBuffer, unsigned short length);
typedef int (*L2CA_Ping_Out)              (void *pCallContext, BD_ADDR *pba, unsigned char *pOutBuffer, unsigned short size);
typedef int (*L2CA_GetInfo_In)            (HANDLE hDeviceContext, void *pCallContext, BD_ADDR *pba, unsigned short usInfoType);
typedef int (*L2CA_GetInfo_Out)           (void *pCallContext, unsigned short result, unsigned char *pBuffer, unsigned short size);
typedef int (*L2CA_DisableCLT_In)         (HANDLE hDeviceContext, void *pCallContext, unsigned short psm);
typedef int (*L2CA_DisableCLT_Out)        (void *pCallContext, unsigned short result);
typedef int (*L2CA_EnableCLT_In)          (HANDLE hDeviceContext, void *pCallContext, unsigned short psm);
typedef int (*L2CA_EnableCLT_Out)         (void *pCallContext, unsigned short result);

struct _L2CAP_EVENT_INDICATION {
	L2CA_ConnectInd					l2ca_ConnectInd;
	L2CA_ConfigInd					l2ca_ConfigInd;
	L2CA_DisconnectInd				l2ca_DisconnectInd;
	L2CA_QoSViolationInd			l2ca_QoSViolationInd;
	L2CA_DataUpInd					l2ca_DataUpInd;

	BT_LAYER_STACK_EVENT_IND        l2ca_StackEvent;
};

struct _L2CAP_CALLBACKS {
	L2CA_ConnectReq_Out			l2ca_ConnectReq_Out;
	L2CA_ConnectResponse_Out	l2ca_ConnectResponse_Out;
	L2CA_ConfigReq_Out			l2ca_ConfigReq_Out;
	L2CA_ConfigResponse_Out		l2ca_ConfigResponse_Out;
	L2CA_Disconnect_Out			l2ca_Disconnect_Out;
	L2CA_DataDown_Out			l2ca_DataDown_Out;
	L2CA_GroupCreate_Out		l2ca_GroupCreate_Out;
	L2CA_GroupClose_Out			l2ca_GroupClose_Out;
	L2CA_GroupAddMember_Out		l2ca_GroupAddMember_Out;
	L2CA_GroupRemoveMember_Out	l2ca_GroupRemoveMember_Out;
	L2CA_GroupMembership_Out	l2ca_GroupMembership_Out;
	L2CA_Ping_Out				l2ca_Ping_Out;
	L2CA_GetInfo_Out			l2ca_GetInfo_Out;
	L2CA_DisableCLT_Out			l2ca_DisableCLT_Out;
	L2CA_EnableCLT_Out			l2ca_EnableCLT_Out;

	BT_LAYER_CALL_ABORTED		l2ca_CallAborted;
};

struct _L2CAP_INTERFACE {
	L2CA_ConnectReq_In			l2ca_ConnectReq_In;
	L2CA_ConnectResponse_In		l2ca_ConnectResponse_In;
	L2CA_ConfigReq_In			l2ca_ConfigReq_In;
	L2CA_ConfigResponse_In		l2ca_ConfigResponse_In;
	L2CA_Disconnect_In			l2ca_Disconnect_In;
	L2CA_DataDown_In			l2ca_DataDown_In;
	L2CA_GroupCreate_In			l2ca_GroupCreate_In;
	L2CA_GroupClose_In			l2ca_GroupClose_In;
	L2CA_GroupAddMember_In		l2ca_GroupAddMember_In;
	L2CA_GroupRemoveMember_In	l2ca_GroupRemoveMember_In;
	L2CA_GroupMembership_In		l2ca_GroupMembership_In;
	L2CA_Ping_In				l2ca_Ping_In;
	L2CA_GetInfo_In				l2ca_GetInfo_In;
	L2CA_DisableCLT_In			l2ca_DisableCLT_In;
	L2CA_EnableCLT_In			l2ca_EnableCLT_In;

	BT_LAYER_IO_CONTROL			l2ca_ioctl;
	BT_LAYER_ABORT_CALL			l2ca_AbortCall;
};

#define L2CAP_PSM_ALL			0x0000
#define L2CAP_PSM_MULTIPLE		0x1000

int L2CAP_EstablishDeviceContext
(
void					*pUserContext,		/* IN */
unsigned short			psm,				/* IN */
L2CAP_EVENT_INDICATION	*pInd,				/* IN */
L2CAP_CALLBACKS			*pCall,				/* IN */
L2CAP_INTERFACE			*pInt,				/* OUT */
int						*pcDataHeaders,		/* OUT */
int						*pcDataTrailers,	/* OUT */
HANDLE					*phDeviceContext	/* OUT */
);

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

int l2cap_InitializeOnce (void);
int l2cap_CreateDriverInstance (void);
int l2cap_CloseDriverInstance (void);
int l2cap_UninitializeOnce (void);

int l2cap_ProcessConsoleCommand (WCHAR *pString);

#define L2CAP_MTU						672
#define L2CAP_MTUMIN					48
#define L2CAP_MTUMAX					65512

//
//	------------------------------------ HCI ------------------------------------
//
//
//	Events
//
#define BT_ERROR_SUCCESS								0x00
#define BT_ERROR_UNKNOWN_HCI_COMMAND					0x01
#define BT_ERROR_NO_CONNECTION							0x02
#define BT_ERROR_HARDWARE_FAILURE						0x03
#define BT_ERROR_PAGE_TIMEOUT							0x04
#define BT_ERROR_AUTHENTICATION_FAILURE					0x05
#define BT_ERROR_KEY_MISSING							0x06
#define BT_ERROR_MEMORY_FULL							0x07
#define BT_ERROR_CONNECTION_TIMEOUT						0x08
#define BT_ERROR_MAX_NUMBER_OF_CONNECTIONS				0x09
#define BT_ERROR_MAX_NUMBER_OF_SCO_CONNECTIONS			0x0a
#define BT_ERROR_MAX_NUMBER_OF_ACL_CONNECTIONS			0x0b
#define BT_ERROR_COMMAND_DISALLOWED						0x0c
#define BT_ERROR_HOST_REJECTED_LIMITED_RESOURCES		0x0d
#define BT_ERROR_HOST_REJECTED_SECURITY_REASONS			0x0e
#define BT_ERROR_HOST_REJECTED_PERSONAL_DEVICE			0x0f
#define BT_ERROR_HOST_TIMEOUT							0x10
#define BT_ERROR_UNSUPPORTED_FEATURE_OR_PARAMETER		0x11
#define BT_ERROR_INVALID_HCI_PARAMETER					0x12
#define BT_ERROR_OETC_USER_ENDED						0x13
#define BT_ERROR_OETC_LOW_RESOURCES						0x14
#define BT_ERROR_OETC_POWERING_OFF						0x15
#define BT_ERROR_CONNECTION_TERMINATED_BY_LOCAL_HOST	0x16
#define BT_ERROR_REPEATED_ATTEMPTS						0x17
#define BT_ERROR_PAIRING_NOT_ALLOWED					0x18
#define BT_ERROR_UNSUPPORTED_REMOTE_FEATURE				0x1a
#define BT_ERROR_UNSPECIFIED_ERROR						0x1f

#define BT_PACKET_TYPE_DM1								0x0008
#define BT_PACKET_TYPE_DH1								0x0010
#define BT_PACKET_TYPE_HV1								0x0020
#define BT_PACKET_TYPE_HV2								0x0040
#define BT_PACKET_TYPE_HV3								0x0080
#define BT_PACKET_TYPE_AUX1								0x0200
#define BT_PACKET_TYPE_DM3								0x0400
#define BT_PACKET_TYPE_DH3								0x0800
#define BT_PACKET_TYPE_DM5								0x4000

⌨️ 快捷键说明

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