Rough enable/disable for lanlink

This commit is contained in:
Rob Emery 2024-10-07 19:45:27 +01:00 committed by Carl Schwan
parent bc48c5e9f8
commit 97841c8634
No known key found for this signature in database
GPG key ID: 02325448204E452A
4 changed files with 32 additions and 19 deletions

View file

@ -73,6 +73,21 @@ void BluetoothLinkProvider::onStop()
}
}
void BluetoothLinkProvider::enable()
{
enabled = true;
tryToInitialise();
}
void BluetoothLinkProvider::disable()
{
enabled = false;
this->onStop();
mBluetoothServer = nullptr;
mServiceDiscoveryAgent = nullptr;
}
void BluetoothLinkProvider::onNetworkChange()
{
qCDebug(KDECONNECT_CORE) << "BluetoothLinkProvider::onNetworkChange executed";

View file

@ -42,20 +42,9 @@ public:
return 10;
}
void enable() override
{
enabled = true;
tryToInitialise();
}
void enable() override;
void disable() override
{
enabled = false;
this->onStop();
mBluetoothServer = nullptr;
mServiceDiscoveryAgent = nullptr;
}
void disable() override;
public Q_SLOTS:
virtual void onNetworkChange() override;

View file

@ -84,6 +84,17 @@ LanLinkProvider::~LanLinkProvider()
{
}
void LanLinkProvider::enable()
{
disabled = false;
this->onStart();
}
void LanLinkProvider::disable()
{
this->onStop();
disabled = true;
}
void LanLinkProvider::onStart()
{
const QHostAddress bindAddress = m_testMode ? QHostAddress::LocalHost : QHostAddress::Any;

View file

@ -43,12 +43,8 @@ public:
return 20;
}
void enable() override
{
}
void disable() override
{
}
void enable() override;
void disable() override;
void sendUdpIdentityPacket(const QList<QHostAddress> &addresses);
@ -99,6 +95,8 @@ private:
const bool m_testMode;
QTimer m_combineNetworkChangeTimer;
bool disabled;
#ifdef KDECONNECT_MDNS
MdnsDiscovery m_mdnsDiscovery;
#endif