@aryacode/dsh-engineering 0.4.4 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +11 -8
  3. package/cordis.patch.yml +3 -2
  4. package/package.json +3 -2
  5. package/vendor/l5x/cip-worker.mjs +181 -0
  6. package/vendor/l5x/lib/core/params.d.ts +3 -1
  7. package/vendor/l5x/lib/core/params.js +4 -0
  8. package/vendor/l5x/lib/engine/cip-request.d.ts +85 -0
  9. package/vendor/l5x/lib/engine/cip-request.js +134 -0
  10. package/vendor/l5x/lib/engine/cip-transaction.d.ts +115 -0
  11. package/vendor/l5x/lib/engine/cip-transaction.js +185 -0
  12. package/vendor/l5x/lib/live.d.ts +5 -0
  13. package/vendor/l5x/lib/live.js +13 -2
  14. package/vendor/l5x/lib/tools/live.d.ts +17 -6
  15. package/vendor/l5x/lib/tools/live.js +177 -15
  16. package/vendor/optix/bridge/LICENSE +35 -0
  17. package/vendor/optix/bridge/StudioMCPBridge.cs +7022 -0
  18. package/vendor/optix/bridge/source.json +10 -0
  19. package/vendor/optix/icon.svg +13 -0
  20. package/vendor/optix/lib/index.js +1531 -0
  21. package/vendor/optix/lib/types/bridge.d.ts +77 -0
  22. package/vendor/optix/lib/types/index.d.ts +52 -0
  23. package/vendor/optix/lib/types/ocr.d.ts +46 -0
  24. package/vendor/optix/lib/types/operations.d.ts +42 -0
  25. package/vendor/optix/lib/types/preview.d.ts +33 -0
  26. package/vendor/optix/lib/types/templates.d.ts +18 -0
  27. package/vendor/optix/locale/en.json +6 -0
  28. package/vendor/optix/locale/zh.json +6 -0
  29. package/vendor/optix/templates/arya-optix-ipc/manifest.json +260 -0
  30. package/vendor/optix/templates/arya-optix-ipc/project/AryaNewHMIProject_IPC.optix +81 -0
  31. package/vendor/optix/templates/arya-optix-ipc/project/AryaNewHMIProject_IPC.optix.design +38 -0
  32. package/vendor/optix/templates/arya-optix-ipc/project/IDEVersion.txt +1 -0
  33. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/Alarms/Alarms.yaml +3 -0
  34. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/AryaNewHMIProject_IPC.yaml +67 -0
  35. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/CommDrivers/CommDrivers.yaml +2 -0
  36. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/Converters/Converters.yaml +2 -0
  37. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/DataStores/DataStores.yaml +2 -0
  38. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/Loggers/Loggers.yaml +2 -0
  39. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/MQTT/MQTT.yaml +2 -0
  40. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/Model/Model.yaml +2 -0
  41. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/NetLogic/NetLogic.yaml +28 -0
  42. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/OPC-UA/OPC-UA.yaml +2 -0
  43. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/Recipes/Recipes.yaml +2 -0
  44. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/Reports/Reports.yaml +2 -0
  45. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/Retentivity/Retentivity.yaml +57 -0
  46. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/Security/Groups/Groups.yaml +3 -0
  47. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/Security/Roles/Roles.yaml +3 -0
  48. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/Security/Security.yaml +7 -0
  49. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/Security/Users/Users.yaml +3 -0
  50. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/System/System.yaml +2 -0
  51. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/Translations/Translations.yaml +16 -0
  52. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/UI/Keyboards/Keyboards.yaml +2 -0
  53. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/UI/Screens/Screens.yaml +2 -0
  54. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/UI/UI.yaml +306 -0
  55. package/vendor/optix/templates/arya-optix-ipc/project/ProjectFiles/NetSolution/.vscode/launch.json +19 -0
  56. package/vendor/optix/templates/arya-optix-ipc/project/ProjectFiles/NetSolution/AryaNewHMIProject_IPC.code-workspace +10 -0
  57. package/vendor/optix/templates/arya-optix-ipc/project/ProjectFiles/NetSolution/AryaNewHMIProject_IPC.csproj +19 -0
  58. package/vendor/optix/templates/arya-optix-ipc/project/ProjectFiles/NetSolution/AryaNewHMIProject_IPC.references +172 -0
  59. package/vendor/optix/templates/arya-optix-ipc/project/ProjectFiles/NetSolution/AryaNewHMIProject_IPC.sln +21 -0
  60. package/vendor/optix/templates/arya-optix-ipc/project/ProjectFiles/NetSolution/Private/TypeConstants.cs +20 -0
  61. package/vendor/optix/templates/arya-optix-ipc/project/ProjectFiles/NetSolution/Private/UITypeDefinitions.cs +11 -0
  62. package/vendor/optix/templates/arya-optix-ipc/project/ProjectFiles/NetSolution/StudioMCPBridge.cs +4555 -0
  63. package/vendor/optix/templates/arya-optix-ipc/project/ProjectFiles/UserDefinedModule.xml +26 -0
  64. package/vendor/optix/templates/arya-optix-panel/manifest.json +411 -0
  65. package/vendor/optix/templates/arya-optix-panel/project/AryaNewHMIProject_OptixPanel.optix +97 -0
  66. package/vendor/optix/templates/arya-optix-panel/project/AryaNewHMIProject_OptixPanel.optix.design +38 -0
  67. package/vendor/optix/templates/arya-optix-panel/project/IDEVersion.txt +1 -0
  68. package/vendor/optix/templates/arya-optix-panel/project/Nodes/Alarms/Alarms.yaml +3 -0
  69. package/vendor/optix/templates/arya-optix-panel/project/Nodes/AryaNewHMIProject_OptixPanel.yaml +67 -0
  70. package/vendor/optix/templates/arya-optix-panel/project/Nodes/CommDrivers/CommDrivers.yaml +2 -0
  71. package/vendor/optix/templates/arya-optix-panel/project/Nodes/Converters/Converters.yaml +2 -0
  72. package/vendor/optix/templates/arya-optix-panel/project/Nodes/DataStores/DataStores.yaml +2 -0
  73. package/vendor/optix/templates/arya-optix-panel/project/Nodes/Loggers/Loggers.yaml +2 -0
  74. package/vendor/optix/templates/arya-optix-panel/project/Nodes/MQTT/MQTT.yaml +2 -0
  75. package/vendor/optix/templates/arya-optix-panel/project/Nodes/Model/Model.yaml +2 -0
  76. package/vendor/optix/templates/arya-optix-panel/project/Nodes/NetLogic/NetLogic.yaml +28 -0
  77. package/vendor/optix/templates/arya-optix-panel/project/Nodes/OPC-UA/OPC-UA.yaml +2 -0
  78. package/vendor/optix/templates/arya-optix-panel/project/Nodes/Recipes/Recipes.yaml +2 -0
  79. package/vendor/optix/templates/arya-optix-panel/project/Nodes/Reports/Reports.yaml +2 -0
  80. package/vendor/optix/templates/arya-optix-panel/project/Nodes/Retentivity/Retentivity.yaml +57 -0
  81. package/vendor/optix/templates/arya-optix-panel/project/Nodes/Security/Groups/Groups.yaml +3 -0
  82. package/vendor/optix/templates/arya-optix-panel/project/Nodes/Security/Roles/Roles.yaml +3 -0
  83. package/vendor/optix/templates/arya-optix-panel/project/Nodes/Security/Security.yaml +7 -0
  84. package/vendor/optix/templates/arya-optix-panel/project/Nodes/Security/Users/Users.yaml +3 -0
  85. package/vendor/optix/templates/arya-optix-panel/project/Nodes/System/System.yaml +444 -0
  86. package/vendor/optix/templates/arya-optix-panel/project/Nodes/Translations/Translations.yaml +81 -0
  87. package/vendor/optix/templates/arya-optix-panel/project/Nodes/UI/Keyboards/Keyboards.yaml +2 -0
  88. package/vendor/optix/templates/arya-optix-panel/project/Nodes/UI/Screens/Screens.yaml +2 -0
  89. package/vendor/optix/templates/arya-optix-panel/project/Nodes/UI/SettingsWidgets/DeviceSettingsWidget/DeviceSettingsWidget.yaml +163 -0
  90. package/vendor/optix/templates/arya-optix-panel/project/Nodes/UI/SettingsWidgets/DeviceSettingsWidget/DeviceSettingsWidgetComponents/DeviceSettingsWidgetComponents.yaml +1663 -0
  91. package/vendor/optix/templates/arya-optix-panel/project/Nodes/UI/SettingsWidgets/FactoryTalkRemoteAccessWidget/FTRemoteAccessWidgetComponents/FTRemoteAccessWidgetComponents.yaml +2471 -0
  92. package/vendor/optix/templates/arya-optix-panel/project/Nodes/UI/SettingsWidgets/FactoryTalkRemoteAccessWidget/FactoryTalkRemoteAccessWidget.yaml +218 -0
  93. package/vendor/optix/templates/arya-optix-panel/project/Nodes/UI/SettingsWidgets/NetworkSettingsWidget/NetworkSettingsWidget.yaml +524 -0
  94. package/vendor/optix/templates/arya-optix-panel/project/Nodes/UI/SettingsWidgets/NetworkSettingsWidget/NetworkSettingsWidgetComponents/NetworkSettingsWidgetComponents.yaml +690 -0
  95. package/vendor/optix/templates/arya-optix-panel/project/Nodes/UI/SettingsWidgets/SettingsWidgets.yaml +1265 -0
  96. package/vendor/optix/templates/arya-optix-panel/project/Nodes/UI/UI.yaml +308 -0
  97. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/.vscode/launch.json +19 -0
  98. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/ApplicationNameLogic.cs +19 -0
  99. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/AryaNewHMIProject_OptixPanel.code-workspace +10 -0
  100. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/AryaNewHMIProject_OptixPanel.csproj +19 -0
  101. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/AryaNewHMIProject_OptixPanel.references +172 -0
  102. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/AryaNewHMIProject_OptixPanel.sln +21 -0
  103. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/ConnectionSwitchLogic.cs +74 -0
  104. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/DateAndTimeWidgetLogic.cs +420 -0
  105. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/DeviceSettingsWidgetLogic.cs +34 -0
  106. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/FTOptixStudioVersionLogic.cs +47 -0
  107. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/FTRemoteAccessWidgetSetupLogic.cs +153 -0
  108. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/IncomingConnectionApprovalLogic.cs +118 -0
  109. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/IncomingConnectionReceiverLogic.cs +166 -0
  110. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/NetworkConfiguratorEditModelsLogic.cs +56 -0
  111. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/NetworkInterfaceLogic.cs +138 -0
  112. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/NetworkInterfacesEditModelReaderLogic.cs +87 -0
  113. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/NetworkInterfacesEditModelToSystemWriterLogic.cs +139 -0
  114. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/NetworkSettingsLogic.cs +168 -0
  115. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/Private/FTRemoteAccessWidgetDataObject.cs +106 -0
  116. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/Private/TypeConstants.cs +37 -0
  117. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/Private/UITypeDefinitions.cs +91 -0
  118. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/RequestAssistanceSwitchLogic.cs +93 -0
  119. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/StudioMCPBridge.cs +4555 -0
  120. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/SystemToNetworkInterfacesEditModelWriterLogic.cs +77 -0
  121. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/UserDefinedModule.xml +111 -0
  122. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/WarningIcon.svg +4 -0
