📄 bluetoothserver.h.svn-base
字号:
/*
============================================================================================
Name : BluetoothServer.h
Author : BluetoothAPI is a initiative of Embedded LAB - http://www.embedded.ufcg.edu.br/
OpenC/SymbianC++ - http://efforts.embedded.ufcg.edu.br/symbiancpp
Version :
Copyright : This file is part of BluetoothAPI.
Bluetooth is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
BluetoothAPI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with BluetoothAPI. If not, see <http://www.gnu.org/licenses/>.
Description : BluetoothServer.h implementation
===========================================================================================
*/
#ifndef BLUETOOTHSERVER_H
#define BLUETOOTHSERVER_H
#include <e32base.h> // For CActive, link against: euser.lib
#include <es_sock.h> // RSocket, RSocketServ, TSockXfrLength
#include <bt_sock.h> // TBTSocAddr
#include <btmanclient.h>
#define KMaximumMessageLength 256
enum TBTServerState {EBTServerDisconnected=0, EBTServerConnecting,
EBTServerWaiting, EBTServerSending, EBTServerConnected};
class MBTServerObserver
{
public:
virtual void HandleBTServerConnected()=0;
virtual void HandleBTServerDisconnected()=0;
virtual void HandleBTServerMessageRecvd()=0;
virtual void HandleBTMessageSent()=0;
virtual void HandleBTError(TInt aError)=0;
};
class CBluetoothServer : public CActive
{
public:
// Two-phased constructor.
static CBluetoothServer* NewL(MBTServerObserver* aObserver);
~CBluetoothServer();
TInt StartL(RSocketServ& aSocketServ);
void Stop();
void SendL(const TDesC8& aMessage);
TBuf8<KMaximumMessageLength> iBuffer;
protected:
void RunL();
void DoCancel();
private:
CBluetoothServer(MBTServerObserver* aObserver);
void ConstructL();
void SetChannelSecurityL(TBool aAuthentication, TBool aEncryption,
TBool aAuthorisation, TInt aChannel, TBTSockAddr& aSockAddr);
TBTServerState iBTServerState;
RSocket iListenSocket;
RSocket iConnectedSocket;
TSockXfrLength iLen;
MBTServerObserver* iBTServerObserver;
};
#endif // BLUETOOTHSERVER_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -