mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-14 21:14:56 +00:00
Compare commits
6 Commits
feature/Ge
...
1.5.6-alph
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7e46cdad1 | ||
|
|
8238f7dba1 | ||
|
|
19199f5867 | ||
|
|
b341aa7135 | ||
|
|
3aa4ba5654 | ||
|
|
124ec9586d |
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using Crestron.SimplSharpProInternal;
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
||||
{
|
||||
public class C3CardControllerBase:CrestronGenericBaseDevice
|
||||
{
|
||||
private readonly C3Card _card;
|
||||
|
||||
public C3CardControllerBase(string key, string name, C3Card hardware) : base(key, name, hardware)
|
||||
{
|
||||
_card = hardware;
|
||||
}
|
||||
|
||||
#region Overrides of Object
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("{0} {1}", Key, _card.ToString());
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.ThreeSeriesCards;
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO.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,29 @@
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.ThreeSeriesCards;
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
||||
{
|
||||
public class C3Io16Controller:C3CardControllerBase,IIOPorts
|
||||
{
|
||||
private readonly C3io16 _card;
|
||||
|
||||
public C3Io16Controller(string key, string name, C3io16 hardware) : base(key, name, hardware)
|
||||
{
|
||||
_card = hardware;
|
||||
}
|
||||
|
||||
#region Implementation of IIOPorts
|
||||
|
||||
public CrestronCollection<Versiport> VersiPorts
|
||||
{
|
||||
get { return _card.VersiPorts; }
|
||||
}
|
||||
|
||||
public int NumberOfVersiPorts
|
||||
{
|
||||
get { return _card.NumberOfVersiPorts; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.ThreeSeriesCards;
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
||||
{
|
||||
public class C3Ir8Controller:C3CardControllerBase, IIROutputPorts
|
||||
{
|
||||
private readonly C3ir8 _card;
|
||||
|
||||
public C3Ir8Controller(string key, string name, C3ir8 hardware) : base(key, name, hardware)
|
||||
{
|
||||
_card = hardware;
|
||||
}
|
||||
|
||||
#region Implementation of IIROutputPorts
|
||||
|
||||
public CrestronCollection<IROutputPort> IROutputPorts
|
||||
{
|
||||
get { return _card.IROutputPorts; }
|
||||
}
|
||||
|
||||
public int NumberOfIROutputPorts
|
||||
{
|
||||
get { return _card.NumberOfIROutputPorts; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.ThreeSeriesCards;
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
||||
{
|
||||
public class C3Ry16Controller:C3CardControllerBase, IRelayPorts
|
||||
{
|
||||
private readonly C3ry16 _card;
|
||||
|
||||
public C3Ry16Controller(string key, string name, C3ry16 hardware) : base(key, name, hardware)
|
||||
{
|
||||
_card = hardware;
|
||||
}
|
||||
|
||||
#region Implementation of IRelayPorts
|
||||
|
||||
public CrestronCollection<Relay> RelayPorts
|
||||
{
|
||||
get { return _card.RelayPorts; }
|
||||
}
|
||||
|
||||
public int NumberOfRelayPorts
|
||||
{
|
||||
get { return _card.NumberOfRelayPorts; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.ThreeSeriesCards;
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
||||
{
|
||||
public class C3Ry8Controller:C3CardControllerBase, IRelayPorts
|
||||
{
|
||||
private readonly C3ry8 _card;
|
||||
|
||||
public C3Ry8Controller(string key, string name, C3ry8 hardware) : base(key, name, hardware)
|
||||
{
|
||||
_card = hardware;
|
||||
}
|
||||
|
||||
#region Implementation of IRelayPorts
|
||||
|
||||
public CrestronCollection<Relay> RelayPorts
|
||||
{
|
||||
get { return _card.RelayPorts; }
|
||||
}
|
||||
|
||||
public int NumberOfRelayPorts
|
||||
{
|
||||
get { return _card.NumberOfRelayPorts; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharpPro.ThreeSeriesCards;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
||||
{
|
||||
public class CenCi31Controller : CrestronGenericBaseDevice
|
||||
{
|
||||
private const string CardKeyTemplate = "{0}-card";
|
||||
private const string CardNameTemplate = "{0}:{1}:{2}";
|
||||
private const uint CardSlot = 1;
|
||||
private readonly CenCi31 _cardCage;
|
||||
private readonly CenCi31Configuration _config;
|
||||
|
||||
private readonly Dictionary<string, Func<CenCi31, uint, C3CardControllerBase>> _cardDict;
|
||||
|
||||
public CenCi31Controller(string key, string name, CenCi31Configuration config, CenCi31 hardware) : base(key, name, hardware)
|
||||
{
|
||||
_cardCage = hardware;
|
||||
|
||||
_config = config;
|
||||
|
||||
_cardDict = new Dictionary<string, Func<CenCi31, uint, C3CardControllerBase>>
|
||||
{
|
||||
{
|
||||
"c3com3",
|
||||
(c, s) =>
|
||||
new C3Com3Controller(String.Format(CardKeyTemplate, key),
|
||||
String.Format(CardNameTemplate, key, s, "C3Com3"), new C3com3(_cardCage))
|
||||
},
|
||||
{
|
||||
"c3io16",
|
||||
(c, s) =>
|
||||
new C3Io16Controller(String.Format(CardKeyTemplate, key),
|
||||
String.Format(CardNameTemplate, key, s,"C3Io16"), new C3io16(_cardCage))
|
||||
},
|
||||
{
|
||||
"c3ir8",
|
||||
(c, s) =>
|
||||
new C3Ir8Controller(String.Format(CardKeyTemplate, key),
|
||||
String.Format(CardNameTemplate, key, s, "C3Ir8"), new C3ir8(_cardCage))
|
||||
},
|
||||
{
|
||||
"c3ry16",
|
||||
(c, s) =>
|
||||
new C3Ry16Controller(String.Format(CardKeyTemplate, key),
|
||||
String.Format(CardNameTemplate, key, s, "C3Ry16"), new C3ry16(_cardCage))
|
||||
},
|
||||
{
|
||||
"c3ry8",
|
||||
(c, s) =>
|
||||
new C3Ry8Controller(String.Format(CardKeyTemplate, key),
|
||||
String.Format(CardNameTemplate, key, s, "C3Ry8"), new C3ry8(_cardCage))
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
GetCards();
|
||||
}
|
||||
|
||||
private void GetCards()
|
||||
{
|
||||
Func<CenCi31, uint, C3CardControllerBase> cardBuilder;
|
||||
|
||||
if (String.IsNullOrEmpty(_config.Card))
|
||||
{
|
||||
Debug.Console(0, this, "No card specified");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_cardDict.TryGetValue(_config.Card.ToLower(), out cardBuilder))
|
||||
{
|
||||
Debug.Console(0, "Unable to find factory for 3-Series card type {0}.", _config.Card);
|
||||
return;
|
||||
}
|
||||
|
||||
var device = cardBuilder(_cardCage, CardSlot);
|
||||
|
||||
DeviceManager.AddDevice(device);
|
||||
}
|
||||
}
|
||||
|
||||
public class CenCi31Configuration
|
||||
{
|
||||
[JsonProperty("card")]
|
||||
public string Card { get; set; }
|
||||
}
|
||||
|
||||
public class CenCi31ControllerFactory : EssentialsDeviceFactory<CenCi31Controller>
|
||||
{
|
||||
public CenCi31ControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string> {"cenci31"};
|
||||
}
|
||||
#region Overrides of EssentialsDeviceFactory<CenCi31Controller>
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory attempting to build new CEN-CI-1");
|
||||
|
||||
var controlProperties = CommFactory.GetControlPropertiesConfig(dc);
|
||||
var ipId = controlProperties.IpIdInt;
|
||||
|
||||
var cardCage = new CenCi31(ipId, Global.ControlSystem);
|
||||
var config = dc.Properties.ToObject<CenCi31Configuration>();
|
||||
|
||||
return new CenCi31Controller(dc.Key, dc.Name, config, cardCage);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharpPro.ThreeSeriesCards;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO.Cards
|
||||
{
|
||||
public class CenCi33Controller : CrestronGenericBaseDevice
|
||||
{
|
||||
private const string CardKeyTemplate = "{0}-card{1}";
|
||||
private const string CardNameTemplate = "{0}:{1}:{2}";
|
||||
private const uint CardSlots = 3;
|
||||
private readonly CenCi33 _cardCage;
|
||||
private readonly CenCi33Configuration _config;
|
||||
|
||||
private readonly Dictionary<string, Func<CenCi33, uint, C3CardControllerBase>> _cardDict;
|
||||
|
||||
public CenCi33Controller(string key, string name, CenCi33Configuration config, CenCi33 hardware) : base(key, name, hardware)
|
||||
{
|
||||
_cardCage = hardware;
|
||||
|
||||
_config = config;
|
||||
|
||||
_cardDict = new Dictionary<string, Func<CenCi33, uint, C3CardControllerBase>>
|
||||
{
|
||||
{
|
||||
"c3com3",
|
||||
(c, s) =>
|
||||
new C3Com3Controller(String.Format(CardKeyTemplate, key, s),
|
||||
String.Format(CardNameTemplate, key, s, "C3Com3"), new C3com3(s,_cardCage))
|
||||
},
|
||||
{
|
||||
"c3io16",
|
||||
(c, s) =>
|
||||
new C3Io16Controller(String.Format(CardKeyTemplate, key, s),
|
||||
String.Format(CardNameTemplate, key, s, "C3Io16"), new C3io16(s,_cardCage))
|
||||
},
|
||||
{
|
||||
"c3ir8",
|
||||
(c, s) =>
|
||||
new C3Ir8Controller(String.Format(CardKeyTemplate, key, s),
|
||||
String.Format(CardNameTemplate, key, s, "C3Ir8"), new C3ir8(s,_cardCage))
|
||||
},
|
||||
{
|
||||
"c3ry16",
|
||||
(c, s) =>
|
||||
new C3Ry16Controller(String.Format(CardKeyTemplate, key, s),
|
||||
String.Format(CardNameTemplate, key, s, "C3Ry16"), new C3ry16(s,_cardCage))
|
||||
},
|
||||
{
|
||||
"c3ry8",
|
||||
(c, s) =>
|
||||
new C3Ry8Controller(String.Format(CardKeyTemplate, key, s),
|
||||
String.Format(CardNameTemplate, key, s, "C3Ry8"), new C3ry8(s,_cardCage))
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
GetCards();
|
||||
}
|
||||
|
||||
private void GetCards()
|
||||
{
|
||||
if (_config.Cards == null)
|
||||
{
|
||||
Debug.Console(0, this, "No card configuration for this device found");
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint i = 1; i <= CardSlots; i++)
|
||||
{
|
||||
string cardType;
|
||||
if (!_config.Cards.TryGetValue(i, out cardType))
|
||||
{
|
||||
Debug.Console(1, this, "No card found for slot {0}", i);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(cardType))
|
||||
{
|
||||
Debug.Console(0, this, "No card specified for slot {0}", i);
|
||||
return;
|
||||
}
|
||||
|
||||
Func<CenCi33, uint, C3CardControllerBase> cardBuilder;
|
||||
if (!_cardDict.TryGetValue(cardType.ToLower(), out cardBuilder))
|
||||
{
|
||||
Debug.Console(0, "Unable to find factory for 3-Series card type {0}.", cardType);
|
||||
return;
|
||||
}
|
||||
|
||||
var device = cardBuilder(_cardCage, i);
|
||||
|
||||
DeviceManager.AddDevice(device);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class CenCi33Configuration
|
||||
{
|
||||
[JsonProperty("cards")]
|
||||
public Dictionary<uint, string> Cards { get; set; }
|
||||
}
|
||||
|
||||
public class CenCi33ControllerFactory : EssentialsDeviceFactory<CenCi33Controller>
|
||||
{
|
||||
public CenCi33ControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string> {"cenci33"};
|
||||
}
|
||||
#region Overrides of EssentialsDeviceFactory<CenCi33Controller>
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory attempting to build new CEN-CI-3");
|
||||
|
||||
var controlProperties = CommFactory.GetControlPropertiesConfig(dc);
|
||||
var ipId = controlProperties.IpIdInt;
|
||||
|
||||
var cardCage = new CenCi33(ipId, Global.ControlSystem);
|
||||
var config = dc.Properties.ToObject<CenCi33Configuration>();
|
||||
|
||||
return new CenCi33Controller(dc.Key, dc.Name, config, cardCage);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -103,7 +103,7 @@ namespace PepperDash.Essentials.Core
|
||||
// Check for types that have been added by plugin dlls.
|
||||
if (FactoryMethods.ContainsKey(typeName))
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loading '{0}' from plugin", dc.Type);
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loading '{0}' from Essentials Core", dc.Type);
|
||||
return FactoryMethods[typeName].FactoryMethod(dc);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,6 +74,10 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Remotes.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Crestron.SimplSharpPro.ThreeSeriesCards, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.ThreeSeriesCards.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Crestron.SimplSharpPro.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll</HintPath>
|
||||
@@ -156,6 +160,16 @@
|
||||
<Compile Include="Config\Essentials\EssentialsConfig.cs" />
|
||||
<Compile Include="Config\SourceDevicePropertiesConfigBase.cs" />
|
||||
<Compile Include="Crestron IO\C2nRts\C2nRthsController.cs" />
|
||||
<Compile Include="Crestron IO\Cards\C3CardControllerBase.cs" />
|
||||
<Compile Include="Crestron IO\Cards\C3Com3Controller.cs" />
|
||||
<Compile Include="Crestron IO\Cards\C3Io16Controller.cs" />
|
||||
<Compile Include="Crestron IO\Cards\C3Ir8Controller.cs" />
|
||||
<Compile Include="Crestron IO\Cards\C3Ry16Controller.cs" />
|
||||
<Compile Include="Crestron IO\Cards\C3Ry8Controller.cs" />
|
||||
<Compile Include="Crestron IO\Cards\CenCi31Controller.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Crestron IO\Cards\CenCi33Controller.cs" />
|
||||
<Compile Include="Crestron IO\Inputs\CenIoDigIn104Controller.cs" />
|
||||
<Compile Include="Crestron IO\Inputs\GenericDigitalInputDevice.cs" />
|
||||
<Compile Include="Crestron IO\Inputs\GenericVersiportInputDevice.cs" />
|
||||
|
||||
Reference in New Issue
Block a user