Initial move in from old repo

This commit is contained in:
Heath Volmer
2017-02-08 10:44:35 -07:00
commit c87a0ed68e
146 changed files with 16657 additions and 0 deletions

Binary file not shown.

Binary file not shown.

BIN
IR Drivers/Comcast X1.ir Normal file

Binary file not shown.

BIN
IR Drivers/DirecTV H21.ir Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,20 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDashEssentials", "PepperDashEssentials\PepperDashEssentials.csproj", "{1BED5BA9-88C4-4365-9362-6F4B128071D3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Binary file not shown.

View File

@@ -0,0 +1,138 @@
using System;
using System.Linq;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials
{
/// <summary>
/// Loads the ConfigObject from the file
/// </summary>
public class ConfigReader
{
public static EssentialsConfig ConfigObject { get; private set; }
public static void LoadConfig2()
{
Debug.Console(0, "Using unmerged system/template configs.");
try
{
using (StreamReader fs = new StreamReader(string.Format(@"\NVRAM\program{0}\ConfigurationFile.json", InitialParametersClass.ApplicationNumber)))
{
var doubleObj = JObject.Parse(fs.ReadToEnd());
ConfigObject = MergeConfigs(doubleObj).ToObject<EssentialsConfig>();
}
}
catch (Exception e)
{
Debug.Console(0, "Config failed: \r{0}", e);
}
}
static JObject MergeConfigs(JObject doubleConfig)
{
var system = JObject.FromObject(doubleConfig["system"]);
var template = JObject.FromObject(doubleConfig["template"]);
var merged = new JObject();
// Put together top-level objects
if (system["info"] != null)
merged.Add("info", Merge(template["info"], system["info"]));
else
merged.Add("info", template["info"]);
merged.Add("devices", MergeArraysOnTopLevelProperty(template["devices"] as JArray, system["devices"] as JArray, "uid"));
if (system["rooms"] == null)
merged.Add("rooms", template["rooms"]);
else
merged.Add("rooms", MergeArraysOnTopLevelProperty(template["rooms"] as JArray, system["rooms"] as JArray, "key"));
if (system["sourceLists"] == null)
merged.Add("sourceLists", template["sourceLists"]);
else
merged.Add("sourceLists", Merge(template["sourceLists"], system["sourceLists"]));
#warning Make tie lines merge appropriately
if (template["tieLines"] != null)
merged.Add("tieLines", template["tieLines"]);
else if (system["tieLines"] != null)
merged.Add("tieLines", system["tieLines"]);
else
merged.Add("tieLines", new JArray());
Debug.Console(0, "MERGED RESULT: \x0d\x0a{0}", merged);
return merged;
}
/// <summary>
/// Merges the contents of a base and a delta array, matching the entries on a top-level property
/// given by propertyName. Returns a merge of them. Items in the delta array that do not have
/// a matched item in base array will not be merged.
/// </summary>
static JArray MergeArraysOnTopLevelProperty(JArray a1, JArray a2, string propertyName)
{
var result = new JArray();
if (a2 == null)
result = a1;
else if (a1 != null)
{
for (int i = 0; i < a1.Count(); i++)
{
var a1Dev = a1[i];
// Try to get a system device and if found, merge it onto template
var a2Match = a2.FirstOrDefault(t => t[propertyName].Equals(a1Dev[propertyName]));// t.Value<int>("uid") == tmplDev.Value<int>("uid"));
if (a2Match != null)
{
var mergedItem = Merge(a1Dev, a2Match);// Merge(JObject.FromObject(a1Dev), JObject.FromObject(a2Match));
result.Add(mergedItem);
}
else
result.Add(a1Dev);
}
}
return result;
}
/// <summary>
/// Helper for using with JTokens. Converts to JObject
/// </summary>
static JObject Merge(JToken t1, JToken t2)
{
return Merge(JObject.FromObject(t1), JObject.FromObject(t2));
}
/// <summary>
/// Merge b ONTO a
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
static JObject Merge(JObject o1, JObject o2)
{
//Console.WriteLine("Merging {0}\ronto {1}", o2, o1);
foreach (var o2Prop in o2)
{
var o1Value = o1[o2Prop.Key];
if (o1Value == null)
o1.Add(o2Prop.Key, o2Prop.Value);
else
{
JToken replacement = null;
if (o2Prop.Value.HasValues && o1Value.HasValues) // Drill down
replacement = Merge(JObject.FromObject(o1Value), JObject.FromObject(o2Prop.Value));
else
replacement = o2Prop.Value;
o1[o2Prop.Key].Replace(replacement);
}
}
return o1;
}
}
}

View File

@@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials
{
public class DeviceFactory
{
public static IKeyed GetDevice(DeviceConfig dc)
{
var key = dc.Key;
var name = dc.Name;
var type = dc.Type;
var properties = dc.Properties;
var typeName = dc.Type.ToLower();
if (dc.Group.ToLower() == "touchpanel") // typeName.StartsWith("tsw"))
{
var comm = CommFactory.GetControlPropertiesConfig(dc);
var props = JsonConvert.DeserializeObject<CrestronTouchpanelPropertiesConfig>(
properties.ToString());
return new EssentialsTouchpanelController(key, name, typeName, props, comm.IpIdInt);
}
else if (typeName == "mockdisplay")
{
return new MockDisplay(key, name);
}
// MOVE into something else???
else if (typeName == "basicirdisplay")
{
var ir = IRPortHelper.GetIrPort(properties);
if (ir != null)
return new BasicIrDisplay(key, name, ir.Port, ir.FileName);
}
else if (typeName == "commmock")
{
var comm = CommFactory.CreateCommForDevice(dc);
var props = JsonConvert.DeserializeObject<ConsoleCommMockDevicePropertiesConfig>(
properties.ToString());
return new ConsoleCommMockDevice(key, name, props, comm);
}
return null;
}
}
}

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using Crestron.SimplSharp.CrestronIO;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials
{
/// <summary>
/// Loads the ConfigObject from the file
/// </summary>
public class EssentialsConfig : BasicConfig
{
[JsonProperty("rooms")]
public List<EssentialsRoomConfig> Rooms { get; private set; }
}
/// <summary>
///
/// </summary>
public class SystemTemplateConfigs
{
public EssentialsConfig System { get; set; }
public EssentialsConfig Template { get; set; }
}
}

View File

@@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials
{
public class TPConfig : DeviceConfig
{
new public TPConfigProperties Properties { get; set; }
}
public class TPConfigProperties
{
/*
"properties": {
"ipId": "aa",
"defaultSystemKey": "system1",
"sgdPath": "\\NVRAM\\Program1\\Sgds\\PepperDash Essentials TSW1050_v0.9.sgd",
"usesSplashPage": true,
"showDate": true,
"showTime": false
}
*/
public uint IpId { get; set; }
public string deafultSystemKey { get; set; }
public string SgdPath { get; set; }
public bool UsesSplashPage { get; set; }
public bool ShowDate { get; set; }
public bool ShowTime { get; set; }
}
/// <summary>
/// The gist of this converter: The comspec JSON comes in with normal values that need to be converted
/// into enum names. This converter takes the value and applies the appropriate enum's name prefix to the value
/// and then returns the enum value using Enum.Parse
/// </summary>
public class TPPropertiesConverter : JsonConverter
{
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
return JObject.Load(reader);
}
/// <summary>
/// This will be hit with every value in the ComPortConfig class. We only need to
/// do custom conversion on the comspec items.
/// </summary>
public override bool CanConvert(Type objectType)
{
return true;
}
public override bool CanRead { get { return true; } }
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,82 @@
using System.Linq;
using Newtonsoft.Json;
using PepperDash.Essentials.Core;
using PepperDash.Core;
namespace PepperDash.Essentials
{
public class ConfigTieLine
{
[JsonProperty(Required=Required.Always)]
public string SourceDeviceKey { get; set; }
[JsonProperty(Required = Required.Always)]
public string SourcePortKey { get; set; }
[JsonProperty(Required = Required.Always)]
public string DestinationDeviceKey { get; set; }
[JsonProperty(Required = Required.Always)]
public string DestinationPortKey { get; set; }
public override string ToString()
{
return string.Format("Tie line: [{0}]{1} --> [{2}]{3}", SourceDeviceKey, SourcePortKey, DestinationDeviceKey, DestinationPortKey);
}
/// <summary>
/// Returns a tie line if one can be constructed between the two devices and ports
/// </summary>
/// <returns>TieLine or null if devices or ports don't exist</returns>
public TieLine GetTieLine()
{
var sourceDevice = (IRoutingOutputs)DeviceManager.GetDeviceForKey(SourceDeviceKey);
var destinationDevice = (IRoutingInputs)DeviceManager.GetDeviceForKey(DestinationDeviceKey);
if (sourceDevice == null)
{
Debug.Console(0, " Cannot create TieLine. Source device '{0}' not found or does not have outputs",
SourceDeviceKey);
return null;
}
else if (destinationDevice == null)
{
Debug.Console(0, " Cannot create TieLine. Destination device '{0}' not found or does not have inputs",
DestinationDeviceKey);
return null;
}
else
{
// Get the ports by key name from the lists
RoutingOutputPort sourcePort = sourceDevice.OutputPorts.FirstOrDefault(
p => p.Key.Equals(SourcePortKey, System.StringComparison.OrdinalIgnoreCase));
//RoutingOutputPort sourcePort = null;
//sourceDevice.OutputPorts.TryGetValue(SourcePortKey, out sourcePort);
if (sourcePort == null)
{
Debug.Console(0, " Cannot create TieLine {0}-->{1}. Source device does not have output port '{2}'",
sourceDevice.Key, destinationDevice.Key, SourcePortKey);
return null;
}
RoutingInputPort destinationPort = destinationDevice.InputPorts.FirstOrDefault(
p => p.Key.Equals(DestinationPortKey, System.StringComparison.OrdinalIgnoreCase));
//RoutingInputPort destinationPort = null;
//destinationDevice.InputPorts.TryGetValue(DestinationPortKey, out destinationPort);
if (destinationPort == null)
{
Debug.Console(0, " Cannot create TieLine {0}-->{1}. Destination device does not have input port '{2}'",
sourceDevice.Key, destinationDevice.Key, DestinationPortKey);
return null;
}
var tl = new TieLine(sourcePort, destinationPort);
Debug.Console(1, " Created {0}", this);
return tl;
}
}
}
}

View File

@@ -0,0 +1,287 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.CrestronThread;
using Crestron.SimplSharpPro.Diagnostics;
using Crestron.SimplSharpPro.EthernetCommunication;
using Crestron.SimplSharpPro.UI;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Devices;
//using PepperDash.Essentials.Core.Devices.Dm;
//using PepperDash.Essentials.Fusion;
using PepperDash.Core;
namespace PepperDash.Essentials
{
public static class Configuration
{
public static string LastPath { get; private set; }
public static CrestronControlSystem ControlSystem { get; private set; }
public static void Initialize(CrestronControlSystem cs)
{
CrestronConsole.AddNewConsoleCommand(ReloadFromConsole, "configreload", "Reloads configuration file",
ConsoleAccessLevelEnum.AccessOperator);
ControlSystem = cs;
}
public static bool ReadConfiguration(string filePath)
{
try
{
// Read file
if (File.Exists(filePath))
{
LastPath = filePath;
string json = File.ReadToEnd(filePath, System.Text.Encoding.ASCII);
JObject jo = JObject.Parse(json);
var info = JsonConvert.DeserializeObject<ConfigInfo>(jo["info"].ToString());
Debug.Console(0, "\r[Config] file read:");
Debug.Console(0, " File: {0}", filePath);
Debug.Console(0, " Name: {0}", info.Name);
Debug.Console(0, " Type: {0}", info.SystemTemplateType);
Debug.Console(0, " Date: {0}", info.EditDate);
Debug.Console(0, " ConfigVersion: {0}", info.Version);
Debug.Console(0, " EditedBy: {0}", info.EditedBy);
Debug.Console(0, " Comment: {0}\r", info.Comment);
// Get the main config object
var jConfig = jo["configuration"];
// Devices
var jDevices = (JArray)jConfig["devices"];
CreateDevices(jDevices);
// TieLines
var jRouting = jConfig["routing"];
CreateRouting(jRouting);
/// Parse the available source list(s)
var jSourceLists = (JArray)jConfig["sourceLists"];
var jSourceListJson = jSourceLists.ToString();
List<ConfigSourceList> sourceLists = JsonConvert.DeserializeObject<List<ConfigSourceList>>(jSourceListJson);
// System
var jSystems = (JArray)jConfig["systems"];
CreateSystems(jSystems, sourceLists);
// Activate everything
DeviceManager.ActivateAll();
}
else
{
Debug.Console(0, "[Config] file not found '{0}'", filePath);
return false;
}
}
catch (Exception e)
{
Debug.Console(0, "Configuration read error: \r {0}", e);
return false;
}
return true;
}
static void CreateDevices(JArray jDevices)
{
//Debug.Console(0, " Creating {0} devices", jDevices.Count);
//for (int i = 0; i < jDevices.Count; i++)
//{
// var jDev = jDevices[i];
// //var devConfig = JsonConvert.DeserializeObject<DeviceConfig>(jDev.ToString());
// //Debug.Console(0, "++++++++++++{0}", devConfig);
// var group = jDev["group"].Value<string>();
// Debug.Console(0, " [{0}], creating {1}:{2}", jDev["key"].Value<string>(),
// group, jDev["type"].Value<string>());
// Device dev = null;
// if (group.Equals("Display", StringComparison.OrdinalIgnoreCase))
// dev = DisplayFactory.CreateDisplay(jDev);
// else if (group.Equals("DeviceMonitor", StringComparison.OrdinalIgnoreCase))
// dev = DeviceManagerFactory.Create(jDev);
// //else if (group.Equals("Pc", StringComparison.OrdinalIgnoreCase))
// // dev = PcFactory.Create(jDev);
// //else if (group.Equals("SetTopBox", StringComparison.OrdinalIgnoreCase))
// // dev = SetTopBoxFactory.Create(jDev);
// //else if (group.Equals("DiscPlayer", StringComparison.OrdinalIgnoreCase))
// // dev = DiscPlayerFactory.Create(jDev);
// //else if (group.Equals("Touchpanel", StringComparison.OrdinalIgnoreCase))
// // dev = TouchpanelFactory.Create(jDev);
// else if (group.Equals("dmEndpoint", StringComparison.OrdinalIgnoreCase)) // Add Transmitter and Receiver
// dev = DmFactory.Create(jDev);
// else if (group.Equals("dmChassic", StringComparison.OrdinalIgnoreCase))
// dev = DmFactory.CreateChassis(jDev);
// else if (group.Equals("processor", StringComparison.OrdinalIgnoreCase))
// continue; // ignore it. Has no value right now.
// //else if (group.Equals("remote", StringComparison.OrdinalIgnoreCase))
// // dev = RemoteFactory.Create(jDev);
// else
// {
// Debug.Console(0, " ERROR: Device [{0}] has unknown Group '{1}'. Skipping",
// jDev["key"].Value<string>(), group);
// continue;
// }
// if (dev != null)
// DeviceManager.AddDevice(dev);
// else
// Debug.Console(0, " ERROR: failed to create device {0}",
// jDev["key"].Value<string>());
//}
}
static void CreateSystems(JArray jSystems, List<ConfigSourceList> sourceLists)
{
// // assuming one system
// var jSystem = jSystems[0];
// var name = jSystem.Value<string>("name");
// var key = FactoryHelper.KeyOrConvertName(jSystem.Value<string>("key"), name);
// if (jSystem.Value<string>("type").Equals("EssentialsHuddleSpace", StringComparison.OrdinalIgnoreCase))
// {
// var sys = new HuddleSpaceRoom(key, name);
// var props = jSystem["properties"];
// var displayKey = props["displayKey"].Value<string>();
// if (displayKey != null)
// sys.DefaultDisplay = (DisplayBase)DeviceManager.GetDeviceForKey(displayKey);
// // Add sources from passed in config list
// var myList = sourceLists.FirstOrDefault(
// l => l.Key.Equals(props.Value<string>("sourceListKey"), StringComparison.OrdinalIgnoreCase));
// if (myList != null)
// AddSourcesToSystem(sys, myList);
// DeviceManager.AddDevice(sys);
// //spin up a fusion thing too
//#warning add this fusion connector back in later
// //DeviceManager.AddDevice(new EssentialsHuddleSpaceFusionSystemController(sys, 0xf1));
//}
}
static void AddSourcesToSystem(Room system, ConfigSourceList configList)
{
//foreach (var configItem in configList.PresentationSources)
//{
// var src = (IPresentationSource)DeviceManager.GetDeviceForKey(configItem.SourceKey);
// if (src != null)
// system.Sources.Add(configItem.Number, src);
// else
// Debug.Console(0, system, "cannot find source '{0}' from list {1}",
// configItem.SourceKey, configList.Name);
//}
}
/// <summary>
/// Links up routing, creates tie lines
/// </summary>
/// <param name="jRouting">The "Routing" JArray from configuration</param>
static void CreateRouting(JToken jRouting)
{
var jsonTieLines = jRouting["tieLines"].ToString();
var tieLineConfigs = JsonConvert.DeserializeObject<List<ConfigTieLine>>(jsonTieLines);
foreach (var c in tieLineConfigs)
{
var tl = c.GetTieLine();
if (tl != null)
TieLineCollection.Default.Add(tl);
}
}
/// <summary>
/// Returns the IIROutputPorts device (control system, etc) that contains a given IR port
/// </summary>
/// <param name="propsToken"></param>
static IROutputPort GetIrPort(JToken propsToken)
{
var portDevName = propsToken.Value<string>("IrPortDevice");
var portNum = propsToken.Value<uint>("IrPortNumber");
if (portDevName.Equals("controlSystem", StringComparison.OrdinalIgnoreCase))
{
IIROutputPorts irDev = ControlSystem;
if (portNum <= irDev.NumberOfIROutputPorts)
return ControlSystem.IROutputPorts[portNum];
else
Debug.Console(0, "[Config] ERROR: IR Port {0} out of range. Range 0-{1} on {2}", portNum,
ControlSystem.IROutputPorts.Count, irDev.ToString());
}
return null;
}
static void HandleUnknownType(JToken devToken, string type)
{
Debug.Console(0, "[Config] ERROR: Type '{0}' not found in group '{1}'", type,
devToken.Value<string>("Group"));
}
static void HandleDeviceCreationError(JToken devToken, Exception e)
{
Debug.Console(0, "[Config] ERROR creating device [{0}]: \r{1}",
devToken["Key"].Value<string>(), e);
}
/// <summary>
/// Console helper to reload
/// </summary>
static void ReloadFromConsole(string s)
{
// Gotta tear down everything first!
if (!string.IsNullOrEmpty(LastPath))
{
ReadConfiguration(LastPath);
}
}
}
public class ConfigSourceList
{
[JsonProperty(Required = Required.Always)]
public string Key { get; set; }
[JsonProperty(Required = Required.Always)]
public string Name { get; set; }
[JsonProperty(Required = Required.Always)]
public List<ConfigSourceItem> PresentationSources { get; set; }
}
public class ConfigSourceItem
{
[JsonProperty(Required = Required.Always)]
public uint Number { get; set; }
[JsonProperty(Required = Required.Always)]
public string SourceKey { get; set; }
public string AlternateName { get; set; }
}
public class ConfigInfo
{
public string SystemTemplateType { get; set; }
public string ProcessorType { get; set; }
public string Name { get; set; }
public uint ProgramSlotNumber { get; set; }
public string Version { get; set; }
public string EditedBy { get; set; }
public string EditDate { get; set; }
public string Comment { get; set; }
}
}

View File

@@ -0,0 +1,20 @@
using Newtonsoft.Json;
namespace PepperDash.Essentials
{
public class SourceListConfigProperties
{
[JsonProperty(Required= Required.Always)]
public uint Number { get; set; }
[JsonProperty(Required= Required.Always)]
public string SourceKey { get; set; }
public string AltName { get; set; }
public string AltIcon { get; set; }
public SourceListConfigProperties()
{
AltName = "";
AltIcon = "";
}
}
}

View File

@@ -0,0 +1,54 @@
//using System;
//using Crestron.SimplSharpPro;
//using Newtonsoft.Json;
//using Newtonsoft.Json.Linq;
//using PepperDash.Essentials.Core;
//using PepperDash.Essentials.Devices;
//using PepperDash.Core;
//namespace PepperDash.Essentials
//{
// public class CommFactory
// {
// public static IBasicCommunication CreateCommForDevice(JToken devToken)
// {
// var devKey = devToken.Value<string>("key");
// IBasicCommunication comm = null;
// try
// {
// var control = devToken["properties"]["control"];
// var commMethod = control["method"].Value<string>();
// if (commMethod == "com")
// {
// var comConfig = JsonConvert.DeserializeObject<ComPortConfig>(
// control["comParams"].ToString(),
// new JsonSerializerSettings
// {
// // Needs ObjectCreationHandling to make the ComSpec struct populate
// ObjectCreationHandling = ObjectCreationHandling.Replace,
// Converters = new JsonConverter[] { new ComSpecJsonConverter() }
// });
// comm = new ComPortController(devKey + "-com", comConfig.GetComPort(), comConfig.ComSpec);
// }
// else if (commMethod == "tcpIp")
// {
// var tcpConfig = JsonConvert.DeserializeObject<TcpIpConfig>(control["tcpParams"].ToString());
// comm = new GenericTcpIpClient(devKey + "-tcp", tcpConfig.Address, tcpConfig.Port, tcpConfig.BufferSize);
// }
// }
// catch (Exception e)
// {
// Debug.Console(0, "Cannot create communication from JSON:\r{0}\r\rException:\r{1}", devToken.ToString(), e);
// }
// // put it in the device manager if it's the right flavor
// var comDev = comm as Device;
// if (comDev != null)
// DeviceManager.AddDevice(comDev);
// return comm;
// }
// }
//}

View File

@@ -0,0 +1,38 @@
//using System;
//using Crestron.SimplSharpPro;
//using Newtonsoft.Json.Linq;
//using PepperDash.Essentials.Core;
//using PepperDash.Essentials.Core.Devices;
//using PepperDash.Core;
//namespace PepperDash.Essentials
//{
// public class DeviceManagerFactory
// {
// public static Device Create(JToken devToken)
// {
// Device dev = null;
// try
// {
// var devType = devToken.Value<string>("type");
// var devKey = devToken.Value<string>("key");
// var devName = devToken.Value<string>("name");
// if (devType.Equals("DeviceMonitor", StringComparison.OrdinalIgnoreCase))
// {
// var comm = CommFactory.CreateCommForDevice(devToken);
// if (comm == null) return null;
// dev = new GenericCommunicationMonitoredDevice(devKey, devName, comm, devToken["properties"]["pollString"].Value<string>());
// }
// else
// FactoryHelper.HandleUnknownType(devToken, devType);
// }
// catch (Exception e)
// {
// FactoryHelper.HandleDeviceCreationError(devToken, e);
// }
// return dev;
// }
// }
//}

View File

@@ -0,0 +1,122 @@
//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.Devices;
//using PepperDash.Essentials.Displays;
//using PepperDash.Core;
//namespace PepperDash.Essentials
//{
// public class DisplayFactory
// {
// public static DisplayBase CreateDisplay(JToken devToken)
// {
// DisplayBase dev = null;
// try
// {
// var devType = devToken.Value<string>("type");
// var devKey = devToken.Value<string>("key");
// var devName = devToken.Value<string>("name");
// var properties = devToken["properties"];
// if (devType.Equals("MockDisplay", StringComparison.OrdinalIgnoreCase))
// dev = new MockDisplay(devKey, devName);
// else if (devType.Equals("NecMPSX", StringComparison.OrdinalIgnoreCase))
// {
// var comm = CommFactory.CreateCommForDevice(devToken);
// if (comm == null) return null;
// dev = new NecPSXMDisplayCom(devKey, devName, comm);
// //var commMethod = properties["control"]["method"].Value<string>();
// //// Helper-ize this?
// //if(commMethod == "com")
// //{
// // // Move some of this up above???
// // var comConfig = JsonConvert.DeserializeObject<ComPortConfig>(
// // properties["control"]["comParams"].ToString(),
// // new JsonSerializerSettings {
// // // Needs ObjectCreationHandling to make the ComSpec struct populate
// // ObjectCreationHandling = ObjectCreationHandling.Replace,
// // Converters = new JsonConverter[] { new ComSpecJsonConverter() }
// // });
// // dev = new NecPSXMDisplayCom(devKey, devName, comConfig.GetComPort(), comConfig.ComSpec);
// //}
// //else if (commMethod == "tcpIp")
// //{
// // var spec = properties["control"]["tcpSpec"];
// // var host = spec["address"].Value<string>();
// // var port = spec["port"].Value<int>();
// // dev = new NecPSXMDisplayCom(devKey, devName, host, port);
// //}
// }
// else if (devType.Equals("NecNpPa550", StringComparison.OrdinalIgnoreCase))
// {
// var proj = new NecPaSeriesProjector(devKey, devName);
// var comm = CreateCommunicationFromPropertiesToken(
// devKey + "-comm", properties, 3000);
// proj.CommunicationMethod = comm;
// dev = proj;
// }
// else
// FactoryHelper.HandleUnknownType(devToken, devType);
// }
// catch (Exception e)
// {
// FactoryHelper.HandleDeviceCreationError(devToken, e);
// }
// return dev;
// }
// public static IBasicCommunication CreateCommunicationFromPropertiesToken(
// string commKey, JToken properties, int bufferSize)
// {
// Debug.Console(2, "Building port from: {0}", properties.ToString());
// var tcpToken = properties["TcpIp"];
// if (tcpToken != null)
// {
// // Convert the Tcp property
// var spec = JsonConvert.DeserializeObject<TcpIpConfig>(tcpToken.ToString());
// var tcp = new GenericTcpIpClient(commKey, spec.Address, spec.Port, bufferSize);
// DeviceManager.AddDevice(tcp);
// return tcp;
// }
// var com = properties["Com"];
// if (com != null)
// {
// // Make the interim config object
// var comConfig = JsonConvert.DeserializeObject<ComPortConfig>(com.ToString(),
// new JsonSerializerSettings { ObjectCreationHandling = ObjectCreationHandling.Replace });
// // Get the IComPorts hardware device from the Device or Control System
// var comDev = comConfig.GetIComPortsDeviceFromManagedDevice();
// if (comDev != null)
// {
// var controller = new ComPortController(commKey, comDev.ComPorts[comConfig.ComPortNumber], comConfig.ComSpec);
// DeviceManager.AddDevice(controller);
// return controller;
// }
// }
// Debug.Console(0, "No Tcp or Com port information for port {0}", commKey);
// return null;
// }
// }
//}

View File

@@ -0,0 +1,91 @@
using System;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
using Newtonsoft.Json.Linq;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Devices;
//using PepperDash.Essentials.Devices.Dm;
using PepperDash.Core;
namespace PepperDash.Essentials
{
public class DmFactory
{
public static Device Create(JToken devToken)
{
Device dev = null;
try
{
var devType = devToken.Value<string>("type");
var devKey = devToken.Value<string>("key");
var devName = devToken.Value<string>("name");
// Catch all 200 series TX
var devprops = devToken["properties"];
var ipId = Convert.ToUInt32(devprops.Value<string>("ipId"), 16);
var parent = devprops.Value<string>("parent");
if (parent == null)
parent = "controlSystem";
if (devType.StartsWith("DmTx2", StringComparison.OrdinalIgnoreCase))
{
DmTx201C tx;
if (parent.Equals("controlSystem", StringComparison.OrdinalIgnoreCase))
{
tx = new DmTx201C(ipId, Global.ControlSystem);
//dev = new DmTx201SBasicController(devKey, devName, tx);
}
}
else if (devType.StartsWith("DmRmc", StringComparison.OrdinalIgnoreCase))
{
DmRmc100C rmc;
if (parent.Equals("controlSystem", StringComparison.OrdinalIgnoreCase))
{
rmc = new DmRmc100C(ipId, Global.ControlSystem);
//dev = new DmRmcBaseController(devKey, devName, rmc);
}
}
else
FactoryHelper.HandleUnknownType(devToken, devType);
}
catch (Exception e)
{
FactoryHelper.HandleDeviceCreationError(devToken, e);
}
return dev;
}
public static Device CreateChassis(JToken devToken)
{
Device dev = null;
try
{
var devType = devToken.Value<string>("type");
var devKey = devToken.Value<string>("key");
var devName = devToken.Value<string>("name");
// Catch all 200 series TX
var devprops = devToken["properties"];
var ipId = Convert.ToUInt32(devprops.Value<string>("ipId"), 16);
var parent = devprops.Value<string>("parent");
if (parent == null)
parent = "controlSystem";
if (devType.Equals("dmmd8x8", StringComparison.OrdinalIgnoreCase))
{
var dm = new DmMd8x8(ipId, Global.ControlSystem);
//dev = new DmChassisController(devKey, devName, dm);
}
}
catch (Exception e)
{
FactoryHelper.HandleDeviceCreationError(devToken, e);
}
return dev;
}
}
}

View File

@@ -0,0 +1,124 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Devices;
using PepperDash.Core;
namespace PepperDash.Essentials
{
public static class FactoryHelper
{
public static string IrDriverPathPrefix = @"\NVRAM\IR\";
public static void HandleUnknownType(JToken devToken, string type)
{
Debug.Console(0, "[Config] ERROR: Type '{0}' not found in group '{1}'", type,
devToken.Value<string>("group"));
}
public static void HandleDeviceCreationError(JToken devToken, Exception e)
{
Debug.Console(0, "[Config] ERROR creating device [{0}]: \r{1}",
devToken["key"].Value<string>(), e);
Debug.Console(0, "Relevant config:\r{0}", devToken.ToString(Newtonsoft.Json.Formatting.Indented));
}
/// <summary>
/// Finds either the ControlSystem or a device controller that contains IR ports and
/// returns a port from the hardware device
/// </summary>
/// <param name="propsToken"></param>
/// <returns>Crestron IrPort or null if device doesn't have IR or is not found</returns>
public static IrOutPortConfig GetIrPort(JToken propsToken)
{
var irSpec = propsToken["control"]["irSpec"];
var portDevKey = irSpec.Value<string>("portDeviceKey");
var portNum = irSpec.Value<uint>("portNumber");
IIROutputPorts irDev = null;
if (portDevKey.Equals("controlSystem", StringComparison.OrdinalIgnoreCase)
|| portDevKey.Equals("processor", StringComparison.OrdinalIgnoreCase))
irDev = Global.ControlSystem;
else
irDev = DeviceManager.GetDeviceForKey(portDevKey) as IIROutputPorts;
if (irDev == null)
{
Debug.Console(0, "[Config] Error, device with IR ports '{0}' not found", portDevKey);
return null;
}
if (portNum <= irDev.NumberOfIROutputPorts) // success!
{
var file = IrDriverPathPrefix + irSpec["file"].Value<string>();
return new IrOutPortConfig { Port = irDev.IROutputPorts[portNum], FileName = file };
}
else
{
Debug.Console(0, "[Config] Error, device '{0}' IR port {1} out of range",
portDevKey, portNum);
return null;
}
}
/// <summary>
/// Finds either the ControlSystem or a device controller that contains com ports and
/// returns a port from the hardware device
/// </summary>
/// <param name="propsToken">The Properties token from the device's config</param>
/// <returns>Crestron ComPort or null if device doesn't have IR or is not found</returns>
public static ComPort GetComPort(JToken propsToken)
{
var portDevKey = propsToken.Value<string>("comPortDevice");
var portNum = propsToken.Value<uint>("comPortNumber");
IComPorts comDev = null;
if (portDevKey.Equals("controlSystem", StringComparison.OrdinalIgnoreCase))
comDev = Global.ControlSystem;
else
comDev = DeviceManager.GetDeviceForKey(portDevKey) as IComPorts;
if (comDev == null)
{
Debug.Console(0, "[Config] Error, device with com ports '{0}' not found", portDevKey);
return null;
}
if (portNum <= comDev.NumberOfComPorts) // success!
return comDev.ComPorts[portNum];
else
{
Debug.Console(0, "[Config] Error, device '{0}' com port {1} out of range",
portDevKey, portNum);
return null;
}
}
/// <summary>
/// Returns the key if it exists or converts the name into a key
/// </summary>
public static string KeyOrConvertName(string key, string name)
{
if (string.IsNullOrEmpty(key))
return name.Replace(' ', '-');
return key;
}
}
/// <summary>
/// Wrapper to help in IR port creation
/// </summary>
public class IrOutPortConfig
{
public IROutputPort Port { get; set; }
public string FileName { get; set; }
}
}

View File

@@ -0,0 +1,52 @@
//using System;
//using Crestron.SimplSharpPro;
//using Newtonsoft.Json.Linq;
//using PepperDash.Essentials.Core;
//using PepperDash.Essentials.Devices;
//using PepperDash.Core;
//namespace PepperDash.Essentials
//{
// public class SetTopBoxFactory
// {
// public static Device Create(JToken devToken)
// {
// Device dev = null;
// try
// {
// var devType = devToken.Value<string>("type");
// var devKey = devToken.Value<string>("key");
// var devName = devToken.Value<string>("name");
// var props = devToken["properties"];
// var portConfig = FactoryHelper.GetIrPort(props);
// if (portConfig != null)
// {
// if (devType.EndsWith("-generic"))
// {
// var stb = new IrSetTopBoxBase(devKey, devName, portConfig.Port, portConfig.FileName);
// // Do this a better way?
// stb.HasDpad = props["hasDpad"].Value<bool>();
// stb.HasDvr = props["hasDvr"].Value<bool>();
// stb.HasNumbers = props["hasNumbers"].Value<bool>();
// stb.HasPreset = props["hasPresets"].Value<bool>();
// dev = stb;
// }
// else
// FactoryHelper.HandleUnknownType(devToken, devType);
// var preDev = dev as IHasSetTopBoxProperties;
// if(preDev.HasPreset)
// preDev.LoadPresets(props["presetListName"].Value<string>());
// }
// }
// catch (Exception e)
// {
// FactoryHelper.HandleDeviceCreationError(devToken, e);
// }
// return dev;
// }
// }
//}

View File

@@ -0,0 +1,34 @@
//using System;
//using Crestron.SimplSharpPro;
//using Newtonsoft.Json.Linq;
//using PepperDash.Essentials.Core;
//using PepperDash.Essentials.Devices;
//using PepperDash.Core;
//namespace PepperDash.Essentials
//{
// public class PcFactory
// {
// public static Device Create(JToken devToken)
// {
// Device dev = null;
// //try
// //{
// // var devType = devToken.Value<string>("type");
// // var devKey = devToken.Value<string>("key");
// // var devName = devToken.Value<string>("name");
// // if (devType.Equals("laptop", StringComparison.OrdinalIgnoreCase))
// // dev = new Laptop(devKey, devName);
// // else
// // FactoryHelper.HandleUnknownType(devToken, devType);
// //}
// //catch (Exception e)
// //{
// // FactoryHelper.HandleDeviceCreationError(devToken, e);
// //}
// return dev;
// }
// }
//}

View File

@@ -0,0 +1,46 @@
//using System;
//using Crestron.SimplSharpPro;
//using Newtonsoft.Json.Linq;
//using PepperDash.Essentials.Core;
//using PepperDash.Essentials.Devices;
//using PepperDash.Core;
//namespace PepperDash.Essentials
//{
// public class DiscPlayerFactory
// {
// public static Device Create(JToken devToken)
// {
// Device dev = null;
// try
// {
// var devType = devToken.Value<string>("type");
// var devKey = devToken.Value<string>("key");
// var devName = devToken.Value<string>("name");
// // Filter out special (Pioneer
// //(devType.Equals("genericIr", StringComparison.OrdinalIgnoreCase))
// var props = devToken["properties"];
// var portConfig = FactoryHelper.GetIrPort(props);
// if (portConfig != null)
// {
// if (devType.EndsWith("-generic"))
// dev = new IrDvdBase(devKey, devName, portConfig.Port, portConfig.FileName);
// else
// FactoryHelper.HandleUnknownType(devToken, devType);
// }
// // NO PORT ERROR HERE??
// }
// catch (Exception e)
// {
// FactoryHelper.HandleDeviceCreationError(devToken, e);
// }
// return dev;
// }
// }
//}

View File

@@ -0,0 +1,127 @@
//using System;
//using System.Collections.Generic;
//using Crestron.SimplSharpPro;
//using Crestron.SimplSharpPro.Remotes;
//using Crestron.SimplSharpPro.UI;
//using Newtonsoft.Json;
//using Newtonsoft.Json.Linq;
//using PepperDash.Essentials.Core;
//using PepperDash.Essentials.Devices;
////using PepperDash.Essentials.Remotes;
//using PepperDash.Core;
//namespace PepperDash.Essentials
//{
// //public class RemoteFactory
// //{
// // public static Device Create(JToken devToken)
// // {
// // Hr150Controller dev = null;
// // try
// // {
// // var devType = devToken.Value<string>("type");
// // var devKey = devToken.Value<string>("key");
// // var devName = devToken.Value<string>("name");
// // var props = devToken["properties"];
// // if (devType.Equals("hr150", StringComparison.OrdinalIgnoreCase))
// // {
// // uint id = Convert.ToUInt32(props.Value<string>("rfId"), 16);
// // var parent = props.Value<string>("rfGateway");
// // RFExGateway rf = GetGateway(parent);
// // var hw = new Hr150(id, rf);
// // dev = new Hr150Controller(devKey, devName, hw);
// // // Have to add the buttons and default source after all devices are spun up
// // dev.AddPostActivationAction(() =>
// // {
// // var defaultSystemKey = props.Value<string>("defaultSystemKey");
// // dev.SetCurrentRoom((EssentialsRoom)DeviceManager.GetDeviceForKey(defaultSystemKey));
// // // Link custom buttons
// // var buttonProps = JsonConvert.DeserializeObject<Dictionary<uint, string>>(props["buttons"].ToString());
// // foreach (var kvp in buttonProps)
// // {
// // var split = kvp.Value.Split(':');
// // if (split[0].Equals("source"))
// // {
// // var src = DeviceManager.GetDeviceForKey(split[1]) as IPresentationSource;
// // if (src == null)
// // {
// // Debug.Console(0, dev, "Error: Cannot add source key '{0}'", split[1]);
// // continue;
// // }
// // dev.SetCustomButtonAsSource(kvp.Key, src);
// // }
// // else if (split[0] == "room")
// // {
// // if (split[1] == "off")
// // dev.SetCustomButtonAsRoomOff(kvp.Key);
// // }
// // }
// // });
// // }
// // else if (devType.Equals("tsr302", StringComparison.OrdinalIgnoreCase))
// // {
// // uint id = Convert.ToUInt32(props.Value<string>("rfId"), 16);
// // var parent = props.Value<string>("rfGateway");
// // RFExGateway rf = GetGateway(parent);
// // var sgd = props.Value<string>("sgdPath");
// // var hw = new Tsr302(id, rf);
// // //dev = new Hr150Controller(devKey, devName, hw);
// // //// Have to add the buttons and default source after all devices are spun up
// // //dev.AddPostActivationAction(() =>
// // //{
// // // var defaultSystemKey = props.Value<string>("defaultSystemKey");
// // // dev.SetCurrentRoom((EssentialsRoom)DeviceManager.GetDeviceForKey(defaultSystemKey));
// // // // Link custom buttons
// // // var buttonProps = JsonConvert.DeserializeObject<Dictionary<uint, string>>(props["buttons"].ToString());
// // // foreach (var kvp in buttonProps)
// // // {
// // // var split = kvp.Value.Split(':');
// // // if (split[0].Equals("source"))
// // // {
// // // var src = DeviceManager.GetDeviceForKey(split[1]) as IPresentationSource;
// // // if (src == null)
// // // {
// // // Debug.Console(0, dev, "Error: Cannot add source key '{0}'", split[1]);
// // // continue;
// // // }
// // // dev.SetCustomButtonAsSource(kvp.Key, src);
// // // }
// // // else if (split[0] == "room")
// // // {
// // // if (split[1] == "off")
// // // dev.SetCustomButtonAsRoomOff(kvp.Key);
// // // }
// // // }
// // //});
// // }
// // }
// // catch (Exception e)
// // {
// // FactoryHelper.HandleDeviceCreationError(devToken, e);
// // }
// // return dev;
// // }
// // public static RFExGateway GetGateway(string parent)
// // {
// // if (parent == null)
// // parent = "controlSystem";
// // RFExGateway rf = null;
// // if (parent.Equals("controlSystem", StringComparison.OrdinalIgnoreCase)
// // || parent.Equals("processor", StringComparison.OrdinalIgnoreCase))
// // {
// // rf = Global.ControlSystem.ControllerRFGatewayDevice;
// // }
// // return rf;
// // }
// //}
//}

View File

@@ -0,0 +1,48 @@
//using System;
//using Crestron.SimplSharpPro;
//using Crestron.SimplSharpPro.UI;
//using Newtonsoft.Json.Linq;
//using PepperDash.Essentials.Core;
//using PepperDash.Essentials.Devices;
//using PepperDash.Core;
//namespace PepperDash.Essentials
//{
// public class TouchpanelFactory
// {
// public static Device Create(JToken devToken)
// {
// SmartGraphicsTouchpanelControllerBase dev = null;
// try
// {
// var devType = devToken.Value<string>("type");
// var devKey = devToken.Value<string>("key");
// var devName = devToken.Value<string>("name");
// var props = devToken["properties"];
// if (devType.Equals("Tsw1052", StringComparison.OrdinalIgnoreCase))
// {
// uint ipId = Convert.ToUInt32(props.Value<string>("ipId"), 16);
// var hw = new Tsw1052(ipId, Global.ControlSystem);
// dev = TouchpanelControllerFactory.Create(devKey, devName, hw, props.Value<string>("sgdPath"));
// dev.UsesSplashPage = props.Value<bool>("usesSplashPage");
// dev.ShowDate = props.Value<bool>("showDate");
// dev.ShowTime = props.Value<bool>("showTime");
// // This plugs the system key into the tp, but it won't be linked up until later
// dev.AddPostActivationAction(() =>
// {
// var defaultSystemKey = props.Value<string>("defaultSystemKey");
// dev.SetCurrentRoom((EssentialsRoom)DeviceManager.GetDeviceForKey(defaultSystemKey));
// });
// }
// }
// catch (Exception e)
// {
// FactoryHelper.HandleDeviceCreationError(devToken, e);
// }
// return dev;
// }
// }
//}

View File

@@ -0,0 +1,163 @@
using System;
using System.Linq;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.CrestronThread;
using PepperDash.Core;
using PepperDash.Core.PortalSync;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Devices.Common;
using PepperDash.Essentials.DM;
using PepperDash.Essentials.Fusion;
namespace PepperDash.Essentials
{
public class ControlSystem : CrestronControlSystem
{
PepperDashPortalSyncClient PortalSync;
public ControlSystem()
: base()
{
Thread.MaxNumberOfUserThreads = 400;
Global.ControlSystem = this;
DeviceManager.Initialize(this);
}
/// <summary>
/// Git 'er goin'
/// </summary>
public override void InitializeSystem()
{
//CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Reloads configuration file",
// ConsoleAccessLevelEnum.AccessOperator);
//CrestronConsole.AddNewConsoleCommand(s => TearDown(), "ungo", "Reloads configuration file",
// ConsoleAccessLevelEnum.AccessOperator);
GoWithLoad();
}
/// <summary>
/// Do it, yo
/// </summary>
public void GoWithLoad()
{
var thread = new Thread(o =>
{
try
{
CrestronConsole.AddNewConsoleCommand(EnablePortalSync, "portalsync", "Loads Portal Sync",
ConsoleAccessLevelEnum.AccessOperator);
//PortalSync = new PepperDashPortalSyncClient();
//GoWithLoad();
Debug.Console(0, "Starting Essentials load from configuration");
ConfigReader.LoadConfig2();
LoadDevices();
LoadTieLines();
LoadRooms();
// FUSION - should go per room I believe. See CreateSystems in original Configuration.cs
// ???
DeviceManager.ActivateAll();
Debug.Console(0, "Essentials load complete\r" +
"-------------------------------------------------------------");
}
catch (Exception e)
{
Debug.Console(0, "FATAL INITIALIZE ERROR. System is in an inconsistent state:\r{0}", e);
}
return null;
}, null);
}
public void EnablePortalSync(string s)
{
if (s.ToLower() == "enable")
{
CrestronConsole.ConsoleCommandResponse("Portal Sync features enabled");
PortalSync = new PepperDashPortalSyncClient();
}
}
public void TearDown()
{
Debug.Console(0, "Tearing down existing system");
DeviceManager.DeactivateAll();
TieLineCollection.Default.Clear();
foreach (var key in DeviceManager.GetDevices())
DeviceManager.RemoveDevice(key);
Debug.Console(0, "Tear down COMPLETE");
}
/// <summary>
/// Reads all devices from config and adds them to DeviceManager
/// </summary>
public void LoadDevices()
{
foreach (var devConf in ConfigReader.ConfigObject.Devices)
{
Debug.Console(0, "Creating device '{0}'", devConf.Key);
// Skip this to prevent unnecessary warnings
if (devConf.Key == "processor")
continue;
// Try local factory first
var newDev = DeviceFactory.GetDevice(devConf);
// Then associated library factories
if (newDev == null)
newDev = PepperDash.Essentials.Devices.Common.DeviceFactory.GetDevice(devConf);
if (newDev == null)
newDev = PepperDash.Essentials.DM.DeviceFactory.GetDevice(devConf);
if (newDev == null)
newDev = PepperDash.Essentials.Displays.DeviceFactory.GetDevice(devConf);
if (newDev != null)
DeviceManager.AddDevice(newDev);
else
Debug.Console(0, "WARNING: Cannot load unknown device type '{0}', key '{1}'.", devConf.Type, devConf.Key);
}
}
/// <summary>
/// Helper method to load tie lines. This should run after devices have loaded
/// </summary>
public void LoadTieLines()
{
// Make this reusable by clearing the TieLineCollection
var tlc = TieLineCollection.Default;
tlc.Clear();
foreach (var tieLineConfig in ConfigReader.ConfigObject.TieLines)
{
var newTL = tieLineConfig.GetTieLine();
if (newTL != null)
tlc.Add(newTL);
}
}
/// <summary>
/// Reads all rooms from config and adds them to DeviceManager
/// </summary>
public void LoadRooms()
{
foreach (var roomConfig in ConfigReader.ConfigObject.Rooms)
{
var room = roomConfig.GetRoomObject();
if (room != null)
{
DeviceManager.AddDevice(room);
//DeviceManager.AddDevice(new EssentialsHuddleSpaceFusionSystemController(room, 0xf1));
#warning Add Fusion connector to room factory?
}
else
Debug.Console(0, "WARNING: Cannot create room from config, key '{0}'", roomConfig.Key);
}
}
}
}

View File

@@ -0,0 +1,42 @@
using System;
using System.Linq;
using System.Collections.Generic;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Devices
{
///// <summary>
///// This DVD class should cover most IR, one-way DVD and Bluray fuctions
///// </summary>
//public class OppoBluray : IrDvdBase, IDvdControls, IExtendedOutputs
//{
// public OppoBluray(string key, string name, IROutputPort port, string irDriverFilepath) : base(key, name, port, irDriverFilepath) { }
// public OutputsToTriListBridge GetExtendedOutputsToTriListBridge()
// {
// return new ExtendedDvdTriListBridge();
// }
//}
//public class ExtendedDvdTriListBridge : OutputsToTriListBridge
//{
// public override void Link()
// {
// throw new NotImplementedException();
// }
// public override void UnLink()
// {
// throw new NotImplementedException();
// }
//}
}

View File

@@ -0,0 +1,45 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using Crestron.SimplSharp;
//using Crestron.SimplSharpPro;
//using Crestron.SimplSharpPro.DeviceSupport;
//using PepperDash.Essentials.Core;
//namespace PepperDash.Essentials.Devices
//{
// public class AppleTV : Device, IHasCueActionList
// {
// public IrOutputPortController IrPort { get; private set; }
// public AppleTV(string key, string name, IROutputPort port, string irDriverFilepath)
// : base(key, name)
// {
// IrPort = new IrOutputPortController("ir" + key, port, irDriverFilepath);
// }
// #region IFunctionList Members
// public List<CueActionPair> CueActionList
// {
// get
// {
// var numToIr = new Dictionary<Cue, string>
// {
// { CommonBoolCue.Menu, IROutputStandardCommands.IROut_MENU },
// { CommonBoolCue.Up, IROutputStandardCommands.IROut_UP_ARROW },
// { CommonBoolCue.Down, IROutputStandardCommands.IROut_DN_ARROW },
// { CommonBoolCue.Left, IROutputStandardCommands.IROut_LEFT_ARROW },
// { CommonBoolCue.Right, IROutputStandardCommands.IROut_RIGHT_ARROW },
// { CommonBoolCue.Select, IROutputStandardCommands.IROut_ENTER }
// };
// var funcs = new List<CueActionPair>(numToIr.Count);
// foreach (var kvp in numToIr)
// funcs.Add(new BoolCueActionPair(kvp.Key, b => IrPort.PressRelease(kvp.Value, b)));
// return funcs;
// }
// }
// #endregion
// }
//}

View File

@@ -0,0 +1,84 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Crestron.SimplSharp;
//using Crestron.SimplSharpPro;
//using PepperDash.Core;
//using PepperDash.Essentials.Core;
//namespace PepperDash.Essentials
//{
// //***************************************************************************************************
// public abstract class EssentialsRoom : Room
// {
// public event EventHandler<EssentialsRoomSourceChangeEventArgs> PresentationSourceChange;
// public event EventHandler<EssentialsRoomAudioDeviceChangeEventArgs> AudioDeviceWillChange;
// public Dictionary<uint, Device> Sources { get; protected set; }
// public abstract BoolFeedback RoomIsOnStandby { get; protected set; }
// public abstract BoolFeedback RoomIsOccupied { get; protected set; }
// public uint UnattendedShutdownTimeMs { get; set; }
// /// <summary>
// /// For use when turning on room without a source selection - e.g. from
// /// wake-on signal or occ sensor
// /// </summary>
// public SourceListItem DefaultPresentationSource { get; set; }
//#warning This might need more "guts" and shouldn't be public
// public SourceListItem CurrentPresentationSourceInfo { get; set; }
// //public IPresentationSource CurrentPresentationSource { get; protected set; }
// //{
// // get
// // {
// // if (_CurrentPresentationSource == null)
// // _CurrentPresentationSource = PresentationDevice.Default;
// // return _CurrentPresentationSource;
// // }
// // protected set { _CurrentPresentationSource = value; }
// //}
// //IPresentationSource _CurrentPresentationSource;
// /// <summary>
// /// The volume control device for this room - changing it will trigger event
// /// </summary>
// public IBasicVolumeControls CurrentAudioDevice
// {
// get { return _CurrentAudioDevice; }
// protected set
// {
// if (value != _CurrentAudioDevice)
// if (AudioDeviceWillChange != null)
// AudioDeviceWillChange(this,
// new EssentialsRoomAudioDeviceChangeEventArgs(this, _CurrentAudioDevice, value));
// _CurrentAudioDevice = value;
// }
// }
// IBasicVolumeControls _CurrentAudioDevice;
// public EssentialsRoom(string key, string name)
// : base(key, name)
// {
// }
// public virtual void SelectSource(uint sourceNum) { }
// public virtual void SelectSource(IPresentationSource newSrc) { }
// /// <summary>
// /// Make sure that this is called before changing the source
// /// </summary>
// protected void OnPresentationSourceChange(SourceListItem currentSource, SourceListItem newSource)
// {
// var handler = PresentationSourceChange;
// if (handler != null)
// PresentationSourceChange(this,
// new EssentialsRoomSourceChangeEventArgs(this, currentSource, newSource));
// }
// }
//}

View File

@@ -0,0 +1,378 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Crestron.SimplSharp;
//using Crestron.SimplSharpPro;
//using PepperDash.Core;
//using PepperDash.Essentials.Core;
//namespace PepperDash.Essentials
//{
// //***************************************************************************************************
// public class HuddleSpaceRoom : EssentialsRoom
// {
// public override BoolFeedback RoomIsOnFeedback { get; protected set; }
// public override BoolFeedback IsWarmingUpFeedback { get; protected set; }
// public override BoolFeedback IsCoolingDownFeedback { get; protected set; }
// public override BoolFeedback RoomIsOnStandby { get; protected set; }
// public override BoolFeedback RoomIsOccupied { get; protected set; }
// public override uint WarmupTime
// {
// get
// {
// if (_Display != null)
// return _Display.WarmupTime;
// return base.WarmupTime;
// }
// }
// public override uint CooldownTime
// {
// get
// {
// if (_Display != null)
// return _Display.CooldownTime;
// return base.CooldownTime;
// }
// }
// bool NoDisplayRoomIsOn = false;
// public DisplayBase DefaultDisplay // PROTECT ---------------------------------------------
// {
// get
// {
// if (_Display == null)
// _Display = TwoWayDisplayBase.DefaultDisplay;
// return _Display;
// }
// set
// {
// // Disconnect current display
// if (_Display != null)
// {
// _Display.PowerIsOnFeedback.OutputChange -= Display_Various_OutputChange;
// _Display.IsCoolingDownFeedback.OutputChange -= Display_Various_OutputChange;
// _Display.IsWarmingUpFeedback.OutputChange -= Display_Various_OutputChange;
// }
// _Display = value;
// if (value != null)
// {
// _Display.PowerIsOnFeedback.OutputChange += Display_Various_OutputChange;
// _Display.IsCoolingDownFeedback.OutputChange += Display_Various_OutputChange;
// _Display.IsWarmingUpFeedback.OutputChange += Display_Various_OutputChange;
// }
// CurrentAudioDevice = (value as IBasicVolumeControls);
// }
// }
// DisplayBase _Display;
// public IBasicVolumeControls DefaultVolumeControls
// {
// get { return DefaultDisplay as IBasicVolumeControls; }
// }
// public IntFeedback SourcesCount { get; private set; }
// public StringFeedback CurrentSourceName { get; private set; }
// public string SourceListKey { get; set; }
// string LastSourceKey;
// public HuddleSpaceRoom(string key, string name)
// : base(key, name)
// {
// // Return the state of the display, unless no display, then return
// // a local or default state.
// RoomIsOnFeedback = new BoolFeedback(RoomCue.RoomIsOn,
// () => DefaultDisplay != null ? DefaultDisplay.PowerIsOnFeedback.BoolValue : NoDisplayRoomIsOn);
// IsWarmingUpFeedback = new BoolFeedback(RoomCue.RoomIsWarmingUp,
// () => DefaultDisplay != null ? DefaultDisplay.IsWarmingUpFeedback.BoolValue : false);
// IsCoolingDownFeedback = new BoolFeedback(RoomCue.RoomIsCoolingDown,
// () => DefaultDisplay != null ? DefaultDisplay.IsCoolingDownFeedback.BoolValue : false);
// RoomIsOnStandby = new BoolFeedback(RoomCue.RoomIsOnStandby,
// () => false);
// RoomIsOccupied = new BoolFeedback(RoomCue.RoomIsOccupied,
// () => true);
// Sources = new Dictionary<uint, Device>();
// SourcesCount = new IntFeedback(RoomCue.SourcesCount,
// () => Sources.Count);
// CurrentSourceName = new StringFeedback(() => CurrentPresentationSourceInfo.PreferredName);// CurrentPresentationSource.Name);
// //CurrentSourceType = new IntOutput(RoomCue.CurrentSourceType,
// // () => CurrentPresentationSource.Type);
// UnattendedShutdownTimeMs = 60000;
// }
// public override void RoomOn()
// {
// Debug.Console(0, this, "Room on");
// if (IsCoolingDownFeedback.BoolValue || IsWarmingUpFeedback.BoolValue)
// {
// Debug.Console(2, this, "Room is warming or cooling. Ignoring room on");
// return;
// }
// if (!RoomIsOnFeedback.BoolValue)
// {
// // Setup callback when powerOn happens
// EventHandler<EventArgs> oneTimeHandler = null;
// oneTimeHandler = (o, a) =>
// {
// Debug.Console(0, this, "RoomOn received display power on: {0}",
// DefaultDisplay.PowerIsOnFeedback.BoolValue);
// // if it's power on
// if (DefaultDisplay.PowerIsOnFeedback.BoolValue)
// {
// (DefaultDisplay as TwoWayDisplayBase).PowerIsOnFeedback.OutputChange -= oneTimeHandler;
// Debug.Console(1, this, "Display has powered on");
// RoomIsOnFeedback.FireUpdate();
// //if (callback != null)
// // callback();
// }
// };
// DefaultDisplay.PowerIsOnFeedback.OutputChange += oneTimeHandler;
// DefaultDisplay.PowerOn();
// }
// }
// public override void RoomOff()
// {
// if (!RoomIsOnFeedback.BoolValue)
// {
// Debug.Console(2, this, "Room is already off");
// return;
// }
// Debug.Console(0, this, "Room off");
// DefaultDisplay.PowerOff();
// //RoomIsOn.FireUpdate(); ---Display will provide this in huddle
// //OnPresentationSourceChange(null);
// //CurrentPresentationSource = null;
// }
// public override void SelectSource(uint sourceNum)
// {
// // Run this on a separate thread
// new CTimer(o =>
// {
// var routeKey = "source-" + sourceNum;
// Debug.Console(1, this, "Run room action '{0}'", routeKey);
// if (string.IsNullOrEmpty(SourceListKey))
// {
// Debug.Console(1, this, "WARNING: No source/action list defined for this room");
// return;
// }
// // Try to get the list from the config object, using SourceListKey string
// if (!ConfigReader.ConfigObject.SourceLists.ContainsKey(SourceListKey))
// {
// Debug.Console(1, this, "WARNING: Config source list '{0}' not found", SourceListKey);
// return;
// }
// var list = ConfigReader.ConfigObject.SourceLists[SourceListKey];
// // Try to get the list item by it's string key
// if (!list.ContainsKey(routeKey))
// {
// Debug.Console(1, this, "WARNING: No item '{0}' found on config list '{1}'",
// routeKey, SourceListKey);
// return;
// }
// var item = list[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;
// 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);
// }
// // 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;
// }
// CurrentAudioDevice = volDev;
// // store the name and UI info for routes
// if (item.SourceKey != null)
// CurrentPresentationSourceInfo = item;
// // And finally, set the "control". This will trigger event
// //CurrentControlDevice = DeviceManager.GetDeviceForKey(item.SourceKey) as Device;
// RoomIsOnFeedback.FireUpdate();
// }, 0); // end of CTimer
// //Debug.Console(1, this, "Checking for source {0}", sourceNum);
// //if (Sources.ContainsKey(sourceNum))
// //{
// // var newSrc = Sources[sourceNum];
// // if (!RoomIsOn.BoolValue)
// // {
// // EventHandler<EventArgs> oneTimeHandler = null;
// // oneTimeHandler = (o, a) =>
// // {
// // RoomIsOn.OutputChange -= oneTimeHandler;
// // FinishSourceSelection(newSrc);
// // };
// // RoomIsOn.OutputChange -= oneTimeHandler;
// // RoomIsOn.OutputChange += oneTimeHandler;
// // RoomOn();
// // }
// // else FinishSourceSelection(newSrc);
// //}
// }
// /// <summary>
// ///
// /// </summary>
// /// <param name="route"></param>
// /// <returns></returns>
// bool DoRoute(SourceRouteListItem route)
// {
// IRoutingSinkNoSwitching dest = null;
// 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 (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;
// }
// ///// <summary>
// /////
// ///// </summary>
// ///// <param name="newSrc"></param>
// //public override void SelectSource(IPresentationSource newSrc)
// //{
// // if (Sources.ContainsValue(newSrc))
// // {
// // if (!RoomIsOn.BoolValue)
// // {
// // EventHandler<EventArgs> oneTimeHandler = null;
// // oneTimeHandler = (o, a) =>
// // {
// // RoomIsOn.OutputChange -= oneTimeHandler;
// // FinishSourceSelection(newSrc);
// // };
// // RoomIsOn.OutputChange -= oneTimeHandler;
// // RoomIsOn.OutputChange += oneTimeHandler;
// // RoomOn();
// // }
// // else FinishSourceSelection(newSrc);
// // }
// //}
// void Display_Various_OutputChange(object sender, EventArgs e)
// {
// // Bounce through the output changes
// if (sender == DefaultDisplay.PowerIsOnFeedback)
// this.RoomIsOnFeedback.FireUpdate();
// else if (sender == DefaultDisplay.IsCoolingDownFeedback)
// this.IsCoolingDownFeedback.FireUpdate();
// else if (sender == DefaultDisplay.IsWarmingUpFeedback)
// this.IsWarmingUpFeedback.FireUpdate();
// }
//// void FinishSourceSelection(IPresentationSource newSource)
//// {
//// Debug.Console(1, this, "Selecting source {0}", newSource.Key);
//// // Notify anyone watching source that it's leaving
//// OnPresentationSourceChange(newSource);
//// CurrentPresentationSource = newSource;
//// var routeableSource = CurrentPresentationSource as IRoutingOutputs;
//// if (routeableSource != null)
////#warning source route type will need clarification
//// DefaultDisplay.GetRouteToSource(routeableSource, eRoutingSignalType.AudioVideo);
//// else
//// Debug.Console(1, this, "New selected source {0} is not routeable", CurrentPresentationSource);
//// CurrentSourceName.FireUpdate();
//// //CurrentSourceType.FireUpdate();
//// }
// public override List<Feedback> Feedbacks
// {
// get
// {
// var feedbacks = new List<Feedback>
// {
// SourcesCount,
// CurrentSourceName,
// //CurrentSourceType,
// };
// feedbacks.AddRange(base.Feedbacks);
// return feedbacks;
// }
// }
// }
//}

View File

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

View File

@@ -0,0 +1,47 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Crestron.SimplSharp;
//using Crestron.SimplSharpPro;
//using Crestron.SimplSharpPro.DeviceSupport;
//using PepperDash.Core;
//using PepperDash.Essentials.Core;
//using PepperDash.Essentials.Core.Presets;
//namespace PepperDash.Essentials
//{
// /// <summary>
// ///
// /// </summary>
// public abstract class DevicePageControllerBase
// {
// protected BasicTriListWithSmartObject TriList;
// protected List<BoolInputSig> FixedObjectSigs;
// public DevicePageControllerBase(BasicTriListWithSmartObject triList)
// {
// TriList = triList;
// }
// public void SetVisible(bool state)
// {
// foreach (var sig in FixedObjectSigs)
// {
// Debug.Console(2, "set visible {0}={1}", sig.Number, state);
// sig.BoolValue = state;
// }
// CustomSetVisible(state);
// }
// /// <summary>
// /// Add any specialized show/hide logic here - beyond FixedObjectSigs. Overriding
// /// methods do not need to call this base method
// /// </summary>
// protected virtual void CustomSetVisible(bool state)
// {
// }
// }
//}

View File

@@ -0,0 +1,308 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using Crestron.SimplSharp;
//using Crestron.SimplSharpPro;
//using Crestron.SimplSharpPro.DeviceSupport;
//using Crestron.SimplSharpPro.UI;
//using PepperDash.Core;
//namespace PepperDash.Essentials.Core
//{
// /// <summary>
// ///
// /// </summary>
// public class LargeTouchpanelControllerBase : SmartGraphicsTouchpanelControllerBase
// {
// public string PresentationShareButtonInVideoText = "Share";
// public string PresentationShareButtonNotInVideoText = "Presentation";
// SourceListSubpageReferenceList SourceSelectSRL;
// DevicePageControllerBase CurrentPresentationSourcePageController;
// public LargeTouchpanelControllerBase(string key, string name,
// BasicTriListWithSmartObject triList, string sgdFilePath)
// : base(key, name, triList, sgdFilePath)
// {
// }
// /// <summary>
// /// Static factory method
// /// </summary>
// public static LargeTouchpanelControllerBase GetController(string key, string name,
// string type, CrestronTswPropertiesConfig props)
// {
// var id = Convert.ToUInt32(props.IpId, 16);
// type = type.ToLower();
// Tswx52ButtonVoiceControl tsw = null;
// if (type == "tsw752")
// tsw = new Tsw752(id, Global.ControlSystem);
// else if (type == "tsw1052")
// tsw = new Tsw1052(id, Global.ControlSystem);
// else
// {
// Debug.Console(0, "WARNING: Cannot create TSW controller with type '{0}'", type);
// return null;
// }
// var sgdPath = string.Format(@"\NVRAM\Program{0}\SGD\{1}",
// InitialParametersClass.ApplicationNumber, props.SgdFile);
// var controller = new LargeTouchpanelControllerBase(key, name, tsw, sgdPath);
// controller.UsesSplashPage = props.UsesSplashPage;
// // Get the room and add it after everthing is ready
// var room = DeviceManager.GetDeviceForKey(props.DefaultRoomKey) as EssentialsRoom;
// controller.AddPostActivationAction(() =>
// {
// controller.SetCurrentRoom(room);
// });
// return controller;
// }
// public override bool CustomActivate()
// {
// var baseSuccess = base.CustomActivate();
// if (!baseSuccess) return false;
// SourceSelectSRL = new SourceListSubpageReferenceList(this.TriList, n =>
// { if (CurrentRoom != null) CurrentRoom.SelectSource(n); });
// var lm = Global.LicenseManager;
// if (lm != null)
// {
// lm.LicenseIsValid.LinkInputSig(TriList.BooleanInput[UiCue.ShowLicensed.Number]);
// //others
// }
// // Wire up buttons
// TriList.SetSigFalseAction(15003, () => SetMainMode(eMainModeType.Presentation));
// TriList.SetSigFalseAction(15008, PowerOffWithConfirmPressed);
// TriList.SetSigFalseAction(15101, () => SetMainMode(eMainModeType.Presentation));
// TriList.SetSigFalseAction(15013, ShowHelp);
// TriList.SetSigFalseAction(15014, () => SetMainMode(eMainModeType.Tech));
// // Temp things -----------------------------------------------------------------------
// TriList.StringInput[UiCue.SplashMessage.Number].StringValue = SplashMessage;
// //------------------------------------------------------------------------------------
// // Initialize initial view
// ShowSplashOrMain();
// return true;
// }
// /// <summary>
// /// In Essentials, this should NEVER be called, since it's a one-room solution
// /// </summary>
// protected override void HideRoomUI()
// {
// // UI Cleanup here????
// //SwapAudioDeviceControls(CurrentRoom.CurrentAudioDevice, null);
// //CurrentRoom.AudioDeviceWillChange -= CurrentRoom_AudioDeviceWillChange;
// CurrentRoom.IsCoolingDownFeedback.OutputChange -= CurrentRoom_IsCoolingDown_OutputChange;
// CurrentRoom.IsWarmingUpFeedback.OutputChange -= CurrentRoom_IsWarmingUp_OutputChange;
// SourceSelectSRL.DetachFromCurrentRoom();
// }
// /// <summary>
// /// Ties this panel controller to the Room and gets updates.
// /// </summary>
// protected override void ShowRoomUI()
// {
// Debug.Console(1, this, "connecting to system '{0}'", CurrentRoom.Key);
// TriList.StringInput[RoomCue.Name.Number].StringValue = CurrentRoom.Name;
// TriList.StringInput[RoomCue.Description.Number].StringValue = CurrentRoom.Description;
// CurrentRoom.IsCoolingDownFeedback.OutputChange -= CurrentRoom_IsCoolingDown_OutputChange;
// CurrentRoom.IsWarmingUpFeedback.OutputChange -= CurrentRoom_IsWarmingUp_OutputChange;
// CurrentRoom.IsCoolingDownFeedback.OutputChange += CurrentRoom_IsCoolingDown_OutputChange;
// CurrentRoom.IsWarmingUpFeedback.OutputChange += CurrentRoom_IsWarmingUp_OutputChange;
// SourceSelectSRL.AttachToRoom(CurrentRoom);
// }
// void CurrentRoom_IsCoolingDown_OutputChange(object sender, EventArgs e)
// {
// Debug.Console(2, this, "Received room in cooldown={0}", CurrentRoom.IsCoolingDownFeedback.BoolValue);
// if (CurrentRoom.IsCoolingDownFeedback.BoolValue) // When entering cooldown
// {
// // Do we need to check for an already-running cooldown - like in the case of room switches?
// new ModalDialog(TriList).PresentModalTimerDialog(0, "Power Off", "Power", "Please wait, shutting down",
// "", "", CurrentRoom.CooldownTime, true, b =>
// {
// ShowSplashOrMain();
// });
// }
// }
// void CurrentRoom_IsWarmingUp_OutputChange(object sender, EventArgs e)
// {
// Debug.Console(2, this, "Received room in warmup={0}", CurrentRoom.IsWarmingUpFeedback.BoolValue);
// if (CurrentRoom.IsWarmingUpFeedback.BoolValue) // When entering warmup
// {
// // Do we need to check for an already-running cooldown - like in the case of room switches?
// new ModalDialog(TriList).PresentModalTimerDialog(0, "Power On", "Power", "Please wait, powering on",
// "", "", CurrentRoom.WarmupTime, false, b =>
// {
// // Reveal sources - or has already been done behind modal
// });
// }
// }
// // Handler for source change events.
// void CurrentRoom_PresentationSourceChange(object sender, EssentialsRoomSourceChangeEventArgs args)
// {
// // Put away the old source and set up the new source.
// Debug.Console(2, this, "Received source change={0}", args.NewSource != null ? args.NewSource.SourceKey : "none");
// // If we're in tech, don't switch screen modes. Add any other modes we may want to switch away from
// // inside the if below.
// if (MainMode == eMainModeType.Splash)
// SetMainMode(eMainModeType.Presentation);
// SetControlSource(args.NewSource);
// }
// //***********************************************************************
// //** UI Manipulation
// //***********************************************************************
// /// <summary>
// /// Shows the splash page or the main presentation page, depending on config setting
// /// </summary>
// void ShowSplashOrMain()
// {
// if (UsesSplashPage)
// SetMainMode(eMainModeType.Splash);
// else
// SetMainMode(eMainModeType.Presentation);
// }
// /// <summary>
// /// Switches between main modes
// /// </summary>
// void SetMainMode(eMainModeType mode)
// {
// MainMode = mode;
// switch (mode)
// {
// case eMainModeType.Presentation:
// TriList.BooleanInput[UiCue.VisibleCommonFooter.Number].BoolValue = true;
// TriList.BooleanInput[UiCue.VisibleCommonHeader.Number].BoolValue = true;
// TriList.BooleanInput[UiCue.VisibleSplash.Number].BoolValue = false;
// TriList.BooleanInput[UiCue.VisiblePresentationSourceList.Number].BoolValue = true;
// ShowCurrentPresentationSourceUi();
// break;
// case eMainModeType.Splash:
// TriList.BooleanInput[UiCue.VisibleCommonFooter.Number].BoolValue = false;
// TriList.BooleanInput[UiCue.VisibleCommonHeader.Number].BoolValue = false;
// TriList.BooleanInput[UiCue.VisiblePresentationSourceList.Number].BoolValue = false;
// TriList.BooleanInput[UiCue.VisibleSplash.Number].BoolValue = true;
// HideCurrentPresentationSourceUi();
// break;
// case eMainModeType.Tech:
// new ModalDialog(TriList).PresentModalTimerDialog(1, "Tech page", "Info",
// "Tech page will be here soon!<br>I promise",
// "Bueno!", "", 0, false, null);
// MainMode = eMainModeType.Presentation;
// break;
// default:
// break;
// }
// }
// /// <summary>
// ///
// /// </summary>
// void PowerOffWithConfirmPressed()
// {
// if (CurrentRoom == null)
// return;
// if (!CurrentRoom.RoomIsOnFeedback.BoolValue)
// return;
// // Timeout or button 1 press will shut down
// var modal = new ModalDialog(TriList);
// uint seconds = CurrentRoom.UnattendedShutdownTimeMs / 1000;
// var message = string.Format("Meeting will end in {0} seconds", seconds);
// modal.PresentModalTimerDialog(2, "End Meeting", "Info", message,
// "End Meeting Now", "Cancel", CurrentRoom.UnattendedShutdownTimeMs, true,
// but => { if (but != 2) CurrentRoom.RoomOff(); });
// }
// /// <summary>
// /// Reveals the basic UI for the current device
// /// </summary>
// protected override void ShowCurrentPresentationSourceUi()
// {
// if (MainMode == eMainModeType.Splash && CurrentRoom.RoomIsOnFeedback.BoolValue)
// SetMainMode(eMainModeType.Presentation);
// if (CurrentPresentationControlDevice == null)
// {
// // If system is off, do one thing
// // Otherwise, do something else - shouldn't be in this condition
// return;
// }
// // If a controller is already loaded, use it
// if (LoadedPageControllers.ContainsKey(CurrentPresentationControlDevice))
// CurrentPresentationSourcePageController = LoadedPageControllers[CurrentPresentationControlDevice];
// else
// {
// // This is by no means optimal, but for now....
// if (CurrentPresentationControlDevice.Type == PresentationSourceType.SetTopBox
// && CurrentPresentationControlDevice is ISetTopBoxControls)
// CurrentPresentationSourcePageController = new PageControllerLargeSetTopBoxGeneric(TriList,
// CurrentPresentationControlDevice as ISetTopBoxControls);
// else if (CurrentPresentationControlDevice.Type == PresentationSourceType.Laptop)
// CurrentPresentationSourcePageController = new PageControllerLaptop(TriList);
// // separate these...
// else if (CurrentPresentationControlDevice.Type == PresentationSourceType.Dvd)
// CurrentPresentationSourcePageController =
// new PageControllerLargeDvd(TriList, CurrentPresentationControlDevice as IDiscPlayerControls);
// else
// CurrentPresentationSourcePageController = null;
// // Save it.
// if (CurrentPresentationSourcePageController != null)
// LoadedPageControllers[CurrentPresentationControlDevice] = CurrentPresentationSourcePageController;
// }
// if (CurrentPresentationSourcePageController != null)
// CurrentPresentationSourcePageController.SetVisible(true);
// }
// protected override void HideCurrentPresentationSourceUi()
// {
// if (CurrentPresentationControlDevice != null && CurrentPresentationSourcePageController != null)
// CurrentPresentationSourcePageController.SetVisible(false);
// }
// void ShowHelp()
// {
// new ModalDialog(TriList).PresentModalTimerDialog(1, "Help", "Help", CurrentRoom.HelpMessage,
// "OK", "", 0, false, null);
// }
// protected void ListSmartObjects()
// {
// Debug.Console(0, this, "Smart objects IDs:");
// var list = TriList.SmartObjects.OrderBy(s => s.Key);
// foreach (var kvp in list)
// Debug.Console(0, " {0}", kvp.Key);
// }
// }
//}

View File

@@ -0,0 +1,28 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Crestron.SimplSharp;
//using Crestron.SimplSharpPro;
//using Crestron.SimplSharpPro.DeviceSupport;
//using PepperDash.Core;
//using PepperDash.Essentials.Core;
//using PepperDash.Essentials.Core.Presets;
//namespace PepperDash.Essentials
//{
// public class PageControllerLaptop : DevicePageControllerBase
// {
// public PageControllerLaptop(BasicTriListWithSmartObject tl)
// : base(tl)
// {
// FixedObjectSigs = new List<BoolInputSig>
// {
// tl.BooleanInput[10092], // well
// tl.BooleanInput[11001] // Laptop info
// };
// }
// }
//}

View File

@@ -0,0 +1,46 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Crestron.SimplSharp;
//using Crestron.SimplSharpPro;
//using Crestron.SimplSharpPro.DeviceSupport;
//using PepperDash.Core;
//using PepperDash.Essentials.Core;
//using PepperDash.Essentials.Core.Presets;
//namespace PepperDash.Essentials
//{
// /// <summary>
// ///
// /// </summary>
// public class PageControllerLargeDvd : DevicePageControllerBase
// {
// IDiscPlayerControls Device;
// public PageControllerLargeDvd(BasicTriListWithSmartObject tl, IDiscPlayerControls device)
// : base(tl)
// {
// Device = device;
// FixedObjectSigs = new List<BoolInputSig>
// {
// tl.BooleanInput[10093], // well
// tl.BooleanInput[10411], // DVD Dpad
// tl.BooleanInput[10412] // everything else
// };
// }
// protected override void CustomSetVisible(bool state)
// {
// // Hook up smart objects if applicable
// if (Device != null)
// {
//#warning rewire this
// //var uos = (Device as IHasCueActionList).CueActionList;
// //SmartObjectHelper.LinkDpadWithUserObjects(TriList, 10411, uos, state);
// }
// }
// }
//}

View File

@@ -0,0 +1,139 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Crestron.SimplSharp;
//using Crestron.SimplSharpPro;
//using Crestron.SimplSharpPro.DeviceSupport;
//using PepperDash.Essentials.Core.Presets;
//using PepperDash.Core;
//using PepperDash.Essentials.Core;
//namespace PepperDash.Essentials
//{
// public class PageControllerLargeSetTopBoxGeneric : DevicePageControllerBase
// {
// // To-DO: Add properties for component subpage names. DpadPos1, DpadPos2...
// // Derived classes can then insert special subpages for variations on given
// // device types. Like DirecTV vs Comcast
// public uint DpadSmartObjectId { get; set; }
// public uint NumberPadSmartObjectId { get; set; }
// public uint PresetsSmartObjectId { get; set; }
// public uint Position5TabsId { get; set; }
// ISetTopBoxControls Device;
// DevicePresetsView PresetsView;
// bool ShowPosition5Tabs;
// uint CurrentVisiblePosition5Item = 1;
// Dictionary<uint, uint> Position5SubpageJoins = new Dictionary<uint, uint>
// {
// { 1, 10053 },
// { 2, 10054 }
// };
// public PageControllerLargeSetTopBoxGeneric(BasicTriListWithSmartObject tl, ISetTopBoxControls device)
// : base(tl)
// {
// Device = device;
// DpadSmartObjectId = 10011;
// NumberPadSmartObjectId = 10014;
// PresetsSmartObjectId = 10012;
// Position5TabsId = 10081;
// bool dpad = device is IDPad;
// bool preset = device.HasPresets;
// bool dvr = device.HasDvr;
// bool numbers = device is INumericKeypad;
// uint[] joins = null;
// if (dpad && !preset && !dvr && !numbers) joins = new uint[] { 10031, 10091 };
// else if (!dpad && preset && !dvr && !numbers) joins = new uint[] { 10032, 10091 };
// else if (!dpad && !preset && dvr && !numbers) joins = new uint[] { 10033, 10091 };
// else if (!dpad && !preset && !dvr && numbers) joins = new uint[] { 10034, 10091 };
// else if (dpad && preset && !dvr && !numbers) joins = new uint[] { 10042, 10021, 10092 };
// else if (dpad && !preset && dvr && !numbers) joins = new uint[] { 10043, 10021, 10092 };
// else if (dpad && !preset && !dvr && numbers) joins = new uint[] { 10044, 10021, 10092 };
// else if (!dpad && preset && dvr && !numbers) joins = new uint[] { 10043, 10022, 10092 };
// else if (!dpad && preset && !dvr && numbers) joins = new uint[] { 10044, 10022, 10092 };
// else if (!dpad && !preset && dvr && numbers) joins = new uint[] { 10044, 10023, 10092 };
// else if (dpad && preset && dvr && !numbers) joins = new uint[] { 10053, 10032, 10011, 10093 };
// else if (dpad && preset && !dvr && numbers) joins = new uint[] { 10054, 10032, 10011, 10093 };
// else if (dpad && !preset && dvr && numbers) joins = new uint[] { 10054, 10033, 10011, 10093 };
// else if (!dpad && preset && dvr && numbers) joins = new uint[] { 10054, 10033, 10012, 10093 };
// else if (dpad && preset && dvr && numbers)
// {
// joins = new uint[] { 10081, 10032, 10011, 10093 }; // special case
// ShowPosition5Tabs = true;
// }
// // Project the joins into corresponding sigs.
// FixedObjectSigs = joins.Select(u => TriList.BooleanInput[u]).ToList();
// // Build presets
// if (device.HasPresets)
// {
// PresetsView = new DevicePresetsView(tl, device.PresetsModel);
// }
// }
// protected override void CustomSetVisible(bool state)
// {
// if (ShowPosition5Tabs)
// {
// // Show selected tab
// TriList.BooleanInput[Position5SubpageJoins[CurrentVisiblePosition5Item]].BoolValue = state;
// var tabSo = TriList.SmartObjects[Position5TabsId];
// if (state) // Link up the tab object
// {
// tabSo.BooleanOutput["Tab Button 1 Press"].UserObject = new Action<bool>(b => ShowTab(1));
// tabSo.BooleanOutput["Tab Button 2 Press"].UserObject = new Action<bool>(b => ShowTab(2));
// }
// else // Disco tab object
// {
// tabSo.BooleanOutput["Tab Button 1 Press"].UserObject = null;
// tabSo.BooleanOutput["Tab Button 2 Press"].UserObject = null;
// }
// }
// // Hook up smart objects if applicable
//#warning hook these up
// //if (Device is IHasCueActionList)
// //{
// // var uos = (Device as IHasCueActionList).CueActionList;
// // SmartObjectHelper.LinkDpadWithUserObjects(TriList, DpadSmartObjectId, uos, state);
// // SmartObjectHelper.LinkNumpadWithUserObjects(TriList, NumberPadSmartObjectId,
// // uos, CommonBoolCue.Dash, CommonBoolCue.Last, state);
// //}
// // Link, unlink presets
// if (Device.HasPresets && state)
// PresetsView.Attach();
// else if (Device.HasPresets && !state)
// PresetsView.Detach();
// }
// void ShowTab(uint number)
// {
// // Ignore re-presses
// if (CurrentVisiblePosition5Item == number) return;
// // Swap subpage
// var bi = TriList.BooleanInput;
// if (CurrentVisiblePosition5Item > 0)
// bi[Position5SubpageJoins[CurrentVisiblePosition5Item]].BoolValue = false;
// CurrentVisiblePosition5Item = number;
// bi[Position5SubpageJoins[CurrentVisiblePosition5Item]].BoolValue = true;
// // Show feedback on buttons
// }
// }
//}

View File

@@ -0,0 +1,43 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Crestron.SimplSharp;
//namespace PepperDash.Essentials.Core
//{
// public class UiCue
// {
// public static readonly Cue VisibleSystemInit = Cue.BoolCue("VisibleSystemInit", 15001);
// public static readonly Cue VisibleSplash = Cue.BoolCue("VisibleSplash", 15002);
// public static readonly Cue PressSplash = Cue.BoolCue("PressSplash", 15003);
// public static readonly Cue PressRoomOn = Cue.BoolCue("PressRoomOn", 15006);
// public static readonly Cue PressRoomOff = Cue.BoolCue("PressRoomOff", 15007);
// public static readonly Cue PressRoomOffWithConfirm = Cue.BoolCue("PressRoomOffWithConfirm", 15008);
// public static readonly Cue VisibleCommonHeader = Cue.BoolCue("PressPowerOffConfirm", 15011);
// public static readonly Cue VisibleCommonFooter = Cue.BoolCue("VisibleCommonFooter", 15012);
// public static readonly Cue PressHelp = Cue.BoolCue("PressHelp", 15013);
// public static readonly Cue PressSettings = Cue.BoolCue("PressSettings", 15014);
// public static readonly Cue ShowDate = Cue.BoolCue("PressSettings", 15015);
// public static readonly Cue ShowTime = Cue.BoolCue("PressSettings", 15016);
// public static readonly Cue ShowLicensed = Cue.BoolCue("PressSettings", 15017);
// public static readonly Cue ShowUnLicensed = Cue.BoolCue("PressSettings", 15018);
// public static readonly Cue PressModePresentationShare = Cue.BoolCue("PressModePresentationShare", 15101);
// public static readonly Cue PressModeVideoConf = Cue.BoolCue("PressModeVideoConf", 15102);
// public static readonly Cue PressModeAudioConf = Cue.BoolCue("PressModeAudioConf", 15103);
// public static readonly Cue VisiblePresentationSourceList = Cue.BoolCue("VisiblePresentationSourceList", 15111);
// public static readonly Cue VisibleSystemIsOff = Cue.BoolCue("VisibleSystemIsOff", 15112);
// public static readonly Cue VisibleAudioConfPopover = Cue.BoolCue("VisibleAudioConfPopover", 15201);
// public static readonly Cue VisibleVideoConfPopover = Cue.BoolCue("VisibleVideoConfPopover", 15251);
// public static readonly Cue TextRoomName = Cue.BoolCue("TextRoomName", 4001);
// public static readonly Cue TextPresentationShareButton = Cue.BoolCue("TextPresentationShareButton", 4011);
// public static readonly Cue SplashMessage = Cue.StringCue("SplashMessage", 2101);
// }
//}

View File

@@ -0,0 +1,318 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using Crestron.SimplSharp;
//using Crestron.SimplSharpPro;
//using Crestron.SimplSharpPro.DeviceSupport;
//namespace PepperDash.Essentials.Core
//{
// public abstract class SmartGraphicsTouchpanelControllerBase : CrestronGenericBaseDevice
// {
// public BasicTriListWithSmartObject TriList { get; protected set; }
// public bool UsesSplashPage { get; set; }
// public string SplashMessage { get; set; }
// public bool ShowDate
// {
// set { TriList.BooleanInput[UiCue.ShowDate.Number].BoolValue = value; }
// }
// public bool ShowTime
// {
// set { TriList.BooleanInput[UiCue.ShowTime.Number].BoolValue = value; }
// }
// //public abstract List<CueActionPair> FunctionList { get; }
// protected eMainModeType MainMode;
// protected SourceListItem CurrentPresentationControlDevice;
// /// <summary>
// /// Defines the signal offset for the presentation device. Defaults to 100
// /// </summary>
// public uint PresentationControlDeviceJoinOffset { get { return 100; } }
// public enum eMainModeType
// {
// Presentation, Splash, Tech
// }
// protected string SgdFilePath;
// public EssentialsRoom CurrentRoom { get; protected set; }
// protected Dictionary<SourceListItem, DevicePageControllerBase> LoadedPageControllers
// = new Dictionary<SourceListItem, DevicePageControllerBase>();
// static object RoomChangeLock = new object();
// /// <summary>
// /// Constructor
// /// </summary>
// public SmartGraphicsTouchpanelControllerBase(string key, string name, BasicTriListWithSmartObject triList,
// string sgdFilePath)
// : base(key, name, triList)
// {
// TriList = triList;
// if (string.IsNullOrEmpty(key)) throw new ArgumentNullException("key");
// if (string.IsNullOrEmpty(sgdFilePath)) throw new ArgumentNullException("sgdFilePath");
// SgdFilePath = sgdFilePath;
// TriList.LoadSmartObjects(SgdFilePath);
// UsesSplashPage = true;
// SplashMessage = "Welcome";
// TriList.SigChange += Tsw_AnySigChange;
// foreach (var kvp in TriList.SmartObjects)
// kvp.Value.SigChange += this.Tsw_AnySigChange;
// }
//#warning wire UI manipulating presses up here, typically in child classes...
// //public override bool CustomActivate()
// //{
// // var baseSuccess = base.CustomActivate();
// // if (!baseSuccess) return false;
// // // Wiring up the buttons with UOs
// // foreach (var uo in this.FunctionList)
// // {
// // if (uo.Cue.Number == 0) continue;
// // //if (uo is BoolCueActionPair)
// // // TriList.BooleanOutput[uo.Cue.Number].UserObject = uo;
// // //else if (uo is UShortCueActionPair)
// // // TriList.UShortOutput[uo.Cue.Number].UserObject = uo;
// // //else if (uo is StringCueActionPair)
// // // TriList.StringOutput[uo.Cue.Number].UserObject = uo;
// // }
// // return true;
// //}
// //public void SetCurrentRoom(EssentialsRoom room)
// //{
// // if (CurrentRoom != null)
// // HideRoomUI();
// // CurrentRoom = room;
// // ShowRoomUI();
// //}
// /// <summary>
// ///
// /// </summary>
// /// <param name="room"></param>
// public void SetCurrentRoom(EssentialsRoom room)
// {
// if (CurrentRoom == room) return;
// IBasicVolumeControls oldAudio = null;
// //Disconnect current room and audio device
// if (CurrentRoom != null)
// {
// HideRoomUI();
// CurrentRoom.AudioDeviceWillChange -= CurrentRoom_AudioDeviceWillChange;
// CurrentRoom.PresentationSourceChange -= CurrentRoom_PresentationSourceChange;
// oldAudio = CurrentRoom.CurrentAudioDevice;
// }
// CurrentRoom = room;
// IBasicVolumeControls newAudio = null;
// if (CurrentRoom != null)
// {
// CurrentRoom.AudioDeviceWillChange += this.CurrentRoom_AudioDeviceWillChange;
// CurrentRoom.PresentationSourceChange += this.CurrentRoom_PresentationSourceChange;
// SetControlSource(CurrentRoom.CurrentPresentationSourceInfo);
// newAudio = CurrentRoom.CurrentAudioDevice;
// ShowRoomUI();
// }
// SwapAudioDeviceControls(oldAudio, newAudio);
// }
// /// <summary>
// /// Detaches and attaches an IVolumeFunctions device to the appropriate TP TriList signals.
// /// This will also add IVolumeNumeric if the device implements it.
// /// Overriding classes should call this. Overriding classes are responsible for
// /// linking up to hard keys, etc.
// /// </summary>
// /// <param name="oldDev">May be null</param>
// /// <param name="newDev">May be null</param>
// protected virtual void SwapAudioDeviceControls(IBasicVolumeControls oldDev, IBasicVolumeControls newDev)
// {
// // Disconnect
// if (oldDev != null)
// {
// TriList.BooleanOutput[CommonBoolCue.VolumeDown.Number].UserObject = null;
// TriList.BooleanOutput[CommonBoolCue.VolumeUp.Number].UserObject = null;
// TriList.BooleanOutput[CommonBoolCue.MuteToggle.Number].UserObject = null;
// TriList.BooleanInput[CommonBoolCue.ShowVolumeButtons.Number].BoolValue = false;
// TriList.BooleanInput[CommonBoolCue.ShowVolumeSlider.Number].BoolValue = false;
// if (oldDev is IBasicVolumeWithFeedback)
// {
// var fbDev = oldDev as IBasicVolumeWithFeedback;
// TriList.UShortOutput[401].UserObject = null;
// fbDev.MuteFeedback.UnlinkInputSig(TriList.BooleanInput[403]);
// fbDev.VolumeLevelFeedback.UnlinkInputSig(TriList.UShortInput[401]);
// }
// }
// if (newDev != null)
// {
// TriList.BooleanInput[CommonBoolCue.ShowVolumeSlider.Number].BoolValue = true;
// TriList.SetBoolSigAction(401, newDev.VolumeUp);
// TriList.SetBoolSigAction(402, newDev.VolumeDown);
// TriList.SetSigFalseAction(405, newDev.MuteToggle);
// if (newDev is IBasicVolumeWithFeedback) // Show slider
// {
// var fbDev = newDev as IBasicVolumeWithFeedback;
// TriList.BooleanInput[406].BoolValue = false;
// TriList.BooleanInput[407].BoolValue = true;
// TriList.UShortOutput[401].UserObject = new Action<ushort>(fbDev.SetVolume);
// fbDev.VolumeLevelFeedback.LinkInputSig(TriList.UShortInput[401]);
// }
// else // Show buttons only
// {
// TriList.BooleanInput[406].BoolValue = true;
// TriList.BooleanInput[407].BoolValue = false;
// }
// }
// }
// /// <summary>
// /// Does nothing. Override to add functionality when calling SetCurrentRoom
// /// </summary>
// protected virtual void HideRoomUI() { }
// /// <summary>
// /// Does nothing. Override to add functionality when calling SetCurrentRoom
// /// </summary>
// protected virtual void ShowRoomUI() { }
// /// <summary>
// /// Sets up the current presentation device and updates statuses if the device is capable.
// /// </summary>
// protected void SetControlSource(SourceListItem newSource)
// {
// if (CurrentPresentationControlDevice != null)
// {
// HideCurrentPresentationSourceUi();
//#warning Get button methods from RESI, and find a more-well-defined way to wire up feedbacks
// // Unhook presses and things
// //if (CurrentPresentationControlDevice is IHasCueActionList)
// //{
// // foreach (var uo in (CurrentPresentationControlDevice as IHasCueActionList).CueActionList)
// // {
// // if (uo.Cue.Number == 0) continue;
// // if (uo is BoolCueActionPair)
// // {
// // var bSig = TriList.BooleanOutput[uo.Cue.Number];
// // // Disconnection should also clear bool sigs in case they are pressed and
// // // might be orphaned
// // if (bSig.BoolValue)
// // (bSig.UserObject as BoolCueActionPair).Invoke(false);
// // bSig.UserObject = null;
// // }
// // else if (uo is UShortCueActionPair)
// // TriList.UShortOutput[uo.Cue.Number].UserObject = null;
// // else if (uo is StringCueActionPair)
// // TriList.StringOutput[uo.Cue.Number].UserObject = null;
// // }
// //}
// // unhook outputs
// if (CurrentPresentationControlDevice is IHasFeedback)
// {
// foreach (var fb in (CurrentPresentationControlDevice as IHasFeedback).Feedbacks)
// {
// if (fb.Cue.Number == 0) continue;
// if (fb is BoolFeedback)
// (fb as BoolFeedback).UnlinkInputSig(TriList.BooleanInput[fb.Cue.Number]);
// else if (fb is IntFeedback)
// (fb as IntFeedback).UnlinkInputSig(TriList.UShortInput[fb.Cue.Number]);
// else if (fb is StringFeedback)
// (fb as StringFeedback).UnlinkInputSig(TriList.StringInput[fb.Cue.Number]);
// }
// }
// }
// CurrentPresentationControlDevice = newSource;
// //connect presses and things
// //if (newSource is IHasCueActionList) // This has functions, get 'em
// //{
// // foreach (var ao in (newSource as IHasCueActionList).CueActionList)
// // {
// // if (ao.Cue.Number == 0) continue;
// // if (ao is BoolCueActionPair)
// // TriList.BooleanOutput[ao.Cue.Number].UserObject = ao;
// // else if (ao is UShortCueActionPair)
// // TriList.UShortOutput[ao.Cue.Number].UserObject = ao;
// // else if (ao is StringCueActionPair)
// // TriList.StringOutput[ao.Cue.Number].UserObject = ao;
// // }
// //}
// // connect outputs (addInputSig should update sig)
// if (CurrentPresentationControlDevice is IHasFeedback)
// {
// foreach (var fb in (CurrentPresentationControlDevice as IHasFeedback).Feedbacks)
// {
// if (fb.Cue.Number == 0) continue;
// if (fb is BoolFeedback)
// (fb as BoolFeedback).LinkInputSig(TriList.BooleanInput[fb.Cue.Number]);
// else if (fb is IntFeedback)
// (fb as IntFeedback).LinkInputSig(TriList.UShortInput[fb.Cue.Number]);
// else if (fb is StringFeedback)
// (fb as StringFeedback).LinkInputSig(TriList.StringInput[fb.Cue.Number]);
// }
// }
// ShowCurrentPresentationSourceUi();
// }
// /// <summary>
// /// Reveals the basic UI for the current device
// /// </summary>
// protected virtual void ShowCurrentPresentationSourceUi()
// {
// }
// /// <summary>
// /// Hides the UI for the current device and calls for a feedback signal cleanup
// /// </summary>
// protected virtual void HideCurrentPresentationSourceUi()
// {
// }
// /// <summary>
// ///
// /// </summary>
// void CurrentRoom_PresentationSourceChange(object sender, EssentialsRoomSourceChangeEventArgs args)
// {
// SetControlSource(args.NewSource);
// }
// /// <summary>
// ///
// /// </summary>
// void CurrentRoom_AudioDeviceWillChange(object sender, EssentialsRoomAudioDeviceChangeEventArgs e)
// {
// SwapAudioDeviceControls(e.OldDevice, e.NewDevice);
// }
// /// <summary>
// /// Panel event handler
// /// </summary>
// void Tsw_AnySigChange(object currentDevice, SigEventArgs args)
// {
// // plugged in commands
// object 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

@@ -0,0 +1,164 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Crestron.SimplSharp;
//using Crestron.SimplSharpPro;
//using Crestron.SimplSharpPro.DeviceSupport;
//using Crestron.SimplSharpPro.UI;
//using PepperDash.Core;
//using PepperDash.Essentials.Core;
//namespace PepperDash.Essentials
//{
// //*****************************************************************************
// /// <summary>
// /// Wrapper class for subpage reference list. Contains helpful methods to get at the various signal groupings
// /// and to get individual signals using an index and a join.
// /// </summary>
// public class SourceListSubpageReferenceList : SubpageReferenceList
// {
// public const uint SmartObjectJoin = 3801;
// Action<uint> SourceSelectCallback;
// EssentialsRoom CurrentRoom;
// public SourceListSubpageReferenceList(BasicTriListWithSmartObject tl,
// Action<uint> sourceSelectCallback)
// : base(tl, SmartObjectJoin, 3, 1, 3)
// {
// SourceSelectCallback = sourceSelectCallback;
// }
// void SetSourceList(Dictionary<uint, SourceListItem> dict)
// {
// // Iterate all positions, including ones missing from the dict.
// var max = dict.Keys.Max();
// for (uint i = 1; i <= max; i++)
// {
// // Add the source if it's in the dict
// if (dict.ContainsKey(i))
// {
// Items.Add(new SourceListSubpageReferenceListItem(i, dict[i], this, SourceSelectCallback));
// // Plug the callback function into the buttons
// }
// // Blank the line
// else
// Items.Add(new SourceListSubpageReferenceListItem(i, null,
// this, SourceSelectCallback));
// }
// Count = (ushort)max;
// }
// /// <summary>
// /// Links the SRL to the Room's PresentationSourceChange event for updating of the UI
// /// </summary>
// /// <param name="room"></param>
// public void AttachToRoom(EssentialsRoom room)
// {
// CurrentRoom = room;
// SetSourceList(room.Sources);
// CurrentRoom.PresentationSourceChange -= CurrentRoom_PresentationSourceChange;
// CurrentRoom.PresentationSourceChange += CurrentRoom_PresentationSourceChange;
// SetPresentationSourceFb(CurrentRoom.CurrentPresentationSource);
// }
// /// <summary>
// /// Disconnects the SRL from a Room's PresentationSourceChange
// /// </summary>
// public void DetachFromCurrentRoom()
// {
// ClearPresentationSourceFb(CurrentRoom.CurrentPresentationSource);
// if(CurrentRoom != null)
// CurrentRoom.PresentationSourceChange -= CurrentRoom_PresentationSourceChange;
// CurrentRoom = null;
// }
// // Handler to route source changes into list feedback
// void CurrentRoom_PresentationSourceChange(object sender, EssentialsRoomSourceChangeEventArgs args)
// {
// Debug.Console(2, "SRL received source change");
// ClearPresentationSourceFb(args.OldSource);
// SetPresentationSourceFb(args.NewSource);
// }
// void ClearPresentationSourceFb(IPresentationSource source)
// {
// if (source == null) return;
// var oldSourceItem = (SourceListSubpageReferenceListItem)Items.FirstOrDefault(
// i => ((SourceListSubpageReferenceListItem)i).SourceDevice == source);
// if (oldSourceItem != null)
// oldSourceItem.ClearFeedback();
// }
// void SetPresentationSourceFb(SourceListItem source)
// {
// if (source == null) return;
// // Now set the new source to light up
// var newSourceItem = (SourceListSubpageReferenceListItem)Items.FirstOrDefault(
// i => ((SourceListSubpageReferenceListItem)i).SourceDevice == source);
// if (newSourceItem != null)
// newSourceItem.SetFeedback();
// }
// }
// public class SourceListSubpageReferenceListItem : SubpageReferenceListItem
// {
// public readonly IPresentationSource SourceDevice;
// public const uint ButtonPressJoin = 1;
// public const uint SelectedFeedbackJoin = 2;
// public const uint ButtonTextJoin = 1;
// public const uint IconNameJoin = 2;
// public SourceListSubpageReferenceListItem(uint index, SourceListItem srcDeviceItem,
// SubpageReferenceList owner, Action<uint> sourceSelectCallback)
// : base(index, owner)
// {
// if (srcDeviceItem == null) throw new ArgumentNullException("srcDeviceItem");
// if (owner == null) throw new ArgumentNullException("owner");
// if (sourceSelectCallback == null) throw new ArgumentNullException("sourceSelectCallback");
// SourceDevice = srcDeviceItem;
// var nameSig = owner.StringInputSig(index, ButtonTextJoin);
// // Should be able to see if there is not enough buttons right here
// if (nameSig == null)
// {
// Debug.Console(0, "ERROR: Item {0} does not exist on source list SRL", index);
// return;
// }
// nameSig.StringValue = srcDeviceItem.Name;
// owner.StringInputSig(index, IconNameJoin).StringValue = srcDeviceItem.Icon;
// // Assign a source selection action to the appropriate button's UserObject - on release
// owner.GetBoolFeedbackSig(index, ButtonPressJoin).UserObject = new Action<bool>(b =>
// { if (!b) sourceSelectCallback(index); });
// // hook up the video icon
// var videoDev = srcDeviceItem as IAttachVideoStatus;
// if (videoDev != null)
// {
// var status = videoDev.GetVideoStatuses();
// if (status != null)
// {
// Debug.Console(1, "Linking {0} video status to SRL", videoDev.Key);
// videoDev.GetVideoStatuses().VideoSyncFeedback.LinkInputSig(owner.BoolInputSig(index, 3));
// }
// }
// }
// public void SetFeedback()
// {
// Owner.BoolInputSig(Index, SelectedFeedbackJoin).BoolValue = true;
// }
// public void ClearFeedback()
// {
// Owner.BoolInputSig(Index, SelectedFeedbackJoin).BoolValue = false;
// }
// }
//}

View File

@@ -0,0 +1,505 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.Fusion;
using PepperDash.Essentials.Core;
using PepperDash.Core;
using PepperDash.Essentials;
using PepperDash.Essentials.Devices.Common;
namespace PepperDash.Essentials.Fusion
{
public class EssentialsHuddleSpaceFusionSystemController : Device
{
FusionRoom FusionRoom;
EssentialsHuddleSpaceRoom Room;
Dictionary<Device, BoolInputSig> SourceToFeedbackSigs =
new Dictionary<Device, BoolInputSig>();
StatusMonitorCollection ErrorMessageRollUp;
StringSigData SourceNameSig;
public EssentialsHuddleSpaceFusionSystemController(EssentialsHuddleSpaceRoom room, uint ipId)
: base(room.Key + "-fusion")
{
Room = room;
CreateSymbolAndBasicSigs(ipId);
SetUpSources();
SetUpCommunitcationMonitors();
SetUpDisplay();
SetUpError();
// test assets --- THESE ARE BOTH WIRED TO AssetUsage somewhere internally.
var ta1 = FusionRoom.CreateStaticAsset(1, "Test asset 1", "Awesome Asset", "Awesome123");
ta1.AssetError.InputSig.StringValue = "This should be error";
var ta2 = FusionRoom.CreateStaticAsset(2, "Test asset 2", "Awesome Asset", "Awesome1232");
ta2.AssetUsage.InputSig.StringValue = "This should be usage";
// Make it so!
FusionRVI.GenerateFileForAllFusionDevices();
}
void CreateSymbolAndBasicSigs(uint ipId)
{
FusionRoom = new FusionRoom(ipId, Global.ControlSystem, Room.Name, "awesomeGuid-" + Room.Key);
FusionRoom.Register();
FusionRoom.FusionStateChange += new FusionStateEventHandler(FusionRoom_FusionStateChange);
// Room to fusion room
Room.OnFeedback.LinkInputSig(FusionRoom.SystemPowerOn.InputSig);
SourceNameSig = FusionRoom.CreateOffsetStringSig(50, "Source - Name", eSigIoMask.InputSigOnly);
// Don't think we need to get current status of this as nothing should be alive yet.
Room.CurrentSourceInfoChange += new SourceInfoChangeHandler(Room_CurrentSourceInfoChange);
FusionRoom.SystemPowerOn.OutputSig.SetSigFalseAction(Room.PowerOnToDefaultOrLastSource);
FusionRoom.SystemPowerOff.OutputSig.SetSigFalseAction(() => Room.RunRouteAction("roomOff"));
// NO!! room.RoomIsOn.LinkComplementInputSig(FusionRoom.SystemPowerOff.InputSig);
FusionRoom.ErrorMessage.InputSig.StringValue =
"3: 7 Errors: This is a really long error message;This is a really long error message;This is a really long error message;This is a really long error message;This is a really long error message;This is a really long error message;This is a really long error message;";
}
void SetUpSources()
{
// Sources
var dict = ConfigReader.ConfigObject.GetSourceListForKey(Room.SourceListKey);
if (dict != null)
{
// NEW PROCESS:
// Make these lists and insert the fusion attributes by iterating these
var setTopBoxes = dict.Where(d => d.Value.SourceDevice is ISetTopBoxControls);
uint i = 1;
foreach (var kvp in setTopBoxes)
{
TryAddRouteActionSigs("Source - TV " + i, 115 + i, kvp.Key, kvp.Value.SourceDevice);
i++;
if (i > 5) // We only have five spots
break;
}
var discPlayers = dict.Where(d => d.Value.SourceDevice is IDiscPlayerControls);
i = 1;
foreach (var kvp in discPlayers)
{
TryAddRouteActionSigs("Source - DVD " + i, 120 + i, kvp.Key, kvp.Value.SourceDevice);
i++;
if (i > 5) // We only have five spots
break;
}
var laptops = dict.Where(d => d.Value.SourceDevice is Laptop);
i = 1;
foreach (var kvp in laptops)
{
TryAddRouteActionSigs("Source - Laptop " + i, 100 + i, kvp.Key, kvp.Value.SourceDevice);
i++;
if (i > 10) // We only have ten spots???
break;
}
// REMOVE THIS PROCESS:
//foreach (var kvp in dict)
//{
// var src = kvp.Value;
// //var srcNum = src.Key;
// var pSrc = src.SourceDevice;
// if (pSrc == null)
// continue;
// var keyNum = ExtractNumberFromKey(pSrc.Key);
// if (keyNum == -1)
// {
// Debug.Console(1, this, "WARNING: Cannot link source '{0}' to numbered Fusion attributes", pSrc.Key);
// continue;
// }
// string attrName = null;
// uint attrNum = Convert.ToUInt32(keyNum);
// if (pSrc is ISetTopBoxControls)
// {
// attrName = "Source - TV " + keyNum;
// attrNum += 115; // TV starts at 116
// }
// else if (pSrc is IDiscPlayerControls)
// {
// attrName = "Source - DVD " + keyNum;
// attrNum += 120; // DVD starts at 121
// }
// //else if (pSrc is Pc)
// //{
// // attrName = "Source - PC " + keyNum;
// // attrNum += 110; // PC starts at 111
// //}
// else if (pSrc is Laptop)
// {
// attrName = "Source - Laptop " + keyNum;
// attrNum += 100; // Laptops start at 101
// }
// //else if (pSrc is IVCR)
// //{
// // attrName = "Source - VCR " + keyNum;
// // attrNum += 125; // VCRs start at 126
// //}
// if (attrName == null)
// {
// Debug.Console(1, this,
// "Source '{0}' does not have corresponsing Fusion attribute type, skipping",
// src.SourceKey);
// continue;
// }
// Debug.Console(2, this, "Creating attribute '{0}' with join {1} for source {2}",
// attrName, attrNum, pSrc.Key);
// try
// {
// var sigD = FusionRoom.CreateOffsetBoolSig(attrNum, attrName, eSigIoMask.InputOutputSig);
// // Need feedback when this source is selected
// // Event handler, added below, will compare source changes with this sig dict
// SourceToFeedbackSigs.Add(pSrc, sigD.InputSig);
// // And respond to selection in Fusion
// sigD.OutputSig.SetSigFalseAction(() => Room.RunRouteAction(kvp.Key));
// }
// catch (Exception)
// {
// Debug.Console(2, this, "Error creating Fusion signal {0} {1} for device '{2}'. THIS NEEDS REWORKING", attrNum, attrName, pSrc.Key);
// }
//}
}
else
{
Debug.Console(1, this, "WARNING: Config source list '{0}' not found for room '{1}'",
Room.SourceListKey, Room.Key);
}
}
void TryAddRouteActionSigs(string attrName, uint attrNum, string routeKey, Device pSrc)
{
Debug.Console(2, this, "Creating attribute '{0}' with join {1} for source {2}",
attrName, attrNum, pSrc.Key);
try
{
var sigD = FusionRoom.CreateOffsetBoolSig(attrNum, attrName, eSigIoMask.InputOutputSig);
// Need feedback when this source is selected
// Event handler, added below, will compare source changes with this sig dict
SourceToFeedbackSigs.Add(pSrc, sigD.InputSig);
// And respond to selection in Fusion
sigD.OutputSig.SetSigFalseAction(() => Room.RunRouteAction(routeKey));
}
catch (Exception)
{
Debug.Console(2, this, "Error creating Fusion signal {0} {1} for device '{2}'. THIS NEEDS REWORKING", attrNum, attrName, pSrc.Key);
}
}
/// <summary>
///
/// </summary>
void SetUpCommunitcationMonitors()
{
// Attach to all room's devices with monitors.
//foreach (var dev in DeviceManager.Devices)
foreach (var dev in DeviceManager.GetDevices())
{
if (!(dev is ICommunicationMonitor))
continue;
var keyNum = ExtractNumberFromKey(dev.Key);
if (keyNum == -1)
{
Debug.Console(1, this, "WARNING: Cannot link device '{0}' to numbered Fusion monitoring attributes",
dev.Key);
continue;
}
string attrName = null;
uint attrNum = Convert.ToUInt32(keyNum);
//if (dev is SmartGraphicsTouchpanelControllerBase)
//{
// if (attrNum > 10)
// continue;
// attrName = "Device Ok - Touch Panel " + attrNum;
// attrNum += 200;
//}
//// add xpanel here
//else
if (dev is DisplayBase)
{
if (attrNum > 10)
continue;
attrName = "Device Ok - Display " + attrNum;
attrNum += 240;
}
//else if (dev is DvdDeviceBase)
//{
// if (attrNum > 5)
// continue;
// attrName = "Device Ok - DVD " + attrNum;
// attrNum += 260;
//}
// add set top box
// add Cresnet roll-up
// add DM-devices roll-up
if (attrName != null)
{
// Link comm status to sig and update
var sigD = FusionRoom.CreateOffsetBoolSig(attrNum, attrName, eSigIoMask.InputSigOnly);
var smd = dev as ICommunicationMonitor;
sigD.InputSig.BoolValue = smd.CommunicationMonitor.Status == MonitorStatus.IsOk;
smd.CommunicationMonitor.StatusChange += (o, a) =>
{ sigD.InputSig.BoolValue = a.Status == MonitorStatus.IsOk; };
Debug.Console(0, this, "Linking '{0}' communication monitor to Fusion '{1}'", dev.Key, attrName);
}
}
}
void SetUpDisplay()
{
var display = Room.DefaultDisplay as DisplayBase;
if (display == null)
{
Debug.Console(1, this, "Cannot link null display to Fusion");
return;
}
var dispPowerOnAction = new Action<bool>(b => { if (!b) display.PowerOn(); });
var dispPowerOffAction = new Action<bool>(b => { if (!b) display.PowerOff(); });
// Display to fusion room sigs
FusionRoom.DisplayPowerOn.OutputSig.UserObject = dispPowerOnAction;
FusionRoom.DisplayPowerOff.OutputSig.UserObject = dispPowerOffAction;
display.PowerIsOnFeedback.LinkInputSig(FusionRoom.DisplayPowerOn.InputSig);
if (display is IDisplayUsage)
(display as IDisplayUsage).LampHours.LinkInputSig(FusionRoom.DisplayUsage.InputSig);
// static assets --------------- testing
// Make a display asset
var dispAsset = FusionRoom.CreateStaticAsset(3, display.Name, "Display", "awesomeDisplayId" + Room.Key);
dispAsset.PowerOn.OutputSig.UserObject = dispPowerOnAction;
dispAsset.PowerOff.OutputSig.UserObject = dispPowerOffAction;
display.PowerIsOnFeedback.LinkInputSig(dispAsset.PowerOn.InputSig);
// NO!! display.PowerIsOn.LinkComplementInputSig(dispAsset.PowerOff.InputSig);
// Use extension methods
dispAsset.TrySetMakeModel(display);
dispAsset.TryLinkAssetErrorToCommunication(display);
}
void SetUpError()
{
// Roll up ALL device errors
ErrorMessageRollUp = new StatusMonitorCollection(this);
foreach (var dev in DeviceManager.GetDevices())
{
var md = dev as ICommunicationMonitor;
if (md != null)
{
ErrorMessageRollUp.AddMonitor(md.CommunicationMonitor);
Debug.Console(2, this, "Adding '{0}' to room's overall error monitor", md.CommunicationMonitor.Parent.Key);
}
}
ErrorMessageRollUp.Start();
FusionRoom.ErrorMessage.InputSig.StringValue = ErrorMessageRollUp.Message;
ErrorMessageRollUp.StatusChange += (o, a) =>
{
FusionRoom.ErrorMessage.InputSig.StringValue = ErrorMessageRollUp.Message;
};
}
/// <summary>
/// Helper to get the number from the end of a device's key string
/// </summary>
/// <returns>-1 if no number matched</returns>
int ExtractNumberFromKey(string key)
{
var capture = System.Text.RegularExpressions.Regex.Match(key, @"\D+(\d+)");
if (!capture.Success)
return -1;
else return Convert.ToInt32(capture.Groups[1].Value);
}
/// <summary>
/// Event handler for when room source changes
/// </summary>
void Room_CurrentSourceInfoChange(EssentialsRoomBase room, SourceListItem info, ChangeType type)
{
// Handle null. Nothing to do when switching from or to null
if (info == null || info.SourceDevice == null)
return;
var dev = info.SourceDevice;
if (type == ChangeType.WillChange)
{
if (SourceToFeedbackSigs.ContainsKey(dev))
SourceToFeedbackSigs[dev].BoolValue = false;
}
else
{
if (SourceToFeedbackSigs.ContainsKey(dev))
SourceToFeedbackSigs[dev].BoolValue = true;
var name = (room == null ? "" : room.Name);
SourceNameSig.InputSig.StringValue = name;
}
}
void FusionRoom_FusionStateChange(FusionBase device, FusionStateEventArgs args)
{
// The sig/UO method: Need separate handlers for fixed and user sigs, all flavors,
// even though they all contain sigs.
var sigData = (args.UserConfiguredSigDetail as BooleanSigDataFixedName);
if (sigData != null)
{
var outSig = sigData.OutputSig;
if (outSig.UserObject is Action<bool>)
(outSig.UserObject as Action<bool>).Invoke(outSig.BoolValue);
else if (outSig.UserObject is Action<ushort>)
(outSig.UserObject as Action<ushort>).Invoke(outSig.UShortValue);
else if (outSig.UserObject is Action<string>)
(outSig.UserObject as Action<string>).Invoke(outSig.StringValue);
return;
}
var attrData = (args.UserConfiguredSigDetail as BooleanSigData);
if (attrData != null)
{
var outSig = attrData.OutputSig;
if (outSig.UserObject is Action<bool>)
(outSig.UserObject as Action<bool>).Invoke(outSig.BoolValue);
else if (outSig.UserObject is Action<ushort>)
(outSig.UserObject as Action<ushort>).Invoke(outSig.UShortValue);
else if (outSig.UserObject is Action<string>)
(outSig.UserObject as Action<string>).Invoke(outSig.StringValue);
return;
}
}
}
public static class FusionRoomExtensions
{
/// <summary>
/// Creates and returns a fusion attribute. The join number will match the established Simpl
/// standard of 50+, and will generate a 50+ join in the RVI. It calls
/// FusionRoom.AddSig with join number - 49
/// </summary>
/// <returns>The new attribute</returns>
public static BooleanSigData CreateOffsetBoolSig(this FusionRoom fr, uint number, string name, eSigIoMask mask)
{
if (number < 50) throw new ArgumentOutOfRangeException("number", "Cannot be less than 50");
number -= 49;
fr.AddSig(eSigType.Bool, number, name, mask);
return fr.UserDefinedBooleanSigDetails[number];
}
/// <summary>
/// Creates and returns a fusion attribute. The join number will match the established Simpl
/// standard of 50+, and will generate a 50+ join in the RVI. It calls
/// FusionRoom.AddSig with join number - 49
/// </summary>
/// <returns>The new attribute</returns>
public static UShortSigData CreateOffsetUshortSig(this FusionRoom fr, uint number, string name, eSigIoMask mask)
{
if (number < 50) throw new ArgumentOutOfRangeException("number", "Cannot be less than 50");
number -= 49;
fr.AddSig(eSigType.UShort, number, name, mask);
return fr.UserDefinedUShortSigDetails[number];
}
/// <summary>
/// Creates and returns a fusion attribute. The join number will match the established Simpl
/// standard of 50+, and will generate a 50+ join in the RVI. It calls
/// FusionRoom.AddSig with join number - 49
/// </summary>
/// <returns>The new attribute</returns>
public static StringSigData CreateOffsetStringSig(this FusionRoom fr, uint number, string name, eSigIoMask mask)
{
if (number < 50) throw new ArgumentOutOfRangeException("number", "Cannot be less than 50");
number -= 49;
fr.AddSig(eSigType.String, number, name, mask);
return fr.UserDefinedStringSigDetails[number];
}
/// <summary>
/// Creates and returns a static asset
/// </summary>
/// <returns>the new asset</returns>
public static FusionStaticAsset CreateStaticAsset(this FusionRoom fr, uint number, string name, string type, string instanceId)
{
fr.AddAsset(eAssetType.StaticAsset, number, name, type, instanceId);
return fr.UserConfigurableAssetDetails[number].Asset as FusionStaticAsset;
}
}
//************************************************************************************************
/// <summary>
/// Extensions to enhance Fusion room, asset and signal creation.
/// </summary>
public static class FusionStaticAssetExtensions
{
/// <summary>
/// Tries to set a Fusion asset with the make and model of a device.
/// If the provided Device is IMakeModel, will set the corresponding parameters on the fusion static asset.
/// Otherwise, does nothing.
/// </summary>
public static void TrySetMakeModel(this FusionStaticAsset asset, Device device)
{
var mm = device as IMakeModel;
if (mm != null)
{
asset.ParamMake.Value = mm.DeviceMake;
asset.ParamModel.Value = mm.DeviceModel;
}
}
/// <summary>
/// Tries to attach the AssetError input on a Fusion asset to a Device's
/// CommunicationMonitor.StatusChange event. Does nothing if the device is not
/// IStatusMonitor
/// </summary>
/// <param name="asset"></param>
/// <param name="device"></param>
public static void TryLinkAssetErrorToCommunication(this FusionStaticAsset asset, Device device)
{
if (device is ICommunicationMonitor)
{
var monitor = (device as ICommunicationMonitor).CommunicationMonitor;
monitor.StatusChange += (o, a) =>
{
// Link connected and error inputs on asset
asset.Connected.InputSig.BoolValue = a.Status == MonitorStatus.IsOk;
asset.AssetError.InputSig.StringValue = a.Status.ToString();
};
// set current value
asset.Connected.InputSig.BoolValue = monitor.Status == MonitorStatus.IsOk;
asset.AssetError.InputSig.StringValue = monitor.Status.ToString();
}
}
}
}

View File

@@ -0,0 +1,266 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharp.Net.Http;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Http;
using PepperDash.Core;
namespace PepperDash.Essentials
{
public class EssentialsHttpApiHandler
{
string ConfigPath;
string PresetsPathPrefix;
EssentialsHttpServer Server;
/// <summary>
///
/// </summary>
/// <param name="server">HTTP server to attach to</param>
/// <param name="configPath">The full path to configuration file</param>
/// <param name="presetsListPath">The folder prefix for the presets path, eq "\HTML\presets\"</param>
public EssentialsHttpApiHandler(EssentialsHttpServer server, string configPath, string presetsPathPrefix)
{
if (server == null) throw new ArgumentNullException("server");
Server = server;
ConfigPath = configPath;
PresetsPathPrefix = presetsPathPrefix;
server.ApiRequest += Server_ApiRequest;
}
void Server_ApiRequest(object sender, Crestron.SimplSharp.Net.Http.OnHttpRequestArgs args)
{
try
{
var path = args.Request.Path.ToLower();
if (path == "/api/config")
HandleApiConfig(args);
else if (path.StartsWith("/api/presetslist/"))
HandleApiPresetsList(args);
else if (path == "/api/presetslists")
HandleApiGetPresetsLists(args.Request, args.Response);
else
{
args.Response.Code = 404;
return;
}
args.Response.Header.SetHeaderValue("Access-Control-Allow-Origin", "*");
args.Response.Header.SetHeaderValue("Access-Control-Allow-Methods", "GET, POST, PATCH, PUT, DELETE, OPTIONS");
}
catch (Exception e)
{
Debug.Console(1, "Uncaught HTTP server error: \n{0}", e);
args.Response.Code = 500;
}
}
/// <summary>
/// GET will return the running configuration. POST will attempt to take in a new config
/// and restart the program.
/// </summary>
void HandleApiConfig(OnHttpRequestArgs args)
{
var request = args.Request;
if (request.Header.RequestType == "GET")
{
if (File.Exists(ConfigPath))
{
Debug.Console(2, "Sending config:{0}", ConfigPath);
args.Response.Header.ContentType = EssentialsHttpServer.GetContentType(new FileInfo(ConfigPath).Extension);
args.Response.ContentStream = new FileStream(ConfigPath, FileMode.Open, FileAccess.Read);
}
}
else if (request.Header.RequestType == "POST")
{
Debug.Console(2, "Post type: '{0}'", request.Header.ContentType);
// Make sure we're receiving at least good json
Debug.Console(1, "Receving new config");
if (GetContentStringJson(args) == null)
return;
//---------------------------- try to move these into common method
// Move current file aside
var bakPath = ConfigPath + ".bak";
if (File.Exists(bakPath))
File.Delete(bakPath);
File.Move(ConfigPath, bakPath);
// Write the file
using (FileStream fs = File.Open(ConfigPath, FileMode.OpenOrCreate))
using (StreamWriter sw = new StreamWriter(fs))
{
try
{
sw.Write(args.Request.ContentString);
}
catch (Exception e)
{
string err = string.Format("Error writing received config file:\r{0}", e);
CrestronConsole.PrintLine(err);
ErrorLog.Warn(err);
// Put file back
File.Move(ConfigPath + ".bak", ConfigPath);
args.Response.Code = 500;
return;
}
}
// If client says "yeah, restart" and has a good token
// Restart program
string consoleResponse = null;
var restart = CrestronConsole.SendControlSystemCommand("progreset -p:" +
InitialParametersClass.ApplicationNumber, ref consoleResponse);
if (!restart) Debug.Console(0, "CAN'T DO THAT YO: {0}", consoleResponse);
}
}
void HandleApiPresetsList(OnHttpRequestArgs args)
{
var listPath = PresetsPathPrefix + args.Request.Path.Remove(0, 17);
Debug.Console(2, "Checking for preset list '{0}'", listPath);
if (args.Request.Header.RequestType == "GET")
{
if (File.Exists(listPath))
{
Debug.Console(2, "Sending presets file:{0}", listPath);
args.Response.Header.ContentType = EssentialsHttpServer.GetContentType(new FileInfo(listPath).Extension);
args.Response.ContentStream = new FileStream(listPath, FileMode.Open, FileAccess.Read);
}
}
else if (args.Request.Header.RequestType == "POST")
{
// Make sure we're receiving at least good json
Debug.Console(1, "Receving new presets");
if (GetContentStringJson(args) == null)
return;
//---------------------------- try to move these into common method
// Move current file aside
var bakPath = listPath + ".new";
Debug.Console(2, "Moving presets file to {0}", bakPath);
if(File.Exists(bakPath))
File.Delete(bakPath);
File.Move(listPath, bakPath);
Debug.Console(2, "Writing new file");
// Write the file
using (FileStream fs = File.OpenWrite(listPath))
using (StreamWriter sw = new StreamWriter(fs))
{
try
{
Debug.Console(2, "Writing {1}, {0} bytes", args.Request.ContentString.Length, listPath);
sw.Write(args.Request.ContentString);
}
catch (Exception e)
{
string err = string.Format("Error writing received presets file:\r{0}", e);
CrestronConsole.PrintLine(err);
ErrorLog.Warn(err);
// Put file back
File.Move(listPath + ".bak", listPath);
args.Response.Code = 500;
return;
}
}
}
}
void HandleApiGetPresetsLists(HttpServerRequest request, HttpServerResponse response)
{
if (request.Header.RequestType != "GET")
{
response.Code = 404; // This should be a 405 with an allow header
return;
}
if (Directory.Exists(PresetsPathPrefix))
{
//CrestronConsole.PrintLine("Parsing presets directory");
List<string> files = Directory.GetFiles(PresetsPathPrefix, "*.json")
.ToList().Select(f => Path.GetFileName(f)).ToList();
if (files.Count > 0)
files.Sort();
var json = JsonConvert.SerializeObject(files);
response.Header.ContentType = "application/json";
response.ContentString = json;
}
// //CrestronConsole.PrintLine("Found {0} files", files.Count);
// JObject jo = new JObject();
// JArray ja = new JArray();
// foreach (var filename in files)
// {
// try
// {
// using (StreamReader sr = new StreamReader(filename))
// {
// JObject tempJo = JObject.Parse(sr.ReadToEnd());
// if (tempJo.Value<string>("content").Equals("presetsList"))
// {
// var jItem = new JObject(); // make a new object
// jItem.Add("Name", tempJo["name"]);
// jItem.Add("File", filename);
// jItem.Add("Url", Uri.EscapeUriString(new Uri(
// filename.Replace("\\html", "")
// .Replace("\\HTML", "")
// .Replace('\\', '/'), UriKind.Relative).ToString()));
// ja.Add(jItem); // add to array
// }
// else
// CrestronConsole.PrintLine("Cannot use presets file '{0}'", filename);
// }
// }
// catch
// {
// // ignore failures - maybe delete them
// CrestronConsole.PrintLine("Unable to read presets file '{0}'", filename);
// }
// }
// jo.Add("PresetChannelLists", ja);
// //CrestronConsole.PrintLine(jo.ToString());
// response.Header.ContentType = "application/json";
// response.ContentString = jo.ToString();
//}
//else
// CrestronConsole.PrintLine("No presets files in directory");
}
/// <summary>
/// Simply does what it says
/// </summary>
JObject GetContentStringJson(OnHttpRequestArgs args)
{
//var content = args.Request.ContentString;
//Debug.Console(1, "{0}", content);
try
{
// just see if it parses properly
return JObject.Parse(args.Request.ContentString);
}
catch (Exception e)
{
string err = string.Format("JSON Error reading config file:\r{0}", e);
CrestronConsole.PrintLine(err);
ErrorLog.Warn(err);
args.Response.Code = 400; // Bad request
return null;
}
}
}
}

View File

@@ -0,0 +1,189 @@
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{1BED5BA9-88C4-4365-9362-6F4B128071D3}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PepperDash.Essentials</RootNamespace>
<AssemblyName>PepperDashEssentials</AssemblyName>
<ProjectTypeGuids>{0B4745B0-194B-4BB6-8E21-E9057CA92230};{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<PlatformFamilyName>WindowsCE</PlatformFamilyName>
<PlatformID>E2BECB1F-8C8C-41ba-B736-9BE7D946A398</PlatformID>
<OSVersion>5.0</OSVersion>
<DeployDirSuffix>SmartDeviceProject1</DeployDirSuffix>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<NativePlatformName>Windows CE</NativePlatformName>
<FormFactorID>
</FormFactorID>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<AllowedReferenceRelatedFileExtensions>.allowedReferenceRelatedFileExtensions</AllowedReferenceRelatedFileExtensions>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<FileAlignment>512</FileAlignment>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<AllowedReferenceRelatedFileExtensions>.allowedReferenceRelatedFileExtensions</AllowedReferenceRelatedFileExtensions>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<FileAlignment>512</FileAlignment>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
</PropertyGroup>
<ItemGroup>
<Reference Include="Crestron.SimplSharpPro.DeviceSupport, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DeviceSupport.dll</HintPath>
</Reference>
<Reference Include="Crestron.SimplSharpPro.DM, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DM.dll</HintPath>
</Reference>
<Reference Include="Crestron.SimplSharpPro.EthernetCommunications, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.EthernetCommunications.dll</HintPath>
</Reference>
<Reference Include="Crestron.SimplSharpPro.Fusion, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Fusion.dll</HintPath>
</Reference>
<Reference Include="Crestron.SimplSharpPro.Remotes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Remotes.dll</HintPath>
</Reference>
<Reference Include="Crestron.SimplSharpPro.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll</HintPath>
</Reference>
<Reference Include="Essentials Devices Common, Version=1.0.0.17079, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\essentials-devices-common\Essentials Devices Common\Essentials Devices Common\bin\Essentials Devices Common.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="EssentialsHttpServer, Version=1.0.0.21365, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\essentials-http-server\EssentialsHttpServer\bin\EssentialsHttpServer.dll</HintPath>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="PepperDashCorePortalSync, Version=1.0.0.27069, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\pepperdash-portal-sync\PepperDashCorePortalSync\PepperDashPortalSync\bin\PepperDashCorePortalSync.dll</HintPath>
</Reference>
<Reference Include="PepperDash_Core, Version=1.0.0.18868, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\pepperdash-simplsharp-core\Pepperdash Core\Pepperdash Core\bin\PepperDash_Core.dll</HintPath>
</Reference>
<Reference Include="PepperDash_Essentials_Core, Version=1.0.0.24312, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\essentials-ssp-base\PepperDashEssentialsBase\PepperDashEssentialsBase\bin\PepperDash_Essentials_Core.dll</HintPath>
</Reference>
<Reference Include="PepperDash_Essentials_Displays, Version=1.0.0.19741, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\essentials-displays\Essentials Displays\Essentials Displays\bin\PepperDash_Essentials_Displays.dll</HintPath>
</Reference>
<Reference Include="PepperDash_Essentials_DM, Version=1.0.0.17590, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\essentials-dm\Essentials_DM\Essentials_DM\bin\PepperDash_Essentials_DM.dll</HintPath>
</Reference>
<Reference Include="SimplSharpCustomAttributesInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll</HintPath>
</Reference>
<Reference Include="SimplSharpHelperInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll</HintPath>
</Reference>
<Reference Include="SimplSharpNewtonsoft, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpNewtonsoft.dll</HintPath>
</Reference>
<Reference Include="SimplSharpPro, Version=1.5.2.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
</ItemGroup>
<ItemGroup>
<Compile Include="Configuration ORIGINAL\Builders\TPConfig.cs" />
<Compile Include="Configuration ORIGINAL\Configuration.cs" />
<Compile Include="Configuration ORIGINAL\ConfigurationHelpers.cs" />
<Compile Include="Configuration ORIGINAL\ConfigTieLine.cs" />
<Compile Include="Configuration ORIGINAL\Factories\CommFactory.cs" />
<Compile Include="Configuration ORIGINAL\Factories\RemoteFactory.cs" />
<Compile Include="Configuration ORIGINAL\Factories\DeviceMonitorFactory.cs" />
<Compile Include="Configuration ORIGINAL\Factories\DmFactory.cs" />
<Compile Include="Configuration ORIGINAL\Factories\TouchpanelFactory.cs" />
<Compile Include="Configuration ORIGINAL\Factories\PcFactory.cs" />
<Compile Include="Configuration ORIGINAL\Factories\REMOVE DiscPlayerFactory.cs" />
<Compile Include="Configuration ORIGINAL\Factories\MAYBE SetTopBoxFactory.cs" />
<Compile Include="Configuration ORIGINAL\Factories\DisplayFactory.cs" />
<Compile Include="Configuration ORIGINAL\Factories\FactoryHelper.cs" />
<Compile Include="Config\ConfigReader.cs" />
<Compile Include="Config\EssentialsConfig.cs" />
<Compile Include="Config\DeviceFactory.cs" />
<Compile Include="Devices\DiscPlayer\OppoExtendedBdp.cs" />
<Compile Include="Devices\NUMERIC AppleTV.cs" />
<Compile Include="ControlSystem.cs" />
<Compile Include="REMOVE EssentialsApp.cs" />
<Compile Include="Fusion\FusionSystemController.cs" />
<Compile Include="HttpApiHandler.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="FOR REFERENCE Room\EssentialsRoom.cs" />
<Compile Include="Room\EssentialsPresentationRoom.cs" />
<Compile Include="Room\EssentialsRoomBase.cs" />
<Compile Include="Room\EssentialsRoomConfig.cs" />
<Compile Include="FOR REFERENCE Room\HuddleSpaceRoom.cs" />
<Compile Include="FOR REFERENCE Room\RoomEventArgs.cs" />
<Compile Include="FOR REFERENCE UI\PageControllers\DevicePageControllerBase.cs" />
<Compile Include="FOR REFERENCE UI\PageControllers\PageControllerLaptop.cs" />
<Compile Include="FOR REFERENCE UI\PageControllers\PageControllerLargeDvd.cs" />
<Compile Include="FOR REFERENCE UI\PageControllers\PageControllerLargeSetTopBoxGeneric.cs" />
<Compile Include="FOR REFERENCE UI\PageControllers\LargeTouchpanelControllerBase.cs" />
<Compile Include="FOR REFERENCE UI\Panels\SmartGraphicsTouchpanelControllerBase.cs" />
<Compile Include="Room\VolumeAndSourceChangeArgs.cs" />
<Compile Include="UI Drivers\EssentialsPresentationPanelAvFunctionsDriver.cs" />
<Compile Include="UI Drivers\EssentialsPanelMainInterfaceDriver.cs" />
<Compile Include="UI Drivers\enums and base.cs" />
<Compile Include="UI Drivers\EssentialsHuddlePanelAvFunctionsDriver.cs" />
<Compile Include="UI Drivers\SingleSubpageModalAndBackDriver.cs" />
<Compile Include="UI Drivers\SmartObjectRoomsList.cs" />
<Compile Include="UI Drivers\UIJoins.cs" />
<Compile Include="UI\SubpageReferenceListActivityItem.cs" />
<Compile Include="UI\CrestronTouchpanelPropertiesConfig.cs" />
<Compile Include="FOR REFERENCE UI\Panels\REMOVE UiCue.cs" />
<Compile Include="FOR REFERENCE UI\SRL\SourceListSubpageReferenceList.cs" />
<Compile Include="Room\EssentialsHuddleSpaceRoom.cs" />
<Compile Include="UI\EssentialsTouchpanelController.cs" />
<Compile Include="UI\SubpageReferenceListSourceItem.cs" />
<None Include="app.config" />
<None Include="Properties\ControlSystem.cfg" />
</ItemGroup>
<ItemGroup>
<Folder Include="OTHER\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
</VisualStudio>
</ProjectExtensions>
<PropertyGroup>
<PostBuildEvent>rem S# Pro preparation will execute after these operations</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,13 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<DeployDeviceID>E282E6BE-C7C3-4ece-916A-88FB1CF8AF3C</DeployDeviceID>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<RemoteDebugEnabled>false</RemoteDebugEnabled>
<StartAction>Project</StartAction>
<StartProgram>
</StartProgram>
<StartArguments>
</StartArguments>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,8 @@
using System.Reflection;
[assembly: AssemblyTitle("PepperDashEssentials")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PepperDashEssentials")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyVersion("1.0.0.*")]

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<ControlSystem>
<Name>Desk MC3</Name>
<Address>ssh 10.0.0.15</Address>
<ProgramSlot>Program01</ProgramSlot>
<Storage>Internal Flash</Storage>
</ControlSystem>

View File

@@ -0,0 +1,69 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using Crestron.SimplSharp;
//using Crestron.SimplSharp.CrestronIO;
//using Crestron.SimplSharpPro;
//using Crestron.SimplSharpPro.DeviceSupport;
//using Crestron.SimplSharpPro.CrestronThread;
//using Crestron.SimplSharpPro.Diagnostics;
//using Crestron.SimplSharpPro.EthernetCommunication;
//using Crestron.SimplSharpPro.UI;
//using Crestron.SimplSharpPro.DM;
//using Crestron.SimplSharpPro.DM.Cards;
//using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
//using PepperDash.Essentials.Core;
//using PepperDash.Essentials.Core.Devices;
////using PepperDash.Essentials.Core.Devices.Dm;
//using PepperDash.Essentials.Displays;
////using PepperDash.Essentials.Core.Http;
//using PepperDash.Core;
//namespace PepperDash.Essentials
//{
// public class EssentialsApp
// {
// public string ConfigPath { get; set; }
// public Dictionary<string, Room> Rooms { get; private set; }
// //EssentialsHttpApiHandler ApiHandler; // MOVE ???????????????????
// public EssentialsApp(CrestronControlSystem cs)
// {
// // Use a fake license manager for now
// Global.LicenseManager = PepperDash.Essentials.License.MockEssentialsLicenseManager.Manager;
// // ---------------------------------- Make this configurable
// //var server = Global.HttpConfigServer;
// //server.Start(8081, "HttpConfigServer");
// //ConfigPath = string.Format(@"\NVRAM\Program{0}\EssentialsConfiguration.json",
// // InitialParametersClass.ApplicationNumber);
// //ApiHandler = new EssentialsHttpApiHandler(server, ConfigPath, @"\HTML\presets\lists\");
// Debug.Console(0, "\r\r--------------------CONFIG BEGIN--------------------\r");
// Configuration.Initialize(cs);
// Configuration.ReadConfiguration(ConfigPath);
// Debug.Console(0, "\r--------------------CONFIG END----------------------\r\r");
// }
// }
// public class ResponseToken
// {
// public string Token { get; private set; }
// public DateTime Expires { get; private set; }
// public bool IsExpired { get { return Expires < DateTime.Now; } }
// public ResponseToken(int timeoutMinutes)
// {
// Expires = DateTime.Now.AddMinutes(timeoutMinutes);
// Token = Guid.NewGuid().ToString();
// }
// }
//}

View File

@@ -0,0 +1,16 @@
<ProgramInfo>
<RequiredInfo>
<FriendlyName>PepperDashEssentials</FriendlyName>
<SystemName>PepperDashEssentialsBase</SystemName>
<EntryPoint>PepperDashEssentialsBase</EntryPoint>
<MinFirmwareVersion>1.009.0029</MinFirmwareVersion>
<ProgramTool>SIMPL# Plugin</ProgramTool>
<DesignToolId>5</DesignToolId>
<ProgramToolId>5</ProgramToolId>
<ArchiveName />
</RequiredInfo>
<OptionalInfo>
<CompiledOn>1/8/2016 3:03:22 PM</CompiledOn>
<CompilerRev>1.0.0.27100</CompilerRev>
</OptionalInfo>
</ProgramInfo>

View File

@@ -0,0 +1,18 @@
MainAssembly=PepperDashEssentialsBase.dll:5d68a993ab03b4b88d0f95478188a439
MainAssemblyMinFirmwareVersion=1.009.0029
ü
DependencySource=Crestron.SimplSharpPro.DeviceSupport.dll:caae4b4259aaf619059f0ae34473bfd2
DependencyPath=PepperDashEssentialsBase.cplz:Crestron.SimplSharpPro.DeviceSupport.dll
DependencyMainAssembly=Crestron.SimplSharpPro.DeviceSupport.dll:caae4b4259aaf619059f0ae34473bfd2
ü
DependencySource=Crestron.SimplSharpPro.DM.dll:bdf5acfa80cc3bb87f21deb891128b1d
DependencyPath=PepperDashEssentialsBase.cplz:Crestron.SimplSharpPro.DM.dll
DependencyMainAssembly=Crestron.SimplSharpPro.DM.dll:bdf5acfa80cc3bb87f21deb891128b1d
ü
DependencySource=Crestron.SimplSharpPro.EthernetCommunications.dll:36e663497195140ee6f1b4ebc53f5ea7
DependencyPath=PepperDashEssentialsBase.cplz:Crestron.SimplSharpPro.EthernetCommunications.dll
DependencyMainAssembly=Crestron.SimplSharpPro.EthernetCommunications.dll:36e663497195140ee6f1b4ebc53f5ea7
ü
DependencySource=Crestron.SimplSharpPro.UI.dll:089312a0cb0b4537072d4eb234e71e0e
DependencyPath=PepperDashEssentialsBase.cplz:Crestron.SimplSharpPro.UI.dll
DependencyMainAssembly=Crestron.SimplSharpPro.UI.dll:089312a0cb0b4537072d4eb234e71e0e

View File

@@ -0,0 +1,284 @@
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
{
public class EssentialsHuddleSpaceRoom : EssentialsRoomBase
{
public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange;
public event SourceInfoChangeHandler CurrentSourceInfoChange;
public EssentialsRoomPropertiesConfig Config { get; private set; }
public IRoutingSinkWithSwitching DefaultDisplay { get; private set; }
public IRoutingSinkNoSwitching DefaultAudioDevice { get; private set; }
public IBasicVolumeControls DefaultVolumeControls { get; private set; }
public bool ExcludeFromGlobalFunctions { get; set; }
/// <summary>
/// The config name of the source list
/// </summary>
public string SourceListKey { get; set; }
/// <summary>
/// If room is off, enables power on to last source. Default true
/// </summary>
public bool EnablePowerOnToLastSource { get; set; }
string LastSourceKey;
/// <summary>
///
/// </summary>
public IBasicVolumeControls CurrentVolumeControls
{
get { return _CurrentAudioDevice; }
set
{
if (value == _CurrentAudioDevice) return;
var oldDev = _CurrentAudioDevice;
// derigister this room from the device, if it can
if (oldDev is IInUseTracking)
(oldDev as IInUseTracking).InUseTracker.RemoveUser(this, "audio");
var handler = CurrentVolumeDeviceChange;
if (handler != null)
CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.WillChange));
_CurrentAudioDevice = value;
if (handler != null)
CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.DidChange));
// register this room with new device, if it can
if (_CurrentAudioDevice is IInUseTracking)
(_CurrentAudioDevice as IInUseTracking).InUseTracker.AddUser(this, "audio");
}
}
IBasicVolumeControls _CurrentAudioDevice;
/// <summary>
/// The SourceListItem last run - containing names and icons
/// </summary>
public SourceListItem CurrentSourceInfo
{
get { return _CurrentSourceInfo; }
private set
{
if (value == _CurrentSourceInfo) return;
var handler = CurrentSourceInfoChange;
// remove from in-use tracker, if so equipped
if(_CurrentSourceInfo != null && _CurrentSourceInfo.SourceDevice is IInUseTracking)
(_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.RemoveUser(this, "control");
if (handler != null)
handler(this, _CurrentSourceInfo, ChangeType.WillChange);
_CurrentSourceInfo = value;
// add to in-use tracking
if (_CurrentSourceInfo != null && _CurrentSourceInfo.SourceDevice is IInUseTracking)
(_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.AddUser(this, "control");
if (handler != null)
handler(this, _CurrentSourceInfo, ChangeType.DidChange);
}
}
SourceListItem _CurrentSourceInfo;
/// <summary>
///
/// </summary>
public BoolFeedback OnFeedback { get; private set; }
/// <summary>
///
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
public EssentialsHuddleSpaceRoom(string key, string name, IRoutingSinkWithSwitching defaultDisplay,
IRoutingSinkNoSwitching defaultAudio, EssentialsRoomPropertiesConfig config)
: base(key, name)
{
Config = config;
DefaultDisplay = defaultDisplay;
DefaultAudioDevice = defaultAudio;
if (defaultAudio is IBasicVolumeControls)
DefaultVolumeControls = defaultAudio as IBasicVolumeControls;
else if (defaultAudio is IHasVolumeDevice)
DefaultVolumeControls = (defaultAudio as IHasVolumeDevice).VolumeDevice;
OnFeedback = new BoolFeedback(() =>
{ return CurrentSourceInfo != null
&& CurrentSourceInfo.Type == eSourceListItemType.Route; });
SourceListKey = "default";
EnablePowerOnToLastSource = true;
}
public void RunRouteAction(string routeKey)
{
RunRouteAction(routeKey, null);
}
/// <summary>
/// Gets a source from config list SourceListKey and dynamically build and executes the
/// route or commands
/// </summary>
/// <param name="name"></param>
public void RunRouteAction(string routeKey, Action successCallback)
{
// Run this on a separate thread
new CTimer(o =>
{
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;
}
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;
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);
}
// 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)
CurrentSourceInfo = item;
// And finally, set the "control". This will trigger event
//CurrentControlDevice = DeviceManager.GetDeviceForKey(item.SourceKey) as Device;
OnFeedback.FireUpdate();
// report back when done
if (successCallback != null)
successCallback();
#warning Need to again handle special commands in here.
}, 0); // end of CTimer
}
/// <summary>
/// Will power the room on with the last-used source
/// </summary>
public void PowerOnToDefaultOrLastSource()
{
if (!EnablePowerOnToLastSource || LastSourceKey == null)
return;
RunRouteAction(LastSourceKey);
}
/// <summary>
///
/// </summary>
/// <param name="route"></param>
/// <returns></returns>
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 (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;
}
/// <summary>
/// Runs "roomOff" action on all rooms not set to ExcludeFromGlobalFunctions
/// </summary>
public static void AllRoomsOff()
{
var allRooms = DeviceManager.AllDevices.Where(d =>
d is EssentialsHuddleSpaceRoom && !(d as EssentialsHuddleSpaceRoom).ExcludeFromGlobalFunctions);
foreach (var room in allRooms)
(room as EssentialsHuddleSpaceRoom).RunRouteAction("roomOff");
}
}
}

