fix(plugins): Avoid double device control releases

This was not really broken, but it generated a debug log message
containing the keyword 'error' consistently, which is convoluting any
debugging session.

This commit also adds some trace log message on plugin device control
API calls.
This commit is contained in:
Dennis Klein
2021-07-05 20:43:45 +02:00
committed by Dennis Klein
parent b374c235f0
commit e2452fa7e4
2 changed files with 11 additions and 1 deletions

View File

@@ -79,7 +79,12 @@ class Plugin
auto GetCurrentDeviceState() const -> DeviceState { return fPluginServices->GetCurrentDeviceState(); }
auto TakeDeviceControl() -> void { fPluginServices->TakeDeviceControl(fkName); };
auto StealDeviceControl() -> void { fPluginServices->StealDeviceControl(fkName); };
auto ReleaseDeviceControl() -> void { fPluginServices->ReleaseDeviceControl(fkName); };
auto ReleaseDeviceControl() -> void
{
if (fPluginServices->GetDeviceController() == fkName) {
fPluginServices->ReleaseDeviceControl(fkName);
}
};
auto ChangeDeviceState(const DeviceStateTransition next) -> bool { return fPluginServices->ChangeDeviceState(fkName, next); }
auto SubscribeToDeviceStateChange(std::function<void(DeviceState)> callback) -> void { fPluginServices->SubscribeToDeviceStateChange(fkName, callback); }
auto UnsubscribeFromDeviceStateChange() -> void { fPluginServices->UnsubscribeFromDeviceStateChange(fkName); }