• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript node-opcua-nodeid.sameNodeId函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中node-opcua-nodeid.sameNodeId函数的典型用法代码示例。如果您正苦于以下问题:TypeScript sameNodeId函数的具体用法?TypeScript sameNodeId怎么用?TypeScript sameNodeId使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了sameNodeId函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: assert

function _slow_isSupertypeOf<T extends UAType>(
  this: T,
  Class: typeof BaseNode,
  baseType: T
): boolean {

    assert(this instanceof Class);
    assert(baseType instanceof Class, " Object must have same type");
    assert(this.addressSpace);

    if (sameNodeId(this.nodeId, baseType.nodeId)) {
        return true;
    }
    const references = this.allReferences();

    const subTypes = references.filter(_filterSubType);
    assert(subTypes.length <= 1, "should have zero or one subtype no more");

    for (const subType1 of subTypes) {
        const subTypeId = subType1.nodeId;
        const subTypeNode = this.addressSpace.findNode(subTypeId) as any as T;
        // istanbul ignore next
        if (!subTypeNode) {
            throw new Error("Cannot find object with nodeId " + subTypeId.toString());
        }
        if (sameNodeId(subTypeNode.nodeId, baseType.nodeId)) {
            return true;
        } else {
            if (_slow_isSupertypeOf.call(subTypeNode, Class, baseType)) {
                return true;
            }
        }
    }
    return false;
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:35,代码来源:tool_isSupertypeOf.ts


示例2: _add_backward_reference

    // TODO : shall we care about overloading the remove_backward_reference method ?
    // some TrueSubState and FalseSubState relationship may be added later
    // so we need a mechanism to keep adding the "value_changed" event handle on subStates that
    // will be defined later.
    // install change detection on sub State
    // this is useful to change the effective transitionTime
    // EffectiveTransitionTime specifies the time when the current state or one of its sub states was entered.
    // If, for example, a LevelAlarm is active and – while active – switches several times between High and
    // HighHigh, then the TransitionTime stays at the point in time where the Alarm became active whereas the
    // EffectiveTransitionTime changes with each shift of a sub state.
    protected _add_backward_reference(reference: Reference): void {

        const self = this;

        super._add_backward_reference(reference);

        if (reference.isForward &&
          (sameNodeId(reference.referenceType, hasTrueSubState_ReferenceTypeNodeId) ||
            sameNodeId(reference.referenceType, hasFalseSubState_ReferenceTypeNodeId))) {

            const addressSpace = self.addressSpace;
            // add event handle
            const subState = addressSpace.findNode(reference.nodeId) as UAVariable;
            subState.on("value_changed", _updateEffectiveTransitionTime.bind(null, self, subState));
        }
    }
开发者ID:node-opcua,项目名称:node-opcua,代码行数:26,代码来源:ua_two_state_variable.ts


示例3: extractEventField

/**
 *
 * @method extractEventField
 * extract a eventField from a event node, matching the given selectClause
 * @param eventData
 * @param selectClause
 */
function extractEventField(eventData: any, selectClause: SimpleAttributeOperand): Variant {

    assert_valid_event_data(eventData);
    assert(selectClause instanceof SimpleAttributeOperand);

    selectClause.browsePath = selectClause.browsePath || [];

    if (selectClause.browsePath.length === 0 && selectClause.attributeId === AttributeIds.NodeId) {

        // "ns=0;i=2782" => ConditionType
        // "ns=0;i=2041" => BaseEventType
        if (selectClause.typeDefinitionId.toString() !== "ns=0;i=2782") {
            // not ConditionType
            // tslint:disable-next-line:no-console
            console.warn("this case is not handled yet : selectClause.typeDefinitionId = " + selectClause.typeDefinitionId.toString());
            const eventSource1 = eventData.$eventDataSource;
            return new Variant({ dataType: DataType.NodeId, value: eventSource1.nodeId });
        }
        const conditionTypeNodeId = resolveNodeId("ConditionType");
        assert(sameNodeId(selectClause.typeDefinitionId, conditionTypeNodeId));

        const eventSource = eventData.$eventDataSource;
        const eventSourceTypeDefinition = eventSource.typeDefinitionObj;
        if (!eventSourceTypeDefinition) {
            // eventSource is a EventType class
            return new Variant();
        }
        const addressSpace = eventSource.addressSpace;
        const conditionType = addressSpace.findObjectType(conditionTypeNodeId);

        if (!eventSourceTypeDefinition.isSupertypeOf(conditionType)) {
            return new Variant();
        }
        // Yeh : our EventType is a Condition Type !
        return new Variant({ dataType: DataType.NodeId, value: eventSource.nodeId });
    }

    const handle = eventData.resolveSelectClause(selectClause);

    if (handle !== null) {
        const value = eventData.readValue(handle, selectClause);
        assert(value instanceof Variant);
        return value;

    } else {

        // Part 4 - 7.17.3
        // A null value is returned in the corresponding event field in the Publish response if the selected
        // field is not part of the Event or an error was returned in the selectClauseResults of the EventFilterResult.
        // return new Variant({dataType: DataType.StatusCode, value: browsePathResult.statusCode});
        return new Variant();
    }
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:60,代码来源:tools_event_filter.ts


示例4: is_valid_reference

function is_valid_reference(ref: Reference): boolean {

    const hasRequestedProperties = ref.hasOwnProperty("referenceType") &&
        ref.hasOwnProperty("nodeId") &&
        !utils.isNullOrUndefined(ref.isForward);

    if (!hasRequestedProperties) {
        return false;
    }
    assert(ref.referenceType instanceof NodeId);
    assert(!ref.node || sameNodeId(ref.node.nodeId, ref.nodeId));
    // xx assert(!ref.referenceTypeName || typeof ref.referenceTypeName === "string");
    // xx // referenceType shall no be a nodeId string (this could happen by mistake)
    // xx assert(!isNodeIdString(ref.referenceType));
    return true;
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:16,代码来源:reference.ts


示例5: _filterSubType

function _filterSubType(reference: UAReference) {
    return (sameNodeId(reference.referenceType, HasSubTypeNodeId)
      && !reference.isForward);
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:4,代码来源:tool_isSupertypeOf.ts


示例6: sameNodeId

 refs = refs.filter((ref: UAReference) => {
     return sameNodeId(ref.nodeId, normalizedReference.nodeId);
 });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:3,代码来源:assertHasMatchingReference.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript node-opcua-nodeid.NodeId类代码示例发布时间:2022-05-25
下一篇:
TypeScript node-opcua-nodeid.resolveNodeId函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap