mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 12:44:58 +00:00
Created a device for TVOneCorio with online status and preset recall/FB
Created a temp bridge for EiscApi
This commit is contained in:
@@ -1,75 +1,80 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core.Routing;
|
using PepperDash.Essentials.Core.Routing;
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.EthernetCommunication;
|
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||||
|
|
||||||
namespace PepperDash.Essentials {
|
namespace PepperDash.Essentials {
|
||||||
public class BridgeFactory {
|
public class BridgeFactory {
|
||||||
public static IKeyed GetDevice(PepperDash.Essentials.Core.Config.DeviceConfig dc) {
|
public static IKeyed GetDevice(PepperDash.Essentials.Core.Config.DeviceConfig dc) {
|
||||||
// ? why is this static JTA 2018-06-13?
|
// ? why is this static JTA 2018-06-13?
|
||||||
|
|
||||||
var key = dc.Key;
|
var key = dc.Key;
|
||||||
var name = dc.Name;
|
var name = dc.Name;
|
||||||
var type = dc.Type;
|
var type = dc.Type;
|
||||||
var properties = dc.Properties;
|
var properties = dc.Properties;
|
||||||
var propAnon = new { };
|
var propAnon = new { };
|
||||||
JsonConvert.DeserializeAnonymousType(dc.Properties.ToString(), propAnon);
|
JsonConvert.DeserializeAnonymousType(dc.Properties.ToString(), propAnon);
|
||||||
|
|
||||||
var typeName = dc.Type.ToLower();
|
var typeName = dc.Type.ToLower();
|
||||||
var groupName = dc.Group.ToLower();
|
var groupName = dc.Group.ToLower();
|
||||||
|
|
||||||
Debug.Console(0, "Name {0}, Key {1}, Type {2}, Properties {3}", name, key, type, properties.ToString());
|
Debug.Console(0, "Name {0}, Key {1}, Type {2}, Properties {3}", name, key, type, properties.ToString());
|
||||||
if (typeName == "essentialdm")
|
if (typeName == "essentialdm")
|
||||||
{
|
{
|
||||||
return new EssentialDM(key, name, properties);
|
return new EssentialDM(key, name, properties);
|
||||||
}
|
}
|
||||||
else if (typeName == "essentialcomm")
|
else if (typeName == "essentialcomm")
|
||||||
{
|
{
|
||||||
Debug.Console(0, "Launch Essential Comm");
|
Debug.Console(0, "Launch Essential Comm");
|
||||||
return new EssentialComm(key, name, properties);
|
return new EssentialComm(key, name, properties);
|
||||||
}
|
}
|
||||||
else if (typeName == "essentialdsp")
|
else if (typeName == "essentialdsp")
|
||||||
{
|
{
|
||||||
Debug.Console(0, "Launch EssentialDsp");
|
Debug.Console(0, "Launch EssentialDsp");
|
||||||
return new EssentialDsp(key, name, properties);
|
return new EssentialDsp(key, name, properties);
|
||||||
}
|
}
|
||||||
return null;
|
else if (typeName == "essentialstvone")
|
||||||
}
|
{
|
||||||
}
|
Debug.Console(0, "Launch essentialstvone");
|
||||||
public class BridgeApiEisc {
|
return new EssentialsTVOne(key, name, properties);
|
||||||
public uint Ipid;
|
}
|
||||||
public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc;
|
return null;
|
||||||
public BridgeApiEisc(string ipid) {
|
}
|
||||||
Ipid = (UInt32)int.Parse(ipid, System.Globalization.NumberStyles.HexNumber);
|
}
|
||||||
Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(Ipid, "127.0.0.2", Global.ControlSystem);
|
public class BridgeApiEisc {
|
||||||
Eisc.Register();
|
public uint Ipid;
|
||||||
Eisc.SigChange += Eisc_SigChange;
|
public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc;
|
||||||
Debug.Console(0, "BridgeApiEisc Created at Ipid {0}", ipid);
|
public BridgeApiEisc(string ipid) {
|
||||||
}
|
Ipid = (UInt32)int.Parse(ipid, System.Globalization.NumberStyles.HexNumber);
|
||||||
void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args) {
|
Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(Ipid, "127.0.0.2", Global.ControlSystem);
|
||||||
if (Debug.Level >= 1)
|
Eisc.Register();
|
||||||
Debug.Console(2, "DDVC EISC change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
Eisc.SigChange += Eisc_SigChange;
|
||||||
var uo = args.Sig.UserObject;
|
Debug.Console(0, "BridgeApiEisc Created at Ipid {0}", ipid);
|
||||||
if (uo is Action<bool>)
|
}
|
||||||
(uo as Action<bool>)(args.Sig.BoolValue);
|
void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args) {
|
||||||
else if (uo is Action<ushort>)
|
if (Debug.Level >= 1)
|
||||||
(uo as Action<ushort>)(args.Sig.UShortValue);
|
Debug.Console(2, "DDVC EISC change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
||||||
else if (uo is Action<string>)
|
var uo = args.Sig.UserObject;
|
||||||
(uo as Action<string>)(args.Sig.StringValue);
|
if (uo is Action<bool>)
|
||||||
}
|
(uo as Action<bool>)(args.Sig.BoolValue);
|
||||||
}
|
else if (uo is Action<ushort>)
|
||||||
|
(uo as Action<ushort>)(args.Sig.UShortValue);
|
||||||
}
|
else if (uo is Action<string>)
|
||||||
|
(uo as Action<string>)(args.Sig.StringValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,140 +1,140 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
using PepperDash.Essentials.DM;
|
using PepperDash.Essentials.DM;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core.Routing;
|
using PepperDash.Essentials.Core.Routing;
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.EthernetCommunication;
|
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||||
using Crestron.SimplSharpPro.DM;
|
using Crestron.SimplSharpPro.DM;
|
||||||
|
|
||||||
namespace PepperDash.Essentials {
|
namespace PepperDash.Essentials {
|
||||||
public class EssentialDM : PepperDash.Core.Device {
|
public class EssentialDM : PepperDash.Core.Device {
|
||||||
public EssentialDMProperties Properties;
|
public EssentialDMProperties Properties;
|
||||||
public List<BridgeApiEisc> BridgeApiEiscs;
|
public List<BridgeApiEisc> BridgeApiEiscs;
|
||||||
private PepperDash.Essentials.DM.DmChassisController DmSwitch;
|
private PepperDash.Essentials.DM.DmChassisController DmSwitch;
|
||||||
private EssentialDMApiMap ApiMap = new EssentialDMApiMap();
|
private EssentialDMApiMap ApiMap = new EssentialDMApiMap();
|
||||||
public EssentialDM(string key, string name, JToken properties)
|
public EssentialDM(string key, string name, JToken properties)
|
||||||
: base(key, name) {
|
: base(key, name) {
|
||||||
Properties = JsonConvert.DeserializeObject<EssentialDMProperties>(properties.ToString());
|
Properties = JsonConvert.DeserializeObject<EssentialDMProperties>(properties.ToString());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public override bool CustomActivate() {
|
public override bool CustomActivate() {
|
||||||
// Create EiscApis
|
// Create EiscApis
|
||||||
try {
|
try {
|
||||||
foreach (var device in DeviceManager.AllDevices) {
|
foreach (var device in DeviceManager.AllDevices) {
|
||||||
if (device.Key == this.Properties.connectionDeviceKey) {
|
if (device.Key == this.Properties.connectionDeviceKey) {
|
||||||
Debug.Console(2, "deviceKey {0} Matches", device.Key);
|
Debug.Console(2, "deviceKey {0} Matches", device.Key);
|
||||||
DmSwitch = DeviceManager.GetDeviceForKey(device.Key) as PepperDash.Essentials.DM.DmChassisController;
|
DmSwitch = DeviceManager.GetDeviceForKey(device.Key) as PepperDash.Essentials.DM.DmChassisController;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
else {
|
else {
|
||||||
Debug.Console(2, "deviceKey {0} doesn't match", device.Key);
|
Debug.Console(2, "deviceKey {0} doesn't match", device.Key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Properties.EiscApiIpids != null) {
|
if (Properties.EiscApiIpids != null) {
|
||||||
|
|
||||||
|
|
||||||
foreach (string Ipid in Properties.EiscApiIpids) {
|
foreach (string Ipid in Properties.EiscApiIpids) {
|
||||||
var ApiEisc = new BridgeApiEisc(Ipid);
|
var ApiEisc = new BridgeApiEisc(Ipid);
|
||||||
for (uint x = 1; x <= DmSwitch.Chassis.NumberOfInputs;x++ ) {
|
for (uint x = 1; x <= DmSwitch.Chassis.NumberOfInputs;x++ ) {
|
||||||
uint tempX = x;
|
uint tempX = x;
|
||||||
Debug.Console(2, "Creating EiscActions {0}", tempX);
|
Debug.Console(2, "Creating EiscActions {0}", tempX);
|
||||||
|
|
||||||
|
|
||||||
ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputVideoRoutes[tempX], u => DmSwitch.ExecuteSwitch(u, tempX, eRoutingSignalType.Video));
|
ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputVideoRoutes[tempX], u => DmSwitch.ExecuteSwitch(u, tempX, eRoutingSignalType.Video));
|
||||||
ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputAudioRoutes[tempX], u => DmSwitch.ExecuteSwitch(u, tempX, eRoutingSignalType.Audio));
|
ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputAudioRoutes[tempX], u => DmSwitch.ExecuteSwitch(u, tempX, eRoutingSignalType.Audio));
|
||||||
|
|
||||||
if (DmSwitch.TxDictionary.ContainsKey(tempX)) {
|
if (DmSwitch.TxDictionary.ContainsKey(tempX)) {
|
||||||
Debug.Console(2, "Creating Tx Feedbacks {0}", tempX);
|
Debug.Console(2, "Creating Tx Feedbacks {0}", tempX);
|
||||||
var TxKey = DmSwitch.TxDictionary[tempX];
|
var TxKey = DmSwitch.TxDictionary[tempX];
|
||||||
var TxDevice = DeviceManager.GetDeviceForKey(TxKey) as DmTxControllerBase;
|
var TxDevice = DeviceManager.GetDeviceForKey(TxKey) as DmTxControllerBase;
|
||||||
TxDevice.IsOnline.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.TxOnlineStatus[tempX]]);
|
TxDevice.IsOnline.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.TxOnlineStatus[tempX]]);
|
||||||
TxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.TxVideoSyncStatus[tempX]]);
|
TxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.TxVideoSyncStatus[tempX]]);
|
||||||
ApiEisc.Eisc.SetUShortSigAction(901, u => TxDevice.SetHdcpSupport((eHdcpSupportMode)(u)));
|
ApiEisc.Eisc.SetUShortSigAction(901, u => TxDevice.SetHdcpSupport((eHdcpSupportMode)(u)));
|
||||||
} else {
|
} else {
|
||||||
DmSwitch.VideoInputSyncFeedbacks[tempX].LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.TxVideoSyncStatus[tempX]]);
|
DmSwitch.VideoInputSyncFeedbacks[tempX].LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.TxVideoSyncStatus[tempX]]);
|
||||||
}
|
}
|
||||||
if (DmSwitch.RxDictionary.ContainsKey(tempX)) {
|
if (DmSwitch.RxDictionary.ContainsKey(tempX)) {
|
||||||
Debug.Console(2, "Creating Rx Feedbacks {0}", tempX);
|
Debug.Console(2, "Creating Rx Feedbacks {0}", tempX);
|
||||||
var RxKey = DmSwitch.RxDictionary[tempX];
|
var RxKey = DmSwitch.RxDictionary[tempX];
|
||||||
var RxDevice = DeviceManager.GetDeviceForKey(RxKey) as DmRmcControllerBase;
|
var RxDevice = DeviceManager.GetDeviceForKey(RxKey) as DmRmcControllerBase;
|
||||||
RxDevice.IsOnline.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.RxOnlineStatus[tempX]]);
|
RxDevice.IsOnline.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.RxOnlineStatus[tempX]]);
|
||||||
}
|
}
|
||||||
// DmSwitch.InputEndpointOnlineFeedbacks[(ushort)tempOutputNum].LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.OutputVideoRoutes[tempOutputNum]]);
|
// DmSwitch.InputEndpointOnlineFeedbacks[(ushort)tempOutputNum].LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.OutputVideoRoutes[tempOutputNum]]);
|
||||||
DmSwitch.VideoOutputFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.OutputVideoRoutes[tempX]]);
|
DmSwitch.VideoOutputFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.OutputVideoRoutes[tempX]]);
|
||||||
DmSwitch.AudioOutputFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.OutputAudioRoutes[tempX]]);
|
DmSwitch.AudioOutputFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.OutputAudioRoutes[tempX]]);
|
||||||
DmSwitch.InputNameFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.StringInput[ApiMap.InputNames[tempX]]);
|
DmSwitch.InputNameFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.StringInput[ApiMap.InputNames[tempX]]);
|
||||||
DmSwitch.OutputNameFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.StringInput[ApiMap.OutputNames[tempX]]);
|
DmSwitch.OutputNameFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.StringInput[ApiMap.OutputNames[tempX]]);
|
||||||
DmSwitch.OutputRouteNameFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.StringInput[ApiMap.OutputRouteNames[tempX]]);
|
DmSwitch.OutputRouteNameFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.StringInput[ApiMap.OutputRouteNames[tempX]]);
|
||||||
}
|
}
|
||||||
DmSwitch.IsOnline.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.ChassisOnline]);
|
DmSwitch.IsOnline.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.ChassisOnline]);
|
||||||
ApiEisc.Eisc.Register();
|
ApiEisc.Eisc.Register();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Debug.Console(2, "Name {0} Activated", this.Name);
|
Debug.Console(2, "Name {0} Activated", this.Name);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
Debug.Console(2, "BRidge {0}", e);
|
Debug.Console(2, "BRidge {0}", e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class EssentialDMProperties {
|
public class EssentialDMProperties {
|
||||||
public string connectionDeviceKey;
|
public string connectionDeviceKey;
|
||||||
public string[] EiscApiIpids;
|
public string[] EiscApiIpids;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class EssentialDMApiMap {
|
public class EssentialDMApiMap {
|
||||||
public ushort ChassisOnline = 11;
|
public ushort ChassisOnline = 11;
|
||||||
public Dictionary<uint, ushort> OutputVideoRoutes;
|
public Dictionary<uint, ushort> OutputVideoRoutes;
|
||||||
public Dictionary<uint, ushort> OutputAudioRoutes;
|
public Dictionary<uint, ushort> OutputAudioRoutes;
|
||||||
public Dictionary<uint, ushort> TxOnlineStatus;
|
public Dictionary<uint, ushort> TxOnlineStatus;
|
||||||
public Dictionary<uint, ushort> RxOnlineStatus;
|
public Dictionary<uint, ushort> RxOnlineStatus;
|
||||||
public Dictionary<uint, ushort> TxVideoSyncStatus;
|
public Dictionary<uint, ushort> TxVideoSyncStatus;
|
||||||
public Dictionary<uint, ushort> InputNames;
|
public Dictionary<uint, ushort> InputNames;
|
||||||
public Dictionary<uint, ushort> OutputNames;
|
public Dictionary<uint, ushort> OutputNames;
|
||||||
public Dictionary<uint, ushort> OutputRouteNames;
|
public Dictionary<uint, ushort> OutputRouteNames;
|
||||||
|
|
||||||
public EssentialDMApiMap() {
|
public EssentialDMApiMap() {
|
||||||
OutputVideoRoutes = new Dictionary<uint, ushort>();
|
OutputVideoRoutes = new Dictionary<uint, ushort>();
|
||||||
OutputAudioRoutes = new Dictionary<uint, ushort>();
|
OutputAudioRoutes = new Dictionary<uint, ushort>();
|
||||||
TxOnlineStatus = new Dictionary<uint, ushort>();
|
TxOnlineStatus = new Dictionary<uint, ushort>();
|
||||||
RxOnlineStatus = new Dictionary<uint, ushort>();
|
RxOnlineStatus = new Dictionary<uint, ushort>();
|
||||||
TxVideoSyncStatus = new Dictionary<uint, ushort>();
|
TxVideoSyncStatus = new Dictionary<uint, ushort>();
|
||||||
InputNames = new Dictionary<uint, ushort>();
|
InputNames = new Dictionary<uint, ushort>();
|
||||||
OutputNames = new Dictionary<uint, ushort>();
|
OutputNames = new Dictionary<uint, ushort>();
|
||||||
OutputRouteNames = new Dictionary<uint, ushort>();
|
OutputRouteNames = new Dictionary<uint, ushort>();
|
||||||
for (uint x = 1; x <= 200; x++) {
|
for (uint x = 1; x <= 200; x++) {
|
||||||
// Debug.Console(0, "Init Value {0}", x);
|
// Debug.Console(0, "Init Value {0}", x);
|
||||||
uint tempNum = x;
|
uint tempNum = x;
|
||||||
|
|
||||||
OutputVideoRoutes[tempNum] = (ushort)(tempNum + 100);
|
OutputVideoRoutes[tempNum] = (ushort)(tempNum + 100);
|
||||||
OutputAudioRoutes[tempNum] = (ushort)(tempNum + 300);
|
OutputAudioRoutes[tempNum] = (ushort)(tempNum + 300);
|
||||||
TxOnlineStatus[tempNum] = (ushort)(tempNum + 500);
|
TxOnlineStatus[tempNum] = (ushort)(tempNum + 500);
|
||||||
RxOnlineStatus[tempNum] = (ushort)(tempNum + 700);
|
RxOnlineStatus[tempNum] = (ushort)(tempNum + 700);
|
||||||
TxVideoSyncStatus[tempNum] = (ushort)(tempNum + 100);
|
TxVideoSyncStatus[tempNum] = (ushort)(tempNum + 100);
|
||||||
InputNames[tempNum] = (ushort)(tempNum + 100);
|
InputNames[tempNum] = (ushort)(tempNum + 100);
|
||||||
OutputNames[tempNum] = (ushort)(tempNum + 300);
|
OutputNames[tempNum] = (ushort)(tempNum + 300);
|
||||||
OutputRouteNames[tempNum] = (ushort)(tempNum + 2000);
|
OutputRouteNames[tempNum] = (ushort)(tempNum + 2000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
98
PepperDashEssentials/Bridges/EssentialTVOne.cs
Normal file
98
PepperDashEssentials/Bridges/EssentialTVOne.cs
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
using PepperDash.Essentials.DM;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Routing;
|
||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||||
|
using Crestron.SimplSharpPro.DM;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials
|
||||||
|
{
|
||||||
|
public class EssentialsTVOne : PepperDash.Core.Device
|
||||||
|
{
|
||||||
|
public EssentialTVOneProperties Properties;
|
||||||
|
public List<BridgeApiEisc> BridgeApiEiscs;
|
||||||
|
private PepperDash.Essentials.Devices.Common.TVOneCorio TVOneCorio;
|
||||||
|
private EssentialsTVOneApiMap ApiMap = new EssentialsTVOneApiMap();
|
||||||
|
public EssentialsTVOne(string key, string name, JToken properties)
|
||||||
|
: base(key, name)
|
||||||
|
{
|
||||||
|
Properties = JsonConvert.DeserializeObject<EssentialTVOneProperties>(properties.ToString());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
public override bool CustomActivate() {
|
||||||
|
// Create EiscApis
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach (var device in DeviceManager.AllDevices)
|
||||||
|
{
|
||||||
|
if (device.Key == this.Properties.connectionDeviceKey)
|
||||||
|
{
|
||||||
|
Debug.Console(2, "deviceKey {0} Matches", device.Key);
|
||||||
|
TVOneCorio = DeviceManager.GetDeviceForKey(device.Key) as PepperDash.Essentials.Devices.Common.TVOneCorio;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Console(2, "deviceKey {0} doesn't match", device.Key);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Properties.EiscApiIpids != null && TVOneCorio != null)
|
||||||
|
{
|
||||||
|
foreach (string Ipid in Properties.EiscApiIpids)
|
||||||
|
{
|
||||||
|
var ApiEisc = new BridgeApiEisc(Ipid);
|
||||||
|
Debug.Console(2, "Connecting EiscApi {0} to {1}", ApiEisc.Ipid, TVOneCorio.Name);
|
||||||
|
ushort x = 1;
|
||||||
|
TVOneCorio.OnlineFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.Online]);
|
||||||
|
ApiEisc.Eisc.SetUShortSigAction(ApiMap.CallPreset, u => TVOneCorio.CallPreset(u));
|
||||||
|
TVOneCorio.PresetFeedback.LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.PresetFeedback]);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Debug.Console(2, "Name {0} Activated", this.Name);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
Debug.Console(2, "BRidge {0}", e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class EssentialTVOneProperties
|
||||||
|
{
|
||||||
|
public string connectionDeviceKey;
|
||||||
|
public string[] EiscApiIpids;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class EssentialsTVOneApiMap
|
||||||
|
{
|
||||||
|
public ushort CallPreset = 1;
|
||||||
|
public ushort PresetFeedback = 1;
|
||||||
|
public ushort Online = 1;
|
||||||
|
|
||||||
|
public EssentialsTVOneApiMap()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -106,6 +106,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Audio\EssentialsVolumeLevelConfig.cs" />
|
<Compile Include="Audio\EssentialsVolumeLevelConfig.cs" />
|
||||||
<Compile Include="Bridges\Bridges.BridgeFactory.cs" />
|
<Compile Include="Bridges\Bridges.BridgeFactory.cs" />
|
||||||
|
<Compile Include="Bridges\EssentialTVOne.cs" />
|
||||||
<Compile Include="Bridges\EssentialDsp.cs" />
|
<Compile Include="Bridges\EssentialDsp.cs" />
|
||||||
<Compile Include="Configuration ORIGINAL\Builders\TPConfig.cs" />
|
<Compile Include="Configuration ORIGINAL\Builders\TPConfig.cs" />
|
||||||
<Compile Include="Configuration ORIGINAL\Configuration.cs" />
|
<Compile Include="Configuration ORIGINAL\Configuration.cs" />
|
||||||
|
|||||||
Submodule essentials-framework updated: c9d5cc34a1...69bb8bcabd
Reference in New Issue
Block a user