Compare commits

...

48 Commits
0.0.1 ... 0.0.9

Author SHA1 Message Date
Neil Dorin
1ccdeda5ed Schema updates 2020-01-22 15:28:19 -07:00
Neil Dorin
f113b0df63 Adds PD.Core schema files from submodule build 2020-01-22 12:16:04 -07:00
Neil Dorin
cb6dcc7de9 Adds control object to schema 2020-01-22 10:00:13 -07:00
Neil Dorin
740c944f54 Config validation and subsequent load working. Need to look into exceptions thrown by several devices when deserializing control properties. 2020-01-21 17:39:57 -07:00
Neil Dorin
bd7831146d Tested schema and working in web tool. Can't get Essentials to load schema file at specified path yet. Adds addtional XML help for config properties. 2020-01-20 22:05:46 -07:00
Neil Dorin
aa64cc917c Adds draft schema document and initial logic to validate config against schema 2020-01-20 16:29:01 -07:00
Neil Dorin
1017464980 Adds try/catch to Communication_BytesReceived callback to prevent exception from getting logged when malformed message is received 2020-01-16 16:40:02 -07:00
Neil Dorin
47f4d90c5a Adds support for CEN-IO-DIGIN-104 2020-01-13 21:56:41 -07:00
Neil Dorin
c3dbd41942 Adds configuratble property for current audio/video output text. Defaults to "". 2020-01-13 21:55:59 -07:00
Neil Dorin
45788a4d6b Adds debug statments with logging for Samsung MDC power on/off events 2020-01-13 21:54:49 -07:00
Neil Dorin
d63787bc78 Adds logging for room on/off and occupancy events 2020-01-13 21:54:12 -07:00
Neil Dorin
d269a04bab Modifes debug statments to also print to log as notices 2020-01-10 11:51:25 -07:00
Neil Dorin
cc5889385e Merged in bugfix/ecs-1220 (pull request #42)
Fixes issue with OutputAudioRouteNameFeebdack not being fired

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-12-20 21:19:43 +00:00
Neil Dorin
fe14d543d6 Fixes issue with OutputAudioRouteNameFeebdack not being fired 2019-12-20 14:17:21 -07:00
Neil Dorin
9a4af1703b Merged in maintenance/PR-5 (pull request #41)
Update PD.Core version
2019-12-17 18:06:10 +00:00
Neil Dorin
5987b5b078 Update PD.Core version 2019-12-17 10:59:54 -07:00
Neil Dorin
531f93040a Merged in bugfix/ecs-1214 (pull request #40)
Fixed to DGE to allow use of Com ports via EfS bridge.  Updates PD.Core version

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-12-16 22:58:35 +00:00
Neil Dorin
5fc93ca251 Fixed to DGE to allow use of Com ports via EfS bridge. Updates PD.Core version 2019-12-16 14:44:34 -07:00
Neil Dorin
bd4bb24945 Merged in bugfix/ecs-1201 (pull request #39)
Bugfix/ecs 1201

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-11-27 18:38:35 +00:00
Neil Dorin
10104e2a09 Corrects issue where if relay state was already Registered, DeviceFactory did not return a GenericRelayDevice 2019-11-27 11:36:56 -07:00
Neil Dorin
c99ba9ca1d Merge branch 'feature/ecs-1188' into bugfix/ecs-1192
# Conflicts:
#	PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs
#	essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingPort.cs
2019-11-27 11:22:27 -07:00
Neil Dorin
74de1c2475 Updates PD.Core version 2019-11-27 11:16:14 -07:00
Neil Dorin
ce247b8e8a Merged in bugfix/ecs-1192 (pull request #38)
Bugfix/ecs 1192

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-11-27 17:41:37 +00:00
Neil Dorin
8e0262e1c3 Merge branch 'bugfix/ecs-1199' into bugfix/ecs-1192 2019-11-27 10:33:10 -07:00
Neil Dorin
f2e2166146 Corrects issues with order of operations so that InCallFeedback isn't null when dependent routines check it's state. 2019-11-27 10:32:21 -07:00
Neil Dorin
89db680986 Fixed syntax issue in CustomActivate() 2019-11-19 20:08:47 -07:00
Neil Dorin
11a01c707c Fixed issue with Output type on DMPS3-4K-150-C when assigning name. Also adds protection if config incorrectly defiines inputs or outputs that don't exist. 2019-11-19 19:07:19 -07:00
Neil Dorin
db08b1fcd9 Switches back to using EndpointOnlineFeedback for Rx online detection. Not currently working but believed to be a Crestron issue. 2019-11-19 18:02:50 -07:00
Neil Dorin
9c0440e8f0 Adds debug statements to compare values between Endpoint.IsOnline and EndpointOnlineFeedback 2019-11-19 16:01:59 -07:00
Neil Dorin
2173116664 Changes to use rxDevice.IsOnline feedback for advanced receivers with blade chassis 2019-11-19 15:34:03 -07:00
Neil Dorin
419d956a8d Switched to using Endpoint.IsOnline instead of EndpointOnlineFeedback for blade chassis as EndpointOnlineFeedback seems to be broken. 2019-11-19 15:16:21 -07:00
Neil Dorin
f44bde2d83 Corrects issue where "new" GlsOdtCCn OccSensor needed to be assigned in GlsOdtOccupancySensorController constructor for adiditional feedbacks to work correctly and not throw null ref exceptions. 2019-11-19 14:50:40 -07:00
Neil Dorin
6c7bc1a24e Adds ability to read input/output names from processor device properties config. Fixes issues with routing to output on DMPS3-4K-150-C 2019-11-19 14:01:57 -07:00
Neil Dorin
af62bf86a5 Merged in bugfix/ecs-1190 (pull request #37)
Bugfix/ecs 1190

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-11-18 22:30:12 +00:00
Neil Dorin
905c40dc0a Corrects issue where inputCard was being cast as wrong type 2019-11-18 14:53:12 -07:00
Neil Dorin
492d8f8203 Removed reference to inputCard.NameFeedback.StringValue from debug statement 2019-11-18 14:41:35 -07:00
Neil Dorin
dd7408dbf1 Modifies SetupInputCards() to try to fix a NullReferenceException being thrown. Adds a debug statement to check if a given card in the collection can't be cast as DMInput. 2019-11-18 14:27:11 -07:00
Trevor Payne
52c387081c Removed some debug print statements 2019-11-18 15:12:55 -06:00
Neil Dorin
84374a8af0 Adds ability to set program to not load config on next boot via console commands 2019-11-15 22:13:53 -07:00
Neil Dorin
c0b59c375e Removed all references to "Cotija" and replaced with "MobileControl". Progress on multi display routing in room logic and Mobile Control bridging. 2019-11-15 22:03:45 -07:00
Trevor Payne
0eb6411dd9 Added support for 'Large' DM Frames 2019-11-15 16:22:18 -06:00
Neil Dorin
405677a3df Merge remote-tracking branch 'origin/development' into feature/ecs-1116 2019-11-14 16:02:56 -07:00
Neil Dorin
a1de8e2edd Merged in maintenance/pdcore-submodule-creds (pull request #36)
Maintenance/pdcore submodule creds

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-11-08 19:55:34 +00:00
Neil Dorin
841cc1a5e4 Readds PDCore submodule without user creds 2019-11-08 12:54:07 -07:00
Neil Dorin
130bac79f3 Removes PDCore submodule with user creds 2019-11-08 12:53:04 -07:00
Neil Dorin
1a9546c970 switch to 1.0.27 of PD Core 2019-11-08 12:49:47 -07:00
Neil Dorin
89f6300d14 Re adds PDCore submodule wihtout user creds 2019-11-08 12:47:44 -07:00
Neil Dorin
2012f55735 Removes pdcore submodule 2019-11-08 12:42:52 -07:00
77 changed files with 4642 additions and 2740 deletions

3
.gitmodules vendored
View File

@@ -1,4 +1,3 @@
[submodule "essentials-framework/pepperdashcore-builds"]
path = essentials-framework/pepperdashcore-builds
url = https://ndorin@bitbucket.org/Pepperdash_Products/pepperdashcore-builds.git
branch = development
url = https://bitbucket.org/Pepperdash_Products/pepperdashcore-builds.git

View File

@@ -6,11 +6,11 @@ using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Core;
namespace PepperDash.Essentials.Room.Cotija
namespace PepperDash.Essentials.Room.MobileControl
{
public static class IChannelExtensions
{
public static void LinkActions(this IChannel dev, CotijaSystemController controller)
public static void LinkActions(this IChannel dev, MobileControlSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
@@ -22,7 +22,7 @@ namespace PepperDash.Essentials.Room.Cotija
controller.AddAction(prefix + "exit", new PressAndHoldAction(dev.Exit));
}
public static void UnlinkActions(this IChannel dev, CotijaSystemController controller)
public static void UnlinkActions(this IChannel dev, MobileControlSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);

View File

@@ -6,11 +6,11 @@ using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Core;
namespace PepperDash.Essentials.Room.Cotija
namespace PepperDash.Essentials.Room.MobileControl
{
public static class IColorExtensions
{
public static void LinkActions(this IColor dev, CotijaSystemController controller)
public static void LinkActions(this IColor dev, MobileControlSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
@@ -20,7 +20,7 @@ namespace PepperDash.Essentials.Room.Cotija
controller.AddAction(prefix + "blue", new PressAndHoldAction(dev.Blue));
}
public static void UnlinkActions(this IColor dev, CotijaSystemController controller)
public static void UnlinkActions(this IColor dev, MobileControlSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);

View File

@@ -6,11 +6,11 @@ using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Core;
namespace PepperDash.Essentials.Room.Cotija
namespace PepperDash.Essentials.Room.MobileControl
{
public static class IDPadExtensions
{
public static void LinkActions(this IDPad dev, CotijaSystemController controller)
public static void LinkActions(this IDPad dev, MobileControlSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
@@ -23,7 +23,7 @@ namespace PepperDash.Essentials.Room.Cotija
controller.AddAction(prefix + "exit", new PressAndHoldAction(dev.Exit));
}
public static void UnlinkActions(this IDPad dev, CotijaSystemController controller)
public static void UnlinkActions(this IDPad dev, MobileControlSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);

View File

@@ -6,11 +6,11 @@ using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Core;
namespace PepperDash.Essentials.Room.Cotija
namespace PepperDash.Essentials.Room.MobileControl
{
public static class IDvrExtensions
{
public static void LinkActions(this IDvr dev, CotijaSystemController controller)
public static void LinkActions(this IDvr dev, MobileControlSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
@@ -18,7 +18,7 @@ namespace PepperDash.Essentials.Room.Cotija
controller.AddAction(prefix + "record", new PressAndHoldAction(dev.Record));
}
public static void UnlinkActions(this IDvr dev, CotijaSystemController controller)
public static void UnlinkActions(this IDvr dev, MobileControlSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);

View File

@@ -6,11 +6,11 @@ using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Core;
namespace PepperDash.Essentials.Room.Cotija
namespace PepperDash.Essentials.Room.MobileControl
{
public static class INumericExtensions
{
public static void LinkActions(this INumericKeypad dev, CotijaSystemController controller)
public static void LinkActions(this INumericKeypad dev, MobileControlSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
@@ -29,7 +29,7 @@ namespace PepperDash.Essentials.Room.Cotija
// Deal with the Accessory functions on the numpad later
}
public static void UnlinkActions(this INumericKeypad dev, CotijaSystemController controller)
public static void UnlinkActions(this INumericKeypad dev, MobileControlSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);

View File

@@ -6,11 +6,11 @@ using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Core;
namespace PepperDash.Essentials.Room.Cotija
namespace PepperDash.Essentials.Room.MobileControl
{
public static class IPowerExtensions
{
public static void LinkActions(this IPower dev, CotijaSystemController controller)
public static void LinkActions(this IPower dev, MobileControlSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
@@ -19,7 +19,7 @@ namespace PepperDash.Essentials.Room.Cotija
controller.AddAction(prefix + "powerToggle", new Action(dev.PowerToggle));
}
public static void UnlinkActions(this IPower dev, CotijaSystemController controller)
public static void UnlinkActions(this IPower dev, MobileControlSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);

View File

@@ -6,11 +6,11 @@ using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Core;
namespace PepperDash.Essentials.Room.Cotija
namespace PepperDash.Essentials.Room.MobileControl
{
public static class ISetTopBoxControlsExtensions
{
public static void LinkActions(this ISetTopBoxControls dev, CotijaSystemController controller)
public static void LinkActions(this ISetTopBoxControls dev, MobileControlSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
@@ -18,7 +18,7 @@ namespace PepperDash.Essentials.Room.Cotija
controller.AddAction(prefix + "replay", new PressAndHoldAction(dev.Replay));
}
public static void UnlinkActions(this ISetTopBoxControls dev, CotijaSystemController controller)
public static void UnlinkActions(this ISetTopBoxControls dev, MobileControlSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);

View File

@@ -6,11 +6,11 @@ using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Core;
namespace PepperDash.Essentials.Room.Cotija
namespace PepperDash.Essentials.Room.MobileControl
{
public static class ITransportExtensions
{
public static void LinkActions(this ITransport dev, CotijaSystemController controller)
public static void LinkActions(this ITransport dev, MobileControlSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
@@ -24,7 +24,7 @@ namespace PepperDash.Essentials.Room.Cotija
controller.AddAction(prefix + "record", new PressAndHoldAction(dev.Record));
}
public static void UnlinkActions(this ITransport dev, CotijaSystemController controller)
public static void UnlinkActions(this ITransport dev, MobileControlSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);

View File

@@ -6,7 +6,7 @@ using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Room.Cotija
namespace PepperDash.Essentials.Room.MobileControl
{
/// <summary>
/// Represents a room whose configuration is derived from runtime data,

View File

@@ -39,7 +39,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
}
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
protected override void CustomRegisterWithAppServer(MobileControlSystemController appServerController)
{
appServerController.AddAction(MessagePath + "/fullStatus", new Action(SendAtcFullMessageObject));
appServerController.AddAction(MessagePath + "/dial", new Action<string>(s => Codec.Dial(s)));

View File

@@ -27,7 +27,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
PostUpdateStatus(e.UpdateStatus.ToString());
}
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
protected override void CustomRegisterWithAppServer(MobileControlSystemController appServerController)
{
appServerController.AddAction(MessagePath + "/updateConfig", new Action<string>(s => GetConfigFile(s)));
}

View File

@@ -127,7 +127,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
///
/// </summary>
/// <param name="appServerController"></param>
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
protected override void CustomRegisterWithAppServer(MobileControlSystemController appServerController)
{
//EISC.SetStringSigAction(SCurrentDialString, s => PostStatusMessage(new { currentDialString = s }));

View File

@@ -253,7 +253,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
///
/// </summary>
/// <param name="appServerController"></param>
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
protected override void CustomRegisterWithAppServer(MobileControlSystemController appServerController)
{
var asc = appServerController;
EISC.SetStringSigAction(SHookState, s =>

View File

@@ -24,7 +24,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// <summary>
///
/// </summary>
public CotijaSystemController AppServerController { get; private set; }
public MobileControlSystemController AppServerController { get; private set; }
public string MessagePath { get; private set; }
@@ -47,7 +47,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// Registers this messenger with appserver controller
/// </summary>
/// <param name="appServerController"></param>
public void RegisterWithAppServer(CotijaSystemController appServerController)
public void RegisterWithAppServer(MobileControlSystemController appServerController)
{
if (appServerController == null)
throw new ArgumentNullException("appServerController");
@@ -60,7 +60,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// Implemented in extending classes. Wire up API calls and feedback here
/// </summary>
/// <param name="appServerController"></param>
abstract protected void CustomRegisterWithAppServer(CotijaSystemController appServerController);
abstract protected void CustomRegisterWithAppServer(MobileControlSystemController appServerController);
/// <summary>
/// Helper for posting status message

View File

@@ -86,7 +86,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
});
}
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
protected override void CustomRegisterWithAppServer(MobileControlSystemController appServerController)
{
AppServerController.AddAction(MessagePath + "/fullStatus", new Action(SendFullStatusMessage));
}

View File

@@ -160,7 +160,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// Called from base's RegisterWithAppServer method
/// </summary>
/// <param name="appServerController"></param>
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
protected override void CustomRegisterWithAppServer(MobileControlSystemController appServerController)
{
appServerController.AddAction("/device/videoCodec/isReady", new Action(SendIsReady));
appServerController.AddAction("/device/videoCodec/fullStatus", new Action(SendVtcFullMessageObject));

View File

@@ -13,7 +13,7 @@ namespace PepperDash.Essentials
/// <summary>
///
/// </summary>
public class CotijaConfig
public class MobileControlConfig
{
[JsonProperty("serverUrl")]
public string ServerUrl { get; set; }
@@ -25,7 +25,7 @@ namespace PepperDash.Essentials
/// <summary>
///
/// </summary>
public class CotijaDdvc01RoomBridgePropertiesConfig
public class MobileControlDdvc01RoomBridgePropertiesConfig
{
[JsonProperty("eiscId")]
public string EiscId { get; set; }

View File

@@ -8,19 +8,19 @@ using Crestron.SimplSharpPro.EthernetCommunication;
using PepperDash.Core;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Room.Cotija
namespace PepperDash.Essentials.Room.MobileControl
{
/// <summary>
/// Represents a generic device connection through to and EISC for DDVC01
/// </summary>
public class CotijaDdvc01DeviceBridge : Device, IChannel, INumericKeypad
public class MobileControlDdvc01DeviceBridge : Device, IChannel, INumericKeypad
{
/// <summary>
/// EISC used to talk to Simpl
/// </summary>
ThreeSeriesTcpIpEthernetIntersystemCommunications EISC;
public CotijaDdvc01DeviceBridge(string key, string name, ThreeSeriesTcpIpEthernetIntersystemCommunications eisc)
public MobileControlDdvc01DeviceBridge(string key, string name, ThreeSeriesTcpIpEthernetIntersystemCommunications eisc)
: base(key, name)
{
EISC = eisc;

View File

@@ -12,15 +12,15 @@ namespace PepperDash.Essentials
/// <summary>
///
/// </summary>
public abstract class CotijaBridgeBase: Device
public abstract class MobileControlBridgeBase: Device
{
public CotijaSystemController Parent { get; private set; }
public MobileControlSystemController Parent { get; private set; }
public string UserCode { get; private set; }
public abstract string RoomName { get; }
public CotijaBridgeBase(string key, string name)
public MobileControlBridgeBase(string key, string name)
: base(key, name)
{
}
@@ -30,7 +30,7 @@ namespace PepperDash.Essentials
/// as adding actions to parent
/// </summary>
/// <param name="parent"></param>
public virtual void AddParent(CotijaSystemController parent)
public virtual void AddParent(MobileControlSystemController parent)
{
Parent = parent;
}

View File

@@ -16,9 +16,9 @@ using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Room.Config;
namespace PepperDash.Essentials.Room.Cotija
namespace PepperDash.Essentials.Room.MobileControl
{
public class CotijaDdvc01RoomBridge : CotijaBridgeBase, IDelayedConfiguration
public class MobileControlDdvc01RoomBridge : MobileControlBridgeBase, IDelayedConfiguration
{
public class BoolJoin
{
@@ -236,7 +236,7 @@ namespace PepperDash.Essentials.Room.Cotija
}
}
CotijaDdvc01DeviceBridge SourceBridge;
MobileControlDdvc01DeviceBridge SourceBridge;
Ddvc01AtcMessenger AtcMessenger;
Ddvc01VtcMessenger VtcMessenger;
@@ -248,7 +248,7 @@ namespace PepperDash.Essentials.Room.Cotija
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="ipId"></param>
public CotijaDdvc01RoomBridge(string key, string name, uint ipId)
public MobileControlDdvc01RoomBridge(string key, string name, uint ipId)
: base(key, name)
{
try
@@ -258,7 +258,7 @@ namespace PepperDash.Essentials.Room.Cotija
if (reg != Crestron.SimplSharpPro.eDeviceRegistrationUnRegistrationResponse.Success)
Debug.Console(0, this, "Cannot connect EISC at IPID {0}: \r{1}", ipId, reg);
SourceBridge = new CotijaDdvc01DeviceBridge(key + "-sourceBridge", "DDVC01 source bridge", EISC);
SourceBridge = new MobileControlDdvc01DeviceBridge(key + "-sourceBridge", "DDVC01 source bridge", EISC);
DeviceManager.AddDevice(SourceBridge);
}
catch (Exception)
@@ -590,7 +590,7 @@ namespace PepperDash.Essentials.Room.Cotija
// rmProps.VolumeSliderNames.Add(EISC.StringInput[i].StringValue);
//}
// There should be cotija devices in here, I think...
// There should be Mobile Control devices in here, I think...
if(co.Devices == null)
co.Devices = new List<DeviceConfig>();

View File

@@ -9,14 +9,14 @@ using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.AppServer.Messengers;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Room.Cotija;
using PepperDash.Essentials.Room.MobileControl;
using PepperDash.Essentials.Devices.Common.Codec;
using PepperDash.Essentials.Devices.Common.VideoCodec;
using PepperDash.Essentials.Devices.Common.AudioCodec;
namespace PepperDash.Essentials
{
public class CotijaEssentialsHuddleSpaceRoomBridge : CotijaBridgeBase
public class MobileConrolEssentialsHuddleSpaceRoomBridge : MobileControlBridgeBase
{
public EssentialsRoomBase Room { get; private set; }
@@ -42,7 +42,7 @@ namespace PepperDash.Essentials
/// </summary>
/// <param name="parent"></param>
/// <param name="room"></param>
public CotijaEssentialsHuddleSpaceRoomBridge(EssentialsRoomBase room):
public MobileConrolEssentialsHuddleSpaceRoomBridge(EssentialsRoomBase room):
base("mobileControlBridge-essentialsHuddle", "Essentials Mobile Control Bridge-Huddle")
{
Room = room;
@@ -52,7 +52,7 @@ namespace PepperDash.Essentials
/// Override of base: calls base to add parent and then registers actions and events.
/// </summary>
/// <param name="parent"></param>
public override void AddParent(CotijaSystemController parent)
public override void AddParent(MobileControlSystemController parent)
{
base.AddParent(parent);
@@ -169,19 +169,6 @@ namespace PepperDash.Essentials
});
}
///// <summary>
///// Handler for codec changes
///// </summary>
//void codec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e)
//{
// PostStatusMessage(new
// {
// calls = GetCallsMessageObject(),
// //vtc = GetVtcCallsMessageObject()
// });
//}
/// <summary>
/// Helper for posting status message
/// </summary>
@@ -435,45 +422,6 @@ namespace PepperDash.Essentials
volumes = volumes
});
}
///// <summary>
///// Helper to return a anonymous object with the call data for JSON message
///// </summary>
///// <returns></returns>
//object GetCallsMessageObject()
//{
// var callRm = Room as IHasVideoCodec;
// if (callRm == null)
// return null;
// return new
// {
// activeCalls = callRm.VideoCodec.ActiveCalls,
// callType = callRm.CallTypeFeedback.IntValue,
// inCall = callRm.InCallFeedback.BoolValue,
// isSharing = callRm.IsSharingFeedback.BoolValue,
// privacyModeIsOn = callRm.PrivacyModeIsOnFeedback.BoolValue
// };
//}
///// <summary>
///// Helper method to build call status for vtc
///// </summary>
///// <returns></returns>
//object GetVtcCallsMessageObject()
//{
// var callRm = Room as IHasVideoCodec;
// object vtc = null;
// if (callRm != null)
// {
// var codec = callRm.VideoCodec;
// vtc = new
// {
// isInCall = codec.IsInCall,
// calls = codec.ActiveCalls
// };
// }
// return vtc;
//}
}
/// <summary>

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Room.Cotija
namespace PepperDash.Essentials.Room.MobileControl
{
/// <summary>

View File

@@ -6,7 +6,7 @@ using Crestron.SimplSharp;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Room.Cotija
namespace PepperDash.Essentials.Room.MobileControl
{
public class Volumes
{

View File

@@ -103,11 +103,14 @@ namespace PepperDash.Essentials.Bridges
(device as DisplayBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
}
else if (device is DmChassisController)
{
else if (device is DmChassisController) {
(device as DmChassisController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
}
else if (device is DmBladeChassisController) {
(device as DmBladeChassisController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
}
else if (device is DmpsRoutingController)
{
(device as DmpsRoutingController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);

View File

@@ -0,0 +1,222 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.DM;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Bridges {
public static class DmBladeChassisControllerApiExtentions {
public static void LinkToApi(this DmBladeChassisController dmChassis, BasicTriList trilist, uint joinStart, string joinMapKey) {
DmBladeChassisControllerJoinMap joinMap = new DmBladeChassisControllerJoinMap();
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<DmBladeChassisControllerJoinMap>(joinMapSerialized);
joinMap.OffsetJoinNumbers(joinStart);
Debug.Console(1, dmChassis, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
var chassis = dmChassis.Chassis as BladeSwitch;
dmChassis.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
// Link up outputs
for (uint i = 1; i <= dmChassis.Chassis.NumberOfOutputs; i++) {
var ioSlot = i;
// Control
trilist.SetUShortSigAction(joinMap.OutputVideo + ioSlot, new Action<ushort>(o => dmChassis.ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video)));
if (dmChassis.TxDictionary.ContainsKey(ioSlot)) {
Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot);
var txKey = dmChassis.TxDictionary[ioSlot];
var basicTxDevice = DeviceManager.GetDeviceForKey(txKey) as BasicDmTxControllerBase;
var advancedTxDevice = basicTxDevice as DmTxControllerBase;
if (dmChassis.Chassis is DmMd128x128 || dmChassis.Chassis is DmMd64x64) {
dmChassis.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
}
else {
if (advancedTxDevice != null) {
advancedTxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
Debug.Console(2, "Linking Tx Online Feedback from Advanced Transmitter at input {0}", ioSlot);
}
else if (dmChassis.InputEndpointOnlineFeedbacks[ioSlot] != null) {
Debug.Console(2, "Linking Tx Online Feedback from Input Card {0}", ioSlot);
dmChassis.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
}
}
if (basicTxDevice != null && advancedTxDevice == null)
trilist.BooleanInput[joinMap.TxAdvancedIsPresent + ioSlot].BoolValue = true;
if (advancedTxDevice != null) {
advancedTxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]);
}
else if (advancedTxDevice == null || basicTxDevice != null) {
Debug.Console(1, "Setting up actions and feedbacks on input card {0}", ioSlot);
dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]);
var inputPort = dmChassis.InputPorts[string.Format("inputCard{0}--hdmiIn", ioSlot)];
if (inputPort != null) {
Debug.Console(1, "Port value for input card {0} is set", ioSlot);
var port = inputPort.Port;
if (port != null) {
if (port is HdmiInputWithCEC) {
Debug.Console(1, "Port is HdmiInputWithCec");
var hdmiInPortWCec = port as HdmiInputWithCEC;
if (hdmiInPortWCec.HdcpSupportedLevel != eHdcpSupportedLevel.Unknown) {
SetHdcpStateAction(true, hdmiInPortWCec, joinMap.HdcpSupportState + ioSlot, trilist);
}
dmChassis.InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState + ioSlot]);
if (dmChassis.InputCardHdcpCapabilityTypes.ContainsKey(ioSlot))
trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = (ushort)dmChassis.InputCardHdcpCapabilityTypes[ioSlot];
else
trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = 1;
}
}
}
else {
inputPort = dmChassis.InputPorts[string.Format("inputCard{0}--dmIn", ioSlot)];
if (inputPort != null) {
var port = inputPort.Port;
if (port is DMInputPortWithCec) {
Debug.Console(1, "Port is DMInputPortWithCec");
var dmInPortWCec = port as DMInputPortWithCec;
if (dmInPortWCec != null) {
SetHdcpStateAction(dmChassis.PropertiesConfig.InputSlotSupportsHdcp2[ioSlot], dmInPortWCec, joinMap.HdcpSupportState + ioSlot, trilist);
}
dmChassis.InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState + ioSlot]);
if (dmChassis.InputCardHdcpCapabilityTypes.ContainsKey(ioSlot))
trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = (ushort)dmChassis.InputCardHdcpCapabilityTypes[ioSlot];
else
trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = 1;
}
}
}
}
}
else {
dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]);
var inputPort = dmChassis.InputPorts[string.Format("inputCard{0}--hdmiIn", ioSlot)];
if (inputPort != null) {
var hdmiPort = inputPort.Port as EndpointHdmiInput;
if (hdmiPort != null) {
SetHdcpStateAction(true, hdmiPort, joinMap.HdcpSupportState + ioSlot, trilist);
dmChassis.InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState + ioSlot]);
}
}
}
if (dmChassis.RxDictionary.ContainsKey(ioSlot)) {
Debug.Console(2, "Creating Rx Feedbacks {0}", ioSlot);
//var rxKey = dmChassis.RxDictionary[ioSlot];
//var rxDevice = DeviceManager.GetDeviceForKey(rxKey) as DmRmcControllerBase;
//var hdBaseTDevice = DeviceManager.GetDeviceForKey(rxKey) as DmHdBaseTControllerBase;
//if (hdBaseTDevice != null) {
dmChassis.OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
//}
//else if (rxDevice != null) {
// rxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
//}
}
// Feedback
dmChassis.VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo + ioSlot]);
dmChassis.OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames + ioSlot]);
dmChassis.InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]);
dmChassis.OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames + ioSlot]);
}
}
static void SetHdcpStateAction(bool hdcpTypeSimple, HdmiInputWithCEC port, uint join, BasicTriList trilist) {
if (hdcpTypeSimple) {
trilist.SetUShortSigAction(join,
new Action<ushort>(s => {
if (s == 0) {
port.HdcpSupportOff();
}
else if (s > 0) {
port.HdcpSupportOn();
}
}));
}
else {
trilist.SetUShortSigAction(join,
new Action<ushort>(u => {
port.HdcpReceiveCapability = (eHdcpCapabilityType)u;
}));
}
}
static void SetHdcpStateAction(bool hdcpTypeSimple, EndpointHdmiInput port, uint join, BasicTriList trilist) {
if (hdcpTypeSimple) {
trilist.SetUShortSigAction(join,
new Action<ushort>(s => {
if (s == 0) {
port.HdcpSupportOff();
}
else if (s > 0) {
port.HdcpSupportOn();
}
}));
}
else {
trilist.SetUShortSigAction(join,
new Action<ushort>(u => {
port.HdcpCapability = (eHdcpCapabilityType)u;
}));
}
}
static void SetHdcpStateAction(bool supportsHdcp2, DMInputPortWithCec port, uint join, BasicTriList trilist) {
if (!supportsHdcp2) {
trilist.SetUShortSigAction(join,
new Action<ushort>(s => {
if (s == 0) {
port.HdcpSupportOff();
}
else if (s > 0) {
port.HdcpSupportOn();
}
}));
}
else {
trilist.SetUShortSigAction(join,
new Action<ushort>(u => {
port.HdcpReceiveCapability = (eHdcpCapabilityType)u;
}));
}
}
}
}

View File

@@ -32,10 +32,12 @@ namespace PepperDash.Essentials.Bridges
Debug.Console(1, dmChassis, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
var chassis = dmChassis.Chassis as DmMDMnxn;
dmChassis.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
trilist.SetUShortSigAction(joinMap.SystemId, new Action<ushort>(o => dmChassis.Chassis.SystemId.UShortValue = o));
trilist.SetSigTrueAction(joinMap.SystemId, new Action(() => dmChassis.Chassis.ApplySystemId()));
trilist.SetUShortSigAction(joinMap.SystemId, new Action<ushort>(o => chassis.SystemId.UShortValue = o));
trilist.SetSigTrueAction(joinMap.SystemId, new Action(() => chassis.ApplySystemId()));
dmChassis.SystemIdFeebdack.LinkInputSig(trilist.UShortInput[joinMap.SystemId]);
dmChassis.SystemIdBusyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.SystemId]);

View File

@@ -0,0 +1,109 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Bridges {
public class DmBladeChassisControllerJoinMap : JoinMapBase {
#region Digital/Analogs
#endregion
#region Digitals
/// <summary>
/// High when device is online
/// </summary>
public uint IsOnline { get; set; }
/// <summary>
/// Range reports video sync feedback for each input
/// </summary>
public uint VideoSyncStatus { get; set; }
/// <summary>
/// Range reports high if corresponding input's endpoint is online
/// </summary>
public uint InputEndpointOnline { get; set; }
/// <summary>
/// Range reports high if corresponding output's endpoint is online
/// </summary>
public uint OutputEndpointOnline { get; set; }
/// <summary>
/// Range reports high if corresponding input's transmitter supports bridging as a separate device for detailed AV switching, HDCP control, etc.
/// </summary>
public uint TxAdvancedIsPresent { get; set; } // indicates that there is an attached transmitter that should be bridged to be interacted with
#endregion
#region Analogs
/// <summary>
/// Range sets and reports the current video source for the corresponding output
/// </summary>
public uint OutputVideo { get; set; }
/// <summary>
/// Range sets and reports the current HDCP state for the corresponding input card
/// </summary>
public uint HdcpSupportState { get; set; }
/// <summary>
/// Range reports the highest supported HDCP state level for the corresponding input card
/// </summary>
public uint HdcpSupportCapability { get; set; }
#endregion
#region Serials
/// <summary>
/// Range sets and reports the name for the corresponding input card
/// </summary>
public uint InputNames { get; set; }
/// <summary>
/// Range sets and reports the name for the corresponding output card
/// </summary>
public uint OutputNames { get; set; }
/// <summary>
/// Range reports the name of the current video source for the corresponding output card
/// </summary>
public uint OutputCurrentVideoInputNames { get; set; }
/// <summary>
/// Range reports the current input resolution for each corresponding input card
/// </summary>
public uint InputCurrentResolution { get; set; }
#endregion
public DmBladeChassisControllerJoinMap() {
//Digital/Analog
//Digital
IsOnline = 11;
VideoSyncStatus = 100; //101-299
InputEndpointOnline = 500; //501-699
OutputEndpointOnline = 700; //701-899
TxAdvancedIsPresent = 1000; //1001-1199
//Analog
OutputVideo = 100; //101-299
HdcpSupportState = 1000; //1001-1199
HdcpSupportCapability = 1200; //1201-1399
//Serial
InputNames = 100; //101-299
OutputNames = 300; //301-499
OutputCurrentVideoInputNames = 2000; //2001-2199
InputCurrentResolution = 2400; // 2401-2599
}
public override void OffsetJoinNumbers(uint joinStart) {
var joinOffset = joinStart - 1;
IsOnline = IsOnline + joinOffset;
OutputVideo = OutputVideo + joinOffset;
VideoSyncStatus = VideoSyncStatus + joinOffset;
InputNames = InputNames + joinOffset;
OutputNames = OutputNames + joinOffset;
OutputCurrentVideoInputNames = OutputCurrentVideoInputNames + joinOffset;
InputCurrentResolution = InputCurrentResolution + joinOffset;
InputEndpointOnline = InputEndpointOnline + joinOffset;
OutputEndpointOnline = OutputEndpointOnline + joinOffset;
HdcpSupportState = HdcpSupportState + joinOffset;
HdcpSupportCapability = HdcpSupportCapability + joinOffset;
}
}
}

View File

@@ -15,7 +15,9 @@ using PepperDash.Essentials.Devices.Common;
using PepperDash.Essentials.DM;
using PepperDash.Essentials.Fusion;
using PepperDash.Essentials.Room.Config;
using PepperDash.Essentials.Room.Cotija;
using PepperDash.Essentials.Room.MobileControl;
using Newtonsoft.Json;
namespace PepperDash.Essentials
{
@@ -40,8 +42,11 @@ namespace PepperDash.Essentials
{
DeterminePlatform();
//CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Loads configuration file",
// ConsoleAccessLevelEnum.AccessOperator);
if (Debug.DoNotLoadOnNextBoot)
{
CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Loads configuration file",
ConsoleAccessLevelEnum.AccessOperator);
}
// CrestronConsole.AddNewConsoleCommand(S => { ConfigWriter.WriteConfigFile(null); }, "writeconfig", "writes the current config to a file", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s =>
@@ -71,7 +76,8 @@ namespace PepperDash.Essentials
"Template URL: {1}", ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.TemplateUrl);
}, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator);
GoWithLoad();
if (!Debug.DoNotLoadOnNextBoot)
GoWithLoad();
}
/// <summary>
@@ -81,57 +87,64 @@ namespace PepperDash.Essentials
/// </summary>
public void DeterminePlatform()
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Determining Platform....");
string filePathPrefix;
var dirSeparator = Global.DirectorySeparator;
var version = Crestron.SimplSharp.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
var versionString = string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build);
string directoryPrefix;
directoryPrefix = Crestron.SimplSharp.CrestronIO.Directory.GetApplicationRootDirectory();
if (CrestronEnvironment.DevicePlatform != eDevicePlatform.Server) // Handles 3-series running Windows OS
try
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on 3-series Appliance", versionString);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Determining Platform....");
// Check if User/ProgramX exists
if (Directory.Exists(directoryPrefix + dirSeparator + "User"
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber)))
string filePathPrefix;
var dirSeparator = Global.DirectorySeparator;
var version = Crestron.SimplSharp.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
var versionString = string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build);
string directoryPrefix;
directoryPrefix = Crestron.SimplSharp.CrestronIO.Directory.GetApplicationRootDirectory();
if (CrestronEnvironment.DevicePlatform != eDevicePlatform.Server) // Handles 3-series running Windows OS
{
Debug.Console(0, @"User/program{0} directory found", InitialParametersClass.ApplicationNumber);
filePathPrefix = directoryPrefix + dirSeparator + "User"
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber) + dirSeparator;
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on 3-series Appliance", versionString);
// Check if User/ProgramX exists
if (Directory.Exists(directoryPrefix + dirSeparator + "User"
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber)))
{
Debug.Console(0, @"User/program{0} directory found", InitialParametersClass.ApplicationNumber);
filePathPrefix = directoryPrefix + dirSeparator + "User"
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber) + dirSeparator;
}
// Check if Nvram/Programx exists
else if (Directory.Exists(directoryPrefix + dirSeparator + "Nvram"
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber)))
{
Debug.Console(0, @"Nvram/program{0} directory found", InitialParametersClass.ApplicationNumber);
filePathPrefix = directoryPrefix + dirSeparator + "Nvram"
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber) + dirSeparator;
}
// If neither exists, set path to User/ProgramX
else
{
Debug.Console(0, @"No previous directory found. Using User/program{0}", InitialParametersClass.ApplicationNumber);
filePathPrefix = directoryPrefix + dirSeparator + "User"
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber) + dirSeparator;
}
}
// Check if Nvram/Programx exists
else if (Directory.Exists(directoryPrefix + dirSeparator + "Nvram"
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber)))
else // Handles Linux OS (Virtual Control)
{
Debug.Console(0, @"Nvram/program{0} directory found", InitialParametersClass.ApplicationNumber);
filePathPrefix = directoryPrefix + dirSeparator + "Nvram"
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber) + dirSeparator;
}
// If neither exists, set path to User/ProgramX
else
{
Debug.Console(0, @"No previous directory found. Using User/program{0}", InitialParametersClass.ApplicationNumber);
filePathPrefix = directoryPrefix + dirSeparator + "User"
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber) + dirSeparator;
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on Virtual Control Server", versionString);
// Set path to User/
filePathPrefix = directoryPrefix + dirSeparator + "User" + dirSeparator;
}
Global.SetFilePathPrefix(filePathPrefix);
}
else // Handles Linux OS (Virtual Control)
catch (Exception e)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on Virtual Control Server", versionString);
// Set path to User/
filePathPrefix = directoryPrefix + dirSeparator + "User" + dirSeparator;
Debug.Console(0, "Unable to Determine Platform due to Exception: {0}", e.Message);
}
Global.SetFilePathPrefix(filePathPrefix);
}
/// <summary>
@@ -141,6 +154,8 @@ namespace PepperDash.Essentials
{
try
{
Debug.SetDoNotLoadOnNextBoot(false);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials load from configuration");
var filesReady = SetupFilesystem();
@@ -335,7 +350,7 @@ namespace PepperDash.Essentials
{
var sysMon = DeviceManager.GetDeviceForKey("systemMonitor") as PepperDash.Essentials.Core.Monitoring.SystemMonitorController;
var appServer = DeviceManager.GetDeviceForKey("appServer") as CotijaSystemController;
var appServer = DeviceManager.GetDeviceForKey("appServer") as MobileControlSystemController;
if (sysMon != null && appServer != null)
@@ -359,21 +374,7 @@ namespace PepperDash.Essentials
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor"));
// Check if the processor is a DMPS model
if (this.ControllerPrompt.IndexOf("dmps", StringComparison.OrdinalIgnoreCase) > -1)
{
Debug.Console(2, "Adding DmpsRoutingController for {0} to Device Manager.", this.ControllerPrompt);
var dmpsRoutingController = DmpsRoutingController.GetDmpsRoutingController("processor-avRouting", this.ControllerPrompt, new DM.Config.DmpsRoutingPropertiesConfig());
DeviceManager.AddDevice(dmpsRoutingController);
}
else
{
Debug.Console(2, "************Processor is not DMPS type***************");
}
// Add global System Monitor device
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Monitoring.SystemMonitorController("systemMonitor"));
@@ -390,7 +391,26 @@ namespace PepperDash.Essentials
if (devConf.Type.ToLower() != Global.ControlSystem.ControllerPrompt.ToLower())
Debug.Console(0,
"WARNING: Config file defines processor type as '{0}' but actual processor is '{1}'! Some ports may not be available",
devConf.Type.ToUpper(), Global.ControlSystem.ControllerPrompt.ToUpper());
devConf.Type.ToUpper(), Global.ControlSystem.ControllerPrompt.ToUpper());
// Check if the processor is a DMPS model
if (this.ControllerPrompt.IndexOf("dmps", StringComparison.OrdinalIgnoreCase) > -1)
{
Debug.Console(2, "Adding DmpsRoutingController for {0} to Device Manager.", this.ControllerPrompt);
var propertiesConfig = JsonConvert.DeserializeObject<DM.Config.DmpsRoutingPropertiesConfig>(devConf.Properties.ToString());
if(propertiesConfig == null)
propertiesConfig = new DM.Config.DmpsRoutingPropertiesConfig();
var dmpsRoutingController = DmpsRoutingController.GetDmpsRoutingController("processor-avRouting", this.ControllerPrompt, propertiesConfig);
DeviceManager.AddDevice(dmpsRoutingController);
}
else
{
Debug.Console(2, "************Processor is not DMPS type***************");
}
continue;
}
@@ -489,13 +509,13 @@ namespace PepperDash.Essentials
DeviceManager.AddDevice(new Core.Fusion.EssentialsHuddleSpaceFusionSystemControllerBase((EssentialsHuddleSpaceRoom)room, 0xf1));
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Cotija Bridge...");
// Cotija bridge
var bridge = new CotijaEssentialsHuddleSpaceRoomBridge(room as EssentialsHuddleSpaceRoom);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge...");
// Mobile Control bridge
var bridge = new MobileConrolEssentialsHuddleSpaceRoomBridge(room as EssentialsHuddleSpaceRoom);
AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present
DeviceManager.AddDevice(bridge);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Cotija Bridge Added...");
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Mobile Control Bridge Added...");
}
else if (room is EssentialsHuddleVtc1Room)
{
@@ -504,9 +524,9 @@ namespace PepperDash.Essentials
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleVtc1Room, attempting to add to DeviceManager with Fusion");
DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController((EssentialsHuddleVtc1Room)room, 0xf1));
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Cotija Bridge...");
// Cotija bridge
var bridge = new CotijaEssentialsHuddleSpaceRoomBridge(room);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge...");
// Mobile Control bridge
var bridge = new MobileConrolEssentialsHuddleSpaceRoomBridge(room);
AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present
DeviceManager.AddDevice(bridge);
}
@@ -529,11 +549,11 @@ namespace PepperDash.Essentials
/// Helps add the post activation steps that link bridges to main controller
/// </summary>
/// <param name="bridge"></param>
void AddBridgePostActivationHelper(CotijaBridgeBase bridge)
void AddBridgePostActivationHelper(MobileControlBridgeBase bridge)
{
bridge.AddPostActivationAction(() =>
{
var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "appServer") as CotijaSystemController;
var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "appServer") as MobileControlSystemController;
if (parent == null)
{
Debug.Console(0, bridge, "ERROR: Cannot connect app server room bridge. System controller not present");

View File

@@ -61,18 +61,18 @@ namespace PepperDash.Essentials
else if (typeName == "appserver")
{
var props = JsonConvert.DeserializeObject<CotijaConfig>(properties.ToString());
return new CotijaSystemController(key, name, props);
var props = JsonConvert.DeserializeObject<MobileControlConfig>(properties.ToString());
return new MobileControlSystemController(key, name, props);
}
else if (typeName == "mobilecontrolbridge-ddvc01")
{
var comm = CommFactory.GetControlPropertiesConfig(dc);
var bridge = new PepperDash.Essentials.Room.Cotija.CotijaDdvc01RoomBridge(key, name, comm.IpIdInt);
var bridge = new PepperDash.Essentials.Room.MobileControl.MobileControlDdvc01RoomBridge(key, name, comm.IpIdInt);
bridge.AddPreActivationAction(() =>
{
var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "appServer") as CotijaSystemController;
var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "appServer") as MobileControlSystemController;
if (parent == null)
{
Debug.Console(0, bridge, "ERROR: Cannot connect bridge. System controller not present");

View File

@@ -38,7 +38,13 @@ namespace PepperDash.Essentials
else if (typeName == "dmdge200c")
dgeDevice = new DmDge200C(comm.IpIdInt, Global.ControlSystem);
var dgeController = new DgeController(config.Key, config.Name, dgeDevice, config, props);
if (dgeDevice == null)
{
Debug.Console(1, "Unable to create DGE device");
return null;
}
var dgeController = new DgeController(config.Key + "-comPorts", config.Name, dgeDevice, config, props);
DeviceManager.AddDevice(dgeController);

View File

@@ -121,6 +121,8 @@
<Compile Include="Bridges\BridgeFactory.cs" />
<Compile Include="Bridges\CameraControllerBridge.cs" />
<Compile Include="Bridges\AirMediaControllerBridge.cs" />
<Compile Include="Bridges\DmBladeChassisControllerBridge.cs" />
<Compile Include="Bridges\JoinMaps\DmBladeChassisControllerJoinMap.cs" />
<Compile Include="Bridges\DmpsAudioOutputControllerBridge.cs" />
<Compile Include="Bridges\DmpsRoutingControllerBridge.cs" />
<Compile Include="Bridges\DisplayControllerBridge.cs" />
@@ -184,12 +186,12 @@
<Compile Include="Room\Config\EssentialsHuddleRoomPropertiesConfig.cs" />
<Compile Include="Room\Config\EssentialsHuddleVtc1PropertiesConfig.cs" />
<Compile Include="Room\Config\EssentialsRoomEmergencyConfig.cs" />
<Compile Include="AppServer\CotijaConfig.cs" />
<Compile Include="AppServer\CotijaDdvc01DeviceBridge.cs" />
<Compile Include="AppServer\MobileControlConfig.cs" />
<Compile Include="AppServer\MobileControlDdvc01DeviceBridge.cs" />
<Compile Include="AppServer\Interfaces.cs" />
<Compile Include="AppServer\RoomBridges\CotijaBridgeBase.cs" />
<Compile Include="AppServer\RoomBridges\CotijaDdvc01RoomBridge.cs" />
<Compile Include="AppServer\RoomBridges\CotijaEssentialsHuddleSpaceRoomBridge.cs" />
<Compile Include="AppServer\RoomBridges\MobileControlBridgeBase.cs" />
<Compile Include="AppServer\RoomBridges\MobileControlDdvc01RoomBridge.cs" />
<Compile Include="AppServer\RoomBridges\MobileControlEssentialsHuddleSpaceRoomBridge.cs" />
<Compile Include="AppServer\DeviceTypeInterfaces\IChannelExtensions.cs" />
<Compile Include="AppServer\DeviceTypeInterfaces\IColorExtensions.cs" />
<Compile Include="AppServer\DeviceTypeInterfaces\IDPadExtensions.cs" />
@@ -238,7 +240,7 @@
<Compile Include="UIDrivers\Page Drivers\SingleSubpageModalAndBackDriver.cs" />
<Compile Include="UIDrivers\SmartObjectRoomsList.cs" />
<Compile Include="UI\JoinConstants\UIBoolJoin.cs" />
<Compile Include="AppServer\CotijaSystemController.cs" />
<Compile Include="AppServer\MobileControlSystemController.cs" />
<Compile Include="UI\DualDisplaySourceSRLController.cs" />
<Compile Include="UI\SubpageReferenceListActivityItem.cs" />
<Compile Include="FOR REFERENCE UI\Panels\REMOVE UiCue.cs" />

View File

@@ -38,6 +38,12 @@ namespace PepperDash.Essentials.Room.Config
{
return new Device(roomConfig.Key, roomConfig.Name); // placeholder device that does nothing.
}
else if (typeName == "dualdisplay")
{
var rm = new EssentialsDualDisplayRoom(roomConfig);
return rm;
}
return null;
}

View File

@@ -15,7 +15,7 @@ using PepperDash.Essentials.Devices.Common.Codec;
using PepperDash.Essentials.Devices.Common.VideoCodec;
using PepperDash.Essentials.Devices.Common.AudioCodec;
namespace PepperDash.Essentials.Room.Types
namespace PepperDash.Essentials
{
public class EssentialsDualDisplayRoom : EssentialsNDisplayRoomBase, IHasCurrentVolumeControls,
IRunRouteAction, IPrivacy, IRunDefaultCallRoute, IHasVideoCodec, IHasAudioCodec, IHasInCallFeedback
@@ -174,9 +174,11 @@ namespace PepperDash.Essentials.Room.Types
var leftDisp = PropertiesConfig.Displays[eSourceListItemDestinationTypes.leftDisplay];
if (leftDisp != null)
{
if (!string.IsNullOrEmpty(leftDisp.Key))
{
LeftDisplay = DeviceManager.GetDeviceForKey(leftDisp.Key) as IRoutingSinkWithSwitching;
Displays.Add(eSourceListItemDestinationTypes.leftDisplay, LeftDisplay);
}
else
Debug.Console(0, this, "Unable to get LeftDisplay for Room");
}
@@ -184,9 +186,11 @@ namespace PepperDash.Essentials.Room.Types
var rightDisp = PropertiesConfig.Displays[eSourceListItemDestinationTypes.rightDisplay];
if (rightDisp != null)
{
if (!string.IsNullOrEmpty(rightDisp.Key))
{
LeftDisplay = DeviceManager.GetDeviceForKey(rightDisp.Key) as IRoutingSinkWithSwitching;
Displays.Add(eSourceListItemDestinationTypes.rightDisplay, RightDisplay);
}
else
Debug.Console(0, this, "Unable to get LeftDisplay for Room");
}

View File

@@ -223,6 +223,8 @@ namespace PepperDash.Essentials
CrestronEnvironment.Sleep(1000);
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Shutting down room");
RunRouteAction("roomOff");
}
@@ -275,8 +277,8 @@ namespace PepperDash.Essentials
// Run this on a separate thread
new CTimer(o =>
{
Debug.Console(1, this, "Run route action '{0}'", routeKey);
var dict = ConfigReader.ConfigObject.GetSourceListForKey(SourceListKey);
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Run route action '{0}'", routeKey);
var dict = ConfigReader.ConfigObject.GetSourceListForKey(SourceListKey);
if(dict == null)
{
Debug.Console(1, this, "WARNING: Config source list '{0}' not found", SourceListKey);

View File

@@ -226,63 +226,25 @@ namespace PepperDash.Essentials
void Initialize()
{
if (DefaultAudioDevice is IBasicVolumeControls)
DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls;
else if (DefaultAudioDevice is IHasVolumeDevice)
DefaultVolumeControls = (DefaultAudioDevice as IHasVolumeDevice).VolumeDevice;
CurrentVolumeControls = DefaultVolumeControls;
var disp = DefaultDisplay as DisplayBase;
if (disp != null)
try
{
// Link power, warming, cooling to display
disp.PowerIsOnFeedback.OutputChange += (o, a) =>
{
if (disp.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue)
{
if (!disp.PowerIsOnFeedback.BoolValue)
CurrentSourceInfo = null;
OnFeedback.FireUpdate();
}
if (disp.PowerIsOnFeedback.BoolValue)
{
SetDefaultLevels();
}
};
if (DefaultAudioDevice is IBasicVolumeControls)
DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls;
else if (DefaultAudioDevice is IHasVolumeDevice)
DefaultVolumeControls = (DefaultAudioDevice as IHasVolumeDevice).VolumeDevice;
CurrentVolumeControls = DefaultVolumeControls;
disp.IsWarmingUpFeedback.OutputChange += (o, a) =>
{
IsWarmingUpFeedback.FireUpdate();
if (!IsWarmingUpFeedback.BoolValue)
(CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(DefaultVolume);
};
disp.IsCoolingDownFeedback.OutputChange += (o, a) =>
{
IsCoolingDownFeedback.FireUpdate();
};
}
// Get Microphone Privacy object, if any
this.MicrophonePrivacy = EssentialsRoomConfigHelper.GetMicrophonePrivacy(PropertiesConfig, this);
Debug.Console(2, this, "Microphone Privacy Config evaluated.");
// Get emergency object, if any
this.Emergency = EssentialsRoomConfigHelper.GetEmergency(PropertiesConfig, this);
Debug.Console(2, this, "Emergency Config evaluated.");
// Combines call feedback from both codecs if available
InCallFeedback = new BoolFeedback(() =>
// Combines call feedback from both codecs if available
InCallFeedback = new BoolFeedback(() =>
{
bool inAudioCall = false;
bool inVideoCall = false;
if(AudioCodec != null)
if (AudioCodec != null)
inAudioCall = AudioCodec.IsInCall;
if(VideoCodec != null)
if (VideoCodec != null)
inVideoCall = VideoCodec.IsInCall;
if (inAudioCall || inVideoCall)
@@ -291,22 +253,71 @@ namespace PepperDash.Essentials
return false;
});
VideoCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate();
var disp = DefaultDisplay as DisplayBase;
if (disp != null)
{
// Link power, warming, cooling to display
disp.PowerIsOnFeedback.OutputChange += (o, a) =>
{
if (disp.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue)
{
if (!disp.PowerIsOnFeedback.BoolValue)
CurrentSourceInfo = null;
OnFeedback.FireUpdate();
}
if (disp.PowerIsOnFeedback.BoolValue)
{
SetDefaultLevels();
}
};
if (AudioCodec != null)
AudioCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate();
disp.IsWarmingUpFeedback.OutputChange += (o, a) =>
{
IsWarmingUpFeedback.FireUpdate();
if (!IsWarmingUpFeedback.BoolValue)
(CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(DefaultVolume);
};
disp.IsCoolingDownFeedback.OutputChange += (o, a) =>
{
IsCoolingDownFeedback.FireUpdate();
};
IsSharingFeedback = new BoolFeedback(() => VideoCodec.SharingContentIsOnFeedback.BoolValue);
VideoCodec.SharingContentIsOnFeedback.OutputChange += (o, a) => this.IsSharingFeedback.FireUpdate();
}
// link privacy to VC (for now?)
PrivacyModeIsOnFeedback = new BoolFeedback(() => VideoCodec.PrivacyModeIsOnFeedback.BoolValue);
VideoCodec.PrivacyModeIsOnFeedback.OutputChange += (o, a) => this.PrivacyModeIsOnFeedback.FireUpdate();
CallTypeFeedback = new IntFeedback(() => 0);
SourceListKey = "default";
EnablePowerOnToLastSource = true;
// Get Microphone Privacy object, if any MUST HAPPEN AFTER setting InCallFeedback
this.MicrophonePrivacy = EssentialsRoomConfigHelper.GetMicrophonePrivacy(PropertiesConfig, this);
Debug.Console(2, this, "Microphone Privacy Config evaluated.");
// Get emergency object, if any
this.Emergency = EssentialsRoomConfigHelper.GetEmergency(PropertiesConfig, this);
Debug.Console(2, this, "Emergency Config evaluated.");
VideoCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate();
if (AudioCodec != null)
AudioCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate();
IsSharingFeedback = new BoolFeedback(() => VideoCodec.SharingContentIsOnFeedback.BoolValue);
VideoCodec.SharingContentIsOnFeedback.OutputChange += (o, a) => this.IsSharingFeedback.FireUpdate();
// link privacy to VC (for now?)
PrivacyModeIsOnFeedback = new BoolFeedback(() => VideoCodec.PrivacyModeIsOnFeedback.BoolValue);
VideoCodec.PrivacyModeIsOnFeedback.OutputChange += (o, a) => this.PrivacyModeIsOnFeedback.FireUpdate();
CallTypeFeedback = new IntFeedback(() => 0);
SourceListKey = "default";
EnablePowerOnToLastSource = true;
}
catch (Exception e)
{
Debug.Console(0, this, "Error Initializing Room: {0}", e);
}
}
protected override void CustomSetConfig(DeviceConfig config)
@@ -323,8 +334,11 @@ namespace PepperDash.Essentials
{
// Add Occupancy object from config
if (PropertiesConfig.Occupancy != null)
{
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Setting Occupancy Provider for room");
this.SetRoomOccupancy(DeviceManager.GetDeviceForKey(PropertiesConfig.Occupancy.DeviceKey) as
IOccupancyStatusProvider, PropertiesConfig.Occupancy.TimeoutMinutes);
}
this.LogoUrl = PropertiesConfig.Logo.GetUrl();
this.SourceListKey = PropertiesConfig.SourceListKey;
@@ -348,6 +362,8 @@ namespace PepperDash.Essentials
CrestronEnvironment.Sleep(1000);
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Shutting down room");
RunRouteAction("roomOff");
}
@@ -397,7 +413,7 @@ namespace PepperDash.Essentials
try
{
Debug.Console(1, this, "Run route action '{0}'", routeKey);
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Run route action '{0}'", routeKey);
var dict = ConfigReader.ConfigObject.GetSourceListForKey(SourceListKey);
if (dict == null)
{

View File

@@ -12,21 +12,21 @@ using PepperDash.Essentials.Core.Devices;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Room.Config;
namespace PepperDash.Essentials.Room.Types
namespace PepperDash.Essentials
{
/// <summary>
/// Base class for rooms with more than a single display
/// </summary>
public abstract class EssentialsNDisplayRoomBase : EssentialsRoomBase
public abstract class EssentialsNDisplayRoomBase : EssentialsRoomBase, IHasMultipleDisplays
{
//public event SourceInfoChangeHandler CurrentSingleSourceChange;
public Dictionary<eSourceListItemDestinationTypes, IRoutingSinkWithSwitching> Displays { get; protected set;}
public EssentialsNDisplayRoomBase(DeviceConfig config)
: base (config)
{
var propertiesConfig = JsonConvert.DeserializeObject<EssentialsNDisplayRoomPropertiesConfig>(config.Properties.ToString());
Displays = new Dictionary<eSourceListItemDestinationTypes, IRoutingSinkWithSwitching>();
}
}

View File

@@ -30,12 +30,17 @@ namespace PepperDash.Essentials
tsw.SigChange += Panel_SigChange;
}
public EssentialsTouchpanelController(string key, string name, Dge100 panel, string projectName, string sgdPath)
public EssentialsTouchpanelController(string key, string name, Dge100 dge, string projectName, string sgdPath)
: base(key, name)
{
Panel = panel;
panel.LoadSmartObjects(sgdPath);
panel.SigChange += Panel_SigChange;
Panel = dge;
if (!string.IsNullOrEmpty(sgdPath))
dge.LoadSmartObjects(sgdPath);
else
Debug.Console(1, this, "No SGD file path defined");
dge.SigChange += Panel_SigChange;
}
/// <summary>

View File

@@ -17,15 +17,27 @@ namespace PepperDash.Essentials.Core.Config
[JsonProperty("info")]
public InfoConfig Info { get; set; }
/// <summary>
/// Defines the devices in the system
/// </summary>
[JsonProperty("devices")]
public List<DeviceConfig> Devices { get; set; }
/// <summary>
/// Defines the source list for the system
/// </summary>
[JsonProperty("sourceLists")]
public Dictionary<string, Dictionary<string, SourceListItem>> SourceLists { get; set; }
/// <summary>
/// Defines all the tie lines for system routing
/// </summary>
[JsonProperty("tieLines")]
public List<TieLineConfig> TieLines { get; set; }
/// <summary>
/// Defines any join maps to override the default join maps
/// </summary>
[JsonProperty("joinMaps")]
public Dictionary<string, string> JoinMaps { get; set; }

View File

@@ -11,24 +11,43 @@ using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Core.Config
{
public class DeviceConfig
public class DeviceConfig : PropertiesConfigBase
{
[JsonProperty("key")]
/// <summary>
/// The unique idendifier for the device
/// </summary>
[JsonProperty("key", Required = Required.Always)]
public string Key { get; set; }
/// <summary>
/// A unique ID for each device instance. Used to differentiate between devices of the same type that may have
/// been added/removed from the system
/// </summary>
[JsonProperty("uid")]
public int Uid { get; set; }
/// <summary>
/// The name of the device
/// </summary>
[JsonProperty("name")]
public string Name { get; set; }
/// <summary>
/// The group for the device
/// </summary>
[JsonProperty("group")]
public string Group { get; set; }
[JsonProperty("type")]
/// <summary>
/// The type of the device to instantiate
/// </summary>
[JsonProperty("type", Required = Required.Always)]
public string Type { get; set; }
[JsonProperty("properties")]
/// <summary>
/// The properties necessary to define the device
/// </summary>
[JsonProperty("properties", Required = Required.Always)]
[JsonConverter(typeof(DevicePropertiesConverter))]
public JToken Properties { get; set; }
}
@@ -59,7 +78,7 @@ namespace PepperDash.Essentials.Core.Config
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
throw new NotImplementedException("SOD OFF HOSER");
throw new NotImplementedException("Not Supported");
}
}
}

View File

@@ -4,6 +4,7 @@ using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Schema;
using PepperDash.Core;
using PepperDash.Core.Config;
@@ -91,9 +92,24 @@ namespace PepperDash.Essentials.Core.Config
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loading config file: '{0}'", filePath);
var directoryPrefix = string.Format("{0}Config{1}Schema{1}", Global.ApplicationDirectoryPrefix, Global.DirectorySeparator);
var schemaFilePath = directoryPrefix + "EssentialsConfigSchema.json";
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loading Schema from path: {0}", schemaFilePath);
var jsonConfig = fs.ReadToEnd();
if(File.Exists(schemaFilePath))
{
// Attempt to validate config against schema
ValidateSchema(jsonConfig, schemaFilePath);
}
else
Debug.Console(0, Debug.ErrorLogLevel.Warning, "No Schema found at path: {0}", schemaFilePath);
if (localConfigFound)
{
ConfigObject = JObject.Parse(fs.ReadToEnd()).ToObject<EssentialsConfig>();
ConfigObject = JObject.Parse(jsonConfig).ToObject<EssentialsConfig>();
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Successfully Loaded Local Config");
@@ -101,7 +117,7 @@ namespace PepperDash.Essentials.Core.Config
}
else
{
var doubleObj = JObject.Parse(fs.ReadToEnd());
var doubleObj = JObject.Parse(jsonConfig);
ConfigObject = PortalConfigReader.MergeConfigs(doubleObj).ToObject<EssentialsConfig>();
// Extract SystemUrl and TemplateUrl into final config output
@@ -129,6 +145,40 @@ namespace PepperDash.Essentials.Core.Config
}
}
/// <summary>
/// Attempts to validate the JSON against the specified schema
/// </summary>
/// <param name="json">JSON to be validated</param>
/// <param name="schemaFileName">File name of schema to validate against</param>
public static void ValidateSchema(string json, string schemaFileName)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Validating Config File against Schema...");
JObject config = JObject.Parse(json);
using (StreamReader fileStream = new StreamReader(schemaFileName))
{
JsonSchema schema = JsonSchema.Parse(fileStream.ReadToEnd());
if (config.IsValid(schema))
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Configuration successfully Validated Against Schema");
else
{
Debug.Console(0, Debug.ErrorLogLevel.Warning, "Validation Errors Found in Configuration:");
config.Validate(schema, Json_ValidationEventHandler);
}
}
}
/// <summary>
/// Event Handler callback for JSON validation
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
public static void Json_ValidationEventHandler(object sender, ValidationEventArgs args)
{
Debug.Console(0, "JSON Validation error at line {0} position {1}: {2}", args.Exception.LineNumber, args.Exception.LinePosition, args.Message);
}
/// <summary>
/// Returns all the files from the directory specified.
/// </summary>

View File

@@ -21,8 +21,6 @@ namespace PepperDash.Essentials.Core.Config
public string TemplateUrl { get; set; }
//public CotijaConfig Cotija { get; private set; }
[JsonProperty("systemUuid")]
public string SystemUuid
{

View File

@@ -0,0 +1,181 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"title": "Control Properties",
"$ref": "#/definitions/ControlPropertiesConfig",
"definitions": {
"ControlPropertiesConfig": {
"description": "The method of communicating with the device",
"properties": {
"method": {
"type": "string",
"title": "Communication Method",
"enum": [
"none",
"com",
"ipid",
"ipidtcp",
"ir",
"ssh",
"tcpip",
"telnet",
"cresnet",
"cec",
"udp"
]
},
"tcpSshProperties": {
"$ref":"TcpSshPropertiesConfigSchema.json#definitions/TcpSshPropertiesConfig",
"title": "Properties for IP based communication",
"default": null
},
"comParams": {
"title":"Com Port parameters",
"description": "The parameters to configure the COM port",
"type":"object",
"protocol":{
"title":"Protocol",
"type":"string",
"enum":[
"RS232",
"RS422",
"RS485"
]
},
"baudRate":{
"title":"Baud Rate",
"type":"integer",
"enum":[
300,
600,
1200,
1800,
2400,
3600,
4800,
7200,
9600,
14400,
19200,
28800,
38400,
57600,
115200
]
},
"dataBits":{
"title":"Data Bits",
"type":"integer",
"enum":[
7,
8
]
},
"stopBits":{
"title":"Stop Bits",
"type":"integer",
"enum":[
1,
2
]
},
"parity":{
"title":"Parity",
"type":"string",
"enum":[
"None",
"Even",
"One"
]
},
"softwareHandshake":{
"title":"Software Handshake",
"type":"string",
"enum":[
"None",
"RTS",
"CTS",
"RTSCTS"
]
},
"hardwareHandshake":{
"title":"Hardware Handshake",
"type":"string",
"enum":[
"None",
"XON",
"XONT",
"XONR"
]
},
"pacing":{
"title":"Pacing",
"type":"integer"
}
},
"cresnetId":{
"type": "string",
"title":"Cresnet ID",
"description": "Cresnet ID of the device",
"default": "",
"examples": [
"13",
"03",
"0A",
"F1"
],
"pattern": "^(?!00|01|02|FF)[0-9,A-F,a-f][0-9,A-F,a-f]$"
},
"controlPortDevKey": {
"type": "string",
"title":"Port Device",
"description": "Key of the device where the control port is found",
"examples": [
"processor"
]
},
"controlPortNumber": {
"type": "integer",
"title": "Port Number",
"description": "Control Port Number on the device referenced by controlPortDevKey",
"examples": [
1
]
},
"controlPortName": {
"type": "string",
"title": "Port Name",
"description": "Control Port Name on the device referenced by controlPortDevKey",
"examples": [
"hdmi1"
]
},
"irFile": {
"type": "string",
"title": "IR File",
"description": "IR Filename",
"default": "",
"examples": [
"Comcast Motorola DVR.ir"
],
"pattern": "^(.*).ir$"
},
"ipid": {
"type": "string",
"title": "IPID",
"default": "",
"examples": [
"13",
"03",
"0A",
"F1"
],
"pattern": "^(?!00|01|02|FF)[0-9,A-F,a-f][0-9,A-F,a-f]$"
}
},
"required": [
"method"
]
}
}
}

View File

@@ -0,0 +1,282 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Essentials Configuration File Schema",
"description": "",
"type": "object",
"$ref":"#/definitions/EssentialsConfig",
"definitions": {
"EssentialsConfig": {
"type": "object",
"additionalProperties": false,
"properties": {
"template": {
"$ref": "#/definitions/BasicConfig"
},
"system_url": {
"type": "string",
"format": "uri",
"qt-uri-protocols": [
"https"
]
},
"system": {
"$ref": "#/definitions/BasicConfig"
},
"template_url": {
"type": "string",
"format": "uri",
"qt-uri-protocols": [
"https"
]
}
},
"required": [
"system",
"template"
],
"title": "Essentials Configuration"
},
"BasicConfig": {
"type": "object",
"additionalProperties": false,
"properties": {
"devices": {
"type": "array",
"items": {
"$ref": "#/definitions/Device"
}
},
"rooms": {
"type": "array",
"items": {
"$ref": "#/definitions/Room"
}
},
"info": {
"$ref": "#/definitions/Info"
},
"sourceLists": {
"$ref": "#/definitions/SourceLists"
}
},
"required": [
],
"title": "Basic Config"
},
"Info": {
"type": "object",
"additionalProperties": true,
"properties": {
"name":{
"type":"string"
},
"date":{
"type":"string",
"format": "date-time"
},
"version":{
"type":"string"
},
"runtimeInfo":{
"$ref":"#/definitions/RuntimeInfo"
},
"comment":{
"type":"string"
},
"hostname":{
"type":"string"
},
"appNumber":{
"type":"integer"
},
"lastModifiedDate": {
"type": "string",
"format": "date-time"
},
"lastUid":{
"type":"integer"
},
"processorType":{
"type":"string"
},
"systemType":{
"type":"string"
},
"requiredControlSoftwareVersion":{
"type":"string"
}
},
"required": [
],
"title": "Info"
},
"RuntimeInfo":{
"type":"object",
"additionalProperties": false,
"properties": {
"appName":{
"type":"string"
},
"assemblyVersion": {
"type":"string"
},
"osVersion":{
"type":"string"
}
}
},
"Device": {
"type": "object",
"additionalProperties": true,
"properties": {
"name": {
"type": "string"
},
"group": {
"type": "string"
},
"properties": {
"type":"object"
},
"uid": {
"type": "integer"
},
"key": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"group",
"key",
"properties",
"type"
],
"title": "Device"
},
"Room": {
"type": "object",
"additionalProperties": false,
"properties": {
"key": {
"type": "string"
},
"name": {
"type": "string"
},
"properties": {
"type": "object"
},
"type": {
"type": "string"
}
},
"required": [
"key",
"name",
"properties",
"type"
],
"title": "Room"
},
"SourceLists": {
"type": "object",
"additionalProperties": true,
"properties": {
"default":{
"$ref":"#/definitions/SourceList"
}
},
"title": "SourceLists"
},
"SourceList": {
"type": "object",
"additionalProperties": true,
"properties": {
},
"title": "Source List"
},
"Source": {
"type": "object",
"additionalProperties": false,
"properties": {
"icon": {
"type": "string"
},
"volumeControlKey": {
"type": "string"
},
"sourceKey": {
"type": "string"
},
"routeList": {
"type": "array",
"items": {
"$ref": "#/definitions/RouteList"
}
},
"includeInSourceList": {
"type": "boolean"
},
"type": {
"type": "string",
"enum":[
"route",
"off",
"other"
]
},
"altIcon": {
"type": "string"
},
"order": {
"type": "integer"
},
"disableCodecSharing": {
"type": "boolean"
}
},
"required": [
"includeInSourceList",
"order",
"routeList",
"sourceKey",
"type",
"volumeControlKey"
],
"title": "Source"
},
"RouteList": {
"type": "object",
"additionalProperties": false,
"properties": {
"destinationKey": {
"type": "string"
},
"sourceKey": {
"type": "string"
},
"type": {
"type": "string",
"enum":[
"audio",
"video",
"audioVideo",
"usbOutput",
"usbInput"
]
}
},
"required": [
"destinationKey",
"sourceKey",
"type"
],
"title": "RouteList"
}
}
}

View File

@@ -0,0 +1,81 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"title": "TcpSshPropertiesConfig",
"$ref": "#/definitions/TcpSshPropertiesConfig",
"definitions": {
"TcpSshPropertiesConfig": {
"properties": {
"username": {
"type": "string",
"title": "Username",
"default":"",
"examples": [
"admin"
],
"pattern": "^(.*)$"
},
"port": {
"type": "integer",
"title": "Port Number",
"minimum": 1,
"maximum": 65535,
"examples": [
22,
23,
1515
]
},
"address": {
"type": "string",
"title": "IP Address or Hostname",
"examples": [
"192.168.99.100",
"myDeviceHostname"
],
"pattern": "^(.*)$"
},
"password": {
"type": "string",
"title": "Password",
"default":"",
"examples": [
"password"
],
"pattern": "^(.*)$"
},
"autoReconnect": {
"type": "boolean",
"title": "Auto Reconnect",
"description": "Indicates if automatic attemtps to reconnect should be made if communication is lost with the device",
"default": true,
"examples": [
true
]
},
"autoReconnectIntervalMs": {
"type": "integer",
"title": "Auto Reconnect Interval (Milliseconds)",
"description": "If Auto Reconnect is enabled, how often should reconnect attempts be made",
"default": 5000,
"examples": [
2000
]
},
"bufferSize": {
"type": "integer",
"title": "Buffer Size",
"description": "The size of the receive buffer to use",
"default": 32768,
"examples": [
32768
]
}
},
"required": [
"port",
"address"
]
}
}
}

View File

@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.GeneralIO;
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Wrapper class for CEN-IO-DIGIN-104 digital input module
/// </summary>
public class CenIoDigIn104Controller : Device, IDigitalInputPorts
{
public CenIoDi104 Di104 { get; private set; }
public CenIoDigIn104Controller(string key, string name, CenIoDi104 di104)
: base(key, name)
{
Di104 = di104;
}
#region IDigitalInputPorts Members
public CrestronCollection<DigitalInput> DigitalInputPorts
{
get { return Di104.DigitalInputPorts; }
}
public int NumberOfDigitalInputPorts
{
get { return Di104.NumberOfDigitalInputPorts; }
}
#endregion
}
}

View File

@@ -10,7 +10,9 @@ using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core.Devices
{
/// <summary>
///
/// This class should be inherited from when the configuration can be modified at runtime from another source other than the configuration file.
/// It contains the necessary properties, methods and events to allot the initial device configuration to be overridden and then notifies the
/// ConfigWriter to write out the new values to a local file to be read on next boot.
/// </summary>
public abstract class ReconfigurableDevice : Device
{

View File

@@ -67,34 +67,64 @@ namespace PepperDash.Essentials.Core
[JsonProperty("name")]
public string Name { get; set; }
/// <summary>
/// The icon to display
/// </summary>
[JsonProperty("icon")]
public string Icon { get; set; }
/// <summary>
/// Alternate icon to display
/// </summary>
[JsonProperty("altIcon")]
public string AltIcon { get; set; }
/// <summary>
/// Indicates if the source should be included in the list
/// </summary>
[JsonProperty("includeInSourceList")]
public bool IncludeInSourceList { get; set; }
/// <summary>
/// Determines the order the source appears in the list (ascending)
/// </summary>
[JsonProperty("order")]
public int Order { get; set; }
/// <summary>
/// Key of the volume control device for the source
/// </summary>
[JsonProperty("volumeControlKey")]
public string VolumeControlKey { get; set; }
/// <summary>
/// The type of source list item
/// </summary>
[JsonProperty("type")]
[JsonConverter(typeof(StringEnumConverter))]
public eSourceListItemType Type { get; set; }
/// <summary>
/// The list of routes to run when source is selected
/// </summary>
[JsonProperty("routeList")]
public List<SourceRouteListItem> RouteList { get; set; }
/// <summary>
/// Indicates if this source should be disabled for sharing via codec content
/// </summary>
[JsonProperty("disableCodecSharing")]
public bool DisableCodecSharing { get; set; }
/// <summary>
/// Indicates if this source should be disabled for local routing
/// </summary>
[JsonProperty("disableRoutedSharing")]
public bool DisableRoutedSharing { get; set; }
/// <summary>
/// The list of valid destination types for this source
/// </summary>
[JsonProperty("destinations")]
public List<eSourceListItemDestinationTypes> Destinations { get; set; }

View File

@@ -52,6 +52,13 @@ namespace PepperDash.Essentials.Core
Debug.Console(1, "Factory Attempting to create new Generic Comm Device");
return new GenericComm(dc);
}
else if (typeName == "ceniodigin104")
{
var control = CommFactory.GetControlPropertiesConfig(dc);
var ipid = control.CresnetIdInt;
return new CenIoDigIn104Controller(key, name, new Crestron.SimplSharpPro.GeneralIO.CenIoDi104(ipid, Global.ControlSystem));
}
// then check for types that have been added by plugin dlls.
if (FactoryMethods.ContainsKey(typeName))

View File

@@ -9,8 +9,14 @@ using PepperDash.Essentials.License;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Global application properties
/// </summary>
public static class Global
{
/// <summary>
/// The control system the application is running on
/// </summary>
public static CrestronControlSystem ControlSystem { get; set; }
public static LicenseManager LicenseManager { get; set; }
@@ -31,6 +37,19 @@ namespace PepperDash.Essentials.Core
}
}
/// <summary>
/// The file path prefix to the folder containing the application files (including embedded resources)
/// </summary>
public static string ApplicationDirectoryPrefix
{
get
{
string fmt = "00.##";
var appNumber = InitialParametersClass.ApplicationNumber.ToString(fmt);
return string.Format("{0}{1}Simpl{1}app{2}{1}", Crestron.SimplSharp.CrestronIO.Directory.GetApplicationRootDirectory(), Global.DirectorySeparator,appNumber );
}
}
/// <summary>
/// Wildcarded config file name for global reference
/// </summary>

View File

@@ -87,7 +87,11 @@ namespace PepperDash.Essentials.Core.Privacy
else
Debug.Console(0, this, "Unable to add Red LED device");
CheckPrivacyMode();
AddPostActivationAction(() => {
CheckPrivacyMode();
PrivacyDevice.PrivacyModeIsOnFeedback.OutputChange -= PrivacyModeIsOnFeedback_OutputChange;
PrivacyDevice.PrivacyModeIsOnFeedback.OutputChange += PrivacyModeIsOnFeedback_OutputChange;
});
initialized = true;
@@ -97,8 +101,6 @@ namespace PepperDash.Essentials.Core.Privacy
public void SetPrivacyDevice(IPrivacy privacyDevice)
{
PrivacyDevice = privacyDevice;
PrivacyDevice.PrivacyModeIsOnFeedback.OutputChange += PrivacyModeIsOnFeedback_OutputChange;
}
void PrivacyModeIsOnFeedback_OutputChange(object sender, EventArgs e)

View File

@@ -62,6 +62,10 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Fusion.dll</HintPath>
</Reference>
<Reference Include="Crestron.SimplSharpPro.GeneralIO, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.GeneralIO.dll</HintPath>
</Reference>
<Reference Include="Crestron.SimplSharpPro.Remotes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Remotes.dll</HintPath>
@@ -114,6 +118,7 @@
<Compile Include="Config\Essentials\ConfigWriter.cs" />
<Compile Include="Config\Essentials\EssentialsConfig.cs" />
<Compile Include="Config\SourceDevicePropertiesConfigBase.cs" />
<Compile Include="Crestron IO\Inputs\CenIoDigIn104Controller.cs" />
<Compile Include="Crestron IO\Inputs\GenericDigitalInputDevice.cs" />
<Compile Include="Crestron IO\Inputs\GenericVersiportInputDevice.cs" />
<Compile Include="Crestron IO\Inputs\IDigitalInput.cs" />
@@ -262,6 +267,15 @@
<Compile Include="SmartObjects\SubpageReferencList\SubpageReferenceList.cs" />
<Compile Include="SmartObjects\SubpageReferencList\SubpageReferenceListItem.cs" />
<None Include="app.config" />
<EmbeddedResource Include="Config\Schema\EssentialsConfigSchema.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="Config\Schema\ControlPropertiesConfigSchema.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="Config\Schema\TcpSshPropertiesConfigSchema.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<None Include="Properties\ControlSystem.cfg" />
</ItemGroup>
<ItemGroup>

View File

@@ -100,7 +100,8 @@ namespace PepperDash.Essentials.Core
ShutdownPromptTimer.HasFinished += (o, a) => Shutdown(); // Shutdown is triggered
ShutdownPromptSeconds = 60;
ShutdownVacancySeconds = 120;
ShutdownVacancySeconds = 120;
ShutdownType = eShutdownType.None;
RoomVacancyShutdownTimer = new SecondsCountdownTimer(Key + "-vacancyOffTimer");
@@ -140,7 +141,7 @@ namespace PepperDash.Essentials.Core
case eVacancyMode.InShutdownWarning:
{
StartShutdown(eShutdownType.Vacancy);
Debug.Console(0, this, "Shutting Down due to vacancy.");
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Shutting Down due to vacancy.");
break;
}
default:
@@ -163,7 +164,7 @@ namespace PepperDash.Essentials.Core
ShutdownType = type;
ShutdownPromptTimer.Start();
Debug.Console(0, this, "ShutdwonPromptTimer Started. Type: {0}. Seconds: {1}", ShutdownType, ShutdownPromptTimer.SecondsToCount);
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "ShutdownPromptTimer Started. Type: {0}. Seconds: {1}", ShutdownType, ShutdownPromptTimer.SecondsToCount);
}
public void StartRoomVacancyTimer(eVacancyMode mode)
@@ -175,7 +176,7 @@ namespace PepperDash.Essentials.Core
VacancyMode = mode;
RoomVacancyShutdownTimer.Start();
Debug.Console(0, this, "Vacancy Timer Started. Mode: {0}. Seconds: {1}", VacancyMode, RoomVacancyShutdownTimer.SecondsToCount);
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Vacancy Timer Started. Mode: {0}. Seconds: {1}", VacancyMode, RoomVacancyShutdownTimer.SecondsToCount);
}
/// <summary>
@@ -211,6 +212,9 @@ namespace PepperDash.Essentials.Core
return;
}
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Room Occupancy set to device: '{0}'", (statusProvider as Device).Key);
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Timeout Minutes from Config is: {0}", timeoutMinutes);
// If status provider is fusion, set flag to remote
if (statusProvider is Core.Fusion.EssentialsHuddleSpaceFusionSystemControllerBase)
OccupancyStatusProviderIsRemote = true;
@@ -218,16 +222,14 @@ namespace PepperDash.Essentials.Core
if(timeoutMinutes > 0)
RoomVacancyShutdownSeconds = timeoutMinutes * 60;
Debug.Console(1, this, "RoomVacancyShutdownSeconds set to {0}", RoomVacancyShutdownSeconds);
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "RoomVacancyShutdownSeconds set to {0}", RoomVacancyShutdownSeconds);
RoomOccupancy = statusProvider;
OnRoomOccupancyIsSet();
RoomOccupancy.RoomIsOccupiedFeedback.OutputChange -= RoomIsOccupiedFeedback_OutputChange;
RoomOccupancy.RoomIsOccupiedFeedback.OutputChange += RoomIsOccupiedFeedback_OutputChange;
Debug.Console(0, this, "Room Occupancy set to device: '{0}'", (statusProvider as Device).Key);
OnRoomOccupancyIsSet();
}
void OnRoomOccupancyIsSet()
@@ -252,13 +254,13 @@ namespace PepperDash.Essentials.Core
{
if (RoomOccupancy.RoomIsOccupiedFeedback.BoolValue == false)
{
Debug.Console(1, this, "Notice: Vacancy Detected");
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Notice: Vacancy Detected");
// Trigger the timer when the room is vacant
StartRoomVacancyTimer(eVacancyMode.InInitialVacancy);
}
else
{
Debug.Console(1, this, "Notice: Occupancy Detected");
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Notice: Occupancy Detected");
// Reset the timer when the room is occupied
RoomVacancyShutdownTimer.Cancel();
}

View File

@@ -22,6 +22,14 @@ namespace PepperDash.Essentials.Core
IRoutingSinkWithSwitching DefaultDisplay { get; }
}
/// <summary>
/// For rooms with multiple displays
/// </summary>
public interface IHasMultipleDisplays
{
Dictionary<eSourceListItemDestinationTypes, IRoutingSinkWithSwitching> Displays { get; }
}
/// <summary>
/// For rooms with routing
/// </summary>
@@ -30,8 +38,6 @@ namespace PepperDash.Essentials.Core
void RunRouteAction(string routeKey);
void RunRouteAction(string routeKey, Action successCallback);
}
/// <summary>

View File

@@ -31,7 +31,6 @@ namespace PepperDash.Essentials.Core
event SourceInfoChangeHandler CurrentSourceChange;
}
/// <summary>
/// Defines a class that has a collection of RoutingInputPorts
/// </summary>

View File

@@ -33,9 +33,9 @@ namespace PepperDash.Essentials.Core
{
Audio = 1,
Video = 2,
//AudioVideo = 4,
UsbOutput = 4,
UsbInput = 8
AudioVideo = 4,
UsbOutput = 8,
UsbInput = 16
}
public enum eRoutingPortConnectionType

View File

@@ -33,7 +33,7 @@ namespace PepperDash.Essentials.Core
public ushort Count
{
get { return SetNumberOfItemsSig.UShortValue; }
set { SetNumberOfItemsSig.UShortValue = value; }
set { SetNumberOfItemsSig.UShortValue = value; }
}
public ushort MaxDefinedItems { get; private set; }
@@ -100,8 +100,9 @@ namespace PepperDash.Essentials.Core
// Empty the list
Items.Clear();
// Clean up the SRL
Count = 0;
ScrollToItemSig.UShortValue = 1;
Count = 1;
ScrollToItemSig.UShortValue = 1;
}
/// <summary>

View File

@@ -17,21 +17,42 @@ namespace PepperDash.Essentials.DM.Config
[JsonProperty("control")]
public ControlPropertiesConfig Control { get; set; }
/// <summary>
/// The available volume controls
/// </summary>
[JsonProperty("volumeControls")]
public Dictionary<uint, DmCardAudioPropertiesConfig> VolumeControls { get; set; }
/// <summary>
/// The input cards
/// </summary>
[JsonProperty("inputSlots")]
public Dictionary<uint, string> InputSlots { get; set; }
/// <summary>
/// The output cards (each card represents a pair of outputs)
/// </summary>
[JsonProperty("outputSlots")]
public Dictionary<uint, string> OutputSlots { get; set; }
/// <summary>
/// The names of the Inputs
/// </summary>
[JsonProperty("inputNames")]
public Dictionary<uint, string> InputNames { get; set; }
/// <summary>
/// The names of the Outputs
/// </summary>
[JsonProperty("outputNames")]
public Dictionary<uint, string> OutputNames { get; set; }
/// <summary>
/// The string to use when no route is set for a given output
/// </summary>
[JsonProperty("noRouteText")]
public string NoRouteText { get; set; }
[JsonProperty("inputSlotSupportsHdcp2")]
public Dictionary<uint, bool> InputSlotSupportsHdcp2 { get; set; }
@@ -46,9 +67,15 @@ namespace PepperDash.Essentials.DM.Config
/// </summary>
public class DmCardAudioPropertiesConfig
{
/// <summary>
/// The level to set on the output
/// </summary>
[JsonProperty("outLevel")]
public int OutLevel { get; set; }
/// <summary>
/// Defines if this level is adjustable or not
/// </summary>
[JsonProperty("isVolumeControlPoint")]
public bool IsVolumeControlPoint { get; set; }
}

View File

@@ -20,6 +20,9 @@ namespace PepperDash.Essentials.DM.Config
[JsonProperty("outputNames")]
public Dictionary<uint, string> OutputNames { get; set; }
[JsonProperty("noRouteText")]
public string NoRouteText { get; set; }
public DmpsRoutingPropertiesConfig()
{
InputNames = new Dictionary<uint, string>();

View File

@@ -0,0 +1,74 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "DmChassisController Properties Config Schema",
"description": "",
"$ref":"EssentialsConfigSchema.json#definitions/Device",
"properties":{
"properties":{
"$ref":"#/definitions/propertiesConfig"
}
},
"definitions": {
"propertiesConfig": {
"type":"object",
"additionalProperties": true,
"properties": {
"control":{
"type":"object",
"$ref":"ControlPropertiesConfigSchema.json#definitions/ControlPropertiesConfig"
},
"volumeControls":{
"type":"object",
"additionalProperties": {
"type":"object",
"$ref": "#definitions/dmAudioCardPropertiesConfig"
}
},
"inputSlots":{
"type":"object",
"additionalProperties": {
"type":"string"
}
},
"outputSlots":{
"type":"object",
"additionalProperties": {
"type":"string"
}
},
"inputNames":{
"type":"object",
"additionalProperties": {
"type":"string"
}
},
"outputNames":{
"type":"object",
"additionalProperties": {
"type":"string"
}
},
"noRouteText":{
"type":"string"
},
"inputSlotSupportsHdcp2":{
"type":"object",
"additionalProperties": {
"type":"boolean"
}
}
}
},
"dmAudioCardPropertiesConfig":{
"type":"object",
"properties": {
"OutLevel":{
"type":"integer"
},
"isVolumeControlPoint":{
"type":"boolean"
}
}
}
}
}

