📄 btifclasses.h
字号:
BD_ADDR m_DiscoveryBdAddr;
UINT16 m_DiscoveryNumRecs;
DISCOVERY_RESULT m_DiscoveryResult;
private:
BOOL m_bInquiryActive;
BOOL m_bDiscoveryActive;
BOOL m_tempRegistry;
GUID m_TempRegistryGUID;
void DeleteTempRegistry();
BOOL AddTempRegistry(const GUID *p_GUID);
UINT16 m_audioHandle;
HANDLE m_hKrnl;
UINT32 m_KernelDriverVersion;
WBtRc m_LastWBtRc; // Contains the last code returned from WBtApi
static BOOL GetDLLVersion(LPCSTR sDLLFileName, LPSTR lpVersionInfo);
BT_CHAR m_szKeyName[MAX_PATH];
DEV_CLASS m_dev_class_filter;
BOOL GetRemoteDeviceName(BD_ADDR remote_bda, BD_NAME *remote_name, DEV_CLASS *devClass);
BOOL m_bStackServerConnected;
BOOL ConnectToStackServer();
void DeleteWbtApi();
HANDLE m_hMutex;
tLINK_STATUS_CB *m_pLinkStatusCb;
BD_ADDR m_link_status_bda_filter;
BYTE* m_devAddr;
DWORD m_devAddrCount;
HANDLE m_hDevNotify;
HWND m_hDevNotifyWnd;
BOOL PP_AclRegisterForChanges(BOOL bRegister);
friend class CBtIfFriend;
// This class will not support the compiler-supplied copy constructor or assignment operator,
// so these are declared private to prevent inadvertent use by the application.
CBtIf(const CBtIf & x);
CBtIf& operator= (const CBtIf & x);
};
////////////////////////////////////////////////////////////////////////////
//
// Define a class to control an L2CAP interface (for a specific PSM)
//
class WIDCOMMSDK CL2CapIf
{
public:
CL2CapIf();
~CL2CapIf();
// Server should call this method without any parameter
// to assign a new PSM value, or with a PSM value if it
// is using a fixed PSM. Client should call this method
// with PSM found from service discovery
//
// Due to a problem discovered in the Microsoft stack implementation
// of this function, a new version has been added, AssignPsmValueEx,
// which requires specification of the desired client/server role for
// the PSM. The original method is now deprecated, and if still used,
// its behavior now assumes client/server role based on if psm = 0 (client
// assumed) or non-zero (server assumed), for Microsoft stack deployments
//
/* Deprecated */ BOOL AssignPsmValue (GUID *p_guid, UINT16 psm = 0);
BOOL AssignPsmValueEx (GUID *p_guid, UINT16 psm, BOOL is_server); // Added 6.1.0.1502 SDK, supported on all stacks
// Both client and server sides should call this function
// to register a PSM with L2CAP, once the PSM value is known
//
BOOL Register ();
// Both client and server sides should call this function
// to de-register a PSM from L2CAP, when application is exiting
//
void Deregister ();
// Both client and server MUST call this function to set
// the security level for connections on the assigned PSM.
//
BOOL SetSecurityLevel (BT_CHAR *p_service_name, UINT8 security_level, BOOL is_server);
// Returns the PSM value currently in use.
//
inline UINT16 GetPsm() { return m_psm; }
private:
UINT16 m_psm;
BOOL m_is_registered;
CL2CapIf *m_p_next_psm;
GUID m_service_guid;
UINT8 m_security_index;
UINT8 m_security_level;
BT_CHAR m_p_service_name[BT_MAX_SERVICE_NAME_LEN+1];
friend class CL2CapConn;
// This class will not support the compiler-supplied copy constructor or assignment operator,
// so these are declared private to prevent inadvertent use by the application.
CL2CapIf(const CL2CapIf & x);
CL2CapIf& operator= (const CL2CapIf & x);
};
////////////////////////////////////////////////////////////////////////////
//
// Define a class to control the L2CAP connections (both client and server
//
class WIDCOMMSDK CL2CapConn
{
public:
// Construction/destruction
//
CL2CapConn ();
virtual ~CL2CapConn();
// Public variables
//
BOOL m_isCongested;
UINT16 m_RemoteMtu;
BD_ADDR m_RemoteBdAddr;
// Server should call this method to listen for an incoming
// connection. Client should not call this method.
//
BOOL Listen (CL2CapIf *p_if);
// Server should call this method to switch role to master if
// it wants to accept multiple connections
//
BOOL SwitchRole(MASTER_SLAVE_ROLE new_role);
BOOL SetLinkSupervisionTimeOut(UINT16 timeout);
// Create AudioConnection
AUDIO_RETURN_CODE CreateAudioConnection(BOOL bIsClient, UINT16 *audioHandle);
AUDIO_RETURN_CODE CreateAudioConnection(BOOL bIsClient, UINT16 *audioHandle, BD_ADDR bda); // added BTW 4.0.1.1400, SDK 4.0
// Disconnect AudioConnection
AUDIO_RETURN_CODE RemoveAudioConnection(UINT16 audioHandle);
// audio callback functions
virtual void OnAudioConnected(UINT16 audioHandle){};
virtual void OnAudioDisconnect(UINT16 audioHandle){};
// eSCO functions
AUDIO_RETURN_CODE RegForEScoEvts (UINT16 audioHandle, tBTM_ESCO_CBACK *p_esco_cback); // added SDK 5.0, BTW 5.0.1.200
AUDIO_RETURN_CODE SetEScoMode (tBTM_SCO_TYPE sco_mode, tBTM_ESCO_PARAMS *p_parms); // added SDK 5.0, BTW 5.0.1.200
AUDIO_RETURN_CODE ReadEScoLinkData (UINT16 audioHandle, tBTM_ESCO_DATA *p_Data); // added SDK 5.0, BTW 5.0.1.200
AUDIO_RETURN_CODE ChangeEScoLinkParms (UINT16 audioHandle, tBTM_CHG_ESCO_PARAMS *p_parms); // added SDK 5.0, BTW 5.0.1.200
void EScoConnRsp (UINT16 audioHandle, UINT8 hci_status, tBTM_ESCO_PARAMS *p_parms = NULL); // added SDK 5.0, BTW 5.0.1.200
// Server should call this method to accept an incoming
// connection, after he is notified of that connection.
// If anything other than the default MTU is desired,
// it should be passed as a parameter.
//
BOOL Accept (UINT16 desired_mtu = L2CAP_DEFAULT_MTU);
// Server should call this method to reject an incoming
// connection, after he is notified of that connection.
//
BOOL Reject (UINT16 reason);
// Client should call thi smethod to create a connection
// to a remote device. If anything other than the default
// MTU is desired, it should be passed as a parameter
//
BOOL Connect (CL2CapIf *p_if, BD_ADDR p_bd_addr, UINT16 desired_mtu = L2CAP_DEFAULT_MTU);
// Client or server may call this function to reconfigure
// an existing connection.
//
BOOL Reconfigure (tL2CAP_CONFIG_INFO *p_cfg);
// Client or server may call this function to disconnect
// an existing connection.
//
void Disconnect (void);
// Client or server may call this function to send data to
// an existing connection.
//
BOOL Write (void *p_data, UINT16 length, UINT16 *p_len_written);
// Get Current Connection Statistics
//
BOOL GetConnectionStats (tBT_CONN_STATS *p_conn_stats);
// Server may provide a function to handle incoming connection
// notifications. Client should not.
//
virtual void OnIncomingConnection ();
// Client may provide a function to handle connection pending
// notifications.
//
virtual void OnConnectPendingReceived (void) {}
// Client and server may provide a method to be notified
// when a connection is established.
//
virtual void OnConnected() {}
// Client and server may provide a method to be notified
// when data is received from the remote side.
//
virtual void OnDataReceived (void *p_data, UINT16 length) {}
// Client and server may provide a method to be notified
// when a connection becomes congested or uncongested.
//
virtual void OnCongestionStatus (BOOL is_congested) {}
// Client and server may provide a method to be notified
// when a connection is disconnected.
//
virtual void OnRemoteDisconnected (UINT16 reason) {}
// Returns L2CAP chanel ID (private member)
// It is unsupported method for internal use only
UINT16 GetCid(){return m_cid;}
private:
void SetIdle();
#define CL2CAP_STATE_IDLE 0
#define CL2CAP_STATE_LISTENING 1
#define CL2CAP_STATE_WAITING_ACCEPT 2
#define CL2CAP_STATE_CONNECTING 3
#define CL2CAP_STATE_CONFIG 4
#define CL2CAP_STATE_CONNECTED 5
int m_state;
UINT16 m_psm;
UINT16 m_desired_mtu;
UINT8 m_cfg_flags;
UINT16 m_cid;
UINT8 m_id;
static CL2CapConn *m_p_first_conn;
CL2CapConn *m_p_next_conn;
UINT16 m_audioHandle;
UINT16 *m_pPendingAudioHandle;
CL2CapIf *m_p_if;
friend class CL2CapFriend;
// This class will not support the compiler-supplied copy constructor or assignment operator,
// so these are declared private to prevent inadvertent use by the application.
CL2CapConn(const CL2CapConn & x);
CL2CapConn& operator= (const CL2CapConn & x);
};
////////////////////////////////////////////////////////////////////////////
//
// Define a class to create and manage SDP service records
//
class WIDCOMMSDK CSdpService
{
public:
CSdpService();
virtual ~CSdpService();
// This function adds a service class ID list to a service record. The service class ID
// list should be the first attribute added for a service record.
//
SDP_RETURN_CODE AddServiceClassIdList (int num_guids, GUID *p_service_guids);
// This function adds a name field to a service record.
//
SDP_RETURN_CODE AddServiceName (BT_CHAR *p_service_name);// CE defs
// This function adds a profile descriptor list to a service record.
//
SDP_RETURN_CODE AddProfileDescriptorList (GUID *p_profile_guid, UINT16 version);
// This function adds an L2CAP protocol descriptor list to a service record.
//
SDP_RETURN_CODE AddL2CapProtocolDescriptor (UINT16 psm);
// This function adds an RFCOMM protocol descriptor list to a service record.
//
SDP_RETURN_CODE AddRFCommProtocolDescriptor (UINT8 scn);
// This function adds a generic protocol descriptor list to a service record.
// It should be only needed if the specific RFCOMM and L2CAP functions above
// do not suffice.
//
SDP_RETURN_CODE AddProtocolList (int num_elem, tSDP_PROTOCOL_ELEM *p_elem_list);
// This function adds the additional sequence of generic protocol descriptor lists to a service record.
// It should be only needed if the specific RFCOMM and L2CAP functions above
// do not suffice.
//
SDP_RETURN_CODE AddAdditionProtoLists (int num_list_elem, tSDP_PROTO_LIST_ELEM *p_proto_list);
// This function adds a language base to a service record.
//
SDP_RETURN_CODE AddLanguageBaseAttrIDList (UINT16 lang, UINT16 char_enc, UINT16 base_id);
// This function makes a service record public browsable.
//
SDP_RETURN_CODE MakePublicBrowseable (void);
// This function sets the 'service availability' field of a service record.
//
SDP_RETURN_CODE SetAvailability (UINT8 availability);
// This function adds an attribute to a service record. It is intended
// to be used to add some other attribute not covered by the existing
// functions. Note that the parameter should be in Big Endian order.
//
SDP_RETURN_CODE AddAttribute (UINT16 attr_id, UINT8 attr_type, UINT32 attr_len, UINT8 *p_val);
// This function deletes an attribute from a service record.
//
SDP_RETURN_CODE DeleteAttribute (UINT16 attr_id);
// This functions add a list (sequence) for the 'supported formats' attribute
//
SDP_RETURN_CODE AddSupportedFormatsList(UINT8 num_formats, UINT8 pDataType[],
UINT8 pDataTypeLength[], UINT8 *pDataTypeValue[]);
SDP_RETURN_CODE CommitRecord(); // added SDK 6.1, BTW PP 6.0.1.2300
private:
UINT32 m_sdp_record_handle;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -