mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-06 00:05:05 +00:00
Compare commits
3 Commits
feature/Ci
...
1.13.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8965752025 | ||
|
|
51bd95937a | ||
|
|
845978c741 |
@@ -1,259 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net.Sockets;
|
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
using Crestron.SimplSharpPro;
|
|
||||||
using Crestron.SimplSharpPro.UI;
|
|
||||||
|
|
||||||
using Crestron.SimplSharpPro.DM;
|
|
||||||
|
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
using PepperDash.Core;
|
|
||||||
using PepperDash.Essentials.Core;
|
|
||||||
using PepperDash.Essentials.Core.Bridges;
|
|
||||||
using PepperDash.Essentials.Core.Config;
|
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
|
||||||
using PepperDash.Essentials.Core.DeviceInfo;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.DM.Endpoints.DGEs
|
|
||||||
{
|
|
||||||
public class DgeBaseController : CrestronGenericBridgeableBaseDevice, IComPorts, IIROutputPorts, IHasBasicTriListWithSmartObject, ICec, IDeviceInfoProvider, IDgeRoutingWithFeedback
|
|
||||||
{
|
|
||||||
private const int CtpPort = 41795;
|
|
||||||
private readonly Dge100 _dge;
|
|
||||||
|
|
||||||
public RoutingInputPort HdmiIn { get; protected set; }
|
|
||||||
public RoutingInputPort ProjectViewIn { get; protected set; }
|
|
||||||
public RoutingOutputPort HdmiOut { get; protected set; }
|
|
||||||
|
|
||||||
protected readonly ushort DmInputJoin;
|
|
||||||
protected readonly ushort HdmiInputJoin;
|
|
||||||
protected readonly ushort ProjectViewJoin;
|
|
||||||
|
|
||||||
private int SwitchValue;
|
|
||||||
|
|
||||||
public RoutingPortCollection<RoutingInputPort> InputPorts
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
private set;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
private set;
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly TsxCcsUcCodec100EthernetReservedSigs _dgeEthernetInfo;
|
|
||||||
|
|
||||||
public BasicTriListWithSmartObject Panel { get { return _dge; } }
|
|
||||||
|
|
||||||
private DeviceConfig _dc;
|
|
||||||
|
|
||||||
CrestronDgePropertiesConfig PropertiesConfig;
|
|
||||||
|
|
||||||
public DgeBaseController(string key, string name, Dge100 device, DeviceConfig dc, CrestronDgePropertiesConfig props)
|
|
||||||
:base(key, name, device)
|
|
||||||
{
|
|
||||||
_dge = device;
|
|
||||||
_dc = dc;
|
|
||||||
|
|
||||||
PropertiesConfig = props;
|
|
||||||
|
|
||||||
DmInputJoin = (ushort)PropertiesConfig.DmInputJoin;
|
|
||||||
HdmiInputJoin = (ushort)PropertiesConfig.HdmiInputJoin;
|
|
||||||
ProjectViewJoin = (ushort)PropertiesConfig.ProjectViewVirtualInputJoin;
|
|
||||||
|
|
||||||
// Set Ports for CEC
|
|
||||||
HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo,
|
|
||||||
eRoutingPortConnectionType.Hdmi, null, this);
|
|
||||||
|
|
||||||
HdmiOut.Port = _dge.HdmiOut;
|
|
||||||
|
|
||||||
|
|
||||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort> { HdmiOut };
|
|
||||||
|
|
||||||
|
|
||||||
_dgeEthernetInfo = _dge.ExtenderEthernetReservedSigs;
|
|
||||||
//_dgeEthernetInfo.DeviceExtenderSigChange += (extender, args) => UpdateDeviceInfo();
|
|
||||||
_dgeEthernetInfo.Use();
|
|
||||||
|
|
||||||
DeviceInfo = new DeviceInfo();
|
|
||||||
|
|
||||||
AudioVideoSourceNumericFeedback = new IntFeedback(() => SwitchValue);
|
|
||||||
|
|
||||||
|
|
||||||
_dge.OnlineStatusChange += (currentDevice, args) => { if (args.DeviceOnLine) UpdateDeviceInfo(); };
|
|
||||||
|
|
||||||
_dge.SigChange += TrilistChange;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void TrilistChange(BasicTriList currentDevice, SigEventArgs args)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#region IComPorts Members
|
|
||||||
|
|
||||||
public CrestronCollection<ComPort> ComPorts
|
|
||||||
{
|
|
||||||
get { return _dge.ComPorts; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int NumberOfComPorts
|
|
||||||
{
|
|
||||||
get { return _dge.NumberOfComPorts; }
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region IIROutputPorts Members
|
|
||||||
|
|
||||||
public CrestronCollection<IROutputPort> IROutputPorts
|
|
||||||
{
|
|
||||||
get { return _dge.IROutputPorts; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int NumberOfIROutputPorts
|
|
||||||
{
|
|
||||||
get { return _dge.NumberOfIROutputPorts; }
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region ICec Members
|
|
||||||
public Cec StreamCec { get { return _dge.HdmiOut.StreamCec; } }
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Implementation of IDeviceInfoProvider
|
|
||||||
|
|
||||||
public DeviceInfo DeviceInfo { get; private set; }
|
|
||||||
|
|
||||||
public event DeviceInfoChangeHandler DeviceInfoChanged;
|
|
||||||
|
|
||||||
public void UpdateDeviceInfo()
|
|
||||||
{
|
|
||||||
DeviceInfo.IpAddress = _dgeEthernetInfo.IpAddressFeedback.StringValue;
|
|
||||||
DeviceInfo.MacAddress = _dgeEthernetInfo.MacAddressFeedback.StringValue;
|
|
||||||
|
|
||||||
GetFirmwareAndSerialInfo();
|
|
||||||
|
|
||||||
OnDeviceInfoChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void GetFirmwareAndSerialInfo()
|
|
||||||
{
|
|
||||||
if (String.IsNullOrEmpty(_dgeEthernetInfo.IpAddressFeedback.StringValue))
|
|
||||||
{
|
|
||||||
Debug.Console(1, this, "IP Address information not yet received. No device is online");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var tcpClient = new GenericTcpIpClient("", _dgeEthernetInfo.IpAddressFeedback.StringValue, CtpPort, 1024) { AutoReconnect = false };
|
|
||||||
|
|
||||||
var gather = new CommunicationGather(tcpClient, "\r\n\r\n");
|
|
||||||
|
|
||||||
tcpClient.ConnectionChange += (sender, args) =>
|
|
||||||
{
|
|
||||||
if (!args.Client.IsConnected)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
args.Client.SendText("ver\r\n");
|
|
||||||
};
|
|
||||||
|
|
||||||
gather.LineReceived += (sender, args) =>
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Debug.Console(1, this, "{0}", args.Text);
|
|
||||||
|
|
||||||
if (args.Text.ToLower().Contains("host"))
|
|
||||||
{
|
|
||||||
DeviceInfo.HostName = args.Text.Split(':')[1].Trim();
|
|
||||||
|
|
||||||
Debug.Console(1, this, "hostname: {0}", DeviceInfo.HostName);
|
|
||||||
tcpClient.Disconnect();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!args.Text.Contains('['))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var splitResponse = args.Text.Split('[');
|
|
||||||
|
|
||||||
foreach (string t in splitResponse)
|
|
||||||
{
|
|
||||||
Debug.Console(1, this, "{0}", t);
|
|
||||||
}
|
|
||||||
|
|
||||||
DeviceInfo.SerialNumber = splitResponse[1].Split(' ')[4].Replace("#", "");
|
|
||||||
DeviceInfo.FirmwareVersion = splitResponse[1].Split(' ')[0];
|
|
||||||
|
|
||||||
Debug.Console(1, this, "Firmware: {0} SerialNumber: {1}", DeviceInfo.FirmwareVersion,
|
|
||||||
DeviceInfo.SerialNumber);
|
|
||||||
|
|
||||||
tcpClient.SendText("host\r\n");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Debug.Console(0, this, "Exception getting data: {0}", ex.Message);
|
|
||||||
Debug.Console(0, this, "response: {0}", args.Text);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
tcpClient.Connect();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnDeviceInfoChange()
|
|
||||||
{
|
|
||||||
var handler = DeviceInfoChanged;
|
|
||||||
|
|
||||||
if (handler == null) return;
|
|
||||||
|
|
||||||
handler(this, new DeviceInfoEventArgs(DeviceInfo));
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region IDgeRouting Members
|
|
||||||
|
|
||||||
public IntFeedback AudioVideoSourceNumericFeedback { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region IRoutingNumeric Members
|
|
||||||
|
|
||||||
public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region IRouting Members
|
|
||||||
|
|
||||||
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -40,8 +40,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
|
|
||||||
private CTimer _brandingTimer;
|
private CTimer _brandingTimer;
|
||||||
|
|
||||||
private CTimer _registrationCheckTimer;
|
|
||||||
|
|
||||||
public CommunicationGather PortGather { get; private set; }
|
public CommunicationGather PortGather { get; private set; }
|
||||||
|
|
||||||
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
||||||
@@ -264,10 +262,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
|
|
||||||
private StringBuilder _jsonMessage;
|
private StringBuilder _jsonMessage;
|
||||||
|
|
||||||
private StringBuilder _feedbackListMessage;
|
|
||||||
|
|
||||||
private bool _feedbackListMessageIncoming;
|
|
||||||
|
|
||||||
private bool _jsonFeedbackMessageIsIncoming;
|
private bool _jsonFeedbackMessageIsIncoming;
|
||||||
|
|
||||||
public bool CommDebuggingIsOn;
|
public bool CommDebuggingIsOn;
|
||||||
@@ -708,8 +702,6 @@ ConnectorID: {2}"
|
|||||||
|
|
||||||
// Fire the ready event
|
// Fire the ready event
|
||||||
SetIsReady();
|
SetIsReady();
|
||||||
|
|
||||||
_registrationCheckTimer = new CTimer(EnqueueCommand, "xFeedback list", 90000, 90000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetCommDebug(string s)
|
public void SetCommDebug(string s)
|
||||||
@@ -786,29 +778,6 @@ ConnectorID: {2}"
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!args.Text.StartsWith("/") && _feedbackListMessage != null)
|
|
||||||
{
|
|
||||||
_feedbackListMessageIncoming = false;
|
|
||||||
|
|
||||||
var feedbackListString = _feedbackListMessage.ToString();
|
|
||||||
_feedbackListMessage = null;
|
|
||||||
|
|
||||||
ProcessFeedbackList(feedbackListString);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.Text.StartsWith("/"))
|
|
||||||
{
|
|
||||||
_feedbackListMessageIncoming = true;
|
|
||||||
if(_feedbackListMessage == null) _feedbackListMessage = new StringBuilder();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_feedbackListMessageIncoming && _feedbackListMessage != null)
|
|
||||||
{
|
|
||||||
_feedbackListMessage.Append(args.Text);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.Text == "{" + Delimiter) // Check for the beginning of a new JSON message
|
if (args.Text == "{" + Delimiter) // Check for the beginning of a new JSON message
|
||||||
{
|
{
|
||||||
_jsonFeedbackMessageIsIncoming = true;
|
_jsonFeedbackMessageIsIncoming = true;
|
||||||
@@ -877,19 +846,6 @@ ConnectorID: {2}"
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ProcessFeedbackList(string data)
|
|
||||||
{
|
|
||||||
Debug.Console(1, this, "Feedback List : ");
|
|
||||||
Debug.Console(1, this, data);
|
|
||||||
|
|
||||||
if (data.Split('\n').Count() == _cliFeedbackRegistrationExpression.Split('\n').Count()) return;
|
|
||||||
Debug.Console(0, this, "Codec Feedback Registrations Lost - Registering Feedbacks");
|
|
||||||
ErrorLog.Error(String.Format("[{0}] :: Codec Feedback Registrations Lost - Registering Feedbacks", Key));
|
|
||||||
//var updateRegistrationString = "xFeedback deregisterall" + Delimiter + _cliFeedbackRegistrationExpression;
|
|
||||||
|
|
||||||
EnqueueCommand(_cliFeedbackRegistrationExpression);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enqueues a command to be sent to the codec.
|
/// Enqueues a command to be sent to the codec.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -898,12 +854,6 @@ ConnectorID: {2}"
|
|||||||
{
|
{
|
||||||
_syncState.AddCommandToQueue(command);
|
_syncState.AddCommandToQueue(command);
|
||||||
}
|
}
|
||||||
private void EnqueueCommand(object cmd)
|
|
||||||
{
|
|
||||||
var command = cmd as string;
|
|
||||||
if (String.IsNullOrEmpty(command)) return;
|
|
||||||
_syncState.AddCommandToQueue(command);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Appends the delimiter and send the command to the codec.
|
/// Appends the delimiter and send the command to the codec.
|
||||||
@@ -919,16 +869,6 @@ ConnectorID: {2}"
|
|||||||
Communication.SendText(command + Delimiter);
|
Communication.SendText(command + Delimiter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendText(object cmd)
|
|
||||||
{
|
|
||||||
var command = cmd as string;
|
|
||||||
if (String.IsNullOrEmpty(command)) return;
|
|
||||||
if (CommDebuggingIsOn)
|
|
||||||
Debug.Console(1, this, "Sending: '{0}'", ComTextHelper.GetDebugText(command + Delimiter));
|
|
||||||
|
|
||||||
Communication.SendText(command + Delimiter);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeserializeResponse(string response)
|
void DeserializeResponse(string response)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
<packages>
|
<packages>
|
||||||
<package id="PepperDashCore" version="1.2.0" targetFramework="net35" allowedVersions="[1.0,2.0)"/>
|
<package id="PepperDashCore" version="1.2.1" targetFramework="net35" allowedVersions="[1.0,2.0)"/>
|
||||||
</packages>
|
</packages>
|
||||||
|
|||||||
Reference in New Issue
Block a user