当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript node-opcua-nodeid.makeNodeId函数代码示例

本文整理汇总了TypeScript中node-opcua-nodeid.makeNodeId函数的典型用法代码示例。如果您正苦于以下问题:TypeScript makeNodeId函数的具体用法?TypeScript makeNodeId怎么用?TypeScript makeNodeId使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了makeNodeId函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: it

    it("should find 'HierarchicalReferences'", () => {

        const hr = addressSpace.findReferenceType("HierarchicalReferences")!;
        hr.browseName.toString().should.equal("HierarchicalReferences");
        hr.nodeId.toString().should.eql(makeNodeId(33).toString());

    });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:7,代码来源:test_referencetype.ts

示例2: addAggregateFunctionSupport

function addAggregateFunctionSupport(
  addressSpace: AddressSpace, functionName: number): void {
    if (!functionName) {
        throw new Error("Invalid function name");
    }

    const serverCapabilities = addressSpace.rootFolder.objects.server.serverCapabilities;

    /* istanbul ignore next */
    if (!serverCapabilities.historyServerCapabilities) {
        throw new Error("missing serverCapabilities.historyServerCapabilities");
    }

    const aggregateFunctions = serverCapabilities.aggregateFunctions;

    const aggregateFunctionsInHist = serverCapabilities.historyServerCapabilities.aggregateFunctions;

    const functionNodeId = makeNodeId(functionName);
    const functionNode = addressSpace.getNamespace(0).findNode(functionNodeId);
    if (!functionNode) {
        throw new Error("Cannot find node " + functionName + " in addressSpace");
    }
    aggregateFunctions.addReference({
        nodeId: functionNode.nodeId,
        referenceType: "Organizes"
    });
    aggregateFunctionsInHist.addReference({
        nodeId: functionNode.nodeId,
        referenceType: "Organizes"
    });
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:31,代码来源:aggregates.ts

示例3: SimpleAttributeOperand

    let selectClauses = browsePaths.map((browsePath) => {
        return new SimpleAttributeOperand({

            attributeId: AttributeIds.Value,
            browsePath,
            indexRange: undefined, //  NumericRange
            typeDefinitionId: makeNodeId(ObjectTypeIds.BaseEventType) // i=2041

        });
    });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:10,代码来源:tools_event_filter.ts

示例4: it

    it("Q3 should encode and decode a method call request", async () => {

        const objectId = makeNodeId(999990, 0);
        const methodId = makeNodeId(999992, 0);

        const obj = addressSpace.findNode(objectId)! as UAObject;
        obj.nodeClass.should.eql(NodeClass.Object);

        const method = obj.getMethodById(methodId)!;
        method.nodeClass.should.eql(NodeClass.Method);
        method.browseName.toString().should.eql("DoStuff");

        const inputArguments = method.getInputArguments();
        inputArguments.should.be.instanceOf(Array);

        const callRequest = new CallRequest({

            methodsToCall: [{
                inputArguments: [{
                    dataType: DataType.UInt32,
                    value: [0xAA, 0xAB, 0xAC]
                }],
                methodId,
                objectId
            }]
        });

        const size = callRequest.binaryStoreSize();

        const stream = new BinaryStream(size);

        callRequest.encode(stream);

        if (doDebug) {
            console.log(hexDump(stream.buffer));
        }

        // now decode
        const callRequest_reloaded = new CallRequest();
        stream.rewind();
        callRequest_reloaded.decode(stream);

    });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:43,代码来源:test_method_service.ts

示例5: makeRefId

export function makeRefId(referenceTypeName: string): NodeId {

    const nodeId = makeNodeId((ReferenceTypeIds as any)[referenceTypeName]
        || (ObjectTypeIds as any)[referenceTypeName]);

    // istanbul ignore next
    if (nodeId.isEmpty()) {
        throw new Error("makeRefId: cannot find ReferenceTypeName + " + referenceTypeName);
    }
    return nodeId;
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:11,代码来源:proxy.ts

示例6: encodeExtensionObject

export function encodeExtensionObject(object: ExtensionObject | null, stream: OutputBinaryStream): void {

    if (!object) {
        encodeNodeId(makeNodeId(0), stream);
        stream.writeUInt8(0x00); // no body is encoded
        // note : Length shall not hbe specified, end of the job!
    } else {
        /* istanbul ignore next */
        if (!((object as any) instanceof ExtensionObject)) {
            throw new Error("Expecting a extension object");
        }
        // ensure we have a valid encoding Default Binary ID !!!
        /* istanbul ignore next */
        if (!object.schema) {
            debugLog(" object = ", object);
            throw new Error("object has no schema " + object.constructor.name);
        }
        const encodingDefaultBinary = object.schema.encodingDefaultBinary;
        /* istanbul ignore next */
        if (!encodingDefaultBinary) {
            debugLog(chalk.yellow("xxxxxxxxx encoding ExtObj "), object);
            throw new Error("Cannot find encodingDefaultBinary for this object");
        }
        /* istanbul ignore next */
        if (encodingDefaultBinary.isEmpty()) {
            debugLog(chalk.yellow("xxxxxxxxx encoding ExtObj "), (object.constructor as any).encodingDefaultBinary.toString());
            throw new Error("Cannot find encodingDefaultBinary for this object");
        }
        /* istanbul ignore next */
        if (is_internal_id(encodingDefaultBinary.value)) {
            debugLog(chalk.yellow("xxxxxxxxx encoding ExtObj "),
              (object.constructor as any).encodingDefaultBinary.toString(), object.schema.name);
            throw new Error("Cannot find valid OPCUA encodingDefaultBinary for this object");
        }

        encodeNodeId(encodingDefaultBinary, stream);
        stream.writeUInt8(0x01); // 0x01 The body is encoded as a ByteString.
        stream.writeUInt32(object.binaryStoreSize());
        object.encode(stream);
    }
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:41,代码来源:extension_object.ts

示例7: it

    it("should crawl on a PseudoSession", async () => {

        const session = new PseudoSession(addressSpace);

        const crawler = new NodeCrawler(session);

        const results: string[] = [];

        const data = {
            onBrowse(this: UserData, crawler1: NodeCrawler, cacheNode: CacheNode) {
                results.push(cacheNode.browseName.toString());
                followForward(crawler1, cacheNode, this);
            }
        };
        const nodeId = makeNodeId(ObjectIds.Server_ServerCapabilities); // server

        await crawler.crawl(nodeId, data);

        results.sort().join(" ").should.eql(
          "HasComponent HasProperty " +
          "LocaleIdArray " +
          "MaxMonitoredItemsPerCall "+
          "MaxNodesPerBrowse " +
          "MaxNodesPerHistoryReadData " +
          "MaxNodesPerHistoryReadEvents " +
          "MaxNodesPerHistoryUpdateData " +
          "MaxNodesPerHistoryUpdateEvents " +
          "MaxNodesPerMethodCall " +
          "MaxNodesPerNodeManagement " +
          "MaxNodesPerRead " +
          "MaxNodesPerRegisterNodes " +
          "MaxNodesPerTranslateBrowsePathsToNodeIds " +
          "MaxNodesPerWrite " + 
          "OperationLimits " +
          "ServerCapabilities");

    });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:37,代码来源:test_crawler_on_addresss_space.ts

示例8: it

 it("AddressSpace#findCorrespondingBasicDataType variation 3 - nodeId as NodeId", () => {
     addressSpace.findCorrespondingBasicDataType(makeNodeId(DataTypeIds.BuildInfo)).should.eql(DataType.ExtensionObject);
 });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:3,代码来源:test_address_space.ts


注:本文中的node-opcua-nodeid.makeNodeId函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。