本文整理汇总了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;
}
示例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();
});
};
示例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));
}
示例4: getEncodingXmlId
function getEncodingXmlId(schema: StructuredTypeSchema): NodeId {
const className = schema.name;
const encodingXmlId = (ObjectIds as any)[className + "_Encoding_DefaultXml"];
return coerceNodeId(encodingXmlId);
}
示例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;
示例6: _localCoerceToNodeID
function _localCoerceToNodeID(nodeIdLike: string | NodeId | BaseNode) {
if ((nodeIdLike as any).nodeId) {
return (nodeIdLike as BaseNode).nodeId;
}
return coerceNodeId(nodeIdLike);
}