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

📄 bt_ddi.h

📁 在PDA上应用的EVC环境中蓝牙设备处理应用程序
💻 H
📖 第 1 页 / 共 5 页
字号:
int sdp_CreateDriverInstance (void);
int sdp_CloseDriverInstance (void);
int sdp_UninitializeOnce (void);

int sdp_ProcessConsoleCommand (WCHAR *pString);

//
//	------------------------------------ RFCOMM ------------------------------------
//
#define RFCOMM_PSM              3
#define RFCOMM_LINGER           0
#define RFCOMM_N1_MIN           27
#define RFCOMM_T1               60
#define RFCOMM_T2               60
#define RFCOMM_MAX_ERR		0
#define RFCOMM_MAX_DATA         0x7fff

#define RFCOMM_PN_CREDIT_IN     0xf
#define RFCOMM_PN_CREDIT_OUT    0xe
#define RFCOMM_PN_CREDIT_MAX    0x7

#define RFCOMM_RPN_XON_IN       0x01
#define RFCOMM_RPN_XON_OUT      0x02
#define RFCOMM_RPN_RTR_IN       0x04
#define RFCOMM_RPN_RTR_OUT      0x08
#define RFCOMM_RPN_RTC_IN       0x10
#define RFCOMM_RPN_RTC_OUT      0x20

#define RFCOMM_RPN_HAVE_BAUD    0x0001
#define RFCOMM_RPN_HAVE_DATA    0x0002
#define RFCOMM_RPN_HAVE_STOP    0x0004
#define RFCOMM_RPN_HAVE_PARITY  0x0008
#define RFCOMM_RPN_HAVE_PT      0x0010
#define RFCOMM_RPN_HAVE_XON     0x0020
#define RFCOMM_RPN_HAVE_XOFF    0x0040
#define RFCOMM_RPN_HAVE_XON_IN  0x0100
#define RFCOMM_RPN_HAVE_XON_OUT 0x0200
#define RFCOMM_RPN_HAVE_RTR_IN  0x0400	
#define RFCOMM_RPN_HAVE_RTR_OUT 0x0800
#define RFCOMM_RPN_HAVE_RTC_IN  0x1000
#define RFCOMM_RPN_HAVE_RTC_OUT 0x2000

typedef struct _RFCOMM_EVENT_INDICATION RFCOMM_EVENT_INDICATION, *PRFCOMM_EVENT_INDICATION;
typedef struct _RFCOMM_INTERFACE        RFCOMM_INTERFACE, *PRFCOMM_INTERFACE;
typedef struct _RFCOMM_CALLBACKS        RFCOMM_CALLBACKS, *PRFCOMM_CALLBACKS;

typedef int (*RFCOMM_CreateChannel)         (HANDLE hDeviceContext, BD_ADDR *pba, unsigned char channel, HANDLE *phConnection);
typedef int (*RFCOMM_GetChannelAddress)     (HANDLE hDeviceContext, HANDLE hConnection, BD_ADDR *pba, unsigned char *pchannel, int *pfLocal);

