本文整理汇总了TypeScript中node-opcua-nodeid.makeNodeId函数的典型用法代码示例。如果您正苦于以下问题:TypeScript makeNodeId函数的具体用法?TypeScript makeNodeId怎么用?TypeScript makeNodeId使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了makeNodeId函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it("should find 'HierarchicalReferences'", () => {
const hr = addressSpace.findReferenceType("HierarchicalReferences")!;
hr.browseName.toString().should.equal("HierarchicalReferences");
hr.nodeId.toString().should.eql(makeNodeId(33).toString());
});
示例2: addAggregateFunctionSupport
function addAggregateFunctionSupport(
addressSpace: AddressSpace, functionName: number): void {
if (!functionName) {
throw new Error("Invalid function name");
}
const serverCapabilities = addressSpace.rootFolder.objects.server.serverCapabilities;
/* istanbul ignore next */
if (!serverCapabilities.historyServerCapabilities) {
throw new Error("missing serverCapabilities.historyServerCapabilities");
}
const aggregateFunctions = serverCapabilities.aggregateFunctions;
const aggregateFunctionsInHist = serverCapabilities.historyServerCapabilities.aggregateFunctions;
const functionNodeId = makeNodeId(functionName);
const functionNode = addressSpace.getNamespace(0).findNode(functionNodeId);
if (!functionNode) {
throw new Error("Cannot find node " + functionName + " in addressSpace");
}
aggregateFunctions.addReference({
nodeId: functionNode.nodeId,
referenceType: "Organizes"
});
aggregateFunctionsInHist.addReference({
nodeId: functionNode.nodeId,
referenceType: "Organizes"
});
}
示例3: SimpleAttributeOperand
let selectClauses = browsePaths.map((browsePath) => {
return new SimpleAttributeOperand({
attributeId: AttributeIds.Value,
browsePath,
indexRange: undefined, // NumericRange
typeDefinitionId: makeNodeId(ObjectTypeIds.BaseEventType) // i=2041
});
});
示例4: it
it("Q3 should encode and decode a method call request", async () => {
const objectId = makeNodeId(999990, 0);
const methodId = makeNodeId(999992, 0);
const obj = addressSpace.findNode(objectId)! as UAObject;
obj.nodeClass.should.eql(NodeClass.Object);
const method = obj.getMethodById(methodId)!;
method.nodeClass.should.eql(NodeClass.Method);
method.browseName.toString().should.eql("DoStuff");
const inputArguments = method.getInputArguments();
inputArguments.should.be.instanceOf(Array);
const callRequest = new CallRequest({
methodsToCall: [{
inputArguments: [{
dataType: DataType.UInt32,
value: [0xAA, 0xAB, 0xAC]
}],
methodId,
objectId
}]
});
const size = callRequest.binaryStoreSize();
const stream = new BinaryStream(size);
callRequest.encode(stream);
if (doDebug) {
console.log(hexDump(stream.buffer));
}
// now decode
const callRequest_reloaded = new CallRequest();
stream.rewind();
callRequest_reloaded.decode(stream);
});
示例5: makeRefId
export function makeRefId(referenceTypeName: string): NodeId {
const nodeId = makeNodeId((ReferenceTypeIds as any)[referenceTypeName]
|| (ObjectTypeIds as any)[referenceTypeName]);
// istanbul ignore next
if (nodeId.isEmpty()) {
throw new Error("makeRefId: cannot find ReferenceTypeName + " + referenceTypeName);
}
return nodeId;
}
示例6: encodeExtensionObject
export function encodeExtensionObject(object: ExtensionObject | null, stream: OutputBinaryStream): void {
if (!object) {
encodeNodeId(makeNodeId(0), stream);
stream.writeUInt8(0x00); // no body is encoded
// note : Length shall not hbe specified, end of the job!
} else {
/* istanbul ignore next */
if (!((object as any) instanceof ExtensionObject)) {
throw new Error("Expecting a extension object");
}
// ensure we have a valid encoding Default Binary ID !!!
/* istanbul ignore next */
if (!object.schema) {
debugLog(" object = ", object);
throw new Error("object has no schema " + object.constructor.name);
}
const encodingDefaultBinary = object.schema.encodingDefaultBinary;
/* istanbul ignore next */
if (!encodingDefaultBinary) {
debugLog(chalk.yellow("xxxxxxxxx encoding ExtObj "), object);
throw new Error("Cannot find encodingDefaultBinary for this object");
}
/* istanbul ignore next */
if (encodingDefaultBinary.isEmpty()) {
debugLog(chalk.yellow("xxxxxxxxx encoding ExtObj "), (object.constructor as any).encodingDefaultBinary.toString());
throw new Error("Cannot find encodingDefaultBinary for this object");
}
/* istanbul ignore next */
if (is_internal_id(encodingDefaultBinary.value)) {
debugLog(chalk.yellow("xxxxxxxxx encoding ExtObj "),
(object.constructor as any).encodingDefaultBinary.toString(), object.schema.name);
throw new Error("Cannot find valid OPCUA encodingDefaultBinary for this object");
}
encodeNodeId(encodingDefaultBinary, stream);
stream.writeUInt8(0x01); // 0x01 The body is encoded as a ByteString.
stream.writeUInt32(object.binaryStoreSize());
object.encode(stream);
}
}
示例7: it
it("should crawl on a PseudoSession", async () => {
const session = new PseudoSession(addressSpace);
const crawler = new NodeCrawler(session);
const results: string[] = [];
const data = {
onBrowse(this: UserData, crawler1: NodeCrawler, cacheNode: CacheNode) {
results.push(cacheNode.browseName.toString());
followForward(crawler1, cacheNode, this);
}
};
const nodeId = makeNodeId(ObjectIds.Server_ServerCapabilities); // server
await crawler.crawl(nodeId, data);
results.sort().join(" ").should.eql(
"HasComponent HasProperty " +
"LocaleIdArray " +
"MaxMonitoredItemsPerCall "+
"MaxNodesPerBrowse " +
"MaxNodesPerHistoryReadData " +
"MaxNodesPerHistoryReadEvents " +
"MaxNodesPerHistoryUpdateData " +
"MaxNodesPerHistoryUpdateEvents " +
"MaxNodesPerMethodCall " +
"MaxNodesPerNodeManagement " +
"MaxNodesPerRead " +
"MaxNodesPerRegisterNodes " +
"MaxNodesPerTranslateBrowsePathsToNodeIds " +
"MaxNodesPerWrite " +
"OperationLimits " +
"ServerCapabilities");
});
示例8: it
it("AddressSpace#findCorrespondingBasicDataType variation 3 - nodeId as NodeId", () => {
addressSpace.findCorrespondingBasicDataType(makeNodeId(DataTypeIds.BuildInfo)).should.eql(DataType.ExtensionObject);
});