Merge and a whole bunch of work before committing merge, moron

This commit is contained in:
Heath Volmer
2018-08-01 14:23:58 -06:00
25 changed files with 2809 additions and 2227 deletions

View File

@@ -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
{
/// <summary>
/// Base class for all bridge class variants
/// </summary>
public class BridgeBase : Device
{
public BridgeApi Api { get; private set; }
public BridgeBase(string key) :
base(key)
{
}
}
/// <summary>
/// Base class for bridge API variants
/// </summary>
public abstract class BridgeApi : Device
{
public BridgeApi(string key) :
base(key)
{
}
}
/// <summary>
/// Bridge API using EISC
/// </summary>
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();
}
/// <summary>
/// Handles incoming sig changes
/// </summary>
/// <param name="currentDevice"></param>
/// <param name="args"></param>
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<bool>)
(uo as Action<bool>)(args.Sig.BoolValue);
else if (uo is Action<ushort>)
(uo as Action<ushort>)(args.Sig.UShortValue);
else if (uo is Action<string>)
(uo as Action<string>)(args.Sig.StringValue);
}
}
/// <summary>
/// Defines each type and it's matching API type
/// </summary>
public static class DeviceApiFactory
{
public static Dictionary<Type, Type> TypeMap = new Dictionary<Type, Type>
{
{ typeof(DmChassisController), typeof(DmChassisControllerApi) },
{ typeof(IBasicCommunication), typeof(IBasicCommunicationApi) }
//{ typeof(SomeShittyDisplayController), typeof(SomeShittyDisplayControllerApi) }
};
}
/// <summary>
/// API class for IBasicCommunication devices
/// </summary>
public class IBasicCommunicationApi : DeviceApiBase
{
public IBasicCommunication Device { get; set; }
SerialFeedback TextReceivedFeedback;
public IBasicCommunicationApi(IBasicCommunication dev)
{
TextReceivedFeedback = new SerialFeedback();
Device = dev;
SetupFeedbacks();
ActionApi = new Dictionary<string, Object>
{
{ "connect", new Action(Device.Connect) },
{ "disconnect", new Action(Device.Disconnect) },
{ "connectstate", new Action<bool>( b => ConnectByState(b) ) },
{ "sendtext", new Action<string>( s => Device.SendText(s) ) }
};
FeedbackApi = new Dictionary<string, Feedback>
{
{ "isconnected", new BoolFeedback( () => Device.IsConnected ) },
{ "textrecieved", TextReceivedFeedback }
};
}
/// <summary>
/// Controls connection based on state of input
/// </summary>
/// <param name="state"></param>
void ConnectByState(bool state)
{
if (state)
Device.Connect();
else
Device.Disconnect();
}
void SetupFeedbacks()
{
Device.TextReceived += new EventHandler<GenericCommMethodReceiveTextArgs>(Device_TextReceived);
if(Device is ISocketStatus)
(Device as ISocketStatus).ConnectionChange += new EventHandler<GenericSocketStatusChageEventArgs>(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);
}
}
/// <summary>
/// Each flavor of API is a static class with static properties and a static constructor that
/// links up the things to do.
/// </summary>
public class DmChassisControllerApi : DeviceApiBase
{
IntFeedback Output1Feedback;
IntFeedback Output2Feedback;
public DmChassisControllerApi(DmChassisController dev)
{
Output1Feedback = new IntFeedback( new Func<int>(() => 1));
Output2Feedback = new IntFeedback( new Func<int>(() => 2));
ActionApi = new Dictionary<string, Object>
{
};
FeedbackApi = new Dictionary<string, Feedback>
{
{ "Output-1/fb", Output1Feedback },
{ "Output-2/fb", Output2Feedback }
};
}
/// <summary>
/// Factory method
/// </summary>
/// <param name="dev"></param>
/// <returns></returns>
public static DmChassisControllerApi GetActionApiForDevice(DmChassisController dev)
{
return new DmChassisControllerApi(dev);
}
}
}

View File

@@ -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<EiscBridgeProperties>(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<IBasicCommunication> CommDevices { get; private set; }
public CommBridge(string key, string name, JToken properties)
: base(key, name)
{
Properties = JsonConvert.DeserializeObject<CommBridgeProperties>(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<EiscProperties> 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<string> 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<bool>)
(uo as Action<bool>)(args.Sig.BoolValue);
else if (uo is Action<ushort>)
(uo as Action<ushort>)(args.Sig.UShortValue);
else if (uo is Action<string>)
(uo as Action<string>)(args.Sig.StringValue);
}
}
}

View File

@@ -30,10 +30,11 @@ namespace PepperDash.Essentials
{ {
get get
{ {
if (string.IsNullOrEmpty(SystemUrl))
return "missing url";
var result = Regex.Match(SystemUrl, @"https?:\/\/.*\/systems\/(.*)\/#.*"); var result = Regex.Match(SystemUrl, @"https?:\/\/.*\/systems\/(.*)\/#.*");
string uuid = result.Groups[1].Value; string uuid = result.Groups[1].Value;
return uuid; return uuid;
} }
} }
@@ -43,10 +44,11 @@ namespace PepperDash.Essentials
{ {
get 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; string uuid = result.Groups[1].Value;
return uuid; return uuid;
} }
} }

View File

