Compare commits

...

45 Commits
0.0.3 ... 0.0.7

Author SHA1 Message Date
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
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
Neil Dorin
ed468add2c Refactored for source change handler updates 2019-11-08 12:30:49 -07:00
Neil Dorin
c22e95cad2 Added remaining methods for EssentialsDualDisplayRoom. Added IHasInCallFeedback interface to be applied to rooms with conferencing 2019-10-25 16:08:55 -06:00
Neil Dorin
59b2e9a8d6 Refactor complete 2019-10-24 11:28:13 -06:00
Neil Dorin
13132c29fc Mega refactor in progress 2019-10-23 22:29:04 -06:00
Neil Dorin
407a354cfe Merge remote-tracking branch 'origin/development' into feature/ecs-1116
# Conflicts:
#	PepperDashEssentials/Room/Config/EssentialsNDisplayRoomPropertiesConfig.cs
2019-10-17 15:46:40 -06:00
Neil Dorin
5b05e8bb48 Adds config object for NDisplayRoom 2019-10-11 10:07:35 -06:00
94 changed files with 5623 additions and 4144 deletions

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,
@@ -19,42 +19,3 @@ namespace PepperDash.Essentials.Room.Cotija
}
}
namespace PepperDash.Essentials
{
/// <summary>
/// For rooms with a single presentation source, change event
/// </summary>
public interface IHasCurrentSourceInfoChange
{
string CurrentSourceInfoKey { get; }
SourceListItem CurrentSourceInfo { get; }
event SourceInfoChangeHandler CurrentSingleSourceChange;
}
/// <summary>
/// For rooms with routing
/// </summary>
public interface IRunRouteAction
{
void RunRouteAction(string routeKey);
void RunRouteAction(string routeKey, Action successCallback);
}
/// <summary>
/// For rooms that default presentation only routing
/// </summary>
public interface IRunDefaultPresentRoute
{
bool RunDefaultPresentRoute();
}
/// <summary>
/// For rooms that have default presentation and calling routes
/// </summary>
public interface IRunDefaultCallRoute : IRunDefaultPresentRoute
{
bool RunDefaultCallRoute();
}
}

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);
@@ -93,7 +93,7 @@ namespace PepperDash.Essentials
var sscRoom = Room as IHasCurrentSourceInfoChange;
if(sscRoom != null)
sscRoom.CurrentSingleSourceChange += new SourceInfoChangeHandler(Room_CurrentSingleSourceChange);
sscRoom.CurrentSourceChange += new SourceInfoChangeHandler(Room_CurrentSingleSourceChange);
var vcRoom = Room as IHasVideoCodec;
if (vcRoom != null && vcRoom.VideoCodec != null)
@@ -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>
@@ -334,7 +321,7 @@ namespace PepperDash.Essentials
}
void Room_CurrentSingleSourceChange(EssentialsRoomBase room, PepperDash.Essentials.Core.SourceListItem info, ChangeType type)
void Room_CurrentSingleSourceChange(PepperDash.Essentials.Core.SourceListItem info, ChangeType type)
{
/* Example message
* {
@@ -395,11 +382,14 @@ namespace PepperDash.Essentials
if (dev is ITransport)
(dev as ITransport).LinkActions(Parent);
var srcRm = room as IHasCurrentSourceInfoChange;
PostStatusMessage(new
{
selectedSourceKey = srcRm.CurrentSourceInfoKey
});
var srcRm = Room as IHasCurrentSourceInfoChange;
if (srcRm != null)
{
PostStatusMessage(new
{
selectedSourceKey = srcRm.CurrentSourceInfoKey
});
}
}
}
}
@@ -432,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;
}
@@ -486,16 +506,16 @@ namespace PepperDash.Essentials
DeviceManager.AddDevice(room);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleSpaceRoom, attempting to add to DeviceManager with Fusion");
DeviceManager.AddDevice(new EssentialsHuddleSpaceFusionSystemControllerBase((EssentialsHuddleSpaceRoom)room, 0xf1));
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

@@ -12,6 +12,32 @@ namespace PepperDash.Essentials
{
public class Amplifier : Device, IRoutingSinkNoSwitching
{
public event SourceInfoChangeHandler CurrentSourceChange;
public string CurrentSourceInfoKey { get; set; }
public SourceListItem CurrentSourceInfo
{
get
{
return _CurrentSourceInfo;
}
set
{
if (value == _CurrentSourceInfo) return;
var handler = CurrentSourceChange;
if (handler != null)
handler(_CurrentSourceInfo, ChangeType.WillChange);
_CurrentSourceInfo = value;
if (handler != null)
handler(_CurrentSourceInfo, ChangeType.DidChange);
}
}
SourceListItem _CurrentSourceInfo;
public RoutingInputPort AudioIn { get; private set; }
public Amplifier(string key, string name)

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");
@@ -87,7 +87,7 @@ namespace PepperDash.Essentials
else if (typeName == "roomonwhenoccupancydetectedfeature")
{
return new Room.Behaviours.RoomOnToDefaultSourceWhenOccupied(dc);
return new RoomOnToDefaultSourceWhenOccupied(dc);
}
return null;

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

@@ -14,6 +14,7 @@ using PepperDash.Core;
using PepperDash.Essentials;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Fusion;
using PepperDash.Essentials.Devices.Common;
using PepperDash.Essentials.Devices.Common.Occupancy;
@@ -181,7 +182,7 @@ namespace PepperDash.Essentials.Fusion
// Moved to
CurrentRoomSourceNameSig = FusionRoom.CreateOffsetStringSig(84, "Display 1 - Current Source", eSigIoMask.InputSigOnly);
// Don't think we need to get current status of this as nothing should be alive yet.
(Room as EssentialsHuddleVtc1Room).CurrentSingleSourceChange += Room_CurrentSourceInfoChange;
(Room as EssentialsHuddleVtc1Room).CurrentSourceChange += Room_CurrentSourceInfoChange;
FusionRoom.SystemPowerOn.OutputSig.SetSigFalseAction((Room as EssentialsHuddleVtc1Room).PowerOnToDefaultOrLastSource);
@@ -220,7 +221,7 @@ namespace PepperDash.Essentials.Fusion
break;
}
var laptops = dict.Where(d => d.Value.SourceDevice is Laptop);
var laptops = dict.Where(d => d.Value.SourceDevice is Core.Devices.Laptop);
i = 1;
foreach (var kvp in laptops)
{

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" />
@@ -173,28 +175,23 @@
<Compile Include="Devices\NUMERIC AppleTV.cs" />
<Compile Include="ControlSystem.cs" />
<Compile Include="Factory\UiDeviceFactory.cs" />
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\EssentialsHuddleVtc1FusionController.cs" />
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\FusionCustomPropertiesBridge.cs" />
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\FusionEventHandlers.cs" />
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\FusionProcessorQueries.cs" />
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\FusionRviDataClasses.cs" />
<Compile Include="Fusion\EssentialsHuddleVtc1FusionController.cs" />
<Compile Include="REMOVE EssentialsApp.cs" />
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\EssentialsHuddleSpaceFusionSystemControllerBase.cs" />
<Compile Include="HttpApiHandler.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Room\Behaviours\RoomOnToDefaultSourceWhenOccupied.cs" />
<Compile Include="Room\Config\EssentialsDualDisplayRoomPropertiesConfig.cs" />
<Compile Include="Room\Config\EssentialsNDisplayRoomPropertiesConfig.cs" />
<Compile Include="Room\Config\DDVC01RoomPropertiesConfig.cs" />
<Compile Include="Room\Config\EssentialsPresentationPropertiesConfig.cs" />
<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" />
@@ -206,10 +203,10 @@
<Compile Include="AppServer\RoomBridges\SourceDeviceMapDictionary.cs" />
<Compile Include="AppServer\Volumes.cs" />
<Compile Include="Room\Emergency\EsentialsRoomEmergencyContactClosure.cs" />
<Compile Include="Room\Types\EssentialsDualDisplayRoom.cs" />
<Compile Include="Room\Types\EssentialsHuddleVtc1Room.cs" />
<Compile Include="Room\Types\EssentialsNDisplayRoomBase.cs" />
<Compile Include="Room\Types\EssentialsPresentationRoom.cs" />
<Compile Include="Room\Types\EssentialsRoomBase.cs" />
<Compile Include="Room\Config\EssentialsRoomConfig.cs" />
<Compile Include="FOR REFERENCE UI\PageControllers\DevicePageControllerBase.cs" />
<Compile Include="FOR REFERENCE UI\PageControllers\PageControllerLaptop.cs" />
@@ -243,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" />
@@ -273,6 +270,9 @@
<Name>Essentials Devices Common</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="FOR REFERENCE UI\OTHER\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Room.Config
{
public class EssentialsDualDisplayRoomPropertiesConfig : EssentialsNDisplayRoomPropertiesConfig
{
}
}

View File

@@ -8,19 +8,10 @@ using Newtonsoft.Json;
namespace PepperDash.Essentials.Room.Config
{
public class EssentialsHuddleVtc1PropertiesConfig : EssentialsRoomPropertiesConfig
public class EssentialsHuddleVtc1PropertiesConfig : EssentialsConferenceRoomPropertiesConfig
{
[JsonProperty("defaultDisplayKey")]
public string DefaultDisplayKey { get; set; }
[JsonProperty("defaultAudioKey")]
public string DefaultAudioKey { get; set; }
[JsonProperty("sourceListKey")]
public string SourceListKey { get; set; }
[JsonProperty("defaultSourceItem")]
public string DefaultSourceItem { get; set; }
[JsonProperty("videoCodecKey")]
public string VideoCodecKey { get; set; }
[JsonProperty("audioCodecKey")]
public string AudioCodecKey { get; set; }
}
}

View File

@@ -4,22 +4,36 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Room.Config
{
/// <summary>
///
/// </summary>
public class EssentialsNDisplayRoomPropertiesConfig : EssentialsRoomPropertiesConfig
public class EssentialsNDisplayRoomPropertiesConfig : EssentialsConferenceRoomPropertiesConfig
{
[JsonProperty("defaultAudioBehavior")]
public string DefaultAudioBehavior { get; set; }
public string DefaultAudioKey { get; set; }
[JsonProperty("defaultVideoBehavior")]
public string DefaultVideoBehavior { get; set; }
public Dictionary<string, string> Displays { get; set; }
public string SourceListKey { get; set; }
[JsonProperty("displays")]
public Dictionary<eSourceListItemDestinationTypes, DisplayItem> Displays { get; set; }
public EssentialsNDisplayRoomPropertiesConfig()
{
Displays = new Dictionary<string, string>();
Displays = new Dictionary<eSourceListItemDestinationTypes, DisplayItem>();
}
}
public class DisplayItem : IKeyName
{
public string Key { get; set; }
public string Name { get; set; }
}
}

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;
}
@@ -65,8 +71,8 @@ namespace PepperDash.Essentials.Room.Config
/// <param name="props"></param>
/// <param name="room"></param>
/// <returns></returns>
public static PepperDash.Essentials.Devices.Common.Microphones.MicrophonePrivacyController GetMicrophonePrivacy(
EssentialsRoomPropertiesConfig props, EssentialsHuddleVtc1Room room)
public static Core.Privacy.MicrophonePrivacyController GetMicrophonePrivacy(
EssentialsRoomPropertiesConfig props, IPrivacy room)
{
var microphonePrivacy = props.MicrophonePrivacy;
if (microphonePrivacy == null)
@@ -76,7 +82,7 @@ namespace PepperDash.Essentials.Room.Config
}
// Get the MicrophonePrivacy device from the device manager
var mP = (DeviceManager.GetDeviceForKey(props.MicrophonePrivacy.DeviceKey) as
PepperDash.Essentials.Devices.Common.Microphones.MicrophonePrivacyController);
Core.Privacy.MicrophonePrivacyController);
// Set this room as the IPrivacy device
if (mP == null)
{
@@ -95,28 +101,30 @@ namespace PepperDash.Essentials.Room.Config
if (behaviour == "trackroomstate")
{
// Tie LED enable to room power state
room.OnFeedback.OutputChange += (o, a) =>
var essRoom = room as EssentialsRoomBase;
essRoom.OnFeedback.OutputChange += (o, a) =>
{
if (room.OnFeedback.BoolValue)
if (essRoom.OnFeedback.BoolValue)
mP.EnableLeds = true;
else
mP.EnableLeds = false;
};
mP.EnableLeds = room.OnFeedback.BoolValue;
mP.EnableLeds = essRoom.OnFeedback.BoolValue;
}
else if (behaviour == "trackcallstate")
{
// Tie LED enable to room power state
room.InCallFeedback.OutputChange += (o, a) =>
var inCallRoom = room as IHasInCallFeedback;
inCallRoom.InCallFeedback.OutputChange += (o, a) =>
{
if (room.InCallFeedback.BoolValue)
if (inCallRoom.InCallFeedback.BoolValue)
mP.EnableLeds = true;
else
mP.EnableLeds = false;
};
mP.EnableLeds = room.InCallFeedback.BoolValue;
mP.EnableLeds = inCallRoom.InCallFeedback.BoolValue;
}
return mP;
@@ -175,6 +183,25 @@ namespace PepperDash.Essentials.Room.Config
public bool ZeroVolumeWhenSwtichingVolumeDevices { get; set; }
}
public class EssentialsAvRoomPropertiesConfig : EssentialsRoomPropertiesConfig
{
[JsonProperty("defaultAudioKey")]
public string DefaultAudioKey { get; set; }
[JsonProperty("sourceListKey")]
public string SourceListKey { get; set; }
[JsonProperty("defaultSourceItem")]
public string DefaultSourceItem { get; set; }
}
public class EssentialsConferenceRoomPropertiesConfig : EssentialsAvRoomPropertiesConfig
{
[JsonProperty("videoCodecKey")]
public string VideoCodecKey { get; set; }
[JsonProperty("audioCodecKey")]
public string AudioCodecKey { get; set; }
}
public class EssentialsEnvironmentPropertiesConfig
{
public bool Enabled { get; set; }

View File

@@ -12,15 +12,7 @@ using PepperDash.Essentials.Room.Config;
namespace PepperDash.Essentials.Room
{
public abstract class EssentialsRoomEmergencyBase : IKeyed
{
public string Key { get; private set; }
public EssentialsRoomEmergencyBase(string key)
{
Key = key;
}
}
public class EssentialsRoomEmergencyContactClosure : EssentialsRoomEmergencyBase

View File

@@ -0,0 +1,656 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Devices;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Room.Config;
using PepperDash.Essentials.Devices.Common.Codec;
using PepperDash.Essentials.Devices.Common.VideoCodec;
using PepperDash.Essentials.Devices.Common.AudioCodec;
namespace PepperDash.Essentials
{
public class EssentialsDualDisplayRoom : EssentialsNDisplayRoomBase, IHasCurrentVolumeControls,
IRunRouteAction, IPrivacy, IRunDefaultCallRoute, IHasVideoCodec, IHasAudioCodec, IHasInCallFeedback
{
public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange;
public EssentialsDualDisplayRoomPropertiesConfig PropertiesConfig { get; private set; }
//************************
// Call-related stuff
public BoolFeedback InCallFeedback { get; private set; }
/// <summary>
/// States: 0 for on hook, 1 for video, 2 for audio, 3 for telekenesis
/// </summary>
public IntFeedback CallTypeFeedback { get; private set; }
/// <summary>
///
/// </summary>
public BoolFeedback PrivacyModeIsOnFeedback { get; private set; }
/// <summary>
/// When something in the room is sharing with the far end or through other means
/// </summary>
public BoolFeedback IsSharingFeedback { get; private set; }
public IRoutingSinkWithSwitching LeftDisplay { get; private set; }
public IRoutingSinkWithSwitching RightDisplay { get; private set; }
protected override Func<bool> OnFeedbackFunc
{
get
{
return () =>
{
var leftDisp = LeftDisplay as DisplayBase;
var rightDisp = RightDisplay as DisplayBase;
var val = leftDisp != null && leftDisp.CurrentSourceInfo != null
&& leftDisp.CurrentSourceInfo.Type == eSourceListItemType.Route
&& rightDisp != null && rightDisp.CurrentSourceInfo != null
&& rightDisp.CurrentSourceInfo.Type == eSourceListItemType.Route;
return val;
};
}
}
/// <summary>
///
/// </summary>
protected override Func<bool> IsWarmingFeedbackFunc
{
get
{
return () =>
{
var leftDisp = LeftDisplay as DisplayBase;
var rightDisp = RightDisplay as DisplayBase;
if (leftDisp != null && RightDisplay != null)
return leftDisp.IsWarmingUpFeedback.BoolValue || rightDisp.IsWarmingUpFeedback.BoolValue;
else
return false;
};
}
}
/// <summary>
///
/// </summary>
protected override Func<bool> IsCoolingFeedbackFunc
{
get
{
return () =>
{
var leftDisp = LeftDisplay as DisplayBase;
var rightDisp = RightDisplay as DisplayBase;
if (leftDisp != null && RightDisplay != null)
return leftDisp.IsCoolingDownFeedback.BoolValue || rightDisp.IsCoolingDownFeedback.BoolValue;
else
return false;
};
}
}
public IBasicVolumeControls DefaultAudioDevice { get; private set; }
public IBasicVolumeControls DefaultVolumeControls { get; private set; }
public VideoCodecBase VideoCodec { get; private set; }
public AudioCodecBase AudioCodec { get; private set; }
public bool ExcludeFromGlobalFunctions { get; set; }
public string DefaultSourceItem { get; set; }
public ushort DefaultVolume { get; set; }
/// <summary>
/// If room is off, enables power on to last source. Default true
/// </summary>
public bool EnablePowerOnToLastSource { get; set; }
string LastSourceKey;
/// <summary>
/// Sets the volume control device, and attaches/removes InUseTrackers with "audio"
/// tag to device.
/// </summary>
public IBasicVolumeControls CurrentVolumeControls
{
get { return _CurrentAudioDevice; }
set
{
if (value == _CurrentAudioDevice) return;
var oldDev = _CurrentAudioDevice;
// derigister this room from the device, if it can
if (oldDev is IInUseTracking)
(oldDev as IInUseTracking).InUseTracker.RemoveUser(this, "audio");
var handler = CurrentVolumeDeviceChange;
if (handler != null)
CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.WillChange));
_CurrentAudioDevice = value;
if (handler != null)
CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.DidChange));
// register this room with new device, if it can
if (_CurrentAudioDevice is IInUseTracking)
(_CurrentAudioDevice as IInUseTracking).InUseTracker.AddUser(this, "audio");
}
}
IBasicVolumeControls _CurrentAudioDevice;
/// <summary>
/// "codecOsd"
/// </summary>
public string DefaultCodecRouteString { get { return "codecOsd"; } }
/// <summary>
/// Temporary implementation. Returns the schedule-ready object or null if none. Fow now,
/// always returns the VideoCodec if it is capable
/// </summary>
public IHasScheduleAwareness ScheduleSource { get { return VideoCodec as IHasScheduleAwareness; } }
CCriticalSection SourceSelectLock = new CCriticalSection();
public EssentialsDualDisplayRoom(DeviceConfig config)
: base(config)
{
try
{
PropertiesConfig = JsonConvert.DeserializeObject<EssentialsDualDisplayRoomPropertiesConfig>
(config.Properties.ToString());
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");
}
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");
}
VideoCodec = DeviceManager.GetDeviceForKey(PropertiesConfig.VideoCodecKey) as
PepperDash.Essentials.Devices.Common.VideoCodec.VideoCodecBase;
if (VideoCodec == null)
throw new ArgumentNullException("codec cannot be null");
AudioCodec = DeviceManager.GetDeviceForKey(PropertiesConfig.AudioCodecKey) as
PepperDash.Essentials.Devices.Common.AudioCodec.AudioCodecBase;
if (AudioCodec == null)
Debug.Console(0, this, "No Audio Codec Found");
DefaultAudioDevice = DeviceManager.GetDeviceForKey(PropertiesConfig.DefaultAudioKey) as IBasicVolumeControls;
Initialize();
}
catch (Exception e)
{
Debug.Console(1, this, "Error building room \n{0}", e);
}
}
void Initialize()
{
if (DefaultAudioDevice is IBasicVolumeControls)
DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls;
else if (DefaultAudioDevice is IHasVolumeDevice)
DefaultVolumeControls = (DefaultAudioDevice as IHasVolumeDevice).VolumeDevice;
CurrentVolumeControls = DefaultVolumeControls;
var leftDisp = LeftDisplay as DisplayBase;
if (leftDisp != null)
InitializeDisplay(leftDisp);
var rightDisp = RightDisplay as DisplayBase;
if (rightDisp != null)
InitializeDisplay(rightDisp);
// 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(() =>
{
bool inAudioCall = false;
bool inVideoCall = false;
if (AudioCodec != null)
inAudioCall = AudioCodec.IsInCall;
if (VideoCodec != null)
inVideoCall = VideoCodec.IsInCall;
if (inAudioCall || inVideoCall)
return true;
else
return false;
});
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;
}
void InitializeDisplay(DisplayBase disp)
{
if (disp != null)
{
// Link power, warming, cooling to display
disp.PowerIsOnFeedback.OutputChange += (o, a) =>
{
if (disp.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue)
{
if (!disp.PowerIsOnFeedback.BoolValue)
disp.CurrentSourceInfo = null;
OnFeedback.FireUpdate();
}
if (disp.PowerIsOnFeedback.BoolValue)
{
SetDefaultLevels();
}
};
disp.IsWarmingUpFeedback.OutputChange += (o, a) =>
{
IsWarmingUpFeedback.FireUpdate();
if (!IsWarmingUpFeedback.BoolValue)
(CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(DefaultVolume);
};
disp.IsCoolingDownFeedback.OutputChange += (o, a) =>
{
IsCoolingDownFeedback.FireUpdate();
};
}
}
protected override void CustomSetConfig(DeviceConfig config)
{
var newPropertiesConfig = JsonConvert.DeserializeObject<EssentialsDualDisplayRoomPropertiesConfig>(config.Properties.ToString());
if (newPropertiesConfig != null)
PropertiesConfig = newPropertiesConfig;
ConfigWriter.UpdateRoomConfig(config);
}
public override bool CustomActivate()
{
// Add Occupancy object from config
if (PropertiesConfig.Occupancy != null)
this.SetRoomOccupancy(DeviceManager.GetDeviceForKey(PropertiesConfig.Occupancy.DeviceKey) as
IOccupancyStatusProvider, PropertiesConfig.Occupancy.TimeoutMinutes);
this.LogoUrl = PropertiesConfig.Logo.GetUrl();
this.SourceListKey = PropertiesConfig.SourceListKey;
this.DefaultSourceItem = PropertiesConfig.DefaultSourceItem;
this.DefaultVolume = (ushort)(PropertiesConfig.Volumes.Master.Level * 65535 / 100);
return base.CustomActivate();
}
/// <summary>
///
/// </summary>
protected override void EndShutdown()
{
VideoCodec.EndAllCalls();
SetDefaultLevels();
RunDefaultPresentRoute();
CrestronEnvironment.Sleep(1000);
RunRouteAction("roomOff");
}
/// <summary>
/// Routes the default source item, if any. Returns true when default route exists
/// </summary>
public override bool RunDefaultPresentRoute()
{
if (DefaultSourceItem != null)
RunRouteAction(DefaultSourceItem);
return DefaultSourceItem != null;
}
/// <summary>
/// Sets up the room when started into call mode without presenting a source
/// </summary>
/// <returns></returns>
public bool RunDefaultCallRoute()
{
RunRouteAction(DefaultCodecRouteString);
return true;
}
/// <summary>
///
/// </summary>
/// <param name="routeKey"></param>
public void RunRouteAction(string routeKey)
{
RunRouteAction(routeKey, null);
}
/// <summary>
/// Gets a source from config list SourceListKey and dynamically build and executes the
/// route or commands
/// </summary>
/// <param name="name"></param>
public void RunRouteAction(string routeKey, Action successCallback)
{
// Run this on a separate thread
new CTimer(o =>
{
// try to prevent multiple simultaneous selections
SourceSelectLock.TryEnter();
try
{
Debug.Console(1, this, "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);
return;
}
// Try to get the list item by it's string key
if (!dict.ContainsKey(routeKey))
{
Debug.Console(1, this, "WARNING: No item '{0}' found on config list '{1}'",
routeKey, SourceListKey);
return;
}
// End usage timer on last source
if (!string.IsNullOrEmpty(LastSourceKey))
{
var usageLastSource = dict[LastSourceKey].SourceDevice as IUsageTracking;
if (usageLastSource != null && usageLastSource.UsageTracker != null)
{
try
{
// There MAY have been failures in here. Protect
usageLastSource.UsageTracker.EndDeviceUsage();
}
catch (Exception e)
{
Debug.Console(1, this, "*#* EXCEPTION in end usage tracking:\r{0}", e);
}
}
}
// Let's run it
var item = dict[routeKey];
if (routeKey.ToLower() != "roomoff")
{
LastSourceKey = routeKey;
}
//else
// CurrentSourceInfoKey = null;
// hand off the individual routes to this helper
foreach (var route in item.RouteList)
DoRouteItem(route, item, routeKey);
// Start usage timer on routed source
var usageNewSource = item.SourceDevice as IUsageTracking;
if (usageNewSource != null && usageNewSource.UsageTracker != null) // Have to make sure there is a usage tracker!
{
(item.SourceDevice as IUsageTracking).UsageTracker.StartDeviceUsage();
}
// See if this can be moved into common, base-class method -------------
// Set volume control, using default if non provided
IBasicVolumeControls volDev = null;
// Handle special cases for volume control
if (string.IsNullOrEmpty(item.VolumeControlKey)
|| item.VolumeControlKey.Equals("$defaultAudio", StringComparison.OrdinalIgnoreCase))
volDev = DefaultVolumeControls;
// Or a specific device, probably rarely used.
else
{
var dev = DeviceManager.GetDeviceForKey(item.VolumeControlKey);
if (dev is IBasicVolumeControls)
volDev = dev as IBasicVolumeControls;
else if (dev is IHasVolumeDevice)
volDev = (dev as IHasVolumeDevice).VolumeDevice;
}
if (volDev != CurrentVolumeControls)
{
// zero the volume on the device we are leaving.
// Set the volume to default on device we are entering
if (ZeroVolumeWhenSwtichingVolumeDevices && CurrentVolumeControls is IBasicVolumeWithFeedback)
{
var vd = CurrentVolumeControls as IBasicVolumeWithFeedback;
SavedVolumeLevels[vd] = (uint)vd.VolumeLevelFeedback.IntValue;
vd.SetVolume(0);
}
CurrentVolumeControls = volDev;
if (ZeroVolumeWhenSwtichingVolumeDevices && CurrentVolumeControls is IBasicVolumeWithFeedback)
{
var vd = CurrentVolumeControls as IBasicVolumeWithFeedback;
ushort vol = (SavedVolumeLevels.ContainsKey(vd) ? (ushort)SavedVolumeLevels[vd] : DefaultVolume);
vd.SetVolume(vol);
}
}
// -----------------------------------------------------------------------
// store the name and UI info for routes
if (item.SourceKey == "$off")
{
LeftDisplay.CurrentSourceInfoKey = routeKey;
LeftDisplay.CurrentSourceInfo = null;
RightDisplay.CurrentSourceInfoKey = routeKey;
RightDisplay.CurrentSourceInfo = null;
}
//else if (item.SourceKey != null)
//{
// if(item.RouteList
// CurrentSourceInfoKey = routeKey;
// CurrentSourceInfo = item;
//}
OnFeedback.FireUpdate();
// report back when done
if (successCallback != null)
successCallback();
}
catch (Exception e)
{
Debug.Console(1, this, "ERROR in routing: {0}", e);
}
SourceSelectLock.Leave();
}, 0); // end of CTimer
}
/// <summary>
///
/// </summary>
/// <param name="route"></param>
void DoRouteItem(SourceRouteListItem route, SourceListItem sourceItem, string sourceItemKey)
{
// if there is a $defaultAll on route, run two separate
if (route.DestinationKey.Equals("$defaultAll", StringComparison.OrdinalIgnoreCase))
{
// Going to assume a single-path route for now
var tempVideo = new SourceRouteListItem
{
DestinationKey = "$defaultDisplay",
SourceKey = route.SourceKey,
Type = eRoutingSignalType.Video
};
DoRoute(tempVideo, sourceItem, sourceItemKey);
}
else
DoRoute(route, sourceItem, sourceItemKey);
}
/// <summary>
///
/// </summary>
/// <param name="route"></param>
/// <returns></returns>
bool DoRoute(SourceRouteListItem route, SourceListItem sourceItem, string sourceItemKey)
{
IRoutingSinkNoSwitching dest = null;
if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase))
dest = DefaultAudioDevice as IRoutingSinkNoSwitching;
else if (route.DestinationKey.Equals(LeftDisplay.Key, StringComparison.OrdinalIgnoreCase))
dest = LeftDisplay;
else if (route.DestinationKey.Equals(RightDisplay.Key, StringComparison.OrdinalIgnoreCase))
dest = RightDisplay;
else
dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSinkNoSwitching;
if (dest == null)
{
Debug.Console(1, this, "Cannot route, unknown destination '{0}'", route.DestinationKey);
return false;
}
if (route.SourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase))
{
dest.ReleaseRoute();
if (dest is IPower)
(dest as IPower).PowerOff();
}
else
{
var source = DeviceManager.GetDeviceForKey(route.SourceKey) as IRoutingOutputs;
if (source == null)
{
Debug.Console(1, this, "Cannot route unknown source '{0}' to {1}", route.SourceKey, route.DestinationKey);
return false;
}
dest.ReleaseAndMakeRoute(source, route.Type);
dest.CurrentSourceInfoKey = sourceItemKey;
dest.CurrentSourceInfo = sourceItem;
}
return true;
}
public override void RoomVacatedForTimeoutPeriod(object o)
{
//Implement this
}
/// <summary>
/// Does what it says
/// </summary>
public override void SetDefaultLevels()
{
Debug.Console(1, this, "Restoring default levels");
var vc = CurrentVolumeControls as IBasicVolumeWithFeedback;
if (vc != null)
vc.SetVolume(DefaultVolume);
}
/// <summary>
/// Will power the room on with the last-used source
/// </summary>
public override void PowerOnToDefaultOrLastSource()
{
if (!EnablePowerOnToLastSource || LastSourceKey == null)
return;
RunRouteAction(LastSourceKey);
}
/// <summary>
/// Runs "roomOff" action on all rooms not set to ExcludeFromGlobalFunctions
/// </summary>
public static void AllRoomsOff()
{
var allRooms = DeviceManager.AllDevices.Where(d =>
d is EssentialsHuddleSpaceRoom && !(d as EssentialsHuddleSpaceRoom).ExcludeFromGlobalFunctions);
foreach (var room in allRooms)
(room as EssentialsHuddleSpaceRoom).RunRouteAction("roomOff");
}
#region IPrivacy Members
public void PrivacyModeOff()
{
VideoCodec.PrivacyModeOff();
}
public void PrivacyModeOn()
{
VideoCodec.PrivacyModeOn();
}
public void PrivacyModeToggle()
{
VideoCodec.PrivacyModeToggle();
}
#endregion
}
}

View File

@@ -13,10 +13,10 @@ using PepperDash.Essentials.Room.Config;
namespace PepperDash.Essentials
{
public class EssentialsHuddleSpaceRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange, IRunRouteAction, IRunDefaultPresentRoute, IHasCurrentVolumeControls
public class EssentialsHuddleSpaceRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange, IRunRouteAction, IRunDefaultPresentRoute, IHasCurrentVolumeControls, IHasDefaultDisplay
{
public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange;
public event SourceInfoChangeHandler CurrentSingleSourceChange;
public event SourceInfoChangeHandler CurrentSourceChange;
protected override Func<bool> OnFeedbackFunc
{
@@ -76,11 +76,6 @@ namespace PepperDash.Essentials
public bool ExcludeFromGlobalFunctions { get; set; }
/// <summary>
/// The config name of the source list
/// </summary>
public string SourceListKey { get; set; }
public string DefaultSourceItem { get; set; }
public ushort DefaultVolume { get; set; }
@@ -124,17 +119,17 @@ namespace PepperDash.Essentials
public SourceListItem CurrentSourceInfo
{
get { return _CurrentSourceInfo; }
private set
set
{
if (value == _CurrentSourceInfo) return;
var handler = CurrentSingleSourceChange;
var handler = CurrentSourceChange;
// remove from in-use tracker, if so equipped
if(_CurrentSourceInfo != null && _CurrentSourceInfo.SourceDevice is IInUseTracking)
(_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.RemoveUser(this, "control");
if (handler != null)
handler(this, _CurrentSourceInfo, ChangeType.WillChange);
handler(_CurrentSourceInfo, ChangeType.WillChange);
_CurrentSourceInfo = value;
@@ -142,12 +137,12 @@ namespace PepperDash.Essentials
if (_CurrentSourceInfo != null && _CurrentSourceInfo.SourceDevice is IInUseTracking)
(_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.AddUser(this, "control");
if (handler != null)
handler(this, _CurrentSourceInfo, ChangeType.DidChange);
handler( _CurrentSourceInfo, ChangeType.DidChange);
}
}
SourceListItem _CurrentSourceInfo;
public string CurrentSourceInfoKey { get; private set; }
public string CurrentSourceInfoKey { get; set; }
public EssentialsHuddleSpaceRoom(DeviceConfig config)
: base(config)
@@ -228,6 +223,8 @@ namespace PepperDash.Essentials
CrestronEnvironment.Sleep(1000);
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Shutting down room");
RunRouteAction("roomOff");
}
@@ -251,7 +248,7 @@ namespace PepperDash.Essentials
// Add Occupancy object from config
if (PropertiesConfig.Occupancy != null)
this.SetRoomOccupancy(DeviceManager.GetDeviceForKey(PropertiesConfig.Occupancy.DeviceKey) as
PepperDash.Essentials.Devices.Common.Occupancy.IOccupancyStatusProvider, PropertiesConfig.Occupancy.TimeoutMinutes);
IOccupancyStatusProvider, PropertiesConfig.Occupancy.TimeoutMinutes);
this.LogoUrl = PropertiesConfig.Logo.GetUrl();
this.SourceListKey = PropertiesConfig.SourceListKey;
@@ -280,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

@@ -16,11 +16,11 @@ using PepperDash.Essentials.Devices.Common.AudioCodec;
namespace PepperDash.Essentials
{
public class EssentialsHuddleVtc1Room : EssentialsRoomBase, IHasCurrentSourceInfoChange,
IPrivacy, IHasCurrentVolumeControls, IRunRouteAction, IRunDefaultCallRoute, IHasVideoCodec, IHasAudioCodec
public class EssentialsHuddleVtc1Room : EssentialsRoomBase, IHasCurrentSourceInfoChange,
IPrivacy, IHasCurrentVolumeControls, IRunRouteAction, IRunDefaultCallRoute, IHasVideoCodec, IHasAudioCodec, IHasDefaultDisplay, IHasInCallFeedback
{
public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange;
public event SourceInfoChangeHandler CurrentSingleSourceChange;
public event SourceInfoChangeHandler CurrentSourceChange;
//************************
@@ -112,11 +112,6 @@ namespace PepperDash.Essentials
public AudioCodecBase AudioCodec { get; private set; }
public bool ExcludeFromGlobalFunctions { get; set; }
/// <summary>
/// The config name of the source list
/// </summary>
public string SourceListKey { get; set; }
public string DefaultSourceItem { get; set; }
@@ -162,17 +157,17 @@ namespace PepperDash.Essentials
public SourceListItem CurrentSourceInfo
{
get { return _CurrentSourceInfo; }
private set
set
{
if (value == _CurrentSourceInfo) return;
var handler = CurrentSingleSourceChange;
var handler = CurrentSourceChange;
// remove from in-use tracker, if so equipped
if(_CurrentSourceInfo != null && _CurrentSourceInfo.SourceDevice is IInUseTracking)
(_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.RemoveUser(this, "control");
if (handler != null)
handler(this, _CurrentSourceInfo, ChangeType.WillChange);
handler(_CurrentSourceInfo, ChangeType.WillChange);
_CurrentSourceInfo = value;
@@ -180,12 +175,12 @@ namespace PepperDash.Essentials
if (_CurrentSourceInfo != null && _CurrentSourceInfo.SourceDevice is IInUseTracking)
(_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.AddUser(this, "control");
if (handler != null)
handler(this, _CurrentSourceInfo, ChangeType.DidChange);
handler(_CurrentSourceInfo, ChangeType.DidChange);
}
}
SourceListItem _CurrentSourceInfo;
public string CurrentSourceInfoKey { get; private set; }
public string CurrentSourceInfoKey { get; set; }
/// <summary>
/// "codecOsd"
@@ -231,64 +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();
}
};
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.");
}
if (DefaultAudioDevice is IBasicVolumeControls)
DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls;
else if (DefaultAudioDevice is IHasVolumeDevice)
DefaultVolumeControls = (DefaultAudioDevice as IHasVolumeDevice).VolumeDevice;
CurrentVolumeControls = DefaultVolumeControls;
// 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)
@@ -297,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)
@@ -329,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
PepperDash.Essentials.Devices.Common.Occupancy.IOccupancyStatusProvider, PropertiesConfig.Occupancy.TimeoutMinutes);
IOccupancyStatusProvider, PropertiesConfig.Occupancy.TimeoutMinutes);
}
this.LogoUrl = PropertiesConfig.Logo.GetUrl();
this.SourceListKey = PropertiesConfig.SourceListKey;
@@ -354,6 +362,8 @@ namespace PepperDash.Essentials
CrestronEnvironment.Sleep(1000);
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Shutting down room");
RunRouteAction("roomOff");
}
@@ -403,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,34 +12,22 @@ 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 event SourceInfoChangeHandler CurrentSingleSourceChange;
public Dictionary<string, IRoutingSinkWithSwitching> Displays { get; protected set; }
protected override Func<bool> IsWarmingFeedbackFunc { get { return () => false; ; } }
protected override Func<bool> IsCoolingFeedbackFunc { get { return () => false; } }
public Dictionary<eSourceListItemDestinationTypes, IRoutingSinkWithSwitching> Displays { get; protected set;}
public EssentialsNDisplayRoomBase(DeviceConfig config)
: base (config)
{
Displays = new Dictionary<string, IRoutingSinkWithSwitching>();
Displays = new Dictionary<eSourceListItemDestinationTypes, IRoutingSinkWithSwitching>();
var propertiesConfig = JsonConvert.DeserializeObject<EssentialsNDisplayRoomPropertiesConfig>(config.Properties.ToString());
foreach (var display in propertiesConfig.Displays)
{
var displayDevice = DeviceManager.GetDeviceForKey(display.Value) as IRoutingSinkWithSwitching;
if (displayDevice != null)
Displays.Add(display.Key, displayDevice);
}
}
}
}

View File

@@ -13,7 +13,7 @@ using PepperDash.Essentials.Core.PageManagers;
namespace PepperDash.Essentials
{
public class EssentialsTouchpanelController : Device
public class EssentialsTouchpanelController : Device, IHasBasicTriListWithSmartObject
{
public BasicTriListWithSmartObject Panel { get; private set; }
@@ -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

@@ -25,11 +25,11 @@ namespace PepperDash.Essentials
public void RegisterForSourceChange(IHasCurrentSourceInfoChange room)
{
room.CurrentSingleSourceChange -= room_CurrentSourceInfoChange;
room.CurrentSingleSourceChange += room_CurrentSourceInfoChange;
room.CurrentSourceChange -= room_CurrentSourceInfoChange;
room.CurrentSourceChange += room_CurrentSourceInfoChange;
}
void room_CurrentSourceInfoChange(EssentialsRoomBase room, SourceListItem info, ChangeType type)
void room_CurrentSourceInfoChange(SourceListItem info, ChangeType type)
{
if (type == ChangeType.WillChange && info == SourceItem)
ClearFeedback();

View File

@@ -733,7 +733,7 @@ namespace PepperDash.Essentials
// Disconnect current room
_CurrentRoom.CurrentVolumeDeviceChange -= this.CurrentRoom_CurrentAudioDeviceChange;
ClearAudioDeviceConnections();
_CurrentRoom.CurrentSingleSourceChange -= this.CurrentRoom_SourceInfoChange;
_CurrentRoom.CurrentSourceChange -= this.CurrentRoom_SourceInfoChange;
DisconnectSource(_CurrentRoom.CurrentSourceInfo);
_CurrentRoom.ShutdownPromptTimer.HasStarted -= ShutdownPromptTimer_HasStarted;
_CurrentRoom.ShutdownPromptTimer.HasFinished -= ShutdownPromptTimer_HasFinished;
@@ -803,7 +803,7 @@ namespace PepperDash.Essentials
_CurrentRoom.CurrentVolumeDeviceChange += CurrentRoom_CurrentAudioDeviceChange;
RefreshAudioDeviceConnections();
_CurrentRoom.CurrentSingleSourceChange += CurrentRoom_SourceInfoChange;
_CurrentRoom.CurrentSourceChange += CurrentRoom_SourceInfoChange;
RefreshSourceInfo();
(Parent as EssentialsPanelMainInterfaceDriver).HeaderDriver.SetupHeaderButtons(this, CurrentRoom);
@@ -1064,8 +1064,7 @@ namespace PepperDash.Essentials
/// <summary>
/// Handles source change
/// </summary>
void CurrentRoom_SourceInfoChange(EssentialsRoomBase room,
SourceListItem info, ChangeType change)
void CurrentRoom_SourceInfoChange(SourceListItem info, ChangeType change)
{
if (change == ChangeType.WillChange)
DisconnectSource(info);

View File

@@ -885,7 +885,7 @@ namespace PepperDash.Essentials
// Disconnect current room
_CurrentRoom.CurrentVolumeDeviceChange -= this.CurrentRoom_CurrentAudioDeviceChange;
ClearAudioDeviceConnections();
_CurrentRoom.CurrentSingleSourceChange -= this.CurrentRoom_SourceInfoChange;
_CurrentRoom.CurrentSourceChange -= this.CurrentRoom_SourceInfoChange;
DisconnectSource(_CurrentRoom.CurrentSourceInfo);
_CurrentRoom.ShutdownPromptTimer.HasStarted -= ShutdownPromptTimer_HasStarted;
_CurrentRoom.ShutdownPromptTimer.HasFinished -= ShutdownPromptTimer_HasFinished;
@@ -924,7 +924,7 @@ namespace PepperDash.Essentials
_CurrentRoom.CurrentVolumeDeviceChange += CurrentRoom_CurrentAudioDeviceChange;
RefreshAudioDeviceConnections();
_CurrentRoom.CurrentSingleSourceChange += CurrentRoom_SourceInfoChange;
_CurrentRoom.CurrentSourceChange += CurrentRoom_SourceInfoChange;
RefreshSourceInfo();
if (_CurrentRoom.VideoCodec is IHasScheduleAwareness)
@@ -939,7 +939,7 @@ namespace PepperDash.Essentials
SetActiveCallListSharingContentStatus();
if (_CurrentRoom != null)
_CurrentRoom.CurrentSingleSourceChange += new SourceInfoChangeHandler(CurrentRoom_CurrentSingleSourceChange);
_CurrentRoom.CurrentSourceChange += new SourceInfoChangeHandler(CurrentRoom_CurrentSingleSourceChange);
TriList.SetSigFalseAction(UIBoolJoin.CallStopSharingPress, () => _CurrentRoom.RunRouteAction("codecOsd"));
@@ -1050,7 +1050,7 @@ namespace PepperDash.Essentials
/// <param name="room"></param>
/// <param name="info"></param>
/// <param name="type"></param>
void CurrentRoom_CurrentSingleSourceChange(EssentialsRoomBase room, SourceListItem info, ChangeType type)
void CurrentRoom_CurrentSingleSourceChange(SourceListItem info, ChangeType type)
{
if (_CurrentRoom.VideoCodec.SharingContentIsOnFeedback.BoolValue && _CurrentRoom.CurrentSourceInfo != null)
TriList.StringInput[UIStringJoin.CallSharedSourceNameText].StringValue = _CurrentRoom.CurrentSourceInfo.PreferredName;
@@ -1363,8 +1363,7 @@ namespace PepperDash.Essentials
/// <summary>
/// Handles source change
/// </summary>
void CurrentRoom_SourceInfoChange(EssentialsRoomBase room,
SourceListItem info, ChangeType change)
void CurrentRoom_SourceInfoChange(SourceListItem info, ChangeType change)
{
if (change == ChangeType.WillChange)
DisconnectSource(info);

View File

@@ -64,11 +64,11 @@ namespace PepperDash.Essentials
parent.SetItemMainText(index, room.Name);
UpdateItem(room.CurrentSourceInfo);
// Watch for later changes
room.CurrentSingleSourceChange += new SourceInfoChangeHandler(room_CurrentSourceInfoChange);
room.CurrentSourceChange += new SourceInfoChangeHandler(room_CurrentSourceInfoChange);
parent.SetItemButtonAction(index, buttonAction);
}
void room_CurrentSourceInfoChange(EssentialsRoomBase room, SourceListItem info, ChangeType type)
void room_CurrentSourceInfoChange(SourceListItem info, ChangeType type)
{
UpdateItem(info);
}

View File

@@ -9,8 +9,8 @@ using PepperDash.Essentials.Core;
namespace PepperDash.Essentials
{
/// <summary>
/// The handler type for a Room's SourceInfoChange
/// </summary>
public delegate void SourceInfoChangeHandler(EssentialsRoomBase room, SourceListItem info, ChangeType type);
///// <summary>
///// The handler type for a Room's SourceInfoChange
///// </summary>
//public delegate void SourceInfoChangeHandler(EssentialsRoomBase room, SourceListItem info, ChangeType type);
}

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,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

@@ -7,7 +7,7 @@ using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Routing;
using PepperDash.Core;
namespace PepperDash.Essentials.Devices.Common
namespace PepperDash.Essentials.Core.Devices
{
/// <summary>
/// This DVD class should cover most IR, one-way DVD and Bluray fuctions

View File

@@ -7,7 +7,7 @@ using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Routing;
using PepperDash.Core;
namespace PepperDash.Essentials.Devices.Common
namespace PepperDash.Essentials.Core.Devices
{
/// <summary>
/// This DVD class should cover most IR, one-way DVD and Bluray fuctions

View File

@@ -95,6 +95,9 @@ namespace PepperDash.Essentials.Core
[JsonProperty("disableRoutedSharing")]
public bool DisableRoutedSharing { get; set; }
[JsonProperty("destinations")]
public List<eSourceListItemDestinationTypes> Destinations { get; set; }
public SourceListItem()
{
Icon = "Blank";
@@ -112,4 +115,16 @@ namespace PepperDash.Essentials.Core
[JsonProperty("type")]
public eRoutingSignalType Type { get; set; }
}
/// <summary>
/// Defines the valid destination types for SourceListItems in a room
/// </summary>
public enum eSourceListItemDestinationTypes
{
defaultDisplay,
leftDisplay,
rightDisplay,
programAudio,
codecContent
}
}

View File

@@ -12,7 +12,7 @@ using PepperDash.Essentials.Core.Routing;
namespace PepperDash.Essentials.Core
{
public class BasicIrDisplay : DisplayBase, IBasicVolumeControls, IPower, IWarmingCooling, IRoutingSinkWithSwitching
public class BasicIrDisplay : DisplayBase, IBasicVolumeControls, IPower, IWarmingCooling
{
public IrOutputPortController IrPort { get; private set; }
public ushort IrPulseTime { get; set; }

View File

@@ -18,6 +18,32 @@ namespace PepperDash.Essentials.Core
/// </summary>
public abstract class DisplayBase : Device, IHasFeedback, IRoutingSinkWithSwitching, IPower, IWarmingCooling, IUsageTracking
{
public event SourceInfoChangeHandler CurrentSourceChange;
public string CurrentSourceInfoKey { get; set; }
public SourceListItem CurrentSourceInfo
{
get
{
return _CurrentSourceInfo;
}
set
{
if (value == _CurrentSourceInfo) return;
var handler = CurrentSourceChange;
if (handler != null)
handler(_CurrentSourceInfo, ChangeType.WillChange);
_CurrentSourceInfo = value;
if (handler != null)
handler(_CurrentSourceInfo, ChangeType.DidChange);
}
}
SourceListItem _CurrentSourceInfo;
public BoolFeedback PowerIsOnFeedback { get; protected set; }
public BoolFeedback IsCoolingDownFeedback { get; protected set; }
public BoolFeedback IsWarmingUpFeedback { get; private 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

@@ -18,12 +18,10 @@ using PepperDash.Core;
using PepperDash.Essentials;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Devices.Common;
using PepperDash.Essentials.Devices.Common.Occupancy;
namespace PepperDash.Essentials.Fusion
namespace PepperDash.Essentials.Core.Fusion
{
public class EssentialsHuddleSpaceFusionSystemControllerBase : Device, IOccupancyStatusProvider
{
@@ -330,11 +328,11 @@ namespace PepperDash.Essentials.Fusion
// Moved to
CurrentRoomSourceNameSig = FusionRoom.CreateOffsetStringSig(84, "Display 1 - Current Source", eSigIoMask.InputSigOnly);
// Don't think we need to get current status of this as nothing should be alive yet.
(Room as EssentialsHuddleSpaceRoom).CurrentSingleSourceChange += new SourceInfoChangeHandler(Room_CurrentSourceInfoChange);
(Room as IHasCurrentSourceInfoChange).CurrentSourceChange += new SourceInfoChangeHandler(Room_CurrentSourceInfoChange);
FusionRoom.SystemPowerOn.OutputSig.SetSigFalseAction((Room as EssentialsHuddleSpaceRoom).PowerOnToDefaultOrLastSource);
FusionRoom.SystemPowerOff.OutputSig.SetSigFalseAction(() => (Room as EssentialsHuddleSpaceRoom).RunRouteAction("roomOff"));
FusionRoom.SystemPowerOn.OutputSig.SetSigFalseAction((Room as EssentialsRoomBase).PowerOnToDefaultOrLastSource);
FusionRoom.SystemPowerOff.OutputSig.SetSigFalseAction(() => (Room as IRunRouteAction).RunRouteAction("roomOff"));
// NO!! room.RoomIsOn.LinkComplementInputSig(FusionRoom.SystemPowerOff.InputSig);
FusionRoom.ErrorMessage.InputSig.StringValue =
"3: 7 Errors: This is a really long error message;This is a really long error message;This is a really long error message;This is a really long error message;This is a really long error message;This is a really long error message;This is a really long error message;";
@@ -990,7 +988,7 @@ namespace PepperDash.Essentials.Fusion
protected virtual void SetUpSources()
{
// Sources
var dict = ConfigReader.ConfigObject.GetSourceListForKey((Room as EssentialsHuddleSpaceRoom).SourceListKey);
var dict = ConfigReader.ConfigObject.GetSourceListForKey((Room as EssentialsRoomBase).SourceListKey);
if (dict != null)
{
// NEW PROCESS:
@@ -1015,7 +1013,7 @@ namespace PepperDash.Essentials.Fusion
break;
}
var laptops = dict.Where(d => d.Value.SourceDevice is Laptop);
var laptops = dict.Where(d => d.Value.SourceDevice is Devices.Laptop);
i = 1;
foreach (var kvp in laptops)
{
@@ -1041,7 +1039,7 @@ namespace PepperDash.Essentials.Fusion
else
{
Debug.Console(1, this, "WARNING: Config source list '{0}' not found for room '{1}'",
(Room as EssentialsHuddleSpaceRoom).SourceListKey, Room.Key);
(Room as EssentialsRoomBase).SourceListKey, Room.Key);
}
}
@@ -1088,7 +1086,7 @@ namespace PepperDash.Essentials.Fusion
SourceToFeedbackSigs.Add(pSrc, sigD.InputSig);
// And respond to selection in Fusion
sigD.OutputSig.SetSigFalseAction(() => (Room as EssentialsHuddleSpaceRoom).RunRouteAction(routeKey));
sigD.OutputSig.SetSigFalseAction(() => (Room as IRunRouteAction).RunRouteAction(routeKey));
}
catch (Exception)
{
@@ -1125,7 +1123,7 @@ namespace PepperDash.Essentials.Fusion
//uint attrNum = Convert.ToUInt32(keyNum);
// Check for UI devices
var uiDev = dev as EssentialsTouchpanelController;
var uiDev = dev as IHasBasicTriListWithSmartObject;
if (uiDev != null)
{
if (uiDev.Panel is Crestron.SimplSharpPro.UI.XpanelForSmartGraphics)
@@ -1206,7 +1204,7 @@ namespace PepperDash.Essentials.Fusion
display.UsageTracker.DeviceUsageEnded += new EventHandler<DeviceUsageEventArgs>(UsageTracker_DeviceUsageEnded);
}
var defaultDisplay = (Room as EssentialsHuddleSpaceRoom).DefaultDisplay as DisplayBase;
var defaultDisplay = (Room as IHasDefaultDisplay).DefaultDisplay as DisplayBase;
if (defaultDisplay == null)
{
Debug.Console(1, this, "Cannot link null display to Fusion because default display is null");
@@ -1271,7 +1269,7 @@ namespace PepperDash.Essentials.Fusion
string displayName = string.Format("Display {0} - ", displayIndex);
if (display == (Room as EssentialsHuddleSpaceRoom).DefaultDisplay)
if (display == (Room as IHasDefaultDisplay).DefaultDisplay)
{
// Display volume
var defaultDisplayVolume = FusionRoom.CreateOffsetUshortSig(50, "Volume - Fader01", eSigIoMask.InputOutputSig);
@@ -1290,7 +1288,7 @@ namespace PepperDash.Essentials.Fusion
// Current Source
var defaultDisplaySourceNone = FusionRoom.CreateOffsetBoolSig((uint)joinOffset + 8, displayName + "Source None", eSigIoMask.InputOutputSig);
defaultDisplaySourceNone.OutputSig.UserObject = new Action<bool>(b => { if (!b) (Room as EssentialsHuddleSpaceRoom).RunRouteAction("roomOff"); }); ;
defaultDisplaySourceNone.OutputSig.UserObject = new Action<bool>(b => { if (!b) (Room as IRunRouteAction).RunRouteAction("roomOff"); }); ;
}
}
@@ -1389,7 +1387,7 @@ namespace PepperDash.Essentials.Fusion
/// <summary>
/// Event handler for when room source changes
/// </summary>
protected void Room_CurrentSourceInfoChange(EssentialsRoomBase room, SourceListItem info, ChangeType type)
protected void Room_CurrentSourceInfoChange(SourceListItem info, ChangeType type)
{
// Handle null. Nothing to do when switching from or to null
if (info == null || info.SourceDevice == null)
@@ -1405,7 +1403,7 @@ namespace PepperDash.Essentials.Fusion
{
if (SourceToFeedbackSigs.ContainsKey(dev))
SourceToFeedbackSigs[dev].BoolValue = true;
var name = (room == null ? "" : room.Name);
//var name = (room == null ? "" : room.Name);
CurrentRoomSourceNameSig.InputSig.StringValue = info.SourceDevice.Name;
}
}

View File

@@ -10,9 +10,8 @@ using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Devices;
using PepperDash.Essentials.Room.Behaviours;
namespace PepperDash.Essentials.Fusion
namespace PepperDash.Essentials.Core.Fusion
{
/// <summary>
/// Handles mapping Fusion Custom Property values to system properties

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Fusion
namespace PepperDash.Essentials.Core.Fusion
{
public class ScheduleChangeEventArgs : EventArgs
{

View File

@@ -4,9 +4,8 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Fusion
namespace PepperDash.Essentials.Core.Fusion
{
/// <summary>
/// When created, runs progcomments on every slot and stores the program names in a list

View File

@@ -7,7 +7,7 @@ using Crestron.SimplSharpPro.Fusion;
using PepperDash.Core;
namespace PepperDash.Essentials.Fusion
namespace PepperDash.Essentials.Core.Fusion
{
// Helper Classes for GUIDs

View File

@@ -1,377 +0,0 @@
//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.Fusion;
//using PepperDash.Essentials.Core;
//using PepperDash.Core;
//namespace PepperDash.Essentials.Core.Fusion
//{
// public class EssentialsHuddleSpaceFusionSystemController : Device
// {
// FusionRoom FusionRoom;
// Room Room;
// Dictionary<IPresentationSource, BoolInputSig> SourceToFeedbackSigs = new Dictionary<IPresentationSource, BoolInputSig>();
// StatusMonitorCollection ErrorMessageRollUp;
// public EssentialsHuddleSpaceFusionSystemController(HuddleSpaceRoom room, uint ipId)
// : base(room.Key + "-fusion")
// {
// Room = room;
// FusionRoom = new FusionRoom(ipId, Global.ControlSystem, room.Name, "awesomeGuid-" + room.Key);
// FusionRoom.Register();
// FusionRoom.FusionStateChange += new FusionStateEventHandler(FusionRoom_FusionStateChange);
// // Room to fusion room
// room.RoomIsOn.LinkInputSig(FusionRoom.SystemPowerOn.InputSig);
// var srcName = FusionRoom.CreateOffsetStringSig(50, "Source - Name", eSigIoMask.InputSigOnly);
// room.CurrentSourceName.LinkInputSig(srcName.InputSig);
// FusionRoom.SystemPowerOn.OutputSig.UserObject = new Action<bool>(b => { if (b) room.RoomOn(null); });
// FusionRoom.SystemPowerOff.OutputSig.UserObject = new Action<bool>(b => { if (b) room.RoomOff(); });
// // NO!! room.RoomIsOn.LinkComplementInputSig(FusionRoom.SystemPowerOff.InputSig);
// FusionRoom.ErrorMessage.InputSig.StringValue = "3: 7 Errors: This is a really long error message;This is a really long error message;This is a really long error message;This is a really long error message;This is a really long error message;This is a really long error message;This is a really long error message;";
// // Sources
// foreach (var src in room.Sources)
// {
// var srcNum = src.Key;
// var pSrc = src.Value as IPresentationSource;
// var keyNum = ExtractNumberFromKey(pSrc.Key);
// if (keyNum == -1)
// {
// Debug.Console(1, this, "WARNING: Cannot link source '{0}' to numbered Fusion attributes", pSrc.Key);
// continue;
// }
// string attrName = null;
// uint attrNum = Convert.ToUInt32(keyNum);
// switch (pSrc.Type)
// {
// case PresentationSourceType.None:
// break;
// case PresentationSourceType.SetTopBox:
// attrName = "Source - TV " + keyNum;
// attrNum += 115; // TV starts at 116
// break;
// case PresentationSourceType.Dvd:
// attrName = "Source - DVD " + keyNum;
// attrNum += 120; // DVD starts at 121
// break;
// case PresentationSourceType.PC:
// attrName = "Source - PC " + keyNum;
// attrNum += 110; // PC starts at 111
// break;
// case PresentationSourceType.Laptop:
// attrName = "Source - Laptop " + keyNum;
// attrNum += 100; // Laptops start at 101
// break;
// case PresentationSourceType.VCR:
// attrName = "Source - VCR " + keyNum;
// attrNum += 125; // VCRs start at 126
// break;
// }
// if (attrName == null)
// {
// Debug.Console(1, this, "Source type {0} does not have corresponsing Fusion attribute type, skipping", pSrc.Type);
// continue;
// }
// Debug.Console(2, this, "Creating attribute '{0}' with join {1} for source {2}", attrName, attrNum, pSrc.Key);
// var sigD = FusionRoom.CreateOffsetBoolSig(attrNum, attrName, eSigIoMask.InputOutputSig);
// // Need feedback when this source is selected
// // Event handler, added below, will compare source changes with this sig dict
// SourceToFeedbackSigs.Add(pSrc, sigD.InputSig);
// // And respond to selection in Fusion
// sigD.OutputSig.UserObject = new Action<bool>(b => { if(b) room.SelectSource(pSrc); });
// }
// // Attach to all room's devices with monitors.
// //foreach (var dev in DeviceManager.Devices)
// foreach (var dev in DeviceManager.GetDevices())
// {
// if (!(dev is ICommunicationMonitor))
// continue;
// var keyNum = ExtractNumberFromKey(dev.Key);
// if (keyNum == -1)
// {
// Debug.Console(1, this, "WARNING: Cannot link device '{0}' to numbered Fusion monitoring attributes", dev.Key);
// continue;
// }
// string attrName = null;
// uint attrNum = Convert.ToUInt32(keyNum);
// //if (dev is SmartGraphicsTouchpanelControllerBase)
// //{
// // if (attrNum > 10)
// // continue;
// // attrName = "Device Ok - Touch Panel " + attrNum;
// // attrNum += 200;
// //}
// //// add xpanel here
// //else
// if (dev is DisplayBase)
// {
// if (attrNum > 10)
// continue;
// attrName = "Device Ok - Display " + attrNum;
// attrNum += 240;
// }
// //else if (dev is DvdDeviceBase)
// //{
// // if (attrNum > 5)
// // continue;
// // attrName = "Device Ok - DVD " + attrNum;
// // attrNum += 260;
// //}
// // add set top box
// // add Cresnet roll-up
// // add DM-devices roll-up
// if (attrName != null)
// {
// // Link comm status to sig and update
// var sigD = FusionRoom.CreateOffsetBoolSig(attrNum, attrName, eSigIoMask.InputSigOnly);
// var smd = dev as ICommunicationMonitor;
// sigD.InputSig.BoolValue = smd.CommunicationMonitor.Status == MonitorStatus.IsOk;
// smd.CommunicationMonitor.StatusChange += (o, a) => { sigD.InputSig.BoolValue = a.Status == MonitorStatus.IsOk; };
// Debug.Console(0, this, "Linking '{0}' communication monitor to Fusion '{1}'", dev.Key, attrName);
// }
// }
// // Don't think we need to get current status of this as nothing should be alive yet.
// room.PresentationSourceChange += Room_PresentationSourceChange;
// // these get used in multiple places
// var display = room.Display;
// var dispPowerOnAction = new Action<bool>(b => { if (!b) display.PowerOn(); });
// var dispPowerOffAction = new Action<bool>(b => { if (!b) display.PowerOff(); });
// // Display to fusion room sigs
// FusionRoom.DisplayPowerOn.OutputSig.UserObject = dispPowerOnAction;
// FusionRoom.DisplayPowerOff.OutputSig.UserObject = dispPowerOffAction;
// display.PowerIsOnFeedback.LinkInputSig(FusionRoom.DisplayPowerOn.InputSig);
// if (display is IDisplayUsage)
// (display as IDisplayUsage).LampHours.LinkInputSig(FusionRoom.DisplayUsage.InputSig);
// // Roll up ALL device errors
// ErrorMessageRollUp = new StatusMonitorCollection(this);
// foreach (var dev in DeviceManager.GetDevices())
// {
// var md = dev as ICommunicationMonitor;
// if (md != null)
// {
// ErrorMessageRollUp.AddMonitor(md.CommunicationMonitor);
// Debug.Console(2, this, "Adding '{0}' to room's overall error monitor", md.CommunicationMonitor.Parent.Key);
// }
// }
// ErrorMessageRollUp.Start();
// FusionRoom.ErrorMessage.InputSig.StringValue = ErrorMessageRollUp.Message;
// ErrorMessageRollUp.StatusChange += (o, a) => {
// FusionRoom.ErrorMessage.InputSig.StringValue = ErrorMessageRollUp.Message; };
// // static assets --------------- testing
// // test assets --- THESE ARE BOTH WIRED TO AssetUsage somewhere internally.
// var ta1 = FusionRoom.CreateStaticAsset(1, "Test asset 1", "Awesome Asset", "Awesome123");
// ta1.AssetError.InputSig.StringValue = "This should be error";
// var ta2 = FusionRoom.CreateStaticAsset(2, "Test asset 2", "Awesome Asset", "Awesome1232");
// ta2.AssetUsage.InputSig.StringValue = "This should be usage";
// // Make a display asset
// var dispAsset = FusionRoom.CreateStaticAsset(3, display.Name, "Display", "awesomeDisplayId" + room.Key);
// dispAsset.PowerOn.OutputSig.UserObject = dispPowerOnAction;
// dispAsset.PowerOff.OutputSig.UserObject = dispPowerOffAction;
// display.PowerIsOnFeedback.LinkInputSig(dispAsset.PowerOn.InputSig);
// // NO!! display.PowerIsOn.LinkComplementInputSig(dispAsset.PowerOff.InputSig);
// // Use extension methods
// dispAsset.TrySetMakeModel(display);
// dispAsset.TryLinkAssetErrorToCommunication(display);
// // Make it so!
// FusionRVI.GenerateFileForAllFusionDevices();
// }
// /// <summary>
// /// Helper to get the number from the end of a device's key string
// /// </summary>
// /// <returns>-1 if no number matched</returns>
// int ExtractNumberFromKey(string key)
// {
// var capture = System.Text.RegularExpressions.Regex.Match(key, @"\D+(\d+)");
// if (!capture.Success)
// return -1;
// else return Convert.ToInt32(capture.Groups[1].Value);
// }
// void Room_PresentationSourceChange(object sender, EssentialsRoomSourceChangeEventArgs e)
// {
// if (e.OldSource != null)
// {
// if (SourceToFeedbackSigs.ContainsKey(e.OldSource))
// SourceToFeedbackSigs[e.OldSource].BoolValue = false;
// }
// if (e.NewSource != null)
// {
// if (SourceToFeedbackSigs.ContainsKey(e.NewSource))
// SourceToFeedbackSigs[e.NewSource].BoolValue = true;
// }
// }
// void FusionRoom_FusionStateChange(FusionBase device, FusionStateEventArgs args)
// {
// // The sig/UO method: Need separate handlers for fixed and user sigs, all flavors,
// // even though they all contain sigs.
// var sigData = (args.UserConfiguredSigDetail as BooleanSigDataFixedName);
// if (sigData != null)
// {
// var outSig = sigData.OutputSig;
// if (outSig.UserObject is Action<bool>)
// (outSig.UserObject as Action<bool>).Invoke(outSig.BoolValue);
// else if (outSig.UserObject is Action<ushort>)
// (outSig.UserObject as Action<ushort>).Invoke(outSig.UShortValue);
// else if (outSig.UserObject is Action<string>)
// (outSig.UserObject as Action<string>).Invoke(outSig.StringValue);
// return;
// }
// var attrData = (args.UserConfiguredSigDetail as BooleanSigData);
// if (attrData != null)
// {
// var outSig = attrData.OutputSig;
// if (outSig.UserObject is Action<bool>)
// (outSig.UserObject as Action<bool>).Invoke(outSig.BoolValue);
// else if (outSig.UserObject is Action<ushort>)
// (outSig.UserObject as Action<ushort>).Invoke(outSig.UShortValue);
// else if (outSig.UserObject is Action<string>)
// (outSig.UserObject as Action<string>).Invoke(outSig.StringValue);
// return;
// }
// }
// }
// public static class FusionRoomExtensions
// {
// /// <summary>
// /// Creates and returns a fusion attribute. The join number will match the established Simpl
// /// standard of 50+, and will generate a 50+ join in the RVI. It calls
// /// FusionRoom.AddSig with join number - 49
// /// </summary>
// /// <returns>The new attribute</returns>
// public static BooleanSigData CreateOffsetBoolSig(this FusionRoom fr, uint number, string name, eSigIoMask mask)
// {
// if (number < 50) throw new ArgumentOutOfRangeException("number", "Cannot be less than 50");
// number -= 49;
// fr.AddSig(eSigType.Bool, number, name, mask);
// return fr.UserDefinedBooleanSigDetails[number];
// }
// /// <summary>
// /// Creates and returns a fusion attribute. The join number will match the established Simpl
// /// standard of 50+, and will generate a 50+ join in the RVI. It calls
// /// FusionRoom.AddSig with join number - 49
// /// </summary>
// /// <returns>The new attribute</returns>
// public static UShortSigData CreateOffsetUshortSig(this FusionRoom fr, uint number, string name, eSigIoMask mask)
// {
// if (number < 50) throw new ArgumentOutOfRangeException("number", "Cannot be less than 50");
// number -= 49;
// fr.AddSig(eSigType.UShort, number, name, mask);
// return fr.UserDefinedUShortSigDetails[number];
// }
// /// <summary>
// /// Creates and returns a fusion attribute. The join number will match the established Simpl
// /// standard of 50+, and will generate a 50+ join in the RVI. It calls
// /// FusionRoom.AddSig with join number - 49
// /// </summary>
// /// <returns>The new attribute</returns>
// public static StringSigData CreateOffsetStringSig(this FusionRoom fr, uint number, string name, eSigIoMask mask)
// {
// if (number < 50) throw new ArgumentOutOfRangeException("number", "Cannot be less than 50");
// number -= 49;
// fr.AddSig(eSigType.String, number, name, mask);
// return fr.UserDefinedStringSigDetails[number];
// }
// /// <summary>
// /// Creates and returns a static asset
// /// </summary>
// /// <returns>the new asset</returns>
// public static FusionStaticAsset CreateStaticAsset(this FusionRoom fr, uint number, string name, string type, string instanceId)
// {
// fr.AddAsset(eAssetType.StaticAsset, number, name, type, instanceId);
// return fr.UserConfigurableAssetDetails[number].Asset as FusionStaticAsset;
// }
// }
// //************************************************************************************************
// /// <summary>
// /// Extensions to enhance Fusion room, asset and signal creation.
// /// </summary>
// public static class FusionStaticAssetExtensions
// {
// /// <summary>
// /// Tries to set a Fusion asset with the make and model of a device.
// /// If the provided Device is IMakeModel, will set the corresponding parameters on the fusion static asset.
// /// Otherwise, does nothing.
// /// </summary>
// public static void TrySetMakeModel(this FusionStaticAsset asset, Device device)
// {
// var mm = device as IMakeModel;
// if (mm != null)
// {
// asset.ParamMake.Value = mm.DeviceMake;
// asset.ParamModel.Value = mm.DeviceModel;
// }
// }
// /// <summary>
// /// Tries to attach the AssetError input on a Fusion asset to a Device's
// /// CommunicationMonitor.StatusChange event. Does nothing if the device is not
// /// IStatusMonitor
// /// </summary>
// /// <param name="asset"></param>
// /// <param name="device"></param>
// public static void TryLinkAssetErrorToCommunication(this FusionStaticAsset asset, Device device)
// {
// if (device is ICommunicationMonitor)
// {
// var monitor = (device as ICommunicationMonitor).CommunicationMonitor;
// monitor.StatusChange += (o, a) =>
// {
// // Link connected and error inputs on asset
// asset.Connected.InputSig.BoolValue = a.Status == MonitorStatus.IsOk;
// asset.AssetError.InputSig.StringValue = a.Status.ToString();
// };
// // set current value
// asset.Connected.InputSig.BoolValue = monitor.Status == MonitorStatus.IsOk;
// asset.AssetError.InputSig.StringValue = monitor.Status.ToString();
// }
// }
// }
//}

View File

@@ -9,7 +9,7 @@ using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.CrestronIO;
namespace PepperDash.Essentials.Devices.Common.Microphones
namespace PepperDash.Essentials.Core.Privacy
{
/// <summary>
/// Used for applications where one or more microphones with momentary contact closure outputs are used to
@@ -87,7 +87,11 @@ namespace PepperDash.Essentials.Devices.Common.Microphones
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.Devices.Common.Microphones
public void SetPrivacyDevice(IPrivacy privacyDevice)
{
PrivacyDevice = privacyDevice;
PrivacyDevice.PrivacyModeIsOnFeedback.OutputChange += PrivacyModeIsOnFeedback_OutputChange;
}
void PrivacyModeIsOnFeedback_OutputChange(object sender, EventArgs e)

View File

@@ -6,7 +6,7 @@ using Crestron.SimplSharp;
using PepperDash.Essentials.Core.CrestronIO;
namespace PepperDash.Essentials.Devices.Common.Microphones
namespace PepperDash.Essentials.Core.Privacy
{
public class MicrophonePrivacyControllerConfig
{

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" />
@@ -123,6 +128,8 @@
<Compile Include="Devices\CodecInterfaces.cs" />
<Compile Include="Devices\CrestronProcessor.cs" />
<Compile Include="Devices\DeviceApiBase.cs" />
<Compile Include="Devices\PC\InRoomPc.cs" />
<Compile Include="Devices\PC\Laptop.cs" />
<Compile Include="Devices\ReconfigurableDevice.cs" />
<Compile Include="Devices\VolumeDeviceChangeEventArgs.cs" />
<Compile Include="Factory\DeviceFactory.cs" />
@@ -132,12 +139,19 @@
<Compile Include="Feedbacks\IntFeedback.cs" />
<Compile Include="Feedbacks\SerialFeedback.cs" />
<Compile Include="Feedbacks\StringFeedback.cs" />
<Compile Include="Fusion\EssentialsHuddleSpaceFusionSystemControllerBase.cs" />
<Compile Include="Fusion\FusionCustomPropertiesBridge.cs" />
<Compile Include="Fusion\FusionEventHandlers.cs" />
<Compile Include="Fusion\FusionProcessorQueries.cs" />
<Compile Include="Fusion\FusionRviDataClasses.cs" />
<Compile Include="Global\JobTimer.cs" />
<Compile Include="Global\Scheduler.cs" />
<Compile Include="JoinMaps\JoinMapBase.cs" />
<Compile Include="Lighting\Lighting Interfaces.cs" />
<Compile Include="Lighting\LightingBase.cs" />
<Compile Include="Monitoring\SystemMonitorController.cs" />
<Compile Include="Microphone Privacy\MicrophonePrivacyController.cs" />
<Compile Include="Microphone Privacy\MicrophonePrivacyControllerConfig.cs" />
<Compile Include="Ramps and Increments\ActionIncrementer.cs" />
<Compile Include="Comm and IR\CommFactory.cs" />
<Compile Include="Comm and IR\CommunicationExtras.cs" />
@@ -173,6 +187,10 @@
<Compile Include="Feedbacks\BoolFeedbackOneShot.cs" />
<Compile Include="Ramps and Increments\NumericalHelpers.cs" />
<Compile Include="Ramps and Increments\UshortSigIncrementer.cs" />
<Compile Include="Room\Behaviours\RoomOnToDefaultSourceWhenOccupied.cs" />
<Compile Include="Room\EssentialsRoomBase.cs" />
<Compile Include="Room\Interfaces.cs" />
<Compile Include="Room\iOccupancyStatusProvider.cs" />
<Compile Include="Routing\DummyRoutingInputsDevice.cs" />
<Compile Include="Routing\ICardPortsDevice.cs" />
<Compile Include="InUseTracking\IInUseTracking.cs" />
@@ -191,7 +209,6 @@
<Compile Include="Display\DELETE IRDisplayBase.cs" />
<Compile Include="Display\MockDisplay.cs" />
<Compile Include="Ethernet\EthernetStatistics.cs" />
<Compile Include="Fusion\MOVED FusionSystemController.cs" />
<Compile Include="Global\Global.cs" />
<Compile Include="License\EssentialsLicenseManager.cs" />
<Compile Include="Feedbacks\BoolOutputLogicals.cs" />
@@ -217,6 +234,7 @@
<Compile Include="Routing\TieLine.cs" />
<Compile Include="Timers\CountdownTimer.cs" />
<Compile Include="Touchpanels\CrestronTouchpanelPropertiesConfig.cs" />
<Compile Include="Touchpanels\Interfaces.cs" />
<Compile Include="Touchpanels\Keyboards\HabaneroKeyboardController.cs" />
<Compile Include="Touchpanels\MOVED LargeTouchpanelControllerBase.cs" />
<Compile Include="Touchpanels\TriListExtensions.cs" />
@@ -238,7 +256,6 @@
<Compile Include="Feedbacks\FeedbackBase.cs" />
<Compile Include="Room\Room.cs" />
<Compile Include="Room\RoomCues.cs" />
<Compile Include="Room\MOVED RoomEventArgs.cs" />
<Compile Include="SmartObjects\SubpageReferencList\SourceListSubpageReferenceList.cs" />
<Compile Include="Touchpanels\ModalDialog.cs" />
<Compile Include="Touchpanels\SmartGraphicsTouchpanelControllerBase.cs" />

View File

@@ -1,297 +1,313 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharp.Scheduler;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Devices;
using PepperDash.Essentials.Devices.Common.Occupancy;
namespace PepperDash.Essentials
{
/// <summary>
///
/// </summary>
public abstract class EssentialsRoomBase : ReconfigurableDevice
{
/// <summary>
///
/// </summary>
public BoolFeedback OnFeedback { get; private set; }
/// <summary>
/// Fires when the RoomOccupancy object is set
/// </summary>
public event EventHandler<EventArgs> RoomOccupancyIsSet;
public BoolFeedback IsWarmingUpFeedback { get; private set; }
public BoolFeedback IsCoolingDownFeedback { get; private set; }
public IOccupancyStatusProvider RoomOccupancy { get; private set; }
public bool OccupancyStatusProviderIsRemote { get; private set; }
protected abstract Func<bool> IsWarmingFeedbackFunc { get; }
protected abstract Func<bool> IsCoolingFeedbackFunc { get; }
/// <summary>
/// Timer used for informing the UIs of a shutdown
/// </summary>
public SecondsCountdownTimer ShutdownPromptTimer { get; private set; }
/// <summary>
///
/// </summary>
public int ShutdownPromptSeconds { get; set; }
public int ShutdownVacancySeconds { get; set; }
public eShutdownType ShutdownType { get; private set; }
public PepperDash.Essentials.Room.EssentialsRoomEmergencyBase Emergency { get; set; }
public PepperDash.Essentials.Devices.Common.Microphones.MicrophonePrivacyController MicrophonePrivacy { get; set; }
public string LogoUrl { get; set; }
protected SecondsCountdownTimer RoomVacancyShutdownTimer { get; private set; }
public eVacancyMode VacancyMode { get; private set; }
/// <summary>
/// Seconds after vacancy prompt is displayed until shutdown
/// </summary>
protected int RoomVacancyShutdownSeconds;
/// <summary>
/// Seconds after vacancy detected until prompt is displayed
/// </summary>
protected int RoomVacancyShutdownPromptSeconds;
/// <summary>
///
/// </summary>
protected abstract Func<bool> OnFeedbackFunc { get; }
protected Dictionary<IBasicVolumeWithFeedback, uint> SavedVolumeLevels = new Dictionary<IBasicVolumeWithFeedback, uint>();
/// <summary>
/// When volume control devices change, should we zero the one that we are leaving?
/// </summary>
public bool ZeroVolumeWhenSwtichingVolumeDevices { get; private set; }
public EssentialsRoomBase(DeviceConfig config)
: base(config)
{
// Setup the ShutdownPromptTimer
ShutdownPromptTimer = new SecondsCountdownTimer(Key + "-offTimer");
ShutdownPromptTimer.IsRunningFeedback.OutputChange += (o, a) =>
{
if (!ShutdownPromptTimer.IsRunningFeedback.BoolValue)
ShutdownType = eShutdownType.None;
};
ShutdownPromptTimer.HasFinished += (o, a) => Shutdown(); // Shutdown is triggered
ShutdownPromptSeconds = 60;
ShutdownVacancySeconds = 120;
ShutdownType = eShutdownType.None;
RoomVacancyShutdownTimer = new SecondsCountdownTimer(Key + "-vacancyOffTimer");
//RoomVacancyShutdownTimer.IsRunningFeedback.OutputChange += (o, a) =>
//{
// if (!RoomVacancyShutdownTimer.IsRunningFeedback.BoolValue)
// ShutdownType = ShutdownType.Vacancy;
//};
RoomVacancyShutdownTimer.HasFinished += new EventHandler<EventArgs>(RoomVacancyShutdownPromptTimer_HasFinished); // Shutdown is triggered
RoomVacancyShutdownPromptSeconds = 1500; // 25 min to prompt warning
RoomVacancyShutdownSeconds = 240; // 4 min after prompt will trigger shutdown prompt
VacancyMode = eVacancyMode.None;
OnFeedback = new BoolFeedback(OnFeedbackFunc);
IsWarmingUpFeedback = new BoolFeedback(IsWarmingFeedbackFunc);
IsCoolingDownFeedback = new BoolFeedback(IsCoolingFeedbackFunc);
AddPostActivationAction(() =>
{
if (RoomOccupancy != null)
OnRoomOccupancyIsSet();
});
}
void RoomVacancyShutdownPromptTimer_HasFinished(object sender, EventArgs e)
{
switch (VacancyMode)
{
case eVacancyMode.None:
StartRoomVacancyTimer(eVacancyMode.InInitialVacancy);
break;
case eVacancyMode.InInitialVacancy:
StartRoomVacancyTimer(eVacancyMode.InShutdownWarning);
break;
case eVacancyMode.InShutdownWarning:
{
StartShutdown(eShutdownType.Vacancy);
Debug.Console(0, this, "Shutting Down due to vacancy.");
break;
}
default:
break;
}
}
/// <summary>
///
/// </summary>
/// <param name="type"></param>
public void StartShutdown(eShutdownType type)
{
// Check for shutdowns running. Manual should override other shutdowns
if (type == eShutdownType.Manual)
ShutdownPromptTimer.SecondsToCount = ShutdownPromptSeconds;
else if (type == eShutdownType.Vacancy)
ShutdownPromptTimer.SecondsToCount = ShutdownVacancySeconds;
ShutdownType = type;
ShutdownPromptTimer.Start();
Debug.Console(0, this, "ShutdwonPromptTimer Started. Type: {0}. Seconds: {1}", ShutdownType, ShutdownPromptTimer.SecondsToCount);
}
public void StartRoomVacancyTimer(eVacancyMode mode)
{
if (mode == eVacancyMode.None)
RoomVacancyShutdownTimer.SecondsToCount = RoomVacancyShutdownPromptSeconds;
else if (mode == eVacancyMode.InInitialVacancy)
RoomVacancyShutdownTimer.SecondsToCount = RoomVacancyShutdownSeconds;
VacancyMode = mode;
RoomVacancyShutdownTimer.Start();
Debug.Console(0, this, "Vacancy Timer Started. Mode: {0}. Seconds: {1}", VacancyMode, RoomVacancyShutdownTimer.SecondsToCount);
}
/// <summary>
/// Resets the vacancy mode and shutsdwon the room
/// </summary>
public void Shutdown()
{
VacancyMode = eVacancyMode.None;
EndShutdown();
}
/// <summary>
/// This method is for the derived class to define it's specific shutdown
/// requirements but should not be called directly. It is called by Shutdown()
/// </summary>
protected abstract void EndShutdown();
/// <summary>
/// Override this to implement a default volume level(s) method
/// </summary>
public abstract void SetDefaultLevels();
/// <summary>
/// Sets the object to be used as the IOccupancyStatusProvider for the room. Can be an Occupancy Aggregator or a specific device
/// </summary>
/// <param name="statusProvider"></param>
public void SetRoomOccupancy(IOccupancyStatusProvider statusProvider, int timeoutMinutes)
{
if (statusProvider == null)
{
Debug.Console(0, this, "ERROR: Occupancy sensor device is null");
return;
}
// If status provider is fusion, set flag to remote
if (statusProvider is PepperDash.Essentials.Fusion.EssentialsHuddleSpaceFusionSystemControllerBase)
OccupancyStatusProviderIsRemote = true;
if(timeoutMinutes > 0)
RoomVacancyShutdownSeconds = timeoutMinutes * 60;
Debug.Console(1, this, "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);
}
void OnRoomOccupancyIsSet()
{
var handler = RoomOccupancyIsSet;
if (handler != null)
handler(this, new EventArgs());
}
/// <summary>
/// To allow base class to power room on to last source
/// </summary>
public abstract void PowerOnToDefaultOrLastSource();
/// <summary>
/// To allow base class to power room on to default source
/// </summary>
/// <returns></returns>
public abstract bool RunDefaultPresentRoute();
void RoomIsOccupiedFeedback_OutputChange(object sender, EventArgs e)
{
if (RoomOccupancy.RoomIsOccupiedFeedback.BoolValue == false)
{
Debug.Console(1, this, "Notice: Vacancy Detected");
// Trigger the timer when the room is vacant
StartRoomVacancyTimer(eVacancyMode.InInitialVacancy);
}
else
{
Debug.Console(1, this, "Notice: Occupancy Detected");
// Reset the timer when the room is occupied
RoomVacancyShutdownTimer.Cancel();
}
}
/// <summary>
/// Executes when RoomVacancyShutdownTimer expires. Used to trigger specific room actions as needed. Must nullify the timer object when executed
/// </summary>
/// <param name="o"></param>
public abstract void RoomVacatedForTimeoutPeriod(object o);
}
/// <summary>
/// To describe the various ways a room may be shutting down
/// </summary>
public enum eShutdownType
{
None = 0,
External,
Manual,
Vacancy
}
public enum eVacancyMode
{
None = 0,
InInitialVacancy,
InShutdownWarning
}
/// <summary>
///
/// </summary>
public enum eWarmingCoolingMode
{
None,
Warming,
Cooling
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharp.Scheduler;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Devices;
namespace PepperDash.Essentials.Core
{
/// <summary>
///
/// </summary>
public abstract class EssentialsRoomBase : ReconfigurableDevice
{
/// <summary>
///
/// </summary>
public BoolFeedback OnFeedback { get; private set; }
/// <summary>
/// Fires when the RoomOccupancy object is set
/// </summary>
public event EventHandler<EventArgs> RoomOccupancyIsSet;
public BoolFeedback IsWarmingUpFeedback { get; private set; }
public BoolFeedback IsCoolingDownFeedback { get; private set; }
public IOccupancyStatusProvider RoomOccupancy { get; private set; }
public bool OccupancyStatusProviderIsRemote { get; private set; }
protected abstract Func<bool> IsWarmingFeedbackFunc { get; }
protected abstract Func<bool> IsCoolingFeedbackFunc { get; }
/// <summary>
/// The config name of the source list
/// </summary>
public string SourceListKey { get; set; }
/// <summary>
/// Timer used for informing the UIs of a shutdown
/// </summary>
public SecondsCountdownTimer ShutdownPromptTimer { get; private set; }
/// <summary>
///
/// </summary>
public int ShutdownPromptSeconds { get; set; }
public int ShutdownVacancySeconds { get; set; }
public eShutdownType ShutdownType { get; private set; }
public EssentialsRoomEmergencyBase Emergency { get; set; }
public Core.Privacy.MicrophonePrivacyController MicrophonePrivacy { get; set; }
public string LogoUrl { get; set; }
protected SecondsCountdownTimer RoomVacancyShutdownTimer { get; private set; }
public eVacancyMode VacancyMode { get; private set; }
/// <summary>
/// Seconds after vacancy prompt is displayed until shutdown
/// </summary>
protected int RoomVacancyShutdownSeconds;
/// <summary>
/// Seconds after vacancy detected until prompt is displayed
/// </summary>
protected int RoomVacancyShutdownPromptSeconds;
/// <summary>
///
/// </summary>
protected abstract Func<bool> OnFeedbackFunc { get; }
protected Dictionary<IBasicVolumeWithFeedback, uint> SavedVolumeLevels = new Dictionary<IBasicVolumeWithFeedback, uint>();
/// <summary>
/// When volume control devices change, should we zero the one that we are leaving?
/// </summary>
public bool ZeroVolumeWhenSwtichingVolumeDevices { get; private set; }
public EssentialsRoomBase(DeviceConfig config)
: base(config)
{
// Setup the ShutdownPromptTimer
ShutdownPromptTimer = new SecondsCountdownTimer(Key + "-offTimer");
ShutdownPromptTimer.IsRunningFeedback.OutputChange += (o, a) =>
{
if (!ShutdownPromptTimer.IsRunningFeedback.BoolValue)
ShutdownType = eShutdownType.None;
};
ShutdownPromptTimer.HasFinished += (o, a) => Shutdown(); // Shutdown is triggered
ShutdownPromptSeconds = 60;
ShutdownVacancySeconds = 120;
ShutdownType = eShutdownType.None;
RoomVacancyShutdownTimer = new SecondsCountdownTimer(Key + "-vacancyOffTimer");
//RoomVacancyShutdownTimer.IsRunningFeedback.OutputChange += (o, a) =>
//{
// if (!RoomVacancyShutdownTimer.IsRunningFeedback.BoolValue)
// ShutdownType = ShutdownType.Vacancy;
//};
RoomVacancyShutdownTimer.HasFinished += new EventHandler<EventArgs>(RoomVacancyShutdownPromptTimer_HasFinished); // Shutdown is triggered
RoomVacancyShutdownPromptSeconds = 1500; // 25 min to prompt warning
RoomVacancyShutdownSeconds = 240; // 4 min after prompt will trigger shutdown prompt
VacancyMode = eVacancyMode.None;
OnFeedback = new BoolFeedback(OnFeedbackFunc);
IsWarmingUpFeedback = new BoolFeedback(IsWarmingFeedbackFunc);
IsCoolingDownFeedback = new BoolFeedback(IsCoolingFeedbackFunc);
AddPostActivationAction(() =>
{
if (RoomOccupancy != null)
OnRoomOccupancyIsSet();
});
}
void RoomVacancyShutdownPromptTimer_HasFinished(object sender, EventArgs e)
{
switch (VacancyMode)
{
case eVacancyMode.None:
StartRoomVacancyTimer(eVacancyMode.InInitialVacancy);
break;
case eVacancyMode.InInitialVacancy:
StartRoomVacancyTimer(eVacancyMode.InShutdownWarning);
break;
case eVacancyMode.InShutdownWarning:
{
StartShutdown(eShutdownType.Vacancy);
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Shutting Down due to vacancy.");
break;
}
default:
break;
}
}
/// <summary>
///
/// </summary>
/// <param name="type"></param>
public void StartShutdown(eShutdownType type)
{
// Check for shutdowns running. Manual should override other shutdowns
if (type == eShutdownType.Manual)
ShutdownPromptTimer.SecondsToCount = ShutdownPromptSeconds;
else if (type == eShutdownType.Vacancy)
ShutdownPromptTimer.SecondsToCount = ShutdownVacancySeconds;
ShutdownType = type;
ShutdownPromptTimer.Start();
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "ShutdownPromptTimer Started. Type: {0}. Seconds: {1}", ShutdownType, ShutdownPromptTimer.SecondsToCount);
}
public void StartRoomVacancyTimer(eVacancyMode mode)
{
if (mode == eVacancyMode.None)
RoomVacancyShutdownTimer.SecondsToCount = RoomVacancyShutdownPromptSeconds;
else if (mode == eVacancyMode.InInitialVacancy)
RoomVacancyShutdownTimer.SecondsToCount = RoomVacancyShutdownSeconds;
VacancyMode = mode;
RoomVacancyShutdownTimer.Start();
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Vacancy Timer Started. Mode: {0}. Seconds: {1}", VacancyMode, RoomVacancyShutdownTimer.SecondsToCount);
}
/// <summary>
/// Resets the vacancy mode and shutsdwon the room
/// </summary>
public void Shutdown()
{
VacancyMode = eVacancyMode.None;
EndShutdown();
}
/// <summary>
/// This method is for the derived class to define it's specific shutdown
/// requirements but should not be called directly. It is called by Shutdown()
/// </summary>
protected abstract void EndShutdown();
/// <summary>
/// Override this to implement a default volume level(s) method
/// </summary>
public abstract void SetDefaultLevels();
/// <summary>
/// Sets the object to be used as the IOccupancyStatusProvider for the room. Can be an Occupancy Aggregator or a specific device
/// </summary>
/// <param name="statusProvider"></param>
public void SetRoomOccupancy(IOccupancyStatusProvider statusProvider, int timeoutMinutes)
{
if (statusProvider == null)
{
Debug.Console(0, this, "ERROR: Occupancy sensor device is null");
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;
if(timeoutMinutes > 0)
RoomVacancyShutdownSeconds = timeoutMinutes * 60;
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "RoomVacancyShutdownSeconds set to {0}", RoomVacancyShutdownSeconds);
RoomOccupancy = statusProvider;
RoomOccupancy.RoomIsOccupiedFeedback.OutputChange -= RoomIsOccupiedFeedback_OutputChange;
RoomOccupancy.RoomIsOccupiedFeedback.OutputChange += RoomIsOccupiedFeedback_OutputChange;
OnRoomOccupancyIsSet();
}
void OnRoomOccupancyIsSet()
{
var handler = RoomOccupancyIsSet;
if (handler != null)
handler(this, new EventArgs());
}
/// <summary>
/// To allow base class to power room on to last source
/// </summary>
public abstract void PowerOnToDefaultOrLastSource();
/// <summary>
/// To allow base class to power room on to default source
/// </summary>
/// <returns></returns>
public abstract bool RunDefaultPresentRoute();
void RoomIsOccupiedFeedback_OutputChange(object sender, EventArgs e)
{
if (RoomOccupancy.RoomIsOccupiedFeedback.BoolValue == false)
{
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, Debug.ErrorLogLevel.Notice, "Notice: Occupancy Detected");
// Reset the timer when the room is occupied
RoomVacancyShutdownTimer.Cancel();
}
}
/// <summary>
/// Executes when RoomVacancyShutdownTimer expires. Used to trigger specific room actions as needed. Must nullify the timer object when executed
/// </summary>
/// <param name="o"></param>
public abstract void RoomVacatedForTimeoutPeriod(object o);
}
/// <summary>
/// To describe the various ways a room may be shutting down
/// </summary>
public enum eShutdownType
{
None = 0,
External,
Manual,
Vacancy
}
public enum eVacancyMode
{
None = 0,
InInitialVacancy,
InShutdownWarning
}
/// <summary>
///
/// </summary>
public enum eWarmingCoolingMode
{
None,
Warming,
Cooling
}
public abstract class EssentialsRoomEmergencyBase : IKeyed
{
public string Key { get; private set; }
public EssentialsRoomEmergencyBase(string key)
{
Key = key;
}
}
}

View File

@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// For rooms with in call feedback
/// </summary>
public interface IHasInCallFeedback
{
BoolFeedback InCallFeedback { get; }
}
/// <summary>
/// For rooms with a single display
/// </summary>
public interface IHasDefaultDisplay
{
IRoutingSinkWithSwitching DefaultDisplay { get; }
}
/// <summary>
/// For rooms with multiple displays
/// </summary>
public interface IHasMultipleDisplays
{
Dictionary<eSourceListItemDestinationTypes, IRoutingSinkWithSwitching> Displays { get; }
}
/// <summary>
/// For rooms with routing
/// </summary>
public interface IRunRouteAction
{
void RunRouteAction(string routeKey);
void RunRouteAction(string routeKey, Action successCallback);
}
/// <summary>
/// For rooms that default presentation only routing
/// </summary>
public interface IRunDefaultPresentRoute
{
bool RunDefaultPresentRoute();
}
/// <summary>
/// For rooms that have default presentation and calling routes
/// </summary>
public interface IRunDefaultCallRoute : IRunDefaultPresentRoute
{
bool RunDefaultCallRoute();
}
}

View File

@@ -1,41 +0,0 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Crestron.SimplSharp;
//namespace PepperDash.Essentials.Core
//{
// public class EssentialsRoomSourceChangeEventArgs : EventArgs
// {
// public EssentialsRoom Room { get; private set; }
// public IPresentationSource OldSource { get; private set; }
// public IPresentationSource NewSource { get; private set; }
// public EssentialsRoomSourceChangeEventArgs(EssentialsRoom room,
// IPresentationSource oldSource, IPresentationSource newSource)
// {
// Room = room;
// OldSource = oldSource;
// NewSource = newSource;
// }
// }
// public class EssentialsRoomAudioDeviceChangeEventArgs : EventArgs
// {
// public EssentialsRoom Room { get; private set; }
// public IBasicVolumeControls OldDevice { get; private set; }
// public IBasicVolumeControls NewDevice { get; private set; }
// public EssentialsRoomAudioDeviceChangeEventArgs(EssentialsRoom room,
// IBasicVolumeControls oldDevice, IBasicVolumeControls newDevice)
// {
// Room = room;
// OldDevice = oldDevice;
// NewDevice = newDevice;
// }
// }
//}

View File

@@ -6,7 +6,7 @@ using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Devices.Common.Occupancy
namespace PepperDash.Essentials.Core
{
public interface IOccupancyStatusProvider
{

View File

@@ -11,9 +11,25 @@ using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// The handler type for a Room's SourceInfoChange
/// </summary>
public delegate void SourceInfoChangeHandler(/*EssentialsRoomBase room,*/ SourceListItem info, ChangeType type);
//*******************************************************************************************
// Interfaces
/// <summary>
/// For rooms with a single presentation source, change event
/// </summary>
public interface IHasCurrentSourceInfoChange
{
string CurrentSourceInfoKey { get; set; }
SourceListItem CurrentSourceInfo { get; set; }
event SourceInfoChangeHandler CurrentSourceChange;
}
/// <summary>
/// Defines a class that has a collection of RoutingInputPorts
@@ -35,7 +51,7 @@ namespace PepperDash.Essentials.Core
/// <summary>
/// For fixed-source endpoint devices
/// </summary>
public interface IRoutingSinkNoSwitching : IRoutingInputs
public interface IRoutingSinkNoSwitching : IRoutingInputs, IHasCurrentSourceInfoChange
{
}
@@ -43,7 +59,7 @@ namespace PepperDash.Essentials.Core
/// <summary>
/// Endpoint device like a display, that selects inputs
/// </summary>
public interface IRoutingSinkWithSwitching : IRoutingSinkNoSwitching
public interface IRoutingSinkWithSwitching : IRoutingSinkNoSwitching, IHasCurrentSourceInfoChange
{
//void ClearRoute();
void ExecuteSwitch(object inputSelector);

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

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
namespace PepperDash.Essentials.Core
{
public interface IHasBasicTriListWithSmartObject
{
BasicTriListWithSmartObject Panel { get; }
}
}

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

@@ -32,6 +32,9 @@ namespace PepperDash.Essentials.DM.Config
[JsonProperty("outputNames")]
public Dictionary<uint, string> OutputNames { get; set; }
[JsonProperty("noRouteText")]
public string NoRouteText { get; set; }
[JsonProperty("inputSlotSupportsHdcp2")]
public Dictionary<uint, bool> InputSlotSupportsHdcp2 { get; set; }

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

@@ -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

@@ -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,12 +95,14 @@
<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="IDmSwitch.cs" />
<Compile Include="Config\DmpsRoutingConfig.cs" />
<Compile Include="Config\DmRmcConfig.cs" />
<Compile Include="Config\DmTxConfig.cs" />

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

@@ -15,6 +15,32 @@ namespace PepperDash.Essentials.Devices.Common
/// </summary>
public class GenericAudioOut : Device, IRoutingSinkNoSwitching
{
public event SourceInfoChangeHandler CurrentSourceChange;
public string CurrentSourceInfoKey { get; set; }
public SourceListItem CurrentSourceInfo
{
get
{
return _CurrentSourceInfo;
}
set
{
if (value == _CurrentSourceInfo) return;
var handler = CurrentSourceChange;
if (handler != null)
handler(_CurrentSourceInfo, ChangeType.WillChange);
_CurrentSourceInfo = value;
if (handler != null)
handler(_CurrentSourceInfo, ChangeType.DidChange);
}
}
SourceListItem _CurrentSourceInfo;
public RoutingInputPort AnyAudioIn { get; private set; }
public GenericAudioOut(string key, string name)

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

@@ -150,13 +150,8 @@
<Compile Include="Environment\Somfy\RelayControlledShade.cs" />
<Compile Include="Factory\DeviceFactory.cs" />
<Compile Include="Generic\GenericSource.cs" />
<Compile Include="Microphone\MicrophonePrivacyController.cs" />
<Compile Include="Microphone\MicrophonePrivacyControllerConfig.cs" />
<Compile Include="Occupancy\GlsOccupancySensorBaseController.cs" />
<Compile Include="Occupancy\IOccupancyStatusProviderAggregator.cs" />
<Compile Include="Occupancy\iOccupancyStatusProvider.cs" />
<Compile Include="PC\InRoomPc.cs" />
<Compile Include="PC\Laptop.cs" />
<Compile Include="SetTopBox\SetTopBoxPropertiesConfig.cs" />
<Compile Include="Streaming\AppleTV.cs" />
<Compile Include="Audio\GenericAudioOut.cs" />

View File

@@ -136,12 +136,12 @@ namespace PepperDash.Essentials.Devices.Common
else if (typeName == "inroompc")
{
return new InRoomPc(key, name);
return new Core.Devices.InRoomPc(key, name);
}
else if (typeName == "laptop")
{
return new Laptop(key, name);
return new Core.Devices.Laptop(key, name);
}
else if (typeName == "mockvc")
@@ -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
}
@@ -299,9 +303,9 @@ namespace PepperDash.Essentials.Devices.Common
else if (typeName == "microphoneprivacycontroller")
{
var props = JsonConvert.DeserializeObject<Microphones.MicrophonePrivacyControllerConfig>(properties.ToString());
var props = JsonConvert.DeserializeObject<Core.Privacy.MicrophonePrivacyControllerConfig>(properties.ToString());
return new Microphones.MicrophonePrivacyController(key, props);
return new Core.Privacy.MicrophonePrivacyController(key, props);
}
else if (typeName == "roku")
{

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.*")]