View File

@@ -0,0 +1,283 @@
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
{
public class EssentialsPresentationRoom : EssentialsRoomBase
{
public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange;
public event SourceInfoChangeHandler CurrentSourceInfoChange;
public EssentialsPresentationRoomPropertiesConfig Config { get; private set; }
public Dictionary<int, IRoutingSinkWithSwitching> Displays { get; private set; }
public IRoutingSinkWithSwitching DefaultDisplay { get; private set; }
public IRoutingSinkNoSwitching DefaultAudioDevice { get; private set; }
public IBasicVolumeControls DefaultVolumeControls { get; private set; }
public bool ExcludeFromGlobalFunctions { get; set; }
/// <summary>
/// The config name of the source list
/// </summary>
public string SourceListKey { get; set; }
/// <summary>
/// If room is off, enables power on to last source. Default true
/// </summary>
public bool EnablePowerOnToLastSource { get; set; }
string LastSourceKey;
/// <summary>
///
/// </summary>
public IBasicVolumeControls CurrentVolumeControls
{
get { return _CurrentAudioDevice; }
set
{
if (value == _CurrentAudioDevice) return;
var oldDev = _CurrentAudioDevice;
// derigister this room from the device, if it can
if (oldDev is IInUseTracking)
(oldDev as IInUseTracking).InUseTracker.RemoveUser(this, "audio");
var handler = CurrentVolumeDeviceChange;
if (handler != null)
CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.WillChange));
_CurrentAudioDevice = value;
if (handler != null)
CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.DidChange));
// register this room with new device, if it can
if (_CurrentAudioDevice is IInUseTracking)
(_CurrentAudioDevice as IInUseTracking).InUseTracker.AddUser(this, "audio");
}
}
IBasicVolumeControls _CurrentAudioDevice;
/// <summary>
/// The SourceListItem last run - containing names and icons
/// </summary>
public SourceListItem CurrentSourceInfo
{
get { return _CurrentSourceInfo; }
private set
{
if (value == _CurrentSourceInfo) return;
var handler = CurrentSourceInfoChange;
// remove from in-use tracker, if so equipped
if(_CurrentSourceInfo != null && _CurrentSourceInfo.SourceDevice is IInUseTracking)
(_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.RemoveUser(this, "control");
if (handler != null)
handler(this, _CurrentSourceInfo, ChangeType.WillChange);
_CurrentSourceInfo = value;
// add to in-use tracking
if (_CurrentSourceInfo != null && _CurrentSourceInfo.SourceDevice is IInUseTracking)
(_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.AddUser(this, "control");
if (handler != null)
handler(this, _CurrentSourceInfo, ChangeType.DidChange);
}
}
SourceListItem _CurrentSourceInfo;
/// <summary>
///
/// </summary>
public BoolFeedback OnFeedback { get; private set; }
/// <summary>
///
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
public EssentialsPresentationRoom(string key, string name, IRoutingSinkWithSwitching defaultDisplay,
IRoutingSinkNoSwitching defaultAudio, EssentialsPresentationRoomPropertiesConfig config)
: base(key, name)
{
Config = config;
DefaultDisplay = defaultDisplay;
DefaultAudioDevice = defaultAudio;
if (defaultAudio is IBasicVolumeControls)
DefaultVolumeControls = defaultAudio as IBasicVolumeControls;
else if (defaultAudio is IHasVolumeDevice)
DefaultVolumeControls = (defaultAudio as IHasVolumeDevice).VolumeDevice;
OnFeedback = new BoolFeedback(() =>
{ return CurrentSourceInfo != null
&& CurrentSourceInfo.Type == eSourceListItemType.Route; });
SourceListKey = "default";
EnablePowerOnToLastSource = true;
}
public void RunRouteAction(string routeKey)
{
RunRouteAction(routeKey, null);
}
/// <summary>
/// Gets a source from config list SourceListKey and dynamically build and executes the
/// route or commands
/// </summary>
/// <param name="name"></param>
public void RunRouteAction(string routeKey, Action successCallback)
{
// Run this on a separate thread
new CTimer(o =>
{
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;
}
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;
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);
}
// 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)
CurrentSourceInfo = item;
// And finally, set the "control". This will trigger event
//CurrentControlDevice = DeviceManager.GetDeviceForKey(item.SourceKey) as Device;
OnFeedback.FireUpdate();
// report back when done
if (successCallback != null)
successCallback();
}, 0); // end of CTimer
}
/// <summary>
/// Will power the room on with the last-used source
/// </summary>
public void PowerOnToDefaultOrLastSource()
{
if (!EnablePowerOnToLastSource || LastSourceKey == null)
return;
RunRouteAction(LastSourceKey);
}
/// <summary>
///
/// </summary>
/// <param name="route"></param>
/// <returns></returns>
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 (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;
}
/// <summary>
/// Runs "roomOff" action on all rooms not set to ExcludeFromGlobalFunctions
/// </summary>
public static void AllRoomsOff()
{
var allRooms = DeviceManager.AllDevices.Where(d =>
d is EssentialsHuddleSpaceRoom && !(d as EssentialsHuddleSpaceRoom).ExcludeFromGlobalFunctions);
foreach (var room in allRooms)
(room as EssentialsHuddleSpaceRoom).RunRouteAction("roomOff");
}
}
}

View File

@@ -0,0 +1,18 @@
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
{
public class EssentialsRoomBase : Device
{
public EssentialsRoomBase(string key, string name) : base(key, name)
{
}
}
}

View File

@@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials
{
public class EssentialsRoomConfig : DeviceConfig
{
/// <summary>
/// Returns a room object from this config data
/// </summary>
/// <returns></returns>
public Device GetRoomObject()
{
var typeName = Type.ToLower();
EssentialsHuddleSpaceRoom room = null;
if (typeName == "huddle")
{
var props = JsonConvert.DeserializeObject<EssentialsHuddleRoomPropertiesConfig>
(this.Properties.ToString());
var disp = DeviceManager.GetDeviceForKey(props.DefaultDisplayKey) as IRoutingSinkWithSwitching;
var audio = DeviceManager.GetDeviceForKey(props.DefaultAudioKey) as IRoutingSinkNoSwitching;
room = new EssentialsHuddleSpaceRoom(Key, Name, disp, audio, props);
room.SourceListKey = props.SourceListKey;
}
else if (typeName == "presentation")
{
var props = JsonConvert.DeserializeObject<EssentialsPresentationRoomPropertiesConfig>
(this.Properties.ToString());
// assign displays
// assign audio. How??????
}
return room;
}
}
public class EssentialsRoomPropertiesConfig
{
public string HelpMessage { get; set; }
public string Description { get; set; }
}
public class EssentialsHuddleRoomPropertiesConfig : EssentialsRoomPropertiesConfig
{
public string DefaultDisplayKey { get; set; }
public string DefaultAudioKey { get; set; }
public string SourceListKey { get; set; }
}
public class EssentialsPresentationRoomPropertiesConfig
{
public string DefaultAudioBehavior { get; set; }
public string DefaultAudioKey { get; set; }
public string DefaultVideoBehavior { get; set; }
public List<string> DisplayKeys { get; set; }
public string SourceListKey { get; set; }
public Dictionary<string, EssentialsVolumeLevelConfig> Volumes { get; set; }
}
public class EssentialsVolumeLevelConfig
{
public string DeviceKey { get; set; }
public string Label { get; set; }
public int Level { get; set; }
}
}

View File

@@ -0,0 +1,41 @@
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
}
}

View File

@@ -0,0 +1,9 @@
11/18/2016 11:41:34 AM, Info: Initializing SIMPLSharp Services...
11/18/2016 11:41:34 AM, Info: ProjectInfo successfully initialized.
11/18/2016 11:45:04 AM, Info: Saving project information...
11/18/2016 11:45:04 AM, Info: Saving project information...
11/18/2016 11:45:04 AM, Info: Saving project information...
11/18/2016 11:45:04 AM, Info: Saving project information...
11/18/2016 11:45:04 AM, Info: Saving project information...
11/18/2016 11:45:04 AM, Info: Saving project information...
11/18/2016 11:45:05 AM, Info: Terminating SIMPLSharp Services

View File

@@ -0,0 +1,20 @@
11/18/2016 11:46:54 AM, Info: Initializing SIMPLSharp Services...
11/18/2016 11:46:54 AM, Info: ProjectInfo successfully initialized.
11/18/2016 11:49:22 AM, Info: Saving project information...
11/18/2016 11:49:22 AM, Info: Saving project information...
11/18/2016 11:49:22 AM, Info: Saving project information...
11/18/2016 11:49:22 AM, Info: Saving project information...
11/18/2016 11:49:22 AM, Info: Saving project information...
11/18/2016 11:49:22 AM, Info: Saving project information...
11/18/2016 11:52:46 AM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-http-server\EssentialsHttpServer\bin\EssentialsHttpServer.dll...
11/18/2016 11:53:06 AM, Info: Saving project information...
11/18/2016 11:53:06 AM, Info: Saving project information...
11/18/2016 11:53:06 AM, Info: Saving project information...
11/18/2016 11:53:06 AM, Info: Saving project information...
11/18/2016 11:53:07 AM, Info: Saving project information...
11/18/2016 11:53:07 AM, Info: Saving project information...
11/18/2016 11:53:09 AM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
11/18/2016 11:53:09 AM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
11/18/2016 11:53:10 AM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
11/18/2016 11:53:11 AM, Info: Saving project information...
11/18/2016 12:51:23 PM, Info: Terminating SIMPLSharp Services