@@ -291,7 +291,7 @@ namespace PepperDash.Essentials
foreach (var roomConfig in ConfigReader.ConfigObject.Rooms) foreach (var roomConfig in ConfigReader.ConfigObject.Rooms)
{ {
var room = roomConfig.GetRoomObject(); var room = roomConfig.GetRoomObject() as EssentialsRoomBase;
if (room != null) if (room != null)
{ {
if (room is EssentialsHuddleSpaceRoom) if (room is EssentialsHuddleSpaceRoom)
@@ -319,7 +319,7 @@ namespace PepperDash.Essentials
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Cotija Bridge..."); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Cotija Bridge...");
// 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 AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present
DeviceManager.AddDevice(bridge); DeviceManager.AddDevice(bridge);
} }

View File

@@ -105,6 +105,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Audio\EssentialsVolumeLevelConfig.cs" /> <Compile Include="Audio\EssentialsVolumeLevelConfig.cs" />
<Compile Include="Bridges\BridgeBase.cs" />
<Compile Include="Bridges\BridgeFactory.cs" />
<Compile Include="Configuration ORIGINAL\Builders\TPConfig.cs" /> <Compile Include="Configuration ORIGINAL\Builders\TPConfig.cs" />
<Compile Include="Configuration ORIGINAL\Configuration.cs" /> <Compile Include="Configuration ORIGINAL\Configuration.cs" />
<Compile Include="Configuration ORIGINAL\ConfigurationHelpers.cs" /> <Compile Include="Configuration ORIGINAL\ConfigurationHelpers.cs" />
@@ -154,6 +156,8 @@
<Compile Include="Room\Cotija\DeviceTypeInterfaces\IPowerExtensions.cs" /> <Compile Include="Room\Cotija\DeviceTypeInterfaces\IPowerExtensions.cs" />
<Compile Include="Room\Cotija\DeviceTypeInterfaces\ISetTopBoxControlsExtensions.cs" /> <Compile Include="Room\Cotija\DeviceTypeInterfaces\ISetTopBoxControlsExtensions.cs" />
<Compile Include="Room\Cotija\DeviceTypeInterfaces\ITransportExtensions.cs" /> <Compile Include="Room\Cotija\DeviceTypeInterfaces\ITransportExtensions.cs" />
<Compile Include="Room\Cotija\RoomBridges\SourceDeviceMapDictionary.cs" />
<Compile Include="Room\Cotija\Volumes.cs" />
<Compile Include="Room\Emergency\EsentialsRoomEmergencyContactClosure.cs" /> <Compile Include="Room\Emergency\EsentialsRoomEmergencyContactClosure.cs" />
<Compile Include="Room\Types\EssentialsHuddleVtc1Room.cs" /> <Compile Include="Room\Types\EssentialsHuddleVtc1Room.cs" />
<Compile Include="Room\Types\EssentialsPresentationRoom.cs" /> <Compile Include="Room\Types\EssentialsPresentationRoom.cs" />
@@ -178,7 +182,7 @@
<Compile Include="UI\SubpageReferenceListCallStagingItem.cs" /> <Compile Include="UI\SubpageReferenceListCallStagingItem.cs" />
<Compile Include="UIDrivers\VC\EssentialsVideoCodecUiDriver.cs" /> <Compile Include="UIDrivers\VC\EssentialsVideoCodecUiDriver.cs" />
<Compile Include="UIDrivers\EssentialsHuddleVTC\EssentialsHuddleVtc1PanelAvFunctionsDriver.cs" /> <Compile Include="UIDrivers\EssentialsHuddleVTC\EssentialsHuddleVtc1PanelAvFunctionsDriver.cs" />
<Compile Include="UIDrivers\VolumeAndSourceChangeArgs.cs" /> <Compile Include="UIDrivers\SourceChangeArgs.cs" />
<Compile Include="UI\JoinConstants\UISmartObjectJoin.cs" /> <Compile Include="UI\JoinConstants\UISmartObjectJoin.cs" />
<Compile Include="UI\JoinConstants\UIStringlJoin.cs" /> <Compile Include="UI\JoinConstants\UIStringlJoin.cs" />
<Compile Include="UI\JoinConstants\UIUshortJoin.cs" /> <Compile Include="UI\JoinConstants\UIUshortJoin.cs" />

View File

@@ -4,5 +4,5 @@
[assembly: AssemblyCompany("PepperDash Technology Corp")] [assembly: AssemblyCompany("PepperDash Technology Corp")]
[assembly: AssemblyProduct("PepperDashEssentials")] [assembly: AssemblyProduct("PepperDashEssentials")]
[assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2017")] [assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2017")]
[assembly: AssemblyVersion("1.2.4.*")] [assembly: AssemblyVersion("1.2.5.*")]

View File

@@ -39,25 +39,25 @@ namespace PepperDash.Essentials.Room.Config
huddle.DefaultVolume = (ushort)(props.Volumes.Master.Level * 65535 / 100); huddle.DefaultVolume = (ushort)(props.Volumes.Master.Level * 65535 / 100);
return huddle; return huddle;
} }
else if (typeName == "presentation") //else if (typeName == "presentation")
{ //{
var props = JsonConvert.DeserializeObject<EssentialsPresentationRoomPropertiesConfig> // var props = JsonConvert.DeserializeObject<EssentialsPresentationRoomPropertiesConfig>
(this.Properties.ToString()); // (this.Properties.ToString());
var displaysDict = new Dictionary<uint, IRoutingSinkNoSwitching>(); // var displaysDict = new Dictionary<uint, IRoutingSinkNoSwitching>();
uint i = 1; // uint i = 1;
foreach (var dispKey in props.DisplayKeys) // read in the ordered displays list // foreach (var dispKey in props.DisplayKeys) // read in the ordered displays list
{ // {
var disp = DeviceManager.GetDeviceForKey(dispKey) as IRoutingSinkWithSwitching; // var disp = DeviceManager.GetDeviceForKey(dispKey) as IRoutingSinkWithSwitching;
displaysDict.Add(i++, disp); // displaysDict.Add(i++, disp);
} // }
// Get the master volume control // // Get the master volume control
IBasicVolumeWithFeedback masterVolumeControlDev = props.Volumes.Master.GetDevice(); // IBasicVolumeWithFeedback masterVolumeControlDev = props.Volumes.Master.GetDevice();
var presRoom = new EssentialsPresentationRoom(Key, Name, displaysDict, masterVolumeControlDev, props); // var presRoom = new EssentialsPresentationRoom(Key, Name, displaysDict, masterVolumeControlDev, props);
return presRoom; // return presRoom;
} //}
else if (typeName == "huddlevtc1") else if (typeName == "huddlevtc1")
{ {
var props = JsonConvert.DeserializeObject<EssentialsHuddleVtc1PropertiesConfig> var props = JsonConvert.DeserializeObject<EssentialsHuddleVtc1PropertiesConfig>

View File

@@ -82,6 +82,36 @@ namespace PepperDash.Essentials
CrestronConsole.AddNewConsoleCommand(TestHttpRequest, CrestronConsole.AddNewConsoleCommand(TestHttpRequest,
"mobilehttprequest", "Tests an HTTP get to URL given", ConsoleAccessLevelEnum.AccessOperator); "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);
}
/// <summary>
/// Sends message to server to indicate the system is shutting down
/// </summary>
/// <param name="programEventType"></param>
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);
}
} }
/// <summary> /// <summary>
@@ -258,7 +288,6 @@ namespace PepperDash.Essentials
confObject.Info.RuntimeInfo.AppName = Assembly.GetExecutingAssembly().GetName().Name; confObject.Info.RuntimeInfo.AppName = Assembly.GetExecutingAssembly().GetName().Name;
var version = Assembly.GetExecutingAssembly().GetName().Version; var version = Assembly.GetExecutingAssembly().GetName().Version;
confObject.Info.RuntimeInfo.AssemblyVersion = string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build); 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); string postBody = JsonConvert.SerializeObject(confObject);
SystemUuid = confObject.SystemUuid; SystemUuid = confObject.SystemUuid;
@@ -452,8 +481,8 @@ namespace PepperDash.Essentials
{ {
SendMessageToServer(JObject.FromObject(new SendMessageToServer(JObject.FromObject(new
{ {
type = "/heartbeat-ack" type = "/system/heartbeatAck"
})); }));
var code = content["userCode"]; var code = content["userCode"];
if(code != null) if(code != null)

View File

@@ -14,9 +14,9 @@ namespace PepperDash.Essentials.Room.Cotija
{ {
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key); var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.AddAction(prefix + "chanup", new PressAndHoldAction(dev.ChannelUp)); controller.AddAction(prefix + "chanUp", new PressAndHoldAction(dev.ChannelUp));
controller.AddAction(prefix + "chandown", new PressAndHoldAction(dev.ChannelDown)); controller.AddAction(prefix + "chanDown", new PressAndHoldAction(dev.ChannelDown));
controller.AddAction(prefix + "lastchan", new PressAndHoldAction(dev.LastChannel)); controller.AddAction(prefix + "lastChan", new PressAndHoldAction(dev.LastChannel));
controller.AddAction(prefix + "guide", new PressAndHoldAction(dev.Guide)); controller.AddAction(prefix + "guide", new PressAndHoldAction(dev.Guide));
controller.AddAction(prefix + "info", new PressAndHoldAction(dev.Info)); controller.AddAction(prefix + "info", new PressAndHoldAction(dev.Info));
controller.AddAction(prefix + "exit", new PressAndHoldAction(dev.Exit)); 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); var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.RemoveAction(prefix + "chanup"); controller.RemoveAction(prefix + "chanUp");
controller.RemoveAction(prefix + "chandown"); controller.RemoveAction(prefix + "chanDown");
controller.RemoveAction(prefix + "lastchan"); controller.RemoveAction(prefix + "lastChan");
controller.RemoveAction(prefix + "guide"); controller.RemoveAction(prefix + "guide");
controller.RemoveAction(prefix + "info"); controller.RemoveAction(prefix + "info");
controller.RemoveAction(prefix + "exit"); controller.RemoveAction(prefix + "exit");

View File

@@ -24,8 +24,8 @@ namespace PepperDash.Essentials.Room.Cotija
controller.AddAction(prefix + "num7", new PressAndHoldAction(dev.Digit0)); controller.AddAction(prefix + "num7", new PressAndHoldAction(dev.Digit0));
controller.AddAction(prefix + "num8", new PressAndHoldAction(dev.Digit0)); controller.AddAction(prefix + "num8", new PressAndHoldAction(dev.Digit0));
controller.AddAction(prefix + "num9", new PressAndHoldAction(dev.Digit0)); controller.AddAction(prefix + "num9", new PressAndHoldAction(dev.Digit0));
controller.AddAction(prefix + "dash", new PressAndHoldAction(dev.KeypadAccessoryButton1)); controller.AddAction(prefix + "numDash", new PressAndHoldAction(dev.KeypadAccessoryButton1));
controller.AddAction(prefix + "enter", new PressAndHoldAction(dev.KeypadAccessoryButton2)); controller.AddAction(prefix + "numEnter", new PressAndHoldAction(dev.KeypadAccessoryButton2));
// Deal with the Accessory functions on the numpad later // 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 + "num6");
controller.RemoveAction(prefix + "num7"); controller.RemoveAction(prefix + "num7");
controller.RemoveAction(prefix + "num8"); controller.RemoveAction(prefix + "num8");
controller.RemoveAction(prefix + "num9"); controller.RemoveAction(prefix + "num9");
controller.RemoveAction(prefix + "dash"); controller.RemoveAction(prefix + "numDash");
controller.RemoveAction(prefix + "enter"); controller.RemoveAction(prefix + "numEnter");
} }
} }
} }

