mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 20:54:55 +00:00
feature: updated folder structure
- moved files into folders to match their current namespace - did not update any namespaces to maintain backward compatibility
This commit is contained in:
14
src/PepperDash.Essentials.Core/Bridges/BridgeApi.cs
Normal file
14
src/PepperDash.Essentials.Core/Bridges/BridgeApi.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Base class for bridge API variants
|
||||||
|
/// </summary>
|
||||||
|
public abstract class BridgeApi : EssentialsDevice
|
||||||
|
{
|
||||||
|
protected BridgeApi(string key) :
|
||||||
|
base(key)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,83 +1,10 @@
|
|||||||
extern alias Full;
|
extern alias Full;
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharp.Reflection;
|
|
||||||
using Crestron.SimplSharpPro;
|
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
|
||||||
using Crestron.SimplSharpPro.EthernetCommunication;
|
|
||||||
|
|
||||||
using Full.Newtonsoft.Json;
|
|
||||||
|
|
||||||
using PepperDash.Core;
|
|
||||||
using PepperDash.Essentials.Core.Config;
|
|
||||||
|
|
||||||
//using PepperDash.Essentials.Devices.Common.Cameras;
|
//using PepperDash.Essentials.Devices.Common.Cameras;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Helper methods for bridges
|
|
||||||
/// </summary>
|
|
||||||
public static class BridgeHelper
|
|
||||||
{
|
|
||||||
public static void PrintJoinMap(string command)
|
|
||||||
{
|
|
||||||
var targets = command.Split(' ');
|
|
||||||
|
|
||||||
var bridgeKey = targets[0].Trim();
|
|
||||||
|
|
||||||
var bridge = DeviceManager.GetDeviceForKey(bridgeKey) as EiscApiAdvanced;
|
|
||||||
|
|
||||||
if (bridge == null)
|
|
||||||
{
|
|
||||||
Debug.Console(0, "Unable to find advanced bridge with key: '{0}'", bridgeKey);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (targets.Length > 1)
|
|
||||||
{
|
|
||||||
var deviceKey = targets[1].Trim();
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(deviceKey)) return;
|
|
||||||
bridge.PrintJoinMapForDevice(deviceKey);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bridge.PrintJoinMaps();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static void JoinmapMarkdown(string command)
|
|
||||||
{
|
|
||||||
var targets = command.Split(' ');
|
|
||||||
|
|
||||||
var bridgeKey = targets[0].Trim();
|
|
||||||
|
|
||||||
var bridge = DeviceManager.GetDeviceForKey(bridgeKey) as EiscApiAdvanced;
|
|
||||||
|
|
||||||
if (bridge == null)
|
|
||||||
{
|
|
||||||
Debug.Console(0, "Unable to find advanced bridge with key: '{0}'", bridgeKey);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (targets.Length > 1)
|
|
||||||
{
|
|
||||||
var deviceKey = targets[1].Trim();
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(deviceKey)) return;
|
|
||||||
bridge.MarkdownJoinMapForDevice(deviceKey, bridgeKey);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bridge.MarkdownForBridge(bridgeKey);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Base class for all bridge class variants
|
/// Base class for all bridge class variants
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -91,414 +18,4 @@ namespace PepperDash.Essentials.Core.Bridges
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Base class for bridge API variants
|
|
||||||
/// </summary>
|
|
||||||
public abstract class BridgeApi : EssentialsDevice
|
|
||||||
{
|
|
||||||
protected BridgeApi(string key) :
|
|
||||||
base(key)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Bridge API using EISC
|
|
||||||
/// </summary>
|
|
||||||
public class EiscApiAdvanced : BridgeApi, ICommunicationMonitor
|
|
||||||
{
|
|
||||||
public EiscApiPropertiesConfig PropertiesConfig { get; private set; }
|
|
||||||
|
|
||||||
public Dictionary<string, JoinMapBaseAdvanced> JoinMaps { get; private set; }
|
|
||||||
|
|
||||||
public BasicTriList Eisc { get; private set; }
|
|
||||||
|
|
||||||
public EiscApiAdvanced(DeviceConfig dc, BasicTriList eisc) :
|
|
||||||
base(dc.Key)
|
|
||||||
{
|
|
||||||
JoinMaps = new Dictionary<string, JoinMapBaseAdvanced>();
|
|
||||||
|
|
||||||
PropertiesConfig = dc.Properties.ToObject<EiscApiPropertiesConfig>();
|
|
||||||
//PropertiesConfig = JsonConvert.DeserializeObject<EiscApiPropertiesConfig>(dc.Properties.ToString());
|
|
||||||
|
|
||||||
Eisc = eisc;
|
|
||||||
|
|
||||||
Eisc.SigChange += Eisc_SigChange;
|
|
||||||
|
|
||||||
CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, Eisc, 120000, 300000);
|
|
||||||
|
|
||||||
AddPostActivationAction(LinkDevices);
|
|
||||||
AddPostActivationAction(LinkRooms);
|
|
||||||
AddPostActivationAction(RegisterEisc);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool CustomActivate()
|
|
||||||
{
|
|
||||||
CommunicationMonitor.Start();
|
|
||||||
return base.CustomActivate();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool Deactivate()
|
|
||||||
{
|
|
||||||
CommunicationMonitor.Stop();
|
|
||||||
return base.Deactivate();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LinkDevices()
|
|
||||||
{
|
|
||||||
Debug.Console(1, this, "Linking Devices...");
|
|
||||||
|
|
||||||
if (PropertiesConfig.Devices == null)
|
|
||||||
{
|
|
||||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "No devices linked to this bridge");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var d in PropertiesConfig.Devices)
|
|
||||||
{
|
|
||||||
var device = DeviceManager.GetDeviceForKey(d.DeviceKey);
|
|
||||||
|
|
||||||
if (device == null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug.Console(1, this, "Linking Device: '{0}'", device.Key);
|
|
||||||
|
|
||||||
if (!typeof (IBridgeAdvanced).IsAssignableFrom(device.GetType().GetCType()))
|
|
||||||
{
|
|
||||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice,
|
|
||||||
"{0} is not compatible with this bridge type. Please use 'eiscapi' instead, or updae the device.",
|
|
||||||
device.Key);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
var bridge = device as IBridgeAdvanced;
|
|
||||||
if (bridge != null)
|
|
||||||
{
|
|
||||||
bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RegisterEisc()
|
|
||||||
{
|
|
||||||
if (Eisc.Registered)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var registerResult = Eisc.Register();
|
|
||||||
|
|
||||||
if (registerResult != eDeviceRegistrationUnRegistrationResponse.Success)
|
|
||||||
{
|
|
||||||
Debug.Console(2, this, Debug.ErrorLogLevel.Error, "Registration result: {0}", registerResult);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "EISC registration successful");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LinkRooms()
|
|
||||||
{
|
|
||||||
Debug.Console(1, this, "Linking Rooms...");
|
|
||||||
|
|
||||||
if (PropertiesConfig.Rooms == null)
|
|
||||||
{
|
|
||||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "No rooms linked to this bridge.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var room in PropertiesConfig.Rooms)
|
|
||||||
{
|
|
||||||
var rm = DeviceManager.GetDeviceForKey(room.RoomKey) as IBridgeAdvanced;
|
|
||||||
|
|
||||||
if (rm == null)
|
|
||||||
{
|
|
||||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice,
|
|
||||||
"Room {0} does not implement IBridgeAdvanced. Skipping...", room.RoomKey);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
rm.LinkToApi(Eisc, room.JoinStart, room.JoinMapKey, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds a join map
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="deviceKey"></param>
|
|
||||||
/// <param name="joinMap"></param>
|
|
||||||
public void AddJoinMap(string deviceKey, JoinMapBaseAdvanced joinMap)
|
|
||||||
{
|
|
||||||
if (!JoinMaps.ContainsKey(deviceKey))
|
|
||||||
{
|
|
||||||
JoinMaps.Add(deviceKey, joinMap);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.Console(2, this, "Unable to add join map with key '{0}'. Key already exists in JoinMaps dictionary", deviceKey);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Prints all the join maps on this bridge
|
|
||||||
/// </summary>
|
|
||||||
public virtual void PrintJoinMaps()
|
|
||||||
{
|
|
||||||
Debug.Console(0, this, "Join Maps for EISC IPID: {0}", Eisc.ID.ToString("X"));
|
|
||||||
|
|
||||||
foreach (var joinMap in JoinMaps)
|
|
||||||
{
|
|
||||||
Debug.Console(0, "Join map for device '{0}':", joinMap.Key);
|
|
||||||
joinMap.Value.PrintJoinMapInfo();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Generates markdown for all join maps on this bridge
|
|
||||||
/// </summary>
|
|
||||||
public virtual void MarkdownForBridge(string bridgeKey)
|
|
||||||
{
|
|
||||||
Debug.Console(0, this, "Writing Joinmaps to files for EISC IPID: {0}", Eisc.ID.ToString("X"));
|
|
||||||
|
|
||||||
foreach (var joinMap in JoinMaps)
|
|
||||||
{
|
|
||||||
Debug.Console(0, "Generating markdown for device '{0}':", joinMap.Key);
|
|
||||||
joinMap.Value.MarkdownJoinMapInfo(joinMap.Key, bridgeKey);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Prints the join map for a device by key
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="deviceKey"></param>
|
|
||||||
public void PrintJoinMapForDevice(string deviceKey)
|
|
||||||
{
|
|
||||||
var joinMap = JoinMaps[deviceKey];
|
|
||||||
|
|
||||||
if (joinMap == null)
|
|
||||||
{
|
|
||||||
Debug.Console(0, this, "Unable to find joinMap for device with key: '{0}'", deviceKey);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug.Console(0, "Join map for device '{0}' on EISC '{1}':", deviceKey, Key);
|
|
||||||
joinMap.PrintJoinMapInfo();
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Prints the join map for a device by key
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="deviceKey"></param>
|
|
||||||
public void MarkdownJoinMapForDevice(string deviceKey, string bridgeKey)
|
|
||||||
{
|
|
||||||
var joinMap = JoinMaps[deviceKey];
|
|
||||||
|
|
||||||
if (joinMap == null)
|
|
||||||
{
|
|
||||||
Debug.Console(0, this, "Unable to find joinMap for device with key: '{0}'", deviceKey);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug.Console(0, "Join map for device '{0}' on EISC '{1}':", deviceKey, Key);
|
|
||||||
joinMap.MarkdownJoinMapInfo(deviceKey, bridgeKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Used for debugging to trigger an action based on a join number and type
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="join"></param>
|
|
||||||
/// <param name="type"></param>
|
|
||||||
/// <param name="state"></param>
|
|
||||||
public void ExecuteJoinAction(uint join, string type, object state)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
switch (type.ToLower())
|
|
||||||
{
|
|
||||||
case "digital":
|
|
||||||
{
|
|
||||||
var uo = Eisc.BooleanOutput[join].UserObject as Action<bool>;
|
|
||||||
if (uo != null)
|
|
||||||
{
|
|
||||||
Debug.Console(2, this, "Executing Action: {0}", uo.ToString());
|
|
||||||
uo(Convert.ToBoolean(state));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Debug.Console(2, this, "User Action is null. Nothing to Execute");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "analog":
|
|
||||||
{
|
|
||||||
var uo = Eisc.BooleanOutput[join].UserObject as Action<ushort>;
|
|
||||||
if (uo != null)
|
|
||||||
{
|
|
||||||
Debug.Console(2, this, "Executing Action: {0}", uo.ToString());
|
|
||||||
uo(Convert.ToUInt16(state));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Debug.Console(2, this, "User Action is null. Nothing to Execute"); break;
|
|
||||||
}
|
|
||||||
case "serial":
|
|
||||||
{
|
|
||||||
var uo = Eisc.BooleanOutput[join].UserObject as Action<string>;
|
|
||||||
if (uo != null)
|
|
||||||
{
|
|
||||||
Debug.Console(2, this, "Executing Action: {0}", uo.ToString());
|
|
||||||
uo(Convert.ToString(state));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Debug.Console(2, this, "User Action is null. Nothing to Execute");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
Debug.Console(2, "Unknown join type. Use digital/serial/analog");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Debug.Console(1, this, "Error: {0}", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Handles incoming sig changes
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="currentDevice"></param>
|
|
||||||
/// <param name="args"></param>
|
|
||||||
protected void Eisc_SigChange(object currentDevice, SigEventArgs args)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (Debug.Level >= 1)
|
|
||||||
Debug.Console(1, this, "EiscApiAdvanced change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
|
||||||
var uo = args.Sig.UserObject;
|
|
||||||
|
|
||||||
if (uo == null) return;
|
|
||||||
|
|
||||||
Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
|
|
||||||
if (uo is Action<bool>)
|
|
||||||
(uo as Action<bool>)(args.Sig.BoolValue);
|
|
||||||
else if (uo is Action<ushort>)
|
|
||||||
(uo as Action<ushort>)(args.Sig.UShortValue);
|
|
||||||
else if (uo is Action<string>)
|
|
||||||
(uo as Action<string>)(args.Sig.StringValue);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Debug.Console(2, this, "Error in Eisc_SigChange handler: {0}", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Implementation of ICommunicationMonitor
|
|
||||||
|
|
||||||
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
|
|
||||||
public class EiscApiPropertiesConfig
|
|
||||||
{
|
|
||||||
[JsonProperty("control")]
|
|
||||||
public EssentialsControlPropertiesConfig Control { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("devices")]
|
|
||||||
public List<ApiDevicePropertiesConfig> Devices { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("rooms")]
|
|
||||||
public List<ApiRoomPropertiesConfig> Rooms { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
public class ApiDevicePropertiesConfig
|
|
||||||
{
|
|
||||||
[JsonProperty("deviceKey")]
|
|
||||||
public string DeviceKey { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("joinStart")]
|
|
||||||
public uint JoinStart { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("joinMapKey")]
|
|
||||||
public string JoinMapKey { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ApiRoomPropertiesConfig
|
|
||||||
{
|
|
||||||
[JsonProperty("roomKey")]
|
|
||||||
public string RoomKey { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("joinStart")]
|
|
||||||
public uint JoinStart { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("joinMapKey")]
|
|
||||||
public string JoinMapKey { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class EiscApiAdvancedFactory : EssentialsDeviceFactory<EiscApiAdvanced>
|
|
||||||
{
|
|
||||||
public EiscApiAdvancedFactory()
|
|
||||||
{
|
|
||||||
TypeNames = new List<string> { "eiscapiadv", "eiscapiadvanced", "eiscapiadvancedserver", "eiscapiadvancedclient", "vceiscapiadv", "vceiscapiadvanced" };
|
|
||||||
}
|
|
||||||
|
|
||||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
|
||||||
{
|
|
||||||
Debug.Console(1, "Factory Attempting to create new EiscApiAdvanced Device");
|
|
||||||
|
|
||||||
var controlProperties = CommFactory.GetControlPropertiesConfig(dc);
|
|
||||||
|
|
||||||
BasicTriList eisc;
|
|
||||||
|
|
||||||
switch (dc.Type.ToLower())
|
|
||||||
{
|
|
||||||
case "eiscapiadv":
|
|
||||||
case "eiscapiadvanced":
|
|
||||||
{
|
|
||||||
eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(controlProperties.IpIdInt,
|
|
||||||
controlProperties.TcpSshProperties.Address, Global.ControlSystem);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "eiscapiadvancedserver":
|
|
||||||
{
|
|
||||||
eisc = new EISCServer(controlProperties.IpIdInt, Global.ControlSystem);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "eiscapiadvancedclient":
|
|
||||||
{
|
|
||||||
eisc = new EISCClient(controlProperties.IpIdInt, controlProperties.TcpSshProperties.Address, Global.ControlSystem);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "vceiscapiadv":
|
|
||||||
case "vceiscapiadvanced":
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(controlProperties.RoomId))
|
|
||||||
{
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to build VC-4 EISC Client for device {0}. Room ID is missing or empty", dc.Key);
|
|
||||||
eisc = null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
eisc = new VirtualControlEISCClient(controlProperties.IpIdInt, controlProperties.RoomId,
|
|
||||||
Global.ControlSystem);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
eisc = null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eisc == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new EiscApiAdvanced(dc, eisc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
64
src/PepperDash.Essentials.Core/Bridges/BridgeHelper.cs
Normal file
64
src/PepperDash.Essentials.Core/Bridges/BridgeHelper.cs
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
using PepperDash.Core;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Helper methods for bridges
|
||||||
|
/// </summary>
|
||||||
|
public static class BridgeHelper
|
||||||
|
{
|
||||||
|
public static void PrintJoinMap(string command)
|
||||||
|
{
|
||||||
|
var targets = command.Split(' ');
|
||||||
|
|
||||||
|
var bridgeKey = targets[0].Trim();
|
||||||
|
|
||||||
|
var bridge = DeviceManager.GetDeviceForKey(bridgeKey) as EiscApiAdvanced;
|
||||||
|
|
||||||
|
if (bridge == null)
|
||||||
|
{
|
||||||
|
Debug.Console(0, "Unable to find advanced bridge with key: '{0}'", bridgeKey);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (targets.Length > 1)
|
||||||
|
{
|
||||||
|
var deviceKey = targets[1].Trim();
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(deviceKey)) return;
|
||||||
|
bridge.PrintJoinMapForDevice(deviceKey);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bridge.PrintJoinMaps();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static void JoinmapMarkdown(string command)
|
||||||
|
{
|
||||||
|
var targets = command.Split(' ');
|
||||||
|
|
||||||
|
var bridgeKey = targets[0].Trim();
|
||||||
|
|
||||||
|
var bridge = DeviceManager.GetDeviceForKey(bridgeKey) as EiscApiAdvanced;
|
||||||
|
|
||||||
|
if (bridge == null)
|
||||||
|
{
|
||||||
|
Debug.Console(0, "Unable to find advanced bridge with key: '{0}'", bridgeKey);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (targets.Length > 1)
|
||||||
|
{
|
||||||
|
var deviceKey = targets[1].Trim();
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(deviceKey)) return;
|
||||||
|
bridge.MarkdownJoinMapForDevice(deviceKey, bridgeKey);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bridge.MarkdownForBridge(bridgeKey);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
308
src/PepperDash.Essentials.Core/Bridges/EiscApiAdvanced.cs
Normal file
308
src/PepperDash.Essentials.Core/Bridges/EiscApiAdvanced.cs
Normal file
@@ -0,0 +1,308 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Crestron.SimplSharp.Reflection;
|
||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Bridge API using EISC
|
||||||
|
/// </summary>
|
||||||
|
public class EiscApiAdvanced : BridgeApi, ICommunicationMonitor
|
||||||
|
{
|
||||||
|
public EiscApiPropertiesConfig PropertiesConfig { get; private set; }
|
||||||
|
|
||||||
|
public Dictionary<string, JoinMapBaseAdvanced> JoinMaps { get; private set; }
|
||||||
|
|
||||||
|
public BasicTriList Eisc { get; private set; }
|
||||||
|
|
||||||
|
public EiscApiAdvanced(DeviceConfig dc, BasicTriList eisc) :
|
||||||
|
base(dc.Key)
|
||||||
|
{
|
||||||
|
JoinMaps = new Dictionary<string, JoinMapBaseAdvanced>();
|
||||||
|
|
||||||
|
PropertiesConfig = dc.Properties.ToObject<EiscApiPropertiesConfig>();
|
||||||
|
//PropertiesConfig = JsonConvert.DeserializeObject<EiscApiPropertiesConfig>(dc.Properties.ToString());
|
||||||
|
|
||||||
|
Eisc = eisc;
|
||||||
|
|
||||||
|
Eisc.SigChange += Eisc_SigChange;
|
||||||
|
|
||||||
|
CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, Eisc, 120000, 300000);
|
||||||
|
|
||||||
|
AddPostActivationAction(LinkDevices);
|
||||||
|
AddPostActivationAction(LinkRooms);
|
||||||
|
AddPostActivationAction(RegisterEisc);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CustomActivate()
|
||||||
|
{
|
||||||
|
CommunicationMonitor.Start();
|
||||||
|
return base.CustomActivate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Deactivate()
|
||||||
|
{
|
||||||
|
CommunicationMonitor.Stop();
|
||||||
|
return base.Deactivate();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LinkDevices()
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, "Linking Devices...");
|
||||||
|
|
||||||
|
if (PropertiesConfig.Devices == null)
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "No devices linked to this bridge");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var d in PropertiesConfig.Devices)
|
||||||
|
{
|
||||||
|
var device = DeviceManager.GetDeviceForKey(d.DeviceKey);
|
||||||
|
|
||||||
|
if (device == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Console(1, this, "Linking Device: '{0}'", device.Key);
|
||||||
|
|
||||||
|
if (!typeof (IBridgeAdvanced).IsAssignableFrom(device.GetType().GetCType()))
|
||||||
|
{
|
||||||
|
Debug.Console(0, this, Debug.ErrorLogLevel.Notice,
|
||||||
|
"{0} is not compatible with this bridge type. Please use 'eiscapi' instead, or updae the device.",
|
||||||
|
device.Key);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var bridge = device as IBridgeAdvanced;
|
||||||
|
if (bridge != null)
|
||||||
|
{
|
||||||
|
bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RegisterEisc()
|
||||||
|
{
|
||||||
|
if (Eisc.Registered)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var registerResult = Eisc.Register();
|
||||||
|
|
||||||
|
if (registerResult != eDeviceRegistrationUnRegistrationResponse.Success)
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, Debug.ErrorLogLevel.Error, "Registration result: {0}", registerResult);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "EISC registration successful");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LinkRooms()
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, "Linking Rooms...");
|
||||||
|
|
||||||
|
if (PropertiesConfig.Rooms == null)
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "No rooms linked to this bridge.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var room in PropertiesConfig.Rooms)
|
||||||
|
{
|
||||||
|
var rm = DeviceManager.GetDeviceForKey(room.RoomKey) as IBridgeAdvanced;
|
||||||
|
|
||||||
|
if (rm == null)
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, Debug.ErrorLogLevel.Notice,
|
||||||
|
"Room {0} does not implement IBridgeAdvanced. Skipping...", room.RoomKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
rm.LinkToApi(Eisc, room.JoinStart, room.JoinMapKey, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a join map
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="deviceKey"></param>
|
||||||
|
/// <param name="joinMap"></param>
|
||||||
|
public void AddJoinMap(string deviceKey, JoinMapBaseAdvanced joinMap)
|
||||||
|
{
|
||||||
|
if (!JoinMaps.ContainsKey(deviceKey))
|
||||||
|
{
|
||||||
|
JoinMaps.Add(deviceKey, joinMap);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "Unable to add join map with key '{0}'. Key already exists in JoinMaps dictionary", deviceKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prints all the join maps on this bridge
|
||||||
|
/// </summary>
|
||||||
|
public virtual void PrintJoinMaps()
|
||||||
|
{
|
||||||
|
Debug.Console(0, this, "Join Maps for EISC IPID: {0}", Eisc.ID.ToString("X"));
|
||||||
|
|
||||||
|
foreach (var joinMap in JoinMaps)
|
||||||
|
{
|
||||||
|
Debug.Console(0, "Join map for device '{0}':", joinMap.Key);
|
||||||
|
joinMap.Value.PrintJoinMapInfo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Generates markdown for all join maps on this bridge
|
||||||
|
/// </summary>
|
||||||
|
public virtual void MarkdownForBridge(string bridgeKey)
|
||||||
|
{
|
||||||
|
Debug.Console(0, this, "Writing Joinmaps to files for EISC IPID: {0}", Eisc.ID.ToString("X"));
|
||||||
|
|
||||||
|
foreach (var joinMap in JoinMaps)
|
||||||
|
{
|
||||||
|
Debug.Console(0, "Generating markdown for device '{0}':", joinMap.Key);
|
||||||
|
joinMap.Value.MarkdownJoinMapInfo(joinMap.Key, bridgeKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prints the join map for a device by key
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="deviceKey"></param>
|
||||||
|
public void PrintJoinMapForDevice(string deviceKey)
|
||||||
|
{
|
||||||
|
var joinMap = JoinMaps[deviceKey];
|
||||||
|
|
||||||
|
if (joinMap == null)
|
||||||
|
{
|
||||||
|
Debug.Console(0, this, "Unable to find joinMap for device with key: '{0}'", deviceKey);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Console(0, "Join map for device '{0}' on EISC '{1}':", deviceKey, Key);
|
||||||
|
joinMap.PrintJoinMapInfo();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Prints the join map for a device by key
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="deviceKey"></param>
|
||||||
|
public void MarkdownJoinMapForDevice(string deviceKey, string bridgeKey)
|
||||||
|
{
|
||||||
|
var joinMap = JoinMaps[deviceKey];
|
||||||
|
|
||||||
|
if (joinMap == null)
|
||||||
|
{
|
||||||
|
Debug.Console(0, this, "Unable to find joinMap for device with key: '{0}'", deviceKey);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Console(0, "Join map for device '{0}' on EISC '{1}':", deviceKey, Key);
|
||||||
|
joinMap.MarkdownJoinMapInfo(deviceKey, bridgeKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Used for debugging to trigger an action based on a join number and type
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="join"></param>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <param name="state"></param>
|
||||||
|
public void ExecuteJoinAction(uint join, string type, object state)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
switch (type.ToLower())
|
||||||
|
{
|
||||||
|
case "digital":
|
||||||
|
{
|
||||||
|
var uo = Eisc.BooleanOutput[join].UserObject as Action<bool>;
|
||||||
|
if (uo != null)
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "Executing Action: {0}", uo.ToString());
|
||||||
|
uo(Convert.ToBoolean(state));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Debug.Console(2, this, "User Action is null. Nothing to Execute");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "analog":
|
||||||
|
{
|
||||||
|
var uo = Eisc.BooleanOutput[join].UserObject as Action<ushort>;
|
||||||
|
if (uo != null)
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "Executing Action: {0}", uo.ToString());
|
||||||
|
uo(Convert.ToUInt16(state));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Debug.Console(2, this, "User Action is null. Nothing to Execute"); break;
|
||||||
|
}
|
||||||
|
case "serial":
|
||||||
|
{
|
||||||
|
var uo = Eisc.BooleanOutput[join].UserObject as Action<string>;
|
||||||
|
if (uo != null)
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "Executing Action: {0}", uo.ToString());
|
||||||
|
uo(Convert.ToString(state));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Debug.Console(2, this, "User Action is null. Nothing to Execute");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
Debug.Console(2, "Unknown join type. Use digital/serial/analog");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, "Error: {0}", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles incoming sig changes
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="currentDevice"></param>
|
||||||
|
/// <param name="args"></param>
|
||||||
|
protected void Eisc_SigChange(object currentDevice, SigEventArgs args)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (Debug.Level >= 1)
|
||||||
|
Debug.Console(1, this, "EiscApiAdvanced change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
||||||
|
var uo = args.Sig.UserObject;
|
||||||
|
|
||||||
|
if (uo == null) return;
|
||||||
|
|
||||||
|
Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
|
||||||
|
if (uo is Action<bool>)
|
||||||
|
(uo as Action<bool>)(args.Sig.BoolValue);
|
||||||
|
else if (uo is Action<ushort>)
|
||||||
|
(uo as Action<ushort>)(args.Sig.UShortValue);
|
||||||
|
else if (uo is Action<string>)
|
||||||
|
(uo as Action<string>)(args.Sig.StringValue);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "Error in Eisc_SigChange handler: {0}", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Implementation of ICommunicationMonitor
|
||||||
|
|
||||||
|
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
|
{
|
||||||
|
public class EiscApiAdvancedFactory : EssentialsDeviceFactory<EiscApiAdvanced>
|
||||||
|
{
|
||||||
|
public EiscApiAdvancedFactory()
|
||||||
|
{
|
||||||
|
TypeNames = new List<string> { "eiscapiadv", "eiscapiadvanced", "eiscapiadvancedserver", "eiscapiadvancedclient", "vceiscapiadv", "vceiscapiadvanced" };
|
||||||
|
}
|
||||||
|
|
||||||
|
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||||
|
{
|
||||||
|
Debug.Console(1, "Factory Attempting to create new EiscApiAdvanced Device");
|
||||||
|
|
||||||
|
var controlProperties = CommFactory.GetControlPropertiesConfig(dc);
|
||||||
|
|
||||||
|
BasicTriList eisc;
|
||||||
|
|
||||||
|
switch (dc.Type.ToLower())
|
||||||
|
{
|
||||||
|
case "eiscapiadv":
|
||||||
|
case "eiscapiadvanced":
|
||||||
|
{
|
||||||
|
eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(controlProperties.IpIdInt,
|
||||||
|
controlProperties.TcpSshProperties.Address, Global.ControlSystem);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "eiscapiadvancedserver":
|
||||||
|
{
|
||||||
|
eisc = new EISCServer(controlProperties.IpIdInt, Global.ControlSystem);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "eiscapiadvancedclient":
|
||||||
|
{
|
||||||
|
eisc = new EISCClient(controlProperties.IpIdInt, controlProperties.TcpSshProperties.Address, Global.ControlSystem);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "vceiscapiadv":
|
||||||
|
case "vceiscapiadvanced":
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(controlProperties.RoomId))
|
||||||
|
{
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to build VC-4 EISC Client for device {0}. Room ID is missing or empty", dc.Key);
|
||||||
|
eisc = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
eisc = new VirtualControlEISCClient(controlProperties.IpIdInt, controlProperties.RoomId,
|
||||||
|
Global.ControlSystem);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
eisc = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eisc == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new EiscApiAdvanced(dc, eisc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
extern alias Full;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Full::Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
|
{
|
||||||
|
public class EiscApiPropertiesConfig
|
||||||
|
{
|
||||||
|
[JsonProperty("control")]
|
||||||
|
public EssentialsControlPropertiesConfig Control { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("devices")]
|
||||||
|
public List<ApiDevicePropertiesConfig> Devices { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("rooms")]
|
||||||
|
public List<ApiRoomPropertiesConfig> Rooms { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public class ApiDevicePropertiesConfig
|
||||||
|
{
|
||||||
|
[JsonProperty("deviceKey")]
|
||||||
|
public string DeviceKey { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("joinStart")]
|
||||||
|
public uint JoinStart { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("joinMapKey")]
|
||||||
|
public string JoinMapKey { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ApiRoomPropertiesConfig
|
||||||
|
{
|
||||||
|
[JsonProperty("roomKey")]
|
||||||
|
public string RoomKey { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("joinStart")]
|
||||||
|
public uint JoinStart { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("joinMapKey")]
|
||||||
|
public string JoinMapKey { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -53,52 +53,4 @@ namespace PepperDash.Essentials.Core
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The gist of this converter: The comspec JSON comes in with normal values that need to be converted
|
|
||||||
/// into enum names. This converter takes the value and applies the appropriate enum's name prefix to the value
|
|
||||||
/// and then returns the enum value using Enum.Parse. NOTE: Does not write
|
|
||||||
/// </summary>
|
|
||||||
public class ComSpecPropsJsonConverter : JsonConverter
|
|
||||||
{
|
|
||||||
public override bool CanConvert(Type objectType)
|
|
||||||
{
|
|
||||||
return objectType == typeof(ComPort.eComBaudRates)
|
|
||||||
|| objectType == typeof(ComPort.eComDataBits)
|
|
||||||
|| objectType == typeof(ComPort.eComParityType)
|
|
||||||
|| objectType == typeof(ComPort.eComHardwareHandshakeType)
|
|
||||||
|| objectType == typeof(ComPort.eComSoftwareHandshakeType)
|
|
||||||
|| objectType == typeof(ComPort.eComProtocolType)
|
|
||||||
|| objectType == typeof(ComPort.eComStopBits);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool CanRead { get { return true; } }
|
|
||||||
|
|
||||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
|
||||||
{
|
|
||||||
//Debug.Console(2, "ReadJson type: " + objectType.Name);
|
|
||||||
if (objectType == typeof(ComPort.eComBaudRates))
|
|
||||||
return Enum.Parse(typeof(ComPort.eComBaudRates), "ComspecBaudRate" + reader.Value, false);
|
|
||||||
else if (objectType == typeof(ComPort.eComDataBits))
|
|
||||||
return Enum.Parse(typeof(ComPort.eComDataBits), "ComspecDataBits" + reader.Value, true);
|
|
||||||
else if (objectType == typeof(ComPort.eComHardwareHandshakeType))
|
|
||||||
return Enum.Parse(typeof(ComPort.eComHardwareHandshakeType), "ComspecHardwareHandshake" + reader.Value, true);
|
|
||||||
else if (objectType == typeof(ComPort.eComParityType))
|
|
||||||
return Enum.Parse(typeof(ComPort.eComParityType), "ComspecParity" + reader.Value, true);
|
|
||||||
else if (objectType == typeof(ComPort.eComProtocolType))
|
|
||||||
return Enum.Parse(typeof(ComPort.eComProtocolType), "ComspecProtocol" + reader.Value, true);
|
|
||||||
else if (objectType == typeof(ComPort.eComSoftwareHandshakeType))
|
|
||||||
return Enum.Parse(typeof(ComPort.eComSoftwareHandshakeType), "ComspecSoftwareHandshake" + reader.Value, true);
|
|
||||||
else if (objectType == typeof(ComPort.eComStopBits))
|
|
||||||
return Enum.Parse(typeof(ComPort.eComStopBits), "ComspecStopBits" + reader.Value, true);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
extern alias Full;
|
||||||
|
using System;
|
||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
using Full::Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The gist of this converter: The comspec JSON comes in with normal values that need to be converted
|
||||||
|
/// into enum names. This converter takes the value and applies the appropriate enum's name prefix to the value
|
||||||
|
/// and then returns the enum value using Enum.Parse. NOTE: Does not write
|
||||||
|
/// </summary>
|
||||||
|
public class ComSpecPropsJsonConverter : JsonConverter
|
||||||
|
{
|
||||||
|
public override bool CanConvert(Type objectType)
|
||||||
|
{
|
||||||
|
return objectType == typeof(ComPort.eComBaudRates)
|
||||||
|
|| objectType == typeof(ComPort.eComDataBits)
|
||||||
|
|| objectType == typeof(ComPort.eComParityType)
|
||||||
|
|| objectType == typeof(ComPort.eComHardwareHandshakeType)
|
||||||
|
|| objectType == typeof(ComPort.eComSoftwareHandshakeType)
|
||||||
|
|| objectType == typeof(ComPort.eComProtocolType)
|
||||||
|
|| objectType == typeof(ComPort.eComStopBits);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CanRead { get { return true; } }
|
||||||
|
|
||||||
|
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||||
|
{
|
||||||
|
//Debug.Console(2, "ReadJson type: " + objectType.Name);
|
||||||
|
if (objectType == typeof(ComPort.eComBaudRates))
|
||||||
|
return Enum.Parse(typeof(ComPort.eComBaudRates), "ComspecBaudRate" + reader.Value, false);
|
||||||
|
else if (objectType == typeof(ComPort.eComDataBits))
|
||||||
|
return Enum.Parse(typeof(ComPort.eComDataBits), "ComspecDataBits" + reader.Value, true);
|
||||||
|
else if (objectType == typeof(ComPort.eComHardwareHandshakeType))
|
||||||
|
return Enum.Parse(typeof(ComPort.eComHardwareHandshakeType), "ComspecHardwareHandshake" + reader.Value, true);
|
||||||
|
else if (objectType == typeof(ComPort.eComParityType))
|
||||||
|
return Enum.Parse(typeof(ComPort.eComParityType), "ComspecParity" + reader.Value, true);
|
||||||
|
else if (objectType == typeof(ComPort.eComProtocolType))
|
||||||
|
return Enum.Parse(typeof(ComPort.eComProtocolType), "ComspecProtocol" + reader.Value, true);
|
||||||
|
else if (objectType == typeof(ComPort.eComSoftwareHandshakeType))
|
||||||
|
return Enum.Parse(typeof(ComPort.eComSoftwareHandshakeType), "ComspecSoftwareHandshake" + reader.Value, true);
|
||||||
|
else if (objectType == typeof(ComPort.eComStopBits))
|
||||||
|
return Enum.Parse(typeof(ComPort.eComStopBits), "ComspecStopBits" + reader.Value, true);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -174,64 +174,4 @@ namespace PepperDash.Essentials.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class EssentialsControlPropertiesConfig :
|
|
||||||
PepperDash.Core.ControlPropertiesConfig
|
|
||||||
{
|
|
||||||
|
|
||||||
[JsonConverter(typeof(ComSpecJsonConverter))]
|
|
||||||
public ComPort.ComPortSpec ComParams { get; set; }
|
|
||||||
|
|
||||||
public string RoomId { get; set; }
|
|
||||||
|
|
||||||
public string CresnetId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Attempts to provide uint conversion of string CresnetId
|
|
||||||
/// </summary>
|
|
||||||
public uint CresnetIdInt
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return Convert.ToUInt32(CresnetId, 16);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
throw new FormatException(string.Format("ERROR:Unable to convert Cresnet ID: {0} to hex. Error:\n{1}", CresnetId));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string InfinetId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Attepmts to provide uiont conversion of string InifinetId
|
|
||||||
/// </summary>
|
|
||||||
public uint InfinetIdInt
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return Convert.ToUInt32(InfinetId, 16);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
throw new FormatException(string.Format("ERROR:Unable to conver Infinet ID: {0} to hex. Error:\n{1}", InfinetId));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class IrControlSpec
|
|
||||||
{
|
|
||||||
public string PortDeviceKey { get; set; }
|
|
||||||
public uint PortNumber { get; set; }
|
|
||||||
public string File { get; set; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
|
||||||
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
@@ -54,33 +52,4 @@ namespace PepperDash.Essentials.Core
|
|||||||
Communication.SendText(s + LineEnding);
|
Communication.SendText(s + LineEnding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ConsoleCommMockDevicePropertiesConfig
|
|
||||||
{
|
|
||||||
public string LineEnding { get; set; }
|
|
||||||
public CommunicationMonitorConfig CommunicationMonitorProperties { get; set; }
|
|
||||||
|
|
||||||
public ConsoleCommMockDevicePropertiesConfig()
|
|
||||||
{
|
|
||||||
LineEnding = "\x0a";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ConsoleCommMockDeviceFactory : EssentialsDeviceFactory<ConsoleCommMockDevice>
|
|
||||||
{
|
|
||||||
public ConsoleCommMockDeviceFactory()
|
|
||||||
{
|
|
||||||
TypeNames = new List<string>() { "commmock" };
|
|
||||||
}
|
|
||||||
|
|
||||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
|
||||||
{
|
|
||||||
Debug.Console(1, "Factory Attempting to create new Comm Mock Device");
|
|
||||||
var comm = CommFactory.CreateCommForDevice(dc);
|
|
||||||
var props = Newtonsoft.Json.JsonConvert.DeserializeObject<ConsoleCommMockDevicePropertiesConfig>(
|
|
||||||
dc.Properties.ToString());
|
|
||||||
return new ConsoleCommMockDevice(dc.Key, dc.Name, props, comm);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
public class ConsoleCommMockDeviceFactory : EssentialsDeviceFactory<ConsoleCommMockDevice>
|
||||||
|
{
|
||||||
|
public ConsoleCommMockDeviceFactory()
|
||||||
|
{
|
||||||
|
TypeNames = new List<string>() { "commmock" };
|
||||||
|
}
|
||||||
|
|
||||||
|
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||||
|
{
|
||||||
|
Debug.Console(1, "Factory Attempting to create new Comm Mock Device");
|
||||||
|
var comm = CommFactory.CreateCommForDevice(dc);
|
||||||
|
var props = Newtonsoft.Json.JsonConvert.DeserializeObject<ConsoleCommMockDevicePropertiesConfig>(
|
||||||
|
dc.Properties.ToString());
|
||||||
|
return new ConsoleCommMockDevice(dc.Key, dc.Name, props, comm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
public class ConsoleCommMockDevicePropertiesConfig
|
||||||
|
{
|
||||||
|
public string LineEnding { get; set; }
|
||||||
|
public CommunicationMonitorConfig CommunicationMonitorProperties { get; set; }
|
||||||
|
|
||||||
|
public ConsoleCommMockDevicePropertiesConfig()
|
||||||
|
{
|
||||||
|
LineEnding = "\x0a";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
extern alias Full;
|
||||||
|
using System;
|
||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
using Full::Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class EssentialsControlPropertiesConfig :
|
||||||
|
PepperDash.Core.ControlPropertiesConfig
|
||||||
|
{
|
||||||
|
|
||||||
|
[JsonConverter(typeof(ComSpecJsonConverter))]
|
||||||
|
public ComPort.ComPortSpec ComParams { get; set; }
|
||||||
|
|
||||||
|
public string RoomId { get; set; }
|
||||||
|
|
||||||
|
public string CresnetId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attempts to provide uint conversion of string CresnetId
|
||||||
|
/// </summary>
|
||||||
|
public uint CresnetIdInt
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return Convert.ToUInt32(CresnetId, 16);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
throw new FormatException(string.Format("ERROR:Unable to convert Cresnet ID: {0} to hex. Error:\n{1}", CresnetId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string InfinetId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attepmts to provide uiont conversion of string InifinetId
|
||||||
|
/// </summary>
|
||||||
|
public uint InfinetIdInt
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return Convert.ToUInt32(InfinetId, 16);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
throw new FormatException(string.Format("ERROR:Unable to conver Infinet ID: {0} to hex. Error:\n{1}", InfinetId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
extern alias Full;
|
extern alias Full;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using Crestron.SimplSharp.CrestronSockets;
|
using Crestron.SimplSharp.CrestronSockets;
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
using Full.Newtonsoft.Json;
|
using Full.Newtonsoft.Json;
|
||||||
@@ -127,18 +126,4 @@ namespace PepperDash.Essentials.Core
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GenericCommFactory : EssentialsDeviceFactory<GenericComm>
|
|
||||||
{
|
|
||||||
public GenericCommFactory()
|
|
||||||
{
|
|
||||||
TypeNames = new List<string>() { "genericComm" };
|
|
||||||
}
|
|
||||||
|
|
||||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
|
||||||
{
|
|
||||||
Debug.Console(1, "Factory Attempting to create new Generic Comm Device");
|
|
||||||
return new GenericComm(dc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
public class GenericCommFactory : EssentialsDeviceFactory<GenericComm>
|
||||||
|
{
|
||||||
|
public GenericCommFactory()
|
||||||
|
{
|
||||||
|
TypeNames = new List<string>() { "genericComm" };
|
||||||
|
}
|
||||||
|
|
||||||
|
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||||
|
{
|
||||||
|
Debug.Console(1, "Factory Attempting to create new Generic Comm Device");
|
||||||
|
return new GenericComm(dc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -100,16 +100,4 @@ namespace PepperDash.Essentials.Core
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
public class GenericHttpClientEventArgs : EventArgs
|
|
||||||
{
|
|
||||||
public string ResponseText { get; private set; }
|
|
||||||
public string RequestPath { get; private set; }
|
|
||||||
public HTTP_CALLBACK_ERROR Error { get; set; }
|
|
||||||
public GenericHttpClientEventArgs(string response, string request, HTTP_CALLBACK_ERROR error)
|
|
||||||
{
|
|
||||||
ResponseText = response;
|
|
||||||
RequestPath = request;
|
|
||||||
Error = error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using Crestron.SimplSharp.Net.Http;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
public class GenericHttpClientEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
public string ResponseText { get; private set; }
|
||||||
|
public string RequestPath { get; private set; }
|
||||||
|
public HTTP_CALLBACK_ERROR Error { get; set; }
|
||||||
|
public GenericHttpClientEventArgs(string response, string request, HTTP_CALLBACK_ERROR error)
|
||||||
|
{
|
||||||
|
ResponseText = response;
|
||||||
|
RequestPath = request;
|
||||||
|
Error = error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -220,18 +220,4 @@ namespace PepperDash.Essentials.Core
|
|||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Wrapper to help in IR port creation
|
|
||||||
/// </summary>
|
|
||||||
public class IrOutPortConfig
|
|
||||||
{
|
|
||||||
public IROutputPort Port { get; set; }
|
|
||||||
public string FileName { get; set; }
|
|
||||||
|
|
||||||
public IrOutPortConfig()
|
|
||||||
{
|
|
||||||
FileName = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
public class IrControlSpec
|
||||||
|
{
|
||||||
|
public string PortDeviceKey { get; set; }
|
||||||
|
public uint PortNumber { get; set; }
|
||||||
|
public string File { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Wrapper to help in IR port creation
|
||||||
|
/// </summary>
|
||||||
|
public class IrOutPortConfig
|
||||||
|
{
|
||||||
|
public IROutputPort Port { get; set; }
|
||||||
|
public string FileName { get; set; }
|
||||||
|
|
||||||
|
public IrOutPortConfig()
|
||||||
|
{
|
||||||
|
FileName = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
extern alias Full;
|
extern alias Full;
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharp.CrestronIO;
|
using Crestron.SimplSharp.CrestronIO;
|
||||||
@@ -49,34 +47,4 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
|
|
||||||
public DeviceConfig() {}
|
public DeviceConfig() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class DevicePropertiesConverter : JsonConverter
|
|
||||||
{
|
|
||||||
|
|
||||||
public override bool CanConvert(Type objectType)
|
|
||||||
{
|
|
||||||
return objectType == typeof(JToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
|
||||||
{
|
|
||||||
return JToken.ReadFrom(reader);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool CanWrite
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException("SOD OFF HOSER");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
extern alias Full;
|
||||||
|
using System;
|
||||||
|
using Full::Newtonsoft.Json;
|
||||||
|
using Full::Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.Config
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class DevicePropertiesConverter : JsonConverter
|
||||||
|
{
|
||||||
|
|
||||||
|
public override bool CanConvert(Type objectType)
|
||||||
|
{
|
||||||
|
return objectType == typeof(JToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||||
|
{
|
||||||
|
return JToken.ReadFrom(reader);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CanWrite
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException("SOD OFF HOSER");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.Config
|
||||||
|
{
|
||||||
|
public class ConfigStatusEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
public eUpdateStatus UpdateStatus { get; private set; }
|
||||||
|
|
||||||
|
public ConfigStatusEventArgs(eUpdateStatus status)
|
||||||
|
{
|
||||||
|
UpdateStatus = status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -200,26 +200,4 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum eUpdateStatus
|
|
||||||
{
|
|
||||||
UpdateStarted,
|
|
||||||
ConfigFileReceived,
|
|
||||||
ArchivingConfigs,
|
|
||||||
DeletingLocalConfig,
|
|
||||||
WritingConfigFile,
|
|
||||||
RestartingProgram,
|
|
||||||
UpdateSucceeded,
|
|
||||||
UpdateFailed
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ConfigStatusEventArgs : EventArgs
|
|
||||||
{
|
|
||||||
public eUpdateStatus UpdateStatus { get; private set; }
|
|
||||||
|
|
||||||
public ConfigStatusEventArgs(eUpdateStatus status)
|
|
||||||
{
|
|
||||||
UpdateStatus = status;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -61,14 +61,4 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
Rooms = new List<DeviceConfig>();
|
Rooms = new List<DeviceConfig>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class SystemTemplateConfigs
|
|
||||||
{
|
|
||||||
public EssentialsConfig System { get; set; }
|
|
||||||
|
|
||||||
public EssentialsConfig Template { get; set; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
namespace PepperDash.Essentials.Core.Config
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class SystemTemplateConfigs
|
||||||
|
{
|
||||||
|
public EssentialsConfig System { get; set; }
|
||||||
|
|
||||||
|
public EssentialsConfig Template { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
namespace PepperDash.Essentials.Core.Config
|
||||||
|
{
|
||||||
|
public enum eUpdateStatus
|
||||||
|
{
|
||||||
|
UpdateStarted,
|
||||||
|
ConfigFileReceived,
|
||||||
|
ArchivingConfigs,
|
||||||
|
DeletingLocalConfig,
|
||||||
|
WritingConfigFile,
|
||||||
|
RestartingProgram,
|
||||||
|
UpdateSucceeded,
|
||||||
|
UpdateFailed
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
extern alias Full;
|
extern alias Full;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharp.Reflection;
|
using Crestron.SimplSharp.Reflection;
|
||||||
|
|
||||||
@@ -51,61 +50,4 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
RuntimeInfo = new RuntimeInfo();
|
RuntimeInfo = new RuntimeInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents runtime information about the program/processor
|
|
||||||
/// </summary>
|
|
||||||
public class RuntimeInfo
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The name of the running application
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("appName")]
|
|
||||||
public string AppName {get; set;}
|
|
||||||
//{
|
|
||||||
// get
|
|
||||||
// {
|
|
||||||
// return Assembly.GetExecutingAssembly().GetName().Name;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The Assembly version of the running application
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("assemblyVersion")]
|
|
||||||
public string AssemblyVersion {get; set;}
|
|
||||||
//{
|
|
||||||
// get
|
|
||||||
// {
|
|
||||||
// var version = Assembly.GetExecutingAssembly().GetName().Version;
|
|
||||||
// return string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
/// <summary>,
|
|
||||||
/// The OS Version of the processor (Firmware Version)
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("osVersion")]
|
|
||||||
public string OsVersion {get; set;}
|
|
||||||
//{
|
|
||||||
// get
|
|
||||||
// {
|
|
||||||
// return Crestron.SimplSharp.CrestronEnvironment.OSVersion.Firmware;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The information gathered by the processor at runtime about it's NICs and their IP addresses.
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("ipInfo")]
|
|
||||||
public Dictionary<short, EthernetAdapterInfo> IpInfo
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Global.EthernetAdapterInfoCollection;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
61
src/PepperDash.Essentials.Core/Config/RuntimeInfo.cs
Normal file
61
src/PepperDash.Essentials.Core/Config/RuntimeInfo.cs
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
extern alias Full;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Full::Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.Config
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents runtime information about the program/processor
|
||||||
|
/// </summary>
|
||||||
|
public class RuntimeInfo
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The name of the running application
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("appName")]
|
||||||
|
public string AppName {get; set;}
|
||||||
|
//{
|
||||||
|
// get
|
||||||
|
// {
|
||||||
|
// return Assembly.GetExecutingAssembly().GetName().Name;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The Assembly version of the running application
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("assemblyVersion")]
|
||||||
|
public string AssemblyVersion {get; set;}
|
||||||
|
//{
|
||||||
|
// get
|
||||||
|
// {
|
||||||
|
// var version = Assembly.GetExecutingAssembly().GetName().Version;
|
||||||
|
// return string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
/// <summary>,
|
||||||
|
/// The OS Version of the processor (Firmware Version)
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("osVersion")]
|
||||||
|
public string OsVersion {get; set;}
|
||||||
|
//{
|
||||||
|
// get
|
||||||
|
// {
|
||||||
|
// return Crestron.SimplSharp.CrestronEnvironment.OSVersion.Firmware;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The information gathered by the processor at runtime about it's NICs and their IP addresses.
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("ipInfo")]
|
||||||
|
public Dictionary<short, EthernetAdapterInfo> IpInfo
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Global.EthernetAdapterInfoCollection;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Crestron.SimplSharpPro.GeneralIO;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.CrestronIO
|
||||||
|
{
|
||||||
|
public class C2NIoControllerFactory : EssentialsDeviceFactory<C2NIoController>
|
||||||
|
{
|
||||||
|
public C2NIoControllerFactory()
|
||||||
|
{
|
||||||
|
TypeNames = new List<string>() { "c2nio" };
|
||||||
|
}
|
||||||
|
|
||||||
|
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||||
|
{
|
||||||
|
Debug.Console(1, "Factory Attempting to create new C2N-IO Device");
|
||||||
|
|
||||||
|
return new C2NIoController(dc.Key, GetC2NIoDevice, dc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static C2nIo GetC2NIoDevice(DeviceConfig dc)
|
||||||
|
{
|
||||||
|
var control = CommFactory.GetControlPropertiesConfig(dc);
|
||||||
|
var cresnetId = control.CresnetIdInt;
|
||||||
|
var branchId = control.ControlPortNumber;
|
||||||
|
var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
|
||||||
|
|
||||||
|
if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nIo", parentKey);
|
||||||
|
return new C2nIo(cresnetId, Global.ControlSystem);
|
||||||
|
}
|
||||||
|
var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches;
|
||||||
|
|
||||||
|
if (cresnetBridge != null)
|
||||||
|
{
|
||||||
|
Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nIo", parentKey);
|
||||||
|
return new C2nIo(cresnetId, cresnetBridge.CresnetBranches[branchId]);
|
||||||
|
}
|
||||||
|
Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
using Crestron.SimplSharpPro.GeneralIO;
|
using Crestron.SimplSharpPro.GeneralIO;
|
||||||
using PepperDash.Core;
|
|
||||||
using PepperDash.Essentials.Core.Bridges;
|
using PepperDash.Essentials.Core.Bridges;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
|
||||||
@@ -65,42 +63,4 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
public class C2NIoControllerFactory : EssentialsDeviceFactory<C2NIoController>
|
|
||||||
{
|
|
||||||
public C2NIoControllerFactory()
|
|
||||||
{
|
|
||||||
TypeNames = new List<string>() { "c2nio" };
|
|
||||||
}
|
|
||||||
|
|
||||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
|
||||||
{
|
|
||||||
Debug.Console(1, "Factory Attempting to create new C2N-IO Device");
|
|
||||||
|
|
||||||
return new C2NIoController(dc.Key, GetC2NIoDevice, dc);
|
|
||||||
}
|
|
||||||
|
|
||||||
static C2nIo GetC2NIoDevice(DeviceConfig dc)
|
|
||||||
{
|
|
||||||
var control = CommFactory.GetControlPropertiesConfig(dc);
|
|
||||||
var cresnetId = control.CresnetIdInt;
|
|
||||||
var branchId = control.ControlPortNumber;
|
|
||||||
var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
|
|
||||||
|
|
||||||
if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
|
|
||||||
{
|
|
||||||
Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nIo", parentKey);
|
|
||||||
return new C2nIo(cresnetId, Global.ControlSystem);
|
|
||||||
}
|
|
||||||
var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches;
|
|
||||||
|
|
||||||
if (cresnetBridge != null)
|
|
||||||
{
|
|
||||||
Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nIo", parentKey);
|
|
||||||
return new C2nIo(cresnetId, cresnetBridge.CresnetBranches[branchId]);
|
|
||||||
}
|
|
||||||
Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
extern alias Full;
|
||||||
|
using Full::Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
||||||
|
{
|
||||||
|
public class CenCi31Configuration
|
||||||
|
{
|
||||||
|
[JsonProperty("card")]
|
||||||
|
public string Card { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,9 +3,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Crestron.SimplSharpPro.ThreeSeriesCards;
|
using Crestron.SimplSharpPro.ThreeSeriesCards;
|
||||||
using Full.Newtonsoft.Json;
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
||||||
{
|
{
|
||||||
@@ -85,34 +83,4 @@ namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
|||||||
DeviceManager.AddDevice(device);
|
DeviceManager.AddDevice(device);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CenCi31Configuration
|
|
||||||
{
|
|
||||||
[JsonProperty("card")]
|
|
||||||
public string Card { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class CenCi31ControllerFactory : EssentialsDeviceFactory<CenCi31Controller>
|
|
||||||
{
|
|
||||||
public CenCi31ControllerFactory()
|
|
||||||
{
|
|
||||||
TypeNames = new List<string> {"cenci31"};
|
|
||||||
}
|
|
||||||
#region Overrides of EssentialsDeviceFactory<CenCi31Controller>
|
|
||||||
|
|
||||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
|
||||||
{
|
|
||||||
Debug.Console(1, "Factory attempting to build new CEN-CI-1");
|
|
||||||
|
|
||||||
var controlProperties = CommFactory.GetControlPropertiesConfig(dc);
|
|
||||||
var ipId = controlProperties.IpIdInt;
|
|
||||||
|
|
||||||
var cardCage = new CenCi31(ipId, Global.ControlSystem);
|
|
||||||
var config = dc.Properties.ToObject<CenCi31Configuration>();
|
|
||||||
|
|
||||||
return new CenCi31Controller(dc.Key, dc.Name, config, cardCage);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Crestron.SimplSharpPro.ThreeSeriesCards;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
||||||
|
{
|
||||||
|
public class CenCi31ControllerFactory : EssentialsDeviceFactory<CenCi31Controller>
|
||||||
|
{
|
||||||
|
public CenCi31ControllerFactory()
|
||||||
|
{
|
||||||
|
TypeNames = new List<string> {"cenci31"};
|
||||||
|
}
|
||||||
|
#region Overrides of EssentialsDeviceFactory<CenCi31Controller>
|
||||||
|
|
||||||
|
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||||
|
{
|
||||||
|
Debug.Console(1, "Factory attempting to build new CEN-CI-1");
|
||||||
|
|
||||||
|
var controlProperties = CommFactory.GetControlPropertiesConfig(dc);
|
||||||
|
var ipId = controlProperties.IpIdInt;
|
||||||
|
|
||||||
|
var cardCage = new CenCi31(ipId, Global.ControlSystem);
|
||||||
|
var config = dc.Properties.ToObject<CenCi31Configuration>();
|
||||||
|
|
||||||
|
return new CenCi31Controller(dc.Key, dc.Name, config, cardCage);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
extern alias Full;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Full::Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
||||||
|
{
|
||||||
|
public class CenCi33Configuration
|
||||||
|
{
|
||||||
|
[JsonProperty("cards")]
|
||||||
|
public Dictionary<uint, string> Cards { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,9 +3,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Crestron.SimplSharpPro.ThreeSeriesCards;
|
using Crestron.SimplSharpPro.ThreeSeriesCards;
|
||||||
using Full.Newtonsoft.Json;
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
||||||
{
|
{
|
||||||
@@ -100,34 +98,4 @@ namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CenCi33Configuration
|
|
||||||
{
|
|
||||||
[JsonProperty("cards")]
|
|
||||||
public Dictionary<uint, string> Cards { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class CenCi33ControllerFactory : EssentialsDeviceFactory<CenCi33Controller>
|
|
||||||
{
|
|
||||||
public CenCi33ControllerFactory()
|
|
||||||
{
|
|
||||||
TypeNames = new List<string> {"cenci33"};
|
|
||||||
}
|
|
||||||
#region Overrides of EssentialsDeviceFactory<CenCi33Controller>
|
|
||||||
|
|
||||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
|
||||||
{
|
|
||||||
Debug.Console(1, "Factory attempting to build new CEN-CI-3");
|
|
||||||
|
|
||||||
var controlProperties = CommFactory.GetControlPropertiesConfig(dc);
|
|
||||||
var ipId = controlProperties.IpIdInt;
|
|
||||||
|
|
||||||
var cardCage = new CenCi33(ipId, Global.ControlSystem);
|
|
||||||
var config = dc.Properties.ToObject<CenCi33Configuration>();
|
|
||||||
|
|
||||||
return new CenCi33Controller(dc.Key, dc.Name, config, cardCage);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Crestron.SimplSharpPro.ThreeSeriesCards;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
||||||
|
{
|
||||||
|
public class CenCi33ControllerFactory : EssentialsDeviceFactory<CenCi33Controller>
|
||||||
|
{
|
||||||
|
public CenCi33ControllerFactory()
|
||||||
|
{
|
||||||
|
TypeNames = new List<string> {"cenci33"};
|
||||||
|
}
|
||||||
|
#region Overrides of EssentialsDeviceFactory<CenCi33Controller>
|
||||||
|
|
||||||
|
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||||
|
{
|
||||||
|
Debug.Console(1, "Factory attempting to build new CEN-CI-3");
|
||||||
|
|
||||||
|
var controlProperties = CommFactory.GetControlPropertiesConfig(dc);
|
||||||
|
var ipId = controlProperties.IpIdInt;
|
||||||
|
|
||||||
|
var cardCage = new CenCi33(ipId, Global.ControlSystem);
|
||||||
|
var config = dc.Properties.ToObject<CenCi33Configuration>();
|
||||||
|
|
||||||
|
return new CenCi33Controller(dc.Key, dc.Name, config, cardCage);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
extern alias Full;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Full::Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
||||||
|
{
|
||||||
|
public class InternalCardCageConfiguration
|
||||||
|
{
|
||||||
|
[JsonProperty("cards")]
|
||||||
|
public Dictionary<uint, string> Cards { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,9 +3,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Crestron.SimplSharpPro.ThreeSeriesCards;
|
using Crestron.SimplSharpPro.ThreeSeriesCards;
|
||||||
using Full.Newtonsoft.Json;
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
||||||
{
|
{
|
||||||
@@ -108,36 +106,4 @@ namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class InternalCardCageConfiguration
|
|
||||||
{
|
|
||||||
[JsonProperty("cards")]
|
|
||||||
public Dictionary<uint, string> Cards { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class InternalCardCageControllerFactory : EssentialsDeviceFactory<InternalCardCageController>
|
|
||||||
{
|
|
||||||
public InternalCardCageControllerFactory()
|
|
||||||
{
|
|
||||||
TypeNames = new List<string> {"internalcardcage"};
|
|
||||||
}
|
|
||||||
#region Overrides of EssentialsDeviceFactory<InternalCardCageController>
|
|
||||||
|
|
||||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
|
||||||
{
|
|
||||||
Debug.Console(1, "Factory attempting to build new Internal Card Cage Controller");
|
|
||||||
|
|
||||||
if (!Global.ControlSystem.SupportsThreeSeriesPlugInCards)
|
|
||||||
{
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Warning, "Current control system does NOT support 3-Series cards. Everything is NOT awesome.");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
var config = dc.Properties.ToObject<InternalCardCageConfiguration>();
|
|
||||||
|
|
||||||
return new InternalCardCageController(dc.Key, dc.Name, config);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
||||||
|
{
|
||||||
|
public class InternalCardCageControllerFactory : EssentialsDeviceFactory<InternalCardCageController>
|
||||||
|
{
|
||||||
|
public InternalCardCageControllerFactory()
|
||||||
|
{
|
||||||
|
TypeNames = new List<string> {"internalcardcage"};
|
||||||
|
}
|
||||||
|
#region Overrides of EssentialsDeviceFactory<InternalCardCageController>
|
||||||
|
|
||||||
|
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||||
|
{
|
||||||
|
Debug.Console(1, "Factory attempting to build new Internal Card Cage Controller");
|
||||||
|
|
||||||
|
if (!Global.ControlSystem.SupportsThreeSeriesPlugInCards)
|
||||||
|
{
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Warning, "Current control system does NOT support 3-Series cards. Everything is NOT awesome.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var config = dc.Properties.ToObject<InternalCardCageConfiguration>();
|
||||||
|
|
||||||
|
return new InternalCardCageController(dc.Key, dc.Name, config);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
using Crestron.SimplSharpPro.GeneralIO;
|
using Crestron.SimplSharpPro.GeneralIO;
|
||||||
using PepperDash.Core;
|
|
||||||
using PepperDash.Essentials.Core.Bridges;
|
using PepperDash.Essentials.Core.Bridges;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
|
||||||
@@ -39,42 +37,4 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DinIo8ControllerFactory : EssentialsDeviceFactory<DinIo8Controller>
|
|
||||||
{
|
|
||||||
public DinIo8ControllerFactory()
|
|
||||||
{
|
|
||||||
TypeNames = new List<string>() { "DinIo8" };
|
|
||||||
}
|
|
||||||
|
|
||||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
|
||||||
{
|
|
||||||
Debug.Console(1, "Factory Attempting to create new DinIo8 Device");
|
|
||||||
|
|
||||||
return new DinIo8Controller(dc.Key, GetDinIo8Device, dc);
|
|
||||||
}
|
|
||||||
|
|
||||||
static DinIo8 GetDinIo8Device(DeviceConfig dc)
|
|
||||||
{
|
|
||||||
var control = CommFactory.GetControlPropertiesConfig(dc);
|
|
||||||
var cresnetId = control.CresnetIdInt;
|
|
||||||
var branchId = control.ControlPortNumber;
|
|
||||||
var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
|
|
||||||
|
|
||||||
if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
|
|
||||||
{
|
|
||||||
Debug.Console(0, "Device {0} is a valid cresnet master - creating new DinIo8", parentKey);
|
|
||||||
return new DinIo8(cresnetId, Global.ControlSystem);
|
|
||||||
}
|
|
||||||
var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches;
|
|
||||||
|
|
||||||
if (cresnetBridge != null)
|
|
||||||
{
|
|
||||||
Debug.Console(0, "Device {0} is a valid cresnet master - creating new DinIo8", parentKey);
|
|
||||||
return new DinIo8(cresnetId, cresnetBridge.CresnetBranches[branchId]);
|
|
||||||
}
|
|
||||||
Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Crestron.SimplSharpPro.GeneralIO;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.CrestronIO
|
||||||
|
{
|
||||||
|
public class DinIo8ControllerFactory : EssentialsDeviceFactory<DinIo8Controller>
|
||||||
|
{
|
||||||
|
public DinIo8ControllerFactory()
|
||||||
|
{
|
||||||
|
TypeNames = new List<string>() { "DinIo8" };
|
||||||
|
}
|
||||||
|
|
||||||
|
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||||
|
{
|
||||||
|
Debug.Console(1, "Factory Attempting to create new DinIo8 Device");
|
||||||
|
|
||||||
|
return new DinIo8Controller(dc.Key, GetDinIo8Device, dc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DinIo8 GetDinIo8Device(DeviceConfig dc)
|
||||||
|
{
|
||||||
|
var control = CommFactory.GetControlPropertiesConfig(dc);
|
||||||
|
var cresnetId = control.CresnetIdInt;
|
||||||
|
var branchId = control.ControlPortNumber;
|
||||||
|
var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
|
||||||
|
|
||||||
|
if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
Debug.Console(0, "Device {0} is a valid cresnet master - creating new DinIo8", parentKey);
|
||||||
|
return new DinIo8(cresnetId, Global.ControlSystem);
|
||||||
|
}
|
||||||
|
var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches;
|
||||||
|
|
||||||
|
if (cresnetBridge != null)
|
||||||
|
{
|
||||||
|
Debug.Console(0, "Device {0} is a valid cresnet master - creating new DinIo8", parentKey);
|
||||||
|
return new DinIo8(cresnetId, cresnetBridge.CresnetBranches[branchId]);
|
||||||
|
}
|
||||||
|
Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,14 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.GeneralIO;
|
using Crestron.SimplSharpPro.GeneralIO;
|
||||||
using PepperDash.Essentials.Core.Config;
|
|
||||||
|
|
||||||
|
|
||||||
using PepperDash.Core;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
@@ -40,30 +35,4 @@ namespace PepperDash.Essentials.Core
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CenIoDigIn104ControllerFactory : EssentialsDeviceFactory<CenIoDigIn104Controller>
|
|
||||||
{
|
|
||||||
public CenIoDigIn104ControllerFactory()
|
|
||||||
{
|
|
||||||
TypeNames = new List<string>() { "ceniodigin104" };
|
|
||||||
}
|
|
||||||
|
|
||||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
|
||||||
{
|
|
||||||
Debug.Console(1, "Factory Attempting to create new CEN-DIGIN-104 Device");
|
|
||||||
|
|
||||||
var control = CommFactory.GetControlPropertiesConfig(dc);
|
|
||||||
if (control == null)
|
|
||||||
{
|
|
||||||
Debug.Console(1, "Factory failed to create a new CEN-DIGIN-104 Device, control properties not found");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
var ipid = control.IpIdInt;
|
|
||||||
if (ipid != 0) return new CenIoDigIn104Controller(dc.Key, dc.Name, new CenIoDi104(ipid, Global.ControlSystem));
|
|
||||||
|
|
||||||
Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device using IP-ID-{0}", ipid);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Crestron.SimplSharpPro.GeneralIO;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
public class CenIoDigIn104ControllerFactory : EssentialsDeviceFactory<CenIoDigIn104Controller>
|
||||||
|
{
|
||||||
|
public CenIoDigIn104ControllerFactory()
|
||||||
|
{
|
||||||
|
TypeNames = new List<string>() { "ceniodigin104" };
|
||||||
|
}
|
||||||
|
|
||||||
|
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||||
|
{
|
||||||
|
Debug.Console(1, "Factory Attempting to create new CEN-DIGIN-104 Device");
|
||||||
|
|
||||||
|
var control = CommFactory.GetControlPropertiesConfig(dc);
|
||||||
|
if (control == null)
|
||||||
|
{
|
||||||
|
Debug.Console(1, "Factory failed to create a new CEN-DIGIN-104 Device, control properties not found");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var ipid = control.IpIdInt;
|
||||||
|
if (ipid != 0) return new CenIoDigIn104Controller(dc.Key, dc.Name, new CenIoDi104(ipid, Global.ControlSystem));
|
||||||
|
|
||||||
|
Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device using IP-ID-{0}", ipid);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
extern alias Full;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Full::Newtonsoft.Json;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.CrestronIO
|
||||||
|
{
|
||||||
|
public class GenericVersiportAbalogInputDeviceFactory : EssentialsDeviceFactory<GenericVersiportAnalogInputDevice>
|
||||||
|
{
|
||||||
|
public GenericVersiportAbalogInputDeviceFactory()
|
||||||
|
{
|
||||||
|
TypeNames = new List<string>() { "versiportanaloginput" };
|
||||||
|
}
|
||||||
|
|
||||||
|
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||||
|
{
|
||||||
|
Debug.Console(1, "Factory Attempting to create new Generic Versiport Device");
|
||||||
|
|
||||||
|
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());
|
||||||
|
|
||||||
|
if (props == null) return null;
|
||||||
|
|
||||||
|
var portDevice = new GenericVersiportAnalogInputDevice(dc.Key, dc.Name, GenericVersiportAnalogInputDevice.GetVersiportDigitalInput, props);
|
||||||
|
|
||||||
|
return portDevice;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
extern alias Full;
|
extern alias Full;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
@@ -9,7 +8,6 @@ using Crestron.SimplSharpPro;
|
|||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
|
||||||
using PepperDash.Essentials.Core.Bridges;
|
using PepperDash.Essentials.Core.Bridges;
|
||||||
|
|
||||||
|
|
||||||
@@ -185,26 +183,4 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class GenericVersiportAbalogInputDeviceFactory : EssentialsDeviceFactory<GenericVersiportAnalogInputDevice>
|
|
||||||
{
|
|
||||||
public GenericVersiportAbalogInputDeviceFactory()
|
|
||||||
{
|
|
||||||
TypeNames = new List<string>() { "versiportanaloginput" };
|
|
||||||
}
|
|
||||||
|
|
||||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
|
||||||
{
|
|
||||||
Debug.Console(1, "Factory Attempting to create new Generic Versiport Device");
|
|
||||||
|
|
||||||
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());
|
|
||||||
|
|
||||||
if (props == null) return null;
|
|
||||||
|
|
||||||
var portDevice = new GenericVersiportAnalogInputDevice(dc.Key, dc.Name, GenericVersiportAnalogInputDevice.GetVersiportDigitalInput, props);
|
|
||||||
|
|
||||||
return portDevice;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
extern alias Full;
|
extern alias Full;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
@@ -9,7 +8,6 @@ using Crestron.SimplSharpPro;
|
|||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
|
||||||
using PepperDash.Essentials.Core.Bridges;
|
using PepperDash.Essentials.Core.Bridges;
|
||||||
|
|
||||||
|
|
||||||
@@ -145,26 +143,4 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class GenericVersiportDigitalInputDeviceFactory : EssentialsDeviceFactory<GenericVersiportDigitalInputDevice>
|
|
||||||
{
|
|
||||||
public GenericVersiportDigitalInputDeviceFactory()
|
|
||||||
{
|
|
||||||
TypeNames = new List<string>() { "versiportinput" };
|
|
||||||
}
|
|
||||||
|
|
||||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
|
||||||
{
|
|
||||||
Debug.Console(1, "Factory Attempting to create new Generic Versiport Device");
|
|
||||||
|
|
||||||
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());
|
|
||||||
|
|
||||||
if (props == null) return null;
|
|
||||||
|
|
||||||
var portDevice = new GenericVersiportDigitalInputDevice(dc.Key, dc.Name, GenericVersiportDigitalInputDevice.GetVersiportDigitalInput, props);
|
|
||||||
|
|
||||||
return portDevice;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
extern alias Full;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Full::Newtonsoft.Json;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.CrestronIO
|
||||||
|
{
|
||||||
|
public class GenericVersiportDigitalInputDeviceFactory : EssentialsDeviceFactory<GenericVersiportDigitalInputDevice>
|
||||||
|
{
|
||||||
|
public GenericVersiportDigitalInputDeviceFactory()
|
||||||
|
{
|
||||||
|
TypeNames = new List<string>() { "versiportinput" };
|
||||||
|
}
|
||||||
|
|
||||||
|
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||||
|
{
|
||||||
|
Debug.Console(1, "Factory Attempting to create new Generic Versiport Device");
|
||||||
|
|
||||||
|
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());
|
||||||
|
|
||||||
|
if (props == null) return null;
|
||||||
|
|
||||||
|
var portDevice = new GenericVersiportDigitalInputDevice(dc.Key, dc.Name, GenericVersiportDigitalInputDevice.GetVersiportDigitalInput, props);
|
||||||
|
|
||||||
|
return portDevice;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,14 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.GeneralIO;
|
using Crestron.SimplSharpPro.GeneralIO;
|
||||||
using PepperDash.Essentials.Core.Config;
|
|
||||||
|
|
||||||
|
|
||||||
using PepperDash.Core;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
@@ -52,42 +47,4 @@ namespace PepperDash.Essentials.Core
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// CEN-IO-IR-104 controller fatory
|
|
||||||
/// </summary>
|
|
||||||
public class CenIoIr104ControllerFactory : EssentialsDeviceFactory<CenIoIr104Controller>
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor
|
|
||||||
/// </summary>
|
|
||||||
public CenIoIr104ControllerFactory()
|
|
||||||
{
|
|
||||||
TypeNames = new List<string>() { "cenioir104" };
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Build device CEN-IO-IR-104
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dc"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
|
||||||
{
|
|
||||||
Debug.Console(1, "Factory Attempting to create new CEN-IO-IR-104 Device");
|
|
||||||
|
|
||||||
var control = CommFactory.GetControlPropertiesConfig(dc);
|
|
||||||
if (control == null)
|
|
||||||
{
|
|
||||||
Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device, control properties not found");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
var ipid = control.IpIdInt;
|
|
||||||
if(ipid != 0) return new CenIoIr104Controller(dc.Key, dc.Name, new CenIoIr104(ipid, Global.ControlSystem));
|
|
||||||
|
|
||||||
Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device using IP-ID-{0}", ipid);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Crestron.SimplSharpPro.GeneralIO;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// CEN-IO-IR-104 controller fatory
|
||||||
|
/// </summary>
|
||||||
|
public class CenIoIr104ControllerFactory : EssentialsDeviceFactory<CenIoIr104Controller>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
public CenIoIr104ControllerFactory()
|
||||||
|
{
|
||||||
|
TypeNames = new List<string>() { "cenioir104" };
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Build device CEN-IO-IR-104
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dc"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||||
|
{
|
||||||
|
Debug.Console(1, "Factory Attempting to create new CEN-IO-IR-104 Device");
|
||||||
|
|
||||||
|
var control = CommFactory.GetControlPropertiesConfig(dc);
|
||||||
|
if (control == null)
|
||||||
|
{
|
||||||
|
Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device, control properties not found");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var ipid = control.IpIdInt;
|
||||||
|
if(ipid != 0) return new CenIoIr104Controller(dc.Key, dc.Name, new CenIoIr104(ipid, Global.ControlSystem));
|
||||||
|
|
||||||
|
Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device using IP-ID-{0}", ipid);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
extern alias Full;
|
extern alias Full;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
@@ -9,7 +8,6 @@ using Crestron.SimplSharpPro;
|
|||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
|
||||||
using PepperDash.Essentials.Core.Bridges;
|
using PepperDash.Essentials.Core.Bridges;
|
||||||
|
|
||||||
|
|
||||||
@@ -166,26 +164,4 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class GenericVersiportDigitalOutputDeviceFactory : EssentialsDeviceFactory<GenericVersiportDigitalInputDevice>
|
|
||||||
{
|
|
||||||
public GenericVersiportDigitalOutputDeviceFactory()
|
|
||||||
{
|
|
||||||
TypeNames = new List<string>() { "versiportoutput" };
|
|
||||||
}
|
|
||||||
|
|
||||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
|
||||||
{
|
|
||||||
Debug.Console(1, "Factory Attempting to create new Generic Versiport Device");
|
|
||||||
|
|
||||||
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());
|
|
||||||
|
|
||||||
if (props == null) return null;
|
|
||||||
|
|
||||||
var portDevice = new GenericVersiportDigitalOutputDevice(dc.Key, dc.Name, GenericVersiportDigitalOutputDevice.GetVersiportDigitalOutput, props);
|
|
||||||
|
|
||||||
return portDevice;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
extern alias Full;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Full::Newtonsoft.Json;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.CrestronIO
|
||||||
|
{
|
||||||
|
public class GenericVersiportDigitalOutputDeviceFactory : EssentialsDeviceFactory<GenericVersiportDigitalInputDevice>
|
||||||
|
{
|
||||||
|
public GenericVersiportDigitalOutputDeviceFactory()
|
||||||
|
{
|
||||||
|
TypeNames = new List<string>() { "versiportoutput" };
|
||||||
|
}
|
||||||
|
|
||||||
|
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||||
|
{
|
||||||
|
Debug.Console(1, "Factory Attempting to create new Generic Versiport Device");
|
||||||
|
|
||||||
|
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());
|
||||||
|
|
||||||
|
if (props == null) return null;
|
||||||
|
|
||||||
|
var portDevice = new GenericVersiportDigitalOutputDevice(dc.Key, dc.Name, GenericVersiportDigitalOutputDevice.GetVersiportDigitalOutput, props);
|
||||||
|
|
||||||
|
return portDevice;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro;
|
|
||||||
using Crestron.SimplSharpPro.GeneralIO;
|
using Crestron.SimplSharpPro.GeneralIO;
|
||||||
using PepperDash.Core;
|
|
||||||
using PepperDash.Essentials.Core.Config;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
@@ -42,36 +39,4 @@ namespace PepperDash.Essentials.Core
|
|||||||
get { return _ry104.NumberOfRelayPorts; }
|
get { return _ry104.NumberOfRelayPorts; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// CEN-IO-RY Controller factory
|
|
||||||
/// </summary>
|
|
||||||
public class CenIoRy104ControllerFactory : EssentialsDeviceFactory<CenIoRy104Controller>
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor
|
|
||||||
/// </summary>
|
|
||||||
public CenIoRy104ControllerFactory()
|
|
||||||
{
|
|
||||||
TypeNames = new List<string>() { "ceniory104" };
|
|
||||||
}
|
|
||||||
|
|
||||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
|
||||||
{
|
|
||||||
Debug.Console(1, "Factory Attempting to create a new CEN-IO-RY-104 Device");
|
|
||||||
|
|
||||||
var controlPropertiesConfig = CommFactory.GetControlPropertiesConfig(dc);
|
|
||||||
if (controlPropertiesConfig == null)
|
|
||||||
{
|
|
||||||
Debug.Console(1, "Factory failed to create a new CEN-IO-RY-104 Device, control properties not found");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
var ipid = controlPropertiesConfig.IpIdInt;
|
|
||||||
if (ipid != 0) return new CenIoRy104Controller(dc.Key, dc.Name, new CenIoRy104(ipid, Global.ControlSystem));
|
|
||||||
|
|
||||||
Debug.Console(1, "Factory failed to create a new CEN-IO-RY-104 Device using IP-ID-{0}", ipid);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Crestron.SimplSharpPro.GeneralIO;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// CEN-IO-RY Controller factory
|
||||||
|
/// </summary>
|
||||||
|
public class CenIoRy104ControllerFactory : EssentialsDeviceFactory<CenIoRy104Controller>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
public CenIoRy104ControllerFactory()
|
||||||
|
{
|
||||||
|
TypeNames = new List<string>() { "ceniory104" };
|
||||||
|
}
|
||||||
|
|
||||||
|
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||||
|
{
|
||||||
|
Debug.Console(1, "Factory Attempting to create a new CEN-IO-RY-104 Device");
|
||||||
|
|
||||||
|
var controlPropertiesConfig = CommFactory.GetControlPropertiesConfig(dc);
|
||||||
|
if (controlPropertiesConfig == null)
|
||||||
|
{
|
||||||
|
Debug.Console(1, "Factory failed to create a new CEN-IO-RY-104 Device, control properties not found");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var ipid = controlPropertiesConfig.IpIdInt;
|
||||||
|
if (ipid != 0) return new CenIoRy104Controller(dc.Key, dc.Name, new CenIoRy104(ipid, Global.ControlSystem));
|
||||||
|
|
||||||
|
Debug.Console(1, "Factory failed to create a new CEN-IO-RY-104 Device using IP-ID-{0}", ipid);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
@@ -18,9 +17,4 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
|||||||
void On();
|
void On();
|
||||||
void Off();
|
void Off();
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface ISwitchedOutputCollection
|
|
||||||
{
|
|
||||||
Dictionary<uint, ISwitchedOutput> SwitchedOutputs { get; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.CrestronIO
|
||||||
|
{
|
||||||
|
public interface ISwitchedOutputCollection
|
||||||
|
{
|
||||||
|
Dictionary<uint, ISwitchedOutput> SwitchedOutputs { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Core.JsonStandardObjects;
|
using PepperDash.Core.JsonStandardObjects;
|
||||||
using PepperDash.Essentials.Core.Bridges;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
@@ -170,46 +168,6 @@ namespace PepperDash.Essentials.Core
|
|||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class CrestronGenericBridgeableBaseDevice : CrestronGenericBaseDevice, IBridgeAdvanced
|
|
||||||
{
|
|
||||||
protected CrestronGenericBridgeableBaseDevice(string key, string name, GenericBase hardware) : base(key, name, hardware)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected CrestronGenericBridgeableBaseDevice(string key, string name)
|
//***********************************************************************************
|
||||||
: base(key, name)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public abstract void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//***********************************************************************************
|
|
||||||
public class CrestronGenericBaseDeviceEventIds
|
|
||||||
{
|
|
||||||
public const uint IsOnline = 1;
|
|
||||||
public const uint IpConnectionsText =2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds logging to Register() failure
|
|
||||||
/// </summary>
|
|
||||||
public static class GenericBaseExtensions
|
|
||||||
{
|
|
||||||
public static eDeviceRegistrationUnRegistrationResponse RegisterWithLogging(this GenericBase device, string key)
|
|
||||||
{
|
|
||||||
var result = device.Register();
|
|
||||||
var level = result == eDeviceRegistrationUnRegistrationResponse.Success ?
|
|
||||||
Debug.ErrorLogLevel.Notice : Debug.ErrorLogLevel.Error;
|
|
||||||
Debug.Console(0, level, "Register device result: '{0}', type '{1}', result {2}", key, device, result);
|
|
||||||
//if (result != eDeviceRegistrationUnRegistrationResponse.Success)
|
|
||||||
//{
|
|
||||||
// Debug.Console(0, Debug.ErrorLogLevel.Error, "Cannot register device '{0}': {1}", key, result);
|
|
||||||
//}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
public class CrestronGenericBaseDeviceEventIds
|
||||||
|
{
|
||||||
|
public const uint IsOnline = 1;
|
||||||
|
public const uint IpConnectionsText =2;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
using PepperDash.Essentials.Core.Bridges;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
public abstract class CrestronGenericBridgeableBaseDevice : CrestronGenericBaseDevice, IBridgeAdvanced
|
||||||
|
{
|
||||||
|
protected CrestronGenericBridgeableBaseDevice(string key, string name, GenericBase hardware) : base(key, name, hardware)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected CrestronGenericBridgeableBaseDevice(string key, string name)
|
||||||
|
: base(key, name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public abstract void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
using PepperDash.Core;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Adds logging to Register() failure
|
||||||
|
/// </summary>
|
||||||
|
public static class GenericBaseExtensions
|
||||||
|
{
|
||||||
|
public static eDeviceRegistrationUnRegistrationResponse RegisterWithLogging(this GenericBase device, string key)
|
||||||
|
{
|
||||||
|
var result = device.Register();
|
||||||
|
var level = result == eDeviceRegistrationUnRegistrationResponse.Success ?
|
||||||
|
Debug.ErrorLogLevel.Notice : Debug.ErrorLogLevel.Error;
|
||||||
|
Debug.Console(0, level, "Register device result: '{0}', type '{1}', result {2}", key, device, result);
|
||||||
|
//if (result != eDeviceRegistrationUnRegistrationResponse.Success)
|
||||||
|
//{
|
||||||
|
// Debug.Console(0, Debug.ErrorLogLevel.Error, "Cannot register device '{0}': {1}", key, result);
|
||||||
|
//}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
using PepperDash.Core;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.DeviceInfo
|
||||||
|
{
|
||||||
|
public delegate void DeviceInfoChangeHandler(IKeyed device, DeviceInfoEventArgs args);
|
||||||
|
}
|
||||||
@@ -11,6 +11,4 @@ namespace PepperDash.Essentials.Core.DeviceInfo
|
|||||||
|
|
||||||
void UpdateDeviceInfo();
|
void UpdateDeviceInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
public delegate void DeviceInfoChangeHandler(IKeyed device, DeviceInfoEventArgs args);
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
|
||||||
|
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.SmartObjects;
|
using PepperDash.Essentials.Core.SmartObjects;
|
||||||
|
|
||||||
@@ -18,30 +16,4 @@ namespace PepperDash.Essentials.Core
|
|||||||
void Info(bool pressRelease);
|
void Info(bool pressRelease);
|
||||||
void Exit(bool pressRelease);
|
void Exit(bool pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public static class IChannelExtensions
|
|
||||||
{
|
|
||||||
public static void LinkButtons(this IChannel dev, BasicTriList triList)
|
|
||||||
{
|
|
||||||
triList.SetBoolSigAction(123, dev.ChannelUp);
|
|
||||||
triList.SetBoolSigAction(124, dev.ChannelDown);
|
|
||||||
triList.SetBoolSigAction(125, dev.LastChannel);
|
|
||||||
triList.SetBoolSigAction(137, dev.Guide);
|
|
||||||
triList.SetBoolSigAction(129, dev.Info);
|
|
||||||
triList.SetBoolSigAction(134, dev.Exit);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void UnlinkButtons(this IChannel dev, BasicTriList triList)
|
|
||||||
{
|
|
||||||
triList.ClearBoolSigAction(123);
|
|
||||||
triList.ClearBoolSigAction(124);
|
|
||||||
triList.ClearBoolSigAction(125);
|
|
||||||
triList.ClearBoolSigAction(137);
|
|
||||||
triList.ClearBoolSigAction(129);
|
|
||||||
triList.ClearBoolSigAction(134);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public static class IChannelExtensions
|
||||||
|
{
|
||||||
|
public static void LinkButtons(this IChannel dev, BasicTriList triList)
|
||||||
|
{
|
||||||
|
triList.SetBoolSigAction(123, dev.ChannelUp);
|
||||||
|
triList.SetBoolSigAction(124, dev.ChannelDown);
|
||||||
|
triList.SetBoolSigAction(125, dev.LastChannel);
|
||||||
|
triList.SetBoolSigAction(137, dev.Guide);
|
||||||
|
triList.SetBoolSigAction(129, dev.Info);
|
||||||
|
triList.SetBoolSigAction(134, dev.Exit);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void UnlinkButtons(this IChannel dev, BasicTriList triList)
|
||||||
|
{
|
||||||
|
triList.ClearBoolSigAction(123);
|
||||||
|
triList.ClearBoolSigAction(124);
|
||||||
|
triList.ClearBoolSigAction(125);
|
||||||
|
triList.ClearBoolSigAction(137);
|
||||||
|
triList.ClearBoolSigAction(129);
|
||||||
|
triList.ClearBoolSigAction(134);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public interface IColor
|
||||||
|
{
|
||||||
|
void Red(bool pressRelease);
|
||||||
|
void Green(bool pressRelease);
|
||||||
|
void Yellow(bool pressRelease);
|
||||||
|
void Blue(bool pressRelease);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,18 +6,7 @@ using PepperDash.Essentials.Core.SmartObjects;
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public interface IColor
|
|
||||||
{
|
|
||||||
void Red(bool pressRelease);
|
|
||||||
void Green(bool pressRelease);
|
|
||||||
void Yellow(bool pressRelease);
|
|
||||||
void Blue(bool pressRelease);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class IColorExtensions
|
public static class IColorExtensions
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.SmartObjects;
|
using PepperDash.Essentials.Core.SmartObjects;
|
||||||
@@ -19,32 +18,4 @@ namespace PepperDash.Essentials.Core
|
|||||||
void Menu(bool pressRelease);
|
void Menu(bool pressRelease);
|
||||||
void Exit(bool pressRelease);
|
void Exit(bool pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public static class IDPadExtensions
|
|
||||||
{
|
|
||||||
public static void LinkButtons(this IDPad dev, BasicTriList triList)
|
|
||||||
{
|
|
||||||
triList.SetBoolSigAction(138, dev.Up);
|
|
||||||
triList.SetBoolSigAction(139, dev.Down);
|
|
||||||
triList.SetBoolSigAction(140, dev.Left);
|
|
||||||
triList.SetBoolSigAction(141, dev.Right);
|
|
||||||
triList.SetBoolSigAction(142, dev.Select);
|
|
||||||
triList.SetBoolSigAction(130, dev.Menu);
|
|
||||||
triList.SetBoolSigAction(134, dev.Exit);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void UnlinkButtons(this IDPad dev, BasicTriList triList)
|
|
||||||
{
|
|
||||||
triList.ClearBoolSigAction(138);
|
|
||||||
triList.ClearBoolSigAction(139);
|
|
||||||
triList.ClearBoolSigAction(140);
|
|
||||||
triList.ClearBoolSigAction(141);
|
|
||||||
triList.ClearBoolSigAction(142);
|
|
||||||
triList.ClearBoolSigAction(130);
|
|
||||||
triList.ClearBoolSigAction(134);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public static class IDPadExtensions
|
||||||
|
{
|
||||||
|
public static void LinkButtons(this IDPad dev, BasicTriList triList)
|
||||||
|
{
|
||||||
|
triList.SetBoolSigAction(138, dev.Up);
|
||||||
|
triList.SetBoolSigAction(139, dev.Down);
|
||||||
|
triList.SetBoolSigAction(140, dev.Left);
|
||||||
|
triList.SetBoolSigAction(141, dev.Right);
|
||||||
|
triList.SetBoolSigAction(142, dev.Select);
|
||||||
|
triList.SetBoolSigAction(130, dev.Menu);
|
||||||
|
triList.SetBoolSigAction(134, dev.Exit);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void UnlinkButtons(this IDPad dev, BasicTriList triList)
|
||||||
|
{
|
||||||
|
triList.ClearBoolSigAction(138);
|
||||||
|
triList.ClearBoolSigAction(139);
|
||||||
|
triList.ClearBoolSigAction(140);
|
||||||
|
triList.ClearBoolSigAction(141);
|
||||||
|
triList.ClearBoolSigAction(142);
|
||||||
|
triList.ClearBoolSigAction(130);
|
||||||
|
triList.ClearBoolSigAction(134);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,8 +4,6 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
|
||||||
|
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.SmartObjects;
|
using PepperDash.Essentials.Core.SmartObjects;
|
||||||
|
|
||||||
@@ -19,22 +17,4 @@ namespace PepperDash.Essentials.Core
|
|||||||
void DvrList(bool pressRelease);
|
void DvrList(bool pressRelease);
|
||||||
void Record(bool pressRelease);
|
void Record(bool pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public static class IDvrExtensions
|
|
||||||
{
|
|
||||||
public static void LinkButtons(this IDvr dev, BasicTriList triList)
|
|
||||||
{
|
|
||||||
triList.SetBoolSigAction(136, dev.DvrList);
|
|
||||||
triList.SetBoolSigAction(152, dev.Record);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void UnlinkButtons(this IDvr dev, BasicTriList triList)
|
|
||||||
{
|
|
||||||
triList.ClearBoolSigAction(136);
|
|
||||||
triList.ClearBoolSigAction(152);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public static class IDvrExtensions
|
||||||
|
{
|
||||||
|
public static void LinkButtons(this IDvr dev, BasicTriList triList)
|
||||||
|
{
|
||||||
|
triList.SetBoolSigAction(136, dev.DvrList);
|
||||||
|
triList.SetBoolSigAction(152, dev.Record);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void UnlinkButtons(this IDvr dev, BasicTriList triList)
|
||||||
|
{
|
||||||
|
triList.ClearBoolSigAction(136);
|
||||||
|
triList.ClearBoolSigAction(152);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Defines the ability to power a device on and off
|
||||||
|
/// </summary>
|
||||||
|
public interface IHasPowerControl
|
||||||
|
{
|
||||||
|
void PowerOn();
|
||||||
|
void PowerOff();
|
||||||
|
void PowerToggle();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public static class IHasPowerControlExtensions
|
||||||
|
{
|
||||||
|
public static void LinkButtons(this IHasPowerControl dev, BasicTriList triList)
|
||||||
|
{
|
||||||
|
triList.SetSigFalseAction(101, dev.PowerOn);
|
||||||
|
triList.SetSigFalseAction(102, dev.PowerOff);
|
||||||
|
triList.SetSigFalseAction(103, dev.PowerToggle);
|
||||||
|
|
||||||
|
var fbdev = dev as IHasPowerControlWithFeedback;
|
||||||
|
if (fbdev != null)
|
||||||
|
{
|
||||||
|
fbdev.PowerIsOnFeedback.LinkInputSig(triList.BooleanInput[101]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void UnlinkButtons(this IHasPowerControl dev, BasicTriList triList)
|
||||||
|
{
|
||||||
|
triList.ClearBoolSigAction(101);
|
||||||
|
triList.ClearBoolSigAction(102);
|
||||||
|
triList.ClearBoolSigAction(103);
|
||||||
|
|
||||||
|
var fbdev = dev as IHasPowerControlWithFeedback;
|
||||||
|
if (fbdev != null)
|
||||||
|
{
|
||||||
|
fbdev.PowerIsOnFeedback.UnlinkInputSig(triList.BooleanInput[101]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Adds feedback for current power state
|
||||||
|
/// </summary>
|
||||||
|
public interface IHasPowerControlWithFeedback : IHasPowerControl
|
||||||
|
{
|
||||||
|
BoolFeedback PowerIsOnFeedback { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using PepperDash.Core;
|
||||||
using PepperDash.Core;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
|
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
|
||||||
{
|
{
|
||||||
@@ -12,34 +11,4 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
|
|||||||
|
|
||||||
void LinkSystemMonitorToAppServer();
|
void LinkSystemMonitorToAppServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Describes a MobileSystemController that accepts IEssentialsRoom
|
|
||||||
/// </summary>
|
|
||||||
public interface IMobileControl3 : IMobileControl
|
|
||||||
{
|
|
||||||
void CreateMobileControlRoomBridge(IEssentialsRoom room, IMobileControl parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Describes a MobileControl Room Bridge
|
|
||||||
/// </summary>
|
|
||||||
public interface IMobileControlRoomBridge : IKeyed
|
|
||||||
{
|
|
||||||
event EventHandler<EventArgs> UserCodeChanged;
|
|
||||||
|
|
||||||
event EventHandler<EventArgs> UserPromptedForCode;
|
|
||||||
|
|
||||||
event EventHandler<EventArgs> ClientJoined;
|
|
||||||
|
|
||||||
string UserCode { get; }
|
|
||||||
|
|
||||||
string QrCodeUrl { get; }
|
|
||||||
|
|
||||||
string QrCodeChecksum { get; }
|
|
||||||
|
|
||||||
string McServerUrl { get; }
|
|
||||||
|
|
||||||
string RoomName { get; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Describes a MobileSystemController that accepts IEssentialsRoom
|
||||||
|
/// </summary>
|
||||||
|
public interface IMobileControl3 : IMobileControl
|
||||||
|
{
|
||||||
|
void CreateMobileControlRoomBridge(IEssentialsRoom room, IMobileControl parent);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
using PepperDash.Core;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Describes a MobileControl Room Bridge
|
||||||
|
/// </summary>
|
||||||
|
public interface IMobileControlRoomBridge : IKeyed
|
||||||
|
{
|
||||||
|
event EventHandler<EventArgs> UserCodeChanged;
|
||||||
|
|
||||||
|
event EventHandler<EventArgs> UserPromptedForCode;
|
||||||
|
|
||||||
|
event EventHandler<EventArgs> ClientJoined;
|
||||||
|
|
||||||
|
string UserCode { get; }
|
||||||
|
|
||||||
|
string QrCodeUrl { get; }
|
||||||
|
|
||||||
|
string QrCodeChecksum { get; }
|
||||||
|
|
||||||
|
string McServerUrl { get; }
|
||||||
|
|
||||||
|
string RoomName { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,45 +1,10 @@
|
|||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
using PepperDash.Core;
|
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.SmartObjects;
|
using PepperDash.Essentials.Core.SmartObjects;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public interface INumericKeypad:IKeyed
|
|
||||||
{
|
|
||||||
void Digit0(bool pressRelease);
|
|
||||||
void Digit1(bool pressRelease);
|
|
||||||
void Digit2(bool pressRelease);
|
|
||||||
void Digit3(bool pressRelease);
|
|
||||||
void Digit4(bool pressRelease);
|
|
||||||
void Digit5(bool pressRelease);
|
|
||||||
void Digit6(bool pressRelease);
|
|
||||||
void Digit7(bool pressRelease);
|
|
||||||
void Digit8(bool pressRelease);
|
|
||||||
void Digit9(bool pressRelease);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Used to hide/show the button and/or text on the left-hand keypad button
|
|
||||||
/// </summary>
|
|
||||||
bool HasKeypadAccessoryButton1 { get; }
|
|
||||||
string KeypadAccessoryButton1Label { get; }
|
|
||||||
void KeypadAccessoryButton1(bool pressRelease);
|
|
||||||
|
|
||||||
bool HasKeypadAccessoryButton2 { get; }
|
|
||||||
string KeypadAccessoryButton2Label { get; }
|
|
||||||
void KeypadAccessoryButton2(bool pressRelease);
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface ISetTopBoxNumericKeypad : INumericKeypad
|
|
||||||
{
|
|
||||||
void Dash(bool pressRelease);
|
|
||||||
void KeypadEnter(bool pressRelease);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class INumericExtensions
|
public static class INumericExtensions
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
using PepperDash.Core;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public interface INumericKeypad:IKeyed
|
||||||
|
{
|
||||||
|
void Digit0(bool pressRelease);
|
||||||
|
void Digit1(bool pressRelease);
|
||||||
|
void Digit2(bool pressRelease);
|
||||||
|
void Digit3(bool pressRelease);
|
||||||
|
void Digit4(bool pressRelease);
|
||||||
|
void Digit5(bool pressRelease);
|
||||||
|
void Digit6(bool pressRelease);
|
||||||
|
void Digit7(bool pressRelease);
|
||||||
|
void Digit8(bool pressRelease);
|
||||||
|
void Digit9(bool pressRelease);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Used to hide/show the button and/or text on the left-hand keypad button
|
||||||
|
/// </summary>
|
||||||
|
bool HasKeypadAccessoryButton1 { get; }
|
||||||
|
string KeypadAccessoryButton1Label { get; }
|
||||||
|
void KeypadAccessoryButton1(bool pressRelease);
|
||||||
|
|
||||||
|
bool HasKeypadAccessoryButton2 { get; }
|
||||||
|
string KeypadAccessoryButton2Label { get; }
|
||||||
|
void KeypadAccessoryButton2(bool pressRelease);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,35 +22,4 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// <param name="password"></param>
|
/// <param name="password"></param>
|
||||||
void SubmitPassword(string password);
|
void SubmitPassword(string password);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PasswordPromptEventArgs : EventArgs
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Indicates if the last submitted password was incorrect
|
|
||||||
/// </summary>
|
|
||||||
public bool LastAttemptWasIncorrect { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Indicates that the login attempt has failed
|
|
||||||
/// </summary>
|
|
||||||
public bool LoginAttemptFailed { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Indicates that the process was cancelled and the prompt should be dismissed
|
|
||||||
/// </summary>
|
|
||||||
public bool LoginAttemptCancelled { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A message to be displayed to the user
|
|
||||||
/// </summary>
|
|
||||||
public string Message { get; private set; }
|
|
||||||
|
|
||||||
public PasswordPromptEventArgs(bool lastAttemptIncorrect, bool loginFailed, bool loginCancelled, string message)
|
|
||||||
{
|
|
||||||
LastAttemptWasIncorrect = lastAttemptIncorrect;
|
|
||||||
LoginAttemptFailed = loginFailed;
|
|
||||||
LoginAttemptCancelled = loginCancelled;
|
|
||||||
Message = message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,6 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
|
||||||
using Crestron.SimplSharpPro.Fusion;
|
using Crestron.SimplSharpPro.Fusion;
|
||||||
|
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
@@ -24,54 +23,4 @@ namespace PepperDash.Essentials.Core
|
|||||||
void PowerToggle();
|
void PowerToggle();
|
||||||
BoolFeedback PowerIsOnFeedback { get; }
|
BoolFeedback PowerIsOnFeedback { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds feedback for current power state
|
|
||||||
/// </summary>
|
|
||||||
public interface IHasPowerControlWithFeedback : IHasPowerControl
|
|
||||||
{
|
|
||||||
BoolFeedback PowerIsOnFeedback { get; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Defines the ability to power a device on and off
|
|
||||||
/// </summary>
|
|
||||||
public interface IHasPowerControl
|
|
||||||
{
|
|
||||||
void PowerOn();
|
|
||||||
void PowerOff();
|
|
||||||
void PowerToggle();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public static class IHasPowerControlExtensions
|
|
||||||
{
|
|
||||||
public static void LinkButtons(this IHasPowerControl dev, BasicTriList triList)
|
|
||||||
{
|
|
||||||
triList.SetSigFalseAction(101, dev.PowerOn);
|
|
||||||
triList.SetSigFalseAction(102, dev.PowerOff);
|
|
||||||
triList.SetSigFalseAction(103, dev.PowerToggle);
|
|
||||||
|
|
||||||
var fbdev = dev as IHasPowerControlWithFeedback;
|
|
||||||
if (fbdev != null)
|
|
||||||
{
|
|
||||||
fbdev.PowerIsOnFeedback.LinkInputSig(triList.BooleanInput[101]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void UnlinkButtons(this IHasPowerControl dev, BasicTriList triList)
|
|
||||||
{
|
|
||||||
triList.ClearBoolSigAction(101);
|
|
||||||
triList.ClearBoolSigAction(102);
|
|
||||||
triList.ClearBoolSigAction(103);
|
|
||||||
|
|
||||||
var fbdev = dev as IHasPowerControlWithFeedback;
|
|
||||||
if (fbdev != null)
|
|
||||||
{
|
|
||||||
fbdev.PowerIsOnFeedback.UnlinkInputSig(triList.BooleanInput[101]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
using PepperDash.Essentials.Core;
|
|
||||||
using PepperDash.Essentials.Core.SmartObjects;
|
using PepperDash.Essentials.Core.SmartObjects;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
@@ -37,19 +35,4 @@ namespace PepperDash.Essentials.Core
|
|||||||
void DvrList(bool pressRelease);
|
void DvrList(bool pressRelease);
|
||||||
void Replay(bool pressRelease);
|
void Replay(bool pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ISetTopBoxControlsExtensions
|
|
||||||
{
|
|
||||||
public static void LinkButtons(this ISetTopBoxControls dev, BasicTriList triList)
|
|
||||||
{
|
|
||||||
triList.SetBoolSigAction(136, dev.DvrList);
|
|
||||||
triList.SetBoolSigAction(152, dev.Replay);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void UnlinkButtons(this ISetTopBoxControls dev, BasicTriList triList)
|
|
||||||
{
|
|
||||||
triList.ClearBoolSigAction(136);
|
|
||||||
triList.ClearBoolSigAction(152);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
public static class ISetTopBoxControlsExtensions
|
||||||
|
{
|
||||||
|
public static void LinkButtons(this ISetTopBoxControls dev, BasicTriList triList)
|
||||||
|
{
|
||||||
|
triList.SetBoolSigAction(136, dev.DvrList);
|
||||||
|
triList.SetBoolSigAction(152, dev.Replay);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void UnlinkButtons(this ISetTopBoxControls dev, BasicTriList triList)
|
||||||
|
{
|
||||||
|
triList.ClearBoolSigAction(136);
|
||||||
|
triList.ClearBoolSigAction(152);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
public interface ISetTopBoxNumericKeypad : INumericKeypad
|
||||||
|
{
|
||||||
|
void Dash(bool pressRelease);
|
||||||
|
void KeypadEnter(bool pressRelease);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
namespace PepperDash.Essentials.Core
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@@ -16,38 +14,4 @@ namespace PepperDash.Essentials.Core
|
|||||||
void Stop(bool pressRelease);
|
void Stop(bool pressRelease);
|
||||||
void Record(bool pressRelease);
|
void Record(bool pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public static class ITransportExtensions
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Attaches to trilist joins: Play:145, Pause:146, Stop:147, ChapPlus:148, ChapMinus:149, Rewind:150, Ffwd:151, Record:154
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public static void LinkButtons(this ITransport dev, BasicTriList triList)
|
|
||||||
{
|
|
||||||
triList.SetBoolSigAction(145, dev.Play);
|
|
||||||
triList.SetBoolSigAction(146, dev.Pause);
|
|
||||||
triList.SetBoolSigAction(147, dev.Stop);
|
|
||||||
triList.SetBoolSigAction(148, dev.ChapPlus);
|
|
||||||
triList.SetBoolSigAction(149, dev.ChapMinus);
|
|
||||||
triList.SetBoolSigAction(150, dev.Rewind);
|
|
||||||
triList.SetBoolSigAction(151, dev.FFwd);
|
|
||||||
triList.SetBoolSigAction(154, dev.Record);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void UnlinkButtons(this ITransport dev, BasicTriList triList)
|
|
||||||
{
|
|
||||||
triList.ClearBoolSigAction(145);
|
|
||||||
triList.ClearBoolSigAction(146);
|
|
||||||
triList.ClearBoolSigAction(147);
|
|
||||||
triList.ClearBoolSigAction(148);
|
|
||||||
triList.ClearBoolSigAction(149);
|
|
||||||
triList.ClearBoolSigAction(150);
|
|
||||||
triList.ClearBoolSigAction(151);
|
|
||||||
triList.ClearBoolSigAction(154);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public static class ITransportExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Attaches to trilist joins: Play:145, Pause:146, Stop:147, ChapPlus:148, ChapMinus:149, Rewind:150, Ffwd:151, Record:154
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public static void LinkButtons(this ITransport dev, BasicTriList triList)
|
||||||
|
{
|
||||||
|
triList.SetBoolSigAction(145, dev.Play);
|
||||||
|
triList.SetBoolSigAction(146, dev.Pause);
|
||||||
|
triList.SetBoolSigAction(147, dev.Stop);
|
||||||
|
triList.SetBoolSigAction(148, dev.ChapPlus);
|
||||||
|
triList.SetBoolSigAction(149, dev.ChapMinus);
|
||||||
|
triList.SetBoolSigAction(150, dev.Rewind);
|
||||||
|
triList.SetBoolSigAction(151, dev.FFwd);
|
||||||
|
triList.SetBoolSigAction(154, dev.Record);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void UnlinkButtons(this ITransport dev, BasicTriList triList)
|
||||||
|
{
|
||||||
|
triList.ClearBoolSigAction(145);
|
||||||
|
triList.ClearBoolSigAction(146);
|
||||||
|
triList.ClearBoolSigAction(147);
|
||||||
|
triList.ClearBoolSigAction(148);
|
||||||
|
triList.ClearBoolSigAction(149);
|
||||||
|
triList.ClearBoolSigAction(150);
|
||||||
|
triList.ClearBoolSigAction(151);
|
||||||
|
triList.ClearBoolSigAction(154);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
public class PasswordPromptEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates if the last submitted password was incorrect
|
||||||
|
/// </summary>
|
||||||
|
public bool LastAttemptWasIncorrect { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that the login attempt has failed
|
||||||
|
/// </summary>
|
||||||
|
public bool LoginAttemptFailed { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that the process was cancelled and the prompt should be dismissed
|
||||||
|
/// </summary>
|
||||||
|
public bool LoginAttemptCancelled { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A message to be displayed to the user
|
||||||
|
/// </summary>
|
||||||
|
public string Message { get; private set; }
|
||||||
|
|
||||||
|
public PasswordPromptEventArgs(bool lastAttemptIncorrect, bool loginFailed, bool loginCancelled, string message)
|
||||||
|
{
|
||||||
|
LastAttemptWasIncorrect = lastAttemptIncorrect;
|
||||||
|
LoginAttemptFailed = loginFailed;
|
||||||
|
LoginAttemptCancelled = loginCancelled;
|
||||||
|
Message = message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
src/PepperDash.Essentials.Core/Devices/ApiAttribute.cs
Normal file
11
src/PepperDash.Essentials.Core/Devices/ApiAttribute.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using Crestron.SimplSharp.Reflection;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
[AttributeUsage(AttributeTargets.All)]
|
||||||
|
public class ApiAttribute : CAttribute
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,13 +8,7 @@ using Crestron.SimplSharpPro.DeviceSupport;
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
|
public class AudioChangeEventArgs
|
||||||
public enum AudioChangeType
|
|
||||||
{
|
|
||||||
Mute, Volume
|
|
||||||
}
|
|
||||||
|
|
||||||
public class AudioChangeEventArgs
|
|
||||||
{
|
{
|
||||||
public AudioChangeType ChangeType { get; private set; }
|
public AudioChangeType ChangeType { get; private set; }
|
||||||
public IBasicVolumeControls AudioDevice { get; private set; }
|
public IBasicVolumeControls AudioDevice { get; private set; }
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
public enum AudioChangeType
|
||||||
|
{
|
||||||
|
Mute, Volume
|
||||||
|
}
|
||||||
|
}
|
||||||
10
src/PepperDash.Essentials.Core/Devices/ChangeType.cs
Normal file
10
src/PepperDash.Essentials.Core/Devices/ChangeType.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public enum ChangeType
|
||||||
|
{
|
||||||
|
WillChange, DidChange
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Adds control of codec receive volume
|
|
||||||
/// </summary>
|
|
||||||
public interface IReceiveVolume
|
|
||||||
{
|
|
||||||
// Break this out into 3 interfaces
|
|
||||||
void SetReceiveVolume(ushort level);
|
|
||||||
void ReceiveMuteOn();
|
|
||||||
void ReceiveMuteOff();
|
|
||||||
void ReceiveMuteToggle();
|
|
||||||
IntFeedback ReceiveLevelFeedback { get; }
|
|
||||||
BoolFeedback ReceiveMuteIsOnFeedback { get; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds control of codec transmit volume
|
|
||||||
/// </summary>
|
|
||||||
public interface ITransmitVolume
|
|
||||||
{
|
|
||||||
void SetTransmitVolume(ushort level);
|
|
||||||
void TransmitMuteOn();
|
|
||||||
void TransmitMuteOff();
|
|
||||||
void TransmitMuteToggle();
|
|
||||||
IntFeedback TransmitLevelFeedback { get; }
|
|
||||||
BoolFeedback TransmitMuteIsOnFeedback { get; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds control of codec privacy function (microphone mute)
|
|
||||||
/// </summary>
|
|
||||||
public interface IPrivacy
|
|
||||||
{
|
|
||||||
void PrivacyModeOn();
|
|
||||||
void PrivacyModeOff();
|
|
||||||
void PrivacyModeToggle();
|
|
||||||
BoolFeedback PrivacyModeIsOnFeedback { get; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
[AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = true)]
|
||||||
|
public class ConfigSnippetAttribute : Attribute
|
||||||
|
{
|
||||||
|
private string _ConfigSnippet;
|
||||||
|
|
||||||
|
public ConfigSnippetAttribute(string configSnippet)
|
||||||
|
{
|
||||||
|
//Debug.Console(2, "Setting Config Snippet {0}", configSnippet);
|
||||||
|
_ConfigSnippet = configSnippet;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string ConfigSnippet
|
||||||
|
{
|
||||||
|
get { return _ConfigSnippet; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
[AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = true)]
|
||||||
|
public class DescriptionAttribute : Attribute
|
||||||
|
{
|
||||||
|
private string _Description;
|
||||||
|
|
||||||
|
public DescriptionAttribute(string description)
|
||||||
|
{
|
||||||
|
//Debug.Console(2, "Setting Description: {0}", description);
|
||||||
|
_Description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Description
|
||||||
|
{
|
||||||
|
get { return _Description; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
public class DeviceActionWrapper
|
||||||
|
{
|
||||||
|
public string DeviceKey { get; set; }
|
||||||
|
public string MethodName { get; set; }
|
||||||
|
public object[] Params { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -295,77 +295,5 @@ namespace PepperDash.Essentials.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class DeviceActionWrapper
|
|
||||||
{
|
|
||||||
public string DeviceKey { get; set; }
|
|
||||||
public string MethodName { get; set; }
|
|
||||||
public object[] Params { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class PropertyNameType
|
|
||||||
{
|
|
||||||
object Parent;
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public PropertyInfo PropInfo { get; private set; }
|
|
||||||
public string Name { get { return PropInfo.Name; } }
|
|
||||||
public string Type { get { return PropInfo.PropertyType.Name; } }
|
|
||||||
public string Value { get
|
|
||||||
{
|
|
||||||
if (PropInfo.CanRead)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return PropInfo.GetValue(Parent, null).ToString();
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return null;
|
|
||||||
} }
|
|
||||||
|
|
||||||
public bool CanRead { get { return PropInfo.CanRead; } }
|
|
||||||
public bool CanWrite { get { return PropInfo.CanWrite; } }
|
|
||||||
|
|
||||||
|
|
||||||
public PropertyNameType(PropertyInfo info, object parent)
|
|
||||||
{
|
|
||||||
PropInfo = info;
|
|
||||||
Parent = parent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MethodNameParams
|
|
||||||
{
|
|
||||||
[JsonIgnore]
|
|
||||||
public MethodInfo MethodInfo { get; private set; }
|
|
||||||
|
|
||||||
public string Name { get { return MethodInfo.Name; } }
|
|
||||||
public IEnumerable<NameType> Params { get {
|
|
||||||
return MethodInfo.GetParameters().Select(p =>
|
|
||||||
new NameType { Name = p.Name, Type = p.ParameterType.Name });
|
|
||||||
} }
|
|
||||||
|
|
||||||
public MethodNameParams(MethodInfo info)
|
|
||||||
{
|
|
||||||
MethodInfo = info;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class NameType
|
|
||||||
{
|
|
||||||
public string Name { get; set; }
|
|
||||||
public string Type { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.All)]
|
|
||||||
public class ApiAttribute : CAttribute
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
public class DeviceUsageEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
public DateTime UsageEndTime { get; set; }
|
||||||
|
public int MinutesUsed { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,12 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
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.Reflection;
|
using Crestron.SimplSharp.Reflection;
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
@@ -49,97 +47,4 @@ namespace PepperDash.Essentials.Core
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = true)]
|
|
||||||
public class DescriptionAttribute : Attribute
|
|
||||||
{
|
|
||||||
private string _Description;
|
|
||||||
|
|
||||||
public DescriptionAttribute(string description)
|
|
||||||
{
|
|
||||||
//Debug.Console(2, "Setting Description: {0}", description);
|
|
||||||
_Description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Description
|
|
||||||
{
|
|
||||||
get { return _Description; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = true)]
|
|
||||||
public class ConfigSnippetAttribute : Attribute
|
|
||||||
{
|
|
||||||
private string _ConfigSnippet;
|
|
||||||
|
|
||||||
public ConfigSnippetAttribute(string configSnippet)
|
|
||||||
{
|
|
||||||
//Debug.Console(2, "Setting Config Snippet {0}", configSnippet);
|
|
||||||
_ConfigSnippet = configSnippet;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string ConfigSnippet
|
|
||||||
{
|
|
||||||
get { return _ConfigSnippet; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Devices the basic needs for a Device Factory
|
|
||||||
/// </summary>
|
|
||||||
public abstract class EssentialsDeviceFactory<T> : IDeviceFactory where T:EssentialsDevice
|
|
||||||
{
|
|
||||||
#region IDeviceFactory Members
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A list of strings that can be used in the type property of a DeviceConfig object to build an instance of this device
|
|
||||||
/// </summary>
|
|
||||||
public List<string> TypeNames { get; protected set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Loads an item to the DeviceFactory.FactoryMethods dictionary for each entry in the TypeNames list
|
|
||||||
/// </summary>
|
|
||||||
public void LoadTypeFactories()
|
|
||||||
{
|
|
||||||
foreach (var typeName in TypeNames)
|
|
||||||
{
|
|
||||||
//Debug.Console(2, "Getting Description Attribute from class: '{0}'", typeof(T).FullName);
|
|
||||||
var descriptionAttribute = typeof(T).GetCustomAttributes(typeof(DescriptionAttribute), true) as DescriptionAttribute[];
|
|
||||||
string description = descriptionAttribute[0].Description;
|
|
||||||
var snippetAttribute = typeof(T).GetCustomAttributes(typeof(ConfigSnippetAttribute), true) as ConfigSnippetAttribute[];
|
|
||||||
DeviceFactory.AddFactoryForType(typeName.ToLower(), description, typeof(T), BuildDevice);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The method that will build the device
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dc">The device config</param>
|
|
||||||
/// <returns>An instance of the device</returns>
|
|
||||||
public abstract EssentialsDevice BuildDevice(DeviceConfig dc);
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Devices the basic needs for a Device Factory
|
|
||||||
/// </summary>
|
|
||||||
public abstract class EssentialsPluginDeviceFactory<T> : EssentialsDeviceFactory<T>, IPluginDeviceFactory where T : EssentialsDevice
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Specifies the minimum version of Essentials required for a plugin to run. Must use the format Major.Minor.Build (ex. "1.4.33")
|
|
||||||
/// </summary>
|
|
||||||
public string MinimumEssentialsFrameworkVersion { get; protected set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract class EssentialsPluginDevelopmentDeviceFactory<T> : EssentialsDeviceFactory<T>, IPluginDevelopmentDeviceFactory where T : EssentialsDevice
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Specifies the minimum version of Essentials required for a plugin to run. Must use the format Major.Minor.Build (ex. "1.4.33")
|
|
||||||
/// </summary>
|
|
||||||
public string MinimumEssentialsFrameworkVersion { get; protected set; }
|
|
||||||
|
|
||||||
public List<string> DevelopmentEssentialsFrameworkVersions { get; protected set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user