本文整理汇总了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;未经允许,请勿转载。 |
请发表评论