📄 btifclasses.h
字号:
long m_FtpHandle;
CWBtAPI *m_pBtApi;
BOOL m_authentication_requested_by_app;
BOOL m_encryption_requested_by_app;
BOOL m_authentication_saved;
BOOL m_encryption_saved;
void SaveSecurity();
void RestoreSecurity();
WBtRc m_LastWBtRc; // Contains the last code returned by WBtApi
HANDLE m_hMutex;
friend class CFtpClientFriend;
// 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.
CFtpClient(const CFtpClient & x);
CFtpClient& operator= (const CFtpClient & x);
FTP_RETURN_CODE _DeleteFile(WCHAR * szFile);
};
///////////////////////////////////////////////////////////////////////////////////////
// Define a class to control the OPP client sessions
//
class COppClient_Impl;
class WIDCOMMSDK COppClient
{
public:
//
// Define return code for OPP Client functions
//
typedef enum
{
OPP_CLIENT_SUCCESS, // Operation initiated without error
OUT_OF_MEMORY, // Not enough memory to initiate operation
SECURITY_ERROR, // Error implementing requested security level
OPP_ERROR, // OPP-specific error
OPP_NO_BT_SERVER, // Cannot access the local Bluetooth COM server
ABORT_INVALID, // Abort not valid, no operation is in progress
INVALID_PARAMETER, // One or more of function parameters are not valid
UNKNOWN_ERROR // Any condition other than the above
} OPP_RETURN_CODE;
//
// Define return code for OPP response functions
//
typedef enum
{
COMPLETED, // operation completed without error
BAD_ADDR, // bad BD_ADDR
BAD_STATE, // could not handle request in present state
BAD_REQUEST, // invalid request
NOT_FOUND, // no such file
NO_SERVICE, // could not find the specified FTP server
DISCONNECT, // connection lost
READ, // read error
WRITE, // write error
OBEX_AUTH, // OBEX Authentication required
DENIED, // request could not be honored
DATA_NOT_SUPPORTED, // server does not support the requested data
CONNECT, // error establishing connection
NOT_INITIALIZED, // not initialized
PARAM, // bad parameter
BAD_INBOX, // inbox is not valid
BAD_NAME, // bad name for object
PERMISSIONS, // prohibited by file permissions
SHARING, // file is shared
RESOURCES, // file system resource limit reached - may be file handles, disk space, etc.
FILE_EXISTS, // is closedfile alto attempt to perform function after connectionready exists
UNKNOWN_RESULT_ERROR // Any condition other than the above
} OPP_RESULT_CODE;
//
// Define return code for OPP response functions
// (NOTE: these values match the ones defined in \middleware\opp\oppapp.h)
//
typedef enum
{
OPP_PUT_TRANS = 1,
OPP_GET_TRANS = 2,
OPP_EXCHANGE_PUT_TRANS = 3,
OPP_EXCHANGE_GET_TRANS = 4,
OPP_ABORT_TRANS = 5
} OPP_TRANSACTION_CODE;
public:
// Construction/destruction
//
COppClient ();
virtual ~COppClient();
OPP_RETURN_CODE Push(BD_ADDR bda, WCHAR * pszPathName, CSdpDiscoveryRec & sdp_rec);
OPP_RETURN_CODE Pull(BD_ADDR bda, WCHAR * pszPathName, CSdpDiscoveryRec & sdp_rec);
OPP_RETURN_CODE Exchange(BD_ADDR bda, WCHAR * pszName, WCHAR * pszFolder, CSdpDiscoveryRec & sdp_rec);
OPP_RETURN_CODE Abort();
void SetSecurity(BOOL authentication, BOOL encryption);
virtual void OnAbortResponse (OPP_RESULT_CODE result_code) {}
virtual void OnProgress(OPP_RESULT_CODE result_code, BD_ADDR bda, WCHAR * string, long current, long total) {}
virtual void OnPushResponse(OPP_RESULT_CODE result_code, BD_ADDR bda, WCHAR * string) {}
virtual void OnPullResponse(OPP_RESULT_CODE result_code , BD_ADDR bda, WCHAR * string) {}
virtual void OnExchangeResponse(OPP_RESULT_CODE result_code, BD_ADDR bda, WCHAR * string) {}
virtual void OnExchangeResponse(OPP_RESULT_CODE result_code, BD_ADDR bda, WCHAR * string, OPP_TRANSACTION_CODE transaction_code) {}
void SetExtendedError(WBtRc code) { m_LastWBtRc = code; }
WBtRc GetExtendedError() const { return m_LastWBtRc; }
private:
long m_OppHandle;
CWBtAPI *m_pBtApi;
BOOL m_authentication_requested_by_app;
BOOL m_encryption_requested_by_app;
BOOL m_authentication_saved;
BOOL m_encryption_saved;
void SaveSecurity();
void RestoreSecurity();
WBtRc m_LastWBtRc; // Contains the last code returned by WBtApi
GUID m_guid;
BD_ADDR m_addr;
HANDLE m_hMutex;
friend class COppClientFriend;
// 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.
COppClient(const COppClient & x);
COppClient& operator= (const COppClient & x);
};
///////////////////////////////////////////////////////////////////////////////////////
// Define a class to control the LAP client sessions
//
class WIDCOMMSDK CLapClient
{
public:
//
// Define return code for LAP Client functions
//
typedef enum
{
SUCCESS, // Operation initiated without error
NO_BT_SERVER, // COM server could not be started
ALREADY_CONNECTED, // attempt to connect before previous connection closed
NOT_CONNECTED, // attempt to close unopened connection
NOT_ENOUGH_MEMORY, // local processor could not allocate memory for open
INVALID_PARAMETER, // One or more of function parameters are not valid
UNKNOWN_ERROR, // Any condition other than the above
LICENSE_ERROR, // license error
NOT_SUPPORTED // not supported on Profile Pack version - added SDK 6.1
} LAP_RETURN_CODE;
//
// Define connection states
//
typedef enum
{
LAP_CONNECTED, // port now connected
LAP_DISCONNECTED // port now disconnected
} LAP_STATE_CODE;
public:
// Construction/destruction
//
CLapClient ();
virtual ~CLapClient();
LAP_RETURN_CODE CreateConnection(BD_ADDR bda, GUID guid, CSdpDiscoveryRec & sdp_rec);
LAP_RETURN_CODE CreateConnection(BD_ADDR bda, CSdpDiscoveryRec & sdp_rec);
LAP_RETURN_CODE RemoveConnection();
void SetSecurity(BOOL authentication, BOOL encryption);
virtual void OnStateChange(BD_ADDR bda, DEV_CLASS dev_class, BD_NAME name, short com_port, LAP_STATE_CODE state) = 0;
void SetExtendedError(WBtRc code) { m_LastWBtRc = code; }
WBtRc GetExtendedError() const { return m_LastWBtRc; }
LAP_RETURN_CODE GetConnectionStats (tBT_CONN_STATS *p_conn_stats);
private:
short m_ComPort;
CWBtAPI *m_pBtApi;
BOOL m_authentication_requested_by_app;
BOOL m_encryption_requested_by_app;
BOOL m_authentication_saved;
BOOL m_encryption_saved;
void SaveSecurity();
void RestoreSecurity();
WBtRc m_LastWBtRc; // Contains the last code returned by WBtApi
BD_ADDR m_BdAddr; // Bluetooth address of remote BT to connect tos
GUID m_Guid;
HANDLE m_hMutex;
friend class CLapClientFriend;
// 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.
CLapClient(const CLapClient & x);
CLapClient& operator= (const CLapClient & x);
};
///////////////////////////////////////////////////////////////////////////////////////
// Define a class to control the DUN client sessions
//
class WIDCOMMSDK CDunClient
{
public:
//
// Define return code for DUN Client functions
//
typedef enum
{
SUCCESS, // Operation initiated without error
NO_BT_SERVER, // COM server could not be started
ALREADY_CONNECTED, // attempt to connect before previous connection closed
NOT_CONNECTED, // attempt to close unopened connection
NOT_ENOUGH_MEMORY, // local processor could not allocate memory for open
INVALID_PARAMETER, // One or more of function parameters are not valid
UNKNOWN_ERROR, // Any condition other than the above
LICENSE_ERROR, // invalid license
NOT_SUPPORTED // not supported in Profile Pack version - added SDK 6.1
} DUN_RETURN_CODE;
//
// Define connection states
//
typedef enum
{
DUN_CONNECTED, // port now connected
DUN_DISCONNECTED // port now disconnected
} DUN_STATE_CODE;
public:
// Construction/destruction
//
CDunClient ();
virtual ~CDunClient();
DUN_RETURN_CODE CreateConnection(BD_ADDR bda, CSdpDiscoveryRec & sdp_rec);
DUN_RETURN_CODE RemoveConnection();
void SetSecurity(BOOL authentication, BOOL encryption);
virtual void OnStateChange(BD_ADDR bda, DEV_CLASS dev_class, BD_NAME name, short com_port, DUN_STATE_CODE state) = 0;
void SetExtendedError(WBtRc code) { m_LastWBtRc = code; }
WBtRc GetExtendedError() const { return m_LastWBtRc; }
DUN_RETURN_CODE GetConnectionStats (tBT_CONN_STATS *p_conn_stats);
private:
short m_ComPort;
CWBtAPI *m_pBtApi;
BOOL m_authentication_requested_by_app;
BOOL m_encryption_requested_by_app;
BOOL m_authentication_saved;
BOOL m_encryption_saved;
void SaveSecurity();
void RestoreSecurity();
WBtRc m_LastWBtRc; // Contains the last code returned by WBtApi
BD_ADDR m_BdAddr;
HANDLE m_hMutex;
friend class CDunClientFriend;
// 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.
CDunClient(const CDunClient & x);
CDunClient& operator= (const CDunClient & x);
};
///////////////////////////////////////////////////////////////////////////////////////
// Define a class to control the SPP client sessions
//
class WIDCOMMSDK CSppClient
{
public:
//
// Define return code for SPP Client functions
//
typedef enum
{
SUCCESS, // Operation initiated without error
NO_BT_SERVER, // COM server could not be started
ALREADY_CONNECTED, // attempt to connect before previous connection closed
NOT_CONNECTED, // attempt to close unopened connection
NOT_ENOUGH_MEMORY, // local processor could not allocate memory for open
INVALID_PARAMETER, // One or more of function parameters are not valid
UNKNOWN_ERROR, // Any condition other than the above
NO_EMPTY_PORT, // no empty port
LICENSE_ERROR, // license error
NOT_SUPPORTED // not supported in Profile Pack version - added SDK 6.1
} SPP_CLIENT_RETURN_CODE;
public:
// Construction/destruction
//
CSppClient ();
virtual ~CSppClient();
SPP_CLIENT_RETURN_CODE CreateConnection(BD_ADDR bda, BT_CHAR *szServiceName);
SPP_CLIENT_RETURN_CODE RemoveConnection();
virtual void OnClientStateChange(BD_ADDR bda, DEV_CLASS dev_class, BD_NAME name, short com_port, SPP_STATE_CODE state) = 0;
void SetExtendedError(WBtRc code) { m_LastWBtRc = code; }
WBtRc GetExtendedError() const { return m_LastWBtRc; }
SPP_CLIENT_RETURN_CODE GetConnectionStats (tBT_CONN_STATS *p_conn_stats);
SPP_CLIENT_RETURN_CODE CreateCOMPort(short *com_port);
private:
short m_ComPort;
CWBtAPI *m_pBtApi;
BOOL m_connected;
WBtRc m_LastWBtRc; // Contains the last code returned by WBtApi
BD_ADDR m_BdAddr;
HANDLE m_hMutex;
friend class CSppClientFriend;
// 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.
CSppClient(const CSppClient & x);
CSppClient& operator= (const CSppClient & x);
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -