📄 bluetoothsockconnector.h
字号:
/*============================================================================ Name : BlueToothSockConnector.h Author : Copyright : Description : CBluetoothSockConnector is responsible for connecting to the remote device on a given BT device address and on a given RFCOMM's port using the BT socket layer============================================================================*/#ifndef __BLUETOOTHSOCKCONNECTOR_H__#define __BLUETOOTHSOCKCONNECTOR_H__// INCLUDES#include <bt_sock.h>#include <btmanclient.h>#include <btsdp.h>#include "BluetoothConnector.h"// CLASS DECLARATION/*** CBluetoothSockConnector* Connects to a remote device on a given BT device address and on a given RFCOMM's port using the BT socket layer*/class CBluetoothSockConnector : public CActive {public: /** * Constructor * @param aBtSocket Client endpoint to the RFCOMM protocol * @param aSockConnObs Interface to notify the status of the connection * @param aSocketServer A handle to an existing session on the socket server (ESock). */ static CBluetoothSockConnector* NewL(RSocket& aBtSocket, MSocketConnectorObserver& aSockConnObs, RSocketServ& aSocketServer); /** * Destructor */ ~CBluetoothSockConnector(); /** * Connects to the remote BT device * @param aDevAddr The remote BT device address * @param aPort The RFCOMM's port */ void ConnectToRemoteBtDeviceL(const TBTDevAddr& aDevAddr, TInt aPort);private: /** * Constructor * @param aBtSocket Client endpoint to the RFCOMM protocol * @param aSockConnObs Interface to notify the status of the connection * @param aSocketServer A handle to an existing session on the socket server (ESock). */ CBluetoothSockConnector(RSocket& aBtSocket, MSocketConnectorObserver& aSockConnObs, RSocketServ& aSocketServer); /** * Second phase constructor */ void ConstructL(); // from CSocketConnector /** * Handles CBluetoothConnector's state machine completion events */ virtual void RunL(); /** * Cancels all outstanding BT socket operations */ virtual void DoCancel(); /** * Handles a leave occurring in the request completion event handler RunL() * @param aError The leave code * @return TInt The default implementation returns aError.A derived class implementation should return KErrNone, * if it handles the leave; otherwise it should return any suitable value to cause the handling * of the error to be propagated back to the active scheduler. */ virtual TInt RunError(TInt aError); private: /** * Client endpoint to the RFCOMM protocol */ RSocket& iBtSocket; /** * Interface to notify the status of the connection */ MSocketConnectorObserver& iSockConnObs; /** * A handle to an existing session on the socket server (ESock) */ RSocketServ& iSocketServer; /** * The remote BT device address */ TBTSockAddr iBtDevAddr; };#endif //__BLUETOOTHSOCKCONNECTOR_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -