mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-09 01:35:02 +00:00
Added properties and feedbacks debugging; Working on buffering socket on Sammy
This commit is contained in:
@@ -73,7 +73,7 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
CType t = obj.GetType();
|
||||
// get the properties and set them into a new collection of NameType wrappers
|
||||
var props = t.GetProperties().Select(p => new PropertyNameType(p));
|
||||
var props = t.GetProperties().Select(p => new PropertyNameType(p, obj));
|
||||
return JsonConvert.SerializeObject(props, Formatting.Indented);
|
||||
}
|
||||
|
||||
@@ -197,6 +197,27 @@ namespace PepperDash.Essentials.Core
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets a property on an object.
|
||||
/// </summary>
|
||||
/// <param name="deviceObjectPath"></param>
|
||||
/// <returns></returns>
|
||||
public static string SetProperty(string deviceObjectPath)
|
||||
{
|
||||
throw new NotImplementedException("This could be really useful. Finish it please");
|
||||
|
||||
//var obj = FindObjectOnPath(deviceObjectPath);
|
||||
//if (obj == null)
|
||||
// return "{\"error\":\"No object found\"}";
|
||||
|
||||
//CType t = obj.GetType();
|
||||
|
||||
|
||||
//// get the properties and set them into a new collection of NameType wrappers
|
||||
//var props = t.GetProperties().Select(p => new PropertyNameType(p, obj));
|
||||
//return JsonConvert.SerializeObject(props, Formatting.Indented);
|
||||
}
|
||||
}
|
||||
|
||||
public class DeviceActionWrapper
|
||||
@@ -208,14 +229,26 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
public class PropertyNameType
|
||||
{
|
||||
object Parent;
|
||||
|
||||
[JsonIgnore]
|
||||
public PropertyInfo PropInfo { get; private set; }
|
||||
public string Name { get { return PropInfo.Name; } }
|
||||
public string Type { get { return PropInfo.PropertyType.Name; } }
|
||||
public string Value { get {
|
||||
if (PropInfo.CanRead)
|
||||
return PropInfo.GetValue(Parent, null).ToString();
|
||||
else
|
||||
return "-";
|
||||
} }
|
||||
public bool CanRead { get { return PropInfo.CanRead; } }
|
||||
public bool CanWrite { get { return PropInfo.CanWrite; } }
|
||||
|
||||
public PropertyNameType(PropertyInfo info)
|
||||
|
||||
public PropertyNameType(PropertyInfo info, object parent)
|
||||
{
|
||||
PropInfo = info;
|
||||
Parent = parent;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,10 +29,10 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
public static void Initialize(CrestronControlSystem cs)
|
||||
{
|
||||
CrestronConsole.AddNewConsoleCommand(ListDeviceCommands, "devcmdlist", "Lists commands",
|
||||
ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(DoDeviceCommand, "devcmd", "Runs a command on device - key Name value",
|
||||
ConsoleAccessLevelEnum.AccessOperator);
|
||||
//CrestronConsole.AddNewConsoleCommand(ListDeviceCommands, "devcmdlist", "Lists commands",
|
||||
// ConsoleAccessLevelEnum.AccessOperator);
|
||||
//CrestronConsole.AddNewConsoleCommand(DoDeviceCommand, "devcmd", "Runs a command on device - key Name value",
|
||||
// ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(ListDeviceCommStatuses, "devcommstatus", "Lists the communication status of all devices",
|
||||
ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(ListDeviceFeedbacks, "devfb", "Lists current feedbacks",
|
||||
@@ -105,7 +105,6 @@ namespace PepperDash.Essentials.Core
|
||||
Debug.Console(0, "{0} Devices registered with Device Mangager:",Devices.Count);
|
||||
var sorted = Devices.Values.ToList();
|
||||
sorted.Sort((a, b) => a.Key.CompareTo(b.Key));
|
||||
//var devs = Devices.Values.Where(d => d is IKeyed).Select(d => d as IKeyed);
|
||||
|
||||
foreach (var d in sorted)
|
||||
{
|
||||
@@ -131,16 +130,16 @@ namespace PepperDash.Essentials.Core
|
||||
statusDev.DumpFeedbacksToConsole(true);
|
||||
}
|
||||
|
||||
static void ListDeviceCommands(string devKey)
|
||||
{
|
||||
var dev = GetDeviceForKey(devKey);
|
||||
if (dev == null)
|
||||
{
|
||||
Debug.Console(0, "Device '{0}' not found", devKey);
|
||||
return;
|
||||
}
|
||||
Debug.Console(0, "This needs to be reworked. Stay tuned.", devKey);
|
||||
}
|
||||
//static void ListDeviceCommands(string devKey)
|
||||
//{
|
||||
// var dev = GetDeviceForKey(devKey);
|
||||
// if (dev == null)
|
||||
// {
|
||||
// Debug.Console(0, "Device '{0}' not found", devKey);
|
||||
// return;
|
||||
// }
|
||||
// Debug.Console(0, "This needs to be reworked. Stay tuned.", devKey);
|
||||
//}
|
||||
|
||||
static void ListDeviceCommStatuses(string input)
|
||||
{
|
||||
@@ -154,10 +153,10 @@ namespace PepperDash.Essentials.Core
|
||||
}
|
||||
|
||||
|
||||
static void DoDeviceCommand(string command)
|
||||
{
|
||||
Debug.Console(0, "Not yet implemented. Stay tuned");
|
||||
}
|
||||
//static void DoDeviceCommand(string command)
|
||||
//{
|
||||
// Debug.Console(0, "Not yet implemented. Stay tuned");
|
||||
//}
|
||||
|
||||
public static void AddDevice(IKeyed newDev)
|
||||
{
|
||||
@@ -167,7 +166,7 @@ namespace PepperDash.Essentials.Core
|
||||
//if (existingDevice != null)
|
||||
if(Devices.ContainsKey(newDev.Key))
|
||||
{
|
||||
Debug.Console(0, newDev, "A device with this key already exists. Not added to manager");
|
||||
Debug.Console(0, newDev, "WARNING: A device with this key already exists. Not added to manager");
|
||||
return;
|
||||
}
|
||||
Devices.Add(newDev.Key, newDev);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharp.Reflection;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
@@ -21,6 +22,12 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public static void DumpFeedbacksToConsole(this IHasFeedback source, bool getCurrentStates)
|
||||
{
|
||||
CType t = source.GetType();
|
||||
// get the properties and set them into a new collection of NameType wrappers
|
||||
var props = t.GetProperties().Select(p => new PropertyNameType(p, t));
|
||||
|
||||
|
||||
|
||||
var feedbacks = source.Feedbacks.OrderBy(x => x.Type);
|
||||
if (feedbacks != null)
|
||||
{
|
||||
@@ -28,32 +35,27 @@ namespace PepperDash.Essentials.Core
|
||||
foreach (var f in feedbacks)
|
||||
{
|
||||
string val = "";
|
||||
string type = "";
|
||||
if (getCurrentStates)
|
||||
{
|
||||
if (f is BoolFeedback)
|
||||
val = " = " + f.BoolValue;
|
||||
else if(f is IntFeedback)
|
||||
val = " = " + f.IntValue;
|
||||
else if(f is StringFeedback)
|
||||
val = " = " + f.StringValue;
|
||||
|
||||
//switch (f.Type)
|
||||
//{
|
||||
// case eCueType.Bool:
|
||||
// val = " = " + f.BoolValue;
|
||||
// break;
|
||||
// case eCueType.Int:
|
||||
// val = " = " + f.IntValue;
|
||||
// break;
|
||||
// case eCueType.String:
|
||||
// val = " = " + f.StringValue;
|
||||
// break;
|
||||
// //case eOutputType.Other:
|
||||
// // break;
|
||||
//}
|
||||
{
|
||||
val = f.BoolValue.ToString();
|
||||
type = "boolean";
|
||||
}
|
||||
else if (f is IntFeedback)
|
||||
{
|
||||
val = f.IntValue.ToString();
|
||||
type = "integer";
|
||||
}
|
||||
else if (f is StringFeedback)
|
||||
{
|
||||
val = f.StringValue;
|
||||
type = "string";
|
||||
}
|
||||
}
|
||||
Debug.Console(0, "{0,-8} {1}{2}", f.GetType(),
|
||||
(string.IsNullOrEmpty(f.Cue.Name) ? "-none-" : f.Cue.Name), val);
|
||||
Debug.Console(0, "{0,-12} {1, -25} {2}", type,
|
||||
(string.IsNullOrEmpty(f.Cue.Name) ? "-no name-" : f.Cue.Name), val);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -103,6 +103,11 @@ namespace PepperDash.Essentials.Core
|
||||
LinkedComplementInputSigs.Remove(sig);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return BoolValue.ToString();
|
||||
}
|
||||
|
||||
void UpdateSig(BoolInputSig sig)
|
||||
{
|
||||
sig.BoolValue = _BoolValue;
|
||||
@@ -160,6 +165,11 @@ namespace PepperDash.Essentials.Core
|
||||
LinkedInputSigs.Remove(sig);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return IntValue.ToString();
|
||||
}
|
||||
|
||||
void UpdateSig(UShortInputSig sig)
|
||||
{
|
||||
sig.UShortValue = UShortValue;
|
||||
@@ -212,6 +222,11 @@ namespace PepperDash.Essentials.Core
|
||||
LinkedInputSigs.Remove(sig);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return StringValue;
|
||||
}
|
||||
|
||||
void UpdateSig(StringInputSig sig)
|
||||
{
|
||||
sig.StringValue = _StringValue;
|
||||
|
||||
@@ -13,10 +13,17 @@ using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public abstract class StatusMonitorBase : IStatusMonitor
|
||||
public abstract class StatusMonitorBase : IStatusMonitor, IKeyName
|
||||
{
|
||||
public event EventHandler<MonitorStatusChangeEventArgs> StatusChange;
|
||||
|
||||
/// <summary>
|
||||
/// Format returned: "parentdevkey-comMonitor"
|
||||
/// </summary>
|
||||
public string Key { get { return Parent.Key + "-comMonitor"; } }
|
||||
|
||||
public string Name { get { return "Comm. monitor"; } }
|
||||
|
||||
public IKeyed Parent { get; private set; }
|
||||
|
||||
public MonitorStatus Status
|
||||
@@ -102,5 +109,10 @@ namespace PepperDash.Essentials.Core
|
||||
if(ErrorTimer != null)
|
||||
ErrorTimer.Reset(ErrorTime, ErrorTime);
|
||||
}
|
||||
|
||||
public void PrintStatus()
|
||||
{
|
||||
CrestronConsole.PrintLine("Status={0}", Status);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -22,13 +22,6 @@ namespace PepperDash.Essentials.Devices.Displays
|
||||
var properties = dc.Properties;
|
||||
|
||||
var typeName = dc.Type.ToLower();
|
||||
//if (typeName == "dmmd8x8")
|
||||
//{
|
||||
// var props = JsonConvert.DeserializeObject
|
||||
// <PepperDash.Essentials.DM.Config.DMChassisPropertiesConfig>(properties.ToString());
|
||||
// return PepperDash.Essentials.DM.DmChassisController.
|
||||
// GetDmChassisController(key, name, type, props);
|
||||
//}
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace PepperDash.Essentials.Devices.Displays
|
||||
ushort _VolumeLevel;
|
||||
bool _IsMuted;
|
||||
RoutingInputPort _CurrentInputPort;
|
||||
byte[] IncomingBuffer = new byte[]{};
|
||||
//CTimer StatusTimer;
|
||||
|
||||
protected override Func<bool> PowerIsOnFeedbackFunc { get { return () => _PowerIsOn; } }
|
||||
@@ -85,6 +86,7 @@ namespace PepperDash.Essentials.Devices.Displays
|
||||
{
|
||||
WarmupTime = 10000;
|
||||
CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, 30000, 120000, 300000, StatusGet);
|
||||
DeviceManager.AddDevice(CommunicationMonitor);
|
||||
|
||||
AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.Hdmi, new Action(InputHdmi1), this), 0x21);
|
||||
@@ -151,45 +153,75 @@ namespace PepperDash.Essentials.Devices.Displays
|
||||
/// <param name="e"></param>
|
||||
void Communication_BytesReceived(object sender, GenericCommMethodReceiveBytesArgs e)
|
||||
{
|
||||
var b = e.Bytes;
|
||||
Debug.Console(0, this, "Parsing: {0}", ComTextHelper.GetEscapedText(b));
|
||||
if (b[0] == 0xAA && b[1] == 0xFF)
|
||||
Debug.Console(2, this, "Socket in: {0}", ComTextHelper.GetEscapedText(e.Bytes));
|
||||
// This is probably not thread-safe buffering
|
||||
// Append the incoming bytes with whatever is in the buffer
|
||||
var newBytes = new byte[IncomingBuffer.Length + e.Bytes.Length];
|
||||
IncomingBuffer.CopyTo(newBytes, 0);
|
||||
e.Bytes.CopyTo(newBytes, IncomingBuffer.Length);
|
||||
Debug.Console(2, this, "Buffer+new: {0}", ComTextHelper.GetEscapedText(newBytes));
|
||||
|
||||
ADD A while HERE TOMORROW.
|
||||
// If it's at least got the header, then process it,
|
||||
if (newBytes.Length > 4 && newBytes[0] == 0xAA && newBytes[1] == 0xFF)
|
||||
{
|
||||
if (b[4] == 0x41)
|
||||
var msgLen = newBytes[3];
|
||||
// if the buffer is shorter than the header (3) + message (msgLen) + checksum (1),
|
||||
// give and save it for next time
|
||||
if (newBytes.Length < msgLen + 4)
|
||||
{
|
||||
var typeByte = b[5];
|
||||
switch (typeByte)
|
||||
IncomingBuffer = newBytes;
|
||||
return;
|
||||
}
|
||||
|
||||
// Good length, grab the message
|
||||
var message = newBytes.Skip(4).Take(msgLen).ToArray();
|
||||
Debug.Console(0, this, "Parsing: {0}", ComTextHelper.GetEscapedText(message));
|
||||
|
||||
// At this point, the ack/nak is the first byte
|
||||
if (message[0] == 0x41)
|
||||
{
|
||||
switch (message[1]) // type byte
|
||||
{
|
||||
case 0x00: // General status
|
||||
UpdatePowerFB(b[6]);
|
||||
UpdateVolumeFB(b[7]);
|
||||
UpdateMuteFb(b[8]);
|
||||
UpdateInputFb(b[9]);
|
||||
UpdatePowerFB(message[2]);
|
||||
UpdateVolumeFB(message[3]);
|
||||
UpdateMuteFb(message[4]);
|
||||
UpdateInputFb(message[5]);
|
||||
break;
|
||||
|
||||
case 0x11:
|
||||
UpdatePowerFB(b[6]);
|
||||
UpdatePowerFB(message[2]);
|
||||
break;
|
||||
|
||||
case 0x12:
|
||||
UpdateVolumeFB(b[6]);
|
||||
UpdateVolumeFB(message[2]);
|
||||
break;
|
||||
|
||||
|
||||
case 0x13:
|
||||
UpdateMuteFb(b[6]);
|
||||
UpdateMuteFb(message[2]);
|
||||
break;
|
||||
|
||||
case 0x14:
|
||||
UpdateInputFb(b[6]);
|
||||
UpdateInputFb(message[2]);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Skip over what we've used and save the rest for next time
|
||||
IncomingBuffer = newBytes.Skip(5 + msgLen).ToArray();
|
||||
}
|
||||
// there's not even a full header in the event. Save it for next time.
|
||||
else
|
||||
IncomingBuffer = newBytes;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
void UpdatePowerFB(byte b)
|
||||
{
|
||||
var newVal = b == 1;
|
||||
@@ -201,6 +233,10 @@ namespace PepperDash.Essentials.Devices.Displays
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
void UpdateVolumeFB(byte b)
|
||||
{
|
||||
var newVol = (ushort)Scale((double)b, 0, 100, 0, 65535);
|
||||
|
||||
@@ -105,6 +105,7 @@
|
||||
<Compile Include="DSP\BiampTesira\BiampTesiraFortePropertiesConfig.cs" />
|
||||
<Compile Include="DSP\PolycomSoundStructure\SoundStructureBasics.cs" />
|
||||
<Compile Include="Factory\DeviceFactory.cs" />
|
||||
<Compile Include="Generic\GenericSource.cs" />
|
||||
<Compile Include="PC\InRoomPc.cs" />
|
||||
<Compile Include="PC\Laptop.cs" />
|
||||
<Compile Include="SetTopBox\SetTopBoxPropertiesConfig.cs" />
|
||||
|
||||
Binary file not shown.
@@ -36,7 +36,6 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
|
||||
var irCont = IRPortHelper.GetIrOutputPortController(dc);
|
||||
return new AppleTV(key, name, irCont);
|
||||
|
||||
}
|
||||
|
||||
else if (typeName == "basicirdisplay")
|
||||
@@ -46,6 +45,14 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
return new BasicIrDisplay(key, name, ir.Port, ir.FileName);
|
||||
}
|
||||
|
||||
else if (typeName == "biamptesira")
|
||||
{
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
var props = JsonConvert.DeserializeObject<BiampTesiraFortePropertiesConfig>(
|
||||
properties.ToString());
|
||||
return new BiampTesiraForteDsp(key, name, comm, props);
|
||||
}
|
||||
|
||||
else if (typeName == "cenrfgwex")
|
||||
{
|
||||
return CenRfgwController.GetNewExGatewayController(key, name,
|
||||
@@ -58,6 +65,19 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
properties.Value<string>("id"), properties.Value<string>("gatewayType"));
|
||||
}
|
||||
|
||||
else if (groupName == "discplayer") // (typeName == "irbluray")
|
||||
{
|
||||
if (properties["control"]["method"].Value<string>() == "ir")
|
||||
{
|
||||
var irCont = IRPortHelper.GetIrOutputPortController(dc);
|
||||
return new IRBlurayBase(key, name, irCont);
|
||||
}
|
||||
else if (properties["control"]["method"].Value<string>() == "com")
|
||||
{
|
||||
Debug.Console(0, "[{0}] COM Device type not implemented YET!", key);
|
||||
}
|
||||
}
|
||||
|
||||
else if (typeName == "genericaudiooutwithvolume")
|
||||
{
|
||||
var zone = dc.Properties.Value<uint>("zone");
|
||||
@@ -65,63 +85,39 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
dc.Properties.Value<string>("volumeDeviceKey"), zone);
|
||||
}
|
||||
|
||||
else if (groupName == "discplayer") // (typeName == "irbluray")
|
||||
{
|
||||
if (properties["control"]["method"].Value<string>() == "ir")
|
||||
{
|
||||
var irCont = IRPortHelper.GetIrOutputPortController(dc);
|
||||
return new IRBlurayBase(key, name, irCont);
|
||||
else if (groupName == "genericsource")
|
||||
{
|
||||
return new GenericSource(key, name);
|
||||
}
|
||||
|
||||
//var ir = IRPortHelper.GetIrPort(properties);
|
||||
//if (ir != null)
|
||||
// return new IRBlurayBase(key, name, ir.Port, ir.FileName);
|
||||
}
|
||||
else if (properties["control"]["method"].Value<string>() == "com")
|
||||
{
|
||||
Debug.Console(0, "[{0}] COM Device type not implemented YET!", key);
|
||||
}
|
||||
}
|
||||
else if (typeName == "inroompc")
|
||||
{
|
||||
return new InRoomPc(key, name);
|
||||
}
|
||||
|
||||
else if (groupName == "settopbox") //(typeName == "irstbbase")
|
||||
{
|
||||
var irCont = IRPortHelper.GetIrOutputPortController(dc);
|
||||
else if (typeName == "laptop")
|
||||
{
|
||||
return new Laptop(key, name);
|
||||
}
|
||||
|
||||
else if (groupName == "settopbox") //(typeName == "irstbbase")
|
||||
{
|
||||
var irCont = IRPortHelper.GetIrOutputPortController(dc);
|
||||
var config = dc.Properties.ToObject<SetTopBoxPropertiesConfig>();
|
||||
var stb = new IRSetTopBoxBase(key, name, irCont, config);
|
||||
var stb = new IRSetTopBoxBase(key, name, irCont, config);
|
||||
|
||||
//stb.HasDvr = properties.Value<bool>("hasDvr");
|
||||
var listName = properties.Value<string>("presetsList");
|
||||
if (listName != null)
|
||||
stb.LoadPresets(listName);
|
||||
return stb;
|
||||
}
|
||||
//stb.HasDvr = properties.Value<bool>("hasDvr");
|
||||
var listName = properties.Value<string>("presetsList");
|
||||
if (listName != null)
|
||||
stb.LoadPresets(listName);
|
||||
return stb;
|
||||
}
|
||||
|
||||
else if (typeName == "laptop")
|
||||
{
|
||||
return new Laptop(key, name);
|
||||
}
|
||||
|
||||
else if (typeName == "inroompc")
|
||||
{
|
||||
return new InRoomPc(key, name);
|
||||
}
|
||||
|
||||
else if (typeName == "roku")
|
||||
{
|
||||
var irCont = IRPortHelper.GetIrOutputPortController(dc);
|
||||
return new Roku2(key, name, irCont);
|
||||
|
||||
//var ir = IRPortHelper.GetIrPort(properties);
|
||||
//if (ir != null)
|
||||
// return new Roku2(key, name, ir.Port, ir.FileName);
|
||||
}
|
||||
|
||||
else if (typeName == "biamptesira")
|
||||
{
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
var props = JsonConvert.DeserializeObject<BiampTesiraFortePropertiesConfig>(
|
||||
properties.ToString());
|
||||
return new BiampTesiraForteDsp(key, name, comm, props);
|
||||
}
|
||||
else if (typeName == "roku")
|
||||
{
|
||||
var irCont = IRPortHelper.GetIrOutputPortController(dc);
|
||||
return new Roku2(key, name, irCont);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
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.Routing;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common
|
||||
{
|
||||
public class GenericSource : Device, IUiDisplayInfo, IRoutingOutputs
|
||||
{
|
||||
|
||||
public uint DisplayUiType { get { return DisplayUiConstants.TypeNoControls; } }
|
||||
|
||||
public GenericSource(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
|
||||
AnyOut = new RoutingOutputPort(RoutingPortNames.AnyOut, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.Hdmi, null, this);
|
||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort> { AnyOut };
|
||||
}
|
||||
|
||||
#region IRoutingOutputs Members
|
||||
|
||||
public RoutingOutputPort AnyOut { get; private set; }
|
||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,8 @@ namespace PepperDash.Essentials
|
||||
Debug.Console(0, "Using unmerged system/template configs.");
|
||||
try
|
||||
{
|
||||
using (StreamReader fs = new StreamReader(string.Format(@"\NVRAM\program{0}\ConfigurationFile.json", InitialParametersClass.ApplicationNumber)))
|
||||
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>();
|
||||
@@ -60,19 +61,22 @@ namespace PepperDash.Essentials
|
||||
else
|
||||
merged.Add("info", template["info"]);
|
||||
|
||||
merged.Add("devices", MergeArraysOnTopLevelProperty(template["devices"] as JArray, system["devices"] as JArray, "uid"));
|
||||
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"));
|
||||
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
|
||||
// Template tie lines take precdence. Config tool probably can't do them at system
|
||||
// level anyway...
|
||||
if (template["tieLines"] != null)
|
||||
merged.Add("tieLines", template["tieLines"]);
|
||||
else if (system["tieLines"] != null)
|
||||
@@ -80,7 +84,7 @@ namespace PepperDash.Essentials
|
||||
else
|
||||
merged.Add("tieLines", new JArray());
|
||||
|
||||
Debug.Console(0, "MERGED RESULT: \x0d\x0a{0}", merged);
|
||||
//Debug.Console(0, "MERGED RESULT: \x0d\x0a{0}", merged);
|
||||
return merged;
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
1
devjson commands.json
Normal file
1
devjson commands.json
Normal file
@@ -0,0 +1 @@
|
||||
devjson:1 {"deviceKey":"display-1-comMonitor","methodName":"PrintStatus"}
|
||||
Reference in New Issue
Block a user