@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,153 @@
1
+ #region Using directives
2
+ using UAManagedCore;
3
+ using OpcUa = UAManagedCore.OpcUa;
4
+ using FTOptix.HMIProject;
5
+ using FTOptix.System;
6
+ using FTOptix.NetLogic;
7
+ using FTOptix.Core;
8
+ using FTOptix.CoreBase;
9
+ #endregion
10
+
11
+ public class FTRemoteAccessWidgetSetupLogic : BaseNetLogic
12
+ {
13
+ private const string LOG_CATEGORY = nameof(FTRemoteAccessWidgetSetupLogic);
14
+
15
+ [ExportMethod]
16
+ public void SetupFTRemoteAccessNode()
17
+ {
18
+ var ftRemoteAccessNodePointer = Owner.Get<NodePointer>("FTRemoteAccessNode");
19
+ if (ftRemoteAccessNodePointer == null)
20
+ {
21
+ Log.Error(LOG_CATEGORY, "FTRemoteAccessNode property not defined.");
22
+ return;
23
+ }
24
+
25
+ if (Owner.Context.GetNode(ftRemoteAccessNodePointer.Value) is not FTRemoteAccess ftRemoteAccessNode)
26
+ {
27
+ Log.Error(LOG_CATEGORY, "FTRemoteAccessNode is not defined.");
28
+ return;
29
+ }
30
+
31
+ var eventArguments = InformationModel.MakeObject("EventArguments", FTOptix.System.ObjectTypes.RemoteConnectionRequestEvent);
32
+
33
+ if (ftRemoteAccessNode.Get("RemoteConnectionRequestEventHandler") is not EventHandler eventHandlerNode)
34
+ {
35
+ eventHandlerNode = InformationModel.MakeObject<EventHandler>("RemoteConnectionRequestEventHandler");
36
+ ftRemoteAccessNode.Add(eventHandlerNode);
37
+ eventHandlerNode.ListenEventType = FTOptix.System.ObjectTypes.RemoteConnectionRequestEvent;
38
+ eventHandlerNode.Add(eventArguments);
39
+ }
40
+
41
+ CreateVariables(ftRemoteAccessNode, eventHandlerNode, eventArguments);
42
+ }
43
+
44
+ private static void CreateVariables(FTRemoteAccess ftRemoteAccessNode,
45
+ EventHandler eventHandlerNode,
46
+ IUAObject eventArguments)
47
+ {
48
+ const string usernameVariableName = "FTRemoteAccessWidgetUsername";
49
+ const string ipAddressVariableName = "FTRemoteAccessWidgetIPAddress";
50
+ const string supervisorIdVariableName = "FTRemoteAccessWidgetSupervisorId";
51
+ const string connectionPendingVariableName = "FTRemoteAccessWidgetConnectionPending";
52
+ const string getErrorMessage = "Unable to get event argument: ";
53
+
54
+ Log.Info(LOG_CATEGORY, "Creating FTRemoteAccess widget variables and Remote Connection Request event commands.");
55
+
56
+ IUAVariable usernameVariable = ftRemoteAccessNode.GetVariable(usernameVariableName);
57
+ if (usernameVariable == null)
58
+ {
59
+ usernameVariable = InformationModel.MakeVariable(usernameVariableName, OpcUa.DataTypes.String);
60
+ ftRemoteAccessNode.Add(usernameVariable);
61
+ }
62
+
63
+ IUAVariable eventArgumentUsernameVariable = eventArguments.GetVariable("Username");
64
+ if (eventArgumentUsernameVariable == null)
65
+ {
66
+ Log.Error(LOG_CATEGORY, getErrorMessage + "Username");
67
+ return;
68
+ }
69
+
70
+ SetupEventHandler(eventHandlerNode, usernameVariable, OpcUa.DataTypes.String, eventArgumentUsernameVariable);
71
+
72
+ IUAVariable ipAddressVariable = ftRemoteAccessNode.GetVariable(ipAddressVariableName);
73
+ if (ipAddressVariable == null)
74
+ {
75
+ ipAddressVariable = InformationModel.MakeVariable(ipAddressVariableName, OpcUa.DataTypes.String);
76
+ ftRemoteAccessNode.Add(ipAddressVariable);
77
+ }
78
+
79
+ IUAVariable eventArgumentIpAddressVariable = eventArguments.GetVariable("IpAddress");
80
+ if (eventArgumentIpAddressVariable == null)
81
+ {
82
+ Log.Error(LOG_CATEGORY, getErrorMessage + "IpAddress");
83
+ return;
84
+ }
85
+
86
+ SetupEventHandler(eventHandlerNode, ipAddressVariable, OpcUa.DataTypes.String, eventArgumentIpAddressVariable);
87
+
88
+ IUAVariable supervisorIdVariable = ftRemoteAccessNode.GetVariable(supervisorIdVariableName);
89
+ if (supervisorIdVariable == null)
90
+ {
91
+ supervisorIdVariable = InformationModel.MakeVariable(supervisorIdVariableName, OpcUa.DataTypes.ByteString);
92
+ ftRemoteAccessNode.Add(supervisorIdVariable);
93
+ }
94
+
95
+ IUAVariable eventArgumentSupervisorIdVariable = eventArguments.GetVariable("SupervisorId");
96
+ if (eventArgumentSupervisorIdVariable == null)
97
+ {
98
+ Log.Error(LOG_CATEGORY, getErrorMessage + "SupervisorId");
99
+ return;
100
+ }
101
+
102
+ SetupEventHandler(eventHandlerNode, supervisorIdVariable, OpcUa.DataTypes.ByteString, eventArgumentSupervisorIdVariable);
103
+
104
+ IUAVariable connectionPendingVariable = ftRemoteAccessNode.GetVariable(connectionPendingVariableName);
105
+ if (connectionPendingVariable == null)
106
+ {
107
+ connectionPendingVariable = InformationModel.MakeVariable(connectionPendingVariableName, OpcUa.DataTypes.Boolean);
108
+ ftRemoteAccessNode.Add(connectionPendingVariable);
109
+ }
110
+
111
+ SetupEventHandler(eventHandlerNode, connectionPendingVariable, OpcUa.DataTypes.Boolean, null);
112
+ }
113
+
114
+ private static void SetupEventHandler(EventHandler eventHandlerNode,
115
+ IUAVariable variableNode,
116
+ NodeId valueType,
117
+ IUAVariable eventArgumentVariable)
118
+ {
119
+ string methodContainerName = "MethodContainer" + variableNode.BrowseName;
120
+ IUANode methodContainerNode = eventHandlerNode.Find(methodContainerName);
121
+ if (methodContainerNode != null)
122
+ return;
123
+
124
+ var methodContainer = InformationModel.MakeObject(methodContainerName);
125
+ eventHandlerNode.MethodsToCall.Add(methodContainer);
126
+
127
+ var objectPointerVariable = InformationModel.MakeVariable<NodePointer>("ObjectPointer", OpcUa.DataTypes.NodeId);
128
+ objectPointerVariable.Value = InformationModel.GetObject(FTOptix.CoreBase.Objects.VariableCommands).NodeId;
129
+ methodContainer.Add(objectPointerVariable);
130
+
131
+ var methodNameVariable = InformationModel.MakeVariable("Method", OpcUa.DataTypes.String);
132
+ methodNameVariable.Value = "Set";
133
+ methodContainer.Add(methodNameVariable);
134
+
135
+ var inputArguments = InformationModel.MakeObject("InputArguments");
136
+ methodContainer.Add(inputArguments);
137
+
138
+ var variableToModify = InformationModel.MakeVariable("VariableToModify", FTOptix.Core.DataTypes.VariablePointer);
139
+ variableToModify.Value = variableNode.NodeId;
140
+ inputArguments.Add(variableToModify);
141
+
142
+ var valueVariable = InformationModel.MakeVariable("Value", valueType);
143
+ if (eventArgumentVariable != null)
144
+ valueVariable.SetDynamicLink(eventArgumentVariable, DynamicLinkMode.ReadWrite);
145
+ if (valueType == OpcUa.DataTypes.Boolean)
146
+ valueVariable.Value = true;
147
+ inputArguments.Add(valueVariable);
148
+
149
+ var arrayIndexVariable = InformationModel.MakeVariable("ArrayIndex", OpcUa.DataTypes.UInt32);
150
+ arrayIndexVariable.ValueRank = ValueRank.ScalarOrOneDimension;
151
+ inputArguments.Add(arrayIndexVariable);
152
+ }
153
+ }
@@ -0,0 +1,118 @@
1
+ #region Using directives
2
+ using UAManagedCore;
3
+ using FTOptix.NetLogic;
4
+ using FTOptix.System;
5
+ #endregion
6
+
7
+ public class IncomingConnectionApprovalLogic : BaseNetLogic
8
+ {
9
+ private const string LOG_CATEGORY = nameof(IncomingConnectionApprovalLogic);
10
+
11
+ public override void Start()
12
+ {
13
+ ftRemoteAccessWidgetDataObject = LogicObject.GetAlias("FTRemoteAccessWidgetDataObject") as FTRemoteAccessWidgetDataObject;
14
+ if (ftRemoteAccessWidgetDataObject == null)
15
+ {
16
+ Log.Error(LOG_CATEGORY, "FTRemoteAccessWidgetDataObject" + notDefinedMessage);
17
+ return;
18
+ }
19
+
20
+ ftRemoteAccessNode = ftRemoteAccessWidgetDataObject.Context.GetNode(ftRemoteAccessWidgetDataObject.FTRemoteAccessNode) as FTRemoteAccess;
21
+ if (ftRemoteAccessNode == null)
22
+ {
23
+ Log.Error(LOG_CATEGORY, "FTRemoteAccessNode" + notDefinedMessage);
24
+ return;
25
+ }
26
+
27
+ connectionPendingVariable = ftRemoteAccessNode.GetVariable(connectionPendingVariableName);
28
+ if (connectionPendingVariable == null)
29
+ {
30
+ Log.Error(LOG_CATEGORY, connectionPendingVariableName + notDefinedMessage);
31
+ return;
32
+ }
33
+ }
34
+
35
+ public override void Stop()
36
+ {
37
+ // destruct class objects
38
+ ftRemoteAccessNode = null;
39
+ ftRemoteAccessWidgetDataObject = null;
40
+ connectionPendingVariable = null;
41
+ }
42
+
43
+ [ExportMethod]
44
+ public void AcceptIncomingConnection()
45
+ {
46
+ if (ftRemoteAccessWidgetDataObject == null)
47
+ {
48
+ Log.Error(LOG_CATEGORY, "FTRemoteAccessWidgetDataObject" + notDefinedMessage);
49
+ return;
50
+ }
51
+
52
+ if (ftRemoteAccessNode == null)
53
+ {
54
+ Log.Error(LOG_CATEGORY, "FTRemoteAccessNode" + notDefinedMessage);
55
+ return;
56
+ }
57
+
58
+ if (connectionPendingVariable == null)
59
+ {
60
+ Log.Error(LOG_CATEGORY, connectionPendingVariableName + notDefinedMessage);
61
+ return;
62
+ }
63
+
64
+ var result = ftRemoteAccessNode.ApproveIncomingRemoteConnection(ftRemoteAccessWidgetDataObject.SupervisorId);
65
+ if (result == IncomingRemoteConnectionApprovalResult.Success)
66
+ {
67
+ connectionPendingVariable.Value = false;
68
+ }
69
+ else if (result == IncomingRemoteConnectionApprovalResult.NoConnectionToApprove)
70
+ {
71
+ Log.Info(LOG_CATEGORY, "Connection request has already been handled.");
72
+ connectionPendingVariable.Value = false;
73
+ }
74
+ else
75
+ Log.Error(LOG_CATEGORY, "Failed to accept connection request. FTRemoteAccess runtime is not connected.");
76
+ }
77
+
78
+ [ExportMethod]
79
+ public void DenyIncomingConnection()
80
+ {
81
+ if (ftRemoteAccessWidgetDataObject == null)
82
+ {
83
+ Log.Error(LOG_CATEGORY, "FTRemoteAccessWidgetDataObject" + notDefinedMessage);
84
+ return;
85
+ }
86
+
87
+ if (ftRemoteAccessNode == null)
88
+ {
89
+ Log.Error(LOG_CATEGORY, "FTRemoteAccessNode" + notDefinedMessage);
90
+ return;
91
+ }
92
+
93
+ if (connectionPendingVariable == null)
94
+ {
95
+ Log.Error(LOG_CATEGORY, connectionPendingVariableName + notDefinedMessage);
96
+ return;
97
+ }
98
+
99
+ var result = ftRemoteAccessNode.DenyIncomingRemoteConnection(ftRemoteAccessWidgetDataObject.SupervisorId);
100
+ if (result == IncomingRemoteConnectionApprovalResult.Success)
101
+ {
102
+ connectionPendingVariable.Value = false;
103
+ }
104
+ else if (result == IncomingRemoteConnectionApprovalResult.NoConnectionToApprove)
105
+ {
106
+ Log.Info(LOG_CATEGORY, "Connection request has already been handled.");
107
+ connectionPendingVariable.Value = false;
108
+ }
109
+ else
110
+ Log.Error(LOG_CATEGORY, "Failed to deny connection request. FTRemoteAccess runtime is not connected.");
111
+ }
112
+
113
+ private FTRemoteAccessWidgetDataObject ftRemoteAccessWidgetDataObject;
114
+ private FTRemoteAccess ftRemoteAccessNode;
115
+ private IUAVariable connectionPendingVariable;
116
+ private const string connectionPendingVariableName = "FTRemoteAccessWidgetConnectionPending";
117
+ private const string notDefinedMessage = " is not defined.";
118
+ }
@@ -0,0 +1,166 @@
1
+ #region Using directives
2
+ using UAManagedCore;
3
+ using FTOptix.System;
4
+ using FTOptix.NetLogic;
5
+ #endregion
6
+
7
+ public class IncomingConnectionReceiverLogic : BaseNetLogic
8
+ {
9
+ private const string LOG_CATEGORY = nameof(IncomingConnectionReceiverLogic);
10
+
11
+ public override void Start()
12
+ {
13
+ bool cancelStart = false;
14
+
15
+ ftRemoteAccessWidgetDataObject = Owner.Get<FTRemoteAccessWidgetDataObject>("FTRemoteAccessWidgetDataObject");
16
+ if (ftRemoteAccessWidgetDataObject == null)
17
+ {
18
+ Log.Error(LOG_CATEGORY, "FTRemoteAccessWidgetDataObject" + notDefinedMessage);
19
+ return;
20
+ }
21
+
22
+ ftRemoteAccessNode = ftRemoteAccessWidgetDataObject.Context.GetNode(ftRemoteAccessWidgetDataObject.FTRemoteAccessNode) as FTRemoteAccess;
23
+ if (ftRemoteAccessNode == null)
24
+ {
25
+ Log.Error(LOG_CATEGORY, "FTRemoteAccessNode" + notDefinedMessage);
26
+ return;
27
+ }
28
+
29
+ connectionPendingVariable = ftRemoteAccessNode.GetVariable(connectionPendingVariableName);
30
+ if (connectionPendingVariable == null)
31
+ {
32
+ Log.Error(LOG_CATEGORY, connectionPendingVariableName + notDefinedMessage);
33
+ cancelStart = true;
34
+ }
35
+
36
+ usernameVariable = ftRemoteAccessNode.GetVariable(usernameVariableName);
37
+ if (usernameVariable == null)
38
+ {
39
+ Log.Error(LOG_CATEGORY, usernameVariableName + notDefinedMessage);
40
+ cancelStart = true;
41
+ }
42
+
43
+ ipAddressVariable = ftRemoteAccessNode.GetVariable(ipAddressVariableName);
44
+ if (ipAddressVariable == null)
45
+ {
46
+ Log.Error(LOG_CATEGORY, ipAddressVariableName + notDefinedMessage);
47
+ cancelStart = true;
48
+ }
49
+
50
+ supervisorIdVariable = ftRemoteAccessNode.GetVariable(supervisorIdVariableName);
51
+ if (supervisorIdVariable == null)
52
+ {
53
+ Log.Error(LOG_CATEGORY, supervisorIdVariableName + notDefinedMessage);
54
+ cancelStart = true;
55
+ }
56
+
57
+ if (cancelStart)
58
+ {
59
+ DestroyClassFields();
60
+ return;
61
+ }
62
+
63
+ //handle the case where an incoming connection request may already be pending at startup of the widget
64
+ SetFTRemoteAccessWidgetDataObjectValues(connectionPendingVariable.Value);
65
+
66
+ connectionPendingVariable.VariableChange += HandleConnectionPendingVariableChangedEvent;
67
+ }
68
+
69
+ public override void Stop()
70
+ {
71
+ if (connectionPendingVariable != null)
72
+ connectionPendingVariable.VariableChange -= HandleConnectionPendingVariableChangedEvent;
73
+
74
+ DestroyClassFields();
75
+ }
76
+
77
+ private void DestroyClassFields()
78
+ {
79
+ ftRemoteAccessNode = null;
80
+ ftRemoteAccessWidgetDataObject = null;
81
+ connectionPendingVariable = null;
82
+ usernameVariable = null;
83
+ ipAddressVariable = null;
84
+ supervisorIdVariable = null;
85
+ }
86
+
87
+ private void HandleConnectionPendingVariableChangedEvent(object sender, VariableChangeEventArgs args)
88
+ {
89
+ if (ftRemoteAccessWidgetDataObject == null)
90
+ {
91
+ Log.Error(LOG_CATEGORY, "FTRemoteAccessWidgetDataObject" + notDefinedMessage);
92
+ return;
93
+ }
94
+
95
+ if (ftRemoteAccessNode == null)
96
+ {
97
+ Log.Error(LOG_CATEGORY, "FTRemoteAccessNode" + notDefinedMessage);
98
+ }
99
+
100
+ SetFTRemoteAccessWidgetDataObjectValues(args.NewValue);
101
+ }
102
+
103
+ private void SetFTRemoteAccessWidgetDataObjectValues(bool requestPending)
104
+ {
105
+ bool undefinedVars = false;
106
+
107
+ if (requestPending)
108
+ {
109
+ string userNameValue = usernameVariable.Value;
110
+ if (!string.IsNullOrEmpty(userNameValue))
111
+ ftRemoteAccessWidgetDataObject.Username = userNameValue;
112
+ else
113
+ {
114
+ Log.Error(LOG_CATEGORY, usernameVariableName + noValueMessage);
115
+ undefinedVars = true;
116
+ }
117
+
118
+ string ipAddressValue = ipAddressVariable.Value;
119
+ if (!string.IsNullOrEmpty(ipAddressValue))
120
+ ftRemoteAccessWidgetDataObject.IpAddress = ipAddressVariable.Value;
121
+ else
122
+ {
123
+ Log.Error(LOG_CATEGORY, ipAddressVariableName + noValueMessage);
124
+ undefinedVars = true;
125
+ }
126
+
127
+ ByteString supervisorIdValue = supervisorIdVariable.Value;
128
+ if (!supervisorIdValue.IsEmpty)
129
+ ftRemoteAccessWidgetDataObject.SupervisorId = supervisorIdValue;
130
+ else
131
+ {
132
+ Log.Error(LOG_CATEGORY, supervisorIdVariableName + noValueMessage);
133
+ undefinedVars = true;
134
+ }
135
+ }
136
+ else
137
+ {
138
+ usernameVariable.Value = ftRemoteAccessWidgetDataObject.Username = string.Empty;
139
+ ipAddressVariable.Value = ftRemoteAccessWidgetDataObject.IpAddress = string.Empty;
140
+ supervisorIdVariable.Value = ftRemoteAccessWidgetDataObject.SupervisorId = ByteString.Empty;
141
+ }
142
+
143
+ if (requestPending && !undefinedVars)
144
+ {
145
+ ftRemoteAccessWidgetDataObject.IncomingConnectionRequest = true;
146
+ }
147
+ else
148
+ {
149
+ connectionPendingVariable.Value = false;
150
+ ftRemoteAccessWidgetDataObject.IncomingConnectionRequest = false;
151
+ }
152
+ }
153
+
154
+ private FTRemoteAccessWidgetDataObject ftRemoteAccessWidgetDataObject;
155
+ private FTRemoteAccess ftRemoteAccessNode;
156
+ private IUAVariable connectionPendingVariable;
157
+ private IUAVariable usernameVariable;
158
+ private IUAVariable ipAddressVariable;
159
+ private IUAVariable supervisorIdVariable;
160
+ private const string usernameVariableName = "FTRemoteAccessWidgetUsername";
161
+ private const string ipAddressVariableName = "FTRemoteAccessWidgetIPAddress";
162
+ private const string supervisorIdVariableName = "FTRemoteAccessWidgetSupervisorId";
163
+ private const string connectionPendingVariableName = "FTRemoteAccessWidgetConnectionPending";
164
+ private const string noValueMessage = " has no value.";
165
+ private const string notDefinedMessage = " is not defined.";
166
+ }
@@ -0,0 +1,56 @@
1
+ #region Using directives
2
+ using UAManagedCore;
3
+ using FTOptix.HMIProject;
4
+ using FTOptix.NetLogic;
5
+ using System.Linq;
6
+ using FTOptix.UI;
7
+ using FTOptix.SerialPort;
8
+ #endregion
9
+
10
+ public class NetworkConfiguratorEditModelsLogic : BaseNetLogic
11
+ {
12
+ public static void CreateEditModels(FTOptix.System.System systemNode, IUAObject parentNode)
13
+ {
14
+ NetworkInterfacesEditModel.CreateEditModel(systemNode, parentNode);
15
+ }
16
+
17
+ public static IUAObject GetNetworkInterfacesEditModel(IUAObject parentNode)
18
+ {
19
+ var networkInterfacesEditModel = parentNode.GetObject(editModelNetworkInterfacesBrowseName);
20
+ if (networkInterfacesEditModel == null)
21
+ throw new CoreConfigurationException("Edit model for network interfaces not found");
22
+
23
+ return networkInterfacesEditModel;
24
+ }
25
+
26
+ public static void DeleteEditModels(IUAObject parentNode)
27
+ {
28
+ NetworkInterfacesEditModel.DeleteEditModel(parentNode);
29
+ }
30
+
31
+ private static class NetworkInterfacesEditModel
32
+ {
33
+ public static IUAObject CreateEditModel(FTOptix.System.System systemNode, IUAObject parentNode)
34
+ {
35
+ var editModelNetworkInterfaces = parentNode.FindObject(editModelNetworkInterfacesBrowseName);
36
+ if (editModelNetworkInterfaces == null)
37
+ {
38
+ editModelNetworkInterfaces = InformationModel.MakeObject(editModelNetworkInterfacesBrowseName);
39
+ var systemToNetworkInterfacesEditModelWriter = new SystemToNetworkInterfacesEditModelWriterLogic(editModelNetworkInterfaces);
40
+ systemToNetworkInterfacesEditModelWriter.InitializeEditModel(systemNode.NetworkInterfaces.ToList());
41
+ parentNode.Add(editModelNetworkInterfaces);
42
+ }
43
+
44
+ return editModelNetworkInterfaces;
45
+ }
46
+
47
+ public static void DeleteEditModel(IUAObject parentNode)
48
+ {
49
+ var editModelNetworkInterfaces = parentNode.FindObject(editModelNetworkInterfacesBrowseName);
50
+ if (editModelNetworkInterfaces != null)
51
+ parentNode.Remove(editModelNetworkInterfaces);
52
+ }
53
+ }
54
+
55
+ private static readonly string editModelNetworkInterfacesBrowseName = "NetworkInterfacesEditModel";
56
+ }
@@ -0,0 +1,138 @@
1
+ #region Using directives
2
+ using FTOptix.CoreBase;
3
+ using FTOptix.UI;
4
+ using UAManagedCore;
5
+ using FTOptix.NetLogic;
6
+ using FTOptix.SerialPort;
7
+ #endregion
8
+
9
+ public class NetworkInterfaceLogic : BaseNetLogic
10
+ {
11
+ public override void Stop()
12
+ {
13
+ if (doesThisNetworkInterfaceExist && dhcpCheckbox != null)
14
+ dhcpCheckbox.CheckedVariable.VariableChange -= DhcpChecked_VariableChange;
15
+
16
+ editModelNetworkInterfacesReader = null;
17
+ dhcpCheckbox = null;
18
+ ipAddressTextBox = null;
19
+ maskTextBox= null;
20
+ defaultGatewayTextBox= null;
21
+ dns1TextBox= null;
22
+ dns2TextBox= null;
23
+ }
24
+
25
+ public void SetMembers(FTOptix.System.System systemNode, string interfaceName, IUAObject networkConfiguratorEditModelsObject, IUANode panelObject)
26
+ {
27
+ this.interfaceName = interfaceName;
28
+
29
+ dhcpCheckbox = panelObject.Find<CheckBox>("DHCPClientEnabledCheckbox");
30
+ if (dhcpCheckbox == null)
31
+ throw new CoreConfigurationException("LAN DHCPClientEnabledCheckbox not found");
32
+
33
+ ipAddressTextBox = panelObject.Find<TextBox>("IPAddressTextBox");
34
+ if (ipAddressTextBox == null)
35
+ throw new CoreConfigurationException("LAN IPAddressTextBox not found");
36
+
37
+ maskTextBox = panelObject.Find<TextBox>("MaskTextBox");
38
+ if (maskTextBox == null)
39
+ throw new CoreConfigurationException("LAN MaskTextBox not found");
40
+
41
+ defaultGatewayTextBox = panelObject.Find<TextBox>("DefaultGatewayTextBox");
42
+ if (defaultGatewayTextBox == null)
43
+ throw new CoreConfigurationException("LAN DefaultGatewayTextBox not found");
44
+
45
+ dns1TextBox = panelObject.Find<TextBox>("DNS1TextBox");
46
+ if (dns1TextBox == null)
47
+ throw new CoreConfigurationException("LAN DNS1TextBox not found");
48
+
49
+ dns2TextBox = panelObject.Find<TextBox>("DNS2TextBox");
50
+ if (dns2TextBox == null)
51
+ throw new CoreConfigurationException("LAN DNS2TextBox not found");
52
+
53
+ NetworkConfiguratorEditModelsLogic.CreateEditModels(systemNode, networkConfiguratorEditModelsObject);
54
+ var editModelNetworkInterfaces = NetworkConfiguratorEditModelsLogic.GetNetworkInterfacesEditModel(networkConfiguratorEditModelsObject);
55
+
56
+ editModelNetworkInterfacesReader = new NetworkInterfacesEditModelReaderLogic(editModelNetworkInterfaces);
57
+
58
+ var networkInterfaceObject = editModelNetworkInterfaces.GetObject(interfaceName);
59
+ if (networkInterfaceObject == null)
60
+ {
61
+ if (panelObject is Panel panel)
62
+ panel.Enabled = false;
63
+
64
+ doesThisNetworkInterfaceExist = false;
65
+ }
66
+ else
67
+ {
68
+ SetDynamicLinksToEditModel(this.interfaceName);
69
+ SetControlsEnabled();
70
+ dhcpCheckbox.CheckedVariable.VariableChange += DhcpChecked_VariableChange;
71
+ }
72
+ }
73
+
74
+ private void DhcpChecked_VariableChange(object sender, VariableChangeEventArgs e)
75
+ {
76
+ SetControlsEnabled();
77
+ }
78
+
79
+ private void SetDynamicLinksToEditModel(string interfaceName)
80
+ {
81
+ var checkedVariable = dhcpCheckbox.CheckedVariable;
82
+ checkedVariable.ResetDynamicLink();
83
+ checkedVariable.SetDynamicLink(editModelNetworkInterfacesReader.GetDhcpVariable(interfaceName), DynamicLinkMode.ReadWrite);
84
+
85
+ var ipAddressTextBoxTextVariable = ipAddressTextBox.TextVariable;
86
+ ipAddressTextBoxTextVariable.ResetDynamicLink();
87
+ ipAddressTextBoxTextVariable.SetDynamicLink(editModelNetworkInterfacesReader.GetIPAddressVariable(interfaceName), DynamicLinkMode.ReadWrite);
88
+
89
+ var maskTextBoxTextVariable = maskTextBox.TextVariable;
90
+ maskTextBoxTextVariable.ResetDynamicLink();
91
+ maskTextBoxTextVariable.SetDynamicLink(editModelNetworkInterfacesReader.GetMaskVariable(interfaceName), DynamicLinkMode.ReadWrite);
92
+
93
+ var dns1TextBoxTextVariable = dns1TextBox.TextVariable;
94
+ dns1TextBoxTextVariable.ResetDynamicLink();
95
+ dns1TextBoxTextVariable.SetDynamicLink(editModelNetworkInterfacesReader.GetDNS1Variable(interfaceName), DynamicLinkMode.ReadWrite);
96
+
97
+ var dns2TextBoxTextVariable = dns2TextBox.TextVariable;
98
+ dns2TextBoxTextVariable.ResetDynamicLink();
99
+ dns2TextBoxTextVariable.SetDynamicLink(editModelNetworkInterfacesReader.GetDNS2Variable(interfaceName), DynamicLinkMode.ReadWrite);
100
+
101
+ var defaultGatewayTextBoxTextVariable = defaultGatewayTextBox.TextVariable;
102
+ defaultGatewayTextBoxTextVariable.ResetDynamicLink();
103
+ defaultGatewayTextBoxTextVariable.SetDynamicLink(editModelNetworkInterfacesReader.GetDefaultGatewayVariable(interfaceName), DynamicLinkMode.ReadWrite);
104
+ }
105
+
106
+ private void SetControlsEnabled()
107
+ {
108
+ if (dhcpCheckbox.Checked)
109
+ {
110
+ ipAddressTextBox.Enabled = false;
111
+ maskTextBox.Enabled = false;
112
+ defaultGatewayTextBox.Enabled = false;
113
+ dns1TextBox.Enabled = false;
114
+ dns2TextBox.Enabled = false;
115
+ }
116
+ else
117
+ {
118
+ ipAddressTextBox.Enabled = true;
119
+ maskTextBox.Enabled = true;
120
+ defaultGatewayTextBox.Enabled = true;
121
+ dns1TextBox.Enabled = true;
122
+ dns2TextBox.Enabled = true;
123
+ }
124
+ }
125
+
126
+ private string interfaceName;
127
+
128
+ private NetworkInterfacesEditModelReaderLogic editModelNetworkInterfacesReader;
129
+
130
+ private CheckBox dhcpCheckbox;
131
+ private TextBox ipAddressTextBox;
132
+ private TextBox maskTextBox;
133
+ private TextBox defaultGatewayTextBox;
134
+ private TextBox dns1TextBox;
135
+ private TextBox dns2TextBox;
136
+
137
+ private bool doesThisNetworkInterfaceExist = true;
138
+ }