mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 12:44:58 +00:00
WHAR-1397 Removes extraneous debug traces
This commit is contained in:
@@ -27,24 +27,24 @@ namespace PepperDash.Essentials {
|
|||||||
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(2, "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(2, "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(2, "Launch EssentialDsp");
|
||||||
return new EssentialDsp(key, name, properties);
|
return new EssentialDsp(key, name, properties);
|
||||||
}
|
}
|
||||||
else if (typeName == "essentialstvone")
|
else if (typeName == "essentialstvone")
|
||||||
{
|
{
|
||||||
Debug.Console(0, "Launch essentialstvone");
|
Debug.Console(2, "Launch essentialstvone");
|
||||||
return new EssentialsTVOne(key, name, properties);
|
return new EssentialsTVOne(key, name, properties);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -58,7 +58,7 @@ namespace PepperDash.Essentials {
|
|||||||
Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(Ipid, "127.0.0.2", Global.ControlSystem);
|
Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(Ipid, "127.0.0.2", Global.ControlSystem);
|
||||||
Eisc.Register();
|
Eisc.Register();
|
||||||
Eisc.SigChange += Eisc_SigChange;
|
Eisc.SigChange += Eisc_SigChange;
|
||||||
Debug.Console(0, "BridgeApiEisc Created at Ipid {0}", ipid);
|
Debug.Console(2, "BridgeApiEisc Created at Ipid {0}", ipid);
|
||||||
}
|
}
|
||||||
void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args) {
|
void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args) {
|
||||||
if (Debug.Level >= 1)
|
if (Debug.Level >= 1)
|
||||||
|
|||||||
@@ -1,144 +1,144 @@
|
|||||||
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;
|
||||||
using Crestron.SimplSharpPro.CrestronThread;
|
using Crestron.SimplSharpPro.CrestronThread;
|
||||||
|
|
||||||
namespace PepperDash.Essentials {
|
namespace PepperDash.Essentials {
|
||||||
public class EssentialCommConfig {
|
public class EssentialCommConfig {
|
||||||
public string[] EiscApiIpids;
|
public string[] EiscApiIpids;
|
||||||
public EssentialCommCommConnectionConfigs[] CommConnections;
|
public EssentialCommCommConnectionConfigs[] CommConnections;
|
||||||
}
|
}
|
||||||
public class EssentialCommCommConnectionConfigs {
|
public class EssentialCommCommConnectionConfigs {
|
||||||
public uint joinNumber {get; set; }
|
public uint joinNumber {get; set; }
|
||||||
public EssentialsControlPropertiesConfig control { get; set; }
|
public EssentialsControlPropertiesConfig control { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EssentialCommsPort {
|
public class EssentialCommsPort {
|
||||||
public IBasicCommunication Comm;
|
public IBasicCommunication Comm;
|
||||||
public IntFeedback StatusFeedback;
|
public IntFeedback StatusFeedback;
|
||||||
public BoolFeedback ConnectedFeedback;
|
public BoolFeedback ConnectedFeedback;
|
||||||
public List<EssentialComApiMap> Outputs = new List<EssentialComApiMap>();
|
public List<EssentialComApiMap> Outputs = new List<EssentialComApiMap>();
|
||||||
public String RxBuffer;
|
public String RxBuffer;
|
||||||
public EssentialCommsPort(EssentialsControlPropertiesConfig config, string keyPrefix) {
|
public EssentialCommsPort(EssentialsControlPropertiesConfig config, string keyPrefix) {
|
||||||
Comm = CommFactory.CreateCommForConfig(config, keyPrefix);
|
Comm = CommFactory.CreateCommForConfig(config, keyPrefix);
|
||||||
// var PortGather = new CommunicationGather(Comm, config.EndOfLineChar);
|
// var PortGather = new CommunicationGather(Comm, config.EndOfLineChar);
|
||||||
Comm.TextReceived += new EventHandler<GenericCommMethodReceiveTextArgs>(Communication_TextReceived);
|
Comm.TextReceived += new EventHandler<GenericCommMethodReceiveTextArgs>(Communication_TextReceived);
|
||||||
|
|
||||||
var socket = Comm as ISocketStatus;
|
var socket = Comm as ISocketStatus;
|
||||||
StatusFeedback = new IntFeedback(() => { return (int)socket.ClientStatus; });
|
StatusFeedback = new IntFeedback(() => { return (int)socket.ClientStatus; });
|
||||||
ConnectedFeedback = new BoolFeedback(() => { return Comm.IsConnected; });
|
ConnectedFeedback = new BoolFeedback(() => { return Comm.IsConnected; });
|
||||||
|
|
||||||
if (socket != null) {
|
if (socket != null) {
|
||||||
socket.ConnectionChange += new EventHandler<GenericSocketStatusChageEventArgs>(socket_ConnectionChange);
|
socket.ConnectionChange += new EventHandler<GenericSocketStatusChageEventArgs>(socket_ConnectionChange);
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
void socket_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e) {
|
void socket_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e) {
|
||||||
StatusFeedback.FireUpdate();
|
StatusFeedback.FireUpdate();
|
||||||
ConnectedFeedback.FireUpdate();
|
ConnectedFeedback.FireUpdate();
|
||||||
if (e.Client.IsConnected) {
|
if (e.Client.IsConnected) {
|
||||||
// Tasks on connect
|
// Tasks on connect
|
||||||
} else {
|
} else {
|
||||||
// Cleanup items from this session
|
// Cleanup items from this session
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void Communication_TextReceived(object sender, GenericCommMethodReceiveTextArgs args) {
|
void Communication_TextReceived(object sender, GenericCommMethodReceiveTextArgs args) {
|
||||||
try {
|
try {
|
||||||
foreach (var Output in Outputs) {
|
foreach (var Output in Outputs) {
|
||||||
Output.Api.Eisc.StringInput[Output.Join].StringValue = args.Text;
|
Output.Api.Eisc.StringInput[Output.Join].StringValue = args.Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception) {
|
catch (Exception) {
|
||||||
throw new FormatException(string.Format("ERROR:{0}"));
|
throw new FormatException(string.Format("ERROR:{0}"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EssentialComm : Device {
|
public class EssentialComm : Device {
|
||||||
public EssentialCommConfig Properties;
|
public EssentialCommConfig Properties;
|
||||||
|
|
||||||
public CommunicationGather PortGather { get; private set; }
|
public CommunicationGather PortGather { get; private set; }
|
||||||
public List<BridgeApiEisc> Apis {get; set;}
|
public List<BridgeApiEisc> Apis {get; set;}
|
||||||
public Dictionary<string, StringFeedback> CommFeedbacks {get; private set; }
|
public Dictionary<string, StringFeedback> CommFeedbacks {get; private set; }
|
||||||
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
||||||
public Dictionary<uint, EssentialCommsPort> CommDictionary { get; private set; }
|
public Dictionary<uint, EssentialCommsPort> CommDictionary { get; private set; }
|
||||||
|
|
||||||
public EssentialComm(string key, string name, JToken properties) : base(key, name) {
|
public EssentialComm(string key, string name, JToken properties) : base(key, name) {
|
||||||
Properties = JsonConvert.DeserializeObject<EssentialCommConfig>(properties.ToString());
|
Properties = JsonConvert.DeserializeObject<EssentialCommConfig>(properties.ToString());
|
||||||
CommFeedbacks = new Dictionary<string, StringFeedback>();
|
CommFeedbacks = new Dictionary<string, StringFeedback>();
|
||||||
CommDictionary = new Dictionary<uint, EssentialCommsPort>();
|
CommDictionary = new Dictionary<uint, EssentialCommsPort>();
|
||||||
Apis = new List<BridgeApiEisc>();
|
Apis = new List<BridgeApiEisc>();
|
||||||
int commNumber = 1;
|
int commNumber = 1;
|
||||||
foreach (var commConfig in Properties.CommConnections) {
|
foreach (var commConfig in Properties.CommConnections) {
|
||||||
var commPort = new EssentialCommsPort(commConfig.control, string.Format("{0}-{1}", this.Key, commConfig.joinNumber));
|
var commPort = new EssentialCommsPort(commConfig.control, string.Format("{0}-{1}", this.Key, commConfig.joinNumber));
|
||||||
CommDictionary.Add(commConfig.joinNumber, commPort);
|
CommDictionary.Add(commConfig.joinNumber, commPort);
|
||||||
|
|
||||||
commNumber++;
|
commNumber++;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var Ipid in Properties.EiscApiIpids) {
|
foreach (var Ipid in Properties.EiscApiIpids) {
|
||||||
var ApiEisc = new BridgeApiEisc(Ipid);
|
var ApiEisc = new BridgeApiEisc(Ipid);
|
||||||
Apis.Add(ApiEisc);
|
Apis.Add(ApiEisc);
|
||||||
foreach (var commConnection in CommDictionary) {
|
foreach (var commConnection in CommDictionary) {
|
||||||
Debug.Console(0, "Joining Api{0} to comm {1}", Ipid, commConnection.Key);
|
Debug.Console(2, "Joining Api{0} to comm {1}", Ipid, commConnection.Key);
|
||||||
var tempComm = commConnection.Value;
|
var tempComm = commConnection.Value;
|
||||||
var tempJoin = (uint)commConnection.Key;
|
var tempJoin = (uint)commConnection.Key;
|
||||||
EssentialComApiMap ApiMap = new EssentialComApiMap(ApiEisc, (uint)tempJoin);
|
EssentialComApiMap ApiMap = new EssentialComApiMap(ApiEisc, (uint)tempJoin);
|
||||||
|
|
||||||
tempComm.Outputs.Add(ApiMap);
|
tempComm.Outputs.Add(ApiMap);
|
||||||
// Check for ApiMap Overide Values here
|
// Check for ApiMap Overide Values here
|
||||||
|
|
||||||
ApiEisc.Eisc.SetBoolSigAction(tempJoin, b => {if (b) { tempComm.Comm.Connect(); } else { tempComm.Comm.Disconnect(); }});
|
ApiEisc.Eisc.SetBoolSigAction(tempJoin, b => {if (b) { tempComm.Comm.Connect(); } else { tempComm.Comm.Disconnect(); }});
|
||||||
ApiEisc.Eisc.SetStringSigAction(tempJoin, s => tempComm.Comm.SendText(s));
|
ApiEisc.Eisc.SetStringSigAction(tempJoin, s => tempComm.Comm.SendText(s));
|
||||||
|
|
||||||
tempComm.StatusFeedback.LinkInputSig(ApiEisc.Eisc.UShortInput[tempJoin]);
|
tempComm.StatusFeedback.LinkInputSig(ApiEisc.Eisc.UShortInput[tempJoin]);
|
||||||
tempComm.ConnectedFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[tempJoin]);
|
tempComm.ConnectedFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[tempJoin]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
ApiEisc.Eisc.Register();
|
ApiEisc.Eisc.Register();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public override bool CustomActivate()
|
public override bool CustomActivate()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Debug.Console(0, "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(0, "BRidge {0}", e);
|
Debug.Console(0, "Bridge {0}", e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public class EssentialComApiMap {
|
public class EssentialComApiMap {
|
||||||
public uint Join;
|
public uint Join;
|
||||||
public BridgeApiEisc Api;
|
public BridgeApiEisc Api;
|
||||||
public uint connectJoin;
|
public uint connectJoin;
|
||||||
public EssentialComApiMap(BridgeApiEisc api, uint join) {
|
public EssentialComApiMap(BridgeApiEisc api, uint join) {
|
||||||
Join = join;
|
Join = join;
|
||||||
Api = api;
|
Api = api;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -83,7 +83,7 @@ namespace PepperDash.Essentials {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
Debug.Console(2, "BRidge {0}", e);
|
Debug.Console(0, "Bridge {0}", e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ namespace PepperDash.Essentials
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
Debug.Console(2, "BRidge {0}", e);
|
Debug.Console(0, "Bridge {0}", e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user