Browse Source

parse additional uamethod fields

Martin Kunz 1 month ago
parent
commit
f6d39972ac
1 changed files with 14 additions and 2 deletions
  1. 14 2
      src/ua/UAMethod.ts

+ 14 - 2
src/ua/UAMethod.ts

@@ -4,6 +4,10 @@ import type { NamespaceTable } from "./NameSpaceTable";
 import type { IAddressSpace } from "./IAddressSpace";
 
 export class UAMethod extends UABaseNode {
+    public methodDeclarationId: string|undefined;
+    public userExecutable!: Boolean;
+    public executable!: Boolean;
+
     constructor(options: UAMethodNodeOptions) {
                     super(options);
                     Object.assign(this, options);  
@@ -11,12 +15,18 @@ export class UAMethod extends UABaseNode {
     }
 
     static  fromXML(uaMethod: any, addressSpace: IAddressSpace): UAMethod{
-        const bn=super.fromXML(uaMethod, addressSpace)
+        const bn=super.fromXML(uaMethod, addressSpace) as  UAMethodNodeOptions;
+        bn.methodDeclarationId=uaMethod['@_MethodDeclarationId'];
+        bn.userExecutable=Boolean(uaMethod['@_UserExecutable']||true);
+        bn.executable=Boolean(uaMethod['@_Executable']||true);
         return new UAMethod(bn as UABaseNodeOptions);
     }
 
     toXML(lnst:NamespaceTable, gnst:NamespaceTable): XMLElem {
         const elem =super.toXML(lnst, gnst);
+        elem.attr("MethodDeclarationId", this.methodDeclarationId);
+        elem.attr("UserExecutable", this.userExecutable.toString());
+        elem.attr("Executable", this.executable.toString());
         return elem;
     }
 
@@ -32,5 +42,7 @@ export class UAMethod extends UABaseNode {
 }
 
 export interface UAMethodNodeOptions extends UABaseNodeOptions{
-   
+    methodDeclarationId?: string;
+    userExecutable?: Boolean;
+    executable?: Boolean;
 }