diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj
index 2b45030c..91d49574 100644
--- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj
@@ -183,6 +183,9 @@
+
+
+
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs
index 7cc913e2..ba25fa9c 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs
@@ -8,14 +8,16 @@ using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
+using PepperDash.Essentials.Core.DeviceInfo;
using PepperDash.Essentials.DM.Config;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.DM
{
[Description("Wrapper class for all DM-RMC variants")]
- public abstract class DmRmcControllerBase : CrestronGenericBridgeableBaseDevice
+ public abstract class DmRmcControllerBase : CrestronGenericBridgeableBaseDevice, IDeviceInfoProvider
{
+ private const int CtpPort = 41795;
private readonly EndpointReceiverBase _rmc; //kept here just in case. Only property or method on this class that's not device-specific is the DMOutput that it's attached to.
public StringFeedback VideoOutputResolutionFeedback { get; protected set; }
@@ -32,6 +34,8 @@ namespace PepperDash.Essentials.DM
PreventRegistration = _rmc.DMOutput != null;
AddToFeedbackList(VideoOutputResolutionFeedback, EdidManufacturerFeedback, EdidSerialNumberFeedback, EdidNameFeedback, EdidPreferredTimingFeedback);
+
+ DeviceInfo = new DeviceInfo();
}
protected void LinkDmRmcToApi(DmRmcControllerBase rmc, BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
@@ -79,7 +83,89 @@ namespace PepperDash.Essentials.DM
trilist.SetUShortSigAction(joinMap.AudioVideoSource.JoinNumber, a => routing.ExecuteNumericSwitch(a, 1, eRoutingSignalType.AudioVideo));
}
- }
+
+ #region Implementation of IDeviceInfoProvider
+
+ public DeviceInfo DeviceInfo { get; private set; }
+ public event EventHandler DeviceInfoChanged;
+
+ public void UpdateDeviceInfo()
+ {
+ if (!_rmc.IsOnline || _rmc.ConnectedIpList.Count == 0)
+ {
+ Debug.Console(1, this, "IP Address information not yet received. No device is online");
+ return;
+ }
+
+ DeviceInfo.IpAddress = _rmc.ConnectedIpList[0].DeviceIpAddress;
+
+ foreach (var ip in _rmc.ConnectedIpList)
+ {
+ Debug.Console(0, this, "Connected IP Address: {0}", ip.DeviceIpAddress);
+ }
+
+ GetFirmwareAndSerialInfo();
+
+ OnDeviceInfoChange();
+ }
+
+ private void GetFirmwareAndSerialInfo()
+ {
+ var tcpClient = new GenericTcpIpClient("", _rmc.ConnectedIpList[0].DeviceIpAddress, CtpPort, 1024);
+
+ 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) =>
+ {
+ if (args.Text.ToLower().Contains("host"))
+ {
+ DeviceInfo.HostName = args.Text.Split(';')[1].Trim();
+
+ tcpClient.Disconnect();
+ return;
+ }
+
+ //ignore console prompt
+ if (args.Text.ToLower().Contains(">"))
+ {
+ return;
+ }
+
+ if (!args.Text.ToLower().Contains("rmc"))
+ {
+ return;
+ }
+
+ DeviceInfo.SerialNumber = args.Text.Split('[')[1].Split(' ')[4].Replace("#", "");
+ DeviceInfo.FirmwareVersion = args.Text.Split('[')[1].Split(' ')[1];
+
+ tcpClient.SendText("host\r\n");
+ };
+
+ tcpClient.Connect();
+ }
+
+ private void OnDeviceInfoChange()
+ {
+ var handler = DeviceInfoChanged;
+
+ if (handler == null) return;
+
+ handler(this, new DeviceInfoEventArgs(DeviceInfo));
+ }
+
+ #endregion
+ }
public abstract class DmHdBaseTControllerBase : CrestronGenericBaseDevice
{