📄 bluetoothclient.h
字号:
/*
============================================================================================
Name : BluetoothClient.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 : BluetoothClient.h implementation
===========================================================================================
*/
#ifndef BLUETOOTHCLIENT_H
#define BLUETOOTHCLIENT_H
// INCLUDES
#include <bt_sock.h>
#include <btmanclient.h>
#include <btsdp.h>
#define KMaximumMessageLength 256
enum TBTClientState {EBTClientDisconnected=0, EBTClientConnecting,
EBTClientWaiting, EBTClientSending, EBTClientConnected};
class MBTClientObserver
{
public:
virtual void HandleBTClientConnected()=0;
virtual void HandleBTClientDisconnected()=0;
virtual void HandleBTClientMessageRcvd()=0;
virtual void HandleBTMessageSent()=0;
virtual void HandleBTError(TInt aError)=0;
};
// CLASS DECLARATION
/**
* CBluetoothClient
*
*/
class CBluetoothClient : public CActive
{
public:
static CBluetoothClient* NewL(RSocket& aBtSocket, MBTClientObserver* aSockConnObs);
~CBluetoothClient();
void ConnectL(RSocketServ& aSocketServ, TBTDevAddr aBTDevAddr,
TInt aPort);
void Disconnect();
void SendL(const TDesC8& aMessage);
TBuf8<KMaximumMessageLength> iBuffer;
protected:
void RunL();
void DoCancel();
private:
CBluetoothClient(RSocket& aBtSocket, MBTClientObserver* aSockConnObs);
void ConstructL();
RSocket iClientSocket;
MBTClientObserver* iBTClientObserver;
TBTClientState iBTClientState;
TSockXfrLength iLen;
};
#endif // BLUETOOTHCLIENT_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -