Merge pull request #1331 from PepperDash/dev-list-fix

This commit is contained in:
Neil Dorin
2025-09-17 08:36:04 -06:00
committed by GitHub
7 changed files with 396 additions and 390 deletions

View File

@@ -2,14 +2,12 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Crestron.SimplSharp;
using System.Reflection; using System.Reflection;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro; using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.EthernetCommunication; using Crestron.SimplSharpPro.EthernetCommunication;
using Newtonsoft.Json; using Newtonsoft.Json;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Config;
using Serilog.Events; using Serilog.Events;
@@ -355,22 +353,22 @@ namespace PepperDash.Essentials.Core.Bridges
/// </summary> /// </summary>
public class EiscApiPropertiesConfig public class EiscApiPropertiesConfig
{ {
[JsonProperty("control")]
/// <summary> /// <summary>
/// Gets or sets the Control /// Gets or sets the Control
/// </summary> /// </summary>
[JsonProperty("control")]
public EssentialsControlPropertiesConfig Control { get; set; } public EssentialsControlPropertiesConfig Control { get; set; }
[JsonProperty("devices")]
/// <summary> /// <summary>
/// Gets or sets the Devices /// Gets or sets the Devices
/// </summary> /// </summary>
[JsonProperty("devices")]
public List<ApiDevicePropertiesConfig> Devices { get; set; } public List<ApiDevicePropertiesConfig> Devices { get; set; }
[JsonProperty("rooms")]
/// <summary> /// <summary>
/// Gets or sets the Rooms /// Gets or sets the Rooms
/// </summary> /// </summary>
[JsonProperty("rooms")]
public List<ApiRoomPropertiesConfig> Rooms { get; set; } public List<ApiRoomPropertiesConfig> Rooms { get; set; }
@@ -379,22 +377,22 @@ namespace PepperDash.Essentials.Core.Bridges
/// </summary> /// </summary>
public class ApiDevicePropertiesConfig public class ApiDevicePropertiesConfig
{ {
[JsonProperty("deviceKey")]
/// <summary> /// <summary>
/// Gets or sets the DeviceKey /// Gets or sets the DeviceKey
/// </summary> /// </summary>
[JsonProperty("deviceKey")]
public string DeviceKey { get; set; } public string DeviceKey { get; set; }
[JsonProperty("joinStart")]
/// <summary> /// <summary>
/// Gets or sets the JoinStart /// Gets or sets the JoinStart
/// </summary> /// </summary>
[JsonProperty("joinStart")]
public uint JoinStart { get; set; } public uint JoinStart { get; set; }
[JsonProperty("joinMapKey")]
/// <summary> /// <summary>
/// Gets or sets the JoinMapKey /// Gets or sets the JoinMapKey
/// </summary> /// </summary>
[JsonProperty("joinMapKey")]
public string JoinMapKey { get; set; } public string JoinMapKey { get; set; }
} }
@@ -403,22 +401,22 @@ namespace PepperDash.Essentials.Core.Bridges
/// </summary> /// </summary>
public class ApiRoomPropertiesConfig public class ApiRoomPropertiesConfig
{ {
[JsonProperty("roomKey")]
/// <summary> /// <summary>
/// Gets or sets the RoomKey /// Gets or sets the RoomKey
/// </summary> /// </summary>
[JsonProperty("roomKey")]
public string RoomKey { get; set; } public string RoomKey { get; set; }
[JsonProperty("joinStart")]
/// <summary> /// <summary>
/// Gets or sets the JoinStart /// Gets or sets the JoinStart
/// </summary> /// </summary>
[JsonProperty("joinStart")]
public uint JoinStart { get; set; } public uint JoinStart { get; set; }
[JsonProperty("joinMapKey")]
/// <summary> /// <summary>
/// Gets or sets the JoinMapKey /// Gets or sets the JoinMapKey
/// </summary> /// </summary>
[JsonProperty("joinMapKey")]
public string JoinMapKey { get; set; } public string JoinMapKey { get; set; }
} }

View File

@@ -18,41 +18,41 @@ namespace PepperDash.Essentials.Core.Config
/// </summary> /// </summary>
public class DeviceConfig public class DeviceConfig
{ {
[JsonProperty("key")]
/// <summary> /// <summary>
/// Gets or sets the Key /// Gets or sets the Key
/// </summary> /// </summary>
[JsonProperty("key")]
public string Key { get; set; } public string Key { get; set; }
[JsonProperty("uid")]
/// <summary> /// <summary>
/// Gets or sets the Uid /// Gets or sets the Uid
/// </summary> /// </summary>
[JsonProperty("uid")]
public int Uid { get; set; } public int Uid { get; set; }
[JsonProperty("name")]
/// <summary> /// <summary>
/// Gets or sets the Name /// Gets or sets the Name
/// </summary> /// </summary>
[JsonProperty("name")]
public string Name { get; set; } public string Name { get; set; }
[JsonProperty("group")]
/// <summary> /// <summary>
/// Gets or sets the Group /// Gets or sets the Group
/// </summary> /// </summary>
[JsonProperty("group")]
public string Group { get; set; } public string Group { get; set; }
[JsonProperty("type")]
/// <summary> /// <summary>
/// Gets or sets the Type /// Gets or sets the Type
/// </summary> /// </summary>
[JsonProperty("type")]
public string Type { get; set; } public string Type { get; set; }
[JsonProperty("properties")]
[JsonConverter(typeof(DevicePropertiesConverter))]
/// <summary> /// <summary>
/// Gets or sets the Properties /// Gets or sets the Properties
/// </summary> /// </summary>
[JsonProperty("properties")]
[JsonConverter(typeof(DevicePropertiesConverter))]
public JToken Properties { get; set; } public JToken Properties { get; set; }
public DeviceConfig(DeviceConfig dc) public DeviceConfig(DeviceConfig dc)
@@ -68,7 +68,7 @@ namespace PepperDash.Essentials.Core.Config
//Properties = JToken.FromObject(dc.Properties); //Properties = JToken.FromObject(dc.Properties);
} }
public DeviceConfig() {} public DeviceConfig() { }
} }
/// <summary> /// <summary>

View File

@@ -202,7 +202,7 @@ namespace PepperDash.Essentials.Core
private static void ListDevices(string s) private static void ListDevices(string s)
{ {
CrestronConsole.ConsoleCommandResponse($"{Devices.Count} Devices registered with Device Manager:"); CrestronConsole.ConsoleCommandResponse($"{Devices.Count} Devices registered with Device Manager:\r\n");
var sorted = Devices.Values.ToList(); var sorted = Devices.Values.ToList();
sorted.Sort((a, b) => a.Key.CompareTo(b.Key)); sorted.Sort((a, b) => a.Key.CompareTo(b.Key));
@@ -210,7 +210,7 @@ namespace PepperDash.Essentials.Core
foreach (var d in sorted) foreach (var d in sorted)
{ {
var name = d is IKeyName ? (d as IKeyName).Name : "---"; var name = d is IKeyName ? (d as IKeyName).Name : "---";
CrestronConsole.ConsoleCommandResponse($" [{d.Key}] {name}"); CrestronConsole.ConsoleCommandResponse($" [{d.Key}] {name}\r\n");
} }
} }
@@ -219,28 +219,17 @@ namespace PepperDash.Essentials.Core
var dev = GetDeviceForKey(devKey); var dev = GetDeviceForKey(devKey);
if (dev == null) if (dev == null)
{ {
Debug.LogMessage(LogEventLevel.Information, "Device '{0}' not found", devKey); CrestronConsole.ConsoleCommandResponse($"Device '{devKey}' not found\r\n");
return; return;
} }
if (!(dev is IHasFeedback statusDev)) if (!(dev is IHasFeedback statusDev))
{ {
Debug.LogMessage(LogEventLevel.Information, "Device '{0}' does not have visible feedbacks", devKey); CrestronConsole.ConsoleCommandResponse($"Device '{devKey}' does not have visible feedbacks\r\n");
return; return;
} }
statusDev.DumpFeedbacksToConsole(true); statusDev.DumpFeedbacksToConsole(true);
} }
//static void ListDeviceCommands(string devKey)
//{
// var dev = GetDeviceForKey(devKey);
// if (dev == null)
// {
// Debug.LogMessage(LogEventLevel.Information, "Device '{0}' not found", devKey);
// return;
// }
// Debug.LogMessage(LogEventLevel.Information, "This needs to be reworked. Stay tuned.", devKey);
//}
private static void ListDeviceCommStatuses(string input) private static void ListDeviceCommStatuses(string input)
{ {
@@ -250,12 +239,6 @@ namespace PepperDash.Essentials.Core
} }
} }
//static void DoDeviceCommand(string command)
//{
// Debug.LogMessage(LogEventLevel.Information, "Not yet implemented. Stay tuned");
//}
/// <summary> /// <summary>
/// AddDevice method /// AddDevice method
/// </summary> /// </summary>

View File

@@ -1,14 +1,14 @@
using System; using System;
using System.Linq; using System.Linq;
using Crestron.SimplSharp;
using PepperDash.Core; using PepperDash.Core;
using Serilog.Events; using Serilog.Events;
namespace PepperDash.Essentials.Core namespace PepperDash.Essentials.Core
{ {
/// <summary> /// <summary>
/// Defines the contract for IHasFeedback /// Defines the contract for IHasFeedback
/// </summary> /// </summary>
public interface IHasFeedback : IKeyed public interface IHasFeedback : IKeyed
{ {
/// <summary> /// <summary>
@@ -19,47 +19,72 @@ namespace PepperDash.Essentials.Core
} }
/// <summary>
/// Extension methods for IHasFeedback
/// </summary>
public static class IHasFeedbackExtensions public static class IHasFeedbackExtensions
{ {
/// <summary>
/// Gets the feedback type name for sorting purposes
/// </summary>
/// <param name="feedback">The feedback to get the type name for</param>
/// <returns>A string representing the feedback type</returns>
private static string GetFeedbackTypeName(Feedback feedback)
{
if (feedback is BoolFeedback)
return "boolean";
else if (feedback is IntFeedback)
return "integer";
else if (feedback is StringFeedback)
return "string";
else
return feedback.GetType().Name;
}
/// <summary>
/// Dumps the feedbacks to the console
/// </summary>
/// <param name="source"></param>
/// <param name="getCurrentStates"></param>
public static void DumpFeedbacksToConsole(this IHasFeedback source, bool getCurrentStates) public static void DumpFeedbacksToConsole(this IHasFeedback source, bool getCurrentStates)
{ {
Type t = source.GetType();
// get the properties and set them into a new collection of NameType wrappers
var props = t.GetProperties().Select(p => new PropertyNameType(p, t));
var feedbacks = source.Feedbacks; var feedbacks = source.Feedbacks;
if (feedbacks != null)
if (feedbacks == null || feedbacks.Count == 0)
{ {
Debug.LogMessage(LogEventLevel.Information, source, "\n\nAvailable feedbacks:"); CrestronConsole.ConsoleCommandResponse("No available feedbacks\r\n");
foreach (var f in feedbacks) return;
{ }
string val = "";
string type = ""; CrestronConsole.ConsoleCommandResponse("Available feedbacks:\r\n");
if (getCurrentStates)
{ // Sort feedbacks by type first, then by key
if (f is BoolFeedback) var sortedFeedbacks = feedbacks.OrderBy(f => GetFeedbackTypeName(f)).ThenBy(f => string.IsNullOrEmpty(f.Key) ? "" : f.Key);
{
val = f.BoolValue.ToString(); foreach (var feedback in sortedFeedbacks)
type = "boolean"; {
} string value = "";
else if (f is IntFeedback) string type = "";
{ if (getCurrentStates)
val = f.IntValue.ToString(); {
type = "integer"; if (feedback is BoolFeedback)
} {
else if (f is StringFeedback) value = feedback.BoolValue.ToString();
{ type = "boolean";
val = f.StringValue; }
type = "string"; else if (feedback is IntFeedback)
} {
} value = feedback.IntValue.ToString();
Debug.LogMessage(LogEventLevel.Information, "{0,-12} {1, -25} {2}", type, type = "integer";
(string.IsNullOrEmpty(f.Key) ? "-no key-" : f.Key), val); }
} else if (feedback is StringFeedback)
{
value = feedback.StringValue;
type = "string";
}
}
CrestronConsole.ConsoleCommandResponse($" {type,-12} {(string.IsNullOrEmpty(feedback.Key) ? "-no key-" : feedback.Key),-25} {value}\r\n");
} }
else
Debug.LogMessage(LogEventLevel.Information, source, "No available outputs:");
} }
} }
} }

View File

@@ -9,11 +9,11 @@ using Serilog.Events;
namespace PepperDash.Essentials.Room.Config namespace PepperDash.Essentials.Room.Config
{ {
/// <summary> /// <summary>
/// Represents a EssentialsRoomConfigHelper /// Represents a EssentialsRoomConfigHelper
/// </summary> /// </summary>
public class EssentialsRoomConfigHelper public class EssentialsRoomConfigHelper
{ {
/// <summary> /// <summary>
/// GetEmergency method /// GetEmergency method
/// </summary> /// </summary>
@@ -31,100 +31,100 @@ namespace PepperDash.Essentials.Room.Config
return null; return null;
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="props"></param> /// <param name="props"></param>
/// <param name="room"></param> /// <param name="room"></param>
/// <returns></returns> /// <returns></returns>
/// <summary> /// <summary>
/// GetMicrophonePrivacy method /// GetMicrophonePrivacy method
/// </summary> /// </summary>
public static MicrophonePrivacyController GetMicrophonePrivacy( public static MicrophonePrivacyController GetMicrophonePrivacy(
EssentialsRoomPropertiesConfig props, IPrivacy room) EssentialsRoomPropertiesConfig props, IPrivacy room)
{ {
var microphonePrivacy = props.MicrophonePrivacy; var microphonePrivacy = props.MicrophonePrivacy;
if (microphonePrivacy == null) if (microphonePrivacy == null)
{ {
Debug.LogMessage(LogEventLevel.Information, "Cannot create microphone privacy with null properties"); Debug.LogMessage(LogEventLevel.Information, "Cannot create microphone privacy with null properties");
return null; return null;
} }
// Get the MicrophonePrivacy device from the device manager // Get the MicrophonePrivacy device from the device manager
var mP = (DeviceManager.GetDeviceForKey(props.MicrophonePrivacy.DeviceKey) as MicrophonePrivacyController); var mP = (DeviceManager.GetDeviceForKey(props.MicrophonePrivacy.DeviceKey) as MicrophonePrivacyController);
// Set this room as the IPrivacy device // Set this room as the IPrivacy device
if (mP == null) if (mP == null)
{ {
Debug.LogMessage(LogEventLevel.Information, "ERROR: Selected device {0} is not MicrophonePrivacyController", props.MicrophonePrivacy.DeviceKey); Debug.LogMessage(LogEventLevel.Information, "ERROR: Selected device {0} is not MicrophonePrivacyController", props.MicrophonePrivacy.DeviceKey);
return null; return null;
} }
mP.SetPrivacyDevice(room); mP.SetPrivacyDevice(room);
var behaviour = props.MicrophonePrivacy.Behaviour.ToLower(); var behaviour = props.MicrophonePrivacy.Behaviour.ToLower();
if (behaviour == null) if (behaviour == null)
{ {
Debug.LogMessage(LogEventLevel.Information, "WARNING: No behaviour defined for MicrophonePrivacyController"); Debug.LogMessage(LogEventLevel.Information, "WARNING: No behaviour defined for MicrophonePrivacyController");
return null; return null;
} }
if (behaviour == "trackroomstate") if (behaviour == "trackroomstate")
{ {
// Tie LED enable to room power state // Tie LED enable to room power state
var essRoom = room as IEssentialsRoom; var essRoom = room as IEssentialsRoom;
essRoom.OnFeedback.OutputChange += (o, a) => essRoom.OnFeedback.OutputChange += (o, a) =>
{ {
if (essRoom.OnFeedback.BoolValue) if (essRoom.OnFeedback.BoolValue)
mP.EnableLeds = true; mP.EnableLeds = true;
else else
mP.EnableLeds = false; mP.EnableLeds = false;
}; };
mP.EnableLeds = essRoom.OnFeedback.BoolValue; mP.EnableLeds = essRoom.OnFeedback.BoolValue;
} }
else if (behaviour == "trackcallstate") else if (behaviour == "trackcallstate")
{ {
// Tie LED enable to room power state // Tie LED enable to room power state
var inCallRoom = room as IHasInCallFeedback; var inCallRoom = room as IHasInCallFeedback;
inCallRoom.InCallFeedback.OutputChange += (o, a) => inCallRoom.InCallFeedback.OutputChange += (o, a) =>
{ {
if (inCallRoom.InCallFeedback.BoolValue) if (inCallRoom.InCallFeedback.BoolValue)
mP.EnableLeds = true; mP.EnableLeds = true;
else else
mP.EnableLeds = false; mP.EnableLeds = false;
}; };
mP.EnableLeds = inCallRoom.InCallFeedback.BoolValue; mP.EnableLeds = inCallRoom.InCallFeedback.BoolValue;
} }
return mP; return mP;
} }
} }
/// <summary> /// <summary>
/// Represents a EssentialsRoomPropertiesConfig /// Represents a EssentialsRoomPropertiesConfig
/// </summary> /// </summary>
public class EssentialsRoomPropertiesConfig public class EssentialsRoomPropertiesConfig
{ {
[JsonProperty("addresses")] [JsonProperty("addresses")]
public EssentialsRoomAddressPropertiesConfig Addresses { get; set; } public EssentialsRoomAddressPropertiesConfig Addresses { get; set; }
[JsonProperty("description")] [JsonProperty("description")]
public string Description { get; set; } public string Description { get; set; }
[JsonProperty("emergency")] [JsonProperty("emergency")]
public EssentialsRoomEmergencyConfig Emergency { get; set; } public EssentialsRoomEmergencyConfig Emergency { get; set; }
[JsonProperty("help")] /// <summary>
/// <summary> /// Gets or sets the Help
/// Gets or sets the Help /// </summary>
/// </summary> [JsonProperty("help")]
public EssentialsHelpPropertiesConfig Help { get; set; } public EssentialsHelpPropertiesConfig Help { get; set; }
[JsonProperty("helpMessage")] /// <summary>
/// <summary> /// Gets or sets the HelpMessage
/// Gets or sets the HelpMessage /// </summary>
/// </summary> [JsonProperty("helpMessage")]
public string HelpMessage { get; set; } public string HelpMessage { get; set; }
/// <summary> /// <summary>
/// Read this value to get the help message. It checks for the old and new config format. /// Read this value to get the help message. It checks for the old and new config format.
@@ -133,7 +133,7 @@ namespace PepperDash.Essentials.Room.Config
{ {
get get
{ {
if(Help != null && !string.IsNullOrEmpty(Help.Message)) if (Help != null && !string.IsNullOrEmpty(Help.Message))
{ {
return Help.Message; return Help.Message;
} }
@@ -144,83 +144,83 @@ namespace PepperDash.Essentials.Room.Config
} }
} }
[JsonProperty("environment")] /// <summary>
/// <summary> /// Gets or sets the Environment
/// Gets or sets the Environment /// </summary>
/// </summary> [JsonProperty("environment")]
public EssentialsEnvironmentPropertiesConfig Environment { get; set; } public EssentialsEnvironmentPropertiesConfig Environment { get; set; }
[JsonProperty("logo")] /// <summary>
/// <summary> /// Gets or sets the LogoLight
/// Gets or sets the LogoLight /// </summary>
/// </summary> [JsonProperty("logo")]
public EssentialsLogoPropertiesConfig LogoLight { get; set; } public EssentialsLogoPropertiesConfig LogoLight { get; set; }
[JsonProperty("logoDark")]
/// <summary> /// <summary>
/// Gets or sets the LogoDark /// Gets or sets the LogoDark
/// </summary> /// </summary>
[JsonProperty("logoDark")]
public EssentialsLogoPropertiesConfig LogoDark { get; set; } public EssentialsLogoPropertiesConfig LogoDark { get; set; }
[JsonProperty("microphonePrivacy")] /// <summary>
/// <summary> /// Gets or sets the MicrophonePrivacy
/// Gets or sets the MicrophonePrivacy /// </summary>
/// </summary> [JsonProperty("microphonePrivacy")]
public EssentialsRoomMicrophonePrivacyConfig MicrophonePrivacy { get; set; } public EssentialsRoomMicrophonePrivacyConfig MicrophonePrivacy { get; set; }
[JsonProperty("occupancy")] /// <summary>
/// <summary> /// Gets or sets the Occupancy
/// Gets or sets the Occupancy /// </summary>
/// </summary> [JsonProperty("occupancy")]
public EssentialsRoomOccSensorConfig Occupancy { get; set; } public EssentialsRoomOccSensorConfig Occupancy { get; set; }
[JsonProperty("oneButtonMeeting")] /// <summary>
/// <summary> /// Gets or sets the OneButtonMeeting
/// Gets or sets the OneButtonMeeting /// </summary>
/// </summary> [JsonProperty("oneButtonMeeting")]
public EssentialsOneButtonMeetingPropertiesConfig OneButtonMeeting { get; set; } public EssentialsOneButtonMeetingPropertiesConfig OneButtonMeeting { get; set; }
[JsonProperty("shutdownVacancySeconds")] /// <summary>
/// <summary> /// Gets or sets the ShutdownVacancySeconds
/// Gets or sets the ShutdownVacancySeconds /// </summary>
/// </summary> [JsonProperty("shutdownVacancySeconds")]
public int ShutdownVacancySeconds { get; set; } public int ShutdownVacancySeconds { get; set; }
[JsonProperty("shutdownPromptSeconds")] /// <summary>
/// <summary> /// Gets or sets the ShutdownPromptSeconds
/// Gets or sets the ShutdownPromptSeconds /// </summary>
/// </summary> [JsonProperty("shutdownPromptSeconds")]
public int ShutdownPromptSeconds { get; set; } public int ShutdownPromptSeconds { get; set; }
[JsonProperty("tech")] /// <summary>
/// <summary> /// Gets or sets the Tech
/// Gets or sets the Tech /// </summary>
/// </summary> [JsonProperty("tech")]
public EssentialsRoomTechConfig Tech { get; set; } public EssentialsRoomTechConfig Tech { get; set; }
[JsonProperty("volumes")] /// <summary>
/// <summary> /// Gets or sets the Volumes
/// Gets or sets the Volumes /// </summary>
/// </summary> [JsonProperty("volumes")]
public EssentialsRoomVolumesConfig Volumes { get; set; } public EssentialsRoomVolumesConfig Volumes { get; set; }
[JsonProperty("fusion")]
/// <summary> /// <summary>
/// Gets or sets the Fusion /// Gets or sets the Fusion
/// </summary> /// </summary>
[JsonProperty("fusion")]
public EssentialsRoomFusionConfig Fusion { get; set; } public EssentialsRoomFusionConfig Fusion { get; set; }
[JsonProperty("essentialsRoomUiBehaviorConfig", NullValueHandling=NullValueHandling.Ignore)]
/// <summary> /// <summary>
/// Gets or sets the UiBehavior /// Gets or sets the UiBehavior
/// </summary> /// </summary>
[JsonProperty("essentialsRoomUiBehaviorConfig", NullValueHandling = NullValueHandling.Ignore)]
public EssentialsRoomUiBehaviorConfig UiBehavior { get; set; } public EssentialsRoomUiBehaviorConfig UiBehavior { get; set; }
[JsonProperty("zeroVolumeWhenSwtichingVolumeDevices")] /// <summary>
/// <summary> /// Gets or sets the ZeroVolumeWhenSwtichingVolumeDevices
/// Gets or sets the ZeroVolumeWhenSwtichingVolumeDevices /// </summary>
/// </summary> [JsonProperty("zeroVolumeWhenSwtichingVolumeDevices")]
public bool ZeroVolumeWhenSwtichingVolumeDevices { get; set; } public bool ZeroVolumeWhenSwtichingVolumeDevices { get; set; }
/// <summary> /// <summary>
/// Indicates if this room represents a combination of other rooms /// Indicates if this room represents a combination of other rooms
@@ -236,7 +236,7 @@ namespace PepperDash.Essentials.Room.Config
LogoLight = new EssentialsLogoPropertiesConfig(); LogoLight = new EssentialsLogoPropertiesConfig();
LogoDark = new EssentialsLogoPropertiesConfig(); LogoDark = new EssentialsLogoPropertiesConfig();
} }
} }
/// <summary> /// <summary>
/// Represents a EssentialsRoomUiBehaviorConfig /// Represents a EssentialsRoomUiBehaviorConfig
@@ -327,15 +327,15 @@ namespace PepperDash.Essentials.Room.Config
} }
/// <summary> /// <summary>
/// Represents a EssentialsEnvironmentPropertiesConfig /// Represents a EssentialsEnvironmentPropertiesConfig
/// </summary> /// </summary>
public class EssentialsEnvironmentPropertiesConfig public class EssentialsEnvironmentPropertiesConfig
{ {
/// <summary> /// <summary>
/// Gets or sets the Enabled /// Gets or sets the Enabled
/// </summary> /// </summary>
public bool Enabled { get; set; } public bool Enabled { get; set; }
[JsonProperty("deviceKeys")] [JsonProperty("deviceKeys")]
/// <summary> /// <summary>
@@ -348,7 +348,7 @@ namespace PepperDash.Essentials.Room.Config
DeviceKeys = new List<string>(); DeviceKeys = new List<string>();
} }
} }
/// <summary> /// <summary>
/// Represents a EssentialsRoomFusionConfig /// Represents a EssentialsRoomFusionConfig
@@ -390,17 +390,17 @@ namespace PepperDash.Essentials.Room.Config
/// </summary> /// </summary>
public class EssentialsRoomMicrophonePrivacyConfig public class EssentialsRoomMicrophonePrivacyConfig
{ {
[JsonProperty("deviceKey")] [JsonProperty("deviceKey")]
/// <summary> /// <summary>
/// Gets or sets the DeviceKey /// Gets or sets the DeviceKey
/// </summary> /// </summary>
public string DeviceKey { get; set; } public string DeviceKey { get; set; }
[JsonProperty("behaviour")] [JsonProperty("behaviour")]
/// <summary> /// <summary>
/// Gets or sets the Behaviour /// Gets or sets the Behaviour
/// </summary> /// </summary>
public string Behaviour { get; set; } public string Behaviour { get; set; }
} }
/// <summary> /// <summary>
@@ -408,23 +408,23 @@ namespace PepperDash.Essentials.Room.Config
/// </summary> /// </summary>
public class EssentialsHelpPropertiesConfig public class EssentialsHelpPropertiesConfig
{ {
[JsonProperty("message")] [JsonProperty("message")]
/// <summary> /// <summary>
/// Gets or sets the Message /// Gets or sets the Message
/// </summary> /// </summary>
public string Message { get; set; } public string Message { get; set; }
[JsonProperty("showCallButton")] [JsonProperty("showCallButton")]
public bool ShowCallButton { get; set; } public bool ShowCallButton { get; set; }
/// <summary> /// <summary>
/// Defaults to "Call Help Desk" /// Defaults to "Call Help Desk"
/// </summary> /// </summary>
[JsonProperty("callButtonText")] [JsonProperty("callButtonText")]
/// <summary> /// <summary>
/// Gets or sets the CallButtonText /// Gets or sets the CallButtonText
/// </summary> /// </summary>
public string CallButtonText { get; set; } public string CallButtonText { get; set; }
public EssentialsHelpPropertiesConfig() public EssentialsHelpPropertiesConfig()
{ {
@@ -437,23 +437,23 @@ namespace PepperDash.Essentials.Room.Config
/// </summary> /// </summary>
public class EssentialsOneButtonMeetingPropertiesConfig public class EssentialsOneButtonMeetingPropertiesConfig
{ {
[JsonProperty("enable")] [JsonProperty("enable")]
/// <summary> /// <summary>
/// Gets or sets the Enable /// Gets or sets the Enable
/// </summary> /// </summary>
public bool Enable { get; set; } public bool Enable { get; set; }
} }
public class EssentialsRoomAddressPropertiesConfig public class EssentialsRoomAddressPropertiesConfig
{ {
[JsonProperty("phoneNumber")] [JsonProperty("phoneNumber")]
public string PhoneNumber { get; set; } public string PhoneNumber { get; set; }
[JsonProperty("sipAddress")] [JsonProperty("sipAddress")]
/// <summary> /// <summary>
/// Gets or sets the SipAddress /// Gets or sets the SipAddress
/// </summary> /// </summary>
public string SipAddress { get; set; } public string SipAddress { get; set; }
} }
@@ -462,14 +462,14 @@ namespace PepperDash.Essentials.Room.Config
/// </summary> /// </summary>
public class EssentialsLogoPropertiesConfig public class EssentialsLogoPropertiesConfig
{ {
[JsonProperty("type")] [JsonProperty("type")]
/// <summary> /// <summary>
/// Gets or sets the Type /// Gets or sets the Type
/// </summary> /// </summary>
public string Type { get; set; } public string Type { get; set; }
[JsonProperty("url")] [JsonProperty("url")]
public string Url { get; set; } public string Url { get; set; }
/// <summary> /// <summary>
/// GetLogoUrlLight method /// GetLogoUrlLight method
/// </summary> /// </summary>
@@ -502,22 +502,22 @@ namespace PepperDash.Essentials.Room.Config
/// </summary> /// </summary>
public class EssentialsRoomOccSensorConfig public class EssentialsRoomOccSensorConfig
{ {
[JsonProperty("deviceKey")] [JsonProperty("deviceKey")]
/// <summary> /// <summary>
/// Gets or sets the DeviceKey /// Gets or sets the DeviceKey
/// </summary> /// </summary>
public string DeviceKey { get; set; } public string DeviceKey { get; set; }
[JsonProperty("timeoutMinutes")] [JsonProperty("timeoutMinutes")]
public int TimeoutMinutes { get; set; } public int TimeoutMinutes { get; set; }
} }
public class EssentialsRoomTechConfig public class EssentialsRoomTechConfig
{ {
[JsonProperty("password")] [JsonProperty("password")]
/// <summary> /// <summary>
/// Gets or sets the Password /// Gets or sets the Password
/// </summary> /// </summary>
public string Password { get; set; } public string Password { get; set; }
} }
} }

View File

@@ -14,14 +14,14 @@ using Serilog.Events;
namespace PepperDash.Essentials.Core namespace PepperDash.Essentials.Core
{ {
////***************************************************************************** ////*****************************************************************************
/// <summary> ///// <summary>
/// Base class for all subpage reference list controllers ///// Base class for all subpage reference list controllers
/// </summary> ///// </summary>
//public class SubpageReferenceListController //public class SubpageReferenceListController
//{ //{
// public SubpageReferenceList TheList { get; protected set; } // public SubpageReferenceList TheList { get; protected set; }
//} //}
//***************************************************************************** //*****************************************************************************
/// <summary> /// <summary>
@@ -34,26 +34,26 @@ namespace PepperDash.Essentials.Core
public ushort Count public ushort Count
{ {
get { return SetNumberOfItemsSig.UShortValue; } get { return SetNumberOfItemsSig.UShortValue; }
set { SetNumberOfItemsSig.UShortValue = value; } set { SetNumberOfItemsSig.UShortValue = value; }
} }
public ushort MaxDefinedItems { get; private set; } public ushort MaxDefinedItems { get; private set; }
/// <summary> /// <summary>
/// Gets or sets the ScrollToItemSig /// Gets or sets the ScrollToItemSig
/// </summary> /// </summary>
public UShortInputSig ScrollToItemSig { get; private set; } public UShortInputSig ScrollToItemSig { get; private set; }
UShortInputSig SetNumberOfItemsSig; UShortInputSig SetNumberOfItemsSig;
/// <summary> /// <summary>
/// Gets or sets the BoolIncrement /// Gets or sets the BoolIncrement
/// </summary> /// </summary>
public uint BoolIncrement { get; protected set; } public uint BoolIncrement { get; protected set; }
/// <summary> /// <summary>
/// Gets or sets the UShortIncrement /// Gets or sets the UShortIncrement
/// </summary> /// </summary>
public uint UShortIncrement { get; protected set; } public uint UShortIncrement { get; protected set; }
/// <summary> /// <summary>
/// Gets or sets the StringIncrement /// Gets or sets the StringIncrement
/// </summary> /// </summary>
public uint StringIncrement { get; protected set; } public uint StringIncrement { get; protected set; }
protected readonly SmartObject SRL; protected readonly SmartObject SRL;
@@ -88,7 +88,7 @@ namespace PepperDash.Essentials.Core
} }
else else
Debug.LogMessage(LogEventLevel.Information, "ERROR: TriList 0x{0:X2} Cannot load smart object {1}. Verify correct SGD file is loaded", Debug.LogMessage(LogEventLevel.Information, "ERROR: TriList 0x{0:X2} Cannot load smart object {1}. Verify correct SGD file is loaded",
triList.ID, smartObjectId); triList.ID, smartObjectId);
} }
/// <summary> /// <summary>
@@ -96,17 +96,17 @@ namespace PepperDash.Essentials.Core
/// DOES NOT adjust Count /// DOES NOT adjust Count
/// </summary> /// </summary>
/// <param name="item"></param> /// <param name="item"></param>
/// <summary> /// <summary>
/// AddItem method /// AddItem method
/// </summary> /// </summary>
public void AddItem(SubpageReferenceListItem item) public void AddItem(SubpageReferenceListItem item)
{ {
Items.Add(item); Items.Add(item);
} }
/// <summary> /// <summary>
/// Clear method /// Clear method
/// </summary> /// </summary>
public void Clear() public void Clear()
{ {
// If a line item needs to disconnect an CueActionPair or do something to release RAM // If a line item needs to disconnect an CueActionPair or do something to release RAM
@@ -116,12 +116,12 @@ namespace PepperDash.Essentials.Core
// Clean up the SRL // Clean up the SRL
Count = 1; Count = 1;
ScrollToItemSig.UShortValue = 1; ScrollToItemSig.UShortValue = 1;
} }
/// <summary> /// <summary>
/// Refresh method /// Refresh method
/// </summary> /// </summary>
public void Refresh() public void Refresh()
{ {
foreach (var item in Items) item.Refresh(); foreach (var item in Items) item.Refresh();
@@ -157,7 +157,7 @@ namespace PepperDash.Essentials.Core
public UShortOutputSig GetUShortOutputSig(uint index, uint sigNum) public UShortOutputSig GetUShortOutputSig(uint index, uint sigNum)
{ {
if (sigNum > UShortIncrement) return null; if (sigNum > UShortIncrement) return null;
return SRL.UShortOutput.FirstOrDefault(s => s.Name.Equals(GetUShortOutputSigName(index, sigNum))); return SRL.UShortOutput.FirstOrDefault(s => s.Name.Equals(GetUShortOutputSigName(index, sigNum)));
} }
/// <summary> /// <summary>
@@ -172,7 +172,7 @@ namespace PepperDash.Essentials.Core
public StringOutputSig GetStringOutputSig(uint index, uint sigNum) public StringOutputSig GetStringOutputSig(uint index, uint sigNum)
{ {
if (sigNum > StringIncrement) return null; if (sigNum > StringIncrement) return null;
return SRL.StringOutput.FirstOrDefault(s => s.Name.Equals(GetStringOutputSigName(index, sigNum))); return SRL.StringOutput.FirstOrDefault(s => s.Name.Equals(GetStringOutputSigName(index, sigNum)));
} }
/// <summary> /// <summary>
@@ -263,9 +263,9 @@ namespace PepperDash.Essentials.Core
/// </summary> /// </summary>
/// <param name="currentDevice"></param> /// <param name="currentDevice"></param>
/// <param name="args"></param> /// <param name="args"></param>
/// <summary> /// <summary>
/// SRL_SigChange method /// SRL_SigChange method
/// </summary> /// </summary>
public static void SRL_SigChange(GenericBase currentDevice, SmartObjectEventArgs args) public static void SRL_SigChange(GenericBase currentDevice, SmartObjectEventArgs args)
{ {
var uo = args.Sig.UserObject; var uo = args.Sig.UserObject;

View File

@@ -6,9 +6,9 @@ using Serilog.Events;
namespace PepperDash.Essentials.Core namespace PepperDash.Essentials.Core
{ {
/// <summary> /// <summary>
/// Represents a ModalDialog /// Represents a ModalDialog
/// </summary> /// </summary>
public class ModalDialog public class ModalDialog
{ {
/// <summary> /// <summary>
@@ -19,10 +19,10 @@ namespace PepperDash.Essentials.Core
/// Bool press 3992 /// Bool press 3992
/// </summary> /// </summary>
public const uint Button2Join = 3992; public const uint Button2Join = 3992;
/// <summary> /// <summary>
/// 3993 /// 3993
/// </summary> /// </summary>
public const uint CancelButtonJoin = 3993; public const uint CancelButtonJoin = 3993;
/// <summary> /// <summary>
///For visibility of single button. Bool feedback 3994 ///For visibility of single button. Bool feedback 3994
/// </summary> /// </summary>
@@ -35,19 +35,19 @@ namespace PepperDash.Essentials.Core
/// Shows the timer guage if in use. Bool feedback 3996 /// Shows the timer guage if in use. Bool feedback 3996
/// </summary> /// </summary>
public const uint TimerVisibleJoin = 3996; public const uint TimerVisibleJoin = 3996;
/// <summary> /// <summary>
/// Visibility join to show "X" button 3997 /// Visibility join to show "X" button 3997
/// </summary> /// </summary>
public const uint CancelVisibleJoin = 3997; public const uint CancelVisibleJoin = 3997;
/// <summary> /// <summary>
/// Shows the modal subpage. Boolean feeback join 3999 /// Shows the modal subpage. Boolean feeback join 3999
/// </summary> /// </summary>
public const uint ModalVisibleJoin = 3999; public const uint ModalVisibleJoin = 3999;
/// <summary> ///// <summary>
/// The seconds value of the countdown timer. Ushort join 3991 ///// The seconds value of the countdown timer. Ushort join 3991
/// </summary> ///// </summary>
//public const uint TimerSecondsJoin = 3991; //public const uint TimerSecondsJoin = 3991;
/// <summary> /// <summary>
/// The full ushort value of the countdown timer for a gauge. Ushort join 3992 /// The full ushort value of the countdown timer for a gauge. Ushort join 3992
/// </summary> /// </summary>
@@ -82,10 +82,10 @@ namespace PepperDash.Essentials.Core
get { return TriList.BooleanInput[ModalVisibleJoin].BoolValue; } get { return TriList.BooleanInput[ModalVisibleJoin].BoolValue; }
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public bool CanCancel { get; private set; } public bool CanCancel { get; private set; }
BasicTriList TriList; BasicTriList TriList;
@@ -103,10 +103,10 @@ namespace PepperDash.Essentials.Core
TriList = triList; TriList = triList;
// Attach actions to buttons // Attach actions to buttons
triList.SetSigFalseAction(Button1Join, () => OnModalComplete(1)); triList.SetSigFalseAction(Button1Join, () => OnModalComplete(1));
triList.SetSigFalseAction(Button2Join, () => OnModalComplete(2)); triList.SetSigFalseAction(Button2Join, () => OnModalComplete(2));
triList.SetSigFalseAction(CancelButtonJoin, () => { if (CanCancel) CancelDialog(); }); triList.SetSigFalseAction(CancelButtonJoin, () => { if (CanCancel) CancelDialog(); });
CanCancel = true; CanCancel = true;
} }
/// <summary> /// <summary>
@@ -151,15 +151,15 @@ namespace PepperDash.Essentials.Core
TriList.StringInput[Button2TextJoin].StringValue = button2Text; TriList.StringInput[Button2TextJoin].StringValue = button2Text;
} }
// Show/hide guage // Show/hide guage
TriList.BooleanInput[TimerVisibleJoin].BoolValue = showGauge; TriList.BooleanInput[TimerVisibleJoin].BoolValue = showGauge;
CanCancel = showCancel; CanCancel = showCancel;
TriList.BooleanInput[CancelVisibleJoin].BoolValue = showCancel; TriList.BooleanInput[CancelVisibleJoin].BoolValue = showCancel;
//Reveal and activate //Reveal and activate
TriList.BooleanInput[ModalVisibleJoin].BoolValue = true; TriList.BooleanInput[ModalVisibleJoin].BoolValue = true;
WakePanel(); WakePanel();
return true; return true;
} }
@@ -167,48 +167,48 @@ namespace PepperDash.Essentials.Core
return false; return false;
} }
/// <summary> /// <summary>
/// WakePanel method /// WakePanel method
/// </summary> /// </summary>
public void WakePanel() public void WakePanel()
{
try
{
var panel = TriList as TswFt5Button;
if (panel != null && panel.ExtenderSystemReservedSigs.BacklightOffFeedback.BoolValue)
panel.ExtenderSystemReservedSigs.BacklightOn();
}
catch
{
Debug.LogMessage(LogEventLevel.Debug, "Error Waking Panel. Maybe testing with Xpanel?");
}
}
/// <summary>
/// CancelDialog method
/// </summary>
public void CancelDialog()
{ {
OnModalComplete(0); try
{
var panel = TriList as TswFt5Button;
if (panel != null && panel.ExtenderSystemReservedSigs.BacklightOffFeedback.BoolValue)
panel.ExtenderSystemReservedSigs.BacklightOn();
}
catch
{
Debug.LogMessage(LogEventLevel.Debug, "Error Waking Panel. Maybe testing with Xpanel?");
}
} }
/// <summary> /// <summary>
/// Hides dialog. Fires no action /// CancelDialog method
/// </summary> /// </summary>
public void HideDialog() public void CancelDialog()
{ {
TriList.BooleanInput[ModalVisibleJoin].BoolValue = false; OnModalComplete(0);
} }
/// <summary>
/// Hides dialog. Fires no action
/// </summary>
public void HideDialog()
{
TriList.BooleanInput[ModalVisibleJoin].BoolValue = false;
}
// When the modal is cleared or times out, clean up the various bits // When the modal is cleared or times out, clean up the various bits
void OnModalComplete(uint buttonNum) void OnModalComplete(uint buttonNum)
{ {
TriList.BooleanInput[ModalVisibleJoin].BoolValue = false; TriList.BooleanInput[ModalVisibleJoin].BoolValue = false;
var action = ModalCompleteAction; var action = ModalCompleteAction;
if (action != null) if (action != null)
action(buttonNum); action(buttonNum);
} }
} }