typedef int (*RFCOMM_ConnectRequest_In)		(HANDLE hDeviceContext, void *pCallContext, HANDLE hConnection);
typedef int (*RFCOMM_ConnectRequest_Out)	(void *pCallContext, int iError, HANDLE hConnection);
typedef int (*RFCOMM_ConnectResponse_In)	(HANDLE hDeviceContext, void *pCallContext, HANDLE hConnection, int fAllowConnection);
typedef int (*RFCOMM_ConnectResponse_Out)   (void *pCallContext, int iError);
typedef int (*RFCOMM_DataDown_In)			(HANDLE hDeviceContext, void *pCallContext, HANDLE hConnection, BD_BUFFER *pBuffer, int add_credits);
typedef int (*RFCOMM_DataDown_Out)			(void *pCallContext, int iError);
typedef int (*RFCOMM_Disconnect_In)			(HANDLE hDeviceContext, void *pCallContext, HANDLE hConnection);
typedef int (*RFCOMM_Disconnect_Out)		(void *pCallContext, int iError);
typedef int (*RFCOMM_MSC_In)				(HANDLE hDeviceContext, void *pCallContext, HANDLE hConnection, unsigned char v24, unsigned char bs);
typedef int (*RFCOMM_MSC_Out)				(void *pCallContext, int iError);
typedef int (*RFCOMM_RLS_In)				(HANDLE hDeviceContext, void *pCallContext, HANDLE hConnection, unsigned char rls);
typedef int (*RFCOMM_RLS_Out)				(void *pCallContext, int iError);
typedef int (*RFCOMM_FC_In)					(HANDLE hDeviceContext, void *pCallContext, HANDLE hConnection, unsigned char fcOn);
typedef int (*RFCOMM_FC_Out)				(void *pCallContext, int iError);
typedef int (*RFCOMM_PNREQ_In)				(HANDLE hDeviceContext, void *pCallContext, HANDLE hConnection, unsigned char priority, unsigned short n1, int use_credit_fc_in, int initial_credit_in);
typedef int (*RFCOMM_PNREQ_Out)				(void *pCallContext, int iError, unsigned char priority, unsigned short n1, int use_credit_fc_out, int initial_count_out);
typedef int (*RFCOMM_RPNREQ_In)				(HANDLE hDeviceContext, void *pCallContext, HANDLE hConnection, unsigned short mask, int baud, int data, int stop, int parity, int parity_type, unsigned char flow, unsigned char xon, unsigned char xoff);
typedef int (*RFCOMM_RPNREQ_Out)			(void *pCallContext, int iError, unsigned short mask, int baud, int data, int stop, int parity, int parity_type, unsigned char flow, unsigned char xon, unsigned char xoff);
typedef int (*RFCOMM_PNRSP_In)				(HANDLE hDeviceContext, void *pCallContext, HANDLE hConnection, unsigned char priority, unsigned short n1, int use_credit_fc_out, int initial_credit_out);
typedef int (*RFCOMM_PNRSP_Out)				(void *pCallContext, int iError);
typedef int (*RFCOMM_RPNRSP_In)				(HANDLE hDeviceContext, void *pCallContext, HANDLE hConnection, unsigned short mask, int baud, int data, int stop, int parity, int parity_type, unsigned char flow, unsigned char xon, unsigned char xoff);
typedef int (*RFCOMM_RPNRSP_Out)			(void *pCallContext, int iError);
typedef int (*RFCOMM_TEST_In)				(HANDLE hDeviceContext, void *pCallContext, HANDLE hConnection, unsigned char len, unsigned char *buff);
typedef int (*RFCOMM_TEST_Out)			    (void *pCallContext, int iError, unsigned char len, unsigned char *buff);

typedef int (*RFCOMM_ConnectRequest_Ind)	(void *pUserContext, HANDLE hConnection, BD_ADDR *pba, unsigned char channel);
typedef int (*RFCOMM_DataUp_Ind)			(void *pUserContext, HANDLE hConnection, BD_BUFFER *pba, int add_credits);
typedef int (*RFCOMM_Disconnect_Ind)		(void *pUserContext, HANDLE hConnection);
typedef int (*RFCOMM_MSC_Ind)				(void *pUserContext, HANDLE hConnection, unsigned char v24, unsigned char bs);
typedef int (*RFCOMM_RLS_Ind)				(void *pUserContext, HANDLE hConnection, unsigned char rls);
typedef int (*RFCOMM_FC_Ind)				(void *pUserContext, HANDLE hConnection, unsigned char fcOn);
typedef int (*RFCOMM_PNREQ_Ind)				(void *pUserContext, HANDLE hConnection, unsigned char priority, unsigned short n1, int use_credit_fc, int initial_credit);
typedef int (*RFCOMM_RPNREQ_Ind)			(void *pUserContext, HANDLE hConnection, unsigned short mask, int baud, int data, int stop, int parity, int party_type, unsigned char flow, unsigned char xon, unsigned char xoff);

struct _RFCOMM_EVENT_INDICATION {
	RFCOMM_ConnectRequest_Ind				rfcomm_ConnectRequest_Ind;
	RFCOMM_DataUp_Ind						rfcomm_DataUp_Ind;
	RFCOMM_Disconnect_Ind					rfcomm_Disconnect_Ind;
	RFCOMM_MSC_Ind							rfcomm_MSC_Ind;
	RFCOMM_RLS_Ind							rfcomm_RLS_Ind;
	RFCOMM_FC_Ind							rfcomm_FC_Ind;
	RFCOMM_PNREQ_Ind						rfcomm_PNREQ_Ind;
	RFCOMM_RPNREQ_Ind						rfcomm_RPNREQ_Ind;

	BT_LAYER_STACK_EVENT_IND				rfcomm_StackEvent;
};

