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

TypeScript node-opcua-data-model.coerceLocalizedText函数代码示例

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

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



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

示例1: coerceEnumValues

        return coerceEnumValues(_.map(enumValues, (value: Int64, key)  => {

            return new EnumValueType({
                description: coerceLocalizedText(key),
                displayName: coerceLocalizedText(key),
                value,
            });
        }));
开发者ID:node-opcua,项目名称:node-opcua,代码行数:8,代码来源:coerce_enum_value.ts


示例2: it

        it("should add a YArrayItem", () => {

            const yArrayItem = namespace.addYArrayItem({

                organizedBy: objectsFolder,

                browseName: "MyYArrayItem",

                title: "My Little YArray Item",

                engineeringUnits: standardUnits.degree_celsius,
                engineeringUnitsRange: { low: 100, high: 200 },

                axisScaleType: "Log",

                xAxisDefinition: {
                    axisScaleType: AxisScaleEnumeration.Linear,
                    axisSteps: [0, 25, 50, 75, 100],
                    engineeringUnits: standardUnits.second,
                    euRange: { low: -10, high: 100 },
                    title: coerceLocalizedText("the X axis legend"),
                },

                value: new Variant({
                    arrayType: VariantArrayType.Array,
                    dataType: DataType.Float,
                    value: [1, 2, 3, 2]
                })
            });

            yArrayItem.browseName.toString().should.eql("1:MyYArrayItem");

            yArrayItem.dataType.should.eql(resolveNodeId("Float"));

            yArrayItem.readValue().value.value.length.should.eql(4);
            yArrayItem.readValue().value.value[0].should.eql(1);
            yArrayItem.readValue().value.value[1].should.eql(2);
            yArrayItem.readValue().value.value[2].should.eql(3);
            yArrayItem.readValue().value.value[3].should.eql(2);

            yArrayItem.hasOwnProperty("instrumentRange").should.eql(false, "optional instrument Range not expected");

            yArrayItem.euRange.readValue().value.value.low.should.eql(100);
            yArrayItem.euRange.readValue().value.value.high.should.eql(200);

            yArrayItem.title.readValue().value.value.text.should.eql("My Little YArray Item");

            // access xAxisDefinition from extension object
            const x = yArrayItem.xAxisDefinition.readValue().value.value as AxisInformation;

            x.engineeringUnits.should.eql(standardUnits.second);
            x.title!.text!.should.eql("the X axis legend");
            x.euRange.low.should.eql(-10);
            x.euRange.high.should.eql(100);

            // xx console.log("xxxx ",yArrayItem.xAxisDefinition.toString())
            // xx yArrayItem.xAxisDefinition.euRange.readValue().value.value.should.eql(standardUnits.second);
            // xx yArrayItem.xAxisDefinition.engineeringUnits.readValue().value.value.should.eql(standardUnits.second);

        });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:60,代码来源:subtest_Y_array_item_type.ts


示例3: step8_condition_confirmed

                function step8_condition_confirmed(callback) {
                    //    branchId  |  Active  | Acked | Confirmed | Retain |
                    //    null      |  false   | true  | true      | false   |

                    const context = new SessionContext({ object: condition });
                    const param = [
                        // the eventId
                        { dataType: DataType.ByteString, value: condition.eventId.readValue().value.value },
                        //
                        { dataType: DataType.LocalizedText, value: coerceLocalizedText("Some message") }
                    ];
                    condition.confirm!.execute(param, context,
                      (err: Error|null, callMethodResult: CallMethodResultOptions) => {
                        callMethodResult.statusCode!.should.equal(StatusCodes.Good);
                    });

                    should(condition.branchId.readValue().value.value).eql(NodeId.nullNodeId);
                    should(condition.ackedState.readValue().value.value.text).eql("Acknowledged");
                    should(condition.confirmedState!.readValue().value.value.text).eql("Confirmed");
                    should(condition.retain!.readValue().value.value).eql(false);

                    condition.currentBranch().getBranchId().should.eql(NodeId.nullNodeId);
                    condition.currentBranch().getActiveState().should.eql(false);
                    condition.currentBranch().getAckedState().should.eql(true);
                    condition.currentBranch().getConfirmedState().should.eql(true);
                    condition.currentBranch().getRetain().should.eql(false);

                    callback();
                }
开发者ID:node-opcua,项目名称:node-opcua,代码行数:29,代码来源:utest_alarm_condition.ts


示例4: it

            it("should be possible to set the comment of a condition using the addComment method of the conditionType", async () => {
                const namespace = addressSpace.getOwnNamespace();

                const condition = namespace.instantiateCondition(myCustomConditionType, {
                    browseName: "MyCustomCondition12",
                    conditionSource: null,
                    organizedBy: addressSpace.rootFolder.objects
                });

                condition.raiseNewCondition(new ConditionInfo({ severity: 100 }));

                const context = new SessionContext({ object: condition });
                const eventId = condition.eventId.readValue().value.value;
                should(eventId).be.instanceOf(Buffer);

                const param = [
                    // the eventId
                    new Variant({ dataType: DataType.ByteString, value: eventId }),
                    //
                    new Variant({ dataType: DataType.LocalizedText, value: coerceLocalizedText("Some message") })
                ];

                const conditionType = addressSpace.findObjectType("ConditionType")! as ConditionType;

                conditionType.addComment.execute(param, context,
                  (err: Error | null, callMethodResult: CallMethodResultOptions) => {
                      callMethodResult.statusCode!.should.equal(StatusCodes.Good);
                  });

                condition.currentBranch().getComment().text!.should.eql("Some message");

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


示例5: assert

 return _.map(enumValues, (en: any) => {
     assert(en.hasOwnProperty("value"));
     assert(en.hasOwnProperty("displayName"));
     return new EnumValueType({
         displayName: coerceLocalizedText(en.displayName),
         value: en.value,
     });
 });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:8,代码来源:coerce_enum_value.ts


示例6: step2_condition_acknowledged

                function step2_condition_acknowledged(callback) {
                    // Step 2 : Condition acknowledged :=> Confirmed required
                    //    branchId  |  Active  | Acked | Confirmed | Retain |
                    // 1) null      |  true    | true  | false      | true   |

                    const context = new SessionContext({ object: condition });
                    const param = [
                        // the eventId
                        { dataType: DataType.ByteString, value: condition.eventId.readValue().value.value },
                        //
                        { dataType: DataType.LocalizedText, value: coerceLocalizedText("Some message") }
                    ];
                    condition.acknowledge.execute(param, context,
                      (err: Error| null, callMethodResult: CallMethodResultOptions) => {
                        callMethodResult.statusCode!.should.equal(StatusCodes.Good);
                    });

                    should(condition.branchId.readValue().value.value).eql(NodeId.nullNodeId);
                    should(condition.activeState.readValue().value.value.text).eql("Active");
                    should(condition.ackedState.readValue().value.value.text).eql("Acknowledged");
                    should(condition.confirmedState!.readValue().value.value.text).eql("Unconfirmed");
                    should(condition.retain!.readValue().value.value).eql(true);

                    condition.currentBranch().getBranchId().should.eql(NodeId.nullNodeId);
                    condition.currentBranch().getActiveState().should.eql(true);
                    condition.currentBranch().getAckedState().should.eql(true);
                    condition.currentBranch().getConfirmedState().should.eql(false);
                    condition.currentBranch().getRetain().should.eql(true);

                    // --------------------- the 'acknowledge' event must have been raised
                    acknowledged_spy.callCount.should.eql(1);
                    acknowledged_spy.getCall(0).args.length.should.eql(3);
                    should.not.exist(acknowledged_spy.getCall(0).args[0], "eventId is null");
                    acknowledged_spy.getCall(0).args[1].should.be.instanceOf(LocalizedText);
                    // acknowledged_spy.getCall(0).args[2].should.be.instanceOf(ConditionSnapshot);
                    acknowledged_spy.thisValues[0].should.eql(condition);
                    callback();

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


示例7: setState

    /**
     * @method setState
     */
    public setState(toStateNode: string | State | null): void {

        if (!toStateNode) {
            this.currentStateNode = null;
            this.currentState.setValueFromSource({ dataType: DataType.Null }, StatusCodes.BadStateNotActive);
            return;
        }

        if (_.isString(toStateNode)) {
            const state = this.getStateByName(toStateNode);
            // istanbul ignore next
            if (!state) {
                throw new Error("Cannot find state with name " + toStateNode);
            }
            assert(state.browseName.toString() === toStateNode);
            toStateNode = state;
        }
        const fromStateNode = this.currentStateNode;

        toStateNode = this._coerceNode(toStateNode) as any as State;
        assert(toStateNode.nodeClass === NodeClass.Object);

        this.currentState.setValueFromSource({
            dataType: DataType.LocalizedText,
            value: coerceLocalizedText(toStateNode.browseName.toString())
        }, StatusCodes.Good);

        this.currentStateNode = toStateNode;

        const transitionNode = this.findTransitionNode(fromStateNode, toStateNode);

        if (transitionNode) {

            // xx console.log("transitionNode ",transitionNode.toString());
            // The inherited Property SourceNode shall be filled with the NodeId of the StateMachine instance where the
            // Transition occurs. If the Transition occurs in a SubStateMachine, then the NodeId of the SubStateMachine
            // has to be used. If the Transition occurs between a StateMachine and a SubStateMachine, then the NodeId of
            // the StateMachine has to be used, independent of the direction of the Transition.
            // Transition identifies the Transition that triggered the Event.
            // FromState identifies the State before the Transition.
            // ToState identifies the State after the Transition.
            this.raiseEvent("TransitionEventType", {

                // Base EventType
                // xx nodeId:      this.nodeId,
                // TransitionEventType
                // TransitionVariableType
                "transition": {
                    dataType: "LocalizedText",
                    value: transitionNode.displayName[0]
                },

                "transition.id": transitionNode.transitionNumber.readValue().value,

                "fromState": {
                    dataType: "LocalizedText",
                    value: fromStateNode ? fromStateNode.displayName[0] : ""
                },   // StateVariableType

                "fromState.id": fromStateNode ? fromStateNode.stateNumber.readValue().value : {
                    dataType: "Null"
                },

                "toState": {
                    dataType: "LocalizedText",
                    value: toStateNode.displayName[0]
                },    // StateVariableType

                "toState.id": toStateNode.stateNumber.readValue().value
            });

        } else {
            if (fromStateNode && fromStateNode !== toStateNode) {
                if (doDebug) {
                    const f = fromStateNode.browseName.toString();
                    const t = toStateNode.browseName.toString();
                    console.log(chalk.red("Warning"),
                      " cannot raise event :  transition " + f + " to " + t + " is missing");
                }
            }
        }

        // also update executable flags on methods
        for (const method of this.getMethods()) {
            (method as any)._notifyAttributeChange(AttributeIds.Executable);
        }
    }
开发者ID:node-opcua,项目名称:node-opcua,代码行数:90,代码来源:finite_state_machine.ts


示例8: generateAddressSpace


//.........这里部分代码省略.........
                        this.parent.argument.valueRank = parseInt(this.text.trim(), 10);
                    }
                },

                ArrayDimensions: {

                    finish(this: any) {
                        // xx  this.parent.argument.arrayDimensions =[];
                    }
                },
                Description: {
                    init(this: any) {
                        this._text = "";
                        this.locale = null;
                        this.text = null;
                    },
                    parser: {
                        Locale: {
                            init(this: any) {
                                this.text = "";
                            },
                            finish(this: any) {
                                this.parent.locale = this.text.trim();
                            }
                        },
                        Text: {
                            finish(this: any) {
                                this.text = this.text || "";
                                this.parent._text = this.text.trim();
                            }
                        }
                    },
                    finish(this: any) {
                        this.parent.argument.description = coerceLocalizedText(this._text);
                    }
                }
            },
            finish(this: any) {
                // xx this.argument = new Argument(this.argument);
            }
        }
    };

    const Range_parser = {
        Range: {
            init(this: any) {
                this.range = new Range({});
            },
            parser: {
                Low: {
                    finish(this: any) {
                        this.parent.range.low = parseFloat(this.text);
                    }
                },

                High: {
                    finish(this: any) {
                        this.parent.range.high = parseFloat(this.text);
                    }
                }
            }
        }
    };

    const EUInformation_parser = {
        EUInformation: {
开发者ID:node-opcua,项目名称:node-opcua,代码行数:67,代码来源:load_nodeset2.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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