Hacking in a very rough enable/disable (untested) implementation
This commit is contained in:
parent
21b081ad14
commit
bc48c5e9f8
2 changed files with 25 additions and 11 deletions
|
@ -32,7 +32,9 @@ BluetoothLinkProvider::BluetoothLinkProvider()
|
||||||
void BluetoothLinkProvider::onStart()
|
void BluetoothLinkProvider::onStart()
|
||||||
{
|
{
|
||||||
qCDebug(KDECONNECT_CORE) << "BluetoothLinkProvider::onStart executed";
|
qCDebug(KDECONNECT_CORE) << "BluetoothLinkProvider::onStart executed";
|
||||||
|
if (enabled) {
|
||||||
tryToInitialise();
|
tryToInitialise();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BluetoothLinkProvider::tryToInitialise()
|
void BluetoothLinkProvider::tryToInitialise()
|
||||||
|
@ -57,6 +59,7 @@ void BluetoothLinkProvider::tryToInitialise()
|
||||||
|
|
||||||
void BluetoothLinkProvider::onStop()
|
void BluetoothLinkProvider::onStop()
|
||||||
{
|
{
|
||||||
|
if (enabled) {
|
||||||
qCDebug(KDECONNECT_CORE) << "BluetoothLinkProvider::onStop executed";
|
qCDebug(KDECONNECT_CORE) << "BluetoothLinkProvider::onStop executed";
|
||||||
if (!mBluetoothServer) {
|
if (!mBluetoothServer) {
|
||||||
return;
|
return;
|
||||||
|
@ -67,12 +70,15 @@ void BluetoothLinkProvider::onStop()
|
||||||
mKdeconnectService.unregisterService();
|
mKdeconnectService.unregisterService();
|
||||||
mBluetoothServer->close();
|
mBluetoothServer->close();
|
||||||
mBluetoothServer->deleteLater();
|
mBluetoothServer->deleteLater();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BluetoothLinkProvider::onNetworkChange()
|
void BluetoothLinkProvider::onNetworkChange()
|
||||||
{
|
{
|
||||||
qCDebug(KDECONNECT_CORE) << "BluetoothLinkProvider::onNetworkChange executed";
|
qCDebug(KDECONNECT_CORE) << "BluetoothLinkProvider::onNetworkChange executed";
|
||||||
|
if (enabled) {
|
||||||
tryToInitialise();
|
tryToInitialise();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BluetoothLinkProvider::connectError()
|
void BluetoothLinkProvider::connectError()
|
||||||
|
|
|
@ -44,10 +44,17 @@ public:
|
||||||
|
|
||||||
void enable() override
|
void enable() override
|
||||||
{
|
{
|
||||||
|
enabled = true;
|
||||||
|
tryToInitialise();
|
||||||
}
|
}
|
||||||
|
|
||||||
void disable() override
|
void disable() override
|
||||||
{
|
{
|
||||||
|
enabled = false;
|
||||||
|
this->onStop();
|
||||||
|
|
||||||
|
mBluetoothServer = nullptr;
|
||||||
|
mServiceDiscoveryAgent = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
|
@ -77,6 +84,7 @@ private:
|
||||||
QBluetoothServiceInfo mKdeconnectService;
|
QBluetoothServiceInfo mKdeconnectService;
|
||||||
QBluetoothServiceDiscoveryAgent *mServiceDiscoveryAgent;
|
QBluetoothServiceDiscoveryAgent *mServiceDiscoveryAgent;
|
||||||
QTimer *connectTimer;
|
QTimer *connectTimer;
|
||||||
|
bool enabled;
|
||||||
|
|
||||||
QMap<QString, DeviceLink *> mLinks;
|
QMap<QString, DeviceLink *> mLinks;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue