2017-10-24 11:07:24 +08:00
|
|
|
#include "quserbluetoothprotocol.h"
|
|
|
|
#include "qqtbluetoothclient.h"
|
|
|
|
#include "qqtbluetoothmanager.h"
|
|
|
|
|
|
|
|
QUserBluetoothProtocol::QUserBluetoothProtocol(QObject* parent) : QObject(parent)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-11-22 17:56:37 +08:00
|
|
|
QQtSocketBluetoothClient* QQtUserBluetoothClientInstance(QObject* parent)
|
2017-10-24 11:07:24 +08:00
|
|
|
{
|
2017-11-22 17:56:37 +08:00
|
|
|
static QQtSocketBluetoothClient* cli = nullptr;
|
2017-10-24 11:07:24 +08:00
|
|
|
if (!cli)
|
|
|
|
{
|
|
|
|
QQtBluetoothManager* inst = QQtBluetoothManager::Instance(parent);
|
|
|
|
inst->getDeviceList().first().address();
|
2017-11-22 17:56:37 +08:00
|
|
|
cli = new QQtSocketBluetoothClient(QBluetoothServiceInfo::RfcommProtocol, parent);
|
2017-10-24 11:07:24 +08:00
|
|
|
cli->setServiceAddress(inst->getDeviceList().first().address());
|
|
|
|
|
|
|
|
}
|
|
|
|
return cli;
|
|
|
|
}
|