mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-14 12:15:01 +00:00
started support for 3-Series cards
This commit is contained in:
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user