View File

@@ -14,18 +14,18 @@ namespace PepperDash.Essentials.Room.Cotija
{ {
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key); var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.AddAction(prefix + "poweron", new Action(dev.PowerOn)); controller.AddAction(prefix + "powerOn", new Action(dev.PowerOn));
controller.AddAction(prefix + "poweroff", new Action(dev.PowerOff)); controller.AddAction(prefix + "powerOff", new Action(dev.PowerOff));
controller.AddAction(prefix + "powertoggle", new Action(dev.PowerToggle)); controller.AddAction(prefix + "powerToggle", new Action(dev.PowerToggle));
} }
public static void UnlinkActions(this IPower dev, CotijaSystemController controller) public static void UnlinkActions(this IPower dev, CotijaSystemController controller)
{ {
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key); var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.RemoveAction(prefix + "poweron"); controller.RemoveAction(prefix + "powerOn");
controller.RemoveAction(prefix + "poweroff"); controller.RemoveAction(prefix + "powerOff");
controller.RemoveAction(prefix + "powertoggle"); controller.RemoveAction(prefix + "powerToggle");
} }
} }

View File

@@ -14,7 +14,7 @@ namespace PepperDash.Essentials.Room.Cotija
{ {
var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key); 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)); 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); var prefix = string.Format(@"/device/{0}/", (dev as IKeyed).Key);
controller.RemoveAction(prefix + "dvrlist"); controller.RemoveAction(prefix + "dvrList");
controller.RemoveAction(prefix + "replay"); controller.RemoveAction(prefix + "replay");
} }
} }

View File

@@ -17,8 +17,8 @@ namespace PepperDash.Essentials.Room.Cotija
controller.AddAction(prefix + "play", new PressAndHoldAction(dev.Play)); controller.AddAction(prefix + "play", new PressAndHoldAction(dev.Play));
controller.AddAction(prefix + "pause", new PressAndHoldAction(dev.Pause)); controller.AddAction(prefix + "pause", new PressAndHoldAction(dev.Pause));
controller.AddAction(prefix + "stop", new PressAndHoldAction(dev.Stop)); controller.AddAction(prefix + "stop", new PressAndHoldAction(dev.Stop));
controller.AddAction(prefix + "prevtrack", new PressAndHoldAction(dev.ChapPlus)); controller.AddAction(prefix + "prevTrack", new PressAndHoldAction(dev.ChapPlus));
controller.AddAction(prefix + "nexttrack", new PressAndHoldAction(dev.ChapMinus)); controller.AddAction(prefix + "nextTrack", new PressAndHoldAction(dev.ChapMinus));
controller.AddAction(prefix + "rewind", new PressAndHoldAction(dev.Rewind)); controller.AddAction(prefix + "rewind", new PressAndHoldAction(dev.Rewind));
controller.AddAction(prefix + "ffwd", new PressAndHoldAction(dev.FFwd)); controller.AddAction(prefix + "ffwd", new PressAndHoldAction(dev.FFwd));
controller.AddAction(prefix + "record", new PressAndHoldAction(dev.Record)); controller.AddAction(prefix + "record", new PressAndHoldAction(dev.Record));
@@ -31,8 +31,8 @@ namespace PepperDash.Essentials.Room.Cotija
controller.RemoveAction(prefix + "play"); controller.RemoveAction(prefix + "play");
controller.RemoveAction(prefix + "pause"); controller.RemoveAction(prefix + "pause");
controller.RemoveAction(prefix + "stop"); controller.RemoveAction(prefix + "stop");
controller.RemoveAction(prefix + "prevtrack"); controller.RemoveAction(prefix + "prevTrack");
controller.RemoveAction(prefix + "nexttrack"); controller.RemoveAction(prefix + "nextTrack");
controller.RemoveAction(prefix + "rewind"); controller.RemoveAction(prefix + "rewind");
controller.RemoveAction(prefix + "ffwd"); controller.RemoveAction(prefix + "ffwd");
controller.RemoveAction(prefix + "record"); controller.RemoveAction(prefix + "record");

View File

@@ -4,6 +4,8 @@ using System.Linq;
using System.Text; using System.Text;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Room.Cotija namespace PepperDash.Essentials.Room.Cotija
{ {
/// <summary> /// <summary>
@@ -24,6 +26,8 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
public interface IHasCurrentSourceInfoChange public interface IHasCurrentSourceInfoChange
{ {
string CurrentSourceInfoKey { get; }
SourceListItem CurrentSourceInfo { get; }
event SourceInfoChangeHandler CurrentSingleSourceChange; event SourceInfoChangeHandler CurrentSingleSourceChange;
} }
@@ -43,7 +47,7 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
public interface IRunDefaultPresentRoute public interface IRunDefaultPresentRoute
{ {
void RunDefaultPresentRoute(); bool RunDefaultPresentRoute();
} }
/// <summary> /// <summary>
@@ -51,6 +55,6 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
public interface IRunDefaultCallRoute : IRunDefaultPresentRoute public interface IRunDefaultCallRoute : IRunDefaultPresentRoute
{ {
void RunDefaultCallRoute(); bool RunDefaultCallRoute();
} }
} }

View File

@@ -31,7 +31,7 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
/// <param name="parent"></param> /// <param name="parent"></param>
/// <param name="room"></param> /// <param name="room"></param>
public CotijaEssentialsHuddleSpaceRoomBridge(EssentialsHuddleSpaceRoom room): public CotijaEssentialsHuddleSpaceRoomBridge(EssentialsRoomBase room):
base("mobileControlBridge-essentialsHuddle", "Essentials Mobile Control Bridge-Huddle") base("mobileControlBridge-essentialsHuddle", "Essentials Mobile Control Bridge-Huddle")
{ {
Room = room; Room = room;
@@ -59,7 +59,7 @@ namespace PepperDash.Essentials
var defaultRoom = Room as IRunDefaultPresentRoute; var defaultRoom = Room as IRunDefaultPresentRoute;
if(defaultRoom != null) 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; var vcRoom = Room as IHasCurrentVolumeControls;
if (vcRoom != null) if (vcRoom != null)
@@ -71,15 +71,11 @@ namespace PepperDash.Essentials
vcRoom.CurrentVolumeDeviceChange += new EventHandler<VolumeDeviceChangeEventArgs>(Room_CurrentVolumeDeviceChange); vcRoom.CurrentVolumeDeviceChange += new EventHandler<VolumeDeviceChangeEventArgs>(Room_CurrentVolumeDeviceChange);
// Registers for initial volume events, if possible // Registers for initial volume events, if possible
var currentVolumeDevice = vcRoom.CurrentVolumeControls; var currentVolumeDevice = vcRoom.CurrentVolumeControls as IBasicVolumeWithFeedback;
if (currentVolumeDevice != null) if (currentVolumeDevice != null)
{ {
if (currentVolumeDevice is IBasicVolumeWithFeedback) currentVolumeDevice.MuteFeedback.OutputChange += VolumeLevelFeedback_OutputChange;
{ currentVolumeDevice.VolumeLevelFeedback.OutputChange += VolumeLevelFeedback_OutputChange;
var newDev = currentVolumeDevice as IBasicVolumeWithFeedback;
newDev.MuteFeedback.OutputChange += VolumeLevelFeedback_OutputChange;
newDev.VolumeLevelFeedback.OutputChange += VolumeLevelFeedback_OutputChange;
}
} }
} }
@@ -166,14 +162,12 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
void IsWarmingUpFeedback_OutputChange(object sender, EventArgs e) void IsWarmingUpFeedback_OutputChange(object sender, FeedbackEventArgs e)
{ {
JObject roomStatus = new JObject(); PostStatusMessage(new
roomStatus.Add("isWarmingUp", (sender as BoolFeedback).BoolValue); {
JObject message = new JObject(); isWarmingUp = e.BoolValue
message.Add("type", "/room/status/"); });
message.Add("content", roomStatus);
Parent.SendMessageToServer(message);
} }
/// <summary> /// <summary>
@@ -181,14 +175,12 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
void IsCoolingDownFeedback_OutputChange(object sender, EventArgs e) void IsCoolingDownFeedback_OutputChange(object sender, FeedbackEventArgs e)
{ {
JObject roomStatus = new JObject(); PostStatusMessage(new
roomStatus.Add("isCoolingDown", (sender as BoolFeedback).BoolValue); {
JObject message = new JObject(); isCoolingDown = e.BoolValue
message.Add("type", "/room/status/"); });
message.Add("content", roomStatus);
Parent.SendMessageToServer(message);
} }
/// <summary> /// <summary>
@@ -196,27 +188,12 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
void OnFeedback_OutputChange(object sender, EventArgs e) void OnFeedback_OutputChange(object sender, FeedbackEventArgs e)
{ {
/* Example message PostStatusMessage(new
* { {
"type":"/room/status", isOn = e.BoolValue
"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);
} }
void Room_CurrentVolumeDeviceChange(object sender, VolumeDeviceChangeEventArgs e) void Room_CurrentVolumeDeviceChange(object sender, VolumeDeviceChangeEventArgs e)
@@ -224,56 +201,53 @@ namespace PepperDash.Essentials
if (e.OldDev is IBasicVolumeWithFeedback) if (e.OldDev is IBasicVolumeWithFeedback)
{ {
var oldDev = e.OldDev as IBasicVolumeWithFeedback; var oldDev = e.OldDev as IBasicVolumeWithFeedback;
oldDev.MuteFeedback.OutputChange -= MuteFeedback_OutputChange;
oldDev.MuteFeedback.OutputChange -= VolumeLevelFeedback_OutputChange;
oldDev.VolumeLevelFeedback.OutputChange -= VolumeLevelFeedback_OutputChange; oldDev.VolumeLevelFeedback.OutputChange -= VolumeLevelFeedback_OutputChange;
} }
if (e.NewDev is IBasicVolumeWithFeedback) if (e.NewDev is IBasicVolumeWithFeedback)
{ {
var newDev = e.NewDev as IBasicVolumeWithFeedback; var newDev = e.NewDev as IBasicVolumeWithFeedback;
newDev.MuteFeedback.OutputChange += MuteFeedback_OutputChange;
newDev.MuteFeedback.OutputChange += VolumeLevelFeedback_OutputChange;
newDev.VolumeLevelFeedback.OutputChange += VolumeLevelFeedback_OutputChange; newDev.VolumeLevelFeedback.OutputChange += VolumeLevelFeedback_OutputChange;
} }
} }
void VolumeLevelFeedback_OutputChange(object sender, EventArgs e) /// <summary>
/// Event handler for mute changes
/// </summary>
void MuteFeedback_OutputChange(object sender, FeedbackEventArgs e)
{
PostStatusMessage(new
{
volumes = new
{
master = new
{
muted = e.BoolValue
}
}
});
}
/// <summary>
/// Handles Volume changes on room
/// </summary>
void VolumeLevelFeedback_OutputChange(object sender, FeedbackEventArgs e)
{ {
/* Example message PostStatusMessage(new
* { {
"type":"/room/status", volumes = new
"content": { {
"masterVolumeLevel": 12345, master = new
"masterVolumeMuteState": false {
} level = e.IntValue
} }
*/ }
});
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);
}
} }
void Room_CurrentSingleSourceChange(EssentialsRoomBase room, PepperDash.Essentials.Core.SourceListItem info, ChangeType type) void Room_CurrentSingleSourceChange(EssentialsRoomBase room, PepperDash.Essentials.Core.SourceListItem info, ChangeType type)
{ {
/* Example message /* Example message
@@ -335,16 +309,11 @@ namespace PepperDash.Essentials
if (dev is ITransport) if (dev is ITransport)
(dev as ITransport).LinkActions(Parent); (dev as ITransport).LinkActions(Parent);
var huddleRoom = room as EssentialsHuddleSpaceRoom; var srcRm = room as IHasCurrentSourceInfoChange;
JObject roomStatus = new JObject(); PostStatusMessage(new
roomStatus.Add("selectedSourceKey", huddleRoom.CurrentSourceInfoKey); {
selectedSourceKey = srcRm.CurrentSourceInfoKey
JObject message = new JObject(); });
message.Add("type", "/room/status/");
message.Add("content", roomStatus);
Parent.SendMessageToServer(message);
} }
} }
} }
@@ -355,39 +324,21 @@ namespace PepperDash.Essentials
/// <param name="room"></param> /// <param name="room"></param>
void Room_RoomFullStatus(EssentialsRoomBase room) void Room_RoomFullStatus(EssentialsRoomBase room)
{ {
/* Example message var sourceKey = room is IHasCurrentSourceInfoChange ? (room as IHasCurrentSourceInfoChange).CurrentSourceInfoKey : null;
* {
"type":"/room/status", var rmVc = room as IHasCurrentVolumeControls as IBasicVolumeWithFeedback;
"content": { var volumes = new Volumes();
"selectedSourceKey": "off", if (rmVc != null)
"isOn": false, {
"masterVolumeLevel": 50, volumes.Master = new Volume("master", rmVc.VolumeLevelFeedback.UShortValue, rmVc.MuteFeedback.BoolValue, "Volume", true, "");
"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);
PostStatusMessage(new
{
isOn = room.OnFeedback.BoolValue,
selectedSourceKey = sourceKey,
volumes = volumes
});
} }
} }
@@ -395,8 +346,6 @@ namespace PepperDash.Essentials
public class SourceSelectMessageContent public class SourceSelectMessageContent
{ {
public string SourceListItem { get; set; } public string SourceListItem { get; set; }
//public string Destination { get; set; }
//public string SourceSelect { get; set; }
} }
public delegate void PressAndHoldAction(bool b); public delegate void PressAndHoldAction(bool b);

View File

@@ -0,0 +1,104 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Room.Cotija
{
/// <summary>
/// Contains all of the default joins that map to API funtions
/// </summary>
public class SourceDeviceMapDictionary : Dictionary<string, uint>
{
public SourceDeviceMapDictionary(): base()
{
var dictionary = new Dictionary<string, uint>
{
{"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);
}
}
}
}

View File

@@ -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<Volume> 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;
}
}
}

View File

@@ -212,10 +212,13 @@ namespace PepperDash.Essentials
/// <summary> /// <summary>
/// Routes the default source item, if any /// Routes the default source item, if any
/// </summary> /// </summary>
public void RunDefaultPresentRoute() public bool RunDefaultPresentRoute()
{ {
//if (DefaultSourceItem != null && !OnFeedback.BoolValue) if(DefaultSourceItem == null)
return false;
RunRouteAction(DefaultSourceItem); RunRouteAction(DefaultSourceItem);
return true;
} }
/// <summary> /// <summary>

View File

@@ -1,437 +1,437 @@
using System; //using System;
using System.Collections.Generic; //using System.Collections.Generic;
using System.Linq; //using System.Linq;
using System.Text; //using System.Text;
using Crestron.SimplSharp; //using Crestron.SimplSharp;
using PepperDash.Core; //using PepperDash.Core;
using PepperDash.Essentials.Core; //using PepperDash.Essentials.Core;
using PepperDash.Essentials.Room.Config; //using PepperDash.Essentials.Room.Config;
namespace PepperDash.Essentials //namespace PepperDash.Essentials
{ //{
public class EssentialsPresentationRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange // public class EssentialsPresentationRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange
{ // {
public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange; // public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange;
public event SourceInfoChangeHandler CurrentSingleSourceChange; // public event SourceInfoChangeHandler CurrentSingleSourceChange;
public event SourceInfoChangeHandler CurrentDisplay1SourceChange; // public event SourceInfoChangeHandler CurrentDisplay1SourceChange;
public event SourceInfoChangeHandler CurrentDisplay2SourceChange; // public event SourceInfoChangeHandler CurrentDisplay2SourceChange;
protected override Func<bool> OnFeedbackFunc { get { // protected override Func<bool> OnFeedbackFunc { get {
return () => (CurrentSingleSourceInfo != null // return () => (CurrentSingleSourceInfo != null
&& CurrentSingleSourceInfo.Type != eSourceListItemType.Off) // && CurrentSingleSourceInfo.Type != eSourceListItemType.Off)
|| (Display1SourceInfo != null // || (Display1SourceInfo != null
&& Display1SourceInfo.Type != eSourceListItemType.Off) // && Display1SourceInfo.Type != eSourceListItemType.Off)
|| (Display2SourceInfo != null // || (Display2SourceInfo != null
&& Display2SourceInfo.Type != eSourceListItemType.Off); } } // && Display2SourceInfo.Type != eSourceListItemType.Off); } }
protected override Func<bool> IsWarmingFeedbackFunc { get { return () =>false;; } } // protected override Func<bool> IsWarmingFeedbackFunc { get { return () =>false;; } }
protected override Func<bool> IsCoolingFeedbackFunc { get { return () => false; } } // protected override Func<bool> IsCoolingFeedbackFunc { get { return () => false; } }
public EssentialsPresentationRoomPropertiesConfig Config { get; private set; } // public EssentialsPresentationRoomPropertiesConfig Config { get; private set; }
public Dictionary<uint, IRoutingSinkNoSwitching> Displays { get; private set; } // public Dictionary<uint, IRoutingSinkNoSwitching> Displays { get; private set; }
public IRoutingSinkNoSwitching DefaultAudioDevice { get; private set; } // public IRoutingSinkNoSwitching DefaultAudioDevice { get; private set; }
public IBasicVolumeControls DefaultVolumeControls { get; private set; } // public IBasicVolumeControls DefaultVolumeControls { get; private set; }
/// <summary> // /// <summary>
/// The config name of the source list // /// The config name of the source list
/// </summary> // /// </summary>
public string SourceListKey { get; set; } // public string SourceListKey { get; set; }
/// <summary> // /// <summary>
/// If room is off, enables power on to last source. Default true // /// If room is off, enables power on to last source. Default true
/// </summary> // /// </summary>
public bool EnablePowerOnToLastSource { get; set; } // public bool EnablePowerOnToLastSource { get; set; }
string LastSourceKey; // string LastSourceKey;
public enum eVideoRoutingMode // public enum eVideoRoutingMode
{ // {
SelectSourceSelectDisplay, SourceToAllDisplays // SelectSourceSelectDisplay, SourceToAllDisplays
} // }
public eVideoRoutingMode VideoRoutingMode { get; set; } // public eVideoRoutingMode VideoRoutingMode { get; set; }
public enum eAudioRoutingMode // public enum eAudioRoutingMode
{ // {
AudioFollowsLastVideo, SelectAudioFromDisplay // AudioFollowsLastVideo, SelectAudioFromDisplay
} // }
/// <summary> // /// <summary>
/// // ///
/// </summary> // /// </summary>
public IBasicVolumeControls CurrentVolumeControls // public IBasicVolumeControls CurrentVolumeControls
{ // {
get { return _CurrentAudioDevice; } // get { return _CurrentAudioDevice; }
set // set
{ // {
if (value == _CurrentAudioDevice) return; // if (value == _CurrentAudioDevice) return;
var oldDev = _CurrentAudioDevice; // var oldDev = _CurrentAudioDevice;
// derigister this room from the device, if it can // // derigister this room from the device, if it can
if (oldDev is IInUseTracking) // if (oldDev is IInUseTracking)
(oldDev as IInUseTracking).InUseTracker.RemoveUser(this, "audio"); // (oldDev as IInUseTracking).InUseTracker.RemoveUser(this, "audio");
var handler = CurrentVolumeDeviceChange; // var handler = CurrentVolumeDeviceChange;
if (handler != null) // if (handler != null)
CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.WillChange)); // CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.WillChange));
_CurrentAudioDevice = value; // _CurrentAudioDevice = value;
if (handler != null) // if (handler != null)
CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.DidChange)); // CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.DidChange));
// register this room with new device, if it can // // register this room with new device, if it can
if (_CurrentAudioDevice is IInUseTracking) // if (_CurrentAudioDevice is IInUseTracking)
(_CurrentAudioDevice as IInUseTracking).InUseTracker.AddUser(this, "audio"); // (_CurrentAudioDevice as IInUseTracking).InUseTracker.AddUser(this, "audio");
} // }
} // }
IBasicVolumeControls _CurrentAudioDevice; // IBasicVolumeControls _CurrentAudioDevice;
/// <summary> // /// <summary>
/// The SourceListItem last run - containing names and icons. The complex setter is // /// 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 // /// to add/remove this room to the source's InUseTracking, if it is capable
/// </summary> // /// </summary>
public SourceListItem CurrentSingleSourceInfo // public SourceListItem CurrentSingleSourceInfo
{ // {
get { return _CurrentSingleSourceInfo; } // get { return _CurrentSingleSourceInfo; }
private set // private set
{ // {
if (value == _CurrentSingleSourceInfo) return; // if (value == _CurrentSingleSourceInfo) return;
var handler = CurrentSingleSourceChange; // var handler = CurrentSingleSourceChange;
// remove from in-use tracker, if so equipped // // remove from in-use tracker, if so equipped
if(_CurrentSingleSourceInfo != null && _CurrentSingleSourceInfo.SourceDevice is IInUseTracking) // if(_CurrentSingleSourceInfo != null && _CurrentSingleSourceInfo.SourceDevice is IInUseTracking)
(_CurrentSingleSourceInfo.SourceDevice as IInUseTracking).InUseTracker.RemoveUser(this, "control"); // (_CurrentSingleSourceInfo.SourceDevice as IInUseTracking).InUseTracker.RemoveUser(this, "control");
if (handler != null) // if (handler != null)
handler(this, _CurrentSingleSourceInfo, ChangeType.WillChange); // handler(this, _CurrentSingleSourceInfo, ChangeType.WillChange);
_CurrentSingleSourceInfo = value; // _CurrentSingleSourceInfo = value;
// add to in-use tracking // // add to in-use tracking
if (_CurrentSingleSourceInfo != null && _CurrentSingleSourceInfo.SourceDevice is IInUseTracking) // if (_CurrentSingleSourceInfo != null && _CurrentSingleSourceInfo.SourceDevice is IInUseTracking)
(_CurrentSingleSourceInfo.SourceDevice as IInUseTracking).InUseTracker.AddUser(this, "control"); // (_CurrentSingleSourceInfo.SourceDevice as IInUseTracking).InUseTracker.AddUser(this, "control");
if (handler != null) // if (handler != null)
handler(this, _CurrentSingleSourceInfo, ChangeType.DidChange); // handler(this, _CurrentSingleSourceInfo, ChangeType.DidChange);
} // }
} // }
SourceListItem _CurrentSingleSourceInfo; // SourceListItem _CurrentSingleSourceInfo;
public SourceListItem Display1SourceInfo // public SourceListItem Display1SourceInfo
{ // {
get { return _Display1SourceInfo; } // get { return _Display1SourceInfo; }
set // set
{ // {
if (value == _Display1SourceInfo) return; // if (value == _Display1SourceInfo) return;
var handler = CurrentDisplay1SourceChange; // var handler = CurrentDisplay1SourceChange;
if (handler != null) // if (handler != null)
handler(this, _Display1SourceInfo, ChangeType.WillChange); // handler(this, _Display1SourceInfo, ChangeType.WillChange);
_Display1SourceInfo = value; // _Display1SourceInfo = value;
if (handler != null) // if (handler != null)
handler(this, _Display1SourceInfo, ChangeType.DidChange); // handler(this, _Display1SourceInfo, ChangeType.DidChange);
} // }
} // }
SourceListItem _Display1SourceInfo; // SourceListItem _Display1SourceInfo;
public SourceListItem Display2SourceInfo // public SourceListItem Display2SourceInfo
{ // {
get { return _Display2SourceInfo; } // get { return _Display2SourceInfo; }
set // set
{ // {
if (value == _Display2SourceInfo) return; // if (value == _Display2SourceInfo) return;
var handler = CurrentDisplay2SourceChange; // var handler = CurrentDisplay2SourceChange;
if (handler != null) // if (handler != null)
handler(this, _Display2SourceInfo, ChangeType.WillChange); // handler(this, _Display2SourceInfo, ChangeType.WillChange);
_Display2SourceInfo = value; // _Display2SourceInfo = value;
if (handler != null) // if (handler != null)
handler(this, _Display2SourceInfo, ChangeType.DidChange); // handler(this, _Display2SourceInfo, ChangeType.DidChange);
} // }
} // }
SourceListItem _Display2SourceInfo; // SourceListItem _Display2SourceInfo;
/// <summary> // /// <summary>
/// If an audio dialer is available for this room // /// If an audio dialer is available for this room
/// </summary> // /// </summary>
public bool HasAudioDialer { get { return false; } } // public bool HasAudioDialer { get { return false; } }
/// <summary> // /// <summary>
/// // ///
/// </summary> // /// </summary>
/// <param name="key"></param> // /// <param name="key"></param>
/// <param name="name"></param> // /// <param name="name"></param>
public EssentialsPresentationRoom(string key, string name, // public EssentialsPresentationRoom(string key, string name,
Dictionary<uint, IRoutingSinkNoSwitching> displays, // Dictionary<uint, IRoutingSinkNoSwitching> displays,
IBasicVolumeWithFeedback defaultVolume, EssentialsPresentationRoomPropertiesConfig config) // IBasicVolumeWithFeedback defaultVolume, EssentialsPresentationRoomPropertiesConfig config)
: base(key, name) // : base(key, name)
{ // {
Config = config; // Config = config;
Displays = displays; // Displays = displays;
DefaultVolumeControls = defaultVolume; // DefaultVolumeControls = defaultVolume;
CurrentVolumeControls = defaultVolume; // CurrentVolumeControls = defaultVolume;
//DefaultAudioDevice = defaultAudio; // //DefaultAudioDevice = defaultAudio;
//if (defaultAudio is IBasicVolumeControls) // //if (defaultAudio is IBasicVolumeControls)
// DefaultVolumeControls = defaultAudio as IBasicVolumeControls; // // DefaultVolumeControls = defaultAudio as IBasicVolumeControls;
//else if (defaultAudio is IHasVolumeDevice) // //else if (defaultAudio is IHasVolumeDevice)
// DefaultVolumeControls = (defaultAudio as IHasVolumeDevice).VolumeDevice; // // DefaultVolumeControls = (defaultAudio as IHasVolumeDevice).VolumeDevice;
SourceListKey = "default"; // SourceListKey = "default";
EnablePowerOnToLastSource = true; // EnablePowerOnToLastSource = true;
} // }
/// <summary> // /// <summary>
/// Run the same source to all destinations // /// Run the same source to all destinations
/// </summary> // /// </summary>
/// <param name="sourceItem"></param> // /// <param name="sourceItem"></param>
public void RouteSourceToAllDestinations(SourceListItem sourceItem) // public void RouteSourceToAllDestinations(SourceListItem sourceItem)
{ // {
if (Config.Volumes.Master != null) // if (Config.Volumes.Master != null)
{ // {
var audioDev = DeviceManager.GetDeviceForKey(Config.Volumes.Master.DeviceKey); // var audioDev = DeviceManager.GetDeviceForKey(Config.Volumes.Master.DeviceKey);
if (audioDev is IBasicVolumeWithFeedback) // if (audioDev is IBasicVolumeWithFeedback)
{ // {
} // }
} // }
foreach (var display in Displays.Values) // foreach (var display in Displays.Values)
{ // {
if (sourceItem != null) // if (sourceItem != null)
DoVideoRoute(sourceItem.SourceKey, display.Key); // DoVideoRoute(sourceItem.SourceKey, display.Key);
else // else
DoVideoRoute("$off", display.Key); // DoVideoRoute("$off", display.Key);
} // }
Display1SourceInfo = sourceItem; // Display1SourceInfo = sourceItem;
Display2SourceInfo = sourceItem; // Display2SourceInfo = sourceItem;
CurrentSingleSourceInfo = sourceItem; // CurrentSingleSourceInfo = sourceItem;
OnFeedback.FireUpdate(); // OnFeedback.FireUpdate();
} // }
public void SourceToDisplay1(SourceListItem sourceItem) // public void SourceToDisplay1(SourceListItem sourceItem)
{ // {
DoVideoRoute(sourceItem.SourceKey, Displays[1].Key); // DoVideoRoute(sourceItem.SourceKey, Displays[1].Key);
Display1SourceInfo = sourceItem; // Display1SourceInfo = sourceItem;
OnFeedback.FireUpdate(); // OnFeedback.FireUpdate();
} // }
public void SourceToDisplay2(SourceListItem sourceItem) // public void SourceToDisplay2(SourceListItem sourceItem)
{ // {
DoVideoRoute(sourceItem.SourceKey, Displays[2].Key); // DoVideoRoute(sourceItem.SourceKey, Displays[2].Key);
Display2SourceInfo = sourceItem; // Display2SourceInfo = sourceItem;
OnFeedback.FireUpdate(); // OnFeedback.FireUpdate();
} // }
/// <summary> // /// <summary>
/// Basic source -> destination routing // /// Basic source -> destination routing
/// </summary> // /// </summary>
void DoVideoRoute(string sourceKey, string destinationKey) // void DoVideoRoute(string sourceKey, string destinationKey)
{ // {
new CTimer(o => // new CTimer(o =>
{ // {
var dest = DeviceManager.GetDeviceForKey(destinationKey) as IRoutingSinkNoSwitching; // var dest = DeviceManager.GetDeviceForKey(destinationKey) as IRoutingSinkNoSwitching;
if (dest == null) // if (dest == null)
{ // {
Debug.Console(1, this, "Cannot route. Destination '{0}' not found", destinationKey); // Debug.Console(1, this, "Cannot route. Destination '{0}' not found", destinationKey);
return; // return;
} // }
// off is special case // // off is special case
if (sourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase)) // if (sourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase))
{ // {
dest.ReleaseRoute(); // dest.ReleaseRoute();
if (dest is IPower) // if (dest is IPower)
(dest as IPower).PowerOff(); // (dest as IPower).PowerOff();
return; // return;
} // }
var source = DeviceManager.GetDeviceForKey(sourceKey) as IRoutingOutputs; // var source = DeviceManager.GetDeviceForKey(sourceKey) as IRoutingOutputs;
if (source == null) // if (source == null)
{ // {
Debug.Console(1, this, "Cannot route. Source '{0}' not found", sourceKey); // Debug.Console(1, this, "Cannot route. Source '{0}' not found", sourceKey);
return; // return;
} // }
dest.ReleaseAndMakeRoute(source, eRoutingSignalType.Video); // dest.ReleaseAndMakeRoute(source, eRoutingSignalType.Video);
}, 0); // }, 0);
} // }
/// <summary> // /// <summary>
/// // ///
/// </summary> // /// </summary>
protected override void EndShutdown() // protected override void EndShutdown()
{ // {
RunRouteAction("roomoff"); // RunRouteAction("roomoff");
} // }
/// <summary> // /// <summary>
/// // ///
/// </summary> // /// </summary>
/// <param name="routeKey"></param> // /// <param name="routeKey"></param>
public void RunRouteAction(string routeKey) // public void RunRouteAction(string routeKey)
{ // {
RunRouteAction(routeKey, null); // RunRouteAction(routeKey, null);
} // }
/// <summary> // /// <summary>
/// Gets a source from config list SourceListKey and dynamically build and executes the // /// Gets a source from config list SourceListKey and dynamically build and executes the
/// route or commands // /// route or commands
/// </summary> // /// </summary>
/// <param name="name"></param> // /// <param name="name"></param>
public void RunRouteAction(string routeKey, Action successCallback) // public void RunRouteAction(string routeKey, Action successCallback)
{ // {
// Run this on a separate thread // // Run this on a separate thread
new CTimer(o => // new CTimer(o =>
{ // {
Debug.Console(1, this, "Run room action '{0}'", routeKey); // Debug.Console(1, this, "Run room action '{0}'", routeKey);
var dict = ConfigReader.ConfigObject.GetSourceListForKey(SourceListKey); // var dict = ConfigReader.ConfigObject.GetSourceListForKey(SourceListKey);
if(dict == null) // if(dict == null)
{ // {
Debug.Console(1, this, "WARNING: Config source list '{0}' not found", SourceListKey); // Debug.Console(1, this, "WARNING: Config source list '{0}' not found", SourceListKey);
return; // return;
} // }
// Try to get the list item by it's string key // // Try to get the list item by it's string key
if (!dict.ContainsKey(routeKey)) // if (!dict.ContainsKey(routeKey))
{ // {
Debug.Console(1, this, "WARNING: No item '{0}' found on config list '{1}'", // Debug.Console(1, this, "WARNING: No item '{0}' found on config list '{1}'",
routeKey, SourceListKey); // routeKey, SourceListKey);
return; // return;
} // }
var item = dict[routeKey]; // var item = dict[routeKey];
//Debug.Console(2, this, "Action {0} has {1} steps", // //Debug.Console(2, this, "Action {0} has {1} steps",
// item.SourceKey, item.RouteList.Count); // // item.SourceKey, item.RouteList.Count);
// Let's run it // // Let's run it
if (routeKey.ToLower() != "roomoff") // if (routeKey.ToLower() != "roomoff")
LastSourceKey = routeKey; // LastSourceKey = routeKey;
foreach (var route in item.RouteList) // foreach (var route in item.RouteList)
{ // {
// if there is a $defaultAll on route, run two separate // // if there is a $defaultAll on route, run two separate
if (route.DestinationKey.Equals("$defaultAll", StringComparison.OrdinalIgnoreCase)) // if (route.DestinationKey.Equals("$defaultAll", StringComparison.OrdinalIgnoreCase))
{ // {
var tempAudio = new SourceRouteListItem // var tempAudio = new SourceRouteListItem
{ // {
DestinationKey = "$defaultDisplay", // DestinationKey = "$defaultDisplay",
SourceKey = route.SourceKey, // SourceKey = route.SourceKey,
Type = eRoutingSignalType.Video // Type = eRoutingSignalType.Video
}; // };
DoRoute(tempAudio); // DoRoute(tempAudio);
var tempVideo = new SourceRouteListItem // var tempVideo = new SourceRouteListItem
{ // {
DestinationKey = "$defaultAudio", // DestinationKey = "$defaultAudio",
SourceKey = route.SourceKey, // SourceKey = route.SourceKey,
Type = eRoutingSignalType.Audio // Type = eRoutingSignalType.Audio
}; // };
DoRoute(tempVideo); // DoRoute(tempVideo);
continue; // continue;
} // }
else // else
DoRoute(route); // DoRoute(route);
} // }
// Set volume control on room, using default if non provided // // Set volume control on room, using default if non provided
IBasicVolumeControls volDev = null; // IBasicVolumeControls volDev = null;
// Handle special cases for volume control // // Handle special cases for volume control
if (string.IsNullOrEmpty(item.VolumeControlKey) // if (string.IsNullOrEmpty(item.VolumeControlKey)
|| item.VolumeControlKey.Equals("$defaultAudio", StringComparison.OrdinalIgnoreCase)) // || item.VolumeControlKey.Equals("$defaultAudio", StringComparison.OrdinalIgnoreCase))
volDev = DefaultVolumeControls; // volDev = DefaultVolumeControls;
//else if (item.VolumeControlKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase)) // //else if (item.VolumeControlKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase))
// volDev = DefaultDisplay as IBasicVolumeControls; // // volDev = DefaultDisplay as IBasicVolumeControls;
// Or a specific device, probably rarely used. // // Or a specific device, probably rarely used.
else // else
{ // {
var dev = DeviceManager.GetDeviceForKey(item.VolumeControlKey); // var dev = DeviceManager.GetDeviceForKey(item.VolumeControlKey);
if (dev is IBasicVolumeControls) // if (dev is IBasicVolumeControls)
volDev = dev as IBasicVolumeControls; // volDev = dev as IBasicVolumeControls;
else if (dev is IHasVolumeDevice) // else if (dev is IHasVolumeDevice)
volDev = (dev as IHasVolumeDevice).VolumeDevice; // volDev = (dev as IHasVolumeDevice).VolumeDevice;
} // }
CurrentVolumeControls = volDev; // CurrentVolumeControls = volDev;
// store the name and UI info for routes // // store the name and UI info for routes
if (item.SourceKey != null) // if (item.SourceKey != null)
CurrentSingleSourceInfo = item; // CurrentSingleSourceInfo = item;
// And finally, set the "control". This will trigger event // // And finally, set the "control". This will trigger event
//CurrentControlDevice = DeviceManager.GetDeviceForKey(item.SourceKey) as Device; // //CurrentControlDevice = DeviceManager.GetDeviceForKey(item.SourceKey) as Device;
OnFeedback.FireUpdate(); // OnFeedback.FireUpdate();
// report back when done // // report back when done
if (successCallback != null) // if (successCallback != null)
successCallback(); // successCallback();
}, 0); // end of CTimer // }, 0); // end of CTimer
} // }
/// <summary> // /// <summary>
/// Will power the room on with the last-used source // /// Will power the room on with the last-used source
/// </summary> // /// </summary>
public void PowerOnToDefaultOrLastSource() // public void PowerOnToDefaultOrLastSource()
{ // {
if (!EnablePowerOnToLastSource || LastSourceKey == null) // if (!EnablePowerOnToLastSource || LastSourceKey == null)
return; // return;
RunRouteAction(LastSourceKey); // RunRouteAction(LastSourceKey);
} // }
/// <summary> // /// <summary>
/// Does what it says // /// Does what it says
/// </summary> // /// </summary>
public override void SetDefaultLevels() // public override void SetDefaultLevels()
{ // {
Debug.Console(0, this, "SetDefaultLevels not implemented"); // Debug.Console(0, this, "SetDefaultLevels not implemented");
} // }
/// <summary> // /// <summary>
/// // ///
/// </summary> // /// </summary>
/// <param name="route"></param> // /// <param name="route"></param>
/// <returns></returns> // /// <returns></returns>
bool DoRoute(SourceRouteListItem route) // bool DoRoute(SourceRouteListItem route)
{ // {
IRoutingSinkNoSwitching dest = null; // IRoutingSinkNoSwitching dest = null;
if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase)) // if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase))
dest = DefaultAudioDevice; // dest = DefaultAudioDevice;
//else if (route.DestinationKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase)) // //else if (route.DestinationKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase))
// dest = DefaultDisplay; // // dest = DefaultDisplay;
else // else
dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSinkNoSwitching; // dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSinkNoSwitching;
if (dest == null) // if (dest == null)
{ // {
Debug.Console(1, this, "Cannot route, unknown destination '{0}'", route.DestinationKey); // Debug.Console(1, this, "Cannot route, unknown destination '{0}'", route.DestinationKey);
return false; // return false;
} // }
if (route.SourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase)) // if (route.SourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase))
{ // {
dest.ReleaseRoute(); // dest.ReleaseRoute();
if (dest is IPower) // if (dest is IPower)
(dest as IPower).PowerOff(); // (dest as IPower).PowerOff();
} // }
else // else
{ // {
var source = DeviceManager.GetDeviceForKey(route.SourceKey) as IRoutingOutputs; // var source = DeviceManager.GetDeviceForKey(route.SourceKey) as IRoutingOutputs;
if (source == null) // if (source == null)
{ // {
Debug.Console(1, this, "Cannot route unknown source '{0}' to {1}", route.SourceKey, route.DestinationKey); // Debug.Console(1, this, "Cannot route unknown source '{0}' to {1}", route.SourceKey, route.DestinationKey);
return false; // return false;
} // }
dest.ReleaseAndMakeRoute(source, route.Type); // dest.ReleaseAndMakeRoute(source, route.Type);
} // }
return true; // return true;
} // }
public override void RoomVacatedForTimeoutPeriod(object o) // public override void RoomVacatedForTimeoutPeriod(object o)
{ // {
//Implement this // //Implement this
} // }
} // }
} //}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials
{
/// <summary>
/// The handler type for a Room's SourceInfoChange
/// </summary>
public delegate void SourceInfoChangeHandler(EssentialsRoomBase room, SourceListItem info, ChangeType type);
}

View File

@@ -1,41 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials
{
/// <summary>
///
/// </summary>
public class VolumeDeviceChangeEventArgs : EventArgs
{
public IBasicVolumeControls OldDev { get; private set; }
public IBasicVolumeControls NewDev { get; private set; }
public ChangeType Type { get; private set; }
public VolumeDeviceChangeEventArgs(IBasicVolumeControls oldDev, IBasicVolumeControls newDev, ChangeType type)
{
OldDev = oldDev;
NewDev = newDev;
Type = type;
}
}
/// <summary>
/// The handler type for a Room's SourceInfoChange
/// </summary>
public delegate void SourceInfoChangeHandler(EssentialsRoomBase room, SourceListItem info, ChangeType type);
/// <summary>
///
/// </summary>
public enum ChangeType
{
WillChange, DidChange
}
}