@@ -0,0 +1,87 @@
1
+ #region Using directives
2
+ using UAManagedCore;
3
+ using FTOptix.NetLogic;
4
+ using FTOptix.UI;
5
+ using FTOptix.SerialPort;
6
+ #endregion
7
+
8
+ public class NetworkInterfacesEditModelReaderLogic : BaseNetLogic
9
+ {
10
+ public NetworkInterfacesEditModelReaderLogic(IUAObject editModelNetworkInterfacesObject)
11
+ {
12
+ this.editModelNetworkInterfacesObject = editModelNetworkInterfacesObject;
13
+ }
14
+
15
+ public NetworkInterfacesEditModelReaderLogic() {}
16
+
17
+ public IUAVariable GetDhcpVariable(string interfaceName)
18
+ {
19
+ var networkInterfaceObject = editModelNetworkInterfacesObject.GetObject(interfaceName);
20
+ var variable = networkInterfaceObject.GetVariable("DHCPClientEnabled");
21
+ if (variable == null)
22
+ throw new CoreConfigurationException("DHCPClientEnabled variable not found");
23
+
24
+ return variable;
25
+ }
26
+
27
+ public IUAVariable GetIPAddressVariable(string interfaceName)
28
+ {
29
+ var networkInterfaceObject = editModelNetworkInterfacesObject.GetObject(interfaceName);
30
+ var variable = networkInterfaceObject.GetVariable("IPAddress");
31
+ if (variable == null)
32
+ throw new CoreConfigurationException("IPAddress variable not found");
33
+
34
+ return variable;
35
+ }
36
+
37
+ public IUAVariable GetMaskVariable(string interfaceName)
38
+ {
39
+ var variable = GetIPAddressVariable(interfaceName).GetVariable("Mask");
40
+ if (variable == null)
41
+ throw new CoreConfigurationException("Mask variable not found");
42
+
43
+ return variable;
44
+ }
45
+
46
+ public IUAVariable GetDNS1Variable(string interfaceName)
47
+ {
48
+ var networkInterfaceObject = editModelNetworkInterfacesObject.GetObject(interfaceName);
49
+ var variable = networkInterfaceObject.GetVariable("DNS1");
50
+ if (variable == null)
51
+ throw new CoreConfigurationException("DNS1 variable not found");
52
+
53
+ return variable;
54
+ }
55
+
56
+ public IUAVariable GetDNS2Variable(string interfaceName)
57
+ {
58
+ var networkInterfaceObject = editModelNetworkInterfacesObject.GetObject(interfaceName);
59
+ var variable = networkInterfaceObject.GetVariable("DNS2");
60
+ if (variable == null)
61
+ throw new CoreConfigurationException("DNS2 variable not found");
62
+
63
+ return variable;
64
+ }
65
+
66
+ public IUAVariable GetDefaultGatewayVariable(string interfaceName)
67
+ {
68
+ var networkInterfaceObject = editModelNetworkInterfacesObject.GetObject(interfaceName);
69
+ var variable = networkInterfaceObject.GetVariable("DefaultGateway");
70
+ if (variable == null)
71
+ throw new CoreConfigurationException("DefaultGateway variable not found");
72
+
73
+ return variable;
74
+ }
75
+
76
+ public IUAObject GetAdditionalIPAddressesObject(string interfaceName)
77
+ {
78
+ var networkInterfaceObject = editModelNetworkInterfacesObject.GetObject(interfaceName);
79
+ var additonalIPAddressesObject = networkInterfaceObject.GetObject("AdditionalIPAddresses");
80
+ if (additonalIPAddressesObject == null)
81
+ throw new CoreConfigurationException("AdditionalIPAddresses object not found");
82
+
83
+ return additonalIPAddressesObject;
84
+ }
85
+
86
+ readonly private IUAObject editModelNetworkInterfacesObject;
87
+ }
@@ -0,0 +1,139 @@
1
+ #region Using directives
2
+ using UAManagedCore;
3
+ using FTOptix.System;
4
+ using FTOptix.NetLogic;
5
+ using System.Collections.Generic;
6
+ using System.Text.RegularExpressions;
7
+ using FTOptix.UI;
8
+ using FTOptix.SerialPort;
9
+ #endregion
10
+
11
+ public class NetworkInterfacesEditModelToSystemWriterLogic : BaseNetLogic
12
+ {
13
+ public NetworkInterfacesEditModelToSystemWriterLogic(IUAObject editModelNetworkInterfacesObject)
14
+ {
15
+ editModelNetworkInterfacesReader = new NetworkInterfacesEditModelReaderLogic(editModelNetworkInterfacesObject);
16
+ }
17
+
18
+ public NetworkInterfacesEditModelToSystemWriterLogic() {}
19
+
20
+ public void WriteEditModelToSystemModel(List<NetworkInterface> networkInterfaces)
21
+ {
22
+ foreach (NetworkInterface networkInterface in networkInterfaces)
23
+ {
24
+ string interfaceName = networkInterface.BrowseName;
25
+ if (string.IsNullOrEmpty(interfaceName))
26
+ continue;
27
+
28
+ var dhcpEditModel = editModelNetworkInterfacesReader.GetDhcpVariable(interfaceName).Value;
29
+ if (dhcpEditModel)
30
+ {
31
+ networkInterface.DHCPClientEnabled = dhcpEditModel;
32
+ Log.Info(NetworkSettingsLogic.LOGGING_CATEGORY, $"DHCP is enabled for network interface {interfaceName}. The rest of the configuration will be ignored.");
33
+ continue;
34
+ }
35
+
36
+ var ipAddressVariable = editModelNetworkInterfacesReader.GetIPAddressVariable(interfaceName);
37
+ var maskVariable = editModelNetworkInterfacesReader.GetMaskVariable(interfaceName);
38
+ var dns1Variable = editModelNetworkInterfacesReader.GetDNS1Variable(interfaceName);
39
+ var dns2Variable = editModelNetworkInterfacesReader.GetDNS2Variable(interfaceName);
40
+ var defaultGatewayVariable = editModelNetworkInterfacesReader.GetDefaultGatewayVariable(interfaceName);
41
+
42
+ EditModelNetworkInterface editModelNetworkInterface = new()
43
+ {
44
+ interfaceName = interfaceName,
45
+ dhcpEnabled = false,
46
+ ipAddress = ipAddressVariable.Value,
47
+ mask = maskVariable.Value,
48
+ dns1 = dns1Variable.Value,
49
+ dns2 = dns2Variable.Value,
50
+ defaultGateway = defaultGatewayVariable.Value
51
+ };
52
+
53
+ if (!WriteStandardPropertiesIntoSystemModel(editModelNetworkInterface, networkInterface))
54
+ continue;
55
+ }
56
+ }
57
+
58
+ private static bool WriteStandardPropertiesIntoSystemModel(EditModelNetworkInterface editModelNetworkInterface, NetworkInterface networkInterface)
59
+ {
60
+ var isStandardConfigurationValid = IPAddressValidator.IsStandardConfigurationValid(editModelNetworkInterface);
61
+ if (!isStandardConfigurationValid)
62
+ {
63
+ Log.Error(NetworkSettingsLogic.LOGGING_CATEGORY, $"Configuration for network interface {editModelNetworkInterface.interfaceName} is not valid. The last valid configuration will be used.");
64
+ return false;
65
+ }
66
+
67
+ networkInterface.DHCPClientEnabled = editModelNetworkInterface.dhcpEnabled;
68
+ networkInterface.IPAddress = editModelNetworkInterface.ipAddress;
69
+ networkInterface.IPAddressVariable.Mask = editModelNetworkInterface.mask;
70
+ networkInterface.DNS1 = editModelNetworkInterface.dns1;
71
+ networkInterface.DNS2 = editModelNetworkInterface.dns2;
72
+ networkInterface.DefaultGateway = editModelNetworkInterface.defaultGateway;
73
+
74
+ return true;
75
+ }
76
+
77
+ private struct EditModelNetworkInterface
78
+ {
79
+ public string interfaceName;
80
+ public bool dhcpEnabled;
81
+ public string ipAddress;
82
+ public string mask;
83
+ public string dns1;
84
+ public string dns2;
85
+ public string defaultGateway;
86
+ };
87
+
88
+ readonly private NetworkInterfacesEditModelReaderLogic editModelNetworkInterfacesReader;
89
+
90
+ private class IPAddressValidator
91
+ {
92
+ public static bool IsStandardConfigurationValid(EditModelNetworkInterface editModelNetworkInterface)
93
+ {
94
+ bool isValid = true;
95
+ var interfaceName = editModelNetworkInterface.interfaceName;
96
+ var ipAddressString = editModelNetworkInterface.ipAddress;
97
+ if (!IsValidIPAddress(ipAddressString))
98
+ {
99
+ Log.Error(NetworkSettingsLogic.LOGGING_CATEGORY, $"IP address {ipAddressString} for network interface {interfaceName} is invalid.");
100
+ isValid = false;
101
+ }
102
+
103
+ var maskString = editModelNetworkInterface.mask;
104
+ if (!IsValidIPAddress(maskString))
105
+ {
106
+ Log.Error(NetworkSettingsLogic.LOGGING_CATEGORY, $"Mask {maskString} for network interface {interfaceName} is invalid.");
107
+ isValid = false;
108
+ }
109
+
110
+ var dns1String = editModelNetworkInterface.dns1;
111
+ if (!string.IsNullOrEmpty(dns1String) && !IsValidIPAddress(dns1String))
112
+ {
113
+ Log.Error(NetworkSettingsLogic.LOGGING_CATEGORY, $"DNS1 {dns1String} for network interface {interfaceName} is invalid.");
114
+ isValid = false;
115
+ }
116
+
117
+ var dns2String = editModelNetworkInterface.dns2;
118
+ if (!string.IsNullOrEmpty(dns2String) && !IsValidIPAddress(dns2String))
119
+ {
120
+ Log.Error(NetworkSettingsLogic.LOGGING_CATEGORY, $"DNS2 {dns2String} for network interface {interfaceName} is invalid.");
121
+ isValid = false;
122
+ }
123
+
124
+ var defaultGatewayString = editModelNetworkInterface.defaultGateway;
125
+ if (!string.IsNullOrEmpty(defaultGatewayString) && !IsValidIPAddress(defaultGatewayString))
126
+ {
127
+ Log.Error(NetworkSettingsLogic.LOGGING_CATEGORY, $"DefaultGateway {defaultGatewayString} for network interface {interfaceName} is invalid.");
128
+ isValid = false;
129
+ }
130
+
131
+ return isValid;
132
+ }
133
+
134
+ private static bool IsValidIPAddress(string ipAddress)
135
+ {
136
+ return Regex.IsMatch(ipAddress, "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$");
137
+ }
138
+ }
139
+ }
@@ -0,0 +1,168 @@
1
+ #region Using directives
2
+ using System;
3
+ using UAManagedCore;
4
+ using FTOptix.HMIProject;
5
+ using FTOptix.NetLogic;
6
+ using FTOptix.UI;
7
+ using System.Linq;
8
+ using FTOptix.SerialPort;
9
+ #endregion
10
+
11
+ public class NetworkSettingsLogic : BaseNetLogic
12
+ {
13
+ public const string LOGGING_CATEGORY = nameof(NetworkSettingsLogic);
14
+
15
+ public override void Start()
16
+ {
17
+ IUAVariable systemNodePointer = Owner.GetVariable("SystemNode");
18
+ if (systemNodePointer == null)
19
+ {
20
+ HandleInvalidConfiguration();
21
+ Log.Error(LOGGING_CATEGORY, "SystemNode NodePointer not found.");
22
+ return;
23
+ }
24
+
25
+ NodeId systemNodeId = (NodeId)systemNodePointer.Value;
26
+ if (systemNodeId == null || systemNodeId == NodeId.Empty)
27
+ {
28
+ HandleInvalidConfiguration();
29
+ Log.Error(LOGGING_CATEGORY, "SystemNode is not defined.");
30
+ return;
31
+ }
32
+
33
+ systemNode = InformationModel.Get(systemNodeId) as FTOptix.System.System;
34
+
35
+ if (systemNode == null || systemNode.NetworkInterfaces.Count < 1)
36
+ HandleInvalidConfiguration();
37
+
38
+ if (systemNode == null)
39
+ {
40
+ Log.Error(LOGGING_CATEGORY, "SystemNode not found.");
41
+ return;
42
+ }
43
+
44
+ networkConfiguratorEditModels = Owner.GetObject("NetworkConfiguratorEditModels");
45
+ if (networkConfiguratorEditModels == null)
46
+ throw new CoreConfigurationException("NetworkConfiguratorEditModels object not found");
47
+
48
+ NetworkConfiguratorEditModelsLogic.CreateEditModels(systemNode, networkConfiguratorEditModels);
49
+ var editModelNetworkInterfaces = NetworkConfiguratorEditModelsLogic.GetNetworkInterfacesEditModel(networkConfiguratorEditModels);
50
+
51
+ networkInterfacesEditModelToSystemWriter = new NetworkInterfacesEditModelToSystemWriterLogic(editModelNetworkInterfaces);
52
+
53
+ navPanel = Owner.Get<NavigationPanel>("NavigationPanel1");
54
+ if (navPanel == null)
55
+ throw new CoreConfigurationException("NavigationPanel1 object not found");
56
+
57
+ systemNode.RebootRequiredVariable.VariableChange += RebootRequiredVariable_VariableChange;
58
+ EnableControlsForRebootRequired(systemNode.RebootRequired);
59
+
60
+ navPanel.CurrentPanelVariable.VariableChange += CurrentPanelVariable_VariableChange;
61
+
62
+ NodeId nodeId = (NodeId)navPanel.CurrentPanel;
63
+ if (nodeId != null && nodeId != NodeId.Empty)
64
+ HandleNetworkInterfacePanel(nodeId);
65
+ }
66
+
67
+ public override void Stop()
68
+ {
69
+ if (networkConfiguratorEditModels != null)
70
+ NetworkConfiguratorEditModelsLogic.DeleteEditModels(networkConfiguratorEditModels);
71
+
72
+ if (systemNode != null)
73
+ systemNode.RebootRequiredVariable.VariableChange -= RebootRequiredVariable_VariableChange;
74
+
75
+ if (navPanel != null)
76
+ navPanel.CurrentPanelVariable.VariableChange -= CurrentPanelVariable_VariableChange;
77
+
78
+ systemNode = null;
79
+ networkConfiguratorEditModels = null;
80
+ networkInterfacesEditModelToSystemWriter = null;
81
+ networkInterfaceLogic = null;
82
+ navPanel = null;
83
+ }
84
+
85
+ [ExportMethod]
86
+ public void ApplyNetworkConfiguration()
87
+ {
88
+ try
89
+ {
90
+ networkInterfacesEditModelToSystemWriter.WriteEditModelToSystemModel(systemNode.NetworkInterfaces.ToList());
91
+ }
92
+ catch (Exception ex)
93
+ {
94
+ Log.Error(LOGGING_CATEGORY, $"Failed to apply network configuration: {ex.Message}");
95
+ }
96
+ }
97
+
98
+ [ExportMethod]
99
+ public void Reboot()
100
+ {
101
+ if (systemNode == null)
102
+ {
103
+ Log.Error(LOGGING_CATEGORY, "SystemNode reference not defined. Reboot failed.");
104
+ return;
105
+ }
106
+
107
+ systemNode.Reboot();
108
+ }
109
+
110
+ private void CurrentPanelVariable_VariableChange(object sender, VariableChangeEventArgs e)
111
+ {
112
+ HandleNetworkInterfacePanel((NodeId)e.NewValue.Value);
113
+ }
114
+
115
+ private void RebootRequiredVariable_VariableChange(object sender, VariableChangeEventArgs e)
116
+ {
117
+ EnableControlsForRebootRequired((bool)e.NewValue.Value);
118
+ }
119
+
120
+ private void HandleNetworkInterfacePanel(NodeId nodeId)
121
+ {
122
+ if (nodeId == null || nodeId == NodeId.Empty)
123
+ return;
124
+
125
+ IUANode node = InformationModel.Get(nodeId);
126
+
127
+ networkInterfaceLogic = new NetworkInterfaceLogic();
128
+ networkInterfaceLogic.SetMembers(systemNode, node.BrowseName, networkConfiguratorEditModels, node);
129
+ }
130
+
131
+ private void EnableControlsForRebootRequired(bool rebootRequired)
132
+ {
133
+ Button rebootButton = Owner.Get<Button>("BottomBar/RebootButton");
134
+ if (rebootButton == null)
135
+ throw new CoreConfigurationException("BottomBar/RebootButton object not found");
136
+
137
+ rebootButton.Enabled = rebootRequired;
138
+
139
+ Image warningIcon = Owner.Get<Image>("BottomBar/WarningImage");
140
+ if (warningIcon == null)
141
+ throw new CoreConfigurationException("BottomBar/WarningImage object not found");
142
+
143
+ warningIcon.Visible = rebootRequired;
144
+
145
+ Label messageLabel = Owner.Get<Label>("BottomBar/MessageLabel");
146
+ if (messageLabel == null)
147
+ throw new CoreConfigurationException("BottomBar/MessageLabel object not found");
148
+
149
+ messageLabel.Visible = rebootRequired;
150
+ }
151
+
152
+ private void HandleInvalidConfiguration()
153
+ {
154
+ Button applyButton = Owner.Get<Button>("BottomBar/ApplyButton");
155
+ if (applyButton != null)
156
+ applyButton.Enabled = false;
157
+
158
+ EnableControlsForRebootRequired(false);
159
+ }
160
+
161
+ private FTOptix.System.System systemNode;
162
+
163
+ private IUAObject networkConfiguratorEditModels;
164
+ private NetworkInterfacesEditModelToSystemWriterLogic networkInterfacesEditModelToSystemWriter;
165
+
166
+ private NetworkInterfaceLogic networkInterfaceLogic;
167
+ private NavigationPanel navPanel;
168
+ }
@@ -0,0 +1,106 @@
1
+ using System;
2
+ using UAManagedCore;
3
+
4
+ //-------------------------------------------
5
+ // WARNING: AUTO-GENERATED CODE, DO NOT EDIT!
6
+ //-------------------------------------------
7
+
8
+ [MapType(NamespaceUri = "AryaNewHMIProject_OptixPanel", Guid = "07b10933e4ee4d4cbf84518e190ea9be")]
9
+ public class FTRemoteAccessWidgetDataObject : UAObject
10
+ {
11
+ #region Children properties
12
+ //-------------------------------------------
13
+ // WARNING: AUTO-GENERATED CODE, DO NOT EDIT!
14
+ //-------------------------------------------
15
+ public bool IncomingConnectionRequest
16
+ {
17
+ get
18
+ {
19
+ return (bool)Refs.GetVariable("IncomingConnectionRequest").Value.Value;
20
+ }
21
+ set
22
+ {
23
+ Refs.GetVariable("IncomingConnectionRequest").SetValue(value);
24
+ }
25
+ }
26
+ public IUAVariable IncomingConnectionRequestVariable
27
+ {
28
+ get
29
+ {
30
+ return (IUAVariable)Refs.GetVariable("IncomingConnectionRequest");
31
+ }
32
+ }
33
+ public string Username
34
+ {
35
+ get
36
+ {
37
+ return (string)Refs.GetVariable("Username").Value.Value;
38
+ }
39
+ set
40
+ {
41
+ Refs.GetVariable("Username").SetValue(value);
42
+ }
43
+ }
44
+ public IUAVariable UsernameVariable
45
+ {
46
+ get
47
+ {
48
+ return (IUAVariable)Refs.GetVariable("Username");
49
+ }
50
+ }
51
+ public string IpAddress
52
+ {
53
+ get
54
+ {
55
+ return (string)Refs.GetVariable("IpAddress").Value.Value;
56
+ }
57
+ set
58
+ {
59
+ Refs.GetVariable("IpAddress").SetValue(value);
60
+ }
61
+ }
62
+ public IUAVariable IpAddressVariable
63
+ {
64
+ get
65
+ {
66
+ return (IUAVariable)Refs.GetVariable("IpAddress");
67
+ }
68
+ }
69
+ public UAManagedCore.ByteString SupervisorId
70
+ {
71
+ get
72
+ {
73
+ return (UAManagedCore.ByteString)Refs.GetVariable("SupervisorId").Value.Value;
74
+ }
75
+ set
76
+ {
77
+ Refs.GetVariable("SupervisorId").SetValue(value);
78
+ }
79
+ }
80
+ public IUAVariable SupervisorIdVariable
81
+ {
82
+ get
83
+ {
84
+ return (IUAVariable)Refs.GetVariable("SupervisorId");
85
+ }
86
+ }
87
+ public UAManagedCore.NodeId FTRemoteAccessNode
88
+ {
89
+ get
90
+ {
91
+ return (UAManagedCore.NodeId)Refs.GetVariable("FTRemoteAccessNode").Value.Value;
92
+ }
93
+ set
94
+ {
95
+ Refs.GetVariable("FTRemoteAccessNode").SetValue(value);
96
+ }
97
+ }
98
+ public FTOptix.Core.Alias FTRemoteAccessNodeVariable
99
+ {
100
+ get
101
+ {
102
+ return (FTOptix.Core.Alias)Refs.GetVariable("FTRemoteAccessNode");
103
+ }
104
+ }
105
+ #endregion
106
+ }
@@ -0,0 +1,37 @@
1
+ using System;
2
+ using UAManagedCore;
3
+
4
+ //-------------------------------------------
5
+ // WARNING: AUTO-GENERATED CODE, DO NOT EDIT!
6
+ //-------------------------------------------
7
+
8
+ namespace AryaNewHMIProject_OptixPanel
9
+ {
10
+ public static class ObjectTypes
11
+ {
12
+ private static readonly int namespaceIndex = NamespaceMapProvider.GetNamespaceIndex("AryaNewHMIProject_OptixPanel");
13
+ public static readonly NodeId MainWindow = new NodeId(namespaceIndex, new Guid("01a7e8933afd7c95fe894b0859308138"));
14
+ public static readonly NodeId DateAndTimeWidget = new NodeId(namespaceIndex, new Guid("ba060dabe3223c9b73ecd35e8a6579f1"));
15
+ public static readonly NodeId LAN = new NodeId(namespaceIndex, new Guid("41f433c486aa6dfdb14c2c47570eea1a"));
16
+ public static readonly NodeId NetworkSettingsWidget = new NodeId(namespaceIndex, new Guid("93cbf19dd68a72c543a41f03c3c2b7a1"));
17
+ public static readonly NodeId FTRemoteAccessWidget = new NodeId(namespaceIndex, new Guid("41382c57dc616862c1af276ff6942abc"));
18
+ public static readonly NodeId DeviceSettingsWidget = new NodeId(namespaceIndex, new Guid("343e9a553a1648e3de95b91f6d877b43"));
19
+ public static readonly NodeId WAN = new NodeId(namespaceIndex, new Guid("d17d8ab3d7f8047c35a02cbe0b7248c6"));
20
+ public static readonly NodeId Configuration = new NodeId(namespaceIndex, new Guid("9cf154c923572624320f16c16fa657a3"));
21
+ public static readonly NodeId RequestAssistancePanel = new NodeId(namespaceIndex, new Guid("77122192dcccfaa39d1e78d7bd27e222"));
22
+ public static readonly NodeId Product_Information = new NodeId(namespaceIndex, new Guid("548a589cc1532b072d9d24316f7b6090"));
23
+ public static readonly NodeId Diagnostics = new NodeId(namespaceIndex, new Guid("632709bc0ca708c922da2f68cb20eb09"));
24
+ public static readonly NodeId FTRemoteAccessWidgetDataObject = new NodeId(namespaceIndex, new Guid("07b10933e4ee4d4cbf84518e190ea9be"));
25
+ public static readonly NodeId ConnectionPanel = new NodeId(namespaceIndex, new Guid("e348b14dbc7035688714c7ced8a72128"));
26
+ public static readonly NodeId AcceptDenyIncomingRequestPanel = new NodeId(namespaceIndex, new Guid("c05a81edcb91fa074772f19543ea1b38"));
27
+ public static readonly NodeId RequestAssistanceEnabledPanel = new NodeId(namespaceIndex, new Guid("dc2c41b238ed9ce9aa4f98d28d04b528"));
28
+ public static readonly NodeId NewConnectionCredentialsPanel = new NodeId(namespaceIndex, new Guid("d8a8bb0d6c0490587ebdf9c1eb42375e"));
29
+ public static readonly NodeId RequestAssistanceDisabledPanel = new NodeId(namespaceIndex, new Guid("f0afd51b3f49febd40b32153974e81b8"));
30
+ public static readonly NodeId EmptyPanel = new NodeId(namespaceIndex, new Guid("323ecbd80fe0dccc66307959b261f54a"));
31
+ }
32
+
33
+ public static class VariableTypes
34
+ {
35
+ private static readonly int namespaceIndex = NamespaceMapProvider.GetNamespaceIndex("AryaNewHMIProject_OptixPanel");
36
+ }
37
+ }
@@ -0,0 +1,91 @@
1
+ using System;
2
+ using UAManagedCore;
3
+
4
+ //-------------------------------------------
5
+ // WARNING: AUTO-GENERATED CODE, DO NOT EDIT!
6
+ //-------------------------------------------
7
+
8
+ [MapType(NamespaceUri = "AryaNewHMIProject_OptixPanel", Guid = "01a7e8933afd7c95fe894b0859308138")]
9
+ public class MainWindow : FTOptix.UI.Window
10
+ {
11
+ }
12
+
13
+ [MapType(NamespaceUri = "AryaNewHMIProject_OptixPanel", Guid = "ba060dabe3223c9b73ecd35e8a6579f1")]
14
+ public class DateAndTimeWidget : FTOptix.UI.Screen
15
+ {
16
+ }
17
+
18
+ [MapType(NamespaceUri = "AryaNewHMIProject_OptixPanel", Guid = "41f433c486aa6dfdb14c2c47570eea1a")]
19
+ public class LAN : FTOptix.UI.Panel
20
+ {
21
+ }
22
+
23
+ [MapType(NamespaceUri = "AryaNewHMIProject_OptixPanel", Guid = "93cbf19dd68a72c543a41f03c3c2b7a1")]
24
+ public class NetworkSettingsWidget : FTOptix.UI.Screen
25
+ {
26
+ }
27
+
28
+ [MapType(NamespaceUri = "AryaNewHMIProject_OptixPanel", Guid = "41382c57dc616862c1af276ff6942abc")]
29
+ public class FTRemoteAccessWidget : FTOptix.UI.Screen
30
+ {
31
+ }
32
+
33
+ [MapType(NamespaceUri = "AryaNewHMIProject_OptixPanel", Guid = "343e9a553a1648e3de95b91f6d877b43")]
34
+ public class DeviceSettingsWidget : FTOptix.UI.Screen
35
+ {
36
+ }
37
+
38
+ [MapType(NamespaceUri = "AryaNewHMIProject_OptixPanel", Guid = "d17d8ab3d7f8047c35a02cbe0b7248c6")]
39
+ public class WAN : FTOptix.UI.Panel
40
+ {
41
+ }
42
+
43
+ [MapType(NamespaceUri = "AryaNewHMIProject_OptixPanel", Guid = "9cf154c923572624320f16c16fa657a3")]
44
+ public class Configuration : FTOptix.UI.Panel
45
+ {
46
+ }
47
+
48
+ [MapType(NamespaceUri = "AryaNewHMIProject_OptixPanel", Guid = "77122192dcccfaa39d1e78d7bd27e222")]
49
+ public class RequestAssistancePanel : FTOptix.UI.Panel
50
+ {
51
+ }
52
+
53
+ [MapType(NamespaceUri = "AryaNewHMIProject_OptixPanel", Guid = "548a589cc1532b072d9d24316f7b6090")]
54
+ public class Product_Information : FTOptix.UI.Panel
55
+ {
56
+ }
57
+
58
+ [MapType(NamespaceUri = "AryaNewHMIProject_OptixPanel", Guid = "632709bc0ca708c922da2f68cb20eb09")]
59
+ public class Diagnostics : FTOptix.UI.Panel
60
+ {
61
+ }
62
+
63
+ [MapType(NamespaceUri = "AryaNewHMIProject_OptixPanel", Guid = "e348b14dbc7035688714c7ced8a72128")]
64
+ public class ConnectionPanel : FTOptix.UI.Panel
65
+ {
66
+ }
67
+
68
+ [MapType(NamespaceUri = "AryaNewHMIProject_OptixPanel", Guid = "c05a81edcb91fa074772f19543ea1b38")]
69
+ public class AcceptDenyIncomingRequestPanel : FTOptix.UI.Panel
70
+ {
71
+ }
72
+
73
+ [MapType(NamespaceUri = "AryaNewHMIProject_OptixPanel", Guid = "dc2c41b238ed9ce9aa4f98d28d04b528")]
74
+ public class RequestAssistanceEnabledPanel : FTOptix.UI.Panel
75
+ {
76
+ }
77
+
78
+ [MapType(NamespaceUri = "AryaNewHMIProject_OptixPanel", Guid = "d8a8bb0d6c0490587ebdf9c1eb42375e")]
79
+ public class NewConnectionCredentialsPanel : FTOptix.UI.Panel
80
+ {
81
+ }
82
+
83
+ [MapType(NamespaceUri = "AryaNewHMIProject_OptixPanel", Guid = "f0afd51b3f49febd40b32153974e81b8")]
84
+ public class RequestAssistanceDisabledPanel : FTOptix.UI.Panel
85
+ {
86
+ }
87
+
88
+ [MapType(NamespaceUri = "AryaNewHMIProject_OptixPanel", Guid = "323ecbd80fe0dccc66307959b261f54a")]
89
+ public class EmptyPanel : FTOptix.UI.Panel
90
+ {
91
+ }