import { XMLElem } from "@/util/XmlElem"; import type { NamespaceTable } from "./NameSpaceTable"; import { UABaseNode, type UABaseNodeOptions } from "./UABaseNode"; import type { IAddressSpace } from "./IAddressSpace"; export class UAObject extends UABaseNode { public parentNodeId?: string; public eventNotifier: number=0; constructor(options: UAObjectNodeOptions) { super(options); Object.assign(this, options); this.nodeClass="Object"; } static fromXML(uaObject: any, addressSpace: IAddressSpace): UAObject{ const bn=super.fromXML(uaObject, addressSpace) as UAObjectNodeOptions; bn.parentNodeId=uaObject['@_ParentNodeId']; bn.eventNotifier=Number(uaObject['@_EventNotifier']||0); return new UAObject(bn as UAObjectNodeOptions); } toXML(lnst:NamespaceTable, gnst:NamespaceTable): XMLElem { const elem =super.toXML(lnst, gnst); elem.attr("ParentNodeId", this.parentNodeId); elem.attr("EventNotifier", this.eventNotifier?.toString()); return elem; } } export interface UAObjectNodeOptions extends UABaseNodeOptions{ parentNodeId?: string; eventNotifier?: number; }