@@ -27,11 +27,11 @@ namespace Moryx.Drivers.OpcUa;
2727/// </summary>
2828[ ResourceRegistration ]
2929[ Display ( Name = nameof ( Strings . OpcUaDriver_DisplayName ) , Description = nameof ( Strings . OpcUaDriver_Description ) , ResourceType = typeof ( Strings ) ) ]
30- public class OpcUaDriver : Driver , IOpcUaDriver2
30+ public class OpcUaDriver : Driver , IOpcUaDriver
3131{
3232 //TODO 6.1 Invoke Methods
3333
34- private const int NODE_LAYERS_SHOWN = 5 ;
34+ private const int NodeLayersShown = 5 ;
3535 /// <summary>
3636 /// Current tate of the driver
3737 /// </summary>
@@ -808,7 +808,7 @@ private void BrowseNodes(NodeId nodeId, NamespaceTable namespaceTable, List<OpcU
808808 _nodesFlat . Add ( node . Identifier , node ) ;
809809 }
810810
811- if ( layer < NODE_LAYERS_SHOWN )
811+ if ( layer < NodeLayersShown )
812812 {
813813 list . Add ( node ) ;
814814 }
@@ -843,7 +843,7 @@ private OpcUaNode ConvertToNode(ReferenceDescription referenceDescription, Names
843843 #endregion
844844
845845 #region Read and write nodes
846- /// <inheritdoc/>
846+
847847 public void WriteNode ( OpcUaNode node , object payload )
848848 {
849849 State . WriteNode ( node , payload ) ;
@@ -855,6 +855,12 @@ public void WriteNode(string nodeId, object payload)
855855 WriteNode ( node , payload ) ;
856856 }
857857
858+ /// <inheritdoc />
859+ public Task WriteNodeAsync ( string nodeId , object payload , CancellationToken cancellationToken = default )
860+ {
861+ throw new NotImplementedException ( ) ;
862+ }
863+
858864 internal void OnWriteNode ( OpcUaNode node , object payload )
859865 {
860866
@@ -879,9 +885,15 @@ internal void OnWriteNode(OpcUaNode node, object payload)
879885 }
880886 }
881887 /// <inheritdoc/>
882- public object ReadNode ( string NodeId )
888+ public object ReadNode ( string nodeId )
883889 {
884- return ReadNodeDataValue ( NodeId ) . Result . Value ;
890+ return ReadNodeDataValue ( nodeId ) . Result . Value ;
891+ }
892+
893+ /// <inheritdoc />
894+ public Task < object > ReadNodeAsync ( string nodeId , CancellationToken cancellationToken = default )
895+ {
896+ throw new NotImplementedException ( ) ;
885897 }
886898
887899 private DataValueResult ReadNodeDataValue ( string nodeId )
@@ -978,12 +990,12 @@ public Task SendAsync(OpcUaMessage payload, CancellationToken cancellationToken
978990 /// <summary>
979991 /// Method to read nodes from the ui for testing
980992 /// </summary>
981- /// <param name="NodeId "></param>
993+ /// <param name="nodeId "></param>
982994 /// <returns></returns>
983995 [ EntrySerialize ]
984- public string ReadNodeAsString ( string NodeId )
996+ public string ReadNodeAsString ( string nodeId )
985997 {
986- var value = ReadNodeDataValue ( NodeId ) ;
998+ var value = ReadNodeDataValue ( nodeId ) ;
987999 if ( value == null )
9881000 {
9891001 return "There was an error, when trying to read the value of the node. Please look into the log for further information" ;
@@ -1027,29 +1039,34 @@ private object CreateValue(BuiltInType type, string stringValue)
10271039 {
10281040 switch ( type )
10291041 {
1030- case BuiltInType . Boolean : return bool . Parse ( stringValue ) ;
1031-
1032- case BuiltInType . Int16 : return short . Parse ( stringValue ) ;
1042+ case BuiltInType . Boolean :
1043+ return bool . Parse ( stringValue ) ;
1044+ case BuiltInType . Int16 :
1045+ return short . Parse ( stringValue ) ;
10331046 case BuiltInType . Enumeration :
10341047 case BuiltInType . Integer :
1035- case BuiltInType . Int32 : return int . Parse ( stringValue ) ;
1036- case BuiltInType . Int64 : return long . Parse ( stringValue ) ;
1037- case BuiltInType . UInt16 : return ushort . Parse ( stringValue ) ;
1048+ case BuiltInType . Int32 :
1049+ return int . Parse ( stringValue ) ;
1050+ case BuiltInType . Int64 :
1051+ return long . Parse ( stringValue ) ;
1052+ case BuiltInType . UInt16 :
1053+ return ushort . Parse ( stringValue ) ;
10381054 case BuiltInType . UInteger :
1039- case BuiltInType . UInt32 : return uint . Parse ( stringValue ) ;
1040- case BuiltInType . UInt64 : return ulong . Parse ( stringValue ) ;
1041- case BuiltInType . DateTime : return DateTime . Parse ( stringValue ) ;
1042-
1055+ case BuiltInType . UInt32 :
1056+ return uint . Parse ( stringValue ) ;
1057+ case BuiltInType . UInt64 :
1058+ return ulong . Parse ( stringValue ) ;
1059+ case BuiltInType . DateTime :
1060+ return DateTime . Parse ( stringValue ) ;
10431061 case BuiltInType . Guid :
1044- case BuiltInType . String : return stringValue ;
1045-
1062+ case BuiltInType . String :
1063+ return stringValue ;
10461064 case BuiltInType . Number :
10471065 case BuiltInType . Float :
10481066 case BuiltInType . Double :
10491067 return double . Parse ( stringValue ) ;
1050-
1051- case BuiltInType . Byte : return byte . Parse ( stringValue ) ;
1052-
1068+ case BuiltInType . Byte :
1069+ return byte . Parse ( stringValue ) ;
10531070 }
10541071 }
10551072 catch ( Exception ex )
@@ -1063,9 +1080,9 @@ private object CreateValue(BuiltInType type, string stringValue)
10631080 }
10641081
10651082 [ EntrySerialize ]
1066- public List < string > FindNodeId ( string Displayname )
1083+ public List < string > FindNodeId ( string displayName )
10671084 {
1068- var result = _nodesFlat . Where ( x => x . Value . DisplayName . ToLower ( ) . Contains ( Displayname . ToLower ( ) ) || x . Value . DisplayName . ToLower ( ) . Equals ( Displayname . ToLower ( ) ) )
1085+ var result = _nodesFlat . Where ( x => x . Value . DisplayName . ToLower ( ) . Contains ( displayName . ToLower ( ) ) || x . Value . DisplayName . ToLower ( ) . Equals ( displayName . ToLower ( ) ) )
10691086 . Select ( x => x . Key ) . ToList ( ) ;
10701087
10711088 return result ;
@@ -1145,11 +1162,5 @@ internal void ReadDeviceSet()
11451162 DeviceSet . Add ( deviceType ) ;
11461163
11471164 }
1148-
1149- }
1150-
1151- public List < object > InvokeMethod ( string nodeId , object [ ] parameters )
1152- {
1153- throw new NotImplementedException ( ) ;
11541165 }
11551166}
0 commit comments