From 2967a0f968aa49e5f29da9da2ff3d1478ca0e1c0 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 4 Feb 2021 08:50:50 -0700 Subject: [PATCH 1/2] turn on dev info and stream debugging for temp client --- .../Essentials_DM/Endpoints/DGEs/Dge100Controller.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs index 39e549cc..db7fa159 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs @@ -44,7 +44,7 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs DeviceInfo = new DeviceInfo(); - //_dge.OnlineStatusChange += (currentDevice, args) => { if (args.DeviceOnLine) UpdateDeviceInfo(); }; + _dge.OnlineStatusChange += (currentDevice, args) => { if (args.DeviceOnLine) UpdateDeviceInfo(); }; _dc = dc; @@ -109,6 +109,8 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs var tcpClient = new GenericTcpIpClient("", _dgeEthernetInfo.IpAddressFeedback.StringValue, CtpPort, 1024){AutoReconnect = false}; + tcpClient.StreamDebugging.SetDebuggingWithDefaultTimeout(eStreamDebuggingSetting.Rx); + var gather = new CommunicationGather(tcpClient, "\r\n\r\n"); tcpClient.ConnectionChange += (sender, args) => From 4dfab9a287973e6b4ef9983684dea5a7955363d9 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 4 Feb 2021 11:17:49 -0700 Subject: [PATCH 2/2] got DeviceInfo Parsing working correctly --- .../Endpoints/DGEs/Dge100Controller.cs | 65 +++++++++++++------ 1 file changed, 45 insertions(+), 20 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs index db7fa159..ea220a13 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs @@ -109,8 +109,6 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs var tcpClient = new GenericTcpIpClient("", _dgeEthernetInfo.IpAddressFeedback.StringValue, CtpPort, 1024){AutoReconnect = false}; - tcpClient.StreamDebugging.SetDebuggingWithDefaultTimeout(eStreamDebuggingSetting.Rx); - var gather = new CommunicationGather(tcpClient, "\r\n\r\n"); tcpClient.ConnectionChange += (sender, args) => @@ -125,29 +123,56 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs gather.LineReceived += (sender, args) => { - if (args.Text.ToLower().Contains("host")) + try { - DeviceInfo.HostName = args.Text.Split(';')[1].Trim(); + Debug.Console(1, this, "{0}", args.Text); - tcpClient.Disconnect(); - return; + if (args.Text.ToLower().Contains("host")) + { + DeviceInfo.HostName = args.Text.Split(':')[1].Trim(); + + Debug.Console(1, this, "hostname: {0}", DeviceInfo.HostName); + tcpClient.Disconnect(); + return; + } + + //ignore console prompt + /*if (args.Text.ToLower().Contains(">")) + { + Debug.Console(1, this, "Ignoring console"); + return; + } + + if (args.Text.ToLower().Contains("dge")) + { + Debug.Console(1, this, "Ignoring DGE"); + 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"); } - - //ignore console prompt - if (args.Text.ToLower().Contains(">")) + catch (Exception ex) { - return; + Debug.Console(0, this, "Exception getting data: {0}", ex.Message); + Debug.Console(0, this, "response: {0}", args.Text); } - - if (!args.Text.ToLower().Contains("dge")) - { - 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();