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


TypeScript NodeId.toString方法代码示例

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


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

示例1: toString

    /**
     * turn reference into a arrow :   ---- ReferenceType --> [NodeId]
     * @method toString
     * @return {String}
     */
    public toString(options?: { addressSpace?: any }): string {

        let infoNode = _w(this.nodeId.toString(), 24);
        let refType = this.referenceType.toString();

        if (options && options.addressSpace) {
            const node = options.addressSpace.findNode(this.nodeId);
            infoNode = "[" + infoNode + "]" + _w(node.browseName.toString(), 40);

            const ref = options.addressSpace.findReferenceType(this.referenceType);
            refType += "[" + ref.nodeId.toString() + "]";
        }
        return _arrow(refType, 40, this.isForward) + infoNode;
    }
开发者ID:node-opcua,项目名称:node-opcua,代码行数:19,代码来源:reference.ts

示例2: return

    return (objectId: NodeId, methodId: NodeId) => {
        const response = getMethodDeclaration_ArgumentList(the_address_space, objectId, methodId);

        /* istanbul ignore next */
        if (response.statusCode !== StatusCodes.Good) {
            console.log(" StatusCode  = " + response.statusCode.toString());
            throw new Error("Invalid Method " + response.statusCode.toString() +
              " ObjectId= " + objectId.toString() + "Method Id =" + methodId.toString());
        }
        const methodDeclaration = response.methodDeclaration;
        // verify input Parameters
        const methodInputArguments = methodDeclaration.getInputArguments();
        assert(_.isArray(methodInputArguments));
        return methodInputArguments;
    };
开发者ID:node-opcua,项目名称:node-opcua,代码行数:15,代码来源:argument_list.ts

示例3: findDataTypeNode

function findDataTypeNode(addressSpace: AddressSpace, encodingNodeId: NodeId): UADataType {

    const encodingNode = addressSpace.findNode(encodingNodeId)!;

    // istanbul ignore next
    if (!encodingNode) {
        throw new Error("findDataTypeNode:  Cannot find " + encodingNodeId.toString());
    }
    // xx console.log("encodingNode", encodingNode.toString());

    const refs = encodingNode.findReferences("HasEncoding", false);
    const dataTypes = refs
      .map((ref) => addressSpace.findNode(ref.nodeId))
      .filter((obj: any) => obj !== null);

    // istanbul ignore next
    if (dataTypes.length !== 1) {
        throw new Error("Internal Error");
    }

    const dataTypeNode = dataTypes[0] as UADataType;
    // istanbul ignore next
    if (dataTypeNode.nodeClass !== NodeClass.DataType) {
        throw new Error("internal error: expecting a UADataType node here");
    }
    return dataTypeNode;

}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:28,代码来源:load_nodeset2.ts

示例4: n

 function n(nodeId: NodeId | null) {
     if (!nodeId || nodeId.isEmpty()) {
         return "";
     }
     const node = addressSpace.findNode(nodeId)!;
     return "\"" + nodeId.toString() +
       "\"" + chalk.yellow(" /* " + (node ? node.browseName.toString() : "???") + " */");
 }
开发者ID:node-opcua,项目名称:node-opcua,代码行数:8,代码来源:address_space_change_event_tools.ts

示例5: toString

 public toString(): string {
     const str =
       "/* OpaqueStructure */ { \n" +
       "nodeId " + this.nodeId.toString() + "\n" +
       "buffer = \n" + hexDump(this.buffer) + "\n" +
       "}";
     return str;
 }
开发者ID:node-opcua,项目名称:node-opcua,代码行数:8,代码来源:extension_object.ts

示例6: nodeIdInfo

function nodeIdInfo(
  addressSpace: AddressSpace,
  nodeId: NodeId
): string {

    const obj = addressSpace.findNode(nodeId);
    const name = obj ? obj.browseName.toString() : " <????>";
    return nodeId.toString() + " [ " + name + " ]";

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

示例7: resolveDataTypeName

function resolveDataTypeName(
  addressSpace: AddressSpacePrivate,
  dataType: string | NodeId
): QualifiedName {

    let dataTypeNode = null;
    // istanbul ignore next
    if (_.isString(dataType)) {
        dataTypeNode = addressSpace.findDataType(dataType);
    } else {
        assert(dataType instanceof NodeId);
        const o = addressSpace.findNode(dataType.toString());
        dataTypeNode = o ? o : null;
    }
    if (!dataTypeNode) {
        throw new Error("Cannot find dataTypeName " + dataType);
    }
    return dataTypeNode.browseName;
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:19,代码来源:nodeset_to_xml.ts

示例8: getMethodDeclaration_ArgumentList

export function getMethodDeclaration_ArgumentList(
  addressSpace: AddressSpace,
  objectId: NodeId,
  methodId: NodeId
): any {

    assert(objectId instanceof NodeId);
    assert(methodId instanceof NodeId);
    // find object in address space
    const obj = addressSpace.findNode(objectId) as UAObject;
    if (!obj) {

        // istanbul ignore next
        if (doDebug) {
            console.warn("cannot find node ", objectId.toString());
        }
        return { statusCode: StatusCodes.BadNodeIdUnknown };
    }
    if (!obj.hasMethods) {
        return { statusCode: StatusCodes.BadNodeIdInvalid };
    }
    let objectMethod = obj.getMethodById(methodId) as UAMethod;
    if (!objectMethod) {

        // the method doesn't belong to the object, nevertheless
        // the method can be called
        objectMethod = addressSpace.findNode(methodId) as UAMethod;
        if (!objectMethod || objectMethod.nodeClass !== NodeClass.Method) {
            return { statusCode: StatusCodes.BadMethodInvalid };
        }
    }

    const methodDeclarationId = (objectMethod as any).methodDeclarationId;

    const methodDeclaration = addressSpace.findNode(methodDeclarationId);
    if (!methodDeclaration) {
        //  return {statusCode: StatusCodes.BadMethodInvalid};
        return { statusCode: StatusCodes.Good, methodDeclaration: objectMethod };
    }
    return { statusCode: StatusCodes.Good, methodDeclaration };
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:41,代码来源:argument_list.ts

示例9:

 return references.filter((r: UAReference) => r.nodeId.toString() === nodeId.toString());
开发者ID:node-opcua,项目名称:node-opcua,代码行数:1,代码来源:test_address_space.ts

示例10: Error

export function bindExtObjArrayNode<T extends ExtensionObject>(
  uaArrayVariableNode: UADynamicVariableArray<T>,
  variableTypeNodeId: string | NodeId,
  indexPropertyName: string
): UAVariablePublic {

    const addressSpace = uaArrayVariableNode.addressSpace;

    const variableType = addressSpace.findVariableType(variableTypeNodeId);
    if (!variableType) {
        throw new Error("Cannot find VariableType " + variableTypeNodeId.toString());
    }
    assert(!variableType.nodeId.isEmpty());

    let structure = addressSpace.findDataType("Structure");
    assert(structure, "Structure Type not found: please check your nodeset file");

    let dataType = addressSpace.findDataType(variableType.dataType);
    if (!dataType) {
        throw new Error("Cannot find DataType " + variableType.dataType.toString());
    }
    assert(dataType.isSupertypeOf(structure as any), "expecting a structure (= ExtensionObject) here ");

    assert(!uaArrayVariableNode.$$variableType, "uaArrayVariableNode has already been bound !");

    uaArrayVariableNode.$$variableType = variableType;

    structure = addressSpace.findDataType("Structure");
    assert(structure, "Structure Type not found: please check your nodeset file");

    // verify that an object with same doesn't already exist
    dataType = addressSpace.findDataType(variableType.dataType)! as UADataType;
    assert(dataType.isSupertypeOf(structure as any), "expecting a structure (= ExtensionObject) here ");

    uaArrayVariableNode.$$dataType = dataType as any;
    uaArrayVariableNode.$$extensionObjectArray = [];
    uaArrayVariableNode.$$indexPropertyName = indexPropertyName;

    prepareDataType(dataType as UADataType);

    uaArrayVariableNode.$$getElementBrowseName = function(this: any, extObj: ExtensionObject) {

        const indexPropertyName1 = this.$$indexPropertyName;

        if (!extObj.hasOwnProperty(indexPropertyName1)) {
            console.log(" extension object do not have ", indexPropertyName1, extObj);
        }
        // assert(extObj.constructor === addressSpace.constructExtensionObject(dataType));
        assert(extObj.hasOwnProperty(indexPropertyName1));
        const browseName = (extObj as any)[indexPropertyName1].toString();
        return browseName;
    };

    const options = {
        get: getExtObjArrayNodeValue,
        set: undefined // readonly
    };

    // bind the readonly
    uaArrayVariableNode.bindVariable(options, true);

    return uaArrayVariableNode;
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:63,代码来源:extension_object_array_node.ts


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