Selaa lähdekoodia

added nodeid, nodeclass, namespace to TheDetail.vue,BaseNode, UAObject, UAVariable; nodeset in store.ts,

DS 7 kuukautta sitten
vanhempi
commit
acf3700527
6 muutettua tiedostoa jossa 41 lisäystä ja 5 poistoa
  1. 18 0
      src/components/TheDetail.vue
  2. 7 1
      src/ua/UABaseNode.ts
  3. 9 1
      src/ua/UANodeSet.ts
  4. 4 2
      src/ua/UAObject.ts
  5. 1 0
      src/ua/UAVariable.ts
  6. 2 1
      src/util/store.ts

+ 18 - 0
src/components/TheDetail.vue

@@ -20,6 +20,24 @@ const store = useStore()
           </div>
           <input type="text" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default" v-model="store.selectedNode.browseName">
         </div>
+        <div class="input-group mb-3">
+          <div class="input-group-prepend">
+            <span class="input-group-text" id="inputGroup-sizing-default">NodeId</span>
+          </div>
+          <input type="text" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default" v-model="store.selectedNode.nodeId">
+        </div>
+        <div class="input-group mb-3">
+          <div class="input-group-prepend">
+            <span class="input-group-text" id="inputGroup-sizing-default">NodeClass</span>
+          </div>
+          <input type="text" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default" v-model="store.selectedNode.nodeClass">
+        </div>
+        <div class="input-group mb-3">
+          <div class="input-group-prepend">
+            <span class="input-group-text" id="inputGroup-sizing-default">Namespace</span>
+          </div>
+          <input type="text" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default" v-model="store.selectedNode.namespace">
+        </div>
       </div>
       </div>
     </div>

+ 7 - 1
src/ua/UABaseNode.ts

@@ -12,6 +12,8 @@ import { UAAccessRestriction } from "./UAAccessRestriction"; //TODO
 export class UABaseNode implements IToXML{
 
     public nodeId: NodeId;
+    public nodeClass: string;
+    public namespace: string;
     public browseName: string;
     public displayName?: string; //LocText
     public description?: string; //LocText
@@ -29,7 +31,9 @@ export class UABaseNode implements IToXML{
     
     constructor(options: UABaseNodeOptions) {
         this.nodeId=options.nodeId;
+        this.nodeClass=options.nodeClass;
         this.browseName=options.browseName;
+        this.namespace=options.namespace;
         this.displayName=options.displayName;
         this.references=options.references||[];
     }
@@ -124,7 +128,7 @@ export class UABaseNode implements IToXML{
         for(const xmlref of xmlReferences.Reference) {
             references.push(UAReference.fromXML(xmlref, nodeId));
         }
-        const ua=new UABaseNode({nodeId: nodeId, 
+        const ua=new UABaseNode({nodeId: nodeId,
                                 browseName: xmlObject['@_BrowseName'], 
                                 displayName: xmlObject['DisplayName']['#text'], 
                                 references: references});
@@ -139,6 +143,8 @@ export class UABaseNode implements IToXML{
 
 export interface UABaseNodeOptions {
     browseName: string;
+    nodeClass?: string;
+    namespace?: string;
     nodeId: NodeId;
     references?: UAReference[];
     displayName?: string;

+ 9 - 1
src/ua/UANodeSet.ts

@@ -2,6 +2,7 @@ import {XMLParser, type X2jOptions} from 'fast-xml-parser';
 import { UAObject } from './UAObject';
 import type { UABaseNode } from './UABaseNode';
 import { UAVariable } from './UAVariable';
+import { UAMethod } from './UAMethod';
 import { NamespaceTable } from './NameSpaceTable';
 import { Model } from './Model';
 import { XMLElem, type IToXML } from '@/util/XmlElem';
@@ -9,6 +10,7 @@ import { XMLElem, type IToXML } from '@/util/XmlElem';
 export class UANodeSet implements IToXML{
 
     constructor(public fileName: string,
+                public uri: string,
                 public models: Model[],
                 public nodes: UABaseNode[],
                 public nameSpaceTable: NamespaceTable) {
@@ -59,6 +61,7 @@ export class UANodeSet implements IToXML{
                     case 'UANodeSet.UAObject.References.Reference':
                     case 'UANodeSet.UAObject':
                     case 'UANodeSet.UAVariable':
+                    case 'UANodeSet.UAMethod':
                     case 'UANodeSet.UAVariable.References.Reference':
                     case 'UANodeSet.Models.Model':
                         return true;
@@ -74,6 +77,7 @@ export class UANodeSet implements IToXML{
         for(const xmlModel of xmlModels.Model) {
             models.push(Model.fromXML(xmlModel));
         }
+        let uri = "xxx";
         const nodes:UABaseNode[]=[];
         const xmlObjects=xmlObj['UANodeSet']['UAObject'];
         for(const xmlObject of xmlObjects) {
@@ -83,6 +87,10 @@ export class UANodeSet implements IToXML{
         for(const xmlVariable of xmlVariables) {
             nodes.push(UAVariable.fromXML(xmlVariable));
         }
+        const xmlMethods=xmlObj['UANodeSet']['UAMethod'];
+        for(const xmlMethod of xmlMethods) {
+            nodes.push(UAMethod.fromXML(xmlMethod));
+        }
         const uaNamespaceUris=xmlObj['UANodeSet']['NamespaceUris'];
         const nst=new NamespaceTable();
         if(uaNamespaceUris) {
@@ -90,6 +98,6 @@ export class UANodeSet implements IToXML{
                 nst.addUri(nsUri['#text'])
             }
         }
-        return new UANodeSet(fileName, models, nodes, nst);
+        return new UANodeSet(fileName, uri, models, nodes, nst);
     }
 }

+ 4 - 2
src/ua/UAObject.ts

@@ -10,7 +10,9 @@ export class UAObject extends UABaseNode {
         const bn=super.fromXML(uaObject)
         return new UAObject({nodeId: bn.nodeId, 
                             browseName: bn.browseName, 
-                            displayName: bn.displayName, 
+                            nodeClass: "Object",
+                            namespace: bn.namespace,
+                            displayName: bn.displayName,
                             references: bn.references});
     }
 
@@ -29,5 +31,5 @@ export class UAObject extends UABaseNode {
 }
 
 export interface UAObjectNodeOptions extends UABaseNodeOptions{
-
+   
 }

+ 1 - 0
src/ua/UAVariable.ts

@@ -9,6 +9,7 @@ export class UAVariable extends UABaseNode {
     static  fromXML(uaObject: any): UAVariable{
         const bn=super.fromXML(uaObject)
         return new UAVariable({nodeId: bn.nodeId, 
+                                nodeClass: "Variable",
                                 browseName: bn.browseName, 
                                 displayName: bn.displayName, 
                                 references: bn.references});

+ 2 - 1
src/util/store.ts

@@ -7,7 +7,8 @@ export const useStore = defineStore('user', {
   state: () => ({
       addressSpace: null as AddressSpace | null,
       rootNode: null as UABaseNode | null,
-      selectedNode: null as UABaseNode | null
+      selectedNode: null as UABaseNode | null,
+      nodeset: null as UANodeSet | null
 
   }),
   actions: {