mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 04:34:56 +00:00
87
GlsPartCnTesting_configurationFile_v00.01.json
Normal file
87
GlsPartCnTesting_configurationFile_v00.01.json
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
{
|
||||||
|
"system": {},
|
||||||
|
"system_url": "http://portal-QA.devcloud.pepperdash.com/templates/0f50640b-bc89-42d5-998f-81d137d3fc98#/template_summary",
|
||||||
|
"template": {
|
||||||
|
"devices": [
|
||||||
|
{
|
||||||
|
"key": "processor",
|
||||||
|
"uid": 0,
|
||||||
|
"type": "cp3n",
|
||||||
|
"name": "CP3N",
|
||||||
|
"group": "processor",
|
||||||
|
"supportedConfigModes": [
|
||||||
|
"compliance",
|
||||||
|
"essentials"
|
||||||
|
],
|
||||||
|
"supportedSystemTypes": [
|
||||||
|
"hudType",
|
||||||
|
"presType",
|
||||||
|
"vtcType",
|
||||||
|
"custom"
|
||||||
|
],
|
||||||
|
"supportsCompliance": true,
|
||||||
|
"properties": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "app1-occsensor1",
|
||||||
|
"uid": 1,
|
||||||
|
"type": "glsodtccn",
|
||||||
|
"group": "api",
|
||||||
|
"properties" : {
|
||||||
|
"control": {
|
||||||
|
"cresnetId": "91"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "app1-partitionsensor1",
|
||||||
|
"uid": 1,
|
||||||
|
"type": "glspartcn",
|
||||||
|
"group": "api",
|
||||||
|
"properties" : {
|
||||||
|
"control": {
|
||||||
|
"cresnetId": "90"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "app1-device-bridge",
|
||||||
|
"uid": 3,
|
||||||
|
"name": "Communication Bridge",
|
||||||
|
"group": "api",
|
||||||
|
"type": "eiscApiAdvanced",
|
||||||
|
"properties": {
|
||||||
|
"control": {
|
||||||
|
"tcpSshProperties": {
|
||||||
|
"address": "127.0.0.2",
|
||||||
|
"port": 0
|
||||||
|
},
|
||||||
|
"ipid": "A1",
|
||||||
|
"method": "ipidTcp"
|
||||||
|
},
|
||||||
|
"comment": "genericComm device joinStart is different than plugin device joinStart",
|
||||||
|
"devices": [
|
||||||
|
{
|
||||||
|
"deviceKey": "app1-occsensor1",
|
||||||
|
"joinStart": 201
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"deviceKey": "app1-partitionsensor1",
|
||||||
|
"joinStart": 271
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info": {
|
||||||
|
"comment": "",
|
||||||
|
"lastModifiedDate": "2017-03-06T23:14:40.290Z",
|
||||||
|
"lastUid": 12,
|
||||||
|
"processorType": "Cp3n",
|
||||||
|
"requiredControlSofwareVersion": "",
|
||||||
|
"systemType": "huddle"
|
||||||
|
},
|
||||||
|
"rooms": [],
|
||||||
|
"tieLines": []
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,130 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
|
namespace PepperDash_Essentials_Core.Bridges.JoinMaps
|
||||||
|
{
|
||||||
|
public class GlsPartitionSensorJoinMap : JoinMapBaseAdvanced
|
||||||
|
{
|
||||||
|
[JoinName("IsOnline")]
|
||||||
|
public JoinDataComplete IsOnline = new JoinDataComplete(
|
||||||
|
new JoinData()
|
||||||
|
{
|
||||||
|
JoinNumber = 1,
|
||||||
|
JoinSpan = 1
|
||||||
|
},
|
||||||
|
new JoinMetadata()
|
||||||
|
{
|
||||||
|
Description = "Sensor Is Online",
|
||||||
|
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||||
|
JoinType = eJoinType.Digital
|
||||||
|
});
|
||||||
|
|
||||||
|
[JoinName("Name")]
|
||||||
|
public JoinDataComplete Name = new JoinDataComplete(
|
||||||
|
new JoinData()
|
||||||
|
{
|
||||||
|
JoinNumber = 1,
|
||||||
|
JoinSpan = 1
|
||||||
|
},
|
||||||
|
new JoinMetadata()
|
||||||
|
{
|
||||||
|
Description = "Sensor Name",
|
||||||
|
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||||
|
JoinType = eJoinType.Serial
|
||||||
|
});
|
||||||
|
|
||||||
|
[JoinName("Enable")]
|
||||||
|
public JoinDataComplete Enable = new JoinDataComplete(
|
||||||
|
new JoinData()
|
||||||
|
{
|
||||||
|
JoinNumber = 2,
|
||||||
|
JoinSpan = 1
|
||||||
|
},
|
||||||
|
new JoinMetadata()
|
||||||
|
{
|
||||||
|
Description = "Sensor Enable",
|
||||||
|
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||||
|
JoinType = eJoinType.Digital
|
||||||
|
});
|
||||||
|
|
||||||
|
[JoinName("PartitionSensed")]
|
||||||
|
public JoinDataComplete PartitionSensed = new JoinDataComplete(
|
||||||
|
new JoinData()
|
||||||
|
{
|
||||||
|
JoinNumber = 3,
|
||||||
|
JoinSpan = 1
|
||||||
|
},
|
||||||
|
new JoinMetadata()
|
||||||
|
{
|
||||||
|
Description = "Sensor Partition Sensed",
|
||||||
|
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||||
|
JoinType = eJoinType.Digital
|
||||||
|
});
|
||||||
|
|
||||||
|
[JoinName("PartitionNotSensed")]
|
||||||
|
public JoinDataComplete PartitionNotSensed = new JoinDataComplete(
|
||||||
|
new JoinData()
|
||||||
|
{
|
||||||
|
JoinNumber = 4,
|
||||||
|
JoinSpan = 1
|
||||||
|
},
|
||||||
|
new JoinMetadata()
|
||||||
|
{
|
||||||
|
Description = "Sensor Partition Not Sensed",
|
||||||
|
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||||
|
JoinType = eJoinType.Digital
|
||||||
|
});
|
||||||
|
|
||||||
|
[JoinName("IncreaseSensitivity")]
|
||||||
|
public JoinDataComplete IncreaseSensitivity = new JoinDataComplete(
|
||||||
|
new JoinData()
|
||||||
|
{
|
||||||
|
JoinNumber = 6,
|
||||||
|
JoinSpan = 1
|
||||||
|
},
|
||||||
|
new JoinMetadata()
|
||||||
|
{
|
||||||
|
Description = "Sensor Increase Sensitivity",
|
||||||
|
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||||
|
JoinType = eJoinType.Digital
|
||||||
|
});
|
||||||
|
|
||||||
|
[JoinName("DecreaseSensitivity")]
|
||||||
|
public JoinDataComplete DecreaseSensitivity = new JoinDataComplete(
|
||||||
|
new JoinData()
|
||||||
|
{
|
||||||
|
JoinNumber = 7,
|
||||||
|
JoinSpan = 1
|
||||||
|
},
|
||||||
|
new JoinMetadata()
|
||||||
|
{
|
||||||
|
Description = "Sensor Decrease Sensitivity",
|
||||||
|
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||||
|
JoinType = eJoinType.Digital
|
||||||
|
});
|
||||||
|
|
||||||
|
[JoinName("Sensitivity")]
|
||||||
|
public JoinDataComplete Sensitivity = new JoinDataComplete(
|
||||||
|
new JoinData()
|
||||||
|
{
|
||||||
|
JoinNumber = 2,
|
||||||
|
JoinSpan = 1
|
||||||
|
},
|
||||||
|
new JoinMetadata()
|
||||||
|
{
|
||||||
|
Description = "Sensor Sensitivity",
|
||||||
|
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||||
|
JoinType = eJoinType.Analog
|
||||||
|
});
|
||||||
|
|
||||||
|
public GlsPartitionSensorJoinMap(uint joinStart)
|
||||||
|
: base(joinStart, typeof(GlsPartitionSensorJoinMap))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,9 +18,9 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
|||||||
public IntFeedback TemperatureFeedback { get; private set; }
|
public IntFeedback TemperatureFeedback { get; private set; }
|
||||||
public IntFeedback HumidityFeedback { get; private set; }
|
public IntFeedback HumidityFeedback { get; private set; }
|
||||||
|
|
||||||
public C2nRthsController(string key, string name, GenericBase hardware) : base(key, name, hardware)
|
public C2nRthsController(string key, string name, GenericBase sensor) : base(key, name, sensor)
|
||||||
{
|
{
|
||||||
_device = hardware as C2nRths;
|
_device = sensor as C2nRths;
|
||||||
|
|
||||||
TemperatureFeedback = new IntFeedback(() => _device.TemperatureFeedback.UShortValue);
|
TemperatureFeedback = new IntFeedback(() => _device.TemperatureFeedback.UShortValue);
|
||||||
HumidityFeedback = new IntFeedback(() => _device.HumidityFeedback.UShortValue);
|
HumidityFeedback = new IntFeedback(() => _device.HumidityFeedback.UShortValue);
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
|||||||
{
|
{
|
||||||
private readonly C3Card _card;
|
private readonly C3Card _card;
|
||||||
|
|
||||||
public C3CardControllerBase(string key, string name, C3Card hardware) : base(key, name, hardware)
|
public C3CardControllerBase(string key, string name, C3Card sensor) : base(key, name, sensor)
|
||||||
{
|
{
|
||||||
_card = hardware;
|
_card = sensor;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Overrides of Object
|
#region Overrides of Object
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
|||||||
{
|
{
|
||||||
private readonly C3com3 _card;
|
private readonly C3com3 _card;
|
||||||
|
|
||||||
public C3Com3Controller(string key, string name, C3com3 hardware) : base(key, name, hardware)
|
public C3Com3Controller(string key, string name, C3com3 sensor) : base(key, name, sensor)
|
||||||
{
|
{
|
||||||
_card = hardware;
|
_card = sensor;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Implementation of IComPorts
|
#region Implementation of IComPorts
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
|||||||
{
|
{
|
||||||
private readonly C3io16 _card;
|
private readonly C3io16 _card;
|
||||||
|
|
||||||
public C3Io16Controller(string key, string name, C3io16 hardware) : base(key, name, hardware)
|
public C3Io16Controller(string key, string name, C3io16 sensor) : base(key, name, sensor)
|
||||||
{
|
{
|
||||||
_card = hardware;
|
_card = sensor;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Implementation of IIOPorts
|
#region Implementation of IIOPorts
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
|||||||
{
|
{
|
||||||
private readonly C3ir8 _card;
|
private readonly C3ir8 _card;
|
||||||
|
|
||||||
public C3Ir8Controller(string key, string name, C3ir8 hardware) : base(key, name, hardware)
|
public C3Ir8Controller(string key, string name, C3ir8 sensor) : base(key, name, sensor)
|
||||||
{
|
{
|
||||||
_card = hardware;
|
_card = sensor;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Implementation of IIROutputPorts
|
#region Implementation of IIROutputPorts
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
|||||||
{
|
{
|
||||||
private readonly C3ry16 _card;
|
private readonly C3ry16 _card;
|
||||||
|
|
||||||
public C3Ry16Controller(string key, string name, C3ry16 hardware) : base(key, name, hardware)
|
public C3Ry16Controller(string key, string name, C3ry16 sensor) : base(key, name, sensor)
|
||||||
{
|
{
|
||||||
_card = hardware;
|
_card = sensor;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Implementation of IRelayPorts
|
#region Implementation of IRelayPorts
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
|||||||
{
|
{
|
||||||
private readonly C3ry8 _card;
|
private readonly C3ry8 _card;
|
||||||
|
|
||||||
public C3Ry8Controller(string key, string name, C3ry8 hardware) : base(key, name, hardware)
|
public C3Ry8Controller(string key, string name, C3ry8 sensor) : base(key, name, sensor)
|
||||||
{
|
{
|
||||||
_card = hardware;
|
_card = sensor;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Implementation of IRelayPorts
|
#region Implementation of IRelayPorts
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
|||||||
|
|
||||||
private readonly Dictionary<string, Func<CenCi31, uint, C3CardControllerBase>> _cardDict;
|
private readonly Dictionary<string, Func<CenCi31, uint, C3CardControllerBase>> _cardDict;
|
||||||
|
|
||||||
public CenCi31Controller(string key, string name, CenCi31Configuration config, CenCi31 hardware) : base(key, name, hardware)
|
public CenCi31Controller(string key, string name, CenCi31Configuration config, CenCi31 sensor) : base(key, name, sensor)
|
||||||
{
|
{
|
||||||
_cardCage = hardware;
|
_cardCage = sensor;
|
||||||
|
|
||||||
_config = config;
|
_config = config;
|
||||||
|
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
|||||||
|
|
||||||
private readonly Dictionary<string, Func<CenCi33, uint, C3CardControllerBase>> _cardDict;
|
private readonly Dictionary<string, Func<CenCi33, uint, C3CardControllerBase>> _cardDict;
|
||||||
|
|
||||||
public CenCi33Controller(string key, string name, CenCi33Configuration config, CenCi33 hardware) : base(key, name, hardware)
|
public CenCi33Controller(string key, string name, CenCi33Configuration config, CenCi33 sensor) : base(key, name, sensor)
|
||||||
{
|
{
|
||||||
_cardCage = hardware;
|
_cardCage = sensor;
|
||||||
|
|
||||||
_config = config;
|
_config = config;
|
||||||
|
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
|||||||
public IntFeedback GreenLedBrightnessFeedback { get; private set; }
|
public IntFeedback GreenLedBrightnessFeedback { get; private set; }
|
||||||
public IntFeedback BlueLedBrightnessFeedback { get; private set; }
|
public IntFeedback BlueLedBrightnessFeedback { get; private set; }
|
||||||
|
|
||||||
public StatusSignController(string key, string name, GenericBase hardware) : base(key, name, hardware)
|
public StatusSignController(string key, string name, GenericBase sensor) : base(key, name, sensor)
|
||||||
{
|
{
|
||||||
_device = hardware as StatusSign;
|
_device = sensor as StatusSign;
|
||||||
|
|
||||||
RedLedEnabledFeedback =
|
RedLedEnabledFeedback =
|
||||||
new BoolFeedback(
|
new BoolFeedback(
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class CrestronGenericBaseDevice : EssentialsDevice, IOnline, IHasFeedback, ICommunicationMonitor, IUsageTracking
|
public abstract class CrestronGenericBaseDevice : EssentialsDevice, IOnline, IHasFeedback, ICommunicationMonitor, IUsageTracking
|
||||||
{
|
{
|
||||||
public virtual GenericBase Hardware { get; protected set; }
|
public virtual GenericBase Sensor { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a list containing the Outputs that we want to expose.
|
/// Returns a list containing the Outputs that we want to expose.
|
||||||
@@ -28,18 +28,18 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool PreventRegistration { get; protected set; }
|
public bool PreventRegistration { get; protected set; }
|
||||||
|
|
||||||
protected CrestronGenericBaseDevice(string key, string name, GenericBase hardware)
|
protected CrestronGenericBaseDevice(string key, string name, GenericBase sensor)
|
||||||
: base(key, name)
|
: base(key, name)
|
||||||
{
|
{
|
||||||
Feedbacks = new FeedbackCollection<Feedback>();
|
Feedbacks = new FeedbackCollection<Feedback>();
|
||||||
|
|
||||||
Hardware = hardware;
|
Sensor = sensor;
|
||||||
IsOnline = new BoolFeedback("IsOnlineFeedback", () => Hardware.IsOnline);
|
IsOnline = new BoolFeedback("IsOnlineFeedback", () => Sensor.IsOnline);
|
||||||
IsRegistered = new BoolFeedback("IsRegistered", () => Hardware.Registered);
|
IsRegistered = new BoolFeedback("IsRegistered", () => Sensor.Registered);
|
||||||
IpConnectionsText = new StringFeedback("IpConnectionsText", () => Hardware.ConnectedIpList != null ? string.Join(",", Hardware.ConnectedIpList.Select(cip => cip.DeviceIpAddress).ToArray()) : string.Empty);
|
IpConnectionsText = new StringFeedback("IpConnectionsText", () => Sensor.ConnectedIpList != null ? string.Join(",", Sensor.ConnectedIpList.Select(cip => cip.DeviceIpAddress).ToArray()) : string.Empty);
|
||||||
AddToFeedbackList(IsOnline, IpConnectionsText);
|
AddToFeedbackList(IsOnline, IpConnectionsText);
|
||||||
|
|
||||||
CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, hardware, 120000, 300000);
|
CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, sensor, 120000, 300000);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -53,7 +53,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
{
|
{
|
||||||
//Debug.Console(1, this, " Does not require registration. Skipping");
|
//Debug.Console(1, this, " Does not require registration. Skipping");
|
||||||
|
|
||||||
var response = Hardware.RegisterWithLogging(Key);
|
var response = Sensor.RegisterWithLogging(Key);
|
||||||
if (response != eDeviceRegistrationUnRegistrationResponse.Success)
|
if (response != eDeviceRegistrationUnRegistrationResponse.Success)
|
||||||
{
|
{
|
||||||
//Debug.Console(0, this, "ERROR: Cannot register Crestron device: {0}", response);
|
//Debug.Console(0, this, "ERROR: Cannot register Crestron device: {0}", response);
|
||||||
@@ -68,7 +68,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
f.FireUpdate();
|
f.FireUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
Hardware.OnlineStatusChange += Hardware_OnlineStatusChange;
|
Sensor.OnlineStatusChange += Hardware_OnlineStatusChange;
|
||||||
CommunicationMonitor.Start();
|
CommunicationMonitor.Start();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -81,9 +81,9 @@ namespace PepperDash.Essentials.Core
|
|||||||
public override bool Deactivate()
|
public override bool Deactivate()
|
||||||
{
|
{
|
||||||
CommunicationMonitor.Stop();
|
CommunicationMonitor.Stop();
|
||||||
Hardware.OnlineStatusChange -= Hardware_OnlineStatusChange;
|
Sensor.OnlineStatusChange -= Hardware_OnlineStatusChange;
|
||||||
|
|
||||||
var success = Hardware.UnRegister() == eDeviceRegistrationUnRegistrationResponse.Success;
|
var success = Sensor.UnRegister() == eDeviceRegistrationUnRegistrationResponse.Success;
|
||||||
|
|
||||||
IsRegistered.FireUpdate();
|
IsRegistered.FireUpdate();
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
|
|
||||||
public abstract class CrestronGenericBridgeableBaseDevice : CrestronGenericBaseDevice, IBridgeAdvanced
|
public abstract class CrestronGenericBridgeableBaseDevice : CrestronGenericBaseDevice, IBridgeAdvanced
|
||||||
{
|
{
|
||||||
protected CrestronGenericBridgeableBaseDevice(string key, string name, GenericBase hardware) : base(key, name, hardware)
|
protected CrestronGenericBridgeableBaseDevice(string key, string name, GenericBase sensor) : base(key, name, sensor)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,113 +1,113 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharp.Reflection;
|
using Crestron.SimplSharp.Reflection;
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the basic needs for an EssentialsDevice to enable it to be build by an IDeviceFactory class
|
/// Defines the basic needs for an EssentialsDevice to enable it to be build by an IDeviceFactory class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Description("The base Essentials Device Class")]
|
[Description("The base Essentials Device Class")]
|
||||||
public abstract class EssentialsDevice : Device
|
public abstract class EssentialsDevice : Device
|
||||||
{
|
{
|
||||||
protected EssentialsDevice(string key)
|
protected EssentialsDevice(string key)
|
||||||
: base(key)
|
: base(key)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected EssentialsDevice(string key, string name)
|
protected EssentialsDevice(string key, string name)
|
||||||
: base(key, name)
|
: base(key, name)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = true)]
|
[AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = true)]
|
||||||
public class DescriptionAttribute : Attribute
|
public class DescriptionAttribute : Attribute
|
||||||
{
|
{
|
||||||
private string _Description;
|
private string _Description;
|
||||||
|
|
||||||
public DescriptionAttribute(string description)
|
public DescriptionAttribute(string description)
|
||||||
{
|
{
|
||||||
Debug.Console(2, "Setting Description: {0}", description);
|
Debug.Console(2, "Setting Description: {0}", description);
|
||||||
_Description = description;
|
_Description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Description
|
public string Description
|
||||||
{
|
{
|
||||||
get { return _Description; }
|
get { return _Description; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = true)]
|
[AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = true)]
|
||||||
public class ConfigSnippetAttribute : Attribute
|
public class ConfigSnippetAttribute : Attribute
|
||||||
{
|
{
|
||||||
private string _ConfigSnippet;
|
private string _ConfigSnippet;
|
||||||
|
|
||||||
public ConfigSnippetAttribute(string configSnippet)
|
public ConfigSnippetAttribute(string configSnippet)
|
||||||
{
|
{
|
||||||
Debug.Console(2, "Setting Config Snippet {0}", configSnippet);
|
Debug.Console(2, "Setting Config Snippet {0}", configSnippet);
|
||||||
_ConfigSnippet = configSnippet;
|
_ConfigSnippet = configSnippet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ConfigSnippet
|
public string ConfigSnippet
|
||||||
{
|
{
|
||||||
get { return _ConfigSnippet; }
|
get { return _ConfigSnippet; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Devices the basic needs for a Device Factory
|
/// Devices the basic needs for a Device Factory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class EssentialsDeviceFactory<T> : IDeviceFactory where T:EssentialsDevice
|
public abstract class EssentialsDeviceFactory<T> : IDeviceFactory where T:EssentialsDevice
|
||||||
{
|
{
|
||||||
#region IDeviceFactory Members
|
#region IDeviceFactory Members
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A list of strings that can be used in the type property of a DeviceConfig object to build an instance of this device
|
/// A list of strings that can be used in the type property of a DeviceConfig object to build an instance of this device
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<string> TypeNames { get; protected set; }
|
public List<string> TypeNames { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads an item to the DeviceFactory.FactoryMethods dictionary for each entry in the TypeNames list
|
/// Loads an item to the DeviceFactory.FactoryMethods dictionary for each entry in the TypeNames list
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void LoadTypeFactories()
|
public void LoadTypeFactories()
|
||||||
{
|
{
|
||||||
foreach (var typeName in TypeNames)
|
foreach (var typeName in TypeNames)
|
||||||
{
|
{
|
||||||
Debug.Console(2, "Getting Description Attribute from class: '{0}'", typeof(T).FullName);
|
Debug.Console(2, "Getting Description Attribute from class: '{0}'", typeof(T).FullName);
|
||||||
var descriptionAttribute = typeof(T).GetCustomAttributes(typeof(DescriptionAttribute), true) as DescriptionAttribute[];
|
var descriptionAttribute = typeof(T).GetCustomAttributes(typeof(DescriptionAttribute), true) as DescriptionAttribute[];
|
||||||
string description = descriptionAttribute[0].Description;
|
string description = descriptionAttribute[0].Description;
|
||||||
var snippetAttribute = typeof(T).GetCustomAttributes(typeof(ConfigSnippetAttribute), true) as ConfigSnippetAttribute[];
|
var snippetAttribute = typeof(T).GetCustomAttributes(typeof(ConfigSnippetAttribute), true) as ConfigSnippetAttribute[];
|
||||||
DeviceFactory.AddFactoryForType(typeName.ToLower(), description, typeof(T), BuildDevice);
|
DeviceFactory.AddFactoryForType(typeName.ToLower(), description, typeof(T), BuildDevice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The method that will build the device
|
/// The method that will build the device
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dc">The device config</param>
|
/// <param name="dc">The device config</param>
|
||||||
/// <returns>An instance of the device</returns>
|
/// <returns>An instance of the device</returns>
|
||||||
public abstract EssentialsDevice BuildDevice(DeviceConfig dc);
|
public abstract EssentialsDevice BuildDevice(DeviceConfig dc);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Devices the basic needs for a Device Factory
|
/// Devices the basic needs for a Device Factory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class EssentialsPluginDeviceFactory<T> : EssentialsDeviceFactory<T>, IPluginDeviceFactory where T : EssentialsDevice
|
public abstract class EssentialsPluginDeviceFactory<T> : EssentialsDeviceFactory<T>, IPluginDeviceFactory where T : EssentialsDevice
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Specifies the minimum version of Essentials required for a plugin to run. Must use the format Major.Minor.Build (ex. "1.4.33")
|
/// Specifies the minimum version of Essentials required for a plugin to run. Must use the format Major.Minor.Build (ex. "1.4.33")
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string MinimumEssentialsFrameworkVersion { get; protected set; }
|
public string MinimumEssentialsFrameworkVersion { get; protected set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,488 +1,488 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using Crestron.SimplSharp.Reflection;
|
using Crestron.SimplSharp.Reflection;
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
public static class JoinMapHelper
|
public static class JoinMapHelper
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Attempts to get the serialized join map from config
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinMapKey"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static string GetSerializedJoinMapForDevice(string joinMapKey)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(joinMapKey))
|
|
||||||
return null;
|
|
||||||
|
|
||||||
var joinMap = ConfigReader.ConfigObject.JoinMaps[joinMapKey];
|
|
||||||
|
|
||||||
return joinMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Attempts to get the serialized join map from config
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinMapKey"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static string GetJoinMapForDevice(string joinMapKey)
|
|
||||||
{
|
|
||||||
return GetSerializedJoinMapForDevice(joinMapKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Attempts to find a custom join map by key and returns it deserialized if found
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinMapKey"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static Dictionary<string, JoinData> TryGetJoinMapAdvancedForDevice(string joinMapKey)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(joinMapKey))
|
|
||||||
return null;
|
|
||||||
|
|
||||||
var joinMapSerialzed = ConfigReader.ConfigObject.JoinMaps[joinMapKey];
|
|
||||||
|
|
||||||
if (joinMapSerialzed == null) return null;
|
|
||||||
|
|
||||||
var joinMapData = JsonConvert.DeserializeObject<Dictionary<string, JoinData>>(joinMapSerialzed);
|
|
||||||
|
|
||||||
return joinMapData;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Base class for join maps
|
|
||||||
/// </summary>
|
|
||||||
[Obsolete("This is being deprecated in favor of JoinMapBaseAdvanced")]
|
|
||||||
public abstract class JoinMapBase
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Modifies all the join numbers by adding the offset. This should never be called twice
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinStart"></param>
|
|
||||||
public abstract void OffsetJoinNumbers(uint joinStart);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The collection of joins and associated metadata
|
|
||||||
/// </summary>
|
|
||||||
public Dictionary<string, JoinMetadata> Joins = new Dictionary<string, JoinMetadata>();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Prints the join information to console
|
|
||||||
/// </summary>
|
|
||||||
public void PrintJoinMapInfo()
|
|
||||||
{
|
|
||||||
Debug.Console(0, "{0}:\n", GetType().Name);
|
|
||||||
|
|
||||||
// Get the joins of each type and print them
|
|
||||||
Debug.Console(0, "Digitals:");
|
|
||||||
var digitals = Joins.Where(j => (j.Value.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value);
|
|
||||||
Debug.Console(2, "Found {0} Digital Joins", digitals.Count);
|
|
||||||
PrintJoinList(GetSortedJoins(digitals));
|
|
||||||
|
|
||||||
Debug.Console(0, "Analogs:");
|
|
||||||
var analogs = Joins.Where(j => (j.Value.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value);
|
|
||||||
Debug.Console(2, "Found {0} Analog Joins", analogs.Count);
|
|
||||||
PrintJoinList(GetSortedJoins(analogs));
|
|
||||||
|
|
||||||
Debug.Console(0, "Serials:");
|
|
||||||
var serials = Joins.Where(j => (j.Value.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value);
|
|
||||||
Debug.Console(2, "Found {0} Serial Joins", serials.Count);
|
|
||||||
PrintJoinList(GetSortedJoins(serials));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns a sorted list by JoinNumber
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joins"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
List<KeyValuePair<string, JoinMetadata>> GetSortedJoins(Dictionary<string, JoinMetadata> joins)
|
|
||||||
{
|
|
||||||
var sortedJoins = joins.ToList();
|
|
||||||
|
|
||||||
sortedJoins.Sort((pair1, pair2) => pair1.Value.JoinNumber.CompareTo(pair2.Value.JoinNumber));
|
|
||||||
|
|
||||||
return sortedJoins;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PrintJoinList(List<KeyValuePair<string, JoinMetadata>> joins)
|
|
||||||
{
|
|
||||||
foreach (var join in joins)
|
|
||||||
{
|
|
||||||
Debug.Console(0,
|
|
||||||
@"Join Number: {0} | Label: '{1}' | JoinSpan: '{2}' | Type: '{3}' | Capabilities: '{4}'",
|
|
||||||
join.Value.JoinNumber,
|
|
||||||
join.Value.Label,
|
|
||||||
join.Value.JoinSpan,
|
|
||||||
join.Value.JoinType.ToString(),
|
|
||||||
join.Value.JoinCapabilities.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the join number for the join with the specified key
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="key"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public uint GetJoinForKey(string key)
|
|
||||||
{
|
|
||||||
return Joins.ContainsKey(key) ? Joins[key].JoinNumber : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the join span for the join with the specified key
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="key"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public uint GetJoinSpanForKey(string key)
|
|
||||||
{
|
|
||||||
return Joins.ContainsKey(key) ? Joins[key].JoinSpan : 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Base class for join maps
|
|
||||||
/// </summary>
|
|
||||||
public abstract class JoinMapBaseAdvanced
|
|
||||||
{
|
|
||||||
protected uint JoinOffset;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The collection of joins and associated metadata
|
|
||||||
/// </summary>
|
|
||||||
public Dictionary<string, JoinDataComplete> Joins { get; private set; }
|
|
||||||
|
|
||||||
protected JoinMapBaseAdvanced(uint joinStart)
|
|
||||||
{
|
|
||||||
Joins = new Dictionary<string, JoinDataComplete>();
|
|
||||||
|
|
||||||
JoinOffset = joinStart - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected JoinMapBaseAdvanced(uint joinStart, Type type):this(joinStart)
|
|
||||||
{
|
|
||||||
AddJoins(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void AddJoins(Type type)
|
|
||||||
{
|
|
||||||
// Add all the JoinDataComplete properties to the Joins Dictionary and pass in the offset
|
|
||||||
//Joins = this.GetType()
|
|
||||||
// .GetCType()
|
|
||||||
// .GetFields(BindingFlags.Public | BindingFlags.Instance)
|
|
||||||
// .Where(field => field.IsDefined(typeof(JoinNameAttribute), true))
|
|
||||||
// .Select(field => (JoinDataComplete)field.GetValue(this))
|
|
||||||
// .ToDictionary(join => join.GetNameAttribute(), join =>
|
|
||||||
// {
|
|
||||||
// join.SetJoinOffset(_joinOffset);
|
|
||||||
// return join;
|
|
||||||
// });
|
|
||||||
|
|
||||||
//type = this.GetType(); <- this wasn't working because 'this' was always the base class, never the derived class
|
|
||||||
var fields =
|
|
||||||
type.GetCType()
|
|
||||||
.GetFields(BindingFlags.Public | BindingFlags.Instance)
|
|
||||||
.Where(f => f.IsDefined(typeof (JoinNameAttribute), true));
|
|
||||||
|
|
||||||
foreach (var field in fields)
|
|
||||||
{
|
|
||||||
var childClass = Convert.ChangeType(this, type, null);
|
|
||||||
|
|
||||||
var value = field.GetValue(childClass) as JoinDataComplete; //this here is JoinMapBaseAdvanced, not the child class. JoinMapBaseAdvanced has no fields.
|
|
||||||
|
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
Debug.Console(0, "Unable to caset base class to {0}", type.Name);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
value.SetJoinOffset(JoinOffset);
|
|
||||||
|
|
||||||
var joinName = value.GetNameAttribute(field);
|
|
||||||
|
|
||||||
if (String.IsNullOrEmpty(joinName)) continue;
|
|
||||||
|
|
||||||
Joins.Add(joinName, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PrintJoinMapInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Prints the join information to console
|
|
||||||
/// </summary>
|
|
||||||
public void PrintJoinMapInfo()
|
|
||||||
{
|
|
||||||
Debug.Console(0, "{0}:\n", GetType().Name);
|
|
||||||
|
|
||||||
// Get the joins of each type and print them
|
|
||||||
Debug.Console(0, "Digitals:");
|
|
||||||
var digitals = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value);
|
|
||||||
Debug.Console(2, "Found {0} Digital Joins", digitals.Count);
|
|
||||||
PrintJoinList(GetSortedJoins(digitals));
|
|
||||||
|
|
||||||
Debug.Console(0, "Analogs:");
|
|
||||||
var analogs = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value);
|
|
||||||
Debug.Console(2, "Found {0} Analog Joins", analogs.Count);
|
|
||||||
PrintJoinList(GetSortedJoins(analogs));
|
|
||||||
|
|
||||||
Debug.Console(0, "Serials:");
|
|
||||||
var serials = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value);
|
|
||||||
Debug.Console(2, "Found {0} Serial Joins", serials.Count);
|
|
||||||
PrintJoinList(GetSortedJoins(serials));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns a sorted list by JoinNumber
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joins"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
List<KeyValuePair<string, JoinDataComplete>> GetSortedJoins(Dictionary<string, JoinDataComplete> joins)
|
|
||||||
{
|
|
||||||
var sortedJoins = joins.ToList();
|
|
||||||
|
|
||||||
sortedJoins.Sort((pair1, pair2) => pair1.Value.JoinNumber.CompareTo(pair2.Value.JoinNumber));
|
|
||||||
|
|
||||||
return sortedJoins;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PrintJoinList(List<KeyValuePair<string, JoinDataComplete>> joins)
|
|
||||||
{
|
|
||||||
foreach (var join in joins)
|
|
||||||
{
|
|
||||||
Debug.Console(0,
|
|
||||||
@"Join Number: {0} | JoinSpan: '{1}' | Label: '{2}' | Type: '{3}' | Capabilities: '{4}'",
|
|
||||||
join.Value.JoinNumber,
|
|
||||||
join.Value.JoinSpan,
|
|
||||||
join.Value.Metadata.Label,
|
|
||||||
join.Value.Metadata.JoinType.ToString(),
|
|
||||||
join.Value.Metadata.JoinCapabilities.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Attempts to find the matching key for the custom join and if found overwrites the default JoinData with the custom
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="joinData"></param>
|
|
||||||
public void SetCustomJoinData(Dictionary<string, JoinData> joinData)
|
|
||||||
{
|
|
||||||
foreach (var customJoinData in joinData)
|
|
||||||
{
|
|
||||||
var join = Joins[customJoinData.Key];
|
|
||||||
|
|
||||||
if (join != null)
|
|
||||||
{
|
|
||||||
join.SetCustomJoinData(customJoinData.Value);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.Console(2, "No mathcing key found in join map for: '{0}'", customJoinData.Key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PrintJoinMapInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
///// <summary>
|
|
||||||
///// Returns the join number for the join with the specified key
|
|
||||||
///// </summary>
|
|
||||||
///// <param name="key"></param>
|
|
||||||
///// <returns></returns>
|
|
||||||
//public uint GetJoinForKey(string key)
|
|
||||||
//{
|
|
||||||
// return Joins.ContainsKey(key) ? Joins[key].JoinNumber : 0;
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
///// <summary>
|
|
||||||
///// Returns the join span for the join with the specified key
|
|
||||||
///// </summary>
|
|
||||||
///// <param name="key"></param>
|
|
||||||
///// <returns></returns>
|
|
||||||
//public uint GetJoinSpanForKey(string key)
|
|
||||||
//{
|
|
||||||
// return Joins.ContainsKey(key) ? Joins[key].JoinSpan : 0;
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Read = Provides feedback to SIMPL
|
|
||||||
/// Write = Responds to sig values from SIMPL
|
|
||||||
/// </summary>
|
|
||||||
[Flags]
|
|
||||||
public enum eJoinCapabilities
|
|
||||||
{
|
|
||||||
None = 0,
|
|
||||||
ToSIMPL = 1,
|
|
||||||
FromSIMPL = 2,
|
|
||||||
ToFromSIMPL = ToSIMPL | FromSIMPL
|
|
||||||
}
|
|
||||||
|
|
||||||
[Flags]
|
|
||||||
public enum eJoinType
|
|
||||||
{
|
|
||||||
None = 0,
|
|
||||||
Digital = 1,
|
|
||||||
Analog = 2,
|
|
||||||
Serial = 4,
|
|
||||||
DigitalAnalog = Digital | Analog,
|
|
||||||
DigitalSerial = Digital | Serial,
|
|
||||||
AnalogSerial = Analog | Serial,
|
|
||||||
DigitalAnalogSerial = Digital | Analog | Serial
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Metadata describing the join
|
|
||||||
/// </summary>
|
|
||||||
public class JoinMetadata
|
|
||||||
{
|
{
|
||||||
private string _description;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Join number (based on join offset value)
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("joinNumber")]
|
|
||||||
[Obsolete]
|
|
||||||
public uint JoinNumber { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Join range span. If join indicates the start of a range of joins, this indicated the maximum number of joins in the range
|
|
||||||
/// </summary>
|
|
||||||
[Obsolete]
|
|
||||||
[JsonProperty("joinSpan")]
|
|
||||||
public uint JoinSpan { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A label for the join to better describe its usage
|
|
||||||
/// </summary>
|
|
||||||
[Obsolete("Use Description instead")]
|
|
||||||
[JsonProperty("label")]
|
|
||||||
public string Label { get { return _description; } set { _description = value; } }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A description for the join to better describe its usage
|
/// Attempts to get the serialized join map from config
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("description")]
|
/// <param name="joinMapKey"></param>
|
||||||
public string Description { get { return _description; } set { _description = value; } }
|
/// <returns></returns>
|
||||||
/// <summary>
|
public static string GetSerializedJoinMapForDevice(string joinMapKey)
|
||||||
/// Signal type(s)
|
{
|
||||||
/// </summary>
|
if (string.IsNullOrEmpty(joinMapKey))
|
||||||
[JsonProperty("joinType")]
|
return null;
|
||||||
public eJoinType JoinType { get; set; }
|
|
||||||
/// <summary>
|
var joinMap = ConfigReader.ConfigObject.JoinMaps[joinMapKey];
|
||||||
/// Indicates whether the join is read and/or write
|
|
||||||
/// </summary>
|
return joinMap;
|
||||||
[JsonProperty("joinCapabilities")]
|
}
|
||||||
public eJoinCapabilities JoinCapabilities { get; set; }
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates a set of valid values (particularly if this translates to an enum
|
/// Attempts to get the serialized join map from config
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("validValues")]
|
/// <param name="joinMapKey"></param>
|
||||||
public string[] ValidValues { get; set; }
|
/// <returns></returns>
|
||||||
|
public static string GetJoinMapForDevice(string joinMapKey)
|
||||||
}
|
{
|
||||||
|
return GetSerializedJoinMapForDevice(joinMapKey);
|
||||||
/// <summary>
|
}
|
||||||
/// Data describing the join. Can be
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
public class JoinData
|
/// Attempts to find a custom join map by key and returns it deserialized if found
|
||||||
{
|
/// </summary>
|
||||||
/// <summary>
|
/// <param name="joinMapKey"></param>
|
||||||
/// Join number (based on join offset value)
|
/// <returns></returns>
|
||||||
/// </summary>
|
public static Dictionary<string, JoinData> TryGetJoinMapAdvancedForDevice(string joinMapKey)
|
||||||
[JsonProperty("joinNumber")]
|
{
|
||||||
public uint JoinNumber { get; set; }
|
if (string.IsNullOrEmpty(joinMapKey))
|
||||||
/// <summary>
|
return null;
|
||||||
/// Join range span. If join indicates the start of a range of joins, this indicated the maximum number of joins in the range
|
|
||||||
/// </summary>
|
var joinMapSerialzed = ConfigReader.ConfigObject.JoinMaps[joinMapKey];
|
||||||
[JsonProperty("joinSpan")]
|
|
||||||
public uint JoinSpan { get; set; }
|
if (joinMapSerialzed == null) return null;
|
||||||
}
|
|
||||||
|
var joinMapData = JsonConvert.DeserializeObject<Dictionary<string, JoinData>>(joinMapSerialzed);
|
||||||
/// <summary>
|
|
||||||
/// A class to aggregate the JoinData and JoinMetadata for a join
|
return joinMapData;
|
||||||
/// </summary>
|
}
|
||||||
public class JoinDataComplete
|
|
||||||
{
|
}
|
||||||
private uint _joinOffset;
|
|
||||||
|
/// <summary>
|
||||||
private JoinData _data;
|
/// Base class for join maps
|
||||||
public JoinMetadata Metadata { get; set; }
|
/// </summary>
|
||||||
|
[Obsolete("This is being deprecated in favor of JoinMapBaseAdvanced")]
|
||||||
public JoinDataComplete(JoinData data, JoinMetadata metadata)
|
public abstract class JoinMapBase
|
||||||
{
|
{
|
||||||
_data = data;
|
/// <summary>
|
||||||
Metadata = metadata;
|
/// Modifies all the join numbers by adding the offset. This should never be called twice
|
||||||
}
|
/// </summary>
|
||||||
|
/// <param name="joinStart"></param>
|
||||||
/// <summary>
|
public abstract void OffsetJoinNumbers(uint joinStart);
|
||||||
/// Sets the join offset value
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="joinOffset"></param>
|
/// The collection of joins and associated metadata
|
||||||
public void SetJoinOffset(uint joinOffset)
|
/// </summary>
|
||||||
{
|
public Dictionary<string, JoinMetadata> Joins = new Dictionary<string, JoinMetadata>();
|
||||||
_joinOffset = joinOffset;
|
|
||||||
}
|
/// <summary>
|
||||||
|
/// Prints the join information to console
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// The join number (including the offset)
|
public void PrintJoinMapInfo()
|
||||||
/// </summary>
|
{
|
||||||
public uint JoinNumber
|
Debug.Console(0, "{0}:\n", GetType().Name);
|
||||||
{
|
|
||||||
get { return _data.JoinNumber+ _joinOffset; }
|
// Get the joins of each type and print them
|
||||||
set { _data.JoinNumber = value; }
|
Debug.Console(0, "Digitals:");
|
||||||
}
|
var digitals = Joins.Where(j => (j.Value.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value);
|
||||||
|
Debug.Console(2, "Found {0} Digital Joins", digitals.Count);
|
||||||
public uint JoinSpan
|
PrintJoinList(GetSortedJoins(digitals));
|
||||||
{
|
|
||||||
get { return _data.JoinSpan; }
|
Debug.Console(0, "Analogs:");
|
||||||
}
|
var analogs = Joins.Where(j => (j.Value.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value);
|
||||||
|
Debug.Console(2, "Found {0} Analog Joins", analogs.Count);
|
||||||
public void SetCustomJoinData(JoinData customJoinData)
|
PrintJoinList(GetSortedJoins(analogs));
|
||||||
{
|
|
||||||
_data = customJoinData;
|
Debug.Console(0, "Serials:");
|
||||||
}
|
var serials = Joins.Where(j => (j.Value.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value);
|
||||||
|
Debug.Console(2, "Found {0} Serial Joins", serials.Count);
|
||||||
public string GetNameAttribute(MemberInfo memberInfo)
|
PrintJoinList(GetSortedJoins(serials));
|
||||||
{
|
|
||||||
var name = string.Empty;
|
}
|
||||||
var attribute = (JoinNameAttribute)CAttribute.GetCustomAttribute(memberInfo, typeof(JoinNameAttribute));
|
|
||||||
|
/// <summary>
|
||||||
if (attribute == null) return name;
|
/// Returns a sorted list by JoinNumber
|
||||||
|
/// </summary>
|
||||||
name = attribute.Name;
|
/// <param name="joins"></param>
|
||||||
Debug.Console(2, "JoinName Attribute value: {0}", name);
|
/// <returns></returns>
|
||||||
return name;
|
List<KeyValuePair<string, JoinMetadata>> GetSortedJoins(Dictionary<string, JoinMetadata> joins)
|
||||||
|
{
|
||||||
|
var sortedJoins = joins.ToList();
|
||||||
|
|
||||||
|
sortedJoins.Sort((pair1, pair2) => pair1.Value.JoinNumber.CompareTo(pair2.Value.JoinNumber));
|
||||||
|
|
||||||
|
return sortedJoins;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PrintJoinList(List<KeyValuePair<string, JoinMetadata>> joins)
|
||||||
|
{
|
||||||
|
foreach (var join in joins)
|
||||||
|
{
|
||||||
|
Debug.Console(0,
|
||||||
|
@"Join Number: {0} | Label: '{1}' | JoinSpan: '{2}' | Type: '{3}' | Capabilities: '{4}'",
|
||||||
|
join.Value.JoinNumber,
|
||||||
|
join.Value.Label,
|
||||||
|
join.Value.JoinSpan,
|
||||||
|
join.Value.JoinType.ToString(),
|
||||||
|
join.Value.JoinCapabilities.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the join number for the join with the specified key
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public uint GetJoinForKey(string key)
|
||||||
|
{
|
||||||
|
return Joins.ContainsKey(key) ? Joins[key].JoinNumber : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the join span for the join with the specified key
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public uint GetJoinSpanForKey(string key)
|
||||||
|
{
|
||||||
|
return Joins.ContainsKey(key) ? Joins[key].JoinSpan : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Base class for join maps
|
||||||
[AttributeUsage(AttributeTargets.All)]
|
/// </summary>
|
||||||
public class JoinNameAttribute : CAttribute
|
public abstract class JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
private string _Name;
|
protected uint JoinOffset;
|
||||||
|
|
||||||
public JoinNameAttribute(string name)
|
/// <summary>
|
||||||
{
|
/// The collection of joins and associated metadata
|
||||||
Debug.Console(2, "Setting Attribute Name: {0}", name);
|
/// </summary>
|
||||||
_Name = name;
|
public Dictionary<string, JoinDataComplete> Joins { get; private set; }
|
||||||
}
|
|
||||||
|
protected JoinMapBaseAdvanced(uint joinStart)
|
||||||
public string Name
|
{
|
||||||
{
|
Joins = new Dictionary<string, JoinDataComplete>();
|
||||||
get { return _Name; }
|
|
||||||
}
|
JoinOffset = joinStart - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected JoinMapBaseAdvanced(uint joinStart, Type type):this(joinStart)
|
||||||
|
{
|
||||||
|
AddJoins(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void AddJoins(Type type)
|
||||||
|
{
|
||||||
|
// Add all the JoinDataComplete properties to the Joins Dictionary and pass in the offset
|
||||||
|
//Joins = this.GetType()
|
||||||
|
// .GetCType()
|
||||||
|
// .GetFields(BindingFlags.Public | BindingFlags.Instance)
|
||||||
|
// .Where(field => field.IsDefined(typeof(JoinNameAttribute), true))
|
||||||
|
// .Select(field => (JoinDataComplete)field.GetValue(this))
|
||||||
|
// .ToDictionary(join => join.GetNameAttribute(), join =>
|
||||||
|
// {
|
||||||
|
// join.SetJoinOffset(_joinOffset);
|
||||||
|
// return join;
|
||||||
|
// });
|
||||||
|
|
||||||
|
//type = this.GetType(); <- this wasn't working because 'this' was always the base class, never the derived class
|
||||||
|
var fields =
|
||||||
|
type.GetCType()
|
||||||
|
.GetFields(BindingFlags.Public | BindingFlags.Instance)
|
||||||
|
.Where(f => f.IsDefined(typeof (JoinNameAttribute), true));
|
||||||
|
|
||||||
|
foreach (var field in fields)
|
||||||
|
{
|
||||||
|
var childClass = Convert.ChangeType(this, type, null);
|
||||||
|
|
||||||
|
var value = field.GetValue(childClass) as JoinDataComplete; //this here is JoinMapBaseAdvanced, not the child class. JoinMapBaseAdvanced has no fields.
|
||||||
|
|
||||||
|
if (value == null)
|
||||||
|
{
|
||||||
|
Debug.Console(0, "Unable to caset base class to {0}", type.Name);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
value.SetJoinOffset(JoinOffset);
|
||||||
|
|
||||||
|
var joinName = value.GetNameAttribute(field);
|
||||||
|
|
||||||
|
if (String.IsNullOrEmpty(joinName)) continue;
|
||||||
|
|
||||||
|
Joins.Add(joinName, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PrintJoinMapInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prints the join information to console
|
||||||
|
/// </summary>
|
||||||
|
public void PrintJoinMapInfo()
|
||||||
|
{
|
||||||
|
Debug.Console(0, "{0}:\n", GetType().Name);
|
||||||
|
|
||||||
|
// Get the joins of each type and print them
|
||||||
|
Debug.Console(0, "Digitals:");
|
||||||
|
var digitals = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value);
|
||||||
|
Debug.Console(2, "Found {0} Digital Joins", digitals.Count);
|
||||||
|
PrintJoinList(GetSortedJoins(digitals));
|
||||||
|
|
||||||
|
Debug.Console(0, "Analogs:");
|
||||||
|
var analogs = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value);
|
||||||
|
Debug.Console(2, "Found {0} Analog Joins", analogs.Count);
|
||||||
|
PrintJoinList(GetSortedJoins(analogs));
|
||||||
|
|
||||||
|
Debug.Console(0, "Serials:");
|
||||||
|
var serials = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value);
|
||||||
|
Debug.Console(2, "Found {0} Serial Joins", serials.Count);
|
||||||
|
PrintJoinList(GetSortedJoins(serials));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a sorted list by JoinNumber
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="joins"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
List<KeyValuePair<string, JoinDataComplete>> GetSortedJoins(Dictionary<string, JoinDataComplete> joins)
|
||||||
|
{
|
||||||
|
var sortedJoins = joins.ToList();
|
||||||
|
|
||||||
|
sortedJoins.Sort((pair1, pair2) => pair1.Value.JoinNumber.CompareTo(pair2.Value.JoinNumber));
|
||||||
|
|
||||||
|
return sortedJoins;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PrintJoinList(List<KeyValuePair<string, JoinDataComplete>> joins)
|
||||||
|
{
|
||||||
|
foreach (var join in joins)
|
||||||
|
{
|
||||||
|
Debug.Console(0,
|
||||||
|
@"Join Number: {0} | JoinSpan: '{1}' | Label: '{2}' | Type: '{3}' | Capabilities: '{4}'",
|
||||||
|
join.Value.JoinNumber,
|
||||||
|
join.Value.JoinSpan,
|
||||||
|
join.Value.Metadata.Label,
|
||||||
|
join.Value.Metadata.JoinType.ToString(),
|
||||||
|
join.Value.Metadata.JoinCapabilities.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attempts to find the matching key for the custom join and if found overwrites the default JoinData with the custom
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="joinData"></param>
|
||||||
|
public void SetCustomJoinData(Dictionary<string, JoinData> joinData)
|
||||||
|
{
|
||||||
|
foreach (var customJoinData in joinData)
|
||||||
|
{
|
||||||
|
var join = Joins[customJoinData.Key];
|
||||||
|
|
||||||
|
if (join != null)
|
||||||
|
{
|
||||||
|
join.SetCustomJoinData(customJoinData.Value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Console(2, "No mathcing key found in join map for: '{0}'", customJoinData.Key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PrintJoinMapInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// Returns the join number for the join with the specified key
|
||||||
|
///// </summary>
|
||||||
|
///// <param name="key"></param>
|
||||||
|
///// <returns></returns>
|
||||||
|
//public uint GetJoinForKey(string key)
|
||||||
|
//{
|
||||||
|
// return Joins.ContainsKey(key) ? Joins[key].JoinNumber : 0;
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// Returns the join span for the join with the specified key
|
||||||
|
///// </summary>
|
||||||
|
///// <param name="key"></param>
|
||||||
|
///// <returns></returns>
|
||||||
|
//public uint GetJoinSpanForKey(string key)
|
||||||
|
//{
|
||||||
|
// return Joins.ContainsKey(key) ? Joins[key].JoinSpan : 0;
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Read = Provides feedback to SIMPL
|
||||||
|
/// Write = Responds to sig values from SIMPL
|
||||||
|
/// </summary>
|
||||||
|
[Flags]
|
||||||
|
public enum eJoinCapabilities
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
ToSIMPL = 1,
|
||||||
|
FromSIMPL = 2,
|
||||||
|
ToFromSIMPL = ToSIMPL | FromSIMPL
|
||||||
|
}
|
||||||
|
|
||||||
|
[Flags]
|
||||||
|
public enum eJoinType
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
Digital = 1,
|
||||||
|
Analog = 2,
|
||||||
|
Serial = 4,
|
||||||
|
DigitalAnalog = Digital | Analog,
|
||||||
|
DigitalSerial = Digital | Serial,
|
||||||
|
AnalogSerial = Analog | Serial,
|
||||||
|
DigitalAnalogSerial = Digital | Analog | Serial
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Metadata describing the join
|
||||||
|
/// </summary>
|
||||||
|
public class JoinMetadata
|
||||||
|
{
|
||||||
|
private string _description;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Join number (based on join offset value)
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("joinNumber")]
|
||||||
|
[Obsolete]
|
||||||
|
public uint JoinNumber { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Join range span. If join indicates the start of a range of joins, this indicated the maximum number of joins in the range
|
||||||
|
/// </summary>
|
||||||
|
[Obsolete]
|
||||||
|
[JsonProperty("joinSpan")]
|
||||||
|
public uint JoinSpan { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A label for the join to better describe its usage
|
||||||
|
/// </summary>
|
||||||
|
[Obsolete("Use Description instead")]
|
||||||
|
[JsonProperty("label")]
|
||||||
|
public string Label { get { return _description; } set { _description = value; } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A description for the join to better describe its usage
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("description")]
|
||||||
|
public string Description { get { return _description; } set { _description = value; } }
|
||||||
|
/// <summary>
|
||||||
|
/// Signal type(s)
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("joinType")]
|
||||||
|
public eJoinType JoinType { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether the join is read and/or write
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("joinCapabilities")]
|
||||||
|
public eJoinCapabilities JoinCapabilities { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates a set of valid values (particularly if this translates to an enum
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("validValues")]
|
||||||
|
public string[] ValidValues { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Data describing the join. Can be
|
||||||
|
/// </summary>
|
||||||
|
public class JoinData
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Join number (based on join offset value)
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("joinNumber")]
|
||||||
|
public uint JoinNumber { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Join range span. If join indicates the start of a range of joins, this indicated the maximum number of joins in the range
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("joinSpan")]
|
||||||
|
public uint JoinSpan { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A class to aggregate the JoinData and JoinMetadata for a join
|
||||||
|
/// </summary>
|
||||||
|
public class JoinDataComplete
|
||||||
|
{
|
||||||
|
private uint _joinOffset;
|
||||||
|
|
||||||
|
private JoinData _data;
|
||||||
|
public JoinMetadata Metadata { get; set; }
|
||||||
|
|
||||||
|
public JoinDataComplete(JoinData data, JoinMetadata metadata)
|
||||||
|
{
|
||||||
|
_data = data;
|
||||||
|
Metadata = metadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the join offset value
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="joinOffset"></param>
|
||||||
|
public void SetJoinOffset(uint joinOffset)
|
||||||
|
{
|
||||||
|
_joinOffset = joinOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The join number (including the offset)
|
||||||
|
/// </summary>
|
||||||
|
public uint JoinNumber
|
||||||
|
{
|
||||||
|
get { return _data.JoinNumber+ _joinOffset; }
|
||||||
|
set { _data.JoinNumber = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public uint JoinSpan
|
||||||
|
{
|
||||||
|
get { return _data.JoinSpan; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetCustomJoinData(JoinData customJoinData)
|
||||||
|
{
|
||||||
|
_data = customJoinData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetNameAttribute(MemberInfo memberInfo)
|
||||||
|
{
|
||||||
|
var name = string.Empty;
|
||||||
|
var attribute = (JoinNameAttribute)CAttribute.GetCustomAttribute(memberInfo, typeof(JoinNameAttribute));
|
||||||
|
|
||||||
|
if (attribute == null) return name;
|
||||||
|
|
||||||
|
name = attribute.Name;
|
||||||
|
Debug.Console(2, "JoinName Attribute value: {0}", name);
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.All)]
|
||||||
|
public class JoinNameAttribute : CAttribute
|
||||||
|
{
|
||||||
|
private string _Name;
|
||||||
|
|
||||||
|
public JoinNameAttribute(string name)
|
||||||
|
{
|
||||||
|
Debug.Console(2, "Setting Attribute Name: {0}", name);
|
||||||
|
_Name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return _Name; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -136,7 +136,8 @@
|
|||||||
<Compile Include="Bridges\JoinMaps\DmTxControllerJoinMap.cs" />
|
<Compile Include="Bridges\JoinMaps\DmTxControllerJoinMap.cs" />
|
||||||
<Compile Include="Bridges\JoinMaps\GenericLightingJoinMap.cs" />
|
<Compile Include="Bridges\JoinMaps\GenericLightingJoinMap.cs" />
|
||||||
<Compile Include="Bridges\JoinMaps\GenericRelayControllerJoinMap.cs" />
|
<Compile Include="Bridges\JoinMaps\GenericRelayControllerJoinMap.cs" />
|
||||||
<Compile Include="Bridges\JoinMaps\GlsOccupancySensorBaseJoinMap.cs" />
|
<Compile Include="Bridges\JoinMaps\GlsOccupancySensorJoinMap.cs" />
|
||||||
|
<Compile Include="Bridges\JoinMaps\GlsPartitionSensorJoinMap.cs" />
|
||||||
<Compile Include="Bridges\JoinMaps\HdMdNxM4kEControllerJoinMap.cs" />
|
<Compile Include="Bridges\JoinMaps\HdMdNxM4kEControllerJoinMap.cs" />
|
||||||
<Compile Include="Bridges\JoinMaps\HdMdxxxCEControllerJoinMap.cs" />
|
<Compile Include="Bridges\JoinMaps\HdMdxxxCEControllerJoinMap.cs" />
|
||||||
<Compile Include="Bridges\JoinMaps\Hrxxx0WirelessRemoteControllerJoinMap.cs" />
|
<Compile Include="Bridges\JoinMaps\Hrxxx0WirelessRemoteControllerJoinMap.cs" />
|
||||||
|
|||||||
@@ -40,10 +40,10 @@ namespace PepperDash.Essentials.DM.AirMedia
|
|||||||
public StringFeedback SerialNumberFeedback { get; private set; }
|
public StringFeedback SerialNumberFeedback { get; private set; }
|
||||||
public BoolFeedback AutomaticInputRoutingEnabledFeedback { get; private set; }
|
public BoolFeedback AutomaticInputRoutingEnabledFeedback { get; private set; }
|
||||||
|
|
||||||
public AirMediaController(string key, string name, AmX00 device, DeviceConfig dc, AirMediaPropertiesConfig props)
|
public AirMediaController(string key, string name, AmX00 sensor, DeviceConfig dc, AirMediaPropertiesConfig props)
|
||||||
: base(key, name, device)
|
: base(key, name, sensor)
|
||||||
{
|
{
|
||||||
AirMedia = device;
|
AirMedia = sensor;
|
||||||
|
|
||||||
DeviceConfig = dc;
|
DeviceConfig = dc;
|
||||||
|
|
||||||
|
|||||||
@@ -29,10 +29,10 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs
|
|||||||
|
|
||||||
CrestronTouchpanelPropertiesConfig PropertiesConfig;
|
CrestronTouchpanelPropertiesConfig PropertiesConfig;
|
||||||
|
|
||||||
public Dge100Controller(string key, string name, Dge100 device, DeviceConfig dc, CrestronTouchpanelPropertiesConfig props)
|
public Dge100Controller(string key, string name, Dge100 sensor, DeviceConfig dc, CrestronTouchpanelPropertiesConfig props)
|
||||||
:base(key, name, device)
|
:base(key, name, sensor)
|
||||||
{
|
{
|
||||||
_dge = device;
|
_dge = sensor;
|
||||||
|
|
||||||
_dc = dc;
|
_dc = dc;
|
||||||
|
|
||||||
|
|||||||
@@ -40,10 +40,10 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs
|
|||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DmDge200CController(string key, string name, DmDge200C device, DeviceConfig dc, CrestronTouchpanelPropertiesConfig props)
|
public DmDge200CController(string key, string name, DmDge200C sensor, DeviceConfig dc, CrestronTouchpanelPropertiesConfig props)
|
||||||
: base(key, name, device, dc, props)
|
: base(key, name, sensor, dc, props)
|
||||||
{
|
{
|
||||||
_dge = device;
|
_dge = sensor;
|
||||||
|
|
||||||
DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo,
|
DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo,
|
||||||
eRoutingPortConnectionType.DmCat, 0, this);
|
eRoutingPortConnectionType.DmCat, 0, this);
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ namespace PepperDash.Essentials.DM
|
|||||||
public StringFeedback EdidPreferredTimingFeedback { get; protected set; }
|
public StringFeedback EdidPreferredTimingFeedback { get; protected set; }
|
||||||
public StringFeedback EdidSerialNumberFeedback { get; protected set; }
|
public StringFeedback EdidSerialNumberFeedback { get; protected set; }
|
||||||
|
|
||||||
protected DmRmcControllerBase(string key, string name, EndpointReceiverBase device)
|
protected DmRmcControllerBase(string key, string name, EndpointReceiverBase sensor)
|
||||||
: base(key, name, device)
|
: base(key, name, sensor)
|
||||||
{
|
{
|
||||||
_rmc = device;
|
_rmc = sensor;
|
||||||
// if wired to a chassis, skip registration step in base class
|
// if wired to a chassis, skip registration step in base class
|
||||||
PreventRegistration = _rmc.DMOutput != null;
|
PreventRegistration = _rmc.DMOutput != null;
|
||||||
|
|
||||||
|
|||||||
@@ -159,8 +159,8 @@ namespace PepperDash.Essentials.DM
|
|||||||
|
|
||||||
public abstract class BasicDmTxControllerBase : CrestronGenericBridgeableBaseDevice
|
public abstract class BasicDmTxControllerBase : CrestronGenericBridgeableBaseDevice
|
||||||
{
|
{
|
||||||
protected BasicDmTxControllerBase(string key, string name, GenericBase hardware)
|
protected BasicDmTxControllerBase(string key, string name, GenericBase sensor)
|
||||||
: base(key, name, hardware)
|
: base(key, name, sensor)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -177,18 +177,18 @@ namespace PepperDash.Essentials.DM
|
|||||||
public abstract StringFeedback ActiveVideoInputFeedback { get; protected set; }
|
public abstract StringFeedback ActiveVideoInputFeedback { get; protected set; }
|
||||||
public RoutingInputPortWithVideoStatuses AnyVideoInput { get; protected set; }
|
public RoutingInputPortWithVideoStatuses AnyVideoInput { get; protected set; }
|
||||||
|
|
||||||
protected DmTxControllerBase(string key, string name, EndpointTransmitterBase hardware)
|
protected DmTxControllerBase(string key, string name, EndpointTransmitterBase sensor)
|
||||||
: base(key, name, hardware)
|
: base(key, name, sensor)
|
||||||
{
|
{
|
||||||
// if wired to a chassis, skip registration step in base class
|
// if wired to a chassis, skip registration step in base class
|
||||||
if (hardware.DMInput != null)
|
if (sensor.DMInput != null)
|
||||||
{
|
{
|
||||||
this.PreventRegistration = true;
|
this.PreventRegistration = true;
|
||||||
}
|
}
|
||||||
AddToFeedbackList(ActiveVideoInputFeedback);
|
AddToFeedbackList(ActiveVideoInputFeedback);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DmTxControllerBase(string key, string name, DmHDBasedTEndPoint hardware) : base(key, name, hardware)
|
protected DmTxControllerBase(string key, string name, DmHDBasedTEndPoint sensor) : base(key, name, sensor)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,7 +224,7 @@ namespace PepperDash.Essentials.DM
|
|||||||
|
|
||||||
bool hdcpTypeSimple;
|
bool hdcpTypeSimple;
|
||||||
|
|
||||||
if (tx.Hardware is DmTx4kX02CBase)
|
if (tx.Sensor is DmTx4kX02CBase)
|
||||||
hdcpTypeSimple = false;
|
hdcpTypeSimple = false;
|
||||||
else
|
else
|
||||||
hdcpTypeSimple = true;
|
hdcpTypeSimple = true;
|
||||||
|
|||||||
@@ -116,6 +116,8 @@
|
|||||||
<Compile Include="ImageProcessors\TVOneCorioPropertiesConfig.cs" />
|
<Compile Include="ImageProcessors\TVOneCorioPropertiesConfig.cs" />
|
||||||
<Compile Include="Occupancy\CenOdtOccupancySensorBaseController.cs" />
|
<Compile Include="Occupancy\CenOdtOccupancySensorBaseController.cs" />
|
||||||
<Compile Include="Occupancy\GlsOdtOccupancySensorController.cs" />
|
<Compile Include="Occupancy\GlsOdtOccupancySensorController.cs" />
|
||||||
|
<Compile Include="PartitionSensor\GlsPartitionSensorController.cs" />
|
||||||
|
<Compile Include="PartitionSensor\GlsPartitionSensorControllerFactory.cs" />
|
||||||
<Compile Include="Power Controllers\Digitallogger.cs" />
|
<Compile Include="Power Controllers\Digitallogger.cs" />
|
||||||
<Compile Include="Power Controllers\DigitalLoggerPropertiesConfig.cs" />
|
<Compile Include="Power Controllers\DigitalLoggerPropertiesConfig.cs" />
|
||||||
<Compile Include="ImageProcessors\AnalogWay\AnalongWayLiveCore.cs" />
|
<Compile Include="ImageProcessors\AnalogWay\AnalongWayLiveCore.cs" />
|
||||||
|
|||||||
@@ -0,0 +1,253 @@
|
|||||||
|
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.GeneralIO;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
using PepperDash.Essentials.Core.Bridges;
|
||||||
|
using PepperDash_Essentials_Core.Bridges.JoinMaps;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Devices.Common.PartitionSensor
|
||||||
|
{
|
||||||
|
[Description("Wrapper class for GLS Cresnet Partition Sensor")]
|
||||||
|
public class GlsPartitionSensorController : CrestronGenericBridgeableBaseDevice
|
||||||
|
{
|
||||||
|
public GlsPartCn PartitionSensor { get; private set; }
|
||||||
|
|
||||||
|
public StringFeedback NameFeedback { get; private set; }
|
||||||
|
|
||||||
|
public BoolFeedback EnableFeedback { get; private set; }
|
||||||
|
|
||||||
|
public BoolFeedback PartitionSensedFeedback { get; private set; }
|
||||||
|
public BoolFeedback PartitionNotSensedFeedback { get; private set; }
|
||||||
|
|
||||||
|
public IntFeedback SensitivityFeedback { get; private set; }
|
||||||
|
|
||||||
|
public bool InTestMode { get; private set; }
|
||||||
|
public bool TestEnableFeedback { get; private set; }
|
||||||
|
public bool TestPartitionSensedFeedback { get; private set; }
|
||||||
|
public int TestSensitivityFeedback { get; private set; }
|
||||||
|
|
||||||
|
public Func<string> NameFeedbackFunc
|
||||||
|
{
|
||||||
|
get { return () => Name; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Func<bool> EnableFeedbackFunc
|
||||||
|
{
|
||||||
|
get { return () => InTestMode ? TestEnableFeedback : PartitionSensor.EnableFeedback.BoolValue; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Func<bool> PartitionSensedFeedbackFunc
|
||||||
|
{
|
||||||
|
get { return () => InTestMode ? TestPartitionSensedFeedback : PartitionSensor.PartitionSensedFeedback.BoolValue; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Func<bool> PartitionNotSensedFeedbackFunc
|
||||||
|
{
|
||||||
|
get { return () => InTestMode ? TestPartitionSensedFeedback : PartitionSensor.PartitionNotSensedFeedback.BoolValue; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Func<int> SensitivityFeedbackFunc
|
||||||
|
{
|
||||||
|
get { return () => InTestMode ? TestSensitivityFeedback : PartitionSensor.SensitivityFeedback.UShortValue; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="name"></param>
|
||||||
|
/// <param name="sensor"></param>
|
||||||
|
public GlsPartitionSensorController(string key, string name, GlsPartCn sensor)
|
||||||
|
: base(key, name, sensor)
|
||||||
|
{
|
||||||
|
PartitionSensor = sensor;
|
||||||
|
|
||||||
|
NameFeedback = new StringFeedback(NameFeedbackFunc);
|
||||||
|
EnableFeedback = new BoolFeedback(EnableFeedbackFunc);
|
||||||
|
PartitionSensedFeedback = new BoolFeedback(PartitionSensedFeedbackFunc);
|
||||||
|
PartitionNotSensedFeedback = new BoolFeedback(PartitionNotSensedFeedbackFunc);
|
||||||
|
SensitivityFeedback = new IntFeedback(SensitivityFeedbackFunc);
|
||||||
|
|
||||||
|
PartitionSensor.BaseEvent += PartitionSensor_BaseEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void PartitionSensor_BaseEvent(GenericBase device, BaseEventArgs args)
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "EventId: {0}, Index: {1}", args.EventId, args.Index);
|
||||||
|
|
||||||
|
switch (args.EventId)
|
||||||
|
{
|
||||||
|
case(GlsPartCn.EnableFeedbackEventId):
|
||||||
|
{
|
||||||
|
EnableFeedback.FireUpdate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(GlsPartCn.PartitionSensedFeedbackEventId):
|
||||||
|
{
|
||||||
|
PartitionSensedFeedback.FireUpdate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(GlsPartCn.PartitionNotSensedFeedbackEventId):
|
||||||
|
{
|
||||||
|
PartitionNotSensedFeedback.FireUpdate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(GlsPartCn.SensitivityFeedbackEventId):
|
||||||
|
{
|
||||||
|
SensitivityFeedback.FireUpdate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "args.EventId: {0}", args.EventId);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetTestMode(bool mode)
|
||||||
|
{
|
||||||
|
InTestMode = mode;
|
||||||
|
Debug.Console(1, this, "InTestMode: {0}", InTestMode.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetTestEnableState(bool state)
|
||||||
|
{
|
||||||
|
if (InTestMode)
|
||||||
|
{
|
||||||
|
TestEnableFeedback = state;
|
||||||
|
Debug.Console(1, this, "TestEnableFeedback: {0}", TestEnableFeedback.ToString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Console(1, this, "InTestMode: {0}, unable to set enable state: {1}", InTestMode.ToString(), state.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetTestPartitionSensedState(bool state)
|
||||||
|
{
|
||||||
|
if (InTestMode)
|
||||||
|
{
|
||||||
|
TestPartitionSensedFeedback = state;
|
||||||
|
Debug.Console(1, this, "TestPartitionSensedFeedback: {0}", TestPartitionSensedFeedback.ToString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Console(1, this, "InTestMode: {0}, unable to set partition state: {1}", InTestMode.ToString(), state.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetTestSensitivityValue(int value)
|
||||||
|
{
|
||||||
|
if (InTestMode)
|
||||||
|
{
|
||||||
|
TestSensitivityFeedback = value;
|
||||||
|
Debug.Console(1, this, "TestSensitivityFeedback: {0}", TestSensitivityFeedback);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Console(1, this, "InTestMode: {0}, unable to set sensitivity value: {1}", InTestMode.ToString(), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetEnableState(bool state)
|
||||||
|
{
|
||||||
|
if (PartitionSensor == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
PartitionSensor.Enable.BoolValue = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void IncreaseSensitivity()
|
||||||
|
{
|
||||||
|
if (PartitionSensor == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
PartitionSensor.IncreaseSensitivity();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DecreaseSensitivity()
|
||||||
|
{
|
||||||
|
if (PartitionSensor == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
PartitionSensor.DecreaseSensitivity();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetSensitivity(ushort value)
|
||||||
|
{
|
||||||
|
if (PartitionSensor == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
PartitionSensor.Sensitivity.UShortValue = (ushort)value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||||
|
{
|
||||||
|
var joinMap = new GlsPartitionSensorJoinMap(joinStart);
|
||||||
|
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||||
|
joinMap = JsonConvert.DeserializeObject<GlsPartitionSensorJoinMap>(joinMapSerialized);
|
||||||
|
|
||||||
|
if (bridge != null)
|
||||||
|
{
|
||||||
|
bridge.AddJoinMap(Key, joinMap);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Console(0, this, "Please update config to use 'type': 'EiscApiAdvanced' to get all join map features for this device");
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
Debug.Console(0, this, "Linking to Bridge Type {0}", GetType().Name);
|
||||||
|
|
||||||
|
// link input from simpl
|
||||||
|
trilist.SetSigTrueAction(joinMap.Enable.JoinNumber, () => SetEnableState(true));
|
||||||
|
trilist.SetSigFalseAction(joinMap.Enable.JoinNumber, () => SetEnableState(false));
|
||||||
|
trilist.SetSigTrueAction(joinMap.IncreaseSensitivity.JoinNumber, IncreaseSensitivity);
|
||||||
|
trilist.SetSigTrueAction(joinMap.DecreaseSensitivity.JoinNumber, DecreaseSensitivity);
|
||||||
|
trilist.SetUShortSigAction(joinMap.Sensitivity.JoinNumber, SetSensitivity);
|
||||||
|
|
||||||
|
// link output to simpl
|
||||||
|
IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
|
||||||
|
EnableFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Enable.JoinNumber]);
|
||||||
|
PartitionSensedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PartitionSensed.JoinNumber]);
|
||||||
|
PartitionNotSensedFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PartitionNotSensed.JoinNumber]);
|
||||||
|
SensitivityFeedback.LinkInputSig(trilist.UShortInput[joinMap.Sensitivity.JoinNumber]);
|
||||||
|
|
||||||
|
PartitionSensor.OnlineStatusChange += (o, a) =>
|
||||||
|
{
|
||||||
|
if (a.DeviceOnLine)
|
||||||
|
{
|
||||||
|
FeedbacksFireUpdates();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
trilist.OnlineStatusChange += (o, a) =>
|
||||||
|
{
|
||||||
|
if (a.DeviceOnLine)
|
||||||
|
{
|
||||||
|
FeedbacksFireUpdates();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FeedbacksFireUpdates()
|
||||||
|
{
|
||||||
|
IsOnline.FireUpdate();
|
||||||
|
NameFeedback.FireUpdate();
|
||||||
|
EnableFeedback.FireUpdate();
|
||||||
|
PartitionSensedFeedback.FireUpdate();
|
||||||
|
PartitionNotSensedFeedback.FireUpdate();
|
||||||
|
SensitivityFeedback.FireUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.GeneralIO;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
using PepperDash.Essentials.Devices.Common.Occupancy;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Devices.Common.PartitionSensor
|
||||||
|
{
|
||||||
|
public class GlsPartitionSensorControllerFactory : EssentialsDeviceFactory<GlsPartitionSensorController>
|
||||||
|
{
|
||||||
|
public GlsPartitionSensorControllerFactory()
|
||||||
|
{
|
||||||
|
TypeNames = new List<string>() { "glspartcn" };
|
||||||
|
}
|
||||||
|
|
||||||
|
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||||
|
{
|
||||||
|
Debug.Console(2, "Factory Attempting to create new GLS-PART-CN Device");
|
||||||
|
|
||||||
|
var typeName = dc.Type.ToLower();
|
||||||
|
var key = dc.Key;
|
||||||
|
var name = dc.Name;
|
||||||
|
var comm = CommFactory.GetControlPropertiesConfig(dc);
|
||||||
|
if (comm == null)
|
||||||
|
{
|
||||||
|
Debug.Console(0, "ERROR: Control Properties Config are null");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var sensor = new GlsPartCn(comm.CresnetIdInt, Global.ControlSystem);
|
||||||
|
return new GlsPartitionSensorController(dc.Key, dc.Name, sensor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user