Bladeren bron

parse additional uamethod fields

Martin Kunz 9 maanden geleden
bovenliggende
commit
f6d39972ac
1 gewijzigde bestanden met toevoegingen van 14 en 2 verwijderingen
  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;
 }