From 124ec9586db4e37a7b1fee0ffa543d19fe119970 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 17 Jun 2020 12:04:49 -0600 Subject: [PATCH] started support for 3-Series cards --- .../Crestron IO/Cards/C3CardControllerBase.cs | 16 +++++ .../Crestron IO/Cards/C3Com3Controller.cs | 37 +++++++++++ .../Crestron IO/Cards/CenCi31Controller.cs | 65 +++++++++++++++++++ 3 files changed, 118 insertions(+) create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3CardControllerBase.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Com3Controller.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/CenCi31Controller.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3CardControllerBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3CardControllerBase.cs new file mode 100644 index 00000000..cb9667cf --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3CardControllerBase.cs @@ -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; + } + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Com3Controller.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Com3Controller.cs new file mode 100644 index 00000000..9e649a52 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Com3Controller.cs @@ -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 ComPorts + { + get { return _card.ComPorts; } + } + + public int NumberOfComPorts + { + get { return _card.NumberOfComPorts; } + } + + #endregion + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/CenCi31Controller.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/CenCi31Controller.cs new file mode 100644 index 00000000..0c16e876 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/CenCi31Controller.cs @@ -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> _cardDict; + + public CenCi31Controller(string key, string name, DeviceConfig config, CenCi31 hardware) : base(key, name, hardware) + { + _cardCage = hardware; + _config = config.Properties.ToObject(); + + _cardDict = new Dictionary> + { + { + "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 Cards { get; set; } + } +} \ No newline at end of file