View File

@@ -0,0 +1,3 @@
11/21/2016 8:15:37 AM, Info: Initializing SIMPLSharp Services...
11/21/2016 8:15:37 AM, Info: ProjectInfo successfully initialized.
11/21/2016 8:32:35 AM, Info: Terminating SIMPLSharp Services

View File

@@ -0,0 +1,3 @@
11/21/2016 8:32:44 AM, Info: Initializing SIMPLSharp Services...
11/21/2016 8:32:44 AM, Info: ProjectInfo successfully initialized.
11/21/2016 8:33:03 AM, Info: Terminating SIMPLSharp Services

View File

@@ -0,0 +1,11 @@
1/3/2017 2:46:05 PM, Info: Initializing SIMPLSharp Services...
1/3/2017 2:46:05 PM, Info: ProjectInfo successfully initialized.
1/3/2017 3:29:58 PM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
1/3/2017 3:29:59 PM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
1/3/2017 3:29:59 PM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
1/3/2017 3:30:01 PM, Info: Saving project information...
1/3/2017 3:36:25 PM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
1/3/2017 3:36:26 PM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
1/3/2017 3:36:26 PM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
1/3/2017 3:36:27 PM, Info: Saving project information...
1/3/2017 4:32:20 PM, Info: Terminating SIMPLSharp Services

View File

@@ -0,0 +1,3 @@
1/10/2017 3:37:56 PM, Info: Initializing SIMPLSharp Services...
1/10/2017 3:37:57 PM, Info: ProjectInfo successfully initialized.
1/10/2017 3:41:24 PM, Info: Terminating SIMPLSharp Services

View File

