www.pudn.com > BluetoothChat.rar > BluetoothServer.h
#ifndef __BLUETOOTHSERVER_H__ #define __BLUETOOTHSERVER_H__ // System Includes #include#include // User defined include files #include "BluetoothDefinitions.h" #include "BluetoothObserver.h" // Forward declaration class CBluetoothAdvertiser; class MBluetoothObserver; // CLASS DECLARATION 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 iMessage; RBTMan iSecManager; MBluetoothObserver& iObserver; TBTSockAddr iBTSockAddr; TInt iChannel; private: // Member data - State machine definition enum TState { EDisconnected, ESettingSecurity, EConnecting, EConnected, EWaitingForMessage, ESendData }; TState iState; }; #endif // __BLUETOOTHSERVER_H__ // End of file