mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 20:54:55 +00:00
Merge pull request #596 from PepperDash/hotfix/dge-device-info
Hotfix/dge device info
This commit is contained in:
@@ -44,7 +44,7 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs
|
|||||||
|
|
||||||
DeviceInfo = new DeviceInfo();
|
DeviceInfo = new DeviceInfo();
|
||||||
|
|
||||||
//_dge.OnlineStatusChange += (currentDevice, args) => { if (args.DeviceOnLine) UpdateDeviceInfo(); };
|
_dge.OnlineStatusChange += (currentDevice, args) => { if (args.DeviceOnLine) UpdateDeviceInfo(); };
|
||||||
|
|
||||||
_dc = dc;
|
_dc = dc;
|
||||||
|
|
||||||
@@ -123,29 +123,56 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs
|
|||||||
|
|
||||||
gather.LineReceived += (sender, args) =>
|
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();
|
if (args.Text.ToLower().Contains("host"))
|
||||||
return;
|
{
|
||||||
|
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");
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
//ignore console prompt
|
|
||||||
if (args.Text.ToLower().Contains(">"))
|
|
||||||
{
|
{
|
||||||
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();
|
tcpClient.Connect();
|
||||||
|
|||||||
Reference in New Issue
Block a user