當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript node-opcua-nodeid.coerceNodeId函數代碼示例

本文整理匯總了TypeScript中node-opcua-nodeid.coerceNodeId函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript coerceNodeId函數的具體用法?TypeScript coerceNodeId怎麽用?TypeScript coerceNodeId使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了coerceNodeId函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: constructHookArgument

///
function constructHookArgument(options?: { dataType: any, valueRank?: number, arrayDimensions?: any }): any {

    options = options || {dataType: DataType.Null};

    let dataType = options.dataType;
    if (dataType) {
        if (typeof dataType === "string") {
            dataType = resolveNodeId(dataType);
        } else if (dataType instanceof NodeId) {
            // nothing
        } else if (dataType.value) {
            assert(dataType.hasOwnProperty("namespace"));
            dataType = coerceNodeId(dataType.value, dataType.namespace);
        } else {
            assert(typeof dataType === "number");
        }
        options.dataType = dataType;
    }
    if (options.valueRank === undefined) {
        options.valueRank = -1;
    }
    // fix missing ArrayDimension (The value is an array with one dimension.)
    if (options.valueRank !== 1 || !options.arrayDimensions) {
        options.arrayDimensions = [0];
    }

    return options;

}
開發者ID:node-opcua,項目名稱:node-opcua,代碼行數:30,代碼來源:imports.ts

示例2: function

ClientSessionImpl.prototype._callMethodCondition = function(
    methodName: string,
    conditionId: NodeIdLike,
    eventId: Buffer,
    comment: LocalizedTextLike, callback: (err?: Error) => void
) {

    conditionId = coerceNodeId(conditionId);
    assert(conditionId instanceof NodeId);
    assert(eventId instanceof Buffer);
    assert(typeof(comment) === "string" || comment instanceof LocalizedText);

    comment = LocalizedText.coerce(comment) || new LocalizedText();

    let methodId: NodeId;

    async.series([

        (innerCallback: ErrorCallback) => {
            this.findMethodId(conditionId, methodName, (err: Error | null, _methodId?: NodeId) => {
                if (err) {
                    return innerCallback(err);
                }
                if (_methodId) {
                    methodId = _methodId;
                }
                innerCallback();
            });
        },

        (innerCallback: ErrorCallback) => {

            const methodToCalls = [];

            methodToCalls.push(new CallMethodRequest({
                inputArguments: [
                    /* eventId */ new Variant({dataType: "ByteString", value: eventId}),
                    /* comment */ new Variant({dataType: "LocalizedText", value: comment})
                ],
                methodId,
                objectId: conditionId,
            }));

            this.call(methodToCalls, (err: Error | null, results?: CallMethodResult[]) => {
                if (err) {
                    return innerCallback(err);
                }
                innerCallback();
            });
        }
    ], (err) => {
        if (err) {
            return callback(err);
        }
        callback();
    });
};
開發者ID:node-opcua,項目名稱:node-opcua,代碼行數:57,代碼來源:client_tools.ts

示例3: constructor

    constructor(options: AddReferenceOpts | Reference) {

        assert(options.referenceType instanceof NodeId);
        assert(options.nodeId instanceof NodeId);

        this.referenceType = coerceNodeId(options.referenceType);
        this.isForward = (options.isForward  === undefined ) ? true : !!options.isForward;
        this.nodeId = _localCoerceToNodeID(options.nodeId);

        // optional to speed up when AddReferenceOpts is in fact a Reference !
        this._referenceType = (options as any)._referenceType;
        this.node = (options as any).node;

        assert(is_valid_reference(this));
    }
開發者ID:node-opcua,項目名稱:node-opcua,代碼行數:15,代碼來源:reference.ts

示例4: getEncodingXmlId

function getEncodingXmlId(schema: StructuredTypeSchema): NodeId {
    const className = schema.name;
    const encodingXmlId = (ObjectIds as any)[className + "_Encoding_DefaultXml"];
    return coerceNodeId(encodingXmlId);
}
開發者ID:node-opcua,項目名稱:node-opcua,代碼行數:5,代碼來源:factory_code_generator.ts

示例5: coerceNodeId

 */

// tslint:disable:no-empty
import chalk from "chalk";
import { EventEmitter } from "events";
import { assert } from "node-opcua-assert";
import { ServerState } from "node-opcua-common";
import { VariableIds } from "node-opcua-constants";
import { DataValue } from "node-opcua-data-value";
import { checkDebugFlag, make_debugLog } from "node-opcua-debug";
import { coerceNodeId } from "node-opcua-nodeid";
import { ErrorCallback } from "node-opcua-secure-channel";
import { StatusCodes } from "node-opcua-status-code";
import { ClientSessionImpl } from "./private/client_session_impl";

const serverStatusStateNodeId = coerceNodeId(VariableIds.Server_ServerStatus_State);

const debugLog = make_debugLog(__filename);
const doDebug = checkDebugFlag(__filename);
const warningLog = debugLog;

const emptyCallback = (err?: Error) => {
};

export interface ClientSessionKeepAliveManagerEvents {
    on(event: "keepalive", eventHandler: (lastKnownServerState: ServerState) => void): ClientSessionKeepAliveManager;
}

export class ClientSessionKeepAliveManager extends EventEmitter implements ClientSessionKeepAliveManagerEvents {

    private readonly session: ClientSessionImpl;
開發者ID:node-opcua,項目名稱:node-opcua,代碼行數:31,代碼來源:client_session_keepalive_manager.ts

示例6: _localCoerceToNodeID

function _localCoerceToNodeID(nodeIdLike: string | NodeId | BaseNode) {
    if ((nodeIdLike as any).nodeId) {
        return (nodeIdLike as BaseNode).nodeId;
    }
    return coerceNodeId(nodeIdLike);
}
開發者ID:node-opcua,項目名稱:node-opcua,代碼行數:6,代碼來源:reference.ts


注:本文中的node-opcua-nodeid.coerceNodeId函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。