@@ -0,0 +1,31 @@
1/16/2017 9:03:58 AM, Info: Initializing SIMPLSharp Services...
1/16/2017 9:03:58 AM, Info: ProjectInfo successfully initialized.
1/17/2017 9:47:21 AM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
1/17/2017 9:47:22 AM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
1/17/2017 9:47:22 AM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
1/17/2017 9:47:24 AM, Info: Saving project information...
1/17/2017 10:10:33 AM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
1/17/2017 10:10:33 AM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
1/17/2017 10:10:34 AM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
1/17/2017 10:10:35 AM, Info: Saving project information...
1/17/2017 11:27:26 AM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
1/17/2017 11:27:27 AM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
1/17/2017 11:27:27 AM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
1/17/2017 11:27:28 AM, Info: Saving project information...
1/17/2017 11:31:13 AM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
1/17/2017 11:31:13 AM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
1/17/2017 11:31:13 AM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
1/17/2017 11:31:14 AM, Info: Saving project information...
1/17/2017 12:36:38 PM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
1/17/2017 12:36:38 PM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
1/17/2017 12:36:39 PM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
1/17/2017 12:36:40 PM, Info: Saving project information...
1/17/2017 12:39:52 PM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
1/17/2017 12:39:52 PM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
1/17/2017 12:39:52 PM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
1/17/2017 12:39:54 PM, Info: Saving project information...
1/17/2017 12:40:18 PM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
1/17/2017 12:40:19 PM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
1/17/2017 12:40:19 PM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
1/17/2017 12:40:20 PM, Info: Saving project information...
1/17/2017 5:15:33 PM, Info: Terminating SIMPLSharp Services

View File

@@ -0,0 +1,49 @@
1/24/2017 8:36:38 AM, Info: Initializing SIMPLSharp Services...
1/24/2017 8:36:38 AM, Info: ProjectInfo successfully initialized.
1/24/2017 8:57:18 AM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
1/24/2017 8:57:20 AM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
1/24/2017 8:57:20 AM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
1/24/2017 8:57:21 AM, Info: Saving project information...
1/24/2017 8:58:46 AM, Info: Saving project information...
1/24/2017 8:58:46 AM, Info: Saving project information...
1/24/2017 8:58:46 AM, Info: Saving project information...
1/24/2017 8:58:46 AM, Info: Saving project information...
1/24/2017 8:58:46 AM, Info: Saving project information...
1/24/2017 8:58:46 AM, Info: Saving project information...
1/24/2017 8:58:47 AM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
1/24/2017 8:58:48 AM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
1/24/2017 8:58:48 AM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
1/24/2017 8:58:50 AM, Info: Saving project information...
1/24/2017 9:25:04 AM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
1/24/2017 9:25:04 AM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
1/24/2017 9:25:05 AM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
1/24/2017 9:25:06 AM, Info: Saving project information...
1/24/2017 9:54:09 AM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
1/24/2017 9:54:09 AM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
1/24/2017 9:54:09 AM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
1/24/2017 9:54:11 AM, Info: Saving project information...
1/24/2017 10:23:04 AM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\pepperdash-portal-sync\SspPortalSync\SspPortalSync\bin\PepperDashPortalSync.dll...
1/24/2017 10:24:52 AM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\pepperdash-portal-sync\PepperDashCorePortalSync\PepperDashPortalSync\bin\PepperDashCorePortalSync.dll...
1/24/2017 10:25:07 AM, Info: Saving project information...
1/24/2017 10:25:07 AM, Info: Saving project information...
1/24/2017 10:25:07 AM, Info: Saving project information...
1/24/2017 10:25:07 AM, Info: Saving project information...
1/24/2017 10:25:07 AM, Info: Saving project information...
1/24/2017 10:25:07 AM, Info: Saving project information...
1/24/2017 10:25:09 AM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
1/24/2017 10:25:10 AM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
1/24/2017 10:25:10 AM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
1/24/2017 10:25:11 AM, Info: Saving project information...
1/24/2017 10:25:51 AM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
1/24/2017 10:25:52 AM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
1/24/2017 10:25:52 AM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
1/24/2017 10:25:53 AM, Info: Saving project information...
1/24/2017 10:28:49 AM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
1/24/2017 10:28:50 AM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
1/24/2017 10:28:50 AM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
1/24/2017 10:28:51 AM, Info: Saving project information...
1/24/2017 10:36:42 AM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
1/24/2017 10:36:42 AM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
1/24/2017 10:36:43 AM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
1/24/2017 10:36:44 AM, Info: Saving project information...
1/24/2017 1:02:32 PM, Info: Terminating SIMPLSharp Services

View File

@@ -0,0 +1,91 @@
1/31/2017 8:59:28 AM, Info: Initializing SIMPLSharp Services...
1/31/2017 8:59:28 AM, Info: ProjectInfo successfully initialized.
1/31/2017 11:08:48 AM, Info: Saving project information...
1/31/2017 11:08:48 AM, Info: Saving project information...
1/31/2017 11:08:48 AM, Info: Saving project information...
1/31/2017 11:10:57 AM, Info: Saving project information...
1/31/2017 11:10:57 AM, Info: Saving project information...
1/31/2017 11:10:57 AM, Info: Saving project information...
1/31/2017 11:10:57 AM, Info: Saving project information...
1/31/2017 11:10:57 AM, Info: Saving project information...
1/31/2017 11:10:57 AM, Info: Saving project information...
1/31/2017 11:11:00 AM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
1/31/2017 11:11:01 AM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
1/31/2017 11:11:01 AM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
1/31/2017 11:11:03 AM, Info: Saving project information...
1/31/2017 11:57:55 AM, Info: Saving project information...
1/31/2017 11:57:55 AM, Info: Saving project information...
1/31/2017 11:57:55 AM, Info: Saving project information...
1/31/2017 12:02:55 PM, Info: Saving project information...
1/31/2017 12:02:55 PM, Info: Saving project information...
1/31/2017 12:02:55 PM, Info: Saving project information...
1/31/2017 12:07:55 PM, Info: Saving project information...
1/31/2017 12:07:55 PM, Info: Saving project information...
1/31/2017 12:07:55 PM, Info: Saving project information...
1/31/2017 12:12:55 PM, Info: Saving project information...
1/31/2017 12:12:55 PM, Info: Saving project information...
1/31/2017 12:12:55 PM, Info: Saving project information...
1/31/2017 12:17:55 PM, Info: Saving project information...
1/31/2017 12:17:55 PM, Info: Saving project information...
1/31/2017 12:17:55 PM, Info: Saving project information...
1/31/2017 12:22:55 PM, Info: Saving project information...
1/31/2017 12:22:55 PM, Info: Saving project information...
1/31/2017 12:22:55 PM, Info: Saving project information...
1/31/2017 12:27:55 PM, Info: Saving project information...
1/31/2017 12:27:55 PM, Info: Saving project information...
1/31/2017 12:27:55 PM, Info: Saving project information...
1/31/2017 12:32:55 PM, Info: Saving project information...
1/31/2017 12:32:55 PM, Info: Saving project information...
1/31/2017 12:32:55 PM, Info: Saving project information...
1/31/2017 12:37:55 PM, Info: Saving project information...
1/31/2017 12:37:55 PM, Info: Saving project information...
1/31/2017 12:37:55 PM, Info: Saving project information...
1/31/2017 12:42:55 PM, Info: Saving project information...
1/31/2017 12:42:55 PM, Info: Saving project information...
1/31/2017 12:42:55 PM, Info: Saving project information...
1/31/2017 12:47:55 PM, Info: Saving project information...
1/31/2017 12:47:55 PM, Info: Saving project information...
1/31/2017 12:47:55 PM, Info: Saving project information...
1/31/2017 12:52:55 PM, Info: Saving project information...
1/31/2017 12:52:55 PM, Info: Saving project information...
1/31/2017 12:52:55 PM, Info: Saving project information...
1/31/2017 12:57:55 PM, Info: Saving project information...
1/31/2017 12:57:55 PM, Info: Saving project information...
1/31/2017 12:57:55 PM, Info: Saving project information...
1/31/2017 1:02:55 PM, Info: Saving project information...
1/31/2017 1:02:55 PM, Info: Saving project information...
1/31/2017 1:02:55 PM, Info: Saving project information...
1/31/2017 1:07:55 PM, Info: Saving project information...
1/31/2017 1:07:55 PM, Info: Saving project information...
1/31/2017 1:07:55 PM, Info: Saving project information...
1/31/2017 1:12:55 PM, Info: Saving project information...
1/31/2017 1:12:55 PM, Info: Saving project information...
1/31/2017 1:12:55 PM, Info: Saving project information...
1/31/2017 1:17:55 PM, Info: Saving project information...
1/31/2017 1:17:55 PM, Info: Saving project information...
1/31/2017 1:17:55 PM, Info: Saving project information...
1/31/2017 1:22:55 PM, Info: Saving project information...
1/31/2017 1:22:55 PM, Info: Saving project information...
1/31/2017 1:22:55 PM, Info: Saving project information...
1/31/2017 1:27:55 PM, Info: Saving project information...
1/31/2017 1:27:55 PM, Info: Saving project information...
1/31/2017 1:27:55 PM, Info: Saving project information...
1/31/2017 1:32:55 PM, Info: Saving project information...
1/31/2017 1:32:55 PM, Info: Saving project information...
1/31/2017 1:32:55 PM, Info: Saving project information...
1/31/2017 1:37:55 PM, Info: Saving project information...
1/31/2017 1:37:55 PM, Info: Saving project information...
1/31/2017 1:37:55 PM, Info: Saving project information...
1/31/2017 1:42:55 PM, Info: Saving project information...
1/31/2017 1:42:55 PM, Info: Saving project information...
1/31/2017 1:42:55 PM, Info: Saving project information...
1/31/2017 1:47:55 PM, Info: Saving project information...
1/31/2017 1:47:55 PM, Info: Saving project information...
1/31/2017 1:47:55 PM, Info: Saving project information...
1/31/2017 1:52:24 PM, Info: Saving project information...
1/31/2017 1:52:24 PM, Info: Saving project information...
1/31/2017 1:52:24 PM, Info: Saving project information...
1/31/2017 1:52:24 PM, Info: Saving project information...
1/31/2017 1:52:24 PM, Info: Saving project information...
1/31/2017 1:52:24 PM, Info: Saving project information...
1/31/2017 1:52:25 PM, Info: Terminating SIMPLSharp Services

View File

@@ -0,0 +1,3 @@
1/31/2017 2:52:20 PM, Info: Initializing SIMPLSharp Services...
1/31/2017 2:52:20 PM, Info: ProjectInfo successfully initialized.
1/31/2017 4:17:21 PM, Info: Terminating SIMPLSharp Services

View File

@@ -0,0 +1,7 @@
1/31/2017 4:28:49 PM, Info: Initializing SIMPLSharp Services...
1/31/2017 4:28:49 PM, Info: ProjectInfo successfully initialized.
1/31/2017 4:53:28 PM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
1/31/2017 4:53:29 PM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
1/31/2017 4:53:29 PM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
1/31/2017 4:53:31 PM, Info: Saving project information...
1/31/2017 5:02:34 PM, Info: Terminating SIMPLSharp Services

View File

@@ -0,0 +1,24 @@
2/1/2017 9:00:40 AM, Info: Initializing SIMPLSharp Services...
2/1/2017 9:00:41 AM, Info: ProjectInfo successfully initialized.
2/1/2017 12:08:44 PM, Info: Saving project information...
2/1/2017 12:08:44 PM, Info: Saving project information...
2/1/2017 12:08:44 PM, Info: Saving project information...
2/1/2017 12:13:44 PM, Info: Saving project information...
2/1/2017 12:13:44 PM, Info: Saving project information...
2/1/2017 12:13:44 PM, Info: Saving project information...
2/1/2017 12:18:45 PM, Info: Saving project information...
2/1/2017 12:18:45 PM, Info: Saving project information...
2/1/2017 12:18:45 PM, Info: Saving project information...
2/1/2017 12:23:44 PM, Info: Saving project information...
2/1/2017 12:23:44 PM, Info: Saving project information...
2/1/2017 12:23:44 PM, Info: Saving project information...
2/1/2017 12:28:44 PM, Info: Saving project information...
2/1/2017 12:28:44 PM, Info: Saving project information...
2/1/2017 12:28:44 PM, Info: Saving project information...
2/1/2017 12:33:27 PM, Info: Saving project information...
2/1/2017 12:33:27 PM, Info: Saving project information...
2/1/2017 12:33:27 PM, Info: Saving project information...
2/1/2017 12:33:27 PM, Info: Saving project information...
2/1/2017 12:33:27 PM, Info: Saving project information...
2/1/2017 12:33:27 PM, Info: Saving project information...
2/1/2017 12:33:30 PM, Info: Terminating SIMPLSharp Services

View File

@@ -0,0 +1,3 @@
2/1/2017 2:33:10 PM, Info: Initializing SIMPLSharp Services...
2/1/2017 2:33:10 PM, Info: ProjectInfo successfully initialized.
2/1/2017 2:41:00 PM, Info: Terminating SIMPLSharp Services

View File

@@ -0,0 +1,3 @@
2/2/2017 8:35:09 AM, Info: Initializing SIMPLSharp Services...
2/2/2017 8:35:09 AM, Info: ProjectInfo successfully initialized.
2/2/2017 8:36:58 AM, Info: Terminating SIMPLSharp Services

View File

@@ -0,0 +1,111 @@
2/2/2017 9:43:08 AM, Info: Initializing SIMPLSharp Services...
2/2/2017 9:43:08 AM, Info: ProjectInfo successfully initialized.
2/2/2017 9:48:00 AM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
2/2/2017 9:48:01 AM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
2/2/2017 9:48:02 AM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
2/2/2017 9:48:03 AM, Info: Saving project information...
2/2/2017 9:49:16 AM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
2/2/2017 9:49:16 AM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
2/2/2017 9:49:16 AM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
2/2/2017 9:49:18 AM, Info: Saving project information...
2/2/2017 10:37:52 AM, Info: Saving project information...
2/2/2017 10:37:52 AM, Info: Saving project information...
2/2/2017 10:37:52 AM, Info: Saving project information...
2/2/2017 10:42:52 AM, Info: Saving project information...
2/2/2017 10:42:52 AM, Info: Saving project information...
2/2/2017 10:42:52 AM, Info: Saving project information...
2/2/2017 10:47:52 AM, Info: Saving project information...
2/2/2017 10:47:52 AM, Info: Saving project information...
2/2/2017 10:47:52 AM, Info: Saving project information...
2/2/2017 10:52:52 AM, Info: Saving project information...
2/2/2017 10:52:52 AM, Info: Saving project information...
2/2/2017 10:52:52 AM, Info: Saving project information...
2/2/2017 10:57:52 AM, Info: Saving project information...
2/2/2017 10:57:52 AM, Info: Saving project information...
2/2/2017 10:57:52 AM, Info: Saving project information...
2/2/2017 11:02:52 AM, Info: Saving project information...
2/2/2017 11:02:52 AM, Info: Saving project information...
2/2/2017 11:02:52 AM, Info: Saving project information...
2/2/2017 11:07:52 AM, Info: Saving project information...
2/2/2017 11:07:52 AM, Info: Saving project information...
2/2/2017 11:07:52 AM, Info: Saving project information...
2/2/2017 11:12:52 AM, Info: Saving project information...
2/2/2017 11:12:52 AM, Info: Saving project information...
2/2/2017 11:12:52 AM, Info: Saving project information...
2/2/2017 11:17:52 AM, Info: Saving project information...
2/2/2017 11:17:52 AM, Info: Saving project information...
2/2/2017 11:17:52 AM, Info: Saving project information...
2/2/2017 12:08:13 PM, Info: Saving project information...
2/2/2017 12:08:13 PM, Info: Saving project information...
2/2/2017 12:08:13 PM, Info: Saving project information...
2/2/2017 12:13:12 PM, Info: Saving project information...
2/2/2017 12:13:12 PM, Info: Saving project information...
2/2/2017 12:13:12 PM, Info: Saving project information...
2/2/2017 12:18:12 PM, Info: Saving project information...
2/2/2017 12:18:12 PM, Info: Saving project information...
2/2/2017 12:18:12 PM, Info: Saving project information...
2/2/2017 12:23:12 PM, Info: Saving project information...
2/2/2017 12:23:12 PM, Info: Saving project information...
2/2/2017 12:23:12 PM, Info: Saving project information...
2/2/2017 12:28:12 PM, Info: Saving project information...
2/2/2017 12:28:12 PM, Info: Saving project information...
2/2/2017 12:28:12 PM, Info: Saving project information...
2/2/2017 12:33:12 PM, Info: Saving project information...
2/2/2017 12:33:12 PM, Info: Saving project information...
2/2/2017 12:33:12 PM, Info: Saving project information...
2/2/2017 12:38:12 PM, Info: Saving project information...
2/2/2017 12:38:12 PM, Info: Saving project information...
2/2/2017 12:38:12 PM, Info: Saving project information...
2/2/2017 12:43:12 PM, Info: Saving project information...
2/2/2017 12:43:12 PM, Info: Saving project information...
2/2/2017 12:43:12 PM, Info: Saving project information...
2/2/2017 12:48:12 PM, Info: Saving project information...
2/2/2017 12:48:12 PM, Info: Saving project information...
2/2/2017 12:48:12 PM, Info: Saving project information...
2/2/2017 12:53:12 PM, Info: Saving project information...
2/2/2017 12:53:12 PM, Info: Saving project information...
2/2/2017 12:53:12 PM, Info: Saving project information...
2/2/2017 12:58:12 PM, Info: Saving project information...
2/2/2017 12:58:12 PM, Info: Saving project information...
2/2/2017 12:58:12 PM, Info: Saving project information...
2/2/2017 1:03:12 PM, Info: Saving project information...
2/2/2017 1:03:12 PM, Info: Saving project information...
2/2/2017 1:03:12 PM, Info: Saving project information...
2/2/2017 1:08:12 PM, Info: Saving project information...
2/2/2017 1:08:12 PM, Info: Saving project information...
2/2/2017 1:08:12 PM, Info: Saving project information...
2/2/2017 1:12:32 PM, Info: Saving project information...
2/2/2017 1:12:32 PM, Info: Saving project information...
2/2/2017 1:12:32 PM, Info: Saving project information...
2/2/2017 1:12:32 PM, Info: Saving project information...
2/2/2017 1:12:32 PM, Info: Saving project information...
2/2/2017 1:12:32 PM, Info: Saving project information...
2/2/2017 1:12:34 PM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
2/2/2017 1:12:35 PM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
2/2/2017 1:12:36 PM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
2/2/2017 1:12:37 PM, Info: Saving project information...
2/2/2017 1:12:49 PM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
2/2/2017 1:12:49 PM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
2/2/2017 1:12:49 PM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
2/2/2017 1:12:51 PM, Info: Saving project information...
2/2/2017 1:19:54 PM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
2/2/2017 1:19:55 PM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
2/2/2017 1:19:55 PM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
2/2/2017 1:19:56 PM, Info: Saving project information...
2/2/2017 2:49:46 PM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
2/2/2017 2:49:47 PM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
2/2/2017 2:49:47 PM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
2/2/2017 2:49:49 PM, Info: Saving project information...
2/2/2017 3:17:34 PM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
2/2/2017 3:17:35 PM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
2/2/2017 3:17:35 PM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
2/2/2017 3:17:36 PM, Info: Saving project information...
2/2/2017 3:35:40 PM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
2/2/2017 3:35:41 PM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
2/2/2017 3:35:41 PM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
2/2/2017 3:35:42 PM, Info: Saving project information...
2/2/2017 4:25:42 PM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
2/2/2017 4:25:43 PM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
2/2/2017 4:25:43 PM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
2/2/2017 4:25:44 PM, Info: Saving project information...
2/2/2017 4:34:32 PM, Info: Terminating SIMPLSharp Services

View File

@@ -0,0 +1,43 @@
2/6/2017 1:06:34 PM, Info: Initializing SIMPLSharp Services...
2/6/2017 1:06:34 PM, Info: ProjectInfo successfully initialized.
2/6/2017 1:10:17 PM, Info: Saving project information...
2/6/2017 1:10:17 PM, Info: Saving project information...
2/6/2017 1:10:17 PM, Info: Saving project information...
2/6/2017 1:10:17 PM, Info: Saving project information...
2/6/2017 1:10:17 PM, Info: Saving project information...
2/6/2017 1:10:17 PM, Info: Saving project information...
2/6/2017 1:10:21 PM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
2/6/2017 1:10:22 PM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
2/6/2017 1:10:22 PM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
2/6/2017 1:10:23 PM, Info: Saving project information...
2/6/2017 1:44:38 PM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
2/6/2017 1:44:38 PM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
2/6/2017 1:44:39 PM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
2/6/2017 1:44:40 PM, Info: Saving project information...
2/6/2017 1:48:23 PM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
2/6/2017 1:48:24 PM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
2/6/2017 1:48:24 PM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
2/6/2017 1:48:25 PM, Info: Saving project information...
2/6/2017 1:48:46 PM, Info: Saving project information...
2/6/2017 1:48:46 PM, Info: Saving project information...
2/6/2017 1:48:46 PM, Info: Saving project information...
2/6/2017 1:48:46 PM, Info: Saving project information...
2/6/2017 1:48:46 PM, Info: Saving project information...
2/6/2017 1:48:46 PM, Info: Saving project information...
2/6/2017 1:48:48 PM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
2/6/2017 1:48:48 PM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
2/6/2017 1:48:48 PM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
2/6/2017 1:48:50 PM, Info: Saving project information...
2/6/2017 1:54:12 PM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
2/6/2017 1:54:13 PM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
2/6/2017 1:54:13 PM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
2/6/2017 1:54:14 PM, Info: Saving project information...
2/6/2017 2:14:07 PM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
2/6/2017 2:14:07 PM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
2/6/2017 2:14:07 PM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
2/6/2017 2:14:09 PM, Info: Saving project information...
2/6/2017 2:19:25 PM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
2/6/2017 2:19:25 PM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
2/6/2017 2:19:26 PM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
2/6/2017 2:19:27 PM, Info: Saving project information...
2/6/2017 2:34:42 PM, Info: Terminating SIMPLSharp Services

View File

@@ -0,0 +1,35 @@
2/6/2017 3:56:15 PM, Info: Initializing SIMPLSharp Services...
2/6/2017 3:56:15 PM, Info: ProjectInfo successfully initialized.
2/6/2017 4:07:50 PM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
2/6/2017 4:07:51 PM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
2/6/2017 4:07:51 PM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
2/6/2017 4:07:53 PM, Info: Saving project information...
2/6/2017 4:41:04 PM, Info: Saving project information...
2/6/2017 4:41:04 PM, Info: Saving project information...
2/6/2017 4:41:04 PM, Info: Saving project information...
2/6/2017 4:46:04 PM, Info: Saving project information...
2/6/2017 4:46:04 PM, Info: Saving project information...
2/6/2017 4:46:04 PM, Info: Saving project information...
2/6/2017 4:51:04 PM, Info: Saving project information...
2/6/2017 4:51:04 PM, Info: Saving project information...
2/6/2017 4:51:04 PM, Info: Saving project information...
2/6/2017 4:56:04 PM, Info: Saving project information...
2/6/2017 4:56:04 PM, Info: Saving project information...
2/6/2017 4:56:04 PM, Info: Saving project information...
2/6/2017 5:01:04 PM, Info: Saving project information...
2/6/2017 5:01:04 PM, Info: Saving project information...
2/6/2017 5:01:04 PM, Info: Saving project information...
2/6/2017 5:06:04 PM, Info: Saving project information...
2/6/2017 5:06:04 PM, Info: Saving project information...
2/6/2017 5:06:04 PM, Info: Saving project information...
2/6/2017 5:10:39 PM, Info: Saving project information...
2/6/2017 5:10:39 PM, Info: Saving project information...
2/6/2017 5:10:39 PM, Info: Saving project information...
2/6/2017 5:10:39 PM, Info: Saving project information...
2/6/2017 5:10:39 PM, Info: Saving project information...
2/6/2017 5:10:39 PM, Info: Saving project information...
2/6/2017 5:10:41 PM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
2/6/2017 5:10:42 PM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
2/6/2017 5:10:43 PM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
2/6/2017 5:10:44 PM, Info: Saving project information...
2/7/2017 8:57:36 AM, Info: Terminating SIMPLSharp Services

View File

@@ -0,0 +1,3 @@
2/7/2017 9:06:38 AM, Info: Initializing SIMPLSharp Services...
2/7/2017 9:06:38 AM, Info: ProjectInfo successfully initialized.
2/7/2017 9:13:18 AM, Info: Terminating SIMPLSharp Services

View File

@@ -0,0 +1,3 @@
2/7/2017 11:56:54 AM, Info: Initializing SIMPLSharp Services...
2/7/2017 11:56:55 AM, Info: ProjectInfo successfully initialized.
2/7/2017 1:28:57 PM, Info: Terminating SIMPLSharp Services

View File

@@ -0,0 +1,11 @@
2/7/2017 3:40:21 PM, Info: Initializing SIMPLSharp Services...
2/7/2017 3:40:21 PM, Info: ProjectInfo successfully initialized.
2/7/2017 5:31:40 PM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
2/7/2017 5:31:41 PM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
2/7/2017 5:31:42 PM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
2/7/2017 5:31:43 PM, Info: Saving project information...
2/7/2017 5:36:38 PM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
2/7/2017 5:36:39 PM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
2/7/2017 5:36:39 PM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
2/7/2017 5:36:40 PM, Info: Saving project information...
2/7/2017 5:39:24 PM, Info: Terminating SIMPLSharp Services

View File

@@ -0,0 +1,7 @@
2/8/2017 9:31:23 AM, Info: Initializing SIMPLSharp Services...
2/8/2017 9:31:23 AM, Info: ProjectInfo successfully initialized.
2/8/2017 9:52:55 AM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
2/8/2017 9:52:57 AM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
2/8/2017 9:52:57 AM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
2/8/2017 9:52:59 AM, Info: Saving project information...
2/8/2017 10:27:42 AM, Info: Terminating SIMPLSharp Services

View File

@@ -0,0 +1,7 @@
2/8/2017 10:41:39 AM, Info: Initializing SIMPLSharp Services...
2/8/2017 10:41:39 AM, Info: ProjectInfo successfully initialized.
2/8/2017 10:41:46 AM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll...
2/8/2017 10:41:47 AM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.dll
2/8/2017 10:41:47 AM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\essentials-ssp\PepperDashEssentials\PepperDashEssentials\bin\PepperDashEssentials.cpz...
2/8/2017 10:41:49 AM, Info: Saving project information...
2/8/2017 10:42:00 AM, Info: Terminating SIMPLSharp Services

View File

@@ -0,0 +1,713 @@
using System;
using System.Collections.Generic;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.SmartObjects;
using PepperDash.Essentials.Core.PageManagers;
namespace PepperDash.Essentials
{
/// <summary>
///
/// </summary>
public class EssentialsHuddlePanelAvFunctionsDriver : PanelDriverBase
{
CrestronTouchpanelPropertiesConfig Config;
public enum UiDisplayMode
{
PresentationMode, AudioSetup
}
//public BoolFeedback SelectASourceVisibleFeedback { get; private set; }
/// <summary>
/// Whether volume ramping from this panel will show the volume
/// gauge popup.
/// </summary>
public bool ShowVolumeGauge { get; set; }
/// <summary>
/// The amount of time that the volume buttons stays on screen, in ms
/// </summary>
public uint VolumeButtonPopupTimeout
{
get { return VolumeButtonsPopupFeedback.TimeoutMs; }
set { VolumeButtonsPopupFeedback.TimeoutMs = value; }
}
/// <summary>
/// The amount of time that the volume gauge stays on screen, in ms
/// </summary>
public uint VolumeGaugePopupTimeout
{
get { return VolumeGaugeFeedback.TimeoutMs; }
set { VolumeGaugeFeedback.TimeoutMs = value; }
}
/// <summary>
///
/// </summary>
public uint PowerOffTimeout { get; set; }
/// <summary>
///
/// </summary>
public string DefaultRoomKey
{
get { return _DefaultRoomKey; }
set
{
_DefaultRoomKey = value;
CurrentRoom = DeviceManager.GetDeviceForKey(value) as EssentialsHuddleSpaceRoom;
}
}
string _DefaultRoomKey;
/// <summary>
///
/// </summary>
public EssentialsHuddleSpaceRoom CurrentRoom
{
get { return _CurrentRoom; }
set
{
SetCurrentRoom(value);
}
}
EssentialsHuddleSpaceRoom _CurrentRoom;
/// <summary>
/// Controls the extended period that the volume gauge shows on-screen,
/// as triggered by Volume up/down operations
/// </summary>
BoolFeedbackPulseExtender VolumeGaugeFeedback;
/// <summary>
/// Controls the period that the volume buttons show on non-hard-button
/// interfaces
/// </summary>
BoolFeedbackPulseExtender VolumeButtonsPopupFeedback;
PanelDriverBase Parent;
List<BoolInputSig> CurrentDisplayModeSigsInUse = new List<BoolInputSig>();
//// Important smart objects
/// <summary>
/// Smart Object 3200
/// </summary>
SubpageReferenceList SourcesSrl;
/// <summary>
/// Smart Object 15022
/// </summary>
SubpageReferenceList ActivityFooterSrl;
/// <summary>
/// Tracks which audio page group the UI is in
/// </summary>
UiDisplayMode CurrentDisplayMode;
/// <summary>
/// The AV page mangagers that have been used, to keep them alive for later
/// </summary>
Dictionary<object, PageManager> PageManagers = new Dictionary<object, PageManager>();
/// <summary>
/// Current page manager running for a source
/// </summary>
PageManager CurrentSourcePageManager;
/// <summary>
/// Will auto-timeout a power off
/// </summary>
CTimer PowerOffTimer;
/// <summary>
/// Constructor
/// </summary>
public EssentialsHuddlePanelAvFunctionsDriver(PanelDriverBase parent, CrestronTouchpanelPropertiesConfig config)
: base(parent.TriList)
{
Config = config;
Parent = parent;
//SelectASourceVisibleFeedback = new BoolFeedback(() =>
// CurrentRoom != null && !CurrentRoom.OnFeedback.BoolValue && this.IsVisible);
//SourcesDynamicList = new SmartObjectDynamicList(
// TriList.SmartObjects[UISmartObjectJoin.SourceList], true, 3200);
SourcesSrl = new SubpageReferenceList(TriList, 3200, 3, 3, 3);
ActivityFooterSrl = new SubpageReferenceList(TriList, 15022, 3, 3, 3);
SetupActivityFooterWhenRoomOff();
ShowVolumeGauge = true;
// One-second pulse extender for volume gauge
VolumeGaugeFeedback = new BoolFeedbackPulseExtender(1500);
VolumeGaugeFeedback.Feedback
.LinkInputSig(TriList.BooleanInput[UIBoolJoin.VolumeGaugePopupVisbible]);
VolumeButtonsPopupFeedback = new BoolFeedbackPulseExtender(4000);
VolumeButtonsPopupFeedback.Feedback
.LinkInputSig(TriList.BooleanInput[UIBoolJoin.VolumeButtonPopupVisbible]);
PowerOffTimeout = 30000;
}
/// <summary>
///
/// </summary>
public override void Show()
{
// We'll want to show the current state of AV, but for now, just show rooms
TriList.BooleanInput[UIBoolJoin.TopBarVisible].BoolValue = true;
TriList.BooleanInput[UIBoolJoin.ActivityFooterVisible].BoolValue = true;
// Default to showing rooms/sources now.
ShowMode(UiDisplayMode.PresentationMode);
// Attach actions
TriList.SetSigFalseAction(UIBoolJoin.VolumeButtonPopupPress, VolumeButtonsTogglePress);
// power-related functions
// Note: some of these are not directly-related to the huddle space UI, but are held over
// in case
TriList.SetSigFalseAction(UIBoolJoin.ShowPowerOffPress, PowerButtonPressed);
TriList.SetSigFalseAction(UIBoolJoin.PowerOffCancelPress, CancelPowerOff);
TriList.SetSigFalseAction(UIBoolJoin.PowerOffConfirmPress, FinishPowerOff);
TriList.SetSigFalseAction(UIBoolJoin.PowerOffMorePress, () =>
{
CancelPowerOffTimer();
TriList.BooleanInput[UIBoolJoin.PowerOffStep1Visible].BoolValue = false;
TriList.BooleanInput[UIBoolJoin.PowerOffStep2Visible].BoolValue = true;
});
TriList.SetSigFalseAction(UIBoolJoin.AllRoomsOffPress, () =>
{
EssentialsHuddleSpaceRoom.AllRoomsOff();
CancelPowerOff();
});
TriList.SetSigFalseAction(UIBoolJoin.DisplayPowerTogglePress, () =>
{
if (CurrentRoom != null && CurrentRoom.DefaultDisplay is IPower)
(CurrentRoom.DefaultDisplay as IPower).PowerToggle();
});
base.Show();
}
public override void Hide()
{
HideAndClearCurrentDisplayModeSigsInUse();
TriList.BooleanInput[UIBoolJoin.TopBarVisible].BoolValue = false;
TriList.BooleanInput[UIBoolJoin.ActivityFooterVisible].BoolValue = false;
VolumeButtonsPopupFeedback.ClearNow();
CancelPowerOff();
base.Hide();
}
/// <summary>
/// Shows the various "modes" that this driver controls. Presentation, Setup page
/// </summary>
/// <param name="mode"></param>
public void ShowMode(UiDisplayMode mode)
{
//Clear whatever is showing now.
HideAndClearCurrentDisplayModeSigsInUse();
CurrentDisplayMode = mode;
switch (mode)
{
case UiDisplayMode.PresentationMode:
CurrentDisplayModeSigsInUse.Add(TriList.BooleanInput[UIBoolJoin.StagingPageVisible]);
// Date/time
if (Config.ShowDate && Config.ShowTime)
{
TriList.BooleanInput[UIBoolJoin.DateAndTimeVisible].BoolValue = true;
TriList.BooleanInput[UIBoolJoin.DateOnlyVisible].BoolValue = false;
TriList.BooleanInput[UIBoolJoin.TimeOnlyVisible].BoolValue = false;
}
else
{
TriList.BooleanInput[UIBoolJoin.DateAndTimeVisible].BoolValue = false;
TriList.BooleanInput[UIBoolJoin.DateOnlyVisible].BoolValue = Config.ShowDate;
TriList.BooleanInput[UIBoolJoin.TimeOnlyVisible].BoolValue = Config.ShowTime;
}
ShowCurrentDisplayModeSigsInUse();
break;
}
}
/// <summary>
/// When the room is off, set the footer SRL
/// </summary>
void SetupActivityFooterWhenRoomOff()
{
ActivityFooterSrl.Clear();
ActivityFooterSrl.AddItem(new SubpageReferenceListActivityItem(1, ActivityFooterSrl, 0, null));
ActivityFooterSrl.Count = 1;
TriList.UShortInput[UIUshortJoin.PresentationListCaretMode].UShortValue = 0;
}
/// <summary>
/// Sets up the footer SRL for when the room is on
/// </summary>
void SetupActivityFooterWhenRoomOn()
{
ActivityFooterSrl.Clear();
ActivityFooterSrl.AddItem(new SubpageReferenceListActivityItem(1, ActivityFooterSrl,
0, null));
ActivityFooterSrl.AddItem(new SubpageReferenceListActivityItem(2, ActivityFooterSrl,
3, b => { if (!b) PowerButtonPressed(); }));
ActivityFooterSrl.Count = 2;
TriList.UShortInput[UIUshortJoin.PresentationListCaretMode].UShortValue = 1;
}
/// <summary>
/// Shows all sigs that are in CurrentDisplayModeSigsInUse
/// </summary>
void ShowCurrentDisplayModeSigsInUse()
{
foreach (var sig in CurrentDisplayModeSigsInUse)
sig.BoolValue = true;
}
/// <summary>
/// Hides all CurrentDisplayModeSigsInUse sigs and clears the array
/// </summary>
void HideAndClearCurrentDisplayModeSigsInUse()
{
foreach (var sig in CurrentDisplayModeSigsInUse)
sig.BoolValue = false;
CurrentDisplayModeSigsInUse.Clear();
}
/// <summary>
/// Send the UI back depending on location, not used in huddle UI
/// </summary>
public override void BackButtonPressed()
{
switch (CurrentDisplayMode)
{
case UiDisplayMode.PresentationMode:
//CancelReturnToSourceTimer();
BackToHome();
break;
}
}
/// <summary>
///
/// </summary>
void BackToHome()
{
Hide();
Parent.Show();
}
/// <summary>
/// Loads the appropriate Sigs into CurrentDisplayModeSigsInUse and shows them
/// </summary>
void ShowCurrentSource()
{
if (CurrentRoom.CurrentSourceInfo == null)
{
#warning When system is "off" show start screen and hide staging.
//var offPm = new DefaultPageManager(UIBoolJoin.SelectSourcePopupVisible, TriList);
//PageManagers["OFF"] = offPm;
//CurrentSourcePageManager = offPm;
//offPm.Show();
return;
}
var uiDev = CurrentRoom.CurrentSourceInfo.SourceDevice as IUiDisplayInfo;
PageManager pm = null;
// If we need a page manager, get an appropriate one
if (uiDev != null)
{
// Got an existing page manager, get it
if (PageManagers.ContainsKey(uiDev))
pm = PageManagers[uiDev];
// Otherwise make an apporiate one
else if (uiDev is ISetTopBoxControls)
//pm = new SetTopBoxMediumPageManager(uiDev as ISetTopBoxControls, TriList);
pm = new SetTopBoxThreePanelPageManager(uiDev as ISetTopBoxControls, TriList);
else if (uiDev is IDiscPlayerControls)
pm = new DiscPlayerMediumPageManager(uiDev as IDiscPlayerControls, TriList);
else
pm = new DefaultPageManager(uiDev, TriList);
PageManagers[uiDev] = pm;
CurrentSourcePageManager = pm;
pm.Show();
}
else // show some default thing
{
CurrentDisplayModeSigsInUse.Add(TriList.BooleanInput[12345]);
}
ShowCurrentDisplayModeSigsInUse();
}
/// <summary>
/// Called from button presses on source, where We can assume we want
/// to change to the proper screen.
/// </summary>
/// <param name="key">The key name of the route to run</param>
void UiSelectSource(string key)
{
// Run the route and when it calls back, show the source
CurrentRoom.RunRouteAction(key, null);
}
/// <summary>
///
/// </summary>
public void PowerButtonPressed()
{
if (!CurrentRoom.OnFeedback.BoolValue)
return;
// Timeout or button 1 press will shut down
var modal = new ModalDialog(TriList);
uint time = 60000;
uint seconds = time / 1000;
var message = string.Format("Meeting will end in {0} seconds", seconds);
modal.PresentModalTimerDialog(2, "End Meeting", "Info", message,
"End Meeting Now", "Cancel", time, true,
but => { if (but != 2) CurrentRoom.RunRouteAction("roomOff"); });
}
void CancelPowerOffTimer()
{
if (PowerOffTimer != null)
{
PowerOffTimer.Stop();
PowerOffTimer = null;
}
}
/// <summary>
/// Runs the power off function on the current room
/// </summary>
public void FinishPowerOff()
{
if (CurrentRoom == null)
return;
CurrentRoom.RunRouteAction("roomOff");
CancelPowerOff();
}
/// <summary>
/// Hides power off pages and stops timer
/// </summary>
void CancelPowerOff()
{
CancelPowerOffTimer();
TriList.BooleanInput[UIBoolJoin.PowerOffStep1Visible].BoolValue = false;
TriList.BooleanInput[UIBoolJoin.PowerOffStep2Visible].BoolValue = false;
}
/// <summary>
///
/// </summary>
void VolumeButtonsTogglePress()
{
if (VolumeButtonsPopupFeedback.BoolValue)
VolumeButtonsPopupFeedback.ClearNow();
else
{
// Trigger the popup
VolumeButtonsPopupFeedback.BoolValue = true;
VolumeButtonsPopupFeedback.BoolValue = false;
}
}
/// <summary>
///
/// </summary>
/// <param name="state"></param>
public void VolumeUpPress(bool state)
{
// extend timeouts
if (ShowVolumeGauge)
VolumeGaugeFeedback.BoolValue = state;
VolumeButtonsPopupFeedback.BoolValue = state;
if (CurrentRoom.CurrentVolumeControls != null)
CurrentRoom.CurrentVolumeControls.VolumeUp(state);
}
/// <summary>
///
/// </summary>
/// <param name="state"></param>
public void VolumeDownPress(bool state)
{
// extend timeouts
if (ShowVolumeGauge)
VolumeGaugeFeedback.BoolValue = state;
VolumeButtonsPopupFeedback.BoolValue = state;
if (CurrentRoom.CurrentVolumeControls != null)
CurrentRoom.CurrentVolumeControls.VolumeDown(state);
}
/// <summary>
/// Helper for property setter. Sets the panel to the given room, latching up all functionality
/// </summary>
void SetCurrentRoom(EssentialsHuddleSpaceRoom room)
{
if (_CurrentRoom == room) return;
if (_CurrentRoom != null)
{
// Disconnect current room
_CurrentRoom.OnFeedback.OutputChange -= _CurrentRoom_OnFeedback_OutputChange;
_CurrentRoom.CurrentVolumeDeviceChange -= this._CurrentRoom_CurrentAudioDeviceChange;
ClearAudioDeviceConnections();
_CurrentRoom.CurrentSourceInfoChange -= this._CurrentRoom_SourceInfoChange;
DisconnectSource(_CurrentRoom.CurrentSourceInfo);
}
_CurrentRoom = room;
if (_CurrentRoom != null)
{
// get the source list config and set up the source list
var config = ConfigReader.ConfigObject.SourceLists;
if (config.ContainsKey(_CurrentRoom.SourceListKey))
{
var srcList = config[_CurrentRoom.SourceListKey];
// Setup sources list
uint i = 1; // counter for UI list
foreach (var kvp in srcList)
{
var srcConfig = kvp.Value;
if (!srcConfig.IncludeInSourceList) // Skip sources marked this way
continue;
var actualSource = DeviceManager.GetDeviceForKey(srcConfig.SourceKey) as Device;
if (actualSource == null)
{
Debug.Console(0, "Cannot assign missing source '{0}' to source UI list",
srcConfig.SourceKey);
continue;
}
//Debug.Console(0, "Adding source '{0}'", srcConfig.SourceKey);
//var s = srcConfig; // assign locals for scope in button lambda
var routeKey = kvp.Key;
var item = new SubpageReferenceListSourceItem(i++, SourcesSrl, srcConfig.PreferredName,
b => { if (!b) UiSelectSource(routeKey); });
SourcesSrl.AddItem(item); // add to the SRL
}
SourcesSrl.Count = (ushort)(i - 1);
}
TriList.StringInput[UIStringJoin.CurrentRoomName].StringValue = _CurrentRoom.Name;
// Link up all the change events from the room
_CurrentRoom.OnFeedback.OutputChange += _CurrentRoom_OnFeedback_OutputChange;
_CurrentRoom.CurrentVolumeDeviceChange += _CurrentRoom_CurrentAudioDeviceChange;
RefreshAudioDeviceConnections();
_CurrentRoom.CurrentSourceInfoChange += _CurrentRoom_SourceInfoChange;
RefreshSourceInfo();
}
else
{
// Clear sigs that need to be
TriList.StringInput[UIStringJoin.CurrentRoomName].StringValue = "Select a room";
}
}
/// <summary>
/// For room on/off changes
/// </summary>
void _CurrentRoom_OnFeedback_OutputChange(object sender, EventArgs e)
{
var value = _CurrentRoom.OnFeedback.BoolValue;
TriList.BooleanInput[UIBoolJoin.RoomIsOn].BoolValue = value;
if (value)
SetupActivityFooterWhenRoomOn();
else
SetupActivityFooterWhenRoomOff();
}
/// <summary>
/// Hides source for provided source info
/// </summary>
/// <param name="previousInfo"></param>
void DisconnectSource(SourceListItem previousInfo)
{
if (previousInfo == null) return;
// Hide whatever is showing
if (IsVisible)
{
if (CurrentSourcePageManager != null)
{
CurrentSourcePageManager.Hide();
CurrentSourcePageManager = null;
}
}
if (previousInfo == null) return;
var previousDev = previousInfo.SourceDevice;
// device type interfaces
if (previousDev is ISetTopBoxControls)
(previousDev as ISetTopBoxControls).UnlinkButtons(TriList);
// common interfaces
if (previousDev is IChannel)
(previousDev as IChannel).UnlinkButtons(TriList);
if (previousDev is IColor)
(previousDev as IColor).UnlinkButtons(TriList);
if (previousDev is IDPad)
(previousDev as IDPad).UnlinkButtons(TriList);
if (previousDev is IDvr)
(previousDev as IDvr).UnlinkButtons(TriList);
if (previousDev is INumericKeypad)
(previousDev as INumericKeypad).UnlinkButtons(TriList);
if (previousDev is IPower)
(previousDev as IPower).UnlinkButtons(TriList);
if (previousDev is ITransport)
(previousDev as ITransport).UnlinkButtons(TriList);
//if (previousDev is IRadio)
// (previousDev as IRadio).UnlinkButtons(this);
}
/// <summary>
/// Refreshes and shows the room's current source
/// </summary>
void RefreshSourceInfo()
{
var routeInfo = CurrentRoom.CurrentSourceInfo;
// This will show off popup too
if (this.IsVisible)
ShowCurrentSource();
if (routeInfo == null || !CurrentRoom.OnFeedback.BoolValue)
{
// Check for power off and insert "Room is off"
TriList.StringInput[UIStringJoin.CurrentSourceName].StringValue = "Room is off";
TriList.StringInput[UIStringJoin.CurrentSourceIcon].StringValue = "Power";
this.Hide();
Parent.Show();
return;
}
else if (CurrentRoom.CurrentSourceInfo != null)
{
TriList.StringInput[UIStringJoin.CurrentSourceName].StringValue = routeInfo.PreferredName;
TriList.StringInput[UIStringJoin.CurrentSourceIcon].StringValue = routeInfo.Icon; // defaults to "blank"
}
else
{
TriList.StringInput[UIStringJoin.CurrentSourceName].StringValue = "---";
TriList.StringInput[UIStringJoin.CurrentSourceIcon].StringValue = "Blank";
}
// Connect controls
if (routeInfo.SourceDevice != null)
ConnectControlDeviceMethods(routeInfo.SourceDevice);
}
/// <summary>
/// Attach the source to the buttons and things
/// </summary>
void ConnectControlDeviceMethods(Device dev)
{
if(dev is ISetTopBoxControls)
(dev as ISetTopBoxControls).LinkButtons(TriList);
if (dev is IChannel)
(dev as IChannel).LinkButtons(TriList);
if (dev is IColor)
(dev as IColor).LinkButtons(TriList);
if (dev is IDPad)
(dev as IDPad).LinkButtons(TriList);
if (dev is IDvr)
(dev as IDvr).LinkButtons(TriList);
if (dev is INumericKeypad)
(dev as INumericKeypad).LinkButtons(TriList);
if (dev is IPower)
(dev as IPower).LinkButtons(TriList);
if (dev is ITransport)
(dev as ITransport).LinkButtons(TriList);
//if (dev is IRadio)
// (dev as IRadio).LinkButtons(this); // +++++++++++++ Make part of this into page manager
//if (dev is ICustomFunctions)
//{
// var custBridge = (dev as ICustomFunctions).GetCustomBridge();
// custBridge.Link(this.Remote);
}
/// <summary>
/// Detaches the buttons and feedback from the room's current audio device
/// </summary>
void ClearAudioDeviceConnections()
{
TriList.ClearBoolSigAction(UIBoolJoin.VolumeUpPress);
TriList.ClearBoolSigAction(UIBoolJoin.VolumeDownPress);
TriList.ClearBoolSigAction(UIBoolJoin.Volume1ProgramMutePressAndFB);
var fDev = CurrentRoom.CurrentVolumeControls as IBasicVolumeWithFeedback;
if (fDev != null)
{
TriList.ClearUShortSigAction(UIUshortJoin.VolumeSlider1Value);
fDev.VolumeLevelFeedback.UnlinkInputSig(
TriList.UShortInput[UIUshortJoin.VolumeSlider1Value]);
}
}
/// <summary>
/// Attaches the buttons and feedback to the room's current audio device
/// </summary>
void RefreshAudioDeviceConnections()
{
var dev = CurrentRoom.CurrentVolumeControls;
if (dev != null) // connect buttons
{
TriList.SetBoolSigAction(UIBoolJoin.VolumeUpPress, VolumeUpPress);
TriList.SetBoolSigAction(UIBoolJoin.VolumeDownPress, VolumeDownPress);
TriList.SetSigFalseAction(UIBoolJoin.Volume1ProgramMutePressAndFB, dev.MuteToggle);
}
var fbDev = dev as IBasicVolumeWithFeedback;
if (fbDev == null) // this should catch both IBasicVolume and IBasicVolumeWithFeeback
TriList.UShortInput[UIUshortJoin.VolumeSlider1Value].UShortValue = 0;
else
{
// slider
TriList.SetUShortSigAction(UIUshortJoin.VolumeSlider1Value, fbDev.SetVolume);
// feedbacks
fbDev.MuteFeedback.LinkInputSig(TriList.BooleanInput[UIBoolJoin.Volume1ProgramMutePressAndFB]);
fbDev.VolumeLevelFeedback.LinkInputSig(
TriList.UShortInput[UIUshortJoin.VolumeSlider1Value]);
}
}
/// <summary>
/// Handler for when the room's volume control device changes
/// </summary>
void _CurrentRoom_CurrentAudioDeviceChange(object sender, VolumeDeviceChangeEventArgs args)
{
if (args.Type == ChangeType.WillChange)
ClearAudioDeviceConnections();
else // did change
RefreshAudioDeviceConnections();
}
/// <summary>
/// Handles source change
/// </summary>
void _CurrentRoom_SourceInfoChange(EssentialsRoomBase room,
SourceListItem info, ChangeType change)
{
if (change == ChangeType.WillChange)
DisconnectSource(info);
else
RefreshSourceInfo();
}
}
}

View File

@@ -0,0 +1,87 @@
using System;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.UI;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.SmartObjects;
namespace PepperDash.Essentials
{
/// <summary>
///
/// </summary>
public class EssentialsPanelMainInterfaceDriver : PanelDriverBase
{
/// <summary>
/// Assign the appropriate A/V driver.
/// Want to keep the AvDriver alive, because it may hold states
/// </summary>
public PanelDriverBase AvDriver { get; set; }
public PanelDriverBase CurrentChildDriver { get; private set; }
CrestronTouchpanelPropertiesConfig Config;
SubpageReferenceList ActivityFooterList;
public EssentialsPanelMainInterfaceDriver(BasicTriListWithSmartObject trilist,
CrestronTouchpanelPropertiesConfig config)
: base(trilist)
{
Config = config;
trilist.SetSigFalseAction(UIBoolJoin.StartPagePress, () => ShowSubDriver(AvDriver));
// Need this?
trilist.SetSigFalseAction(UIBoolJoin.ShowPanelSetupPress, () =>
ShowSubDriver(new SingleSubpageModalAndBackDriver(this, UIBoolJoin.PanelSetupVisible)));
ActivityFooterList = new SubpageReferenceList(trilist, 1234, 3, 3, 3);
}
public override void Show()
{
CurrentChildDriver = null;
if (Config.UsesSplashPage)
TriList.BooleanInput[UIBoolJoin.StartPageVisible].BoolValue = true;
else
ShowSubDriver(AvDriver);
TriList.SetSigFalseAction(UIBoolJoin.HelpButtonPress, () =>
{
var modal = new ModalDialog(TriList);
var room = DeviceManager.GetDeviceForKey(Config.DefaultRoomKey)
as EssentialsHuddleSpaceRoom;
string message = "Sorry, no help message available. No room connected.";
if(room != null)
message = room.Config.HelpMessage;
modal.PresentModalTimerDialog(1, "Help", "Help", message,
"Done", null, 0, false, null);
});
base.Show();
}
public override void Hide()
{
TriList.BooleanInput[UIBoolJoin.StartPageVisible].BoolValue = false;
base.Hide();
}
void ShowSubDriver(PanelDriverBase driver)
{
CurrentChildDriver = driver;
if (driver == null)
return;
this.Hide();
driver.Show();
}
/// <summary>
///
/// </summary>
public override void BackButtonPressed()
{
if(CurrentChildDriver != null)
CurrentChildDriver.BackButtonPressed();
}
}
}

View File