View File

@@ -0,0 +1,586 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Cards;
using Crestron.SimplSharpPro.DM.Blades;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.DM.Config;
namespace PepperDash.Essentials.DM {
/// <summary>
/// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
///
/// </summary>
public class DmBladeChassisController : CrestronGenericBaseDevice, IDmSwitch, IRoutingInputsOutputs, IRouting, IHasFeedback {
public DMChassisPropertiesConfig PropertiesConfig { get; set; }
public Switch Chassis { get; private set; }
// Feedbacks for EssentialDM
public Dictionary<uint, IntFeedback> VideoOutputFeedbacks { get; private set; }
public Dictionary<uint, IntFeedback> AudioOutputFeedbacks { get; private set; }
public Dictionary<uint, BoolFeedback> VideoInputSyncFeedbacks { get; private set; }
public Dictionary<uint, BoolFeedback> InputEndpointOnlineFeedbacks { get; private set; }
public Dictionary<uint, BoolFeedback> OutputEndpointOnlineFeedbacks { get; private set; }
public Dictionary<uint, StringFeedback> InputNameFeedbacks { get; private set; }
public Dictionary<uint, StringFeedback> OutputNameFeedbacks { get; private set; }
public Dictionary<uint, StringFeedback> OutputVideoRouteNameFeedbacks { get; private set; }
public Dictionary<uint, StringFeedback> OutputAudioRouteNameFeedbacks { get; private set; }
public Dictionary<uint, IntFeedback> UsbOutputRoutedToFeebacks { get; private set; }
public Dictionary<uint, IntFeedback> UsbInputRoutedToFeebacks { get; private set; }
public IntFeedback SystemIdFeebdack { get; private set; }
public BoolFeedback SystemIdBusyFeedback { get; private set; }
public Dictionary<uint, IntFeedback> InputCardHdcpCapabilityFeedbacks { get; private set; }
public Dictionary<uint, eHdcpCapabilityType> InputCardHdcpCapabilityTypes { get; private set; }
// Need a couple Lists of generic Backplane ports
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
public Dictionary<uint, string> TxDictionary { get; set; }
public Dictionary<uint, string> RxDictionary { get; set; }
//public Dictionary<uint, DmInputCardControllerBase> InputCards { get; private set; }
//public Dictionary<uint, DmSingleOutputCardControllerBase> OutputCards { get; private set; }
public Dictionary<uint, string> InputNames { get; set; }
public Dictionary<uint, string> OutputNames { get; set; }
public Dictionary<uint, DmCardAudioOutputController> VolumeControls { get; private set; }
public const int RouteOffTime = 500;
Dictionary<PortNumberType, CTimer> RouteOffTimers = new Dictionary<PortNumberType, CTimer>();
/// <summary>
/// Factory method to create a new chassis controller from config data. Limited to 8x8 right now
/// </summary>
public static DmBladeChassisController GetDmChassisController(string key, string name,
string type, DMChassisPropertiesConfig properties) {
try {
type = type.ToLower();
uint ipid = properties.Control.IpIdInt;
BladeSwitch chassis = null;
if (type == "dmmd64x64") { chassis = new DmMd64x64(ipid, Global.ControlSystem); }
else if (type == "dmmd128x128") { chassis = new DmMd128x128(ipid, Global.ControlSystem); }
if (chassis == null) {
return null;
}
var controller = new DmBladeChassisController(key, name, chassis);
// add the cards and port names
foreach (var kvp in properties.InputSlots)
controller.AddInputBlade(kvp.Value, kvp.Key);
foreach (var kvp in properties.OutputSlots) {
controller.AddOutputBlade(kvp.Value, kvp.Key);
}
foreach (var kvp in properties.VolumeControls) {
// get the card
// check it for an audio-compatible type
// make a something-something that will make it work
// retire to mountain village
var outNum = kvp.Key;
var card = controller.Chassis.Outputs[outNum].Card;
Audio.Output audio = null;
if (card is DmHdmi4kOutputBladeCard)
audio = (card as DmHdmi4kOutputBladeCard).Hdmi4kOutput.Audio;
if (audio == null)
continue;
// wire up the audio to something here...
controller.AddVolumeControl(outNum, audio);
}
controller.InputNames = properties.InputNames;
controller.OutputNames = properties.OutputNames;
controller.PropertiesConfig = properties;
return controller;
}
catch (System.Exception e) {
Debug.Console(0, "Error creating DM chassis:\r{0}", e);
}
return null;
}
/// <summary>
///
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="chassis"></param>
public DmBladeChassisController(string key, string name, BladeSwitch chassis)
: base(key, name, chassis) {
Chassis = chassis;
InputPorts = new RoutingPortCollection<RoutingInputPort>();
OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
VolumeControls = new Dictionary<uint, DmCardAudioOutputController>();
TxDictionary = new Dictionary<uint, string>();
RxDictionary = new Dictionary<uint, string>();
IsOnline.OutputChange += new EventHandler<FeedbackEventArgs>(IsOnline_OutputChange);
Chassis.DMInputChange += new DMInputEventHandler(Chassis_DMInputChange);
Chassis.DMOutputChange += new DMOutputEventHandler(Chassis_DMOutputChange);
VideoOutputFeedbacks = new Dictionary<uint, IntFeedback>();
UsbOutputRoutedToFeebacks = new Dictionary<uint, IntFeedback>();
UsbInputRoutedToFeebacks = new Dictionary<uint, IntFeedback>();
VideoInputSyncFeedbacks = new Dictionary<uint, BoolFeedback>();
InputNameFeedbacks = new Dictionary<uint, StringFeedback>();
OutputNameFeedbacks = new Dictionary<uint, StringFeedback>();
OutputVideoRouteNameFeedbacks = new Dictionary<uint, StringFeedback>();
OutputAudioRouteNameFeedbacks = new Dictionary<uint, StringFeedback>();
InputEndpointOnlineFeedbacks = new Dictionary<uint, BoolFeedback>();
OutputEndpointOnlineFeedbacks = new Dictionary<uint, BoolFeedback>();
InputCardHdcpCapabilityFeedbacks = new Dictionary<uint, IntFeedback>();
InputCardHdcpCapabilityTypes = new Dictionary<uint, eHdcpCapabilityType>();
for (uint x = 1; x <= Chassis.NumberOfOutputs; x++) {
var tempX = x;
if (Chassis.Outputs[tempX] != null) {
VideoOutputFeedbacks[tempX] = new IntFeedback(() => {
if (Chassis.Outputs[tempX].VideoOutFeedback != null) { return (ushort)Chassis.Outputs[tempX].VideoOutFeedback.Number; }
else { return 0; };
});
OutputNameFeedbacks[tempX] = new StringFeedback(() => {
if (Chassis.Outputs[tempX].NameFeedback != null) {
return Chassis.Outputs[tempX].NameFeedback.StringValue;
}
else {
return "";
}
});
OutputVideoRouteNameFeedbacks[tempX] = new StringFeedback(() => {
if (Chassis.Outputs[tempX].VideoOutFeedback != null) {
return Chassis.Outputs[tempX].VideoOutFeedback.NameFeedback.StringValue;
}
else {
return "";
}
});
OutputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() => {
//if (Chassis.Outputs[tempX].Endpoint != null)
// return Chassis.Outputs[tempX].Endpoint.IsOnline;
//else
return Chassis.Outputs[tempX].EndpointOnlineFeedback;
});
}
if (Chassis.Inputs[tempX] != null) {
UsbInputRoutedToFeebacks[tempX] = new IntFeedback(() => {
if (Chassis.Inputs[tempX].USBRoutedToFeedback != null) { return (ushort)Chassis.Inputs[tempX].USBRoutedToFeedback.Number; }
else { return 0; };
});
VideoInputSyncFeedbacks[tempX] = new BoolFeedback(() => {
if (Chassis.Inputs[tempX].VideoDetectedFeedback != null)
return Chassis.Inputs[tempX].VideoDetectedFeedback.BoolValue;
else
return false;
});
InputNameFeedbacks[tempX] = new StringFeedback(() => {
if (Chassis.Inputs[tempX].NameFeedback != null) {
return Chassis.Inputs[tempX].NameFeedback.StringValue;
}
else {
return "";
}
});
InputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() => {
return Chassis.Inputs[tempX].EndpointOnlineFeedback;
});
InputCardHdcpCapabilityFeedbacks[tempX] = new IntFeedback(() => {
var inputCard = Chassis.Inputs[tempX];
if (inputCard.Card is DmHdmi4kInputBladeCard) {
InputCardHdcpCapabilityTypes[tempX] = eHdcpCapabilityType.Hdcp2_2Support;
if ((inputCard.Card as DmHdmi4kInputBladeCard).Hdmi4kInput.HdcpSupportOnFeedback.BoolValue)
return 1;
else
return 0;
}
if (inputCard.Card is DmC4kInputBladeCard) {
InputCardHdcpCapabilityTypes[tempX] = eHdcpCapabilityType.Hdcp2_2Support;
if ((inputCard.Card as DmC4kInputBladeCard).DmInput.HdcpCapabilityFeedback.Equals(eHdcpCapabilityType.HdcpSupportOff))
return 0;
else
return 1;
}
else
return 0;
});
}
}
}
/// <summary>
///
/// </summary>
/// <param name="type"></param>
/// <param name="number"></param>
public void AddInputBlade(string type, uint number) {
Debug.Console(2, this, "Adding input blade '{0}', slot {1}", type, number);
type = type.ToLower();
if (type == "dmb4kihd") {
var inputBlade = new Dmb4kIHd(number, this.Chassis);
foreach (var item in inputBlade.Inputs) {
var card = (item.Card as DmHdmi4kInputBladeCard).Hdmi4kInput;
var cecPort = card as ICec;
AddHdmiInBladePorts(item.Number, cecPort);
}
}
else if (type == "dmb4kihddnt") {
var inputBlade = new Dmb4kIHd(number, this.Chassis);
foreach (var item in inputBlade.Inputs) {
var card = (item.Card as DmHdmi4kInputBladeCard).Hdmi4kInput;
var cecPort = card as ICec;
AddHdmiInBladePorts(item.Number, cecPort);
}
}
else if (type == "dmb4kic") {
var inputBlade = new Dmb4kIC(number, this.Chassis);
foreach (var item in inputBlade.Inputs) {
AddDmInBladePorts(item.Number);
}
}
else if (type == "dmbis") {
var inputBlade = new DmbIS(number, this.Chassis);
foreach (var item in inputBlade.Inputs) {
AddDmInMmFiberPorts(item.Number);
}
}
else if (type == "dmbis2") {
var inputBlade = new DmbIS2(number, this.Chassis);
foreach (var item in inputBlade.Inputs) {
AddDmInSmFiberPorts(item.Number);
}
}
}
void AddHdmiInBladePorts(uint number, ICec cecPort) {
AddInputPortWithDebug(number, "hdmiIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, cecPort);
}
void AddDmInBladePorts(uint number) {
AddInputPortWithDebug(number, "dmCIn", eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat);
}
void AddDmInMmFiberPorts(uint number) {
AddInputPortWithDebug(number, "dmMmIn", eRoutingSignalType.Video, eRoutingPortConnectionType.DmMmFiber);
}
void AddDmInSmFiberPorts(uint number) {
AddInputPortWithDebug(number, "dmSmIn", eRoutingSignalType.Video, eRoutingPortConnectionType.DmSmFiber);
}
/// <summary>
///
/// </summary>
/// <param name="type"></param>
/// <param name="number"></param>
public void AddOutputBlade(string type, uint number) {
type = type.ToLower();
Debug.Console(2, this, "Adding output blade '{0}', slot {1}", type, number);
if (type == "dmb4kohd") {
var outputBlade = new Dmb4KOHD(number, Chassis);
foreach (var item in outputBlade.Outputs) {
AddHdmiOutBladePorts(item.Number);
}
}
else if (type == "dmb4kohddnt") {
var outputBlade = new Dmb4KOHD(number, Chassis);
foreach (var item in outputBlade.Outputs) {
AddHdmiOutBladePorts(item.Number);
}
}
else if (type == "dmb4koc") {
var outputBlade = new Dmb4KOC(number, Chassis);
foreach (var item in outputBlade.Outputs) {
AddDmOutBladePorts(item.Number);
}
}
else if (type == "dmb4koc") {
var outputBlade = new Dmb4KOC(number, Chassis);
foreach (var item in outputBlade.Outputs) {
AddDmOutBladePorts(item.Number);
}
}
else if (type == "dmbos") {
var outputBlade = new DmbOS(number, Chassis);
foreach (var item in outputBlade.Outputs) {
AddDmOutMmFiberBladePorts(item.Number);
}
}
else if (type == "dmbos2") {
var outputBlade = new DmbOS2(number, Chassis);
foreach (var item in outputBlade.Outputs) {
AddDmOutSmFiberBladePorts(item.Number);
}
}
}
void AddHdmiOutBladePorts(uint number) {
AddOutputPortWithDebug(String.Format("outputBlade{0}", (number / 8 > 0 ? 1 : number / 8)), String.Format("hdmiOut{0}", number) , eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, number);
}
void AddDmOutBladePorts(uint number) {
AddOutputPortWithDebug(String.Format("outputBlade{0}", (number / 8 > 0 ? 1 : number / 8)), String.Format("dmOut{0}", number), eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, number);
}
void AddDmOutMmFiberBladePorts(uint number) {
AddOutputPortWithDebug(String.Format("outputBlade{0}", (number / 8 > 0 ? 1 : number / 8)), String.Format("dmOut{0}", number), eRoutingSignalType.Video, eRoutingPortConnectionType.DmMmFiber, number);
}
void AddDmOutSmFiberBladePorts(uint number) {
AddOutputPortWithDebug(String.Format("outputBlade{0}", (number / 8 > 0 ? 1 : number / 8)), String.Format("dmOut{0}", number), eRoutingSignalType.Video, eRoutingPortConnectionType.DmSmFiber, number);
}
/// <summary>
/// Adds InputPort
/// </summary>
void AddInputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType) {
var portKey = string.Format("inputCard{0}--{1}", cardNum, portName);
Debug.Console(2, this, "Adding input port '{0}'", portKey);
var inputPort = new RoutingInputPort(portKey, sigType, portType, cardNum, this);
InputPorts.Add(inputPort);
}
/// <summary>
/// Adds InputPort and sets Port as ICec object
/// </summary>
void AddInputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, ICec cecPort) {
var portKey = string.Format("inputCard{0}--{1}", cardNum, portName);
Debug.Console(2, this, "Adding input port '{0}'", portKey);
var inputPort = new RoutingInputPort(portKey, sigType, portType, cardNum, this);
if (inputPort != null) {
if (cecPort != null)
inputPort.Port = cecPort;
InputPorts.Add(inputPort);
}
else
Debug.Console(2, this, "inputPort is null");
}
/// <summary>
/// Adds OutputPort
/// </summary>
void AddOutputPortWithDebug(string cardName, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, object selector) {
var portKey = string.Format("{0}--{1}", cardName, portName);
Debug.Console(2, this, "Adding output port '{0}'", portKey);
OutputPorts.Add(new RoutingOutputPort(portKey, sigType, portType, selector, this));
}
/// <summary>
///
/// </summary>
void AddVolumeControl(uint number, Audio.Output audio) {
VolumeControls.Add(number, new DmCardAudioOutputController(audio));
}
//public void SetInputHdcpSupport(uint input, ePdtHdcpSupport hdcpSetting)
//{
//}
void Chassis_DMInputChange(Switch device, DMInputEventArgs args) {
switch (args.EventId) {
case DMInputEventIds.EndpointOnlineEventId: {
Debug.Console(2, this, "DM Input EndpointOnlineEventId for input: {0}. State: {1}", args.Number, device.Inputs[args.Number].EndpointOnlineFeedback);
InputEndpointOnlineFeedbacks[args.Number].FireUpdate();
break;
}
case DMInputEventIds.OnlineFeedbackEventId: {
Debug.Console(2, this, "DM Input OnlineFeedbackEventId for input: {0}. State: {1}", args.Number, device.Inputs[args.Number].EndpointOnlineFeedback);
InputEndpointOnlineFeedbacks[args.Number].FireUpdate();
break;
}
case DMInputEventIds.VideoDetectedEventId: {
Debug.Console(2, this, "DM Input {0} VideoDetectedEventId", args.Number);
VideoInputSyncFeedbacks[args.Number].FireUpdate();
break;
}
case DMInputEventIds.InputNameEventId: {
Debug.Console(2, this, "DM Input {0} NameFeedbackEventId", args.Number);
InputNameFeedbacks[args.Number].FireUpdate();
break;
}
case DMInputEventIds.HdcpCapabilityFeedbackEventId: {
Debug.Console(2, this, "DM Input {0} HdcpCapabilityFeedbackEventId", args.Number);
InputCardHdcpCapabilityFeedbacks[args.Number].FireUpdate();
break;
}
default: {
Debug.Console(2, this, "DMInputChange fired for Input {0} with Unhandled EventId: {1}", args.Number, args.EventId);
break;
}
}
}
///
/// </summary>
void Chassis_DMOutputChange(Switch device, DMOutputEventArgs args)
{
var output = args.Number;
switch (args.EventId) {
case DMOutputEventIds.VolumeEventId: {
if (VolumeControls.ContainsKey(output)) {
VolumeControls[args.Number].VolumeEventFromChassis();
}
break;
}
case DMOutputEventIds.EndpointOnlineEventId: {
Debug.Console(2, this, "Output {0} DMOutputEventIds.EndpointOnlineEventId fired. EndpointOnlineFeedback State: {1}", args.Number, Chassis.Outputs[output].EndpointOnlineFeedback);
if(Chassis.Outputs[output].Endpoint != null)
Debug.Console(2, this, "Output {0} DMOutputEventIds.EndpointOnlineEventId fired. Endpoint.IsOnline State: {1}", args.Number, Chassis.Outputs[output].Endpoint.IsOnline);
OutputEndpointOnlineFeedbacks[output].FireUpdate();
break;
}
case DMOutputEventIds.OnlineFeedbackEventId: {
Debug.Console(2, this, "Output {0} DMInputEventIds.OnlineFeedbackEventId fired. State: {1}", args.Number, Chassis.Outputs[output].EndpointOnlineFeedback);
OutputEndpointOnlineFeedbacks[output].FireUpdate();
break;
}
case DMOutputEventIds.VideoOutEventId: {
if (Chassis.Outputs[output].VideoOutFeedback != null) {
Debug.Console(2, this, "DMSwitchVideo:{0} Routed Input:{1} Output:{2}'", this.Name, Chassis.Outputs[output].VideoOutFeedback.Number, output);
}
if (VideoOutputFeedbacks.ContainsKey(output)) {
VideoOutputFeedbacks[output].FireUpdate();
}
if (OutputVideoRouteNameFeedbacks.ContainsKey(output)) {
OutputVideoRouteNameFeedbacks[output].FireUpdate();
}
break;
}
case DMOutputEventIds.OutputNameEventId: {
Debug.Console(2, this, "DM Output {0} NameFeedbackEventId", output);
OutputNameFeedbacks[output].FireUpdate();
break;
}
default: {
Debug.Console(2, this, "DMOutputChange fired for Output {0} with Unhandled EventId: {1}", args.Number, args.EventId);
break;
}
}
}
/// <summary>
///
/// </summary>
/// <param name="pnt"></param>
void StartOffTimer(PortNumberType pnt) {
if (RouteOffTimers.ContainsKey(pnt))
return;
RouteOffTimers[pnt] = new CTimer(o => {
ExecuteSwitch(0, pnt.Number, pnt.Type);
}, RouteOffTime);
}
// Send out sigs when coming online
void IsOnline_OutputChange(object sender, EventArgs e) {
if (IsOnline.BoolValue) {
Chassis.EnableUSBBreakaway.BoolValue = true;
if (InputNames != null)
foreach (var kvp in InputNames)
Chassis.Inputs[kvp.Key].Name.StringValue = kvp.Value;
if (OutputNames != null)
foreach (var kvp in OutputNames)
Chassis.Outputs[kvp.Key].Name.StringValue = kvp.Value;
}
}
#region IRouting Members
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType sigType) {
Debug.Console(2, this, "Making an awesome DM route from {0} to {1} {2}", inputSelector, outputSelector, sigType);
var input = Convert.ToUInt32(inputSelector); // Cast can sometimes fail
var output = Convert.ToUInt32(outputSelector);
// Check to see if there's an off timer waiting on this and if so, cancel
var key = new PortNumberType(output, sigType);
if (input == 0) {
StartOffTimer(key);
}
else {
if (RouteOffTimers.ContainsKey(key)) {
Debug.Console(2, this, "{0} cancelling route off due to new source", output);
RouteOffTimers[key].Stop();
RouteOffTimers.Remove(key);
}
}
var inCard = input == 0 ? null : Chassis.Inputs[input];
var outCard = input == 0 ? null : Chassis.Outputs[output];
// NOTE THAT BITWISE COMPARISONS - TO CATCH ALL ROUTING TYPES
if ((sigType | eRoutingSignalType.Video) == eRoutingSignalType.Video) {
Chassis.VideoEnter.BoolValue = true;
Chassis.Outputs[output].VideoOut = inCard;
}
}
#endregion
}
/*
public struct PortNumberType {
public uint Number { get; private set; }
public eRoutingSignalType Type { get; private set; }
public PortNumberType(uint number, eRoutingSignalType type)
: this() {
Number = number;
Type = type;
}
}*/
}

View File

@@ -48,6 +48,11 @@ namespace PepperDash.Essentials.DM
public const int RouteOffTime = 500;
Dictionary<PortNumberType, CTimer> RouteOffTimers = new Dictionary<PortNumberType, CTimer>();
/// <summary>
/// Text that represents when an output has no source routed to it
/// </summary>
public string NoRouteText = "";
public static DmpsRoutingController GetDmpsRoutingController(string key, string name,
DmpsRoutingPropertiesConfig properties)
{
@@ -67,6 +72,9 @@ namespace PepperDash.Essentials.DM
controller.InputNames = properties.InputNames;
controller.OutputNames = properties.OutputNames;
if (!string.IsNullOrEmpty(properties.NoRouteText))
controller.NoRouteText = properties.NoRouteText;
return controller;
}
@@ -116,15 +124,25 @@ namespace PepperDash.Essentials.DM
public override bool CustomActivate()
{
// Set input and output names from config
if (InputNames != null)
{
foreach (var kvp in InputNames)
(Dmps.SwitcherInputs[kvp.Key] as DMInput).Name.StringValue = kvp.Value;
{
var input = (Dmps.SwitcherInputs[kvp.Key] as DMInput);
if (input != null)
input.Name.StringValue = kvp.Value;
}
}
if (OutputNames != null)
{
foreach (var kvp in OutputNames)
(Dmps.SwitcherOutputs[kvp.Key] as Card.Dmps3OutputBase).Name.StringValue = kvp.Value;
{
var output = (Dmps.SwitcherOutputs[kvp.Key] as DMOutput);
if (output != null)
output.Name.StringValue = kvp.Value;
}
}
// Subscribe to events
Dmps.DMInputChange += new DMInputEventHandler(Dmps_DMInputChange);
@@ -181,7 +199,7 @@ namespace PepperDash.Essentials.DM
}
else
{
return "";
return NoRouteText;
}
});
OutputAudioRouteNameFeedbacks[outputCard.Number] = new StringFeedback(() =>
@@ -192,7 +210,7 @@ namespace PepperDash.Essentials.DM
}
else
{
return "";
return NoRouteText;
}
});
@@ -213,10 +231,10 @@ namespace PepperDash.Essentials.DM
{
var inputCard = card as DMInput;
Debug.Console(1, this, "Adding Input Card Number {0} Type: {1}", inputCard.Number, inputCard.CardInputOutputType.ToString());
if (inputCard != null)
{
Debug.Console(1, this, "Adding Input Card Number {0} Type: {1}", inputCard.Number, inputCard.CardInputOutputType.ToString());
InputEndpointOnlineFeedbacks[inputCard.Number] = new BoolFeedback(() => { return inputCard.EndpointOnlineFeedback; });
if (inputCard.VideoDetectedFeedback != null)
@@ -226,23 +244,28 @@ namespace PepperDash.Essentials.DM
return inputCard.VideoDetectedFeedback.BoolValue;
});
}
InputNameFeedbacks[inputCard.Number] = new StringFeedback(() =>
{
if (inputCard.NameFeedback != null && !string.IsNullOrEmpty(inputCard.NameFeedback.StringValue))
{
Debug.Console(2, this, "Input Card {0} Name: {1}", inputCard.Number, inputCard.NameFeedback.StringValue);
return inputCard.NameFeedback.StringValue;
return inputCard.NameFeedback.StringValue;
}
else
{
Debug.Console(2, this, "Input Card {0} Name is null", inputCard.Number, inputCard.NameFeedback.StringValue);
Debug.Console(2, this, "Input Card {0} Name is null", inputCard.Number);
return "";
}
});
}
AddInputCard(inputCard.Number, inputCard);
AddInputCard(inputCard.Number, inputCard);
}
else
{
Debug.Console(2, this, "***********Input Card of type {0} is cannot be cast as DMInput*************", card.CardInputOutputType);
}
}
}
@@ -255,7 +278,7 @@ namespace PepperDash.Essentials.DM
{
if (inputCard is Card.Dmps3HdmiInputWithoutAnalogAudio)
{
var hdmiInputCard = inputCard as Card.Dmps3HdmiInput;
var hdmiInputCard = inputCard as Card.Dmps3HdmiInputWithoutAnalogAudio;
var cecPort = hdmiInputCard.HdmiInputPort;
@@ -272,8 +295,6 @@ namespace PepperDash.Essentials.DM
}
else if (inputCard is Card.Dmps3HdmiVgaInput)
{
// TODO: Build a virtual TX device and assign the ports to it
var hdmiVgaInputCard = inputCard as Card.Dmps3HdmiVgaInput;
DmpsInternalVirtualHdmiVgaInputController inputCardController = new DmpsInternalVirtualHdmiVgaInputController(Key +
@@ -285,8 +306,6 @@ namespace PepperDash.Essentials.DM
}
else if (inputCard is Card.Dmps3HdmiVgaBncInput)
{
// TODO: Build a virtual TX device and assign the ports to it
var hdmiVgaBncInputCard = inputCard as Card.Dmps3HdmiVgaBncInput;
DmpsInternalVirtualHdmiVgaBncInputController inputCardController = new DmpsInternalVirtualHdmiVgaBncInputController(Key +
@@ -309,8 +328,6 @@ namespace PepperDash.Essentials.DM
{
var airMediaInputCard = inputCard as Card.Dmps3AirMediaInput;
AddInputPortWithDebug(number, string.Format("AirMediaIn{0}", number), eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Streaming);
}
}
@@ -630,41 +647,41 @@ namespace PepperDash.Essentials.DM
}
DMInput inCard = input == 0 ? null : Dmps.SwitcherInputs[input] as DMInput;
Card.Dmps3OutputBase outCard = output == 0 ? null : Dmps.SwitcherOutputs[output] as Card.Dmps3OutputBase;
DMOutput outCard = output == 0 ? null : Dmps.SwitcherOutputs[output] as DMOutput;
if (inCard != null)
{
//if (inCard != null)
//{
// NOTE THAT BITWISE COMPARISONS - TO CATCH ALL ROUTING TYPES
if ((sigType | eRoutingSignalType.Video) == eRoutingSignalType.Video)
{
//SystemControl.VideoEnter.BoolValue = true;
if (outCard != null && outCard.VideoOut != null)
if (outCard != null)
outCard.VideoOut = inCard;
}
if ((sigType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
{
if (outCard != null && outCard.AudioOut != null)
if (outCard != null)
outCard.AudioOut = inCard;
}
if ((sigType | eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput)
{
if (outCard != null && outCard.USBRoutedTo != null)
if (outCard != null)
outCard.USBRoutedTo = inCard;
}
if ((sigType | eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput)
{
if (inCard != null && inCard.USBRoutedTo != null)
if (inCard != null)
inCard.USBRoutedTo = outCard;
}
}
else
{
Debug.Console(1, this, "Unable to execute route from input {0} to output {1}. Input card not available", inputSelector, outputSelector);
}
//}
//else
//{
// Debug.Console(1, this, "Unable to execute route from input {0} to output {1}. Input card not available", inputSelector, outputSelector);
//}
}
else

View File

@@ -1,97 +1,99 @@
using System;
using System.Collections.Generic;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.AirMedia;
using Crestron.SimplSharpPro.UI;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.DM.AirMedia;
using PepperDash.Essentials.DM.Endpoints.DGEs;
namespace PepperDash.Essentials.DM
{
public class DeviceFactory
{
public static IKeyed GetDevice(DeviceConfig dc)
{
var key = dc.Key;
var name = dc.Name;
var type = dc.Type;
var properties = dc.Properties;
var typeName = dc.Type.ToLower();
if (typeName.StartsWith("am"))
{
var props = JsonConvert.DeserializeObject<AirMediaPropertiesConfig>(properties.ToString());
AmX00 amDevice = null;
if (typeName == "am200")
amDevice = new Crestron.SimplSharpPro.DM.AirMedia.Am200(props.Control.IpIdInt, Global.ControlSystem);
else if(typeName == "am300")
amDevice = new Crestron.SimplSharpPro.DM.AirMedia.Am300(props.Control.IpIdInt, Global.ControlSystem);
return new AirMediaController(key, name, amDevice, dc, props);
}
else if (typeName.StartsWith("dmmd8x") || typeName.StartsWith("dmmd16x") || typeName.StartsWith("dmmd32x"))
{
var props = JsonConvert.DeserializeObject
<PepperDash.Essentials.DM.Config.DMChassisPropertiesConfig>(properties.ToString());
return PepperDash.Essentials.DM.DmChassisController.
GetDmChassisController(key, name, type, props);
}
// Hand off to DmTxHelper class
else if (typeName.StartsWith("dmtx"))
{
var props = JsonConvert.DeserializeObject
<PepperDash.Essentials.DM.Config.DmTxPropertiesConfig>(properties.ToString());
return PepperDash.Essentials.DM.DmTxHelper.GetDmTxController(key, name, type, props);
}
// Hand off to DmRmcHelper class
else if (typeName.StartsWith("dmrmc"))
{
var props = JsonConvert.DeserializeObject
<PepperDash.Essentials.DM.Config.DmRmcPropertiesConfig>(properties.ToString());
return PepperDash.Essentials.DM.DmRmcHelper.GetDmRmcController(key, name, type, props);
}
else if (typeName.Equals("hdmd4x14ke"))
{
var props = JsonConvert.DeserializeObject
<PepperDash.Essentials.DM.Config.HdMdNxM4kEPropertiesConfig>(properties.ToString());
return PepperDash.Essentials.DM.Chassis.HdMdNxM4kEController.GetController(key, name, type, props);
}
else if (typeName.Equals("hdmd400ce") || typeName.Equals("hdmd300ce") || typeName.Equals("hdmd200ce") || typeName.Equals("hdmd200c1ge"))
{
var props = JsonConvert.DeserializeObject
<PepperDash.Essentials.DM.HdMdxxxCEPropertiesConfig>(properties.ToString());
if (typeName.Equals("hdmd400ce"))
return new PepperDash.Essentials.DM.HdMdxxxCEController(key, name,
new HdMd400CE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem));
else if (typeName.Equals("hdmd300ce"))
return new PepperDash.Essentials.DM.HdMdxxxCEController(key, name,
new HdMd300CE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem));
else if (typeName.Equals("hdmd200ce"))
return new PepperDash.Essentials.DM.HdMdxxxCEController(key, name,
new HdMd200CE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem));
else if (typeName.Equals("hdmd200c1ge"))
return new PepperDash.Essentials.DM.HdMdxxxCEController(key, name,
new HdMd200C1GE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem));
}
return null;
}
}
using System;
using System.Collections.Generic;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.AirMedia;
using Crestron.SimplSharpPro.UI;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.DM.AirMedia;
using PepperDash.Essentials.DM.Endpoints.DGEs;
namespace PepperDash.Essentials.DM
{
public class DeviceFactory
{
public static IKeyed GetDevice(DeviceConfig dc)
{
var key = dc.Key;
var name = dc.Name;
var type = dc.Type;
var properties = dc.Properties;
var typeName = dc.Type.ToLower();
if (typeName.StartsWith("am"))
{
var props = JsonConvert.DeserializeObject<AirMediaPropertiesConfig>(properties.ToString());
AmX00 amDevice = null;
if (typeName == "am200")
amDevice = new Crestron.SimplSharpPro.DM.AirMedia.Am200(props.Control.IpIdInt, Global.ControlSystem);
else if(typeName == "am300")
amDevice = new Crestron.SimplSharpPro.DM.AirMedia.Am300(props.Control.IpIdInt, Global.ControlSystem);
return new AirMediaController(key, name, amDevice, dc, props);
}
else if (typeName.StartsWith("dmmd8x") || typeName.StartsWith("dmmd16x") || typeName.StartsWith("dmmd32x"))
{
var props = JsonConvert.DeserializeObject
<PepperDash.Essentials.DM.Config.DMChassisPropertiesConfig>(properties.ToString());
return PepperDash.Essentials.DM.DmChassisController.
GetDmChassisController(key, name, type, props);
}
else if (typeName.StartsWith("dmmd128x") || typeName.StartsWith("dmmd64x")) {
var props = JsonConvert.DeserializeObject
<PepperDash.Essentials.DM.Config.DMChassisPropertiesConfig>(properties.ToString());
return PepperDash.Essentials.DM.DmBladeChassisController.
GetDmChassisController(key, name, type, props);
}
// Hand off to DmTxHelper class
else if (typeName.StartsWith("dmtx")) {
var props = JsonConvert.DeserializeObject
<PepperDash.Essentials.DM.Config.DmTxPropertiesConfig>(properties.ToString());
return PepperDash.Essentials.DM.DmTxHelper.GetDmTxController(key, name, type, props);
}
// Hand off to DmRmcHelper class
else if (typeName.StartsWith("dmrmc")) {
var props = JsonConvert.DeserializeObject
<PepperDash.Essentials.DM.Config.DmRmcPropertiesConfig>(properties.ToString());
return PepperDash.Essentials.DM.DmRmcHelper.GetDmRmcController(key, name, type, props);
}
else if (typeName.Equals("hdmd4x14ke")) {
var props = JsonConvert.DeserializeObject
<PepperDash.Essentials.DM.Config.HdMdNxM4kEPropertiesConfig>(properties.ToString());
return PepperDash.Essentials.DM.Chassis.HdMdNxM4kEController.GetController(key, name, type, props);
}
else if (typeName.Equals("hdmd400ce") || typeName.Equals("hdmd300ce") || typeName.Equals("hdmd200ce") || typeName.Equals("hdmd200c1ge")) {
var props = JsonConvert.DeserializeObject
<PepperDash.Essentials.DM.HdMdxxxCEPropertiesConfig>(properties.ToString());
if (typeName.Equals("hdmd400ce"))
return new PepperDash.Essentials.DM.HdMdxxxCEController(key, name,
new HdMd400CE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem));
else if (typeName.Equals("hdmd300ce"))
return new PepperDash.Essentials.DM.HdMdxxxCEController(key, name,
new HdMd300CE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem));
else if (typeName.Equals("hdmd200ce"))
return new PepperDash.Essentials.DM.HdMdxxxCEController(key, name,
new HdMd200CE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem));
else if (typeName.Equals("hdmd200c1ge"))
return new PepperDash.Essentials.DM.HdMdxxxCEController(key, name,
new HdMd200C1GE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem));
}
return null;
}
}
}

