started support for 3-Series cards

This commit is contained in:
Andrew Welker
2020-06-17 12:04:49 -06:00
parent 514fe466fd
commit 124ec9586d
3 changed files with 118 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
using Crestron.SimplSharpPro;
using Crestron.SimplSharpProInternal;
using PepperDash.Essentials.Core;
namespace PepperDash_Essentials_Core.Crestron_IO.Cards
{
public class C3CardControllerBase:CrestronGenericBaseDevice
{
private C3Card _card;
public C3CardControllerBase(string key, string name, C3Card hardware) : base(key, name, hardware)
{
_card = hardware;
}
}
}

View File

@@ -0,0 +1,37 @@
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.ThreeSeriesCards;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
namespace PepperDash_Essentials_Core.Crestron_IO.Cards
{
public class C3Com3Controller:C3CardControllerBase, IComPorts
{
private readonly C3com3 _card;
public C3Com3Controller(string key, string name, C3com3 hardware) : base(key, name, hardware)
{
_card = hardware;
}
#region Implementation of IComPorts
public CrestronCollection<ComPort> ComPorts
{
get { return _card.ComPorts; }
}
public int NumberOfComPorts
{
get { return _card.NumberOfComPorts; }
}
#endregion
}
}

View File

@@ -0,0 +1,65 @@
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.ThreeSeriesCards;
using Crestron.SimplSharpProInternal;
using Newtonsoft.Json;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
namespace PepperDash_Essentials_Core.Crestron_IO.Cards
{
public class CenCi31Controller :CrestronGenericBridgeableBaseDevice
{
private const string CardKeyTemplate = "{0}-card{1}";
private readonly CenCi31 _cardCage;
private CenCi3Configuration _config;
private Dictionary<string, Func<CenCi31, uint, C3CardControllerBase>> _cardDict;
public CenCi31Controller(string key, string name, DeviceConfig config, CenCi31 hardware) : base(key, name, hardware)
{
_cardCage = hardware;
_config = config.Properties.ToObject<CenCi3Configuration>();
_cardDict = new Dictionary<string, Func<CenCi31, uint, C3CardControllerBase>>
{
{
"c3com3",
(c, s) =>
new C3Com3Controller(String.Format(CardKeyTemplate, key, s),
String.Format(CardKeyTemplate, key, s), new C3com3(_cardCage))
},
};
}
private void GetCards()
{
foreach (var card in _config.Cards)
{
}
}
#region Overrides of CrestronGenericBridgeableBaseDevice
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
throw new NotImplementedException();
}
#endregion
}
public class CenCi3Configuration
{
[JsonProperty("cards")]
public Dictionary<uint, string> Cards { get; set; }
}
}