| ofs | hex dump | ascii |
|---|
| 0000 | 4f 54 54 4f 00 0c 00 80 00 03 00 40 43 46 46 20 95 1f 2f 43 00 00 0f 7c 00 00 c2 5c 44 53 49 47 | OTTO.......@CFF.../C...|...\DSIG |
| 0020 | c3 0f a1 bb 00 01 b4 04 00 00 03 f4 47 50 4f 53 55 5d d7 eb 00 00 d1 d8 00 00 cb 70 47 53 55 42 | ............GPOSU].........pGSUB |
| 0040 | ea e1 bf 70 00 01 9d 48 00 00 10 10 4f 53 2f 32 cc f0 29 57 00 00 01 30 00 00 00 60 63 6d 61 70 | ...p...H....OS/2..)W...0...`cmap |
| 0060 | 2b ed 7e 09 00 00 09 80 00 00 05 dc 68 65 61 64 04 c2 c9 e2 00 00 00 cc 00 00 00 36 68 68 65 61 | +.~.........head...........6hhea |
| 0080 | 1b bc 0e 39 00 00 01 04 00 00 00 24 68 6d 74 78 a8 4c d3 c2 00 01 ad 58 00 00 06 ac 6d 61 78 70 | ...9.......$hmtx.L.....X....maxp |
| 00a0 | 01 ab 50 00 00 00 01 28 00 00 00 06 6e 61 6d 65 41 ed 4e f8 00 00 01 90 00 00 07 ed 70 6f 73 74 | ..P....(....nameA.N.........post |
| 00c0 | fe ca 00 a7 00 00 0f 5c 00 00 00 20 00 01 00 00 00 01 01 89 da e5 95 6c 5f 0f 3c f5 00 03 0d 05 | .......\...............l_.<..... |
| 00e0 | 00 00 00 00 cb 6a ba 8f 00 00 00 00 cb 6a ba 8f fd b3 fc b4 11 22 0c 8a 00 01 00 03 00 02 00 00 | .....j.......j.......".......... |
| 0100 | 00 00 00 00 00 01 00 00 0a 49 fd 44 02 9b 11 96 fd b3 fd b3 11 22 00 01 00 00 00 00 00 00 00 00 | .........I.D.........".......... |
| 0120 | 00 00 00 00 00 00 01 ab 00 00 50 00 01 ab 00 00 00 02 06 fd 03 20 00 05 00 04 09 1d 08 77 00 00 | ..........P..................w.. |
| 0140 | 01 d3 09 1d 08 77 00 00 06 36 00 a6 02 ed 00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 af 40 00 | .....w...6....................@. |
| 0160 | 20 6b 00 00 00 00 00 00 00 00 44 75 72 6f 00 20 00 20 fb 04 0a 49 fd 44 02 9b 0b 97 04 09 00 00 | .k........Duro.......I.D........ |
| 0180 | 00 13 00 00 00 00 06 f5 09 1a 00 00 00 20 00 0c 00 00 00 22 01 9e 00 01 00 00 00 00 00 00 00 46 | ..................."...........F |
| 01a0 | 00 00 00 01 00 00 00 00 00 01 00 05 00 46 00 01 00 00 00 00 00 02 00 05 00 4b 00 01 00 00 00 00 | .............F...........K...... |
| 01c0 | 00 03 00 2c 00 50 00 01 00 00 00 00 00 04 00 0b 00 7c 00 01 00 00 00 00 00 05 00 29 00 87 00 01 | ...,.P...........|.........).... |
| 01e0 | 00 00 00 00 00 06 00 0b 00 b0 00 01 00 00 00 00 00 07 00 21 00 bb 00 01 00 00 00 00 00 08 00 08 | ...................!............ |
| 0200 | 00 dc 00 01 00 00 00 00 00 09 00 08 00 e4 00 01 00 00 00 00 00 0a 00 01 00 ec 00 01 00 00 00 00 | ................................ |
| 0220 | 00 0b 00 10 00 ed 00 01 00 00 00 00 00 0c 00 01 00 ec 00 01 00 00 00 00 00 0d 01 1a 00 fd 00 01 | ................................ |
| 0240 | 00 00 00 00 00 0e 00 10 00 ed 00 01 00 00 00 00 00 10 00 05 00 46 00 01 00 00 00 00 00 11 00 05 | .....................F.......... |
| 0260 | 00 4b 00 03 00 01 04 09 00 00 00 8c 02 17 00 03 00 01 04 09 00 01 00 18 02 a3 00 03 00 01 04 09 | .K.............................. |
| 0280 | 00 02 00 08 02 bb 00 03 00 01 04 09 00 03 00 58 02 c3 00 03 00 01 04 09 00 04 00 16 03 1b 00 03 | ...............X................ |
| 02a0 | 00 01 04 09 00 05 00 52 03 31 00 03 00 01 04 09 00 06 00 16 03 1b 00 03 00 01 04 09 00 07 00 42 | .......R.1.....................B |
| 02c0 | 03 83 00 03 00 01 04 09 00 08 00 10 03 c5 00 03 00 01 04 09 00 09 00 10 03 d5 00 03 00 01 04 09 | ................................ |
| 02e0 | 00 0a 00 02 03 e5 00 03 00 01 04 09 00 0b 00 20 03 e7 00 03 00 01 04 09 00 0c 00 02 03 e5 00 03 | ................................ |
| 0300 | 00 01 04 09 00 0d 02 34 04 07 00 03 00 01 04 09 00 0e 00 20 03 e7 00 03 00 01 04 09 00 10 00 0a | pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */using Microsoft.WindowsAPICodePack.Net;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.Core;
using Tango.Core.DI;
using Tango.Integration.ExternalBridge;
using Tango.PPC.Common.Application;
using Tango.PPC.Common.Connectivity;
using Tango.PPC.Common.ExternalBridge;
using Tango.PPC.Shared.Information;
using Tango.Settings;
using Tango.SystemInfo;
namespace Tango.PPC.Common.SystemInfo
{
[TangoCreateWhenRegistered]
public class DefaultSystemInfoService : ExtendedObject, ISystemInfoService, IExternalBridgeRequestHandler
{
public bool Enabled { get; set; } = true;
private List<SystemObjectsCollection> _baseSystemInfo;
private IPPCApplicationManager _applicationManager;
private IConnectivityProvider _connectivityProvider;
public DefaultSystemInfoService(IPPCExternalBridgeService externalBridge, IPPCApplicationManager applicationManager, IConnectivityProvider connectivityProvider)
{
_applicationManager = applicationManager;
_connectivityProvider = connectivityProvider;
externalBridge.RegisterRequestHandler(this);
}
[ExternalBridgeRequestHandlerMethod(typeof(GetMachineInformationRequest), RequestHandlerLoggingMode.LogRequestName)]
public async Task OnGetMachineInformationRequest(GetMachineInformationRequest request, String token, ExternalBridgeReceiver receiver)
{
if (_baseSystemInfo == null) //Create hardware info just once.
{
_baseSystemInfo = new List<SystemObjectsCollection>();
if (!Debugger.IsAttached)
{
_baseSystemInfo = SystemObjectsCollection.Create();
}
}
//Now always update the latest custom objects..
var system = _baseSystemInfo.ToList();
//Get the networks that are currently connected to
var connectedNetwork = NetworkListManager.GetNetworks(NetworkConnectivityLevels.Connected).FirstOrDefault();
var settings = SettingsManager.Default.GetOrCreate<PPCSettings>();
var applicationCollection = new SystemObjectsCollection();
applicationCollection.Name = "Application";
system.Insert(0, applicationCollection);
//Application.
applicationCollection.Objects.Add(new SystemObject()
{
Name = "Tango PPC",
Properties = new List<SystemObjectProperty>()
{
new SystemObjectProperty() { Name = "Version", Value = _applicationManager.Version.ToString(3) },
new SystemObjectProperty() { Name = "Build Date", Value = _applicationManager.BuildDate },
new SystemObjectProperty() { Name = "Previous Version", Value = settings.PreviousApplicationVersion },
new SystemObjectProperty() { Name = "Firmware Version", Value = _applicationManager.FirmwareVersion.ToStringSafe() },
new SystemObjectProperty() { Name = "Technician Mode", Value = _applicationManager.IsInTechnicianMode.ToStringYesNo() },
new SystemObjectProperty() { Name = "After Update", Value = _applicationManager.IsAfterUpdate.ToStringYesNo() },
new SystemObjectProperty() { Name = "Startup Date", Value = _applicationManager.StartUpDate.ToString() },
},
});
//Network.
if (connectedNetwork != null)
{
applicationCollection.Objects.Add(new SystemObject()
{
Name = "Network",
Properties = new List<SystemObjectProperty>()
{
new SystemObjectProperty() { Name = "Network Name", Value = connectedNetwork.Name },
new SystemObjectProperty() { Name = "Category", Value = connectedNetwork.Category.ToString() },
new SystemObjectProperty() { Name = "Type", Value = connectedNetwork.Connectivity.ToString() },
new SystemObjectProperty() { Name = "Domain", Value = connectedNetwork.DomainType.ToString() },
new SystemObjectProperty() { Name = "Connected Time", Value = connectedNetwork.ConnectedTime.ToString() },
new SystemObjectProperty() { Name = "Internet Connection", Value = connectedNetwork.IsConnectedToInternet.ToStringYesNo() },
},
});
}
//Settings.
applicationCollection.Objects.Add(new SystemObject()
{
Name = "Settings",
Properties = new List<SystemObjectProperty>()
{
new SystemObjectProperty() { Name = "Application State", Value = settings.ApplicationState.ToString() },
new SystemObjectProperty() { Name = "Auto Update Check", Value = settings.AutoCheckForUpdates.ToStringYesNo() },
new SystemObjectProperty() { Name = "Auto Update Interval", Value = settings.AutoUpdateCheckInterval.ToString() },
new SystemObjectProperty() { Name = "Automatic Thread Loading", Value = settings.EnableAutomaticThreadLoading.ToStringYesNo() },
new SystemObjectProperty() { Name = "Firmware Logs Enabled", Value = settings.EnableEmbeddedDebugLogs.ToStringYesNo() },
new SystemObjectProperty() { Name = "Emergency Switch Enabled", Value = settings.EnableEmergencyNotifications.ToStringYesNo() },
new SystemObjectProperty() { Name = "Liquid Quantity Validation Enabled", Value = settings.EnableJobLiquidQuantityValidation.ToStringYesNo() },
new SystemObjectProperty() { Name = "Remote Assistance Enabled", Value = settings.EnableRemoteAssistance.ToStringYesNo() },
new SystemObjectProperty() { Name = "Remote Desktop Enabled", Value = settings.EnableRemoteDesktop.ToStringYesNo() },
new SystemObjectProperty() { Name = "Start in Technician Mode", Value = settings.EnableTechnicianModeByDefault.ToStringYesNo() },
new SystemObjectProperty() { Name = "Watchdog Enabled", Value = settings.EnableWatchDog.ToStringYesNo() },
new SystemObjectProperty() { Name = "Job Units Method", Value = settings.JobUnitsMethod.ToString() },
new SystemObjectProperty() { Name = "PowerUp Screen Enabled", Value = settings.DisplayPowerUpScreen.ToStringYesNo() },
new SystemObjectProperty() { Name = "Firmware COM Port", Value = settings.EmbeddedComPort.ToStringOrEmpty() },
new SystemObjectProperty() { Name = "Emergency COM Port", Value = settings.EmergencyComPort.ToStringOrEmpty() },
new SystemObjectProperty() { Name = "Job Upload Method", Value = settings.JobUploadStrategy.ToString() },
new SystemObjectProperty() { Name = "Diagnostics Synchronization", Value = settings.SynchronizeDiagnostics.ToStringYesNo() },
new SystemObjectProperty() { Name = "Jobs Synchronization", Value = settings.SynchronizeJobs.ToStringYesNo() },
new SystemObjectProperty() { Name = "TCP Write Mode", Value = settings.TcpTransportAdapterWriteMode.ToString() },
}.OrderBy(x => x.Name).ToList(),
});
await receiver.SendGenericResponse(new GetMachineInformationResponse()
{
Package = new InformationPackage()
{
System = system,
}
}, token);
}
public void OnReceiverDisconnected(ExternalBridgeReceiver receiver)
{
}
}
}
|