2017-10-24 11:07:24 +08:00
|
|
|
#include "quserbluetoothprotocol.h"
|
2017-11-27 20:15:23 +08:00
|
|
|
#include "qqtsocketbluetoothclient.h"
|
2017-10-24 11:07:24 +08:00
|
|
|
#include "qqtbluetoothmanager.h"
|
|
|
|
|
2017-11-27 20:15:23 +08:00
|
|
|
QUserBluetoothProtocol::QUserBluetoothProtocol ( QObject* parent ) : QObject ( parent )
|
2017-10-24 11:07:24 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-11-27 20:15:23 +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-11-27 20:15:23 +08:00
|
|
|
|
|
|
|
if ( !cli )
|
2017-10-24 11:07:24 +08:00
|
|
|
{
|
2017-11-27 20:15:23 +08:00
|
|
|
QQtBluetoothManager* inst = QQtBluetoothManager::Instance ( parent );
|
2017-10-24 11:07:24 +08:00
|
|
|
inst->getDeviceList().first().address();
|
2017-11-27 20:15:23 +08:00
|
|
|
cli = new QQtSocketBluetoothClient ( QBluetoothServiceInfo::RfcommProtocol, parent );
|
|
|
|
cli->setServiceAddress ( inst->getDeviceList().first().address() );
|
2017-10-24 11:07:24 +08:00
|
|
|
|
|
|
|
}
|
2017-11-27 20:15:23 +08:00
|
|
|
|
2017-10-24 11:07:24 +08:00
|
|
|
return cli;
|
|
|
|
}
|