Attribute not needed
This commit is contained in:
parent
b1ef3f9fc9
commit
ea812f1101
3 changed files with 2 additions and 18 deletions
|
@ -36,21 +36,10 @@ LanPairingHandler::LanPairingHandler(DeviceLink* deviceLink)
|
|||
connect(&m_pairingTimeout, &QTimer::timeout, this, &LanPairingHandler::pairingTimeout);
|
||||
}
|
||||
|
||||
void LanPairingHandler::createPairPackage(NetworkPackage& np)
|
||||
{
|
||||
np.set("link", deviceLink()->name());
|
||||
np.set("pair", true);
|
||||
}
|
||||
|
||||
void LanPairingHandler::packageReceived(const NetworkPackage& np)
|
||||
{
|
||||
qDebug() << "Pairing package received!" << np.serialize();
|
||||
|
||||
if (np.get<QString>("link", deviceLink()->name()).compare(deviceLink()->name()) != 0) {
|
||||
// If this package is not received by my type of link
|
||||
return;
|
||||
}
|
||||
|
||||
m_pairingTimeout.stop();
|
||||
|
||||
bool wantsPair = np.get<bool>("pair");
|
||||
|
@ -103,7 +92,7 @@ bool LanPairingHandler::requestPairing()
|
|||
}
|
||||
|
||||
NetworkPackage np(PACKAGE_TYPE_PAIR);
|
||||
createPairPackage(np);
|
||||
np.set("pair", true);
|
||||
bool success;
|
||||
success = deviceLink()->sendPackage(np);
|
||||
if (success) {
|
||||
|
@ -118,7 +107,7 @@ bool LanPairingHandler::acceptPairing()
|
|||
qDebug() << "User accepts pairing";
|
||||
m_pairingTimeout.stop(); // Just in case it is started
|
||||
NetworkPackage np(PACKAGE_TYPE_PAIR);
|
||||
createPairPackage(np);
|
||||
np.set("pair", true);
|
||||
bool success = deviceLink()->sendPackage(np);
|
||||
if (success) {
|
||||
setInternalPairStatus(Paired);
|
||||
|
@ -131,7 +120,6 @@ void LanPairingHandler::rejectPairing()
|
|||
qDebug() << "User rejects pairing";
|
||||
NetworkPackage np(PACKAGE_TYPE_PAIR);
|
||||
np.set("pair", false);
|
||||
np.set("link", deviceLink()->name());
|
||||
deviceLink()->sendPackage(np);
|
||||
setInternalPairStatus(NotPaired);
|
||||
}
|
||||
|
@ -139,7 +127,6 @@ void LanPairingHandler::rejectPairing()
|
|||
void LanPairingHandler::unpair() {
|
||||
NetworkPackage np(PACKAGE_TYPE_PAIR);
|
||||
np.set("pair", false);
|
||||
np.set("link", deviceLink()->name());
|
||||
deviceLink()->sendPackage(np);
|
||||
setInternalPairStatus(NotPaired);
|
||||
}
|
||||
|
@ -148,7 +135,6 @@ void LanPairingHandler::pairingTimeout()
|
|||
{
|
||||
NetworkPackage np(PACKAGE_TYPE_PAIR);
|
||||
np.set("pair", false);
|
||||
np.set("name", deviceLink()->name());
|
||||
deviceLink()->sendPackage(np);
|
||||
setInternalPairStatus(NotPaired); //Will emit the change as well
|
||||
Q_EMIT pairingError(i18n("Timed out"));
|
||||
|
|
|
@ -41,7 +41,6 @@ public:
|
|||
LanPairingHandler(DeviceLink* deviceLink);
|
||||
virtual ~LanPairingHandler() { }
|
||||
|
||||
virtual void createPairPackage(NetworkPackage& np) Q_DECL_OVERRIDE;
|
||||
virtual void packageReceived(const NetworkPackage& np) Q_DECL_OVERRIDE;
|
||||
virtual bool requestPairing() Q_DECL_OVERRIDE;
|
||||
virtual bool acceptPairing() Q_DECL_OVERRIDE;
|
||||
|
|
|
@ -48,7 +48,6 @@ public:
|
|||
DeviceLink* deviceLink() const;
|
||||
void setDeviceLink(DeviceLink* dl);
|
||||
|
||||
virtual void createPairPackage(NetworkPackage& np) = 0;
|
||||
virtual void packageReceived(const NetworkPackage& np) = 0;
|
||||
virtual void unpair() = 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue