mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 12:44:58 +00:00
Merge branch 'development' into feature/add-zoomroom-participant-actions
This commit is contained in:
27
.github/ISSUE_TEMPLATE/rfi_request.md
vendored
Normal file
27
.github/ISSUE_TEMPLATE/rfi_request.md
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
---
|
||||||
|
name: Request for Information
|
||||||
|
about: Request specific information about capabilities of the framework
|
||||||
|
title: "[RFI]-"
|
||||||
|
labels: RFI
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**What is your request?**
|
||||||
|
Please provide as much detail as possible.
|
||||||
|
|
||||||
|
|
||||||
|
**What is the intended use case**
|
||||||
|
- [ ] Essentials Standalone Application
|
||||||
|
- [ ] Essentials + SIMPL Windows Hybrid
|
||||||
|
|
||||||
|
**User Interface Requirements**
|
||||||
|
- [ ] Not Applicable (logic only)
|
||||||
|
- [ ] Crestron Smart Graphics Touchpanel
|
||||||
|
- [ ] Cisco Touch10
|
||||||
|
- [ ] Mobile Control
|
||||||
|
- [ ] Crestron CH5 Touchpanel interface
|
||||||
|
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the request here.
|
||||||
@@ -1,162 +1,162 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharp.CrestronIO;
|
using Crestron.SimplSharp.CrestronIO;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Config
|
namespace PepperDash.Essentials.Core.Config
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Responsible for updating config at runtime, and writing the updates out to a local file
|
/// Responsible for updating config at runtime, and writing the updates out to a local file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ConfigWriter
|
public class ConfigWriter
|
||||||
{
|
{
|
||||||
public const string LocalConfigFolder = "LocalConfig";
|
public const string LocalConfigFolder = "LocalConfig";
|
||||||
|
|
||||||
public const long WriteTimeout = 30000;
|
public const long WriteTimeout = 30000;
|
||||||
|
|
||||||
public static CTimer WriteTimer;
|
public static CTimer WriteTimer;
|
||||||
static CCriticalSection fileLock = new CCriticalSection();
|
static CCriticalSection fileLock = new CCriticalSection();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates the config properties of a device
|
/// Updates the config properties of a device
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deviceKey"></param>
|
/// <param name="deviceKey"></param>
|
||||||
/// <param name="properties"></param>
|
/// <param name="properties"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static bool UpdateDeviceProperties(string deviceKey, JToken properties)
|
public static bool UpdateDeviceProperties(string deviceKey, JToken properties)
|
||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
// Get the current device config
|
// Get the current device config
|
||||||
var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(d => d.Key.Equals(deviceKey));
|
var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(d => d.Key.Equals(deviceKey));
|
||||||
|
|
||||||
if (deviceConfig != null)
|
if (deviceConfig != null)
|
||||||
{
|
{
|
||||||
// Replace the current properties JToken with the new one passed into this method
|
// Replace the current properties JToken with the new one passed into this method
|
||||||
deviceConfig.Properties = properties;
|
deviceConfig.Properties = properties;
|
||||||
|
|
||||||
Debug.Console(1, "Updated properties of device: '{0}'", deviceKey);
|
Debug.Console(1, "Updated properties of device: '{0}'", deviceKey);
|
||||||
|
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResetTimer();
|
ResetTimer();
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool UpdateDeviceConfig(DeviceConfig config)
|
public static bool UpdateDeviceConfig(DeviceConfig config)
|
||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(d => d.Key.Equals(config.Key));
|
var deviceConfigIndex = ConfigReader.ConfigObject.Devices.FindIndex(d => d.Key.Equals(config.Key));
|
||||||
|
|
||||||
if (deviceConfig != null)
|
if (deviceConfigIndex >= 0)
|
||||||
{
|
{
|
||||||
deviceConfig = config;
|
ConfigReader.ConfigObject.Devices[deviceConfigIndex] = config;
|
||||||
|
|
||||||
Debug.Console(1, "Updated config of device: '{0}'", config.Key);
|
Debug.Console(1, "Updated config of device: '{0}'", config.Key);
|
||||||
|
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResetTimer();
|
ResetTimer();
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool UpdateRoomConfig(DeviceConfig config)
|
public static bool UpdateRoomConfig(DeviceConfig config)
|
||||||
{
|
{
|
||||||
bool success = false;
|
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;
|
success = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResetTimer();
|
ResetTimer();
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resets (or starts) the write timer
|
/// Resets (or starts) the write timer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static void ResetTimer()
|
static void ResetTimer()
|
||||||
{
|
{
|
||||||
if (WriteTimer == null)
|
if (WriteTimer == null)
|
||||||
WriteTimer = new CTimer(WriteConfigFile, WriteTimeout);
|
WriteTimer = new CTimer(WriteConfigFile, WriteTimeout);
|
||||||
|
|
||||||
WriteTimer.Reset(WriteTimeout);
|
WriteTimer.Reset(WriteTimeout);
|
||||||
|
|
||||||
Debug.Console(1, "Config File write timer has been reset.");
|
Debug.Console(1, "Config File write timer has been reset.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes the current config to a file in the LocalConfig subfolder
|
/// Writes the current config to a file in the LocalConfig subfolder
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private static void WriteConfigFile(object o)
|
private static void WriteConfigFile(object o)
|
||||||
{
|
{
|
||||||
var filePath = Global.FilePathPrefix + LocalConfigFolder + Global.DirectorySeparator + "configurationFile.json";
|
var filePath = Global.FilePathPrefix + LocalConfigFolder + Global.DirectorySeparator + "configurationFile.json";
|
||||||
|
|
||||||
var configData = JsonConvert.SerializeObject(ConfigReader.ConfigObject);
|
var configData = JsonConvert.SerializeObject(ConfigReader.ConfigObject);
|
||||||
|
|
||||||
WriteFile(filePath, configData);
|
WriteFile(filePath, configData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes
|
/// Writes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filepath"></param>
|
/// <param name="filepath"></param>
|
||||||
/// <param name="o"></param>
|
/// <param name="o"></param>
|
||||||
public static void WriteFile(string filePath, string configData)
|
public static void WriteFile(string filePath, string configData)
|
||||||
{
|
{
|
||||||
if (WriteTimer != null)
|
if (WriteTimer != null)
|
||||||
WriteTimer.Stop();
|
WriteTimer.Stop();
|
||||||
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Writing Configuration to file");
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Writing Configuration to file");
|
||||||
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to write config file: '{0}'", filePath);
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to write config file: '{0}'", filePath);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (fileLock.TryEnter())
|
if (fileLock.TryEnter())
|
||||||
{
|
{
|
||||||
using (StreamWriter sw = new StreamWriter(filePath))
|
using (StreamWriter sw = new StreamWriter(filePath))
|
||||||
{
|
{
|
||||||
sw.Write(configData);
|
sw.Write(configData);
|
||||||
sw.Flush();
|
sw.Flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to enter FileLock");
|
Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to enter FileLock");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: Config write failed: \r{0}", e);
|
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: Config write failed: \r{0}", e);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (fileLock != null && !fileLock.Disposed)
|
if (fileLock != null && !fileLock.Disposed)
|
||||||
fileLock.Leave();
|
fileLock.Leave();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,8 @@ using Crestron.SimplSharpPro.DeviceSupport;
|
|||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core.Bridges;
|
using PepperDash.Essentials.Core.Bridges;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Devices
|
namespace PepperDash.Essentials.Core.Devices
|
||||||
{
|
{
|
||||||
@@ -52,6 +54,8 @@ namespace PepperDash.Essentials.Core.Devices
|
|||||||
Name = config.Name;
|
Name = config.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used by the extending class to allow for any custom actions to be taken (tell the ConfigWriter to write config, etc)
|
/// Used by the extending class to allow for any custom actions to be taken (tell the ConfigWriter to write config, etc)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ using Crestron.SimplSharp.Reflection;
|
|||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.Devices;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
using PepperDash.Essentials.Core.Bridges;
|
using PepperDash.Essentials.Core.Bridges;
|
||||||
using PepperDash.Essentials.Core.Presets;
|
using PepperDash.Essentials.Core.Presets;
|
||||||
using PepperDash.Essentials.Devices.Common.Codec;
|
using PepperDash.Essentials.Devices.Common.Codec;
|
||||||
@@ -25,7 +27,7 @@ namespace PepperDash.Essentials.Devices.Common.Cameras
|
|||||||
Focus = 8
|
Focus = 8
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class CameraBase : EssentialsDevice, IRoutingOutputs
|
public abstract class CameraBase : ReconfigurableDevice, IRoutingOutputs
|
||||||
{
|
{
|
||||||
public eCameraControlMode ControlMode { get; protected set; }
|
public eCameraControlMode ControlMode { get; protected set; }
|
||||||
|
|
||||||
@@ -70,12 +72,18 @@ namespace PepperDash.Essentials.Devices.Common.Cameras
|
|||||||
// A bitmasked value to indicate the movement capabilites of this camera
|
// A bitmasked value to indicate the movement capabilites of this camera
|
||||||
protected eCameraCapabilities Capabilities { get; set; }
|
protected eCameraCapabilities Capabilities { get; set; }
|
||||||
|
|
||||||
protected CameraBase(string key, string name) :
|
protected CameraBase(DeviceConfig config) : base(config)
|
||||||
base(key, name)
|
{
|
||||||
{
|
OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
|
||||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
|
|
||||||
|
|
||||||
ControlMode = eCameraControlMode.Manual;
|
ControlMode = eCameraControlMode.Manual;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected CameraBase(string key, string name) :
|
||||||
|
this (new DeviceConfig{Name = name, Key = key})
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void LinkCameraToApi(CameraBase cameraDevice, BasicTriList trilist, uint joinStart, string joinMapKey,
|
protected void LinkCameraToApi(CameraBase cameraDevice, BasicTriList trilist, uint joinStart, string joinMapKey,
|
||||||
|
|||||||
Reference in New Issue
Block a user