本文整理匯總了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;
}