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.SimplSharp;
using Crestron.SimplSharpPro.EthernetCommunication; using Crestron.SimplSharpPro.EthernetCommunication;
using Newtonsoft.Json;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Devices; using PepperDash.Essentials.Core.Devices;
@@ -76,20 +78,24 @@ namespace PepperDash.Essentials.Bridges
} }
} }
public class EiscApiPropertiesConfig
/// <summary>
/// Defines each type and it's matching API type
/// </summary>
public static class DeviceApiFactory
{ {
public static Dictionary<Type, Type> TypeMap = new Dictionary<Type, Type> [JsonProperty("control")]
public EssentialsControlPropertiesConfig Control { get; set; }
[JsonProperty("devices")]
public List<ApiDevice> Devices { get; set; }
public class ApiDevice
{ {
{ typeof(DmChassisController), typeof(DmChassisControllerApi) }, [JsonProperty("deviceKey")]
{ typeof(IBasicCommunication), typeof(IBasicCommunicationApi) } public string DeviceKey { get; set; }
//{ typeof(SomeShittyDisplayController), typeof(SomeShittyDisplayControllerApi) }
}; [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> /// <summary>
/// Each flavor of API is a static class with static properties and a static constructor that /// Each flavor of API is a static class with static properties and a static constructor that
/// links up the things to do. /// links up the things to do.

View File

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

View File

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