本文整理汇总了TypeScript中node-opcua-address-space.AddressSpace.getNamespace方法的典型用法代码示例。如果您正苦于以下问题:TypeScript AddressSpace.getNamespace方法的具体用法?TypeScript AddressSpace.getNamespace怎么用?TypeScript AddressSpace.getNamespace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类node-opcua-address-space.AddressSpace
的用法示例。
在下文中一共展示了AddressSpace.getNamespace方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: addAggregateSupport
export function addAggregateSupport(addressSpace: AddressSpace) {
const aggregateConfigurationType = addressSpace.getNamespace(0).findObjectType("AggregateConfigurationType");
if (!aggregateConfigurationType) {
throw new Error("addressSpace do not expose AggregateConfigurationType");
}
const aggregateFunctionType = addressSpace.getNamespace(0).findObjectType("AggregateFunctionType");
if (!aggregateFunctionType) {
throw new Error("addressSpace do not expose AggregateFunctionType");
}
const serverObject = addressSpace.rootFolder.objects.getFolderElementByName("Server");
if (!serverObject) {
throw new Error("addressSpace do not expose a ServerObject");
}
// xx serverObject.
const serverCapabilities = serverObject.getChildByName("ServerCapabilities")! as UAServerCapabilities;
// Let see if HistoryServer Capabilities object exists
let historyServerCapabilities = serverCapabilities.getChildByName("HistoryServerCapabilities");
if (!historyServerCapabilities) {
historyServerCapabilities = createHistoryServerCapabilities(addressSpace, serverCapabilities);
}
setHistoricalServerCapabilities(historyServerCapabilities, historicalCapabilitiesDefaultProperties);
addAggregateFunctionSupport(addressSpace, AggregateFunction.Interpolative);
addAggregateFunctionSupport(addressSpace, AggregateFunction.Minimum);
addAggregateFunctionSupport(addressSpace, AggregateFunction.Maximum);
}
示例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: createHistoryServerCapabilities
export function createHistoryServerCapabilities(
addressSpace: AddressSpace,
serverCapabilities: UAServerCapabilities
): UAObject {
/* istanbul ignore next */
if (serverCapabilities.browseName.toString() !== "ServerCapabilities") {
throw new Error("Expecting server Capabilities");
}
const historyServerCapabilitiesType = addressSpace.getNamespace(0).findObjectType("HistoryServerCapabilitiesType")!;
/* istanbul ignore next */
if (!historyServerCapabilitiesType) {
throw new Error("Cannot find HistoryServerCapabilitiesType");
}
const historyServerCapabilities = historyServerCapabilitiesType.instantiate({
browseName: "HistoryServerCapabilities",
componentOf: serverCapabilities
});
return historyServerCapabilities;
}