View File

@@ -28,6 +28,8 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs
public DgeController(string key, string name, Dge100 device, DeviceConfig dc, CrestronTouchpanelPropertiesConfig props)
:base(key, name, device)
{
DigitalGraphicsEngine = device;
DeviceConfig = dc;
PropertiesConfig = props;

View File

@@ -1,256 +1,257 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.DM.Config;
namespace PepperDash.Essentials.DM
{
public abstract class DmRmcControllerBase : CrestronGenericBaseDevice
{
public virtual StringFeedback VideoOutputResolutionFeedback { get; protected set; }
public virtual StringFeedback EdidManufacturerFeedback { get; protected set; }
public virtual StringFeedback EdidNameFeedback { get; protected set; }
public virtual StringFeedback EdidPreferredTimingFeedback { get; protected set; }
public virtual StringFeedback EdidSerialNumberFeedback { get; protected set; }
public DmRmcControllerBase(string key, string name, EndpointReceiverBase device)
: base(key, name, device)
{
// if wired to a chassis, skip registration step in base class
if (device.DMOutput != null)
{
this.PreventRegistration = true;
}
AddToFeedbackList(VideoOutputResolutionFeedback, EdidManufacturerFeedback, EdidSerialNumberFeedback, EdidNameFeedback, EdidPreferredTimingFeedback);
}
}
public abstract class DmHdBaseTControllerBase : CrestronGenericBaseDevice
{
public HDBaseTBase Rmc { get; protected set; }
/// <summary>
/// Make a Crestron RMC and put it in here
/// </summary>
public DmHdBaseTControllerBase(string key, string name, HDBaseTBase rmc)
: base(key, name, rmc)
{
}
}
public class DmRmcHelper
{
/// <summary>
/// A factory method for various DmTxControllers
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="props"></param>
/// <returns></returns>
public static CrestronGenericBaseDevice GetDmRmcController(string key, string name, string typeName, DmRmcPropertiesConfig props)
{
// switch on type name... later...
typeName = typeName.ToLower();
uint ipid = props.Control.IpIdInt; // Convert.ToUInt16(props.Id, 16);
// right here, we need to grab the tie line that associates this
// RMC with a chassis or processor. If the RMC input's tie line is not
// connected to a chassis, then it's parent is the processor.
// If the RMC is connected to a chassis, then we need to grab the
// output number from the tie line and use that to plug it in.
// Example of chassis-connected:
//{
// "sourceKey": "dmMd8x8-1",
// "sourcePort": "anyOut2",
// "destinationKey": "dmRmc100C-2",
// "destinationPort": "DmIn"
//}
// Tx -> RMC link:
//{
// "sourceKey": "dmTx201C-1",
// "sourcePort": "DmOut",
// "destinationKey": "dmRmc100C-2",
// "destinationPort": "DmIn"
//}
var tlc = TieLineCollection.Default;
// grab the tie line that has this key as
// THIS DOESN'T WORK BECAUSE THE RMC THAT WE NEED (THIS) HASN'T BEEN MADE
// YET AND THUS WILL NOT HAVE A TIE LINE...
var inputTieLine = tlc.FirstOrDefault(t =>
{
var d = t.DestinationPort.ParentDevice;
return d.Key.Equals(key, StringComparison.OrdinalIgnoreCase)
&& d is DmChassisController;
});
var pKey = props.ParentDeviceKey.ToLower();
// Non-DM-chassis endpoints
if (pKey == "processor")
{
// Catch constructor failures, mainly dues to IPID
try
{
if (typeName.StartsWith("dmrmc100c"))
return new DmRmcX100CController(key, name, new DmRmc100C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmc100s"))
return new DmRmc100SController(key, name, new DmRmc100S(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmc4k100c"))
return new DmRmcX100CController(key, name, new DmRmc4k100C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmc4kz100c"))
return new DmRmcX100CController(key, name, new DmRmc4kz100C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmc150s"))
return new DmRmc150SController(key, name, new DmRmc150S(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmc200c"))
return new DmRmc200CController(key, name, new DmRmc200C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmc200s"))
return new DmRmc200SController(key, name, new DmRmc200S(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmc200s2"))
return new DmRmc200S2Controller(key, name, new DmRmc200S2(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmcscalerc"))
return new DmRmcScalerCController(key, name, new DmRmcScalerC(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmcscalers"))
return new DmRmcScalerSController(key, name, new DmRmcScalerS(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmcscalers2"))
return new DmRmcScalerS2Controller(key, name, new DmRmcScalerS2(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmc4kscalerc"))
return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmc4kscalercdsp"))
return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(ipid, Global.ControlSystem));
}
catch (Exception e)
{
Debug.Console(0, "[{0}] WARNING: Cannot create DM-RMC device: {1}", key, e.Message);
}
Debug.Console(0, "Cannot create DM-RMC of type: '{0}'", typeName);
}
// Endpoints attached to DM Chassis
else
{
var parentDev = DeviceManager.GetDeviceForKey(pKey);
if (!(parentDev is DmChassisController))
{
Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a DM Chassis.",
key, pKey);
return null;
}
var chassis = (parentDev as DmChassisController).Chassis;
var num = props.ParentOutputNumber;
if (num <= 0 || num > chassis.NumberOfOutputs)
{
Debug.Console(0, "Cannot create DM device '{0}'. Output number '{1}' is out of range",
key, num);
return null;
}
else
{
var controller = (parentDev as DmChassisController);
controller.RxDictionary.Add(num, key);
}
// Catch constructor failures, mainly dues to IPID
try
{
// Must use different constructor for CPU3 chassis types. No IPID
if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 ||
chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps ||
chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps)
{
if (typeName.StartsWith("hdbasetrx"))
return new HDBaseTRxController(key, name, new HDRx3CB(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc4k100c1g"))
return new DmRmc4k100C1GController(key, name, new DmRmc4K100C1G(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc100c"))
return new DmRmcX100CController(key, name, new DmRmc100C(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc100s"))
return new DmRmc100SController(key, name, new DmRmc100S(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc4k100c"))
return new DmRmcX100CController(key, name, new DmRmc4k100C(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc4kz100c"))
return new DmRmcX100CController(key, name, new DmRmc4kz100C(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc150s"))
return new DmRmc150SController(key, name, new DmRmc150S(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc200c"))
return new DmRmc200CController(key, name, new DmRmc200C(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc200s"))
return new DmRmc200SController(key, name, new DmRmc200S(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc200s2"))
return new DmRmc200S2Controller(key, name, new DmRmc200S2(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmcscalerc"))
return new DmRmcScalerCController(key, name, new DmRmcScalerC(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmcscalers"))
return new DmRmcScalerSController(key, name, new DmRmcScalerS(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmcscalers2"))
return new DmRmcScalerS2Controller(key, name, new DmRmcScalerS2(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc4kscalerc"))
return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc4kscalercdsp"))
return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(chassis.Outputs[num]));
}
else
{
if (typeName.StartsWith("hdbasetrx"))
return new HDBaseTRxController(key, name, new HDRx3CB(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc4k100c1g"))
return new DmRmc4k100C1GController(key, name, new DmRmc4K100C1G(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc100c"))
return new DmRmcX100CController(key, name, new DmRmc100C(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc100s"))
return new DmRmc100SController(key, name, new DmRmc100S(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc4k100c"))
return new DmRmcX100CController(key, name, new DmRmc4k100C(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc4kz100c"))
return new DmRmcX100CController(key, name, new DmRmc4kz100C(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc150s"))
return new DmRmc150SController(key, name, new DmRmc150S(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc200c"))
return new DmRmc200CController(key, name, new DmRmc200C(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc200s"))
return new DmRmc200SController(key, name, new DmRmc200S(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc200s2"))
return new DmRmc200S2Controller(key, name, new DmRmc200S2(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmcscalerc"))
return new DmRmcScalerCController(key, name, new DmRmcScalerC(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmcscalers"))
return new DmRmcScalerSController(key, name, new DmRmcScalerS(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmcscalers2"))
return new DmRmcScalerS2Controller(key, name, new DmRmcScalerS2(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc4kscalerc"))
return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc4kscalercdsp"))
return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(ipid, chassis.Outputs[num]));
}
}
catch (Exception e)
{
Debug.Console(0, "[{0}] WARNING: Cannot create DM-RMC device: {1}", key, e.Message);
}
}
return null;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.DM.Config;
namespace PepperDash.Essentials.DM
{
public abstract class DmRmcControllerBase : CrestronGenericBaseDevice
{
public virtual StringFeedback VideoOutputResolutionFeedback { get; protected set; }
public virtual StringFeedback EdidManufacturerFeedback { get; protected set; }
public virtual StringFeedback EdidNameFeedback { get; protected set; }
public virtual StringFeedback EdidPreferredTimingFeedback { get; protected set; }
public virtual StringFeedback EdidSerialNumberFeedback { get; protected set; }
public DmRmcControllerBase(string key, string name, EndpointReceiverBase device)
: base(key, name, device)
{
// if wired to a chassis, skip registration step in base class
if (device.DMOutput != null)
{
this.PreventRegistration = true;
}
AddToFeedbackList(VideoOutputResolutionFeedback, EdidManufacturerFeedback, EdidSerialNumberFeedback, EdidNameFeedback, EdidPreferredTimingFeedback);
}
}
public abstract class DmHdBaseTControllerBase : CrestronGenericBaseDevice
{
public HDBaseTBase Rmc { get; protected set; }
/// <summary>
/// Make a Crestron RMC and put it in here
/// </summary>
public DmHdBaseTControllerBase(string key, string name, HDBaseTBase rmc)
: base(key, name, rmc)
{
}
}
public class DmRmcHelper
{
/// <summary>
/// A factory method for various DmTxControllers
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="props"></param>
/// <returns></returns>
public static CrestronGenericBaseDevice GetDmRmcController(string key, string name, string typeName, DmRmcPropertiesConfig props)
{
// switch on type name... later...
typeName = typeName.ToLower();
uint ipid = props.Control.IpIdInt; // Convert.ToUInt16(props.Id, 16);
// right here, we need to grab the tie line that associates this
// RMC with a chassis or processor. If the RMC input's tie line is not
// connected to a chassis, then it's parent is the processor.
// If the RMC is connected to a chassis, then we need to grab the
// output number from the tie line and use that to plug it in.
// Example of chassis-connected:
//{
// "sourceKey": "dmMd8x8-1",
// "sourcePort": "anyOut2",
// "destinationKey": "dmRmc100C-2",
// "destinationPort": "DmIn"
//}
// Tx -> RMC link:
//{
// "sourceKey": "dmTx201C-1",
// "sourcePort": "DmOut",
// "destinationKey": "dmRmc100C-2",
// "destinationPort": "DmIn"
//}
var tlc = TieLineCollection.Default;
// grab the tie line that has this key as
// THIS DOESN'T WORK BECAUSE THE RMC THAT WE NEED (THIS) HASN'T BEEN MADE
// YET AND THUS WILL NOT HAVE A TIE LINE...
var inputTieLine = tlc.FirstOrDefault(t =>
{
var d = t.DestinationPort.ParentDevice;
return d.Key.Equals(key, StringComparison.OrdinalIgnoreCase)
&& d is DmChassisController;
});
var pKey = props.ParentDeviceKey.ToLower();
// Non-DM-chassis endpoints
if (pKey == "processor")
{
// Catch constructor failures, mainly dues to IPID
try
{
if (typeName.StartsWith("dmrmc100c"))
return new DmRmcX100CController(key, name, new DmRmc100C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmc100s"))
return new DmRmc100SController(key, name, new DmRmc100S(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmc4k100c"))
return new DmRmcX100CController(key, name, new DmRmc4k100C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmc4kz100c"))
return new DmRmcX100CController(key, name, new DmRmc4kz100C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmc150s"))
return new DmRmc150SController(key, name, new DmRmc150S(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmc200c"))
return new DmRmc200CController(key, name, new DmRmc200C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmc200s"))
return new DmRmc200SController(key, name, new DmRmc200S(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmc200s2"))
return new DmRmc200S2Controller(key, name, new DmRmc200S2(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmcscalerc"))
return new DmRmcScalerCController(key, name, new DmRmcScalerC(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmcscalers"))
return new DmRmcScalerSController(key, name, new DmRmcScalerS(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmcscalers2"))
return new DmRmcScalerS2Controller(key, name, new DmRmcScalerS2(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmc4kscalerc"))
return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmc4kscalercdsp"))
return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(ipid, Global.ControlSystem));
}
catch (Exception e)
{
Debug.Console(0, "[{0}] WARNING: Cannot create DM-RMC device: {1}", key, e.Message);
}
Debug.Console(0, "Cannot create DM-RMC of type: '{0}'", typeName);
}
// Endpoints attached to DM Chassis
else
{
var parentDev = DeviceManager.GetDeviceForKey(pKey);
if (!(parentDev is IDmSwitch))
{
Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a DM Chassis.",
key, pKey);
return null;
}
var chassis = (parentDev as IDmSwitch).Chassis;
var num = props.ParentOutputNumber;
if (num <= 0 || num > chassis.NumberOfOutputs)
{
Debug.Console(0, "Cannot create DM device '{0}'. Output number '{1}' is out of range",
key, num);
return null;
}
else
{
var controller = (parentDev as IDmSwitch);
controller.RxDictionary.Add(num, key);
}
// Catch constructor failures, mainly dues to IPID
try
{
// Must use different constructor for CPU3 chassis types. No IPID
if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 ||
chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps ||
chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps ||
chassis is DmMd128x128 || chassis is DmMd64x64)
{
if (typeName.StartsWith("hdbasetrx"))
return new HDBaseTRxController(key, name, new HDRx3CB(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc4k100c1g"))
return new DmRmc4k100C1GController(key, name, new DmRmc4K100C1G(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc100c"))
return new DmRmcX100CController(key, name, new DmRmc100C(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc100s"))
return new DmRmc100SController(key, name, new DmRmc100S(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc4k100c"))
return new DmRmcX100CController(key, name, new DmRmc4k100C(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc4kz100c"))
return new DmRmcX100CController(key, name, new DmRmc4kz100C(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc150s"))
return new DmRmc150SController(key, name, new DmRmc150S(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc200c"))
return new DmRmc200CController(key, name, new DmRmc200C(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc200s"))
return new DmRmc200SController(key, name, new DmRmc200S(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc200s2"))
return new DmRmc200S2Controller(key, name, new DmRmc200S2(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmcscalerc"))
return new DmRmcScalerCController(key, name, new DmRmcScalerC(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmcscalers"))
return new DmRmcScalerSController(key, name, new DmRmcScalerS(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmcscalers2"))
return new DmRmcScalerS2Controller(key, name, new DmRmcScalerS2(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc4kscalerc"))
return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc4kscalercdsp"))
return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(chassis.Outputs[num]));
}
else
{
if (typeName.StartsWith("hdbasetrx"))
return new HDBaseTRxController(key, name, new HDRx3CB(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc4k100c1g"))
return new DmRmc4k100C1GController(key, name, new DmRmc4K100C1G(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc100c"))
return new DmRmcX100CController(key, name, new DmRmc100C(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc100s"))
return new DmRmc100SController(key, name, new DmRmc100S(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc4k100c"))
return new DmRmcX100CController(key, name, new DmRmc4k100C(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc4kz100c"))
return new DmRmcX100CController(key, name, new DmRmc4kz100C(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc150s"))
return new DmRmc150SController(key, name, new DmRmc150S(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc200c"))
return new DmRmc200CController(key, name, new DmRmc200C(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc200s"))
return new DmRmc200SController(key, name, new DmRmc200S(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc200s2"))
return new DmRmc200S2Controller(key, name, new DmRmc200S2(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmcscalerc"))
return new DmRmcScalerCController(key, name, new DmRmcScalerC(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmcscalers"))
return new DmRmcScalerSController(key, name, new DmRmcScalerS(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmcscalers2"))
return new DmRmcScalerS2Controller(key, name, new DmRmcScalerS2(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc4kscalerc"))
return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc4kscalercdsp"))
return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(ipid, chassis.Outputs[num]));
}
}
catch (Exception e)
{
Debug.Console(0, "[{0}] WARNING: Cannot create DM-RMC device: {1}", key, e.Message);
}
}
return null;
}
}
}

View File

@@ -1,181 +1,182 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.DM.Config;
namespace PepperDash.Essentials.DM
{
public class DmTxHelper
{
/// <summary>
/// A factory method for various DmTxControllers
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="props"></param>
/// <returns></returns>
public static BasicDmTxControllerBase GetDmTxController(string key, string name, string typeName, DmTxPropertiesConfig props)
{
// switch on type name... later...
typeName = typeName.ToLower();
//uint ipid = Convert.ToUInt16(props.Id, 16);
var ipid = props.Control.IpIdInt;
var pKey = props.ParentDeviceKey.ToLower();
if (pKey == "processor")
{
// Catch constructor failures, mainly dues to IPID
try
{
if(typeName.StartsWith("dmtx200"))
return new DmTx200Controller(key, name, new DmTx200C2G(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx201"))
return new DmTx201XController(key, name, new DmTx201S(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4k202CController(key, name, new DmTx4kz202C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4kz302"))
return new DmTx4kz302CController(key, name, new DmTx4kz302C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx401"))
return new DmTx401CController(key, name, new DmTx401C(ipid, Global.ControlSystem));
Debug.Console(0, "{1} WARNING: Cannot create DM-TX of type: '{0}'", typeName, key);
}
catch (Exception e)
{
Debug.Console(0, "[{0}] WARNING: Cannot create DM-TX device: {1}", key, e);
}
}
else
{
var parentDev = DeviceManager.GetDeviceForKey(pKey);
if (!(parentDev is DmChassisController))
{
Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a DM Chassis.",
key, pKey);
return null;
}
// Get the Crestron chassis and link stuff up
var switchDev = parentDev as DmChassisController;
var chassis = switchDev.Chassis;
var num = props.ParentInputNumber;
if (num <= 0 || num > chassis.NumberOfInputs)
{
Debug.Console(0, "Cannot create DM device '{0}'. Input number '{1}' is out of range",
key, num);
return null;
}
else
{
var controller = (parentDev as DmChassisController);
controller.TxDictionary.Add(num, key);
}
// Catch constructor failures, mainly dues to IPID
try
{
// Must use different constructor for CPU3 chassis types. No IPID
if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 ||
chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps ||
chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps)
{
if (typeName.StartsWith("dmtx200"))
return new DmTx200Controller(key, name, new DmTx200C2G(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx201"))
return new DmTx201XController(key, name, new DmTx201C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k100"))
return new DmTx4k100Controller(key, name, new DmTx4K100C1G(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4k202CController(key, name, new DmTx4kz202C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz302"))
return new DmTx4kz302CController(key, name, new DmTx4kz302C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx401"))
return new DmTx401CController(key, name, new DmTx401C(chassis.Inputs[num]));
}
else
{
if (typeName.StartsWith("dmtx200"))
return new DmTx200Controller(key, name, new DmTx200C2G(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx201"))
return new DmTx201XController(key, name, new DmTx201C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k100"))
return new DmTx4k100Controller(key, name, new DmTx4K100C1G(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4k202CController(key, name, new DmTx4kz202C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz302"))
return new DmTx4kz302CController(key, name, new DmTx4kz302C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx401"))
return new DmTx401CController(key, name, new DmTx401C(ipid, chassis.Inputs[num]));
}
}
catch (Exception e)
{
Debug.Console(0, "[{0}] WARNING: Cannot create DM-TX device: {1}", key, e);
}
}
return null;
}
}
public abstract class BasicDmTxControllerBase : CrestronGenericBaseDevice
{
public BasicDmTxControllerBase(string key, string name, GenericBase hardware)
: base(key, name, hardware)
{
}
}
/// <summary>
///
/// </summary>
public abstract class DmTxControllerBase : BasicDmTxControllerBase
{
public virtual void SetPortHdcpCapability(eHdcpCapabilityType hdcpMode, uint port) { }
public virtual eHdcpCapabilityType HdcpSupportCapability { get; protected set; }
public abstract StringFeedback ActiveVideoInputFeedback { get; protected set; }
public RoutingInputPortWithVideoStatuses AnyVideoInput { get; protected set; }
public DmTxControllerBase(string key, string name, EndpointTransmitterBase hardware)
: base(key, name, hardware)
{
// if wired to a chassis, skip registration step in base class
if (hardware.DMInput != null)
{
this.PreventRegistration = true;
}
AddToFeedbackList(ActiveVideoInputFeedback);
}
}
//public enum ePdtHdcpSupport
//{
// HdcpOff = 0,
// Hdcp1 = 1,
// Hdcp2 = 2,
// Hdcp2_2= 3,
// Auto = 99
//}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.DM.Config;
namespace PepperDash.Essentials.DM
{
public class DmTxHelper
{
/// <summary>
/// A factory method for various DmTxControllers
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="props"></param>
/// <returns></returns>
public static BasicDmTxControllerBase GetDmTxController(string key, string name, string typeName, DmTxPropertiesConfig props)
{
// switch on type name... later...
typeName = typeName.ToLower();
//uint ipid = Convert.ToUInt16(props.Id, 16);
var ipid = props.Control.IpIdInt;
var pKey = props.ParentDeviceKey.ToLower();
if (pKey == "processor")
{
// Catch constructor failures, mainly dues to IPID
try
{
if(typeName.StartsWith("dmtx200"))
return new DmTx200Controller(key, name, new DmTx200C2G(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx201"))
return new DmTx201XController(key, name, new DmTx201S(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4k202CController(key, name, new DmTx4kz202C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4kz302"))
return new DmTx4kz302CController(key, name, new DmTx4kz302C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx401"))
return new DmTx401CController(key, name, new DmTx401C(ipid, Global.ControlSystem));
Debug.Console(0, "{1} WARNING: Cannot create DM-TX of type: '{0}'", typeName, key);
}
catch (Exception e)
{
Debug.Console(0, "[{0}] WARNING: Cannot create DM-TX device: {1}", key, e);
}
}
else
{
var parentDev = DeviceManager.GetDeviceForKey(pKey);
if (!(parentDev is IDmSwitch))
{
Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a DM Chassis.",
key, pKey);
return null;
}
// Get the Crestron chassis and link stuff up
var switchDev = (parentDev as IDmSwitch);
var chassis = switchDev.Chassis;
var num = props.ParentInputNumber;
if (num <= 0 || num > chassis.NumberOfInputs)
{
Debug.Console(0, "Cannot create DM device '{0}'. Input number '{1}' is out of range",
key, num);
return null;
}
else
{
var controller = (parentDev as IDmSwitch);
controller.TxDictionary.Add(num, key);
}
// Catch constructor failures, mainly dues to IPID
try
{
// Must use different constructor for CPU3 chassis types. No IPID
if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 ||
chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps ||
chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps||
chassis is DmMd128x128 || chassis is DmMd64x64)
{
if (typeName.StartsWith("dmtx200"))
return new DmTx200Controller(key, name, new DmTx200C2G(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx201"))
return new DmTx201XController(key, name, new DmTx201C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k100"))
return new DmTx4k100Controller(key, name, new DmTx4K100C1G(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4k202CController(key, name, new DmTx4kz202C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz302"))
return new DmTx4kz302CController(key, name, new DmTx4kz302C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx401"))
return new DmTx401CController(key, name, new DmTx401C(chassis.Inputs[num]));
}
else
{
if (typeName.StartsWith("dmtx200"))
return new DmTx200Controller(key, name, new DmTx200C2G(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx201"))
return new DmTx201XController(key, name, new DmTx201C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k100"))
return new DmTx4k100Controller(key, name, new DmTx4K100C1G(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4k202CController(key, name, new DmTx4kz202C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz302"))
return new DmTx4kz302CController(key, name, new DmTx4kz302C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx401"))
return new DmTx401CController(key, name, new DmTx401C(ipid, chassis.Inputs[num]));
}
}
catch (Exception e)
{
Debug.Console(0, "[{0}] WARNING: Cannot create DM-TX device: {1}", key, e);
}
}
return null;
}
}
public abstract class BasicDmTxControllerBase : CrestronGenericBaseDevice
{
public BasicDmTxControllerBase(string key, string name, GenericBase hardware)
: base(key, name, hardware)
{
}
}
/// <summary>
///
/// </summary>
public abstract class DmTxControllerBase : BasicDmTxControllerBase
{
public virtual void SetPortHdcpCapability(eHdcpCapabilityType hdcpMode, uint port) { }
public virtual eHdcpCapabilityType HdcpSupportCapability { get; protected set; }
public abstract StringFeedback ActiveVideoInputFeedback { get; protected set; }
public RoutingInputPortWithVideoStatuses AnyVideoInput { get; protected set; }
public DmTxControllerBase(string key, string name, EndpointTransmitterBase hardware)
: base(key, name, hardware)
{
// if wired to a chassis, skip registration step in base class
if (hardware.DMInput != null)
{
this.PreventRegistration = true;
}
AddToFeedbackList(ActiveVideoInputFeedback);
}
}
//public enum ePdtHdcpSupport
//{
// HdcpOff = 0,
// Hdcp1 = 1,
// Hdcp2 = 2,
// Hdcp2_2= 3,
// Auto = 99
//}
}

View File

@@ -95,16 +95,18 @@
<Compile Include="Cards REMOVE\DmcC4kInputCard.cs" />
<Compile Include="Cards REMOVE\DmcHD4kInputCard.cs" />
<Compile Include="Cards REMOVE\DmInputCardBase.cs" />
<Compile Include="Chassis\DmBladeChassisController.cs" />
<Compile Include="Chassis\DmCardAudioOutput.cs" />
<Compile Include="Chassis\DmChassisController.cs" />
<Compile Include="Chassis\DmpsAudioOutputController.cs" />
<Compile Include="Chassis\DmpsInternalVirtualDmTxController.cs" />
<Compile Include="Chassis\DmpsRoutingController.cs" />
<Compile Include="Chassis\HdMdNxM4kEController.cs" />
<Compile Include="Config\DmpsRoutingConfig.cs" />
<Compile Include="IDmSwitch.cs" />
<Compile Include="Chassis\Config\DmpsRoutingConfig.cs" />
<Compile Include="Config\DmRmcConfig.cs" />
<Compile Include="Config\DmTxConfig.cs" />
<Compile Include="Config\DMChassisConfig.cs" />
<Compile Include="Chassis\Config\DMChassisConfig.cs" />
<Compile Include="Config\HdMdNxM4kEPropertiesConfig.cs" />
<Compile Include="Config\InputPropertiesConfig.cs" />
<Compile Include="DmPortName.cs" />
@@ -146,6 +148,9 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="VideoStatusHelpers.cs" />
<None Include="app.config" />
<EmbeddedResource Include="Chassis\Config\Schema\DmChassisControllerPropertiesConfigSchema.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<None Include="Properties\ControlSystem.cfg" />
</ItemGroup>
<ItemGroup>

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Cards;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
using PepperDash.Core;
using PepperDash.Essentials.Core;
//using PepperDash.Essentials.DM.Cards;
using PepperDash.Essentials.DM.Config;
namespace PepperDash.Essentials.DM {
public interface IDmSwitch {
Switch Chassis { get; }
Dictionary<uint, string> TxDictionary { get; }
Dictionary<uint, string> RxDictionary { get; }
}
}

View File

@@ -167,84 +167,91 @@ namespace PepperDash.Essentials.Devices.Displays
/// <param name="sender"></param>
void Communication_BytesReceived(object sender, GenericCommMethodReceiveBytesArgs e)
{
// This is probably not thread-safe buffering
// Append the incoming bytes with whatever is in the buffer
var newBytes = new byte[IncomingBuffer.Length + e.Bytes.Length];
IncomingBuffer.CopyTo(newBytes, 0);
e.Bytes.CopyTo(newBytes, IncomingBuffer.Length);
if (Debug.Level == 2) // This check is here to prevent following string format from building unnecessarily on level 0 or 1
Debug.Console(2, this, "Received:{0}", ComTextHelper.GetEscapedText(newBytes));
// Need to find AA FF and have
for (int i = 0; i < newBytes.Length; i++)
try
{
if (newBytes[i] == 0xAA && newBytes[i + 1] == 0xFF)
// This is probably not thread-safe buffering
// Append the incoming bytes with whatever is in the buffer
var newBytes = new byte[IncomingBuffer.Length + e.Bytes.Length];
IncomingBuffer.CopyTo(newBytes, 0);
e.Bytes.CopyTo(newBytes, IncomingBuffer.Length);
if (Debug.Level == 2) // This check is here to prevent following string format from building unnecessarily on level 0 or 1
Debug.Console(2, this, "Received:{0}", ComTextHelper.GetEscapedText(newBytes));
// Need to find AA FF and have
for (int i = 0; i < newBytes.Length; i++)
{
newBytes = newBytes.Skip(i).ToArray(); // Trim off junk if there's "dirt" in the buffer
// parse it
// If it's at least got the header, then process it,
while (newBytes.Length > 4 && newBytes[0] == 0xAA && newBytes[1] == 0xFF)
if (newBytes[i] == 0xAA && newBytes[i + 1] == 0xFF)
{
var msgLen = newBytes[3];
// if the buffer is shorter than the header (3) + message (msgLen) + checksum (1),
// give and save it for next time
if (newBytes.Length < msgLen + 4)
break;
newBytes = newBytes.Skip(i).ToArray(); // Trim off junk if there's "dirt" in the buffer
// Good length, grab the message
var message = newBytes.Skip(4).Take(msgLen).ToArray();
// At this point, the ack/nak is the first byte
if (message[0] == 0x41)
// parse it
// If it's at least got the header, then process it,
while (newBytes.Length > 4 && newBytes[0] == 0xAA && newBytes[1] == 0xFF)
{
switch (message[1]) // type byte
var msgLen = newBytes[3];
// if the buffer is shorter than the header (3) + message (msgLen) + checksum (1),
// give and save it for next time
if (newBytes.Length < msgLen + 4)
break;
// Good length, grab the message
var message = newBytes.Skip(4).Take(msgLen).ToArray();
// At this point, the ack/nak is the first byte
if (message[0] == 0x41)
{
case 0x00: // General status
//UpdatePowerFB(message[2], message[5]); // "power" can be misrepresented when the display sleeps
switch (message[1]) // type byte
{
case 0x00: // General status
//UpdatePowerFB(message[2], message[5]); // "power" can be misrepresented when the display sleeps
// Handle the first power on fb when waiting for it.
if (IsPoweringOnIgnorePowerFb && message[2] == 0x01)
IsPoweringOnIgnorePowerFb = false;
// Ignore general-status power off messages when powering up
if (!(IsPoweringOnIgnorePowerFb && message[2] == 0x00))
UpdatePowerFB(message[2]);
UpdateVolumeFB(message[3]);
UpdateMuteFb(message[4]);
UpdateInputFb(message[5]);
break;
// Handle the first power on fb when waiting for it.
if (IsPoweringOnIgnorePowerFb && message[2] == 0x01)
IsPoweringOnIgnorePowerFb = false;
// Ignore general-status power off messages when powering up
if (!(IsPoweringOnIgnorePowerFb && message[2] == 0x00))
UpdatePowerFB(message[2]);
UpdateVolumeFB(message[3]);
UpdateMuteFb(message[4]);
UpdateInputFb(message[5]);
break;
case 0x11:
UpdatePowerFB(message[2]);
break;
case 0x11:
UpdatePowerFB(message[2]);
break;
case 0x12:
UpdateVolumeFB(message[2]);
break;
case 0x12:
UpdateVolumeFB(message[2]);
break;
case 0x13:
UpdateMuteFb(message[2]);
break;
case 0x13:
UpdateMuteFb(message[2]);
break;
case 0x14:
UpdateInputFb(message[2]);
break;
case 0x14:
UpdateInputFb(message[2]);
break;
default:
break;
default:
break;
}
}
// Skip over what we've used and save the rest for next time
newBytes = newBytes.Skip(5 + msgLen).ToArray();
}
// Skip over what we've used and save the rest for next time
newBytes = newBytes.Skip(5 + msgLen).ToArray();
}
break; // parsing will mean we can stop looking for header in loop
}
}
// Save whatever partial message is here
IncomingBuffer = newBytes;
break; // parsing will mean we can stop looking for header in loop
}
}
// Save whatever partial message is here
IncomingBuffer = newBytes;
}
catch (Exception err)
{
Debug.Console(2, this, "Error parsing feedback: {0}", err);
}
}
/// <summary>
@@ -256,6 +263,7 @@ namespace PepperDash.Essentials.Devices.Displays
if (newVal != _PowerIsOn)
{
_PowerIsOn = newVal;
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Feedback Power State: {0}", _PowerIsOn);
PowerIsOnFeedback.FireUpdate();
}
}
@@ -364,6 +372,8 @@ namespace PepperDash.Essentials.Devices.Displays
/// </summary>
public override void PowerOn()
{
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Powering On Display");
IsPoweringOnIgnorePowerFb = true;
//Send(PowerOnCmd);
SendBytes(new byte[] { 0xAA, 0x11, 0x00, 0x01, 0x01, 0x00 });
@@ -387,6 +397,8 @@ namespace PepperDash.Essentials.Devices.Displays
/// </summary>
public override void PowerOff()
{
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Powering Off Display");
IsPoweringOnIgnorePowerFb = false;
// If a display has unreliable-power off feedback, just override this and
// remove this check.

View File

@@ -0,0 +1,33 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "SamsungMDC Properties Config Schema v1",
"description": "",
"$ref":"EssentialsConfigSchema.json#/definitions/Device",
"properties":{
"properties":{
"$ref":"#/definitions/propertiesConfig"
}
},
"definitions": {
"propertiesConfig": {
"type":"object",
"additionalProperties": true,
"properties": {
"control":{
"type":"object",
"$ref":"ControlPropertiesConfigSchema.json#definitions/ControlPropertiesConfig"
},
"id":{
"title":"Display ID",
"description": "This must match the ID set in the display's on screen menu",
"type":"string",
"pattern": "^(?!FF)[0-9,A-F,a-f][0-9,A-F,a-f]$"
}
},
"required": [
"control",
"id"
]
}
}
}

View File

@@ -182,6 +182,9 @@
<Compile Include="VideoCodec\ZoomRoom\ZoomRoom.cs" />
<Compile Include="VideoCodec\ZoomRoom\ZoomRoomCamera.cs" />
<Compile Include="VideoCodec\ZoomRoom\ZoomRoomPropertiesConfig.cs" />
<EmbeddedResource Include="Display\Schema\SamsungMDCPropertiesConfigSchema.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<None Include="Properties\ControlSystem.cfg" />
</ItemGroup>
<ItemGroup>

View File

@@ -292,6 +292,10 @@ namespace PepperDash.Essentials.Devices.Common
else
Debug.Console(0, "Attempt to register relay {0} on device with key '{1}' failed.", props.PortNumber, props.PortDeviceKey);
}
else
{
return new GenericRelayDevice(key, relay);
}
// Future: Check if portDevice is 3-series card or other non control system that supports versiports
}

View File

@@ -30,6 +30,8 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy
public GlsOdtOccupancySensorController(string key, string name, GlsOdtCCn sensor)
: base(key, name, sensor)
{
OccSensor = sensor;
AndWhenVacatedFeedback = new BoolFeedback(() => OccSensor.AndWhenVacatedFeedback.BoolValue);
OrWhenVacatedFeedback = new BoolFeedback(() => OccSensor.OrWhenVacatedFeedback.BoolValue);

View File

@@ -4,4 +4,4 @@
[assembly: AssemblyCompany("PepperDash Technology Corp")]
[assembly: AssemblyProduct("Essentials_Devices_Common")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyVersion("1.3.*")]
[assembly: AssemblyVersion("1.4.*")]