struct _RFCOMM_INTERFACE {
	RFCOMM_CreateChannel                    rfcomm_CreateChannel;
	RFCOMM_GetChannelAddress                rfcomm_GetChannelAddress;
	RFCOMM_ConnectRequest_In				rfcomm_ConnectRequest_In;
	RFCOMM_ConnectResponse_In				rfcomm_ConnectResponse_In;
	RFCOMM_DataDown_In						rfcomm_DataDown_In;
	RFCOMM_Disconnect_In					rfcomm_Disconnect_In;
	RFCOMM_MSC_In							rfcomm_MSC_In;
	RFCOMM_RLS_In							rfcomm_RLS_In;
	RFCOMM_FC_In							rfcomm_FC_In;
	RFCOMM_PNREQ_In							rfcomm_PNREQ_In;
	RFCOMM_RPNREQ_In						rfcomm_RPNREQ_In;
	RFCOMM_PNRSP_In							rfcomm_PNRSP_In;
	RFCOMM_RPNRSP_In						rfcomm_RPNRSP_In;
	RFCOMM_TEST_In							rfcomm_TEST_In;

	BT_LAYER_IO_CONTROL						rfcomm_ioctl;
	BT_LAYER_ABORT_CALL						rfcomm_AbortCall;
};

struct _RFCOMM_CALLBACKS {
    RFCOMM_ConnectRequest_Out				rfcomm_ConnectRequest_Out;
    RFCOMM_ConnectResponse_Out				rfcomm_ConnectResponse_Out;
    RFCOMM_DataDown_Out						rfcomm_DataDown_Out;
    RFCOMM_Disconnect_Out					rfcomm_Disconnect_Out;
    RFCOMM_MSC_Out							rfcomm_MSC_Out;
    RFCOMM_RLS_Out							rfcomm_RLS_Out;
    RFCOMM_FC_Out							rfcomm_FC_Out;
    RFCOMM_PNREQ_Out						rfcomm_PNREQ_Out;
    RFCOMM_RPNREQ_Out						rfcomm_RPNREQ_Out;
    RFCOMM_PNRSP_Out						rfcomm_PNRSP_Out;
    RFCOMM_RPNRSP_Out						rfcomm_RPNRSP_Out;
	RFCOMM_TEST_Out							rfcomm_TEST_Out;

	BT_LAYER_CALL_ABORTED					rfcomm_CallAborted;
};

//
//	channel:
//		RFCOMM_CHANNEL_ALL			accept connection on all channels (default upper layer)
//		RFCOMM_CHANNEL_CLIENT_ONLY	do not accept connections at all (client only)
//		...or channel to restrict connections on
//

#define RFCOMM_CHANNEL_ALL			0x00
#define RFCOMM_CHANNEL_MULTIPLE		0xfe
#define RFCOMM_CHANNEL_CLIENT_ONLY	0xff

int RFCOMM_EstablishDeviceContext
(
void					*pUserContext,		/* IN */
unsigned char			channel,			/* IN */
RFCOMM_EVENT_INDICATION	*pInd,				/* IN */
RFCOMM_CALLBACKS		*pCall,				/* IN */
RFCOMM_INTERFACE		*pInt,				/* OUT */
int						*pcDataHeaders,		/* OUT */
int						*pcDataTrailers,	/* OUT */
HANDLE					*phDeviceContext	/* OUT */
);

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

int rfcomm_InitializeOnce (void);
int rfcomm_CreateDriverInstance (void);
int rfcomm_CloseDriverInstance (void);
int rfcomm_UninitializeOnce (void);

int rfcomm_ProcessConsoleCommand (WCHAR *pString);

//	RFCOMM port emulator entity

#define PORTEMU_MTUMIN		23
#define PORTEMU_MTUMAX		32767
#define PORTEMU_MTU			127
#define PORTEMU_RECVMAX		1024
#define PORTEMU_SENDMAX		1024
#define PORTEMU_XONLIM		800
#define PORTEMU_XOFFLIM		200
#define PORTEMU_PRI			32
#define PORTEMU_RTO			1000
#define PORTEMU_WTO			1000

#define PORTEMU_CREDITS_LOW		10
#define PORTEMU_CREDITS_LOWEST	3

int portemu_InitializeOnce (void);
int portemu_CreateDriverInstance (void);
int portemu_CloseDriverInstance (void);
int portemu_UninitializeOnce (void);

int portemu_ProcessConsoleCommand (WCHAR *pString);

//	RFCOMM TDI
#define TDIR_MTUMIN			23
#define TDIR_MTUMAX			32767
#define TDIR_MTU			127
#define TDIR_RECVMAX		1024
#define TDIR_SENDMAX		1024
#define TDIR_XONLIM			800
#define TDIR_XOFFLIM		200

⌨️ 快捷键说明

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