Commit before switching branches

This commit is contained in:
Neil Dorin
2018-09-20 14:14:59 -06:00
parent c2665f0225
commit d98b7e837a
6 changed files with 26 additions and 31 deletions

View File

@@ -5,6 +5,8 @@ using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.EthernetCommunication;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Devices;
@@ -76,20 +78,24 @@ namespace PepperDash.Essentials.Bridges
}
}
/// <summary>
/// Defines each type and it's matching API type
/// </summary>
public static class DeviceApiFactory
public class EiscApiPropertiesConfig
{
public static Dictionary<Type, Type> TypeMap = new Dictionary<Type, Type>
[JsonProperty("control")]
public EssentialsControlPropertiesConfig Control { get; set; }
[JsonProperty("devices")]
public List<ApiDevice> Devices { get; set; }
public class ApiDevice
{
{ typeof(DmChassisController), typeof(DmChassisControllerApi) },
{ typeof(IBasicCommunication), typeof(IBasicCommunicationApi) }
//{ typeof(SomeShittyDisplayController), typeof(SomeShittyDisplayControllerApi) }
};
[JsonProperty("deviceKey")]
public string DeviceKey { get; set; }
[JsonProperty("joinStart")]
public int JoinStart { get; set; }
}
}
@@ -159,20 +165,6 @@ namespace PepperDash.Essentials.Bridges
public class DmChassisController : Device
{
public DmChassisController(string key)
: base(key)
{
}
public void SetInput(int input)
{
Debug.Console(2, this, "Dm Chassis {0}, input {1}", Key, input);
}
}
/// <summary>
/// Each flavor of API is a static class with static properties and a static constructor that
/// links up the things to do.

View File

@@ -15,9 +15,9 @@ namespace PepperDash.Essentials.Bridges.TEST
/// <summary>
///
/// </summary>
public static class DmChassisControllerTrilistBridgeExtensions
public static class DmChassisControllerApiExtensions
{
public static void LinkMeToTrilist(this PepperDash.Essentials.DM.DmChassisController chassis,
public static void LinkToApi(this PepperDash.Essentials.DM.DmChassisController chassis,
BasicTriList trilist, Dictionary<string,uint> map, uint joinstart)
{
uint joinOffset = joinstart - 1;
@@ -48,7 +48,7 @@ namespace PepperDash.Essentials.Bridges.TEST
/// <summary>
/// For trilists to com sockets only
/// </summary>
public static class IBasicCommunicationTrilistBridgeExtensions
public static class IBasicCommunicationApiExtensions
{
/// <summary>
///
@@ -56,11 +56,12 @@ namespace PepperDash.Essentials.Bridges.TEST
/// <param name="comm"></param>
/// <param name="trilist"></param>
/// <param name="joinStart"></param>
public static void LinkMeToTrilist(this IBasicCommunication comm, BasicTriList trilist, uint joinStart)
public static void LinkToApi(this IBasicCommunication comm, BasicTriList trilist, uint joinStart)
{
// this is a permanent event handler. This cannot be -= from event
comm.TextReceived += (s, a) => trilist.SetString(joinStart, a.Text);
trilist.SetStringSigAction(joinStart, new Action<string>(s => comm.SendText(s)));
var sComm = comm as ISocketStatus;
if (sComm != null)
{

View File

@@ -235,6 +235,8 @@ namespace PepperDash.Essentials
var newDev = DeviceFactory.GetDevice(devConf);
// Then associated library factories
if (newDev == null)
newDev = PepperDash.Essentials.Core.DeviceFactory.GetDevice(devConf);
if (newDev == null)
newDev = PepperDash.Essentials.Devices.Common.DeviceFactory.GetDevice(devConf);
if (newDev == null)