📄 bluetoothserver.h
字号:
#ifndef __BLUETOOTHSERVER_H__
#define __BLUETOOTHSERVER_H__
// System Includes
#include <es_sock.h>
#include <btmanclient.h>
// User defined include files
#include "BluetoothDefinitions.h"
#include "BluetoothObserver.h"
// Forward declaration
class CBluetoothAdvertiser;
class MBluetoothObserver;
// CLASS DECLARATION
/**
*
* @class CBluetoothServer BluetoothServer.h
* @brief This is the Bluetooth Server and handles setting up sockets for Bluetooth communications, triggering Security settings,
* and advertising services
*
* It requires an observer to handle UI feedback on certain events
* Copyright (c) EMCC Software Ltd 2003
* @version 1.0
*
*/
class CBluetoothServer : public CActive
{
public: // Constructors
static CBluetoothServer* NewL(MBluetoothObserver& aObserver);
static CBluetoothServer* NewLC(MBluetoothObserver& aObserver);
~CBluetoothServer();
private: // Consturctors - Symbian 2nd phase
CBluetoothServer(MBluetoothObserver& aObserver);
void ConstructL();
public: // Functionality
void StartServerL();
void StartAdvertisingL();
void StopL();
void Send(const TDesC& aMessage);
TBool IsConnected();
TBool AvailableToSend();
public:// from CActive
void RunL();
void DoCancel();
private: // Member functions
void RequestData();
void SetSecurityOnChannelL(TBool aAuthentication, TBool aEncryption, TBool aAuthorisation);
void AcceptConnectionsL();
void SendL(const TDesC& aMessage);
private: // Member data
CBluetoothAdvertiser* iAdvertiser;
RSocketServ iSocketServer;
RSocket iListeningSocket;
RSocket iAcceptedSocket;
TSockXfrLength iLen;
TBuf8<KMaxMessageSizeDesc16 + sizeof (TInt)> iMessage;
RBTMan iSecManager;
MBluetoothObserver& iObserver;
RBTSecuritySettings iSecSettingsSession;
TInt iChannel;
private: // Member data - State machine definition
enum TState
{
EDisconnected,
ESettingSecurity,
EConnecting,
EConnected,
EWaitingForMessage,
ESendData
};
TState iState;
};
#endif // __BLUETOOTHSERVER_H__
// End of file
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -