ECS-1245 Added C2nRths Controller and Bridge

This commit is contained in:
Andrew Welker
2020-01-23 13:02:42 -07:00
parent 8f530aa7fe
commit 09bc84346d
7 changed files with 128 additions and 1 deletions

View File

@@ -0,0 +1,39 @@
using System.Linq;
using Crestron.SimplSharp.Reflection;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Bridges
{
public class C2nRthsControllerJoinMap:JoinMapBase
{
public uint IsOnline { get; set; }
public uint Temperature { get; set; }
public uint Humidity { get; set; }
public uint TemperatureFormat { get; set; }
public C2nRthsControllerJoinMap(uint joinStart)
{
//digital
IsOnline = 1;
TemperatureFormat = 2;
//Analog
Temperature = 2;
Humidity = 3;
OffsetJoinNumbers(joinStart);
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
var properties =
GetType().GetCType().GetProperties().Where(p => p.PropertyType == typeof(uint)).ToList();
foreach (var propertyInfo in properties)
{
propertyInfo.SetValue(this, (uint)propertyInfo.GetValue(this, null) + joinOffset, null);
}
}
}
}