1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00
LibQQt/examples/qqtnetworkexample/quserbluetoothprotocol.cpp

23 lines
651 B
C++

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