added postSetupDevice
This commit is contained in:
parent
e555754706
commit
b88994e3f4
@ -473,7 +473,7 @@ DeviceManager::DeviceError DeviceManager::addConfiguredDeviceInternal(const Devi
|
|||||||
|
|
||||||
m_configuredDevices.append(device);
|
m_configuredDevices.append(device);
|
||||||
storeConfiguredDevices();
|
storeConfiguredDevices();
|
||||||
|
postSetupDevice(device);
|
||||||
return DeviceErrorNoError;
|
return DeviceErrorNoError;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -864,6 +864,7 @@ void DeviceManager::slotPairingFinished(const PairingTransactionId &pairingTrans
|
|||||||
storeConfiguredDevices();
|
storeConfiguredDevices();
|
||||||
|
|
||||||
emit deviceSetupFinished(device, DeviceError::DeviceErrorNoError);
|
emit deviceSetupFinished(device, DeviceError::DeviceErrorNoError);
|
||||||
|
postSetupDevice(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceManager::autoDevicesAppeared(const DeviceClassId &deviceClassId, const QList<DeviceDescriptor> &deviceDescriptors)
|
void DeviceManager::autoDevicesAppeared(const DeviceClassId &deviceClassId, const QList<DeviceDescriptor> &deviceDescriptors)
|
||||||
@ -894,6 +895,7 @@ void DeviceManager::autoDevicesAppeared(const DeviceClassId &deviceClassId, cons
|
|||||||
case DeviceSetupStatusSuccess:
|
case DeviceSetupStatusSuccess:
|
||||||
qDebug() << "Device setup complete.";
|
qDebug() << "Device setup complete.";
|
||||||
emit deviceSetupFinished(device, DeviceError::DeviceErrorNoError);
|
emit deviceSetupFinished(device, DeviceError::DeviceErrorNoError);
|
||||||
|
postSetupDevice(device);
|
||||||
m_configuredDevices.append(device);
|
m_configuredDevices.append(device);
|
||||||
storeConfiguredDevices();
|
storeConfiguredDevices();
|
||||||
break;
|
break;
|
||||||
@ -1025,6 +1027,14 @@ DeviceManager::DeviceSetupStatus DeviceManager::setupDevice(Device *device)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeviceManager::postSetupDevice(Device *device)
|
||||||
|
{
|
||||||
|
DeviceClass deviceClass = findDeviceClass(device->deviceClassId());
|
||||||
|
DevicePlugin *plugin = m_devicePlugins.value(deviceClass.pluginId());
|
||||||
|
|
||||||
|
plugin->postSetupDevice(device);
|
||||||
|
}
|
||||||
|
|
||||||
DeviceManager::DeviceError DeviceManager::verifyParams(const QList<ParamType> paramTypes, ParamList ¶ms, bool requireAll)
|
DeviceManager::DeviceError DeviceManager::verifyParams(const QList<ParamType> paramTypes, ParamList ¶ms, bool requireAll)
|
||||||
{
|
{
|
||||||
foreach (const Param ¶m, params) {
|
foreach (const Param ¶m, params) {
|
||||||
|
|||||||
@ -137,6 +137,7 @@ private:
|
|||||||
bool verifyPluginMetadata(const QJsonObject &data);
|
bool verifyPluginMetadata(const QJsonObject &data);
|
||||||
DeviceError addConfiguredDeviceInternal(const DeviceClassId &deviceClassId, const ParamList ¶ms, const DeviceId id = DeviceId::createDeviceId());
|
DeviceError addConfiguredDeviceInternal(const DeviceClassId &deviceClassId, const ParamList ¶ms, const DeviceId id = DeviceId::createDeviceId());
|
||||||
DeviceSetupStatus setupDevice(Device *device);
|
DeviceSetupStatus setupDevice(Device *device);
|
||||||
|
void postSetupDevice(Device *device);
|
||||||
DeviceError verifyParams(const QList<ParamType> paramTypes, ParamList ¶ms, bool requireAll = true);
|
DeviceError verifyParams(const QList<ParamType> paramTypes, ParamList ¶ms, bool requireAll = true);
|
||||||
DeviceError verifyParam(const QList<ParamType> paramTypes, const Param ¶m);
|
DeviceError verifyParam(const QList<ParamType> paramTypes, const Param ¶m);
|
||||||
DeviceError verifyParam(const ParamType ¶mType, const Param ¶m);
|
DeviceError verifyParam(const ParamType ¶mType, const Param ¶m);
|
||||||
|
|||||||
@ -317,6 +317,12 @@ DeviceManager::DeviceSetupStatus DevicePlugin::setupDevice(Device *device)
|
|||||||
return DeviceManager::DeviceSetupStatusSuccess;
|
return DeviceManager::DeviceSetupStatusSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! This will be called when a new \a device was added successfully and the device setup is finished.*/
|
||||||
|
void DevicePlugin::postSetupDevice(Device *device)
|
||||||
|
{
|
||||||
|
Q_UNUSED(device)
|
||||||
|
}
|
||||||
|
|
||||||
/*! This will be called when a \a device removed. The plugin has the chance to do some teardown.
|
/*! This will be called when a \a device removed. The plugin has the chance to do some teardown.
|
||||||
* The device is still valid during this call, but already removed from the system.
|
* The device is still valid during this call, but already removed from the system.
|
||||||
* The device will be deleted as soon as this method returns.*/
|
* The device will be deleted as soon as this method returns.*/
|
||||||
|
|||||||
@ -54,6 +54,7 @@ public:
|
|||||||
virtual DeviceManager::DeviceError discoverDevices(const DeviceClassId &deviceClassId, const ParamList ¶ms);
|
virtual DeviceManager::DeviceError discoverDevices(const DeviceClassId &deviceClassId, const ParamList ¶ms);
|
||||||
|
|
||||||
virtual DeviceManager::DeviceSetupStatus setupDevice(Device *device);
|
virtual DeviceManager::DeviceSetupStatus setupDevice(Device *device);
|
||||||
|
virtual void postSetupDevice(Device *device);
|
||||||
virtual void deviceRemoved(Device *device);
|
virtual void deviceRemoved(Device *device);
|
||||||
|
|
||||||
virtual DeviceManager::DeviceSetupStatus confirmPairing(const PairingTransactionId &pairingTransactionId, const DeviceClassId &deviceClassId, const ParamList ¶ms);
|
virtual DeviceManager::DeviceSetupStatus confirmPairing(const PairingTransactionId &pairingTransactionId, const DeviceClassId &deviceClassId, const ParamList ¶ms);
|
||||||
|
|||||||
Reference in New Issue
Block a user