diff --git a/PepperDashEssentials/Bridges/BridgeBase.cs b/PepperDashEssentials/Bridges/BridgeBase.cs
new file mode 100644
index 00000000..cf2d2f27
--- /dev/null
+++ b/PepperDashEssentials/Bridges/BridgeBase.cs
@@ -0,0 +1,214 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Crestron.SimplSharp;
+using Crestron.SimplSharpPro.EthernetCommunication;
+
+using PepperDash.Core;
+using PepperDash.Essentials.Core;
+using PepperDash.Essentials.Core.Devices;
+
+namespace PepperDash.Essentials.Bridges
+{
+ ///
+ /// Base class for all bridge class variants
+ ///
+ public class BridgeBase : Device
+ {
+ public BridgeApi Api { get; private set; }
+
+ public BridgeBase(string key) :
+ base(key)
+ {
+
+ }
+
+ }
+
+ ///
+ /// Base class for bridge API variants
+ ///
+ public abstract class BridgeApi : Device
+ {
+ public BridgeApi(string key) :
+ base(key)
+ {
+
+ }
+
+ }
+
+ ///
+ /// Bridge API using EISC
+ ///
+ public class EiscApi : BridgeApi
+ {
+ public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; }
+
+
+ public EiscApi(string key, uint ipid, string hostname) :
+ base(key)
+ {
+ Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(ipid, hostname, Global.ControlSystem);
+
+ Eisc.SigChange += new Crestron.SimplSharpPro.DeviceSupport.SigEventHandler(Eisc_SigChange);
+
+ Eisc.Register();
+ }
+
+ ///
+ /// Handles incoming sig changes
+ ///
+ ///
+ ///
+ void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
+ {
+ if (Debug.Level >= 1)
+ Debug.Console(1, this, "BridgeApi EISC change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
+ var uo = args.Sig.UserObject;
+ if (uo is Action)
+ (uo as Action)(args.Sig.BoolValue);
+ else if (uo is Action)
+ (uo as Action)(args.Sig.UShortValue);
+ else if (uo is Action)
+ (uo as Action)(args.Sig.StringValue);
+ }
+ }
+
+
+
+
+ ///
+ /// Defines each type and it's matching API type
+ ///
+ public static class DeviceApiFactory
+ {
+ public static Dictionary TypeMap = new Dictionary
+ {
+ { typeof(DmChassisController), typeof(DmChassisControllerApi) },
+ { typeof(IBasicCommunication), typeof(IBasicCommunicationApi) }
+ //{ typeof(SomeShittyDisplayController), typeof(SomeShittyDisplayControllerApi) }
+ };
+ }
+
+
+ ///
+ /// API class for IBasicCommunication devices
+ ///
+ public class IBasicCommunicationApi : DeviceApiBase
+ {
+ public IBasicCommunication Device { get; set; }
+
+ SerialFeedback TextReceivedFeedback;
+
+ public IBasicCommunicationApi(IBasicCommunication dev)
+ {
+ TextReceivedFeedback = new SerialFeedback();
+
+ Device = dev;
+
+ SetupFeedbacks();
+
+ ActionApi = new Dictionary
+ {
+ { "connect", new Action(Device.Connect) },
+ { "disconnect", new Action(Device.Disconnect) },
+ { "connectstate", new Action( b => ConnectByState(b) ) },
+ { "sendtext", new Action( s => Device.SendText(s) ) }
+
+ };
+
+ FeedbackApi = new Dictionary
+ {
+ { "isconnected", new BoolFeedback( () => Device.IsConnected ) },
+ { "textrecieved", TextReceivedFeedback }
+ };
+ }
+
+ ///
+ /// Controls connection based on state of input
+ ///
+ ///
+ void ConnectByState(bool state)
+ {
+ if (state)
+ Device.Connect();
+ else
+ Device.Disconnect();
+ }
+
+ void SetupFeedbacks()
+ {
+ Device.TextReceived += new EventHandler(Device_TextReceived);
+
+ if(Device is ISocketStatus)
+ (Device as ISocketStatus).ConnectionChange += new EventHandler(IBasicCommunicationApi_ConnectionChange);
+ }
+
+ void IBasicCommunicationApi_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e)
+ {
+ FeedbackApi["isconnected"].FireUpdate();
+ }
+
+ void Device_TextReceived(object sender, GenericCommMethodReceiveTextArgs e)
+ {
+ TextReceivedFeedback.FireUpdate(e.Text);
+ }
+ }
+
+
+
+ public class DmChassisController : Device
+ {
+ public DmChassisController(string key)
+ : base(key)
+ {
+
+ }
+
+ public void SetInput(int input)
+ {
+ Debug.Console(2, this, "Dm Chassis {0}, input {1}", Key, input);
+ }
+ }
+
+ ///
+ /// Each flavor of API is a static class with static properties and a static constructor that
+ /// links up the things to do.
+ ///
+ public class DmChassisControllerApi : DeviceApiBase
+ {
+ IntFeedback Output1Feedback;
+ IntFeedback Output2Feedback;
+
+ public DmChassisControllerApi(DmChassisController dev)
+ {
+ Output1Feedback = new IntFeedback( new Func(() => 1));
+ Output2Feedback = new IntFeedback( new Func(() => 2));
+
+ ActionApi = new Dictionary
+ {
+
+ };
+
+ FeedbackApi = new Dictionary
+ {
+ { "Output-1/fb", Output1Feedback },
+ { "Output-2/fb", Output2Feedback }
+ };
+ }
+
+ ///
+ /// Factory method
+ ///
+ ///
+ ///
+ public static DmChassisControllerApi GetActionApiForDevice(DmChassisController dev)
+ {
+ return new DmChassisControllerApi(dev);
+ }
+ }
+
+
+}
\ No newline at end of file
diff --git a/PepperDashEssentials/Bridges/BridgeFactory.cs b/PepperDashEssentials/Bridges/BridgeFactory.cs
new file mode 100644
index 00000000..97cc6fce
--- /dev/null
+++ b/PepperDashEssentials/Bridges/BridgeFactory.cs
@@ -0,0 +1,184 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Crestron.SimplSharp;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using PepperDash.Essentials.Core;
+using PepperDash.Essentials.Core.Config;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Routing;
+using Crestron.SimplSharpPro;
+using Crestron.SimplSharpPro.EthernetCommunication;
+
+namespace PepperDash.Essentials
+{
+ public class BridgeFactory
+ {
+ public static IKeyed GetDevice(PepperDash.Essentials.Core.Config.DeviceConfig dc)
+ {
+ // ? why is this static JTA 2018-06-13?
+
+ var key = dc.Key;
+ var name = dc.Name;
+ var type = dc.Type;
+ var properties = dc.Properties;
+ var propAnon = new { };
+ JsonConvert.DeserializeAnonymousType(dc.Properties.ToString(), propAnon);
+
+ var typeName = dc.Type.ToLower();
+ var groupName = dc.Group.ToLower();
+
+ Debug.Console(0, "Name {0}, Key {1}, Type {2}, Properties {3}", name, key, type, properties.ToString());
+ if (typeName == "dm")
+ {
+ return new DmBridge(key, name, properties);
+ }
+ else if (typeName == "comm")
+ {
+ return new CommBridge(key, name, properties);
+ }
+ else
+ return null;
+ }
+ }
+
+ public class DmBridge : Device
+ {
+ public EiscBridgeProperties Properties { get; private set; }
+
+ public PepperDash.Essentials.DM.DmChassisController DmSwitch { get; private set; }
+
+ public DmBridge(string key, string name, JToken properties) : base(key, name)
+ {
+ Properties = JsonConvert.DeserializeObject(properties.ToString());
+ }
+
+ public override bool CustomActivate()
+ {
+ // Create EiscApis
+ if (Properties.Eiscs != null)
+ {
+ foreach (var eisc in Properties.Eiscs)
+ {
+ var ApiEisc = new BridgeApiEisc(eisc.IpId, eisc.Hostname);
+
+ ApiEisc.Eisc.SetUShortSigAction(101, u => DmSwitch.ExecuteSwitch(u,1, eRoutingSignalType.Video));
+ ApiEisc.Eisc.SetUShortSigAction(102, u => DmSwitch.ExecuteSwitch(u,2, eRoutingSignalType.Video));
+ }
+ }
+
+ foreach (var device in DeviceManager.AllDevices)
+ {
+ if (device.Key == this.Properties.ParentDeviceKey)
+ {
+ Debug.Console(0, "deviceKey {0} Matches", device.Key);
+ DmSwitch = DeviceManager.GetDeviceForKey(device.Key) as PepperDash.Essentials.DM.DmChassisController;
+ }
+ else
+ {
+ Debug.Console(0, "deviceKey {0} doesn't match", device.Key);
+ }
+ }
+
+ Debug.Console(0, "Bridge {0} Activated", this.Name);
+ return true;
+ }
+ }
+
+ public class CommBridge : Device
+ {
+ public CommBridgeProperties Properties { get; private set; }
+
+ public List CommDevices { get; private set; }
+
+ public CommBridge(string key, string name, JToken properties)
+ : base(key, name)
+ {
+ Properties = JsonConvert.DeserializeObject(properties.ToString());
+ }
+
+ public override bool CustomActivate()
+ {
+ // Create EiscApis
+ if (Properties.Eiscs != null)
+ {
+ foreach (var eisc in Properties.Eiscs)
+ {
+ var ApiEisc = new BridgeApiEisc(eisc.IpId, eisc.Hostname);
+ }
+ }
+
+ foreach (var deviceKey in Properties.CommDevices)
+ {
+ var device = DeviceManager.GetDeviceForKey(deviceKey);
+
+ if (device != null)
+ {
+ Debug.Console(0, "deviceKey {0} Found in Device Manager", device.Key);
+ CommDevices.Add(device as IBasicCommunication);
+ }
+ else
+ {
+ Debug.Console(0, "deviceKey {0} Not Found in Device Manager", deviceKey);
+ }
+ }
+
+ // Iterate through all the CommDevices and link up their Actions and Feedbacks
+
+ Debug.Console(0, "Bridge {0} Activated", this.Name);
+
+ return true;
+ }
+ }
+
+
+ public class EiscBridgeProperties
+ {
+ public string ParentDeviceKey { get; set; }
+ public eApiType ApiType { get; set; }
+ public List Eiscs { get; set; }
+ public string ApiOverrideFilePath { get; set; }
+
+ public class EiscProperties
+ {
+ public string IpId { get; set; }
+ public string Hostname { get; set; }
+ }
+ }
+
+ public class CommBridgeProperties : EiscBridgeProperties
+ {
+ public List CommDevices { get; set; }
+ }
+
+ public enum eApiType { Eisc = 0 }
+
+ public class BridgeApiEisc
+ {
+ public uint Ipid { get; private set; }
+ public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; }
+
+ public BridgeApiEisc(string ipid, string hostname)
+ {
+ Ipid = (UInt32)int.Parse(ipid, System.Globalization.NumberStyles.HexNumber);
+ Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(Ipid, hostname, Global.ControlSystem);
+ Eisc.Register();
+ Eisc.SigChange += Eisc_SigChange;
+ Debug.Console(0, "BridgeApiEisc Created at Ipid {0}", ipid);
+ }
+ void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
+ {
+ if (Debug.Level >= 1)
+ Debug.Console(1, "BridgeApiEisc change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
+ var uo = args.Sig.UserObject;
+ if (uo is Action)
+ (uo as Action)(args.Sig.BoolValue);
+ else if (uo is Action)
+ (uo as Action)(args.Sig.UShortValue);
+ else if (uo is Action)
+ (uo as Action)(args.Sig.StringValue);
+ }
+ }
+}
\ No newline at end of file
diff --git a/PepperDashEssentials/Config/EssentialsConfig.cs b/PepperDashEssentials/Config/EssentialsConfig.cs
index 71c2be9f..fdd6e837 100644
--- a/PepperDashEssentials/Config/EssentialsConfig.cs
+++ b/PepperDashEssentials/Config/EssentialsConfig.cs
@@ -30,10 +30,11 @@ namespace PepperDash.Essentials
{
get
{
+ if (string.IsNullOrEmpty(SystemUrl))
+ return "missing url";
+
var result = Regex.Match(SystemUrl, @"https?:\/\/.*\/systems\/(.*)\/#.*");
-
string uuid = result.Groups[1].Value;
-
return uuid;
}
}
@@ -43,10 +44,11 @@ namespace PepperDash.Essentials
{
get
{
- var result = Regex.Match(TemplateUrl, @"https?:\/\/.*\/templates\/(.*)\/#.*");
-
+ if (string.IsNullOrEmpty(TemplateUrl))
+ return "missing template url";
+
+ var result = Regex.Match(TemplateUrl, @"https?:\/\/.*\/templates\/(.*)\/#.*");
string uuid = result.Groups[1].Value;
-
return uuid;
}
}
diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs
index 44da9ded..d25711ed 100644
--- a/PepperDashEssentials/ControlSystem.cs
+++ b/PepperDashEssentials/ControlSystem.cs
@@ -291,7 +291,7 @@ namespace PepperDash.Essentials
foreach (var roomConfig in ConfigReader.ConfigObject.Rooms)
{
- var room = roomConfig.GetRoomObject();
+ var room = roomConfig.GetRoomObject() as EssentialsRoomBase;
if (room != null)
{
if (room is EssentialsHuddleSpaceRoom)
@@ -319,7 +319,7 @@ namespace PepperDash.Essentials
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Cotija Bridge...");
// Cotija bridge
- var bridge = new CotijaEssentialsHuddleSpaceRoomBridge(room as EssentialsHuddleSpaceRoom);
+ var bridge = new CotijaEssentialsHuddleSpaceRoomBridge(room);
AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present
DeviceManager.AddDevice(bridge);
}
diff --git a/PepperDashEssentials/PepperDashEssentials.csproj b/PepperDashEssentials/PepperDashEssentials.csproj
index b4bfc66a..3fbb485a 100644
--- a/PepperDashEssentials/PepperDashEssentials.csproj
+++ b/PepperDashEssentials/PepperDashEssentials.csproj
@@ -105,6 +105,8 @@
+
+
@@ -154,6 +156,8 @@
+
+
@@ -178,7 +182,7 @@
-
+
diff --git a/PepperDashEssentials/Properties/AssemblyInfo.cs b/PepperDashEssentials/Properties/AssemblyInfo.cs
index 7541bd8a..c817c57a 100644
--- a/PepperDashEssentials/Properties/AssemblyInfo.cs
+++ b/PepperDashEssentials/Properties/AssemblyInfo.cs
@@ -4,5 +4,5 @@
[assembly: AssemblyCompany("PepperDash Technology Corp")]
[assembly: AssemblyProduct("PepperDashEssentials")]
[assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2017")]
-[assembly: AssemblyVersion("1.2.4.*")]
+[assembly: AssemblyVersion("1.2.5.*")]
diff --git a/PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs b/PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs
index 246bb42b..eeb1e9cb 100644
--- a/PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs
+++ b/PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs
@@ -39,25 +39,25 @@ namespace PepperDash.Essentials.Room.Config
huddle.DefaultVolume = (ushort)(props.Volumes.Master.Level * 65535 / 100);
return huddle;
}
- else if (typeName == "presentation")
- {
- var props = JsonConvert.DeserializeObject
- (this.Properties.ToString());
- var displaysDict = new Dictionary();
- uint i = 1;
- foreach (var dispKey in props.DisplayKeys) // read in the ordered displays list
- {
- var disp = DeviceManager.GetDeviceForKey(dispKey) as IRoutingSinkWithSwitching;
- displaysDict.Add(i++, disp);
- }
+ //else if (typeName == "presentation")
+ //{
+ // var props = JsonConvert.DeserializeObject
+ // (this.Properties.ToString());
+ // var displaysDict = new Dictionary();
+ // uint i = 1;
+ // foreach (var dispKey in props.DisplayKeys) // read in the ordered displays list
+ // {
+ // var disp = DeviceManager.GetDeviceForKey(dispKey) as IRoutingSinkWithSwitching;
+ // displaysDict.Add(i++, disp);
+ // }
- // Get the master volume control
- IBasicVolumeWithFeedback masterVolumeControlDev = props.Volumes.Master.GetDevice();
+ // // Get the master volume control
+ // IBasicVolumeWithFeedback masterVolumeControlDev = props.Volumes.Master.GetDevice();
- var presRoom = new EssentialsPresentationRoom(Key, Name, displaysDict, masterVolumeControlDev, props);
- return presRoom;
- }
+ // var presRoom = new EssentialsPresentationRoom(Key, Name, displaysDict, masterVolumeControlDev, props);
+ // return presRoom;
+ //}
else if (typeName == "huddlevtc1")
{
var props = JsonConvert.DeserializeObject
diff --git a/PepperDashEssentials/Room/Cotija/CotijaSystemController.cs b/PepperDashEssentials/Room/Cotija/CotijaSystemController.cs
index ab06a774..e64af860 100644
--- a/PepperDashEssentials/Room/Cotija/CotijaSystemController.cs
+++ b/PepperDashEssentials/Room/Cotija/CotijaSystemController.cs
@@ -82,6 +82,36 @@ namespace PepperDash.Essentials
CrestronConsole.AddNewConsoleCommand(TestHttpRequest,
"mobilehttprequest", "Tests an HTTP get to URL given", ConsoleAccessLevelEnum.AccessOperator);
+ CrestronConsole.AddNewConsoleCommand(PrintActionDictionaryPaths, "showactionpaths", "Prints the paths in teh Action Dictionary", ConsoleAccessLevelEnum.AccessOperator);
+
+
+ CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
+ }
+
+ ///
+ /// Sends message to server to indicate the system is shutting down
+ ///
+ ///
+ void CrestronEnvironment_ProgramStatusEventHandler(eProgramStatusEventType programEventType)
+ {
+ if (programEventType == eProgramStatusEventType.Stopping && WSClient.Connected)
+ {
+ SendMessageToServer(JObject.FromObject( new
+ {
+ type = "/system/close"
+ }));
+
+ }
+ }
+
+ public void PrintActionDictionaryPaths(object o)
+ {
+ Debug.Console(0, this, "ActionDictionary Contents:");
+
+ foreach (var item in ActionDictionary)
+ {
+ Debug.Console(0, this, "{0}", item.Key);
+ }
}
///
@@ -258,7 +288,6 @@ namespace PepperDash.Essentials
confObject.Info.RuntimeInfo.AppName = Assembly.GetExecutingAssembly().GetName().Name;
var version = Assembly.GetExecutingAssembly().GetName().Version;
confObject.Info.RuntimeInfo.AssemblyVersion = string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build);
- confObject.Info.RuntimeInfo.OsVersion = Crestron.SimplSharp.CrestronEnvironment.OSVersion.Firmware;
string postBody = JsonConvert.SerializeObject(confObject);
SystemUuid = confObject.SystemUuid;
@@ -452,8 +481,8 @@ namespace PepperDash.Essentials
{
SendMessageToServer(JObject.FromObject(new
{
- type = "/heartbeat-ack"
- }));
+ type = "/system/heartbeatAck"
+ }));
var code = content["userCode"];
if(code != null)
diff --git a/PepperDashEssentials/Room/Cotija/DeviceTypeInterfaces/IChannelExtensions.cs b/PepperDashEssentials/Room/Cotija/DeviceTypeInterfaces/IChannelExtensions.cs
index b26a7f99..dd23d85a 100644
--- a/PepperDashEssentials/Room/Cotija/DeviceTypeInterfaces/IChannelExtensions.cs
+++ b/PepperDashEssentials/Room/Cotija/DeviceTypeInterfaces/IChannelExtensions.cs
@@ -14,9 +14,9 @@ namespace PepperDash.Essentials.Room.Cotija
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
- controller.AddAction(prefix + "chanup", new PressAndHoldAction(dev.ChannelUp));
- controller.AddAction(prefix + "chandown", new PressAndHoldAction(dev.ChannelDown));
- controller.AddAction(prefix + "lastchan", new PressAndHoldAction(dev.LastChannel));
+ controller.AddAction(prefix + "chanUp", new PressAndHoldAction(dev.ChannelUp));
+ controller.AddAction(prefix + "chanDown", new PressAndHoldAction(dev.ChannelDown));
+ controller.AddAction(prefix + "lastChan", new PressAndHoldAction(dev.LastChannel));
controller.AddAction(prefix + "guide", new PressAndHoldAction(dev.Guide));
controller.AddAction(prefix + "info", new PressAndHoldAction(dev.Info));
controller.AddAction(prefix + "exit", new PressAndHoldAction(dev.Exit));
@@ -26,9 +26,9 @@ namespace PepperDash.Essentials.Room.Cotija
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
- controller.RemoveAction(prefix + "chanup");
- controller.RemoveAction(prefix + "chandown");
- controller.RemoveAction(prefix + "lastchan");
+ controller.RemoveAction(prefix + "chanUp");
+ controller.RemoveAction(prefix + "chanDown");
+ controller.RemoveAction(prefix + "lastChan");
controller.RemoveAction(prefix + "guide");
controller.RemoveAction(prefix + "info");
controller.RemoveAction(prefix + "exit");
diff --git a/PepperDashEssentials/Room/Cotija/DeviceTypeInterfaces/INumericExtensions.cs b/PepperDashEssentials/Room/Cotija/DeviceTypeInterfaces/INumericExtensions.cs
index 7246cb51..4f35e238 100644
--- a/PepperDashEssentials/Room/Cotija/DeviceTypeInterfaces/INumericExtensions.cs
+++ b/PepperDashEssentials/Room/Cotija/DeviceTypeInterfaces/INumericExtensions.cs
@@ -24,8 +24,8 @@ namespace PepperDash.Essentials.Room.Cotija
controller.AddAction(prefix + "num7", new PressAndHoldAction(dev.Digit0));
controller.AddAction(prefix + "num8", new PressAndHoldAction(dev.Digit0));
controller.AddAction(prefix + "num9", new PressAndHoldAction(dev.Digit0));
- controller.AddAction(prefix + "dash", new PressAndHoldAction(dev.KeypadAccessoryButton1));
- controller.AddAction(prefix + "enter", new PressAndHoldAction(dev.KeypadAccessoryButton2));
+ controller.AddAction(prefix + "numDash", new PressAndHoldAction(dev.KeypadAccessoryButton1));
+ controller.AddAction(prefix + "numEnter", new PressAndHoldAction(dev.KeypadAccessoryButton2));
// Deal with the Accessory functions on the numpad later
}
@@ -42,9 +42,9 @@ namespace PepperDash.Essentials.Room.Cotija
controller.RemoveAction(prefix + "num6");
controller.RemoveAction(prefix + "num7");
controller.RemoveAction(prefix + "num8");
- controller.RemoveAction(prefix + "num9");
- controller.RemoveAction(prefix + "dash");
- controller.RemoveAction(prefix + "enter");
+ controller.RemoveAction(prefix + "num9");
+ controller.RemoveAction(prefix + "numDash");
+ controller.RemoveAction(prefix + "numEnter");
}
}
}
\ No newline at end of file
diff --git a/PepperDashEssentials/Room/Cotija/DeviceTypeInterfaces/IPowerExtensions.cs b/PepperDashEssentials/Room/Cotija/DeviceTypeInterfaces/IPowerExtensions.cs
index 68b36675..732d2740 100644
--- a/PepperDashEssentials/Room/Cotija/DeviceTypeInterfaces/IPowerExtensions.cs
+++ b/PepperDashEssentials/Room/Cotija/DeviceTypeInterfaces/IPowerExtensions.cs
@@ -14,18 +14,18 @@ namespace PepperDash.Essentials.Room.Cotija
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
- controller.AddAction(prefix + "poweron", new Action(dev.PowerOn));
- controller.AddAction(prefix + "poweroff", new Action(dev.PowerOff));
- controller.AddAction(prefix + "powertoggle", new Action(dev.PowerToggle));
+ controller.AddAction(prefix + "powerOn", new Action(dev.PowerOn));
+ controller.AddAction(prefix + "powerOff", new Action(dev.PowerOff));
+ controller.AddAction(prefix + "powerToggle", new Action(dev.PowerToggle));
}
public static void UnlinkActions(this IPower dev, CotijaSystemController controller)
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
- controller.RemoveAction(prefix + "poweron");
- controller.RemoveAction(prefix + "poweroff");
- controller.RemoveAction(prefix + "powertoggle");
+ controller.RemoveAction(prefix + "powerOn");
+ controller.RemoveAction(prefix + "powerOff");
+ controller.RemoveAction(prefix + "powerToggle");
}
}
diff --git a/PepperDashEssentials/Room/Cotija/DeviceTypeInterfaces/ISetTopBoxControlsExtensions.cs b/PepperDashEssentials/Room/Cotija/DeviceTypeInterfaces/ISetTopBoxControlsExtensions.cs
index 7fa7d1b1..99198fa6 100644
--- a/PepperDashEssentials/Room/Cotija/DeviceTypeInterfaces/ISetTopBoxControlsExtensions.cs
+++ b/PepperDashEssentials/Room/Cotija/DeviceTypeInterfaces/ISetTopBoxControlsExtensions.cs
@@ -14,7 +14,7 @@ namespace PepperDash.Essentials.Room.Cotija
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
- controller.AddAction(prefix + "dvrlist", new PressAndHoldAction(dev.DvrList));
+ controller.AddAction(prefix + "dvrList", new PressAndHoldAction(dev.DvrList));
controller.AddAction(prefix + "replay", new PressAndHoldAction(dev.Replay));
}
@@ -22,7 +22,7 @@ namespace PepperDash.Essentials.Room.Cotija
{
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
- controller.RemoveAction(prefix + "dvrlist");
+ controller.RemoveAction(prefix + "dvrList");
controller.RemoveAction(prefix + "replay");
}
}
diff --git a/PepperDashEssentials/Room/Cotija/DeviceTypeInterfaces/ITransportExtensions.cs b/PepperDashEssentials/Room/Cotija/DeviceTypeInterfaces/ITransportExtensions.cs
index 34bda457..9463d95f 100644
--- a/PepperDashEssentials/Room/Cotija/DeviceTypeInterfaces/ITransportExtensions.cs
+++ b/PepperDashEssentials/Room/Cotija/DeviceTypeInterfaces/ITransportExtensions.cs
@@ -17,8 +17,8 @@ namespace PepperDash.Essentials.Room.Cotija
controller.AddAction(prefix + "play", new PressAndHoldAction(dev.Play));
controller.AddAction(prefix + "pause", new PressAndHoldAction(dev.Pause));
controller.AddAction(prefix + "stop", new PressAndHoldAction(dev.Stop));
- controller.AddAction(prefix + "prevtrack", new PressAndHoldAction(dev.ChapPlus));
- controller.AddAction(prefix + "nexttrack", new PressAndHoldAction(dev.ChapMinus));
+ controller.AddAction(prefix + "prevTrack", new PressAndHoldAction(dev.ChapPlus));
+ controller.AddAction(prefix + "nextTrack", new PressAndHoldAction(dev.ChapMinus));
controller.AddAction(prefix + "rewind", new PressAndHoldAction(dev.Rewind));
controller.AddAction(prefix + "ffwd", new PressAndHoldAction(dev.FFwd));
controller.AddAction(prefix + "record", new PressAndHoldAction(dev.Record));
@@ -31,8 +31,8 @@ namespace PepperDash.Essentials.Room.Cotija
controller.RemoveAction(prefix + "play");
controller.RemoveAction(prefix + "pause");
controller.RemoveAction(prefix + "stop");
- controller.RemoveAction(prefix + "prevtrack");
- controller.RemoveAction(prefix + "nexttrack");
+ controller.RemoveAction(prefix + "prevTrack");
+ controller.RemoveAction(prefix + "nextTrack");
controller.RemoveAction(prefix + "rewind");
controller.RemoveAction(prefix + "ffwd");
controller.RemoveAction(prefix + "record");
diff --git a/PepperDashEssentials/Room/Cotija/Interfaces.cs b/PepperDashEssentials/Room/Cotija/Interfaces.cs
index a20f614b..df651ef8 100644
--- a/PepperDashEssentials/Room/Cotija/Interfaces.cs
+++ b/PepperDashEssentials/Room/Cotija/Interfaces.cs
@@ -4,6 +4,8 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
+using PepperDash.Essentials.Core;
+
namespace PepperDash.Essentials.Room.Cotija
{
///
@@ -24,6 +26,8 @@ namespace PepperDash.Essentials
///
public interface IHasCurrentSourceInfoChange
{
+ string CurrentSourceInfoKey { get; }
+ SourceListItem CurrentSourceInfo { get; }
event SourceInfoChangeHandler CurrentSingleSourceChange;
}
@@ -43,7 +47,7 @@ namespace PepperDash.Essentials
///
public interface IRunDefaultPresentRoute
{
- void RunDefaultPresentRoute();
+ bool RunDefaultPresentRoute();
}
///
@@ -51,6 +55,6 @@ namespace PepperDash.Essentials
///
public interface IRunDefaultCallRoute : IRunDefaultPresentRoute
{
- void RunDefaultCallRoute();
+ bool RunDefaultCallRoute();
}
}
\ No newline at end of file
diff --git a/PepperDashEssentials/Room/Cotija/RoomBridges/CotijaDdvc01RoomBridge.cs b/PepperDashEssentials/Room/Cotija/RoomBridges/CotijaDdvc01RoomBridge.cs
index 48bd33fa..3435ec0e 100644
--- a/PepperDashEssentials/Room/Cotija/RoomBridges/CotijaDdvc01RoomBridge.cs
+++ b/PepperDashEssentials/Room/Cotija/RoomBridges/CotijaDdvc01RoomBridge.cs
@@ -1,607 +1,671 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Crestron.SimplSharp;
-using Crestron.SimplSharpPro.EthernetCommunication;
-
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-
-using PepperDash.Core;
-using PepperDash.Essentials.Core;
-using PepperDash.Essentials.Core.Config;
-using PepperDash.Essentials.Room.Config;
-
-
-namespace PepperDash.Essentials.Room.Cotija
-{
- public class CotijaDdvc01RoomBridge : CotijaBridgeBase, IDelayedConfiguration
- {
- public class BoolJoin
- {
- ///
- /// 301
- ///
- public const uint RoomIsOn = 301;
-
- ///
- /// 51
- ///
- public const uint ActivitySharePress = 51;
- ///
- /// 52
- ///
- public const uint ActivityPhoneCallPress = 52;
- ///
- /// 53
- ///
- public const uint ActivityVideoCallPress = 53;
-
- ///
- /// 1
- ///
- public const uint MasterVolumeIsMuted = 1;
- ///
- /// 1
- ///
- public const uint MasterVolumeMuteToggle = 1;
-
- ///
- /// 61
- ///
- public const uint ShutdownCancel = 61;
- ///
- /// 62
- ///
- public const uint ShutdownEnd = 62;
- ///
- /// 63
- ///
- public const uint ShutdownStart = 63;
-
-
-
- ///
- /// 72
- ///
- public const uint SourceHasChanged = 72;
- ///
- /// 501
- ///
- public const uint ConfigIsReady = 501;
- }
-
- public class UshortJoin
- {
- ///
- /// 1
- ///
- public const uint MasterVolumeLevel = 1;
-
- ///
- /// 61
- ///
- public const uint ShutdownPromptDuration = 61;
- }
-
- public class StringJoin
- {
- ///
- /// 71
- ///
- public const uint SelectedSourceKey = 71;
-
- ///
- /// 501
- ///
- public const uint ConfigRoomName = 501;
- ///
- /// 502
- ///
- public const uint ConfigHelpMessage = 502;
- ///
- /// 503
- ///
- public const uint ConfigHelpNumber = 503;
- ///
- /// 504
- ///
- public const uint ConfigRoomPhoneNumber = 504;
- ///
- /// 505
- ///
- public const uint ConfigRoomURI = 505;
- ///
- /// 401
- ///
- public const uint UserCodeToSystem = 401;
- ///
- /// 402
- ///
- public const uint ServerUrl = 402;
- }
-
- ///
- /// Fires when config is ready to go
- ///
- public event EventHandler ConfigurationIsReady;
-
- public ThreeSeriesTcpIpEthernetIntersystemCommunications EISC { get; private set; }
-
- ///
- ///
- ///
- public bool ConfigIsLoaded { get; private set; }
-
- public override string RoomName
- {
- get {
- var name = EISC.StringOutput[StringJoin.ConfigRoomName].StringValue;
- return string.IsNullOrEmpty(name) ? "Not Loaded" : name;
- }
- }
-
- CotijaDdvc01DeviceBridge SourceBridge;
-
-
- ///
- ///
- ///
- ///
- ///
- ///
- public CotijaDdvc01RoomBridge(string key, string name, uint ipId)
- : base(key, name)
- {
- try
- {
- EISC = new ThreeSeriesTcpIpEthernetIntersystemCommunications(ipId, "127.0.0.2", Global.ControlSystem);
- var reg = EISC.Register();
- 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);
- DeviceManager.AddDevice(SourceBridge);
- }
- catch (Exception)
- {
- throw;
- }
- }
-
- ///
- /// Finish wiring up everything after all devices are created. The base class will hunt down the related
- /// parent controller and link them up.
- ///
- ///
- public override bool CustomActivate()
- {
- Debug.Console(0, this, "Final activation. Setting up actions and feedbacks");
- SetupFunctions();
- SetupFeedbacks();
-
- EISC.SigChange += EISC_SigChange;
- EISC.OnlineStatusChange += (o, a) =>
- {
- Debug.Console(1, this, "DDVC EISC online={0}. Config is ready={1}", a.DeviceOnLine, EISC.BooleanOutput[BoolJoin.ConfigIsReady].BoolValue);
- if (a.DeviceOnLine && EISC.BooleanOutput[BoolJoin.ConfigIsReady].BoolValue)
- LoadConfigValues();
- };
- // load config if it's already there
- if (EISC.IsOnline && EISC.BooleanOutput[BoolJoin.ConfigIsReady].BoolValue) // || EISC.BooleanInput[BoolJoin.ConfigIsReady].BoolValue)
- LoadConfigValues();
-
-
- CrestronConsole.AddNewConsoleCommand(s =>
- {
- for (uint i = 1; i < 1000; i++)
- {
- if (s.ToLower().Equals("b"))
- {
- CrestronConsole.ConsoleCommandResponse("D{0,6} {1} - ", i, EISC.BooleanOutput[i].BoolValue);
- }
- else if (s.ToLower().Equals("u"))
- {
- CrestronConsole.ConsoleCommandResponse("U{0,6} {1,8} - ", i, EISC.UShortOutput[i].UShortValue);
- }
- else if (s.ToLower().Equals("s"))
- {
- var val = EISC.StringOutput[i].StringValue;
- if(!string.IsNullOrEmpty(val))
- CrestronConsole.ConsoleCommandResponse("S{0,6} {1}\r", i, EISC.StringOutput[i].StringValue);
- }
-
- }
- }, "mobilebridgedump", "Dumps DDVC01 bridge EISC data b,u,s", ConsoleAccessLevelEnum.AccessOperator);
-
- CrestronConsole.AddNewConsoleCommand(s => LoadConfigValues(), "loadddvc", "", ConsoleAccessLevelEnum.AccessOperator);
-
- return base.CustomActivate();
- }
-
-
- ///
- /// Setup the actions to take place on various incoming API calls
- ///
- void SetupFunctions()
- {
-
- Parent.AddAction(@"/room/room1/status", new Action(SendFullStatus));
-
- Parent.AddAction(@"/room/room1/source", new Action(c =>
- {
- EISC.SetString(StringJoin.SelectedSourceKey, c.SourceListItem);
- EISC.PulseBool(BoolJoin.SourceHasChanged);
- }));
-
-#warning CHANGE to activityshare. Perhaps
- Parent.AddAction(@"/room/room1/defaultsource", new Action(() =>
- EISC.PulseBool(BoolJoin.ActivitySharePress)));
-
- Parent.AddAction(@"/room/room1/masterVolumeLevel", new Action(u =>
- EISC.SetUshort(UshortJoin.MasterVolumeLevel, u)));
- Parent.AddAction(@"/room/room1/masterVolumeMuteToggle", new Action(() =>
- EISC.PulseBool(BoolJoin.MasterVolumeIsMuted)));
-
- Parent.AddAction(@"/room/room1/shutdownStart", new Action(() =>
- EISC.PulseBool(BoolJoin.ShutdownStart)));
- Parent.AddAction(@"/room/room1/shutdownEnd", new Action(() =>
- EISC.PulseBool(BoolJoin.ShutdownEnd)));
- Parent.AddAction(@"/room/room1/shutdownCancel", new Action(() =>
- EISC.PulseBool(BoolJoin.ShutdownCancel)));
- }
-
- ///
- /// Links feedbacks to whatever is gonna happen!
- ///
- void SetupFeedbacks()
- {
- // Power
- EISC.SetBoolSigAction(BoolJoin.RoomIsOn, b =>
- PostStatusMessage(new
- {
- isOn = b
- }));
-
- // Source change things
- EISC.SetSigTrueAction(BoolJoin.SourceHasChanged, () =>
- PostStatusMessage(new
- {
- selectedSourceKey = EISC.StringOutput[StringJoin.SelectedSourceKey].StringValue
- }));
-
- // Volume things
- EISC.SetUShortSigAction(UshortJoin.MasterVolumeLevel, u =>
- PostStatusMessage(new
- {
- masterVolumeLevel = u
- }));
-
- EISC.SetBoolSigAction(BoolJoin.MasterVolumeIsMuted, b =>
- PostStatusMessage(new
- {
- masterVolumeMuteState = b
- }));
-
- // shutdown things
- EISC.SetSigTrueAction(BoolJoin.ShutdownCancel, new Action(() =>
- PostMessage("/room/shutdown/", new
- {
- state = "wasCancelled"
- })));
- EISC.SetSigTrueAction(BoolJoin.ShutdownEnd, new Action(() =>
- PostMessage("/room/shutdown/", new
- {
- state = "hasFinished"
- })));
- EISC.SetSigTrueAction(BoolJoin.ShutdownStart, new Action(() =>
- PostMessage("/room/shutdown/", new
- {
- state = "hasStarted",
- duration = EISC.UShortOutput[UshortJoin.ShutdownPromptDuration].UShortValue
- })));
-
- // Config things
- EISC.SetSigTrueAction(BoolJoin.ConfigIsReady, LoadConfigValues);
- }
-
- ///
- /// Reads in config values when the Simpl program is ready
- ///
- void LoadConfigValues()
- {
- Debug.Console(1, this, "Loading configuration from DDVC01 EISC bridge");
- ConfigIsLoaded = false;
-
- var co = ConfigReader.ConfigObject;
-
- //Room
- if (co.Rooms == null)
- co.Rooms = new List();
- var rm = new EssentialsRoomConfig();
- if (co.Rooms.Count == 0)
- {
- Debug.Console(0, this, "Adding room to config");
- co.Rooms.Add(rm);
- }
- rm.Name = EISC.StringOutput[501].StringValue;
- rm.Key = "room1";
- rm.Type = "ddvc01";
-
- DDVC01RoomPropertiesConfig rmProps;
- if (rm.Properties == null)
- rmProps = new DDVC01RoomPropertiesConfig();
- else
- rmProps = JsonConvert.DeserializeObject(rm.Properties.ToString());
-
- rmProps.Help = new EssentialsHelpPropertiesConfig();
- rmProps.Help.CallButtonText = EISC.StringOutput[503].StringValue;
- rmProps.Help.Message = EISC.StringOutput[502].StringValue;
-
- rmProps.Environment = new EssentialsEnvironmentPropertiesConfig(); // enabled defaults to false
-
- rmProps.RoomPhoneNumber = EISC.StringOutput[504].StringValue;
- rmProps.RoomURI = EISC.StringOutput[505].StringValue;
- rmProps.SpeedDials = new List();
- // add speed dials as long as there are more - up to 4
- for (uint i = 512; i <= 519; i = i + 2)
- {
- var num = EISC.StringOutput[i].StringValue;
- if (string.IsNullOrEmpty(num))
- break;
- var name = EISC.StringOutput[i + 1].StringValue;
- rmProps.SpeedDials.Add(new DDVC01SpeedDial { Number = num, Name = name});
- }
- // volume control names
- var volCount = EISC.UShortOutput[701].UShortValue;
-
- // use Volumes object or?
- rmProps.VolumeSliderNames = new List();
- for(uint i = 701; i <= 700 + volCount; i++)
- {
- rmProps.VolumeSliderNames.Add(EISC.StringInput[i].StringValue);
- }
-
- // There should be cotija devices in here, I think...
- if(co.Devices == null)
- co.Devices = new List();
-
- // clear out previous DDVC devices
- co.Devices.RemoveAll(d => d.Key.StartsWith("source-", StringComparison.OrdinalIgnoreCase));
-
- rmProps.SourceListKey = "default";
- rm.Properties = JToken.FromObject(rmProps);
-
- // Source list! This might be brutal!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
- var groupMap = GetSourceGroupDictionary();
-
- co.SourceLists = new Dictionary>();
- var newSl = new Dictionary();
- // add sources...
- for (uint i = 0; i<= 19; i++)
- {
- var name = EISC.StringOutput[601 + i].StringValue;
- if(string.IsNullOrEmpty(name))
- break;
- var icon = EISC.StringOutput[651 + i].StringValue;
- var key = EISC.StringOutput[671 + i].StringValue;
- var type = EISC.StringOutput[701 + i].StringValue;
-
- Debug.Console(0, this, "Adding source {0} '{1}'", key, name);
- var newSLI = new SourceListItem{
- Icon = icon,
- Name = name,
- Order = (int)i + 1,
- SourceKey = key,
- };
- newSl.Add(key, newSLI);
-
- string group = "genericsource";
- if (groupMap.ContainsKey(type))
- {
- group = groupMap[type];
- }
-
- // add dev to devices list
- var devConf = new DeviceConfig {
- Group = group,
- Key = key,
- Name = name,
- Type = type
- };
- co.Devices.Add(devConf);
- }
-
- co.SourceLists.Add("default", newSl);
-
- Debug.Console(0, this, "******* CONFIG FROM DDVC: \r{0}", JsonConvert.SerializeObject(ConfigReader.ConfigObject, Formatting.Indented));
-
- var handler = ConfigurationIsReady;
- if (handler != null)
- {
- handler(this, new EventArgs());
- }
-
- ConfigIsLoaded = true;
- }
-
- void SendFullStatus()
- {
- if (ConfigIsLoaded)
- {
- PostStatusMessage(new
- {
- isOn = EISC.BooleanOutput[BoolJoin.RoomIsOn].BoolValue,
- selectedSourceKey = EISC.StringOutput[StringJoin.SelectedSourceKey].StringValue,
- masterVolumeLevel = EISC.UShortOutput[UshortJoin.MasterVolumeLevel].UShortValue,
- masterVolumeMuteState = EISC.BooleanOutput[BoolJoin.MasterVolumeIsMuted].BoolValue
- });
- }
- else
- {
- PostStatusMessage(new
- {
- error = "systemNotReady"
- });
- }
- }
-
-
-
- ///
- /// Helper for posting status message
- ///
- /// The contents of the content object
- void PostStatusMessage(object contentObject)
- {
- Parent.SendMessageToServer(JObject.FromObject(new
- {
- type = "/room/status/",
- content = contentObject
- }));
- }
-
- ///
- ///
- ///
- ///
- ///
- void PostMessage(string messageType, object contentObject)
- {
- Parent.SendMessageToServer(JObject.FromObject(new
- {
- type = messageType,
- content = contentObject
- }));
- }
-
-
- ///
- ///
- ///
- ///
- ///
- void EISC_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
- {
- if (Debug.Level >= 1)
- Debug.Console(1, this, "DDVC EISC change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
- var uo = args.Sig.UserObject;
- if (uo is Action)
- (uo as Action)(args.Sig.BoolValue);
- else if (uo is Action)
- (uo as Action)(args.Sig.UShortValue);
- else if (uo is Action)
- (uo as Action)(args.Sig.StringValue);
- }
-
- ///
- /// Returns the mapping of types to groups, for setting up devices.
- ///
- ///
- Dictionary GetSourceGroupDictionary()
- {
- //type, group
- var d = new Dictionary(StringComparer.OrdinalIgnoreCase)
- {
- { "laptop", "pc" },
- { "wireless", "genericsource" },
- { "iptv", "settopbox" }
-
- };
- return d;
- }
-
- ///
- /// updates the usercode from server
- ///
- protected override void UserCodeChange()
- {
- Debug.Console(1, this, "Server user code changed: {0}", UserCode);
- EISC.StringInput[StringJoin.UserCodeToSystem].StringValue = UserCode;
- EISC.StringInput[StringJoin.ServerUrl].StringValue = Parent.Config.ClientAppUrl;
- }
-
- ///
- ///
- ///
- ///
- ///
- void SourceChange(string oldKey, string newKey)
- {
- /* Example message
- * {
- "type":"/room/status",
- "content": {
- "selectedSourceKey": "off",
- }
- }
- */
- //if (type == ChangeType.WillChange)
- //{
- // // Disconnect from previous source
-
- // if (info != null)
- // {
- // var previousDev = info.SourceDevice;
-
- // // device type interfaces
- // if (previousDev is ISetTopBoxControls)
- // (previousDev as ISetTopBoxControls).UnlinkActions(Parent);
- // // common interfaces
- // if (previousDev is IChannel)
- // (previousDev as IChannel).UnlinkActions(Parent);
- // if (previousDev is IColor)
- // (previousDev as IColor).UnlinkActions(Parent);
- // if (previousDev is IDPad)
- // (previousDev as IDPad).UnlinkActions(Parent);
- // if (previousDev is IDvr)
- // (previousDev as IDvr).UnlinkActions(Parent);
- // if (previousDev is INumericKeypad)
- // (previousDev as INumericKeypad).UnlinkActions(Parent);
- // if (previousDev is IPower)
- // (previousDev as IPower).UnlinkActions(Parent);
- // if (previousDev is ITransport)
- // (previousDev as ITransport).UnlinkActions(Parent);
- // }
-
-
- // var huddleRoom = room as EssentialsHuddleSpaceRoom;
- // JObject roomStatus = new JObject();
- // roomStatus.Add("selectedSourceKey", huddleRoom.CurrentSourceInfoKey);
-
- // JObject message = new JObject();
-
- // message.Add("type", "/room/status/");
- // message.Add("content", roomStatus);
-
- // Parent.PostToServer(message);
- //}
- //else
- //{
- // if (info != null)
- // {
- // var dev = info.SourceDevice;
-
- // if (dev is ISetTopBoxControls)
- // (dev as ISetTopBoxControls).LinkActions(Parent);
- // if (dev is IChannel)
- // (dev as IChannel).LinkActions(Parent);
- // if (dev is IColor)
- // (dev as IColor).LinkActions(Parent);
- // if (dev is IDPad)
- // (dev as IDPad).LinkActions(Parent);
- // if (dev is IDvr)
- // (dev as IDvr).LinkActions(Parent);
- // if (dev is INumericKeypad)
- // (dev as INumericKeypad).LinkActions(Parent);
- // if (dev is IPower)
- // (dev as IPower).LinkActions(Parent);
- // if (dev is ITransport)
- // (dev as ITransport).LinkActions(Parent);
- // }
- //}
- }
- }
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Crestron.SimplSharp;
+using Crestron.SimplSharp.Reflection;
+using Crestron.SimplSharpPro.EthernetCommunication;
+
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+
+using PepperDash.Core;
+using PepperDash.Essentials.Core;
+using PepperDash.Essentials.Core.Config;
+using PepperDash.Essentials.Room.Config;
+
+
+namespace PepperDash.Essentials.Room.Cotija
+{
+ public class CotijaDdvc01RoomBridge : CotijaBridgeBase, IDelayedConfiguration
+ {
+ public class BoolJoin
+ {
+ ///
+ /// 301
+ ///
+ public const uint RoomIsOn = 301;
+
+ ///
+ /// 51
+ ///
+ public const uint ActivitySharePress = 51;
+ ///
+ /// 52
+ ///
+ public const uint ActivityPhoneCallPress = 52;
+ ///
+ /// 53
+ ///
+ public const uint ActivityVideoCallPress = 53;
+
+ ///
+ /// 1
+ ///
+ public const uint MasterVolumeIsMuted = 1;
+ ///
+ /// 1
+ ///
+ public const uint MasterVolumeMuteToggle = 1;
+
+ ///
+ /// 61
+ ///
+ public const uint ShutdownCancel = 61;
+ ///
+ /// 62
+ ///
+ public const uint ShutdownEnd = 62;
+ ///
+ /// 63
+ ///
+ public const uint ShutdownStart = 63;
+
+
+
+ ///
+ /// 72
+ ///
+ public const uint SourceHasChanged = 72;
+ ///
+ /// 501
+ ///
+ public const uint ConfigIsReady = 501;
+ }
+
+ public class UshortJoin
+ {
+ ///
+ /// 1
+ ///
+ public const uint MasterVolumeLevel = 1;
+
+ ///
+ /// 61
+ ///
+ public const uint ShutdownPromptDuration = 61;
+ }
+
+ public class StringJoin
+ {
+ ///
+ /// 71
+ ///
+ public const uint SelectedSourceKey = 71;
+
+ ///
+ /// 501
+ ///
+ public const uint ConfigRoomName = 501;
+ ///
+ /// 502
+ ///
+ public const uint ConfigHelpMessage = 502;
+ ///
+ /// 503
+ ///
+ public const uint ConfigHelpNumber = 503;
+ ///
+ /// 504
+ ///
+ public const uint ConfigRoomPhoneNumber = 504;
+ ///
+ /// 505
+ ///
+ public const uint ConfigRoomURI = 505;
+ ///
+ /// 401
+ ///
+ public const uint UserCodeToSystem = 401;
+ ///
+ /// 402
+ ///
+ public const uint ServerUrl = 402;
+ }
+
+ ///
+ /// Fires when config is ready to go
+ ///
+ public event EventHandler ConfigurationIsReady;
+
+ public ThreeSeriesTcpIpEthernetIntersystemCommunications EISC { get; private set; }
+
+ ///
+ ///
+ ///
+ public bool ConfigIsLoaded { get; private set; }
+
+ public override string RoomName
+ {
+ get {
+ var name = EISC.StringOutput[StringJoin.ConfigRoomName].StringValue;
+ return string.IsNullOrEmpty(name) ? "Not Loaded" : name;
+ }
+ }
+
+ CotijaDdvc01DeviceBridge SourceBridge;
+
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public CotijaDdvc01RoomBridge(string key, string name, uint ipId)
+ : base(key, name)
+ {
+ try
+ {
+ EISC = new ThreeSeriesTcpIpEthernetIntersystemCommunications(ipId, "127.0.0.2", Global.ControlSystem);
+ var reg = EISC.Register();
+ 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);
+ DeviceManager.AddDevice(SourceBridge);
+ }
+ catch (Exception)
+ {
+ throw;
+ }
+ }
+
+ ///
+ /// Finish wiring up everything after all devices are created. The base class will hunt down the related
+ /// parent controller and link them up.
+ ///
+ ///
+ public override bool CustomActivate()
+ {
+ Debug.Console(0, this, "Final activation. Setting up actions and feedbacks");
+ SetupFunctions();
+ SetupFeedbacks();
+
+ EISC.SigChange += EISC_SigChange;
+ EISC.OnlineStatusChange += (o, a) =>
+ {
+ Debug.Console(1, this, "DDVC EISC online={0}. Config is ready={1}", a.DeviceOnLine, EISC.BooleanOutput[BoolJoin.ConfigIsReady].BoolValue);
+ if (a.DeviceOnLine && EISC.BooleanOutput[BoolJoin.ConfigIsReady].BoolValue)
+ LoadConfigValues();
+ };
+ // load config if it's already there
+ if (EISC.IsOnline && EISC.BooleanOutput[BoolJoin.ConfigIsReady].BoolValue) // || EISC.BooleanInput[BoolJoin.ConfigIsReady].BoolValue)
+ LoadConfigValues();
+
+
+ CrestronConsole.AddNewConsoleCommand(s =>
+ {
+ for (uint i = 1; i < 1000; i++)
+ {
+ if (s.ToLower().Equals("b"))
+ {
+ CrestronConsole.ConsoleCommandResponse("D{0,6} {1} - ", i, EISC.BooleanOutput[i].BoolValue);
+ }
+ else if (s.ToLower().Equals("u"))
+ {
+ CrestronConsole.ConsoleCommandResponse("U{0,6} {1,8} - ", i, EISC.UShortOutput[i].UShortValue);
+ }
+ else if (s.ToLower().Equals("s"))
+ {
+ var val = EISC.StringOutput[i].StringValue;
+ if(!string.IsNullOrEmpty(val))
+ CrestronConsole.ConsoleCommandResponse("S{0,6} {1}\r", i, EISC.StringOutput[i].StringValue);
+ }
+
+ }
+ }, "mobilebridgedump", "Dumps DDVC01 bridge EISC data b,u,s", ConsoleAccessLevelEnum.AccessOperator);
+
+ CrestronConsole.AddNewConsoleCommand(s => LoadConfigValues(), "loadddvc", "", ConsoleAccessLevelEnum.AccessOperator);
+
+ return base.CustomActivate();
+ }
+
+
+ ///
+ /// Setup the actions to take place on various incoming API calls
+ ///
+ void SetupFunctions()
+ {
+
+ Parent.AddAction(@"/room/room1/status", new Action(SendFullStatus));
+
+ Parent.AddAction(@"/room/room1/source", new Action(c =>
+ {
+ EISC.SetString(StringJoin.SelectedSourceKey, c.SourceListItem);
+ EISC.PulseBool(BoolJoin.SourceHasChanged);
+ }));
+
+#warning CHANGE to activityshare. Perhaps
+ Parent.AddAction(@"/room/room1/defaultsource", new Action(() =>
+ EISC.PulseBool(BoolJoin.ActivitySharePress)));
+
+ Parent.AddAction(@"/room/room1/volumes/master/level", new Action(u =>
+ EISC.SetUshort(UshortJoin.MasterVolumeLevel, u)));
+ Parent.AddAction(@"/room/room1/volumes/master/muteToggle", new Action(() =>
+ EISC.PulseBool(BoolJoin.MasterVolumeIsMuted)));
+
+ Parent.AddAction(@"/room/room1/shutdownStart", new Action(() =>
+ EISC.PulseBool(BoolJoin.ShutdownStart)));
+ Parent.AddAction(@"/room/room1/shutdownEnd", new Action(() =>
+ EISC.PulseBool(BoolJoin.ShutdownEnd)));
+ Parent.AddAction(@"/room/room1/shutdownCancel", new Action(() =>
+ EISC.PulseBool(BoolJoin.ShutdownCancel)));
+
+
+ // Source Device (Current Source)'
+
+ SourceDeviceMapDictionary sourceJoinMap = new SourceDeviceMapDictionary();
+
+ var prefix = @"/device/currentSource/";
+
+ foreach (var item in sourceJoinMap)
+ {
+ Parent.AddAction(string.Format("{0}{1}", prefix, item.Key), new PressAndHoldAction(b => EISC.SetBool(item.Value, b)));
+ }
+ }
+
+ ///
+ /// Links feedbacks to whatever is gonna happen!
+ ///
+ void SetupFeedbacks()
+ {
+ // Power
+ EISC.SetBoolSigAction(BoolJoin.RoomIsOn, b =>
+ PostStatusMessage(new
+ {
+ isOn = b
+ }));
+
+ // Source change things
+ EISC.SetSigTrueAction(BoolJoin.SourceHasChanged, () =>
+ PostStatusMessage(new
+ {
+ selectedSourceKey = EISC.StringOutput[StringJoin.SelectedSourceKey].StringValue
+ }));
+
+ // Volume things
+ EISC.SetUShortSigAction(UshortJoin.MasterVolumeLevel, u =>
+ PostStatusMessage(new
+ {
+ volumes = new
+ {
+ master = new
+ {
+ level = u
+ }
+ }
+ }));
+
+ EISC.SetBoolSigAction(BoolJoin.MasterVolumeIsMuted, b =>
+ PostStatusMessage(new
+ {
+ volumes = new
+ {
+ master = new
+ {
+ muted = b
+ }
+ }
+ }));
+
+
+ // shutdown things
+ EISC.SetSigTrueAction(BoolJoin.ShutdownCancel, new Action(() =>
+ PostMessage("/room/shutdown/", new
+ {
+ state = "wasCancelled"
+ })));
+ EISC.SetSigTrueAction(BoolJoin.ShutdownEnd, new Action(() =>
+ PostMessage("/room/shutdown/", new
+ {
+ state = "hasFinished"
+ })));
+ EISC.SetSigTrueAction(BoolJoin.ShutdownStart, new Action(() =>
+ PostMessage("/room/shutdown/", new
+ {
+ state = "hasStarted",
+ duration = EISC.UShortOutput[UshortJoin.ShutdownPromptDuration].UShortValue
+ })));
+
+ // Config things
+ EISC.SetSigTrueAction(BoolJoin.ConfigIsReady, LoadConfigValues);
+ }
+
+ ///
+ /// Reads in config values when the Simpl program is ready
+ ///
+ void LoadConfigValues()
+ {
+ Debug.Console(1, this, "Loading configuration from DDVC01 EISC bridge");
+ ConfigIsLoaded = false;
+
+ var co = ConfigReader.ConfigObject;
+
+ co.Info.RuntimeInfo.AppName = Assembly.GetExecutingAssembly().GetName().Name;
+ var version = Assembly.GetExecutingAssembly().GetName().Version;
+ co.Info.RuntimeInfo.AssemblyVersion = string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build);
+
+
+ //Room
+ if (co.Rooms == null)
+ co.Rooms = new List();
+ var rm = new EssentialsRoomConfig();
+ if (co.Rooms.Count == 0)
+ {
+ Debug.Console(0, this, "Adding room to config");
+ co.Rooms.Add(rm);
+ }
+ else
+ {
+ Debug.Console(0, this, "Replacing Room[0] in config");
+ co.Rooms[0] = rm;
+ }
+ rm.Name = EISC.StringOutput[501].StringValue;
+ rm.Key = "room1";
+ rm.Type = "ddvc01";
+
+ DDVC01RoomPropertiesConfig rmProps;
+ if (rm.Properties == null)
+ rmProps = new DDVC01RoomPropertiesConfig();
+ else
+ rmProps = JsonConvert.DeserializeObject(rm.Properties.ToString());
+
+ rmProps.Help = new EssentialsHelpPropertiesConfig();
+ rmProps.Help.CallButtonText = EISC.StringOutput[503].StringValue;
+ rmProps.Help.Message = EISC.StringOutput[502].StringValue;
+
+ rmProps.Environment = new EssentialsEnvironmentPropertiesConfig(); // enabled defaults to false
+
+ rmProps.RoomPhoneNumber = EISC.StringOutput[504].StringValue;
+ rmProps.RoomURI = EISC.StringOutput[505].StringValue;
+ rmProps.SpeedDials = new List();
+ // add speed dials as long as there are more - up to 4
+ for (uint i = 512; i <= 519; i = i + 2)
+ {
+ var num = EISC.StringOutput[i].StringValue;
+ if (string.IsNullOrEmpty(num))
+ break;
+ var name = EISC.StringOutput[i + 1].StringValue;
+ rmProps.SpeedDials.Add(new DDVC01SpeedDial { Number = num, Name = name});
+ }
+ // volume control names
+ var volCount = EISC.UShortOutput[701].UShortValue;
+
+ //// use Volumes object or?
+ //rmProps.VolumeSliderNames = new List();
+ //for(uint i = 701; i <= 700 + volCount; i++)
+ //{
+ // rmProps.VolumeSliderNames.Add(EISC.StringInput[i].StringValue);
+ //}
+
+ // There should be cotija devices in here, I think...
+ if(co.Devices == null)
+ co.Devices = new List();
+
+ // clear out previous DDVC devices
+ co.Devices.RemoveAll(d => d.Key.StartsWith("source-", StringComparison.OrdinalIgnoreCase));
+
+ rmProps.SourceListKey = "default";
+ rm.Properties = JToken.FromObject(rmProps);
+
+ // Source list! This might be brutal!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+ var groupMap = GetSourceGroupDictionary();
+
+ co.SourceLists = new Dictionary>();
+ var newSl = new Dictionary();
+ // add sources...
+ for (uint i = 0; i<= 19; i++)
+ {
+ var name = EISC.StringOutput[601 + i].StringValue;
+ if(string.IsNullOrEmpty(name))
+ break;
+ var icon = EISC.StringOutput[651 + i].StringValue;
+ var key = EISC.StringOutput[671 + i].StringValue;
+ var type = EISC.StringOutput[701 + i].StringValue;
+
+ Debug.Console(0, this, "Adding source {0} '{1}'", key, name);
+ var newSLI = new SourceListItem{
+ Icon = icon,
+ Name = name,
+ Order = (int)i + 1,
+ SourceKey = key,
+ };
+ newSl.Add(key, newSLI);
+
+ string group = "genericsource";
+ if (groupMap.ContainsKey(type))
+ {
+ group = groupMap[type];
+ }
+
+ // add dev to devices list
+ var devConf = new DeviceConfig {
+ Group = group,
+ Key = key,
+ Name = name,
+ Type = type
+ };
+ co.Devices.Add(devConf);
+ }
+
+ co.SourceLists.Add("default", newSl);
+
+ Debug.Console(0, this, "******* CONFIG FROM DDVC: \r{0}", JsonConvert.SerializeObject(ConfigReader.ConfigObject, Formatting.Indented));
+
+ var handler = ConfigurationIsReady;
+ if (handler != null)
+ {
+ handler(this, new EventArgs());
+ }
+
+ ConfigIsLoaded = true;
+ }
+
+ void SendFullStatus()
+ {
+ if (ConfigIsLoaded)
+ {
+ var count = EISC.UShortOutput[801].UShortValue;
+
+ Debug.Console(1, this, "The Fader Count is : {0}", count);
+
+ // build volumes object, serialize and put in content of method below
+
+ var auxFaders = new List();
+
+ // Create auxFaders
+ for (uint i = 2; i <= count; i++)
+ {
+ auxFaders.Add(
+ new Volume(string.Format("level-{0}", i),
+ EISC.UShortOutput[i].UShortValue,
+ EISC.BooleanOutput[i].BoolValue,
+ EISC.StringOutput[800 + i].StringValue,
+ true,
+ "someting.png"));
+ }
+
+ var volumes = new Volumes();
+
+ volumes.Master = new Volume("master",
+ EISC.UShortOutput[UshortJoin.MasterVolumeLevel].UShortValue,
+ EISC.BooleanOutput[BoolJoin.MasterVolumeIsMuted].BoolValue,
+ EISC.StringOutput[801].StringValue,
+ true,
+ "something.png");
+
+ volumes.AuxFaders = auxFaders;
+
+ PostStatusMessage(new
+ {
+ isOn = EISC.BooleanOutput[BoolJoin.RoomIsOn].BoolValue,
+ selectedSourceKey = EISC.StringOutput[StringJoin.SelectedSourceKey].StringValue,
+ volumes = volumes
+ });
+ }
+ else
+ {
+ PostStatusMessage(new
+ {
+ error = "systemNotReady"
+ });
+ }
+ }
+
+ ///
+ /// Helper for posting status message
+ ///
+ /// The contents of the content object
+ void PostStatusMessage(object contentObject)
+ {
+ Parent.SendMessageToServer(JObject.FromObject(new
+ {
+ type = "/room/status/",
+ content = contentObject
+ }));
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ void PostMessage(string messageType, object contentObject)
+ {
+ Parent.SendMessageToServer(JObject.FromObject(new
+ {
+ type = messageType,
+ content = contentObject
+ }));
+ }
+
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ void EISC_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
+ {
+ if (Debug.Level >= 1)
+ Debug.Console(1, this, "DDVC EISC change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
+ var uo = args.Sig.UserObject;
+ if (uo is Action)
+ (uo as Action)(args.Sig.BoolValue);
+ else if (uo is Action)
+ (uo as Action)(args.Sig.UShortValue);
+ else if (uo is Action)
+ (uo as Action)(args.Sig.StringValue);
+ }
+
+ ///
+ /// Returns the mapping of types to groups, for setting up devices.
+ ///
+ ///
+ Dictionary GetSourceGroupDictionary()
+ {
+ //type, group
+ var d = new Dictionary(StringComparer.OrdinalIgnoreCase)
+ {
+ { "laptop", "pc" },
+ { "wireless", "genericsource" },
+ { "iptv", "settopbox" }
+
+ };
+ return d;
+ }
+
+ ///
+ /// updates the usercode from server
+ ///
+ protected override void UserCodeChange()
+ {
+ Debug.Console(1, this, "Server user code changed: {0}", UserCode);
+ EISC.StringInput[StringJoin.UserCodeToSystem].StringValue = UserCode;
+ EISC.StringInput[StringJoin.ServerUrl].StringValue = Parent.Config.ClientAppUrl;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ void SourceChange(string oldKey, string newKey)
+ {
+ /* Example message
+ * {
+ "type":"/room/status",
+ "content": {
+ "selectedSourceKey": "off",
+ }
+ }
+ */
+ //if (type == ChangeType.WillChange)
+ //{
+ // // Disconnect from previous source
+
+ // if (info != null)
+ // {
+ // var previousDev = info.SourceDevice;
+
+ // // device type interfaces
+ // if (previousDev is ISetTopBoxControls)
+ // (previousDev as ISetTopBoxControls).UnlinkActions(Parent);
+ // // common interfaces
+ // if (previousDev is IChannel)
+ // (previousDev as IChannel).UnlinkActions(Parent);
+ // if (previousDev is IColor)
+ // (previousDev as IColor).UnlinkActions(Parent);
+ // if (previousDev is IDPad)
+ // (previousDev as IDPad).UnlinkActions(Parent);
+ // if (previousDev is IDvr)
+ // (previousDev as IDvr).UnlinkActions(Parent);
+ // if (previousDev is INumericKeypad)
+ // (previousDev as INumericKeypad).UnlinkActions(Parent);
+ // if (previousDev is IPower)
+ // (previousDev as IPower).UnlinkActions(Parent);
+ // if (previousDev is ITransport)
+ // (previousDev as ITransport).UnlinkActions(Parent);
+ // }
+
+
+ // var huddleRoom = room as EssentialsHuddleSpaceRoom;
+ // JObject roomStatus = new JObject();
+ // roomStatus.Add("selectedSourceKey", huddleRoom.CurrentSourceInfoKey);
+
+ // JObject message = new JObject();
+
+ // message.Add("type", "/room/status/");
+ // message.Add("content", roomStatus);
+
+ // Parent.PostToServer(message);
+ //}
+ //else
+ //{
+ // if (info != null)
+ // {
+ // var dev = info.SourceDevice;
+
+ // if (dev is ISetTopBoxControls)
+ // (dev as ISetTopBoxControls).LinkActions(Parent);
+ // if (dev is IChannel)
+ // (dev as IChannel).LinkActions(Parent);
+ // if (dev is IColor)
+ // (dev as IColor).LinkActions(Parent);
+ // if (dev is IDPad)
+ // (dev as IDPad).LinkActions(Parent);
+ // if (dev is IDvr)
+ // (dev as IDvr).LinkActions(Parent);
+ // if (dev is INumericKeypad)
+ // (dev as INumericKeypad).LinkActions(Parent);
+ // if (dev is IPower)
+ // (dev as IPower).LinkActions(Parent);
+ // if (dev is ITransport)
+ // (dev as ITransport).LinkActions(Parent);
+ // }
+ //}
+ }
+ }
}
\ No newline at end of file
diff --git a/PepperDashEssentials/Room/Cotija/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs b/PepperDashEssentials/Room/Cotija/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs
index cae7555d..74f03937 100644
--- a/PepperDashEssentials/Room/Cotija/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs
+++ b/PepperDashEssentials/Room/Cotija/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs
@@ -31,7 +31,7 @@ namespace PepperDash.Essentials
///
///
///
- public CotijaEssentialsHuddleSpaceRoomBridge(EssentialsHuddleSpaceRoom room):
+ public CotijaEssentialsHuddleSpaceRoomBridge(EssentialsRoomBase room):
base("mobileControlBridge-essentialsHuddle", "Essentials Mobile Control Bridge-Huddle")
{
Room = room;
@@ -59,7 +59,7 @@ namespace PepperDash.Essentials
var defaultRoom = Room as IRunDefaultPresentRoute;
if(defaultRoom != null)
- Parent.AddAction(string.Format(@"/room/{0}/defaultsource", Room.Key), new Action(defaultRoom.RunDefaultPresentRoute));
+ Parent.AddAction(string.Format(@"/room/{0}/defaultsource", Room.Key), new Action(() => defaultRoom.RunDefaultPresentRoute()));
var vcRoom = Room as IHasCurrentVolumeControls;
if (vcRoom != null)
@@ -71,15 +71,11 @@ namespace PepperDash.Essentials
vcRoom.CurrentVolumeDeviceChange += new EventHandler(Room_CurrentVolumeDeviceChange);
// Registers for initial volume events, if possible
- var currentVolumeDevice = vcRoom.CurrentVolumeControls;
+ var currentVolumeDevice = vcRoom.CurrentVolumeControls as IBasicVolumeWithFeedback;
if (currentVolumeDevice != null)
{
- if (currentVolumeDevice is IBasicVolumeWithFeedback)
- {
- var newDev = currentVolumeDevice as IBasicVolumeWithFeedback;
- newDev.MuteFeedback.OutputChange += VolumeLevelFeedback_OutputChange;
- newDev.VolumeLevelFeedback.OutputChange += VolumeLevelFeedback_OutputChange;
- }
+ currentVolumeDevice.MuteFeedback.OutputChange += VolumeLevelFeedback_OutputChange;
+ currentVolumeDevice.VolumeLevelFeedback.OutputChange += VolumeLevelFeedback_OutputChange;
}
}
@@ -166,14 +162,12 @@ namespace PepperDash.Essentials
///
///
///
- void IsWarmingUpFeedback_OutputChange(object sender, EventArgs e)
+ void IsWarmingUpFeedback_OutputChange(object sender, FeedbackEventArgs e)
{
- JObject roomStatus = new JObject();
- roomStatus.Add("isWarmingUp", (sender as BoolFeedback).BoolValue);
- JObject message = new JObject();
- message.Add("type", "/room/status/");
- message.Add("content", roomStatus);
- Parent.SendMessageToServer(message);
+ PostStatusMessage(new
+ {
+ isWarmingUp = e.BoolValue
+ });
}
///
@@ -181,14 +175,12 @@ namespace PepperDash.Essentials
///
///
///
- void IsCoolingDownFeedback_OutputChange(object sender, EventArgs e)
+ void IsCoolingDownFeedback_OutputChange(object sender, FeedbackEventArgs e)
{
- JObject roomStatus = new JObject();
- roomStatus.Add("isCoolingDown", (sender as BoolFeedback).BoolValue);
- JObject message = new JObject();
- message.Add("type", "/room/status/");
- message.Add("content", roomStatus);
- Parent.SendMessageToServer(message);
+ PostStatusMessage(new
+ {
+ isCoolingDown = e.BoolValue
+ });
}
///
@@ -196,27 +188,12 @@ namespace PepperDash.Essentials
///
///
///
- void OnFeedback_OutputChange(object sender, EventArgs e)
+ void OnFeedback_OutputChange(object sender, FeedbackEventArgs e)
{
- /* Example message
- * {
- "type":"/room/status",
- "content": {
- "isOn": false
- }
- }
- */
-
- JObject roomStatus = new JObject();
-
- roomStatus.Add("isOn", (sender as BoolFeedback).BoolValue);
-
- JObject message = new JObject();
-
- message.Add("type", "/room/status/");
- message.Add("content", roomStatus);
-
- Parent.SendMessageToServer(message);
+ PostStatusMessage(new
+ {
+ isOn = e.BoolValue
+ });
}
void Room_CurrentVolumeDeviceChange(object sender, VolumeDeviceChangeEventArgs e)
@@ -224,56 +201,53 @@ namespace PepperDash.Essentials
if (e.OldDev is IBasicVolumeWithFeedback)
{
var oldDev = e.OldDev as IBasicVolumeWithFeedback;
-
- oldDev.MuteFeedback.OutputChange -= VolumeLevelFeedback_OutputChange;
+ oldDev.MuteFeedback.OutputChange -= MuteFeedback_OutputChange;
oldDev.VolumeLevelFeedback.OutputChange -= VolumeLevelFeedback_OutputChange;
}
if (e.NewDev is IBasicVolumeWithFeedback)
{
var newDev = e.NewDev as IBasicVolumeWithFeedback;
-
- newDev.MuteFeedback.OutputChange += VolumeLevelFeedback_OutputChange;
+ newDev.MuteFeedback.OutputChange += MuteFeedback_OutputChange;
newDev.VolumeLevelFeedback.OutputChange += VolumeLevelFeedback_OutputChange;
}
}
- void VolumeLevelFeedback_OutputChange(object sender, EventArgs e)
+ ///
+ /// Event handler for mute changes
+ ///
+ void MuteFeedback_OutputChange(object sender, FeedbackEventArgs e)
+ {
+ PostStatusMessage(new
+ {
+ volumes = new
+ {
+ master = new
+ {
+ muted = e.BoolValue
+ }
+ }
+ });
+ }
+
+ ///
+ /// Handles Volume changes on room
+ ///
+ void VolumeLevelFeedback_OutputChange(object sender, FeedbackEventArgs e)
{
- /* Example message
- * {
- "type":"/room/status",
- "content": {
- "masterVolumeLevel": 12345,
- "masterVolumeMuteState": false
- }
- }
- */
-
- var huddleRoom = Room as EssentialsHuddleSpaceRoom;
-
- if(huddleRoom.CurrentVolumeControls is IBasicVolumeWithFeedback)
- {
-
-
- JObject roomStatus = new JObject();
-
- if (huddleRoom.CurrentVolumeControls is IBasicVolumeWithFeedback)
- {
- var currentVolumeConstrols = huddleRoom.CurrentVolumeControls as IBasicVolumeWithFeedback;
- roomStatus.Add("masterVolumeLevel", currentVolumeConstrols.VolumeLevelFeedback.IntValue);
- roomStatus.Add("masterVolumeMuteState", currentVolumeConstrols.MuteFeedback.BoolValue);
- }
-
- JObject message = new JObject();
-
- message.Add("type", "/room/status/");
- message.Add("content", roomStatus);
-
- Parent.SendMessageToServer(message);
- }
+ PostStatusMessage(new
+ {
+ volumes = new
+ {
+ master = new
+ {
+ level = e.IntValue
+ }
+ }
+ });
}
+
void Room_CurrentSingleSourceChange(EssentialsRoomBase room, PepperDash.Essentials.Core.SourceListItem info, ChangeType type)
{
/* Example message
@@ -335,16 +309,11 @@ namespace PepperDash.Essentials
if (dev is ITransport)
(dev as ITransport).LinkActions(Parent);
- var huddleRoom = room as EssentialsHuddleSpaceRoom;
- JObject roomStatus = new JObject();
- roomStatus.Add("selectedSourceKey", huddleRoom.CurrentSourceInfoKey);
-
- JObject message = new JObject();
-
- message.Add("type", "/room/status/");
- message.Add("content", roomStatus);
-
- Parent.SendMessageToServer(message);
+ var srcRm = room as IHasCurrentSourceInfoChange;
+ PostStatusMessage(new
+ {
+ selectedSourceKey = srcRm.CurrentSourceInfoKey
+ });
}
}
}
@@ -355,39 +324,21 @@ namespace PepperDash.Essentials
///
void Room_RoomFullStatus(EssentialsRoomBase room)
{
- /* Example message
- * {
- "type":"/room/status",
- "content": {
- "selectedSourceKey": "off",
- "isOn": false,
- "masterVolumeLevel": 50,
- "masterVolumeMuteState": false
- }
- }
- */
-
- JObject roomStatus = new JObject();
-
- var huddleRoom = room as EssentialsHuddleSpaceRoom;
- roomStatus.Add("isOn", huddleRoom.OnFeedback.BoolValue);
- roomStatus.Add("selectedSourceKey", huddleRoom.CurrentSourceInfoKey);
-
-
- if(huddleRoom.CurrentVolumeControls is IBasicVolumeWithFeedback)
- {
- var currentVolumeConstrols = huddleRoom.CurrentVolumeControls as IBasicVolumeWithFeedback;
- roomStatus.Add("masterVolumeLevel", currentVolumeConstrols.VolumeLevelFeedback.IntValue);
- roomStatus.Add("masterVolumeMuteState", currentVolumeConstrols.MuteFeedback.BoolValue);
- }
-
- JObject message = new JObject();
-
- message.Add("type", "/room/status/");
- message.Add("content", roomStatus);
-
- Parent.SendMessageToServer(message);
+ var sourceKey = room is IHasCurrentSourceInfoChange ? (room as IHasCurrentSourceInfoChange).CurrentSourceInfoKey : null;
+
+ var rmVc = room as IHasCurrentVolumeControls as IBasicVolumeWithFeedback;
+ var volumes = new Volumes();
+ if (rmVc != null)
+ {
+ volumes.Master = new Volume("master", rmVc.VolumeLevelFeedback.UShortValue, rmVc.MuteFeedback.BoolValue, "Volume", true, "");
+ }
+ PostStatusMessage(new
+ {
+ isOn = room.OnFeedback.BoolValue,
+ selectedSourceKey = sourceKey,
+ volumes = volumes
+ });
}
}
@@ -395,8 +346,6 @@ namespace PepperDash.Essentials
public class SourceSelectMessageContent
{
public string SourceListItem { get; set; }
- //public string Destination { get; set; }
- //public string SourceSelect { get; set; }
}
public delegate void PressAndHoldAction(bool b);
diff --git a/PepperDashEssentials/Room/Cotija/RoomBridges/SourceDeviceMapDictionary.cs b/PepperDashEssentials/Room/Cotija/RoomBridges/SourceDeviceMapDictionary.cs
new file mode 100644
index 00000000..341f77dd
--- /dev/null
+++ b/PepperDashEssentials/Room/Cotija/RoomBridges/SourceDeviceMapDictionary.cs
@@ -0,0 +1,104 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Crestron.SimplSharp;
+
+namespace PepperDash.Essentials.Room.Cotija
+{
+
+ ///
+ /// Contains all of the default joins that map to API funtions
+ ///
+ public class SourceDeviceMapDictionary : Dictionary
+ {
+
+ public SourceDeviceMapDictionary(): base()
+ {
+ var dictionary = new Dictionary
+ {
+ {"preset01", 101},
+ {"preset02", 102},
+ {"preset03", 103},
+ {"preset04", 104},
+ {"preset05", 105},
+ {"preset06", 106},
+ {"preset07", 107},
+ {"preset08", 108},
+ {"preset09", 109},
+ {"preset10", 110},
+ {"preset11", 111},
+ {"preset12", 112},
+ {"preset13", 113},
+ {"preset14", 114},
+ {"preset15", 115},
+ {"preset16", 116},
+ {"preset17", 117},
+ {"preset18", 118},
+ {"preset19", 119},
+ {"preset20", 120},
+ {"preset21", 121},
+ {"preset22", 122},
+ {"preset23", 123},
+ {"preset24", 124},
+
+ {"num0", 130},
+ {"num1", 131},
+ {"num2", 132},
+ {"num3", 133},
+ {"num4", 134},
+ {"num5", 135},
+ {"num6", 136},
+ {"num7", 137},
+ {"num8", 138},
+ {"num9", 139},
+ {"numDash", 140},
+ {"numEnter", 141},
+ {"chanUp", 142},
+ {"chanDown", 143},
+ {"lastChan", 144},
+ {"exit", 145},
+ {"powerToggle", 146},
+ {"red", 147},
+ {"green", 148},
+ {"yellow", 149},
+ {"blue", 150},
+ {"video", 151},
+ {"previous", 152},
+ {"next", 153},
+ {"rewind", 154},
+ {"ffwd", 155},
+ {"closedCaption", 156},
+ {"stop", 157},
+ {"pause", 158},
+ {"up", 159},
+ {"down", 160},
+ {"left", 161},
+ {"right", 162},
+ {"settings", 163},
+ {"info", 164},
+ {"return", 165},
+ {"guide", 166},
+ {"reboot", 167},
+ {"dvrList", 168},
+ {"replay", 169},
+ {"play", 170},
+ {"select", 171},
+ {"record", 172},
+ {"menu", 173},
+ {"topMenu", 174},
+ {"prevTrack", 175},
+ {"nextTrack", 176},
+ {"powerOn", 177},
+ {"powerOff", 178},
+ {"dot", 179}
+
+ };
+
+ foreach (var item in dictionary)
+ {
+ this.Add(item.Key, item.Value);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/PepperDashEssentials/Room/Cotija/Volumes.cs b/PepperDashEssentials/Room/Cotija/Volumes.cs
new file mode 100644
index 00000000..f266b486
--- /dev/null
+++ b/PepperDashEssentials/Room/Cotija/Volumes.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Crestron.SimplSharp;
+
+using Newtonsoft.Json;
+
+namespace PepperDash.Essentials.Room.Cotija
+{
+ public class Volumes
+ {
+ [JsonProperty("master")]
+ public Volume Master { get; set; }
+
+ [JsonProperty("auxFaders")]
+ public List AuxFaders { get; set; }
+ }
+
+ public class Volume
+ {
+ [JsonProperty("key")]
+ public string Key { get; set; }
+
+ [JsonProperty("level")]
+ public ushort Level { get; set; }
+
+ [JsonProperty("muted")]
+ public bool Muted { get; set; }
+
+ [JsonProperty("label")]
+ public string Label { get; set; }
+
+ [JsonProperty("hasMute")]
+ public bool HasMute { get; set; }
+
+ [JsonProperty("muteIcon")]
+ public string MuteIcon { get; set; }
+
+ public Volume(string key, ushort level, bool muted, string label, bool hasMute, string muteIcon)
+ {
+ Key = key;
+ Level = level;
+ Muted = muted;
+ Label = label;
+ HasMute = hasMute;
+ MuteIcon = muteIcon;
+ }
+ }
+}
\ No newline at end of file
diff --git a/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs b/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs
index ef001150..5b7bdfde 100644
--- a/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs
+++ b/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs
@@ -212,10 +212,13 @@ namespace PepperDash.Essentials
///
/// Routes the default source item, if any
///
- public void RunDefaultPresentRoute()
+ public bool RunDefaultPresentRoute()
{
- //if (DefaultSourceItem != null && !OnFeedback.BoolValue)
+ if(DefaultSourceItem == null)
+ return false;
+
RunRouteAction(DefaultSourceItem);
+ return true;
}
///
diff --git a/PepperDashEssentials/Room/Types/EssentialsPresentationRoom.cs b/PepperDashEssentials/Room/Types/EssentialsPresentationRoom.cs
index 86de8977..c21c265f 100644
--- a/PepperDashEssentials/Room/Types/EssentialsPresentationRoom.cs
+++ b/PepperDashEssentials/Room/Types/EssentialsPresentationRoom.cs
@@ -1,437 +1,437 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Crestron.SimplSharp;
+//using System;
+//using System.Collections.Generic;
+//using System.Linq;
+//using System.Text;
+//using Crestron.SimplSharp;
-using PepperDash.Core;
-using PepperDash.Essentials.Core;
-using PepperDash.Essentials.Room.Config;
+//using PepperDash.Core;
+//using PepperDash.Essentials.Core;
+//using PepperDash.Essentials.Room.Config;
-namespace PepperDash.Essentials
-{
- public class EssentialsPresentationRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange
- {
- public event EventHandler CurrentVolumeDeviceChange;
- public event SourceInfoChangeHandler CurrentSingleSourceChange;
- public event SourceInfoChangeHandler CurrentDisplay1SourceChange;
- public event SourceInfoChangeHandler CurrentDisplay2SourceChange;
+//namespace PepperDash.Essentials
+//{
+// public class EssentialsPresentationRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange
+// {
+// public event EventHandler CurrentVolumeDeviceChange;
+// public event SourceInfoChangeHandler CurrentSingleSourceChange;
+// public event SourceInfoChangeHandler CurrentDisplay1SourceChange;
+// public event SourceInfoChangeHandler CurrentDisplay2SourceChange;
- protected override Func OnFeedbackFunc { get {
- return () => (CurrentSingleSourceInfo != null
- && CurrentSingleSourceInfo.Type != eSourceListItemType.Off)
- || (Display1SourceInfo != null
- && Display1SourceInfo.Type != eSourceListItemType.Off)
- || (Display2SourceInfo != null
- && Display2SourceInfo.Type != eSourceListItemType.Off); } }
+// protected override Func OnFeedbackFunc { get {
+// return () => (CurrentSingleSourceInfo != null
+// && CurrentSingleSourceInfo.Type != eSourceListItemType.Off)
+// || (Display1SourceInfo != null
+// && Display1SourceInfo.Type != eSourceListItemType.Off)
+// || (Display2SourceInfo != null
+// && Display2SourceInfo.Type != eSourceListItemType.Off); } }
- protected override Func IsWarmingFeedbackFunc { get { return () =>false;; } }
- protected override Func IsCoolingFeedbackFunc { get { return () => false; } }
+// protected override Func IsWarmingFeedbackFunc { get { return () =>false;; } }
+// protected override Func IsCoolingFeedbackFunc { get { return () => false; } }
- public EssentialsPresentationRoomPropertiesConfig Config { get; private set; }
+// public EssentialsPresentationRoomPropertiesConfig Config { get; private set; }
- public Dictionary Displays { get; private set; }
+// public Dictionary Displays { get; private set; }
- public IRoutingSinkNoSwitching DefaultAudioDevice { get; private set; }
- public IBasicVolumeControls DefaultVolumeControls { get; private set; }
+// public IRoutingSinkNoSwitching DefaultAudioDevice { get; private set; }
+// public IBasicVolumeControls DefaultVolumeControls { get; private set; }
- ///
- /// The config name of the source list
- ///
- public string SourceListKey { get; set; }
+// ///
+// /// The config name of the source list
+// ///
+// public string SourceListKey { get; set; }
- ///
- /// If room is off, enables power on to last source. Default true
- ///
- public bool EnablePowerOnToLastSource { get; set; }
- string LastSourceKey;
+// ///
+// /// If room is off, enables power on to last source. Default true
+// ///
+// public bool EnablePowerOnToLastSource { get; set; }
+// string LastSourceKey;
- public enum eVideoRoutingMode
- {
- SelectSourceSelectDisplay, SourceToAllDisplays
- }
+// public enum eVideoRoutingMode
+// {
+// SelectSourceSelectDisplay, SourceToAllDisplays
+// }
- public eVideoRoutingMode VideoRoutingMode { get; set; }
+// public eVideoRoutingMode VideoRoutingMode { get; set; }
- public enum eAudioRoutingMode
- {
- AudioFollowsLastVideo, SelectAudioFromDisplay
- }
+// public enum eAudioRoutingMode
+// {
+// AudioFollowsLastVideo, SelectAudioFromDisplay
+// }
- ///
- ///
- ///
- public IBasicVolumeControls CurrentVolumeControls
- {
- get { return _CurrentAudioDevice; }
- set
- {
- if (value == _CurrentAudioDevice) return;
+// ///
+// ///
+// ///
+// 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;
+// 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;
- ///
- /// The SourceListItem last run - containing names and icons. The complex setter is
- /// to add/remove this room to the source's InUseTracking, if it is capable
- ///
- public SourceListItem CurrentSingleSourceInfo
- {
- get { return _CurrentSingleSourceInfo; }
- private set
- {
- if (value == _CurrentSingleSourceInfo) return;
+// ///
+// /// The SourceListItem last run - containing names and icons. The complex setter is
+// /// to add/remove this room to the source's InUseTracking, if it is capable
+// ///
+// public SourceListItem CurrentSingleSourceInfo
+// {
+// get { return _CurrentSingleSourceInfo; }
+// private set
+// {
+// if (value == _CurrentSingleSourceInfo) return;
- var handler = CurrentSingleSourceChange;
- // remove from in-use tracker, if so equipped
- if(_CurrentSingleSourceInfo != null && _CurrentSingleSourceInfo.SourceDevice is IInUseTracking)
- (_CurrentSingleSourceInfo.SourceDevice as IInUseTracking).InUseTracker.RemoveUser(this, "control");
+// var handler = CurrentSingleSourceChange;
+// // remove from in-use tracker, if so equipped
+// if(_CurrentSingleSourceInfo != null && _CurrentSingleSourceInfo.SourceDevice is IInUseTracking)
+// (_CurrentSingleSourceInfo.SourceDevice as IInUseTracking).InUseTracker.RemoveUser(this, "control");
- if (handler != null)
- handler(this, _CurrentSingleSourceInfo, ChangeType.WillChange);
+// if (handler != null)
+// handler(this, _CurrentSingleSourceInfo, ChangeType.WillChange);
- _CurrentSingleSourceInfo = value;
+// _CurrentSingleSourceInfo = value;
- // add to in-use tracking
- if (_CurrentSingleSourceInfo != null && _CurrentSingleSourceInfo.SourceDevice is IInUseTracking)
- (_CurrentSingleSourceInfo.SourceDevice as IInUseTracking).InUseTracker.AddUser(this, "control");
- if (handler != null)
- handler(this, _CurrentSingleSourceInfo, ChangeType.DidChange);
- }
- }
- SourceListItem _CurrentSingleSourceInfo;
+// // add to in-use tracking
+// if (_CurrentSingleSourceInfo != null && _CurrentSingleSourceInfo.SourceDevice is IInUseTracking)
+// (_CurrentSingleSourceInfo.SourceDevice as IInUseTracking).InUseTracker.AddUser(this, "control");
+// if (handler != null)
+// handler(this, _CurrentSingleSourceInfo, ChangeType.DidChange);
+// }
+// }
+// SourceListItem _CurrentSingleSourceInfo;
- public SourceListItem Display1SourceInfo
- {
- get { return _Display1SourceInfo; }
- set
- {
- if (value == _Display1SourceInfo) return;
+// public SourceListItem Display1SourceInfo
+// {
+// get { return _Display1SourceInfo; }
+// set
+// {
+// if (value == _Display1SourceInfo) return;
- var handler = CurrentDisplay1SourceChange;
- if (handler != null)
- handler(this, _Display1SourceInfo, ChangeType.WillChange);
+// var handler = CurrentDisplay1SourceChange;
+// if (handler != null)
+// handler(this, _Display1SourceInfo, ChangeType.WillChange);
- _Display1SourceInfo = value;
+// _Display1SourceInfo = value;
- if (handler != null)
- handler(this, _Display1SourceInfo, ChangeType.DidChange);
- }
- }
- SourceListItem _Display1SourceInfo;
+// if (handler != null)
+// handler(this, _Display1SourceInfo, ChangeType.DidChange);
+// }
+// }
+// SourceListItem _Display1SourceInfo;
- public SourceListItem Display2SourceInfo
- {
- get { return _Display2SourceInfo; }
- set
- {
- if (value == _Display2SourceInfo) return;
+// public SourceListItem Display2SourceInfo
+// {
+// get { return _Display2SourceInfo; }
+// set
+// {
+// if (value == _Display2SourceInfo) return;
- var handler = CurrentDisplay2SourceChange;
- if (handler != null)
- handler(this, _Display2SourceInfo, ChangeType.WillChange);
+// var handler = CurrentDisplay2SourceChange;
+// if (handler != null)
+// handler(this, _Display2SourceInfo, ChangeType.WillChange);
- _Display2SourceInfo = value;
+// _Display2SourceInfo = value;
- if (handler != null)
- handler(this, _Display2SourceInfo, ChangeType.DidChange);
- }
- }
- SourceListItem _Display2SourceInfo;
+// if (handler != null)
+// handler(this, _Display2SourceInfo, ChangeType.DidChange);
+// }
+// }
+// SourceListItem _Display2SourceInfo;
- ///
- /// If an audio dialer is available for this room
- ///
- public bool HasAudioDialer { get { return false; } }
- ///
- ///
- ///
- ///
- ///
- public EssentialsPresentationRoom(string key, string name,
- Dictionary displays,
- IBasicVolumeWithFeedback defaultVolume, EssentialsPresentationRoomPropertiesConfig config)
- : base(key, name)
- {
- Config = config;
- Displays = displays;
+// ///
+// /// If an audio dialer is available for this room
+// ///
+// public bool HasAudioDialer { get { return false; } }
+// ///
+// ///
+// ///
+// ///
+// ///
+// public EssentialsPresentationRoom(string key, string name,
+// Dictionary displays,
+// IBasicVolumeWithFeedback defaultVolume, EssentialsPresentationRoomPropertiesConfig config)
+// : base(key, name)
+// {
+// Config = config;
+// Displays = displays;
- DefaultVolumeControls = defaultVolume;
- CurrentVolumeControls = defaultVolume;
+// DefaultVolumeControls = defaultVolume;
+// CurrentVolumeControls = defaultVolume;
- //DefaultAudioDevice = defaultAudio;
- //if (defaultAudio is IBasicVolumeControls)
- // DefaultVolumeControls = defaultAudio as IBasicVolumeControls;
- //else if (defaultAudio is IHasVolumeDevice)
- // DefaultVolumeControls = (defaultAudio as IHasVolumeDevice).VolumeDevice;
+// //DefaultAudioDevice = defaultAudio;
+// //if (defaultAudio is IBasicVolumeControls)
+// // DefaultVolumeControls = defaultAudio as IBasicVolumeControls;
+// //else if (defaultAudio is IHasVolumeDevice)
+// // DefaultVolumeControls = (defaultAudio as IHasVolumeDevice).VolumeDevice;
- SourceListKey = "default";
- EnablePowerOnToLastSource = true;
- }
+// SourceListKey = "default";
+// EnablePowerOnToLastSource = true;
+// }
- ///
- /// Run the same source to all destinations
- ///
- ///
- public void RouteSourceToAllDestinations(SourceListItem sourceItem)
- {
- if (Config.Volumes.Master != null)
- {
- var audioDev = DeviceManager.GetDeviceForKey(Config.Volumes.Master.DeviceKey);
- if (audioDev is IBasicVolumeWithFeedback)
- {
+// ///
+// /// Run the same source to all destinations
+// ///
+// ///
+// public void RouteSourceToAllDestinations(SourceListItem sourceItem)
+// {
+// if (Config.Volumes.Master != null)
+// {
+// var audioDev = DeviceManager.GetDeviceForKey(Config.Volumes.Master.DeviceKey);
+// if (audioDev is IBasicVolumeWithFeedback)
+// {
- }
- }
+// }
+// }
- foreach (var display in Displays.Values)
- {
- if (sourceItem != null)
- DoVideoRoute(sourceItem.SourceKey, display.Key);
- else
- DoVideoRoute("$off", display.Key);
- }
- Display1SourceInfo = sourceItem;
- Display2SourceInfo = sourceItem;
- CurrentSingleSourceInfo = sourceItem;
- OnFeedback.FireUpdate();
- }
+// foreach (var display in Displays.Values)
+// {
+// if (sourceItem != null)
+// DoVideoRoute(sourceItem.SourceKey, display.Key);
+// else
+// DoVideoRoute("$off", display.Key);
+// }
+// Display1SourceInfo = sourceItem;
+// Display2SourceInfo = sourceItem;
+// CurrentSingleSourceInfo = sourceItem;
+// OnFeedback.FireUpdate();
+// }
- public void SourceToDisplay1(SourceListItem sourceItem)
- {
- DoVideoRoute(sourceItem.SourceKey, Displays[1].Key);
- Display1SourceInfo = sourceItem;
- OnFeedback.FireUpdate();
- }
+// public void SourceToDisplay1(SourceListItem sourceItem)
+// {
+// DoVideoRoute(sourceItem.SourceKey, Displays[1].Key);
+// Display1SourceInfo = sourceItem;
+// OnFeedback.FireUpdate();
+// }
- public void SourceToDisplay2(SourceListItem sourceItem)
- {
- DoVideoRoute(sourceItem.SourceKey, Displays[2].Key);
- Display2SourceInfo = sourceItem;
- OnFeedback.FireUpdate();
- }
+// public void SourceToDisplay2(SourceListItem sourceItem)
+// {
+// DoVideoRoute(sourceItem.SourceKey, Displays[2].Key);
+// Display2SourceInfo = sourceItem;
+// OnFeedback.FireUpdate();
+// }
- ///
- /// Basic source -> destination routing
- ///
- void DoVideoRoute(string sourceKey, string destinationKey)
- {
- new CTimer(o =>
- {
- var dest = DeviceManager.GetDeviceForKey(destinationKey) as IRoutingSinkNoSwitching;
- if (dest == null)
- {
- Debug.Console(1, this, "Cannot route. Destination '{0}' not found", destinationKey);
- return;
- }
- // off is special case
- if (sourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase))
- {
- dest.ReleaseRoute();
- if (dest is IPower)
- (dest as IPower).PowerOff();
- return;
- }
+// ///
+// /// Basic source -> destination routing
+// ///
+// void DoVideoRoute(string sourceKey, string destinationKey)
+// {
+// new CTimer(o =>
+// {
+// var dest = DeviceManager.GetDeviceForKey(destinationKey) as IRoutingSinkNoSwitching;
+// if (dest == null)
+// {
+// Debug.Console(1, this, "Cannot route. Destination '{0}' not found", destinationKey);
+// return;
+// }
+// // off is special case
+// if (sourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase))
+// {
+// dest.ReleaseRoute();
+// if (dest is IPower)
+// (dest as IPower).PowerOff();
+// return;
+// }
- var source = DeviceManager.GetDeviceForKey(sourceKey) as IRoutingOutputs;
- if (source == null)
- {
- Debug.Console(1, this, "Cannot route. Source '{0}' not found", sourceKey);
- return;
- }
- dest.ReleaseAndMakeRoute(source, eRoutingSignalType.Video);
- }, 0);
- }
+// var source = DeviceManager.GetDeviceForKey(sourceKey) as IRoutingOutputs;
+// if (source == null)
+// {
+// Debug.Console(1, this, "Cannot route. Source '{0}' not found", sourceKey);
+// return;
+// }
+// dest.ReleaseAndMakeRoute(source, eRoutingSignalType.Video);
+// }, 0);
+// }
- ///
- ///
- ///
- protected override void EndShutdown()
- {
- RunRouteAction("roomoff");
- }
+// ///
+// ///
+// ///
+// protected override void EndShutdown()
+// {
+// RunRouteAction("roomoff");
+// }
- ///
- ///
- ///
- ///
- public void RunRouteAction(string routeKey)
- {
- RunRouteAction(routeKey, null);
- }
+// ///
+// ///
+// ///
+// ///
+// public void RunRouteAction(string routeKey)
+// {
+// RunRouteAction(routeKey, null);
+// }
- ///
- /// Gets a source from config list SourceListKey and dynamically build and executes the
- /// route or commands
- ///
- ///
- public void RunRouteAction(string routeKey, Action successCallback)
- {
- // Run this on a separate thread
- new CTimer(o =>
- {
- Debug.Console(1, this, "Run room 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;
- }
+// ///
+// /// Gets a source from config list SourceListKey and dynamically build and executes the
+// /// route or commands
+// ///
+// ///
+// public void RunRouteAction(string routeKey, Action successCallback)
+// {
+// // Run this on a separate thread
+// new CTimer(o =>
+// {
+// Debug.Console(1, this, "Run room 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;
- }
+// // 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;
+// }
- var item = dict[routeKey];
- //Debug.Console(2, this, "Action {0} has {1} steps",
- // item.SourceKey, item.RouteList.Count);
+// var item = dict[routeKey];
+// //Debug.Console(2, this, "Action {0} has {1} steps",
+// // item.SourceKey, item.RouteList.Count);
- // Let's run it
- if (routeKey.ToLower() != "roomoff")
- LastSourceKey = routeKey;
+// // Let's run it
+// if (routeKey.ToLower() != "roomoff")
+// LastSourceKey = routeKey;
- foreach (var route in item.RouteList)
- {
- // if there is a $defaultAll on route, run two separate
- if (route.DestinationKey.Equals("$defaultAll", StringComparison.OrdinalIgnoreCase))
- {
- var tempAudio = new SourceRouteListItem
- {
- DestinationKey = "$defaultDisplay",
- SourceKey = route.SourceKey,
- Type = eRoutingSignalType.Video
- };
- DoRoute(tempAudio);
+// foreach (var route in item.RouteList)
+// {
+// // if there is a $defaultAll on route, run two separate
+// if (route.DestinationKey.Equals("$defaultAll", StringComparison.OrdinalIgnoreCase))
+// {
+// var tempAudio = new SourceRouteListItem
+// {
+// DestinationKey = "$defaultDisplay",
+// SourceKey = route.SourceKey,
+// Type = eRoutingSignalType.Video
+// };
+// DoRoute(tempAudio);
- var tempVideo = new SourceRouteListItem
- {
- DestinationKey = "$defaultAudio",
- SourceKey = route.SourceKey,
- Type = eRoutingSignalType.Audio
- };
- DoRoute(tempVideo);
- continue;
- }
- else
- DoRoute(route);
- }
+// var tempVideo = new SourceRouteListItem
+// {
+// DestinationKey = "$defaultAudio",
+// SourceKey = route.SourceKey,
+// Type = eRoutingSignalType.Audio
+// };
+// DoRoute(tempVideo);
+// continue;
+// }
+// else
+// DoRoute(route);
+// }
- // Set volume control on room, 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;
- //else if (item.VolumeControlKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase))
- // volDev = DefaultDisplay as IBasicVolumeControls;
- // 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;
- }
- CurrentVolumeControls = volDev;
+// // Set volume control on room, 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;
+// //else if (item.VolumeControlKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase))
+// // volDev = DefaultDisplay as IBasicVolumeControls;
+// // 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;
+// }
+// CurrentVolumeControls = volDev;
- // store the name and UI info for routes
- if (item.SourceKey != null)
- CurrentSingleSourceInfo = item;
- // And finally, set the "control". This will trigger event
- //CurrentControlDevice = DeviceManager.GetDeviceForKey(item.SourceKey) as Device;
+// // store the name and UI info for routes
+// if (item.SourceKey != null)
+// CurrentSingleSourceInfo = item;
+// // And finally, set the "control". This will trigger event
+// //CurrentControlDevice = DeviceManager.GetDeviceForKey(item.SourceKey) as Device;
- OnFeedback.FireUpdate();
+// OnFeedback.FireUpdate();
- // report back when done
- if (successCallback != null)
- successCallback();
- }, 0); // end of CTimer
- }
+// // report back when done
+// if (successCallback != null)
+// successCallback();
+// }, 0); // end of CTimer
+// }
- ///
- /// Will power the room on with the last-used source
- ///
- public void PowerOnToDefaultOrLastSource()
- {
- if (!EnablePowerOnToLastSource || LastSourceKey == null)
- return;
- RunRouteAction(LastSourceKey);
- }
+// ///
+// /// Will power the room on with the last-used source
+// ///
+// public void PowerOnToDefaultOrLastSource()
+// {
+// if (!EnablePowerOnToLastSource || LastSourceKey == null)
+// return;
+// RunRouteAction(LastSourceKey);
+// }
- ///
- /// Does what it says
- ///
- public override void SetDefaultLevels()
- {
- Debug.Console(0, this, "SetDefaultLevels not implemented");
- }
+// ///
+// /// Does what it says
+// ///
+// public override void SetDefaultLevels()
+// {
+// Debug.Console(0, this, "SetDefaultLevels not implemented");
+// }
- ///
- ///
- ///
- ///
- ///
- bool DoRoute(SourceRouteListItem route)
- {
- IRoutingSinkNoSwitching dest = null;
+// ///
+// ///
+// ///
+// ///
+// ///
+// bool DoRoute(SourceRouteListItem route)
+// {
+// IRoutingSinkNoSwitching dest = null;
- if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase))
- dest = DefaultAudioDevice;
- //else if (route.DestinationKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase))
- // dest = DefaultDisplay;
- else
- dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSinkNoSwitching;
+// if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase))
+// dest = DefaultAudioDevice;
+// //else if (route.DestinationKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase))
+// // dest = DefaultDisplay;
+// 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 (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);
- }
- return true;
- }
+// 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);
+// }
+// return true;
+// }
- public override void RoomVacatedForTimeoutPeriod(object o)
- {
- //Implement this
- }
+// public override void RoomVacatedForTimeoutPeriod(object o)
+// {
+// //Implement this
+// }
- }
-}
\ No newline at end of file
+// }
+//}
\ No newline at end of file
diff --git a/PepperDashEssentials/UIDrivers/Essentials/EssentialsPresentationPanelAvFunctionsDriver.cs b/PepperDashEssentials/UIDrivers/Essentials/EssentialsPresentationPanelAvFunctionsDriver.cs
index e7e13020..edda29e0 100644
--- a/PepperDashEssentials/UIDrivers/Essentials/EssentialsPresentationPanelAvFunctionsDriver.cs
+++ b/PepperDashEssentials/UIDrivers/Essentials/EssentialsPresentationPanelAvFunctionsDriver.cs
@@ -1,1048 +1,1048 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Crestron.SimplSharp;
-using Crestron.SimplSharpPro;
+//using System;
+//using System.Collections.Generic;
+//using System.Linq;
+//using Crestron.SimplSharp;
+//using Crestron.SimplSharpPro;
-using PepperDash.Core;
-using PepperDash.Essentials.Core;
-using PepperDash.Essentials.Core.Config;
-using PepperDash.Essentials.Core.SmartObjects;
-using PepperDash.Essentials.Core.PageManagers;
+//using PepperDash.Core;
+//using PepperDash.Essentials.Core;
+//using PepperDash.Essentials.Core.Config;
+//using PepperDash.Essentials.Core.SmartObjects;
+//using PepperDash.Essentials.Core.PageManagers;
-namespace PepperDash.Essentials
-{
- ///
- ///
- ///
- public class EssentialsPresentationPanelAvFunctionsDriver : PanelDriverBase
- {
- ///
- /// Smart Object 3200
- ///
- SubpageReferenceList SourcesSrl;
+//namespace PepperDash.Essentials
+//{
+// ///
+// ///
+// ///
+// public class EssentialsPresentationPanelAvFunctionsDriver : PanelDriverBase
+// {
+// ///
+// /// Smart Object 3200
+// ///
+// SubpageReferenceList SourcesSrl;
- ///
- /// For tracking feedback on last selected
- ///
- BoolInputSig LastSelectedSourceSig;
+// ///
+// /// For tracking feedback on last selected
+// ///
+// BoolInputSig LastSelectedSourceSig;
- ///
- /// The source that has been selected and is awaiting assignment to a display
- ///
- SourceListItem PendingSource;
+// ///
+// /// The source that has been selected and is awaiting assignment to a display
+// ///
+// SourceListItem PendingSource;
- bool IsSharingModeAdvanced;
+// bool IsSharingModeAdvanced;
- CrestronTouchpanelPropertiesConfig Config;
+// CrestronTouchpanelPropertiesConfig Config;
- public enum UiDisplayMode
- {
- PresentationMode, AudioSetup
- }
+// public enum UiDisplayMode
+// {
+// PresentationMode, AudioSetup
+// }
- ///
- /// Whether volume ramping from this panel will show the volume
- /// gauge popup.
- ///
- public bool ShowVolumeGauge { get; set; }
+// ///
+// /// Whether volume ramping from this panel will show the volume
+// /// gauge popup.
+// ///
+// public bool ShowVolumeGauge { get; set; }
- ///
- /// The amount of time that the volume buttons stays on screen, in ms
- ///
- public uint VolumeButtonPopupTimeout
- {
- get { return VolumeButtonsPopupFeedback.TimeoutMs; }
- set { VolumeButtonsPopupFeedback.TimeoutMs = value; }
- }
+// ///
+// /// The amount of time that the volume buttons stays on screen, in ms
+// ///
+// public uint VolumeButtonPopupTimeout
+// {
+// get { return VolumeButtonsPopupFeedback.TimeoutMs; }
+// set { VolumeButtonsPopupFeedback.TimeoutMs = value; }
+// }
- ///
- /// The amount of time that the volume gauge stays on screen, in ms
- ///
- public uint VolumeGaugePopupTimeout
- {
- get { return VolumeGaugeFeedback.TimeoutMs; }
- set { VolumeGaugeFeedback.TimeoutMs = value; }
- }
-
- ///
- ///
- ///
- public uint PowerOffTimeout { get; set; }
-
- ///
- ///
- ///
- public string DefaultRoomKey
- {
- get { return _DefaultRoomKey; }
- set
- {
- _DefaultRoomKey = value;
- CurrentRoom = DeviceManager.GetDeviceForKey(value) as EssentialsPresentationRoom;
- }
- }
- string _DefaultRoomKey;
-
- ///
- ///
- ///
- public EssentialsPresentationRoom CurrentRoom
- {
- get { return _CurrentRoom; }
- set
- {
- SetCurrentRoom(value);
- }
- }
- EssentialsPresentationRoom _CurrentRoom;
-
- ///
- /// For hitting feedback
- ///
- BoolInputSig ShareButtonSig;
- BoolInputSig EndMeetingButtonSig;
-
- ///
- /// Controls the extended period that the volume gauge shows on-screen,
- /// as triggered by Volume up/down operations
- ///
- BoolFeedbackPulseExtender VolumeGaugeFeedback;
-
- ///
- /// Controls the period that the volume buttons show on non-hard-button
- /// interfaces
- ///
- BoolFeedbackPulseExtender VolumeButtonsPopupFeedback;
-
- ///
- /// The parent driver for this
- ///
- PanelDriverBase Parent;
-
- /////
- ///// Driver that manages advanced sharing features
- /////
- //DualDisplaySimpleOrAdvancedRouting DualDisplayUiDriver;
-
- ///
- /// All children attached to this driver. For hiding and showing as a group.
- ///
- List ChildDrivers = new List();
-
- List CurrentDisplayModeSigsInUse = new List();
-
- ///
- /// Smart Object 15022
- ///
- SubpageReferenceList ActivityFooterSrl;
-
- ///
- /// Tracks which audio page group the UI is in
- ///
- UiDisplayMode CurrentDisplayMode;
-
- ///
- /// The AV page mangagers that have been used, to keep them alive for later
- ///
- Dictionary