@@ -0,0 +1,709 @@
using System;
using System.Collections.Generic;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.SmartObjects;
using PepperDash.Essentials.Core.PageManagers;
namespace PepperDash.Essentials
{
/// <summary>
///
/// </summary>
public class EssentialsPresentationPanelAvFunctionsDriver : PanelDriverBase
{
CrestronTouchpanelPropertiesConfig Config;
public enum UiDisplayMode
{
AudioSetup, AudioCallMode, PresentationMode
}
/// <summary>
/// Whether volume ramping from this panel will show the volume
/// gauge popup.
/// </summary>
public bool ShowVolumeGauge { get; set; }
/// <summary>
/// The amount of time that the volume buttons stays on screen, in ms
/// </summary>
public uint VolumeButtonPopupTimeout
{
get { return VolumeButtonsPopupFeedback.TimeoutMs; }
set { VolumeButtonsPopupFeedback.TimeoutMs = value; }
}
/// <summary>
/// The amount of time that the volume gauge stays on screen, in ms
/// </summary>
public uint VolumeGaugePopupTimeout
{
get { return VolumeGaugeFeedback.TimeoutMs; }
set { VolumeGaugeFeedback.TimeoutMs = value; }
}
/// <summary>
///
/// </summary>
public uint PowerOffTimeout { get; set; }
/// <summary>
///
/// </summary>
public string DefaultRoomKey
{
get { return _DefaultRoomKey; }
set
{
_DefaultRoomKey = value;
CurrentRoom = DeviceManager.GetDeviceForKey(value) as EssentialsPresentationRoom;
}
}
string _DefaultRoomKey;
/// <summary>
///
/// </summary>
public EssentialsPresentationRoom CurrentRoom
{
get { return _CurrentRoom; }
set
{
SetCurrentRoom(value);
}
}
EssentialsPresentationRoom _CurrentRoom;
/// <summary>
/// Controls the extended period that the volume gauge shows on-screen,
/// as triggered by Volume up/down operations
/// </summary>
BoolFeedbackPulseExtender VolumeGaugeFeedback;
/// <summary>
/// Controls the period that the volume buttons show on non-hard-button
/// interfaces
/// </summary>
BoolFeedbackPulseExtender VolumeButtonsPopupFeedback;
PanelDriverBase Parent;
List<BoolInputSig> CurrentDisplayModeSigsInUse = new List<BoolInputSig>();
//// Important smart objects
/// <summary>
/// Smart Object 3200
/// </summary>
SubpageReferenceList SourcesSrl;
/// <summary>
/// Smart Object 15022
/// </summary>
SubpageReferenceList ActivityFooterSrl;
/// <summary>
/// Tracks which audio page group the UI is in
/// </summary>
UiDisplayMode CurrentDisplayMode;
/// <summary>
/// The AV page mangagers that have been used, to keep them alive for later
/// </summary>
Dictionary<object, PageManager> PageManagers = new Dictionary<object, PageManager>();
/// <summary>
/// Current page manager running for a source
/// </summary>
PageManager CurrentSourcePageManager;
/// <summary>
/// Will auto-timeout a power off
/// </summary>
CTimer PowerOffTimer;
/// <summary>
/// Constructor
/// </summary>
public EssentialsPresentationPanelAvFunctionsDriver(PanelDriverBase parent, CrestronTouchpanelPropertiesConfig config)
: base(parent.TriList)
{
Config = config;
Parent = parent;
SourcesSrl = new SubpageReferenceList(TriList, 3200, 3, 3, 3);
ActivityFooterSrl = new SubpageReferenceList(TriList, 15022, 3, 3, 3);
SetupActivityFooterWhenRoomOff();
ShowVolumeGauge = true;
// One-second pulse extender for volume gauge
VolumeGaugeFeedback = new BoolFeedbackPulseExtender(1500);
VolumeGaugeFeedback.Feedback
.LinkInputSig(TriList.BooleanInput[UIBoolJoin.VolumeGaugePopupVisbible]);
VolumeButtonsPopupFeedback = new BoolFeedbackPulseExtender(4000);
VolumeButtonsPopupFeedback.Feedback
.LinkInputSig(TriList.BooleanInput[UIBoolJoin.VolumeButtonPopupVisbible]);
PowerOffTimeout = 30000;
}
/// <summary>
///
/// </summary>
public override void Show()
{
// We'll want to show the current state of AV, but for now, just show rooms
TriList.BooleanInput[UIBoolJoin.TopBarVisible].BoolValue = true;
TriList.BooleanInput[UIBoolJoin.ActivityFooterVisible].BoolValue = true;
// Default to showing rooms/sources now.
ShowMode(UiDisplayMode.PresentationMode);
// Attach actions
TriList.SetSigFalseAction(UIBoolJoin.VolumeButtonPopupPress, VolumeButtonsTogglePress);
// power-related functions
// Note: some of these are not directly-related to the huddle space UI, but are held over
// in case
TriList.SetSigFalseAction(UIBoolJoin.ShowPowerOffPress, PowerButtonPressed);
TriList.SetSigFalseAction(UIBoolJoin.PowerOffCancelPress, CancelPowerOff);
TriList.SetSigFalseAction(UIBoolJoin.PowerOffConfirmPress, FinishPowerOff);
TriList.SetSigFalseAction(UIBoolJoin.PowerOffMorePress, () =>
{
CancelPowerOffTimer();
TriList.BooleanInput[UIBoolJoin.PowerOffStep1Visible].BoolValue = false;
TriList.BooleanInput[UIBoolJoin.PowerOffStep2Visible].BoolValue = true;
});
TriList.SetSigFalseAction(UIBoolJoin.AllRoomsOffPress, () =>
{
EssentialsHuddleSpaceRoom.AllRoomsOff();
CancelPowerOff();
});
TriList.SetSigFalseAction(UIBoolJoin.DisplayPowerTogglePress, () =>
{
if (CurrentRoom != null && CurrentRoom.DefaultDisplay is IPower)
(CurrentRoom.DefaultDisplay as IPower).PowerToggle();
});
base.Show();
}
public override void Hide()
{
HideAndClearCurrentDisplayModeSigsInUse();
TriList.BooleanInput[UIBoolJoin.TopBarVisible].BoolValue = false;
TriList.BooleanInput[UIBoolJoin.ActivityFooterVisible].BoolValue = false;
VolumeButtonsPopupFeedback.ClearNow();
CancelPowerOff();
base.Hide();
}
/// <summary>
/// Shows the various "modes" that this driver controls. Presentation, Setup page
/// </summary>
/// <param name="mode"></param>
public void ShowMode(UiDisplayMode mode)
{
//Clear whatever is showing now.
HideAndClearCurrentDisplayModeSigsInUse();
CurrentDisplayMode = mode;
switch (mode)
{
case UiDisplayMode.PresentationMode:
CurrentDisplayModeSigsInUse.Add(TriList.BooleanInput[UIBoolJoin.StagingPageVisible]);
// Date/time
if (Config.ShowDate && Config.ShowTime)
{
TriList.BooleanInput[UIBoolJoin.DateAndTimeVisible].BoolValue = true;
TriList.BooleanInput[UIBoolJoin.DateOnlyVisible].BoolValue = false;
TriList.BooleanInput[UIBoolJoin.TimeOnlyVisible].BoolValue = false;
}
else
{
TriList.BooleanInput[UIBoolJoin.DateAndTimeVisible].BoolValue = false;
TriList.BooleanInput[UIBoolJoin.DateOnlyVisible].BoolValue = Config.ShowDate;
TriList.BooleanInput[UIBoolJoin.TimeOnlyVisible].BoolValue = Config.ShowTime;
}
ShowCurrentDisplayModeSigsInUse();
break;
}
}
/// <summary>
/// When the room is off, set the footer SRL
/// </summary>
void SetupActivityFooterWhenRoomOff()
{
ActivityFooterSrl.Clear();
ActivityFooterSrl.AddItem(new SubpageReferenceListActivityItem(1, ActivityFooterSrl, 0,
b => { if (!b) ShowMode(UiDisplayMode.PresentationMode); }));
ActivityFooterSrl.AddItem(new SubpageReferenceListActivityItem(2, ActivityFooterSrl, 0,
b => { if (!b) ShowMode(UiDisplayMode.AudioCallMode); }));
ActivityFooterSrl.Count = 2;
TriList.UShortInput[UIUshortJoin.PresentationListCaretMode].UShortValue = 1;
}
/// <summary>
/// Sets up the footer SRL for when the room is on
/// </summary>
void SetupActivityFooterWhenRoomOn()
{
ActivityFooterSrl.Clear();
ActivityFooterSrl.AddItem(new SubpageReferenceListActivityItem(1, ActivityFooterSrl, 0,
b => { if (!b) ShowMode(UiDisplayMode.PresentationMode); }));
ActivityFooterSrl.AddItem(new SubpageReferenceListActivityItem(2, ActivityFooterSrl, 0,
b => { if (!b) ShowMode(UiDisplayMode.AudioCallMode); }));
ActivityFooterSrl.AddItem(new SubpageReferenceListActivityItem(3, ActivityFooterSrl,
3, b => { if (!b) PowerButtonPressed(); }));
ActivityFooterSrl.Count = 3;
TriList.UShortInput[UIUshortJoin.PresentationListCaretMode].UShortValue = 2;
}
/// <summary>
/// Shows all sigs that are in CurrentDisplayModeSigsInUse
/// </summary>
void ShowCurrentDisplayModeSigsInUse()
{
foreach (var sig in CurrentDisplayModeSigsInUse)
sig.BoolValue = true;
}
/// <summary>
/// Hides all CurrentDisplayModeSigsInUse sigs and clears the array
/// </summary>
void HideAndClearCurrentDisplayModeSigsInUse()
{
foreach (var sig in CurrentDisplayModeSigsInUse)
sig.BoolValue = false;
CurrentDisplayModeSigsInUse.Clear();
}
/// <summary>
/// Send the UI back depending on location, not used in huddle UI
/// </summary>
public override void BackButtonPressed()
{
switch (CurrentDisplayMode)
{
case UiDisplayMode.PresentationMode:
//CancelReturnToSourceTimer();
BackToHome();
break;
}
}
/// <summary>
///
/// </summary>
void BackToHome()
{
Hide();
Parent.Show();
}
/// <summary>
/// Loads the appropriate Sigs into CurrentDisplayModeSigsInUse and shows them
/// </summary>
void ShowCurrentSource()
{
if (CurrentRoom.CurrentSourceInfo == null)
{
//var offPm = new DefaultPageManager(UIBoolJoin.SelectSourcePopupVisible, TriList);
//PageManagers["OFF"] = offPm;
//CurrentSourcePageManager = offPm;
//offPm.Show();
return;
}
var uiDev = CurrentRoom.CurrentSourceInfo.SourceDevice as IUiDisplayInfo;
PageManager pm = null;
// If we need a page manager, get an appropriate one
if (uiDev != null)
{
// Got an existing page manager, get it
if (PageManagers.ContainsKey(uiDev))
pm = PageManagers[uiDev];
// Otherwise make an apporiate one
else if (uiDev is ISetTopBoxControls)
//pm = new SetTopBoxMediumPageManager(uiDev as ISetTopBoxControls, TriList);
pm = new SetTopBoxThreePanelPageManager(uiDev as ISetTopBoxControls, TriList);
else if (uiDev is IDiscPlayerControls)
pm = new DiscPlayerMediumPageManager(uiDev as IDiscPlayerControls, TriList);
else
pm = new DefaultPageManager(uiDev, TriList);
PageManagers[uiDev] = pm;
CurrentSourcePageManager = pm;
pm.Show();
}
else // show some default thing
{
CurrentDisplayModeSigsInUse.Add(TriList.BooleanInput[12345]);
}
ShowCurrentDisplayModeSigsInUse();
}
/// <summary>
/// Called from button presses on source, where We can assume we want
/// to change to the proper screen.
/// </summary>
/// <param name="key">The key name of the route to run</param>
void UiSelectSource(string key)
{
// Run the route and when it calls back, show the source
CurrentRoom.RunRouteAction(key, null);
}
/// <summary>
///
/// </summary>
public void PowerButtonPressed()
{
if (!CurrentRoom.OnFeedback.BoolValue)
return;
// Timeout or button 1 press will shut down
var modal = new ModalDialog(TriList);
uint time = 60000;
uint seconds = time / 1000;
var message = string.Format("Meeting will end in {0} seconds", seconds);
modal.PresentModalTimerDialog(2, "End Meeting", "Info", message,
"End Meeting Now", "Cancel", time, true,
but => { if (but != 2) CurrentRoom.RunRouteAction("roomOff"); });
}
void CancelPowerOffTimer()
{
if (PowerOffTimer != null)
{
PowerOffTimer.Stop();
PowerOffTimer = null;
}
}
/// <summary>
/// Runs the power off function on the current room
/// </summary>
public void FinishPowerOff()
{
if (CurrentRoom == null)
return;
CurrentRoom.RunRouteAction("roomOff");
CancelPowerOff();
}
/// <summary>
/// Hides power off pages and stops timer
/// </summary>
void CancelPowerOff()
{
CancelPowerOffTimer();
TriList.BooleanInput[UIBoolJoin.PowerOffStep1Visible].BoolValue = false;
TriList.BooleanInput[UIBoolJoin.PowerOffStep2Visible].BoolValue = false;
}
/// <summary>
///
/// </summary>
void VolumeButtonsTogglePress()
{
if (VolumeButtonsPopupFeedback.BoolValue)
VolumeButtonsPopupFeedback.ClearNow();
else
{
// Trigger the popup
VolumeButtonsPopupFeedback.BoolValue = true;
VolumeButtonsPopupFeedback.BoolValue = false;
}
}
/// <summary>
///
/// </summary>
/// <param name="state"></param>
public void VolumeUpPress(bool state)
{
// extend timeouts
if (ShowVolumeGauge)
VolumeGaugeFeedback.BoolValue = state;
VolumeButtonsPopupFeedback.BoolValue = state;
if (CurrentRoom.CurrentVolumeControls != null)
CurrentRoom.CurrentVolumeControls.VolumeUp(state);
}
/// <summary>
///
/// </summary>
/// <param name="state"></param>
public void VolumeDownPress(bool state)
{
// extend timeouts
if (ShowVolumeGauge)
VolumeGaugeFeedback.BoolValue = state;
VolumeButtonsPopupFeedback.BoolValue = state;
if (CurrentRoom.CurrentVolumeControls != null)
CurrentRoom.CurrentVolumeControls.VolumeDown(state);
}
/// <summary>
/// Helper for property setter. Sets the panel to the given room, latching up all functionality
/// </summary>
void SetCurrentRoom(EssentialsPresentationRoom room)
{
if (_CurrentRoom == room) return;
if (_CurrentRoom != null)
{
// Disconnect current room
_CurrentRoom.OnFeedback.OutputChange -= _CurrentRoom_OnFeedback_OutputChange;
_CurrentRoom.CurrentVolumeDeviceChange -= this._CurrentRoom_CurrentAudioDeviceChange;
ClearAudioDeviceConnections();
_CurrentRoom.CurrentSourceInfoChange -= this._CurrentRoom_SourceInfoChange;
DisconnectSource(_CurrentRoom.CurrentSourceInfo);
}
_CurrentRoom = room;
if (_CurrentRoom != null)
{
// get the source list config and set up the source list
var config = ConfigReader.ConfigObject.SourceLists;
if (config.ContainsKey(_CurrentRoom.SourceListKey))
{
var srcList = config[_CurrentRoom.SourceListKey];
// Setup sources list
uint i = 1; // counter for UI list
foreach (var kvp in srcList)
{
var srcConfig = kvp.Value;
if (!srcConfig.IncludeInSourceList) // Skip sources marked this way
continue;
var actualSource = DeviceManager.GetDeviceForKey(srcConfig.SourceKey) as Device;
if (actualSource == null)
{
Debug.Console(0, "Cannot assign missing source '{0}' to source UI list",
srcConfig.SourceKey);
continue;
}
//Debug.Console(0, "Adding source '{0}'", srcConfig.SourceKey);
//var s = srcConfig; // assign locals for scope in button lambda
var routeKey = kvp.Key;
var item = new SubpageReferenceListSourceItem(i++, SourcesSrl, srcConfig.PreferredName,
b => { if (!b) UiSelectSource(routeKey); });
SourcesSrl.AddItem(item); // add to the SRL
}
SourcesSrl.Count = (ushort)(i - 1);
}
TriList.StringInput[UIStringJoin.CurrentRoomName].StringValue = _CurrentRoom.Name;
// Link up all the change events from the room
_CurrentRoom.OnFeedback.OutputChange += _CurrentRoom_OnFeedback_OutputChange;
_CurrentRoom.CurrentVolumeDeviceChange += _CurrentRoom_CurrentAudioDeviceChange;
RefreshAudioDeviceConnections();
_CurrentRoom.CurrentSourceInfoChange += _CurrentRoom_SourceInfoChange;
RefreshSourceInfo();
}
else
{
// Clear sigs that need to be
TriList.StringInput[UIStringJoin.CurrentRoomName].StringValue = "Select a room";
}
}
/// <summary>
/// For room on/off changes
/// </summary>
void _CurrentRoom_OnFeedback_OutputChange(object sender, EventArgs e)
{
var value = _CurrentRoom.OnFeedback.BoolValue;
TriList.BooleanInput[UIBoolJoin.RoomIsOn].BoolValue = value;
if (value)
SetupActivityFooterWhenRoomOn();
else
SetupActivityFooterWhenRoomOff();
}
/// <summary>
/// Hides source for provided source info
/// </summary>
/// <param name="previousInfo"></param>
void DisconnectSource(SourceListItem previousInfo)
{
if (previousInfo == null) return;
// Hide whatever is showing
if (IsVisible)
{
if (CurrentSourcePageManager != null)
{
CurrentSourcePageManager.Hide();
CurrentSourcePageManager = null;
}
}
if (previousInfo == null) return;
var previousDev = previousInfo.SourceDevice;
// device type interfaces
if (previousDev is ISetTopBoxControls)
(previousDev as ISetTopBoxControls).UnlinkButtons(TriList);
// common interfaces
if (previousDev is IChannel)
(previousDev as IChannel).UnlinkButtons(TriList);
if (previousDev is IColor)
(previousDev as IColor).UnlinkButtons(TriList);
if (previousDev is IDPad)
(previousDev as IDPad).UnlinkButtons(TriList);
if (previousDev is IDvr)
(previousDev as IDvr).UnlinkButtons(TriList);
if (previousDev is INumericKeypad)
(previousDev as INumericKeypad).UnlinkButtons(TriList);
if (previousDev is IPower)
(previousDev as IPower).UnlinkButtons(TriList);
if (previousDev is ITransport)
(previousDev as ITransport).UnlinkButtons(TriList);
//if (previousDev is IRadio)
// (previousDev as IRadio).UnlinkButtons(this);
}
/// <summary>
/// Refreshes and shows the room's current source
/// </summary>
void RefreshSourceInfo()
{
var routeInfo = CurrentRoom.CurrentSourceInfo;
// This will show off popup too
if (this.IsVisible)
ShowCurrentSource();
if (routeInfo == null || !CurrentRoom.OnFeedback.BoolValue)
{
// Check for power off and insert "Room is off"
TriList.StringInput[UIStringJoin.CurrentSourceName].StringValue = "Room is off";
TriList.StringInput[UIStringJoin.CurrentSourceIcon].StringValue = "Power";
this.Hide();
Parent.Show();
return;
}
else if (CurrentRoom.CurrentSourceInfo != null)
{
TriList.StringInput[UIStringJoin.CurrentSourceName].StringValue = routeInfo.PreferredName;
TriList.StringInput[UIStringJoin.CurrentSourceIcon].StringValue = routeInfo.Icon; // defaults to "blank"
}
else
{
TriList.StringInput[UIStringJoin.CurrentSourceName].StringValue = "---";
TriList.StringInput[UIStringJoin.CurrentSourceIcon].StringValue = "Blank";
}
// Connect controls
if (routeInfo.SourceDevice != null)
ConnectControlDeviceMethods(routeInfo.SourceDevice);
}
/// <summary>
/// Attach the source to the buttons and things
/// </summary>
void ConnectControlDeviceMethods(Device dev)
{
if(dev is ISetTopBoxControls)
(dev as ISetTopBoxControls).LinkButtons(TriList);
if (dev is IChannel)
(dev as IChannel).LinkButtons(TriList);
if (dev is IColor)
(dev as IColor).LinkButtons(TriList);
if (dev is IDPad)
(dev as IDPad).LinkButtons(TriList);
if (dev is IDvr)
(dev as IDvr).LinkButtons(TriList);
if (dev is INumericKeypad)
(dev as INumericKeypad).LinkButtons(TriList);
if (dev is IPower)
(dev as IPower).LinkButtons(TriList);
if (dev is ITransport)
(dev as ITransport).LinkButtons(TriList);
//if (dev is IRadio)
// (dev as IRadio).LinkButtons(this); // +++++++++++++ Make part of this into page manager
//if (dev is ICustomFunctions)
//{
// var custBridge = (dev as ICustomFunctions).GetCustomBridge();
// custBridge.Link(this.Remote);
}
/// <summary>
/// Detaches the buttons and feedback from the room's current audio device
/// </summary>
void ClearAudioDeviceConnections()
{
TriList.ClearBoolSigAction(UIBoolJoin.VolumeUpPress);
TriList.ClearBoolSigAction(UIBoolJoin.VolumeDownPress);
TriList.ClearBoolSigAction(UIBoolJoin.Volume1ProgramMutePressAndFB);
var fDev = CurrentRoom.CurrentVolumeControls as IBasicVolumeWithFeedback;
if (fDev != null)
{
TriList.ClearUShortSigAction(UIUshortJoin.VolumeSlider1Value);
fDev.VolumeLevelFeedback.UnlinkInputSig(
TriList.UShortInput[UIUshortJoin.VolumeSlider1Value]);
}
}
/// <summary>
/// Attaches the buttons and feedback to the room's current audio device
/// </summary>
void RefreshAudioDeviceConnections()
{
var dev = CurrentRoom.CurrentVolumeControls;
if (dev != null) // connect buttons
{
TriList.SetBoolSigAction(UIBoolJoin.VolumeUpPress, VolumeUpPress);
TriList.SetBoolSigAction(UIBoolJoin.VolumeDownPress, VolumeDownPress);
TriList.SetSigFalseAction(UIBoolJoin.Volume1ProgramMutePressAndFB, dev.MuteToggle);
}
var fbDev = dev as IBasicVolumeWithFeedback;
if (fbDev == null) // this should catch both IBasicVolume and IBasicVolumeWithFeeback
TriList.UShortInput[UIUshortJoin.VolumeSlider1Value].UShortValue = 0;
else
{
// slider
TriList.SetUShortSigAction(UIUshortJoin.VolumeSlider1Value, fbDev.SetVolume);
// feedbacks
fbDev.MuteFeedback.LinkInputSig(TriList.BooleanInput[UIBoolJoin.Volume1ProgramMutePressAndFB]);
fbDev.VolumeLevelFeedback.LinkInputSig(
TriList.UShortInput[UIUshortJoin.VolumeSlider1Value]);
}
}
/// <summary>
/// Handler for when the room's volume control device changes
/// </summary>
void _CurrentRoom_CurrentAudioDeviceChange(object sender, VolumeDeviceChangeEventArgs args)
{
if (args.Type == ChangeType.WillChange)
ClearAudioDeviceConnections();
else // did change
RefreshAudioDeviceConnections();
}
/// <summary>
/// Handles source change
/// </summary>
void _CurrentRoom_SourceInfoChange(EssentialsRoomBase room,
SourceListItem info, ChangeType change)
{
if (change == ChangeType.WillChange)
DisconnectSource(info);
else
RefreshSourceInfo();
}
}
}

View File

@@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.UI;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.SmartObjects;
namespace PepperDash.Essentials
{
/// <summary>
/// Very basic show/hide manager for weather page. Basic functionality is useful on any
/// size of interface
/// </summary>
public class SingleSubpageModalAndBackDriver : PanelDriverBase
{
BoolInputSig SubpageSig;
PanelDriverBase Parent;
public SingleSubpageModalAndBackDriver(PanelDriverBase parent, uint subpageJoin) : base(parent.TriList)
{
Parent = parent;
SubpageSig = Parent.TriList.BooleanInput[subpageJoin];
}
/// <summary>
/// This shows the driver.
/// Not sure I like this approach. Hides this and shows it's parent. Not really a navigation-stack type thing.
/// The parent is always the home page driver
/// </summary>
public override void Show()
{
SubpageSig.BoolValue = true;
base.Show();
}
public override void Hide()
{
SubpageSig.BoolValue = false;
base.Hide();
}
public override void BackButtonPressed()
{
Hide();
Parent.Show();
}
}
}

View File

@@ -0,0 +1,94 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.SmartObjects;
namespace PepperDash.Essentials
{
public class SmartObjectRoomsList : SmartObjectDynamicList
{
public uint StatusSigOffset { get; private set; }
List<SmartObjectRoomsListItem> Items;
public SmartObjectRoomsList(SmartObject so, uint nameSigOffset, uint statusSigOffset)
: base(so, true, nameSigOffset)
{
StatusSigOffset = statusSigOffset;
Items = new List<SmartObjectRoomsListItem>();
}
public void AddRoomItem(SmartObjectRoomsListItem item)
{
Items.Add(item);
}
public void SetItemStatusText(uint index, string text)
{
if (index > MaxCount) return;
// The list item template defines CIPS tags that refer to standard joins
(SmartObject.Device as BasicTriList).StringInput[StatusSigOffset + index].StringValue = text;
}
/// <summary>
/// Sets feedback for the given room
/// </summary>
public void SetFeedbackForRoom(EssentialsHuddleSpaceRoom room)
{
var itemToSet = Items.FirstOrDefault(i => i.Room == room);
if (itemToSet != null)
SetFeedback(itemToSet.Index, true);
}
}
public class SmartObjectRoomsListItem
{
public EssentialsHuddleSpaceRoom Room { get; private set; }
SmartObjectRoomsList Parent;
public uint Index { get; private set; }
public SmartObjectRoomsListItem(EssentialsHuddleSpaceRoom room, uint index, SmartObjectRoomsList parent,
Action<bool> buttonAction)
{
Room = room;
Parent = parent;
Index = index;
if (room == null) return;
// Set "now" states
parent.SetItemMainText(index, room.Name);
UpdateItem(room.CurrentSourceInfo);
// Watch for later changes
room.CurrentSourceInfoChange += new SourceInfoChangeHandler(room_CurrentSourceInfoChange);
parent.SetItemButtonAction(index, buttonAction);
}
void room_CurrentSourceInfoChange(EssentialsRoomBase room, SourceListItem info, ChangeType type)
{
UpdateItem(info);
}
/// <summary>
/// Helper to handle source events and startup syncing with room's current source
/// </summary>
/// <param name="info"></param>
void UpdateItem(SourceListItem info)
{
if (info == null || info.Type == eSourceListItemType.Off)
{
Parent.SetItemStatusText(Index, "");
Parent.SetItemIcon(Index, "Blank");
}
else
{
Parent.SetItemStatusText(Index, info.PreferredName);
Parent.SetItemIcon(Index, info.AltIcon);
}
}
}
}

View File

@@ -0,0 +1,143 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
namespace PepperDash.Essentials
{
public class UISmartObjectJoin
{
public const uint StagingListSRL = 3200;
public const uint ActivityFooterSRL = 15022;
}
/// <summary>
///
/// </summary>
public class UIBoolJoin
{
public const uint VolumeUpPress = 901;
public const uint VolumeDownPress = 902;
//public const uint MuteTogglePress = 3813;
//public const uint MutedFeedback = 3813;
// **********************************************************
// REVISE THESE WITH JOSHUA 3800's
public const uint VolumeSingleMute1Visible = 3811;
public const uint VolumeSlider1Press = 3812;
public const uint Volume1ProgramMutePressAndFB = 3813;
public const uint VolumeDualMute1Visible = 3871;
public const uint Volume1SpeechMutePressAndFB = 3874;
public const uint Volume1BackerVisibility = 3875;
public const uint Volume2Visible = 3821;
public const uint VolumeSlider2Press = 3822;
public const uint Volume2MutePressAndFB = 3823;
public const uint Volume3Visible = 3831;
public const uint VolumeSlider3Press = 3832;
public const uint Volume3MutePressAndFB = 3833;
public const uint Volume4Visible = 3841;
public const uint VolumeSlider4Press = 3842;
public const uint Volume4MutePressAndFB = 3843;
public const uint Volume5Visible = 3851;
public const uint VolumeSlider5Press = 3852;
public const uint Volume5MutePressAndFB = 3853;
public const uint Volume6Visible = 3861;
public const uint VolumeSlider6Press = 3862;
public const uint Volume6MutePressAndFB = 3863;
public const uint VolumesPageVisible = 3870;
// **********************************************************
public const uint GenericModalVisible = 3999;
public const uint AvNoControlsSubVisible = 12345;
public const uint HomeVisible = 15001;
/// <summary>
/// Shows the start page in the source controls area of the screen
/// </summary>
public const uint StartPageVisible = 15002;
public const uint StartPagePress = 15003; // REMOVE -------------------------------------------------
public const uint RoomIsOn = 15004;
//public const uint SelectSourcePopupVisible = 15005;
/// <summary>
/// Shows always-on volume control subpage with only audio mute
/// </summary>
public const uint VolumeControlsSingleMuteVisible = 15005;
/// <summary>
/// Shows always-on volume control subpage with mic and audio mutes
/// </summary>
public const uint VolumeControlsDualMuteVisible = 15006;
public const uint ShowPanelSetupPress = 15010;
public const uint TopBarVisible = 15011;
public const uint StagingPageVisible = 15012;
public const uint PowerOffStep1Visible = 15013;
public const uint PowerOffStep2Visible = 15014;
public const uint ShowPowerOffPress = 15015;
public const uint PowerOffMorePress = 15016;
public const uint StagingPageAdditionalArrowsVisible = 15017;
public const uint PanelSetupVisible = 15020;
public const uint SourceWaitOverlayVisible = 15021;
public const uint ActivityFooterVisible = 15022;
public const uint LightsHeaderButtonVisible = 15023;
public const uint CallRightHeaderButtonVisible = 15024;
public const uint CallLeftHeaderButtonVisible = 15025;
public const uint LightsHeaderButtonPress = 15026;
public const uint CallHeaderButtonPress = 15027;
public const uint GearHeaderButtonPress = 15028;
public const uint RoomHeaderButtonPress = 15029;
// 15030
public const uint AllRoomsOffPress = 15031;
public const uint DisplayPowerTogglePress = 15032;
public const uint PowerOffCancelPress = 15033;
public const uint PowerOffConfirmPress = 15034;
public const uint VolumeButtonPopupPress = 15035;
public const uint VolumeButtonPopupVisbible = 15035;
public const uint VolumeGaugePopupVisbible = 15036;
public const uint CallStatusPageVisible = 15040;
public const uint LightsPageVisbible = 15041;
public const uint HelpButtonPress = 15087;
public const uint DateOnlyVisible = 15088;
public const uint TimeOnlyVisible = 15089;
public const uint DateAndTimeVisible = 15090;
public const uint SetupFullDistrib = 15091;
}
/// <summary>
///
/// </summary>
public class UIUshortJoin
{
//public const uint VolumeLevel = 3812;
public const uint VolumeSlider1Value = 3812;
public const uint VolumeSlider2Value = 3822;
public const uint VolumeSlider3Value = 3832;
public const uint VolumeSlider4Value = 3842;
public const uint VolumeSlider5Value = 3852;
public const uint VolumeSlider6Value = 3862;
public const uint PresentationListCaretMode = 3922;
}
/// <summary>
///
/// </summary>
public class UIStringJoin
{
public const uint AdvancedVolumeSlider1Text = 3812;
public const uint AdvancedVolumeSlider2Text = 3822;
public const uint AdvancedVolumeSlider3Text = 3832;
public const uint AdvancedVolumeSlider4Text = 3842;
public const uint AdvancedVolumeSlider5Text = 3852;
public const uint AdvancedVolumeSlider6Text = 3862;
public const uint CurrentRoomName = 3901;
public const uint CurrentSourceName = 3902;
public const uint CurrentSourceIcon = 3903;
public const uint PowerOffMessage = 3911;
}
}

View File

@@ -0,0 +1,135 @@
using System;
using System.Collections.Generic;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials
{
public enum eAvSubpageType
{
NoControls,
PowerOff,
SetupFullDistributed,
SourceWaitOverlay,
TopBar,
VolumePopup,
ZoneSource
}
public enum eAvSourceSubpageType
{
AppleTv,
Radio,
Roku
}
public enum eCommonSubpageType
{
GenericModal,
Home,
PanelSetup,
Weather
}
public enum eAvSmartObjects
{
RoomList,
SourceList
}
public enum eCommonSmartObjects
{
HomePageList
}
/// <summary>
///
/// </summary>
public abstract class PanelDriverBase// : IBasicTriListWithSmartObject
{
/// <summary>
///
/// </summary>
public bool IsVisible { get; private set; }
/// <summary>
/// Makes sure you call this.
/// Sets IsVisible and attaches back/home buttons to BackButtonPressed
/// </summary>
public virtual void Show()
{
IsVisible = true;
TriList.SetSigFalseAction(15002, BackButtonPressed);
}
/// <summary>
/// Only sets IsVisible
/// </summary>
public virtual void Hide()
{
IsVisible = false;
}
/// <summary>
/// Override with specific back button behavior. Default is empty
/// </summary>
public virtual void BackButtonPressed()
{
}
public PanelDriverBase(Crestron.SimplSharpPro.DeviceSupport.BasicTriListWithSmartObject triList)
{
TriList = triList;
}
#region IBasicTriListWithSmartObject Members
/// <summary>
///
/// </summary>
public void AddSmartObjectHelper(uint id, object controller)
{
SmartObjectControllers.Add(id, controller);
}
/// <summary>
///
/// </summary>
public void RemoveSmartObjectHelper(uint id)
{
SmartObjectControllers.Remove(id);
}
Dictionary<uint, object> SmartObjectControllers = new Dictionary<uint, object>();
/// <summary>
/// The trilist object for the Crestron TP device
/// </summary>
public Crestron.SimplSharpPro.DeviceSupport.BasicTriListWithSmartObject TriList { get; private set; }
/// <summary>
///
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public bool ContainsSmartObjectHelper(uint id)
{
return SmartObjectControllers.ContainsKey(id);
}
/// <summary>
///
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public object GetSmartObjectHelper(uint id)
{
if (SmartObjectControllers.ContainsKey(id))
return SmartObjectControllers[id];
else
return null;
}
#endregion
}
}

View File

@@ -0,0 +1,15 @@
namespace PepperDash.Essentials
{
public class CrestronTouchpanelPropertiesConfig
{
public string IpId { get; set; }
public string DefaultRoomKey { get; set; }
public string RoomListKey { get; set; }
public string SgdFile { get; set; }
public string ProjectName { get; set; }
public bool ShowVolumeGauge { get; set; }
public bool UsesSplashPage { get; set; }
public bool ShowDate { get; set; }
public bool ShowTime { get; set; }
}
}

View File

@@ -0,0 +1,197 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.UI;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.PageManagers;
namespace PepperDash.Essentials
{
public class EssentialsTouchpanelController : Device
{
public BasicTriListWithSmartObject Panel { get; private set; }
public PanelDriverBase PanelDriver { get; private set; }
CTimer BacklightTransitionedOnTimer;
public EssentialsTouchpanelController(string key, string name, Tswx52ButtonVoiceControl tsw,
string projectName, string sgdPath)
: base(key, name)
{
Panel = tsw;
tsw.LoadSmartObjects(sgdPath);
tsw.SigChange += new Crestron.SimplSharpPro.DeviceSupport.SigEventHandler(Tsw_SigChange);
}
/// <summary>
/// Config constructor
/// </summary>
public EssentialsTouchpanelController(string key, string name, string type, CrestronTouchpanelPropertiesConfig props, uint id)
: base(key, name)
{
AddPostActivationAction(() =>
{
Debug.Console(2, this, "post-activation linking");
type = type.ToLower();
try
{
if (type == "crestronapp")
{
var app = new CrestronApp(id, Global.ControlSystem);
app.ParameterProjectName.Value = props.ProjectName;
Panel = app;
}
else if (type == "tsw752")
Panel = new Tsw752(id, Global.ControlSystem);
else if (type == "tsw1052")
Panel = new Tsw1052(id, Global.ControlSystem);
else
{
Debug.Console(0, this, "WARNING: Cannot create TSW controller with type '{0}'", type);
return;
}
}
catch (Exception e)
{
Debug.Console(0, this, "WARNING: Cannot create TSW base class. Panel will not function: {0}", e.Message);
return;
}
// Reserved sigs
if (Panel is TswFt5ButtonSystem)
{
var tsw = Panel as TswFt5ButtonSystem;
tsw.ExtenderSystemReservedSigs.Use();
tsw.ExtenderSystemReservedSigs.DeviceExtenderSigChange
+= ExtenderSystemReservedSigs_DeviceExtenderSigChange;
}
new CTimer(o =>
{
var regSuccess = Panel.Register();
if (regSuccess != eDeviceRegistrationUnRegistrationResponse.Success)
Debug.Console(0, this, "WARNING: Registration failed. Continuing, but panel may not function: {0}", regSuccess);
// Give up cleanly if SGD is not present.
var sgdName = @"\NVRAM\Program" + InitialParametersClass.ApplicationNumber
+ @"\sgd\" + props.SgdFile;
if (!File.Exists(sgdName))
{
Debug.Console(0, this, "WARNING: Smart object file '{0}' not present. Exiting TSW load", sgdName);
return;
}
Panel.LoadSmartObjects(sgdName);
Panel.SigChange += Tsw_SigChange;
var mainDriver = new EssentialsPanelMainInterfaceDriver(Panel, props);
// Then the AV driver
// spin up different room drivers depending on room type
var room = DeviceManager.GetDeviceForKey(props.DefaultRoomKey);
if (room is EssentialsHuddleSpaceRoom)
{
var avDriver = new EssentialsHuddlePanelAvFunctionsDriver(mainDriver, props);
avDriver.CurrentRoom = DeviceManager.GetDeviceForKey(props.DefaultRoomKey)
as EssentialsHuddleSpaceRoom;
avDriver.DefaultRoomKey = props.DefaultRoomKey;
mainDriver.AvDriver = avDriver;
LoadAndShowDriver(mainDriver); // This is a little convoluted.
if (Panel is TswFt5ButtonSystem)
{
var tsw = Panel as TswFt5ButtonSystem;
// Wire up hard keys
tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.PowerButtonPressed(); });
tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress);
tsw.ButtonStateChange += new ButtonEventHandler(Tsw_ButtonStateChange);
}
}
else if (room is EssentialsPresentationRoom)
{
var avDriver = new EssentialsPresentationPanelAvFunctionsDriver(mainDriver, props);
avDriver.CurrentRoom = DeviceManager.GetDeviceForKey(props.DefaultRoomKey)
as EssentialsPresentationRoom;
avDriver.DefaultRoomKey = props.DefaultRoomKey;
mainDriver.AvDriver = avDriver;
LoadAndShowDriver(mainDriver);
if (Panel is TswFt5ButtonSystem)
{
var tsw = Panel as TswFt5ButtonSystem;
// Wire up hard keys
tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.PowerButtonPressed(); });
tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress);
tsw.ButtonStateChange += new ButtonEventHandler(Tsw_ButtonStateChange);
}
}
else
{
Debug.Console(0, this, "ERROR: Cannot load AvFunctionsDriver for room '{0}'", props.DefaultRoomKey);
}
}, 0);
});
}
public void LoadAndShowDriver(PanelDriverBase driver)
{
PanelDriver = driver;
driver.Show();
}
void HomePressed()
{
if (BacklightTransitionedOnTimer != null)
Debug.Console(2, this, "Home pressed from dark screen");
else
PanelDriver.BackButtonPressed();
}
void ExtenderSystemReservedSigs_DeviceExtenderSigChange(DeviceExtender currentDeviceExtender, SigEventArgs args)
{
// If the sig is transitioning on, mark it in case it was home button that transitioned it
var blOnSig = (Panel as TswFt5ButtonSystem).ExtenderSystemReservedSigs.BacklightOnFeedback;
if (args.Sig == blOnSig && blOnSig.BoolValue)
{
Debug.Console(2, this, "Backlight transitioning on");
BacklightTransitionedOnTimer = new CTimer(o =>
{
BacklightTransitionedOnTimer = null;
}, 200);
}
}
void Tsw_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
{
if (Debug.Level == 2)
Debug.Console(2, this, "Sig 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);
}
void Tsw_ButtonStateChange(GenericBase device, ButtonEventArgs args)
{
var uo = args.Button.UserObject;
if(uo is Action<bool>)
(uo as Action<bool>)(args.Button.State == eButtonState.Pressed);
}
}
}

View File

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.UI;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials
{
public class SubpageReferenceListActivityItem : SubpageReferenceListItem
{
public SubpageReferenceListActivityItem(uint index, SubpageReferenceList owner,
ushort buttonMode, Action<bool> pressAction)
: base(index, owner)
{
Owner.GetBoolFeedbackSig(Index, 1).UserObject = pressAction;
Owner.UShortInputSig(Index, 1).UShortValue = buttonMode;
}
/// <summary>
/// Called by SRL to release all referenced objects
/// </summary>
public override void Clear()
{
Owner.BoolInputSig(Index, 1).UserObject = null;
Owner.UShortInputSig(Index, 1).UShortValue = 0;
}
}
}

View File

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.UI;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials
{
public class SubpageReferenceListSourceItem : SubpageReferenceListItem
{
public SubpageReferenceListSourceItem(uint index, SubpageReferenceList owner,
string name, Action<bool> routeAction)
: base(index, owner)
{
owner.GetBoolFeedbackSig(index, 1).UserObject = new Action<bool>(routeAction);
owner.StringInputSig(index, 1).StringValue = name;
}
/// <summary>
/// Called by SRL to release all referenced objects
/// </summary>
public override void Clear()
{
Owner.BoolInputSig(Index, 1).UserObject = null;
Owner.StringInputSig(Index, 1).StringValue = "";
}
//public override void Refresh()
//{
//}
}
}

View File

@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="SimplSharpPro" publicKeyToken="1099C178B3B54C3B" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.5.2.1" newVersion="1.5.2.1"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Some files were not shown because too many files have changed in this diff Show More