#700 FIxes issue where ConfigWrite.UpdateDeviceConfig and UpdateRoomConfig do not write config to file

This commit is contained in:
Jason Alborough
2021-05-11 20:28:15 -04:00
parent da179c01f5
commit 5fc4ff6027
3 changed files with 10 additions and 16 deletions

View File

@@ -54,11 +54,11 @@ namespace PepperDash.Essentials.Core.Config
{
bool success = false;
var deviceConfig = ConfigReader.ConfigObject.Devices.FindIndex(d => d.Key.Equals(config.Key));
var deviceConfigIndex = ConfigReader.ConfigObject.Devices.FindIndex(d => d.Key.Equals(config.Key));
if (deviceConfig >= 0)
if (deviceConfigIndex >= 0)
{
ConfigReader.ConfigObject.Devices[deviceConfig] = config;
ConfigReader.ConfigObject.Devices[deviceConfigIndex] = config;
Debug.Console(1, "Updated config of device: '{0}'", config.Key);
@@ -74,13 +74,13 @@ namespace PepperDash.Essentials.Core.Config
{
bool success = false;
var deviceConfig = ConfigReader.ConfigObject.Rooms.FirstOrDefault(d => d.Key.Equals(config.Key));
var roomConfigIndex = ConfigReader.ConfigObject.Rooms.FindIndex(d => d.Key.Equals(config.Key));
if (deviceConfig != null)
if (roomConfigIndex >= 0)
{
deviceConfig = config;
ConfigReader.ConfigObject.Rooms[roomConfigIndex] = config;
Debug.Console(1, "Updated config of device: '{0}'", config.Key);
Debug.Console(1, "Updated room of device: '{0}'", config.Key);
success = true;
}

View File

@@ -54,11 +54,7 @@ namespace PepperDash.Essentials.Core.Devices
Name = config.Name;
}
protected virtual void WriteControlProperty(JToken controlObject)
{
Config.Properties["control"] = JToken.FromObject(controlObject);
CustomSetConfig(Config);
}
/// <summary>
/// Used by the extending class to allow for any custom actions to be taken (tell the ConfigWriter to write config, etc)

View File

@@ -81,11 +81,9 @@ namespace PepperDash.Essentials.Devices.Common.Cameras
}
protected CameraBase(string key, string name) :
base (new DeviceConfig{Name = name, Key = key})
this (new DeviceConfig{Name = name, Key = key})
{
OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
ControlMode = eCameraControlMode.Manual;
}
protected void LinkCameraToApi(CameraBase cameraDevice, BasicTriList trilist, uint joinStart, string joinMapKey,