1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00
LibQQt/examples/qqtclientexample/quserbluetoothprotocol.cpp
tianduanrui 444a97e6c9 move example to QQtExample.pro
QQtExample工程依赖于QQt工程
2018-04-23 18:29:20 +08:00

25 lines
655 B
C++

#include "quserbluetoothprotocol.h"
#include "qqtbluetoothclient.h"
#include "qqtbluetoothmanager.h"
QUserBluetoothProtocol::QUserBluetoothProtocol ( QObject* parent ) : QObject ( parent )
{
}
QQtBluetoothClient* QQtUserBluetoothClientInstance ( QObject* parent )
{
static QQtBluetoothClient* cli = nullptr;
if ( !cli )
{
QQtBluetoothManager* inst = QQtBluetoothManager::Instance ( parent );
inst->getDeviceList().first().address();
cli = new QQtBluetoothClient ( QBluetoothServiceInfo::RfcommProtocol, parent );
cli->setServiceAddress ( inst->getDeviceList().first().address() );
}
return cli;
}