Skip to content

Commit

Permalink
Update Bluetooth Configuration Usage
Browse files Browse the repository at this point in the history
  • Loading branch information
HTRamsey committed Apr 18, 2024
1 parent 6becaa4 commit bc3baf2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/comm/BluetoothLink.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
#include "LinkManager.h"

BluetoothLink::BluetoothLink(SharedLinkConfigurationPtr& config)
: LinkInterface (config)
: LinkInterface(config)
, _bluetoothConfig(qobject_cast<BluetoothConfiguration*>(config.get()))
{

}
Expand Down Expand Up @@ -111,7 +112,7 @@ bool BluetoothLink::_hardwareConnect()
_discoveryAgent->start();
#else
_createSocket();
_targetSocket->connectToService(QBluetoothAddress(qobject_cast<BluetoothConfiguration*>(_config.get())->device().address), QBluetoothUuid(QBluetoothUuid::ServiceClassUuid::SerialPort));
_targetSocket->connectToService(QBluetoothAddress(_bluetoothConfig->device().address), QBluetoothUuid(QBluetoothUuid::ServiceClassUuid::SerialPort));
#endif
return true;
}
Expand All @@ -137,7 +138,7 @@ void BluetoothLink::serviceDiscovered(const QBluetoothServiceInfo& info)
{
if(!info.device().name().isEmpty() && !_targetSocket)
{
if(_config->device().uuid == info.device().deviceUuid() && _config->device().name == info.device().name())
if(_bluetoothConfig->device().uuid == info.device().deviceUuid() && _bluetoothConfig->device().name == info.device().name())
{
_createSocket();
_targetSocket->connectToService(info);
Expand All @@ -157,7 +158,7 @@ void BluetoothLink::discoveryFinished()
if(!_targetSocket)
{
_connectState = false;
emit communicationError("Could not locate Bluetooth device:", _config->device().name);
emit communicationError("Could not locate Bluetooth device:", _bluetoothConfig->device().name);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/comm/BluetoothLink.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ private slots:
bool _hardwareConnect (void);
void _createSocket (void);

BluetoothConfiguration* _bluetoothConfig;
QBluetoothSocket* _targetSocket = nullptr;
#ifdef Q_OS_IOS
QBluetoothServiceDiscoveryAgent* _discoveryAgent = nullptr;
Expand Down

0 comments on commit bc3baf2

Please sign in to comment.