How to use the node-opcua-common.ServerState.Running function in node-opcua-common

To help you get started, we’ve selected a few node-opcua-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github node-opcua / node-opcua / packages / node-opcua-server / source / server_engine.ts View on Github external
generateAddressSpace(engine.addressSpace, options.nodeset_filename, () => {

      if (!engine.addressSpace) {
        throw new Error("Internal error");
      }
      const addressSpace = engine.addressSpace;

      const endTime = new Date();
      debugLog("Loading ", options.nodeset_filename, " done : ",
        endTime.getTime() - startTime.getTime(), " ms");

      engine.setServerState(ServerState.Running);

      function bindVariableIfPresent(nodeId: NodeId, opts: any) {
        assert(nodeId instanceof NodeId);
        assert(!nodeId.isEmpty());
        const obj = addressSpace.findNode(nodeId);
        if (obj) {
          __bindVariable(engine, nodeId, opts);
        }
        return obj;
      }

      // -------------------------------------------- install default get/put handler
      const server_NamespaceArray_Id = makeNodeId(VariableIds.Server_NamespaceArray); // ns=0;i=2255
      bindVariableIfPresent(server_NamespaceArray_Id, {
        get() {
          return new Variant({
github node-opcua / node-opcua / packages / node-opcua-server / src / server_engine.js View on Github external
const endTime = new Date();
        debugLog("Loading ", options.nodeset_filename, " done : ", endTime - startTime, " ms");

        function findObjectNodeId(name) {
            const obj = engine.addressSpace.findNode(name);
            return obj ? obj.nodeId : null;
        }

        engine.FolderTypeId = findObjectNodeId("FolderType");
        engine.BaseObjectTypeId = findObjectNodeId("BaseObjectType");
        engine.BaseDataVariableTypeId = findObjectNodeId("BaseDataVariableType");

        engine.rootFolder = engine.addressSpace.findNode("RootFolder");
        assert(engine.rootFolder && engine.rootFolder.readAttribute, " must provide a root folder and expose a readAttribute method");

        engine.setServerState(ServerState.Running);

        function bindVariableIfPresent(nodeId, opts) {
            assert(nodeId instanceof NodeId);
            assert(!nodeId.isEmpty());
            const obj = engine.addressSpace.findNode(nodeId);
            if (obj) {
                __bindVariable(engine, nodeId, opts);
            }
            return obj;
        }


        // -------------------------------------------- install default get/put handler
        const server_NamespaceArray_Id = makeNodeId(VariableIds.Server_NamespaceArray); // ns=0;i=2255
        bindVariableIfPresent(server_NamespaceArray_Id, {
            get: function () {