UAMethod.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import { XMLElem } from "@/util/XmlElem";
  2. import { UABaseNode, type UABaseNodeOptions } from "./UABaseNode";
  3. export class UAMethod extends UABaseNode {
  4. constructor(options: UAMethodNodeOptions) {
  5. super(options);
  6. }
  7. static fromXML(uaMethod: any): UAMethod{
  8. const bn=super.fromXML(uaMethod)
  9. return new UAMethod({nodeId: bn.nodeId,
  10. browseName: bn.browseName,
  11. nodeClass: "Method",
  12. namespace: bn.namespace,
  13. displayName: bn.displayName,
  14. references: bn.references});
  15. }
  16. toXML(): XMLElem {
  17. const elem =new XMLElem('UAMethod');
  18. elem.attr('NodeID', this.nodeId.toString())
  19. .attr('BrowseName', this.browseName)
  20. .attr('DisplayName', this.displayName);
  21. const refs=elem.add(new XMLElem('References'))
  22. for(const ref of this.references) {
  23. refs.add(ref.toXML());
  24. }
  25. return elem;
  26. }
  27. }
  28. export interface UAMethodNodeOptions extends UABaseNodeOptions{
  29. }