當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。