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 27, 2024
1 parent 4965c24 commit efbc152
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 @@ -20,7 +20,8 @@
#endif

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

}
Expand Down Expand Up @@ -109,7 +110,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 @@ -135,7 +136,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 @@ -155,7 +156,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 efbc152

Please sign in to comment.