📄 bluetoothclient.h
字号:
#ifndef __BLUETOOTHCLIENT_H__
#define __BLUETOOTHCLIENT_H__
// System Includes
#include <bt_sock.h>
// User defined includes
#include "BluetoothDefinitions.h" // KMaxMessageLength
// Forward Declaration
class MBluetoothObserver;
// CLASS DECLARATION
/**
*
* This is the Bluetooth Client and handles setting up sockets for Bluetooth communications
*
* It requires an observer to handle UI feedback on certain events
*
*/
/**
*
* @class CBluetoothClient BluetoothClient.h
* @brief This is the Bluetooth Client and handles setting up sockets for Bluetooth communications
*
* It requires an observer to handle UI feedback on certain events
*
* Copyright (c) EMCC Software Ltd 2003
* @version 1.0
*
*/
class CBluetoothClient : public CActive
{
public: // Constructors
static CBluetoothClient* NewL(MBluetoothObserver& aObserver);
~CBluetoothClient();
private: // Constructors - Symbian 2nd stage
CBluetoothClient(MBluetoothObserver& aObserver);
void ConstructL();
public: // Member functions
void ConnectToServerL(const TBTDevAddr& aBTDevAddr, const TInt aPort);
void Send(const TDesC& aMessage);
TBool IsConnected();
TBool AvailableToSend();
public: // Member functions from CActive
void RunL();
void DoCancel();
private: // member functions, utility functions
void Disconnect();
void RequestData();
void SendL(const TDesC& aMessage);
private: // Private member data
RSocketServ iSocketServer;
RSocket iSendingSocket;
TBTSockAddr iSocketAddress;
TBuf8<KMaxMessageSizeDesc16 + sizeof (TInt)> iMessage;
TSockXfrLength iLen;
MBluetoothObserver& iObserver;
private: // State machine definition
enum TState
{
EDisconnected,
EConnecting,
EConnected,
EWaitingForMessage,
ESendData
};
TState iState;
};
#endif // __BLUETOOTHCLIENT_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -