当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript AddressSpace.getNamespace方法代码示例

本文整理汇总了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);

}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:32,代码来源:aggregates.ts

示例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"
    });
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:31,代码来源:aggregates.ts

示例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;
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:22,代码来源:aggregates.ts


注:本文中的node-opcua-address-space.AddressSpace.getNamespace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。