Esempio n. 1
0
        public ModbusClientNode(INodeContext context)
        {
            context.ThrowIfNull("context");
            ITypeService typeService = context.GetService <ITypeService>();

            this.TimeSpan          = typeService.CreateInt(PortTypes.Integer, "Abfrageinterval", 60);
            this.ModbusHost        = typeService.CreateString(PortTypes.String, "Modbus TCP Host");
            this.ModbusPort        = typeService.CreateInt(PortTypes.Integer, "Port", 502);
            this.ModbusID          = typeService.CreateInt(PortTypes.Integer, "Geräte ID", 1);
            this.ModbusID.MinValue = 1;
            this.ModbusID.MaxValue = 256;

            // --------------------------------------------------------------------------------------- //
            this.ModbusAddress1          = typeService.CreateInt(PortTypes.Integer, "Register Addresse", 1);
            this.ModbusAddress1.MinValue = 1;
            this.ModbusAddress1.MaxValue = 65535;

            this.FunctionCode = typeService.CreateEnum("ModbusFunction", "Funktion", FunctionCodeEnum.VALUES, FunctionCodeEnum.FC_03);

            this.DataType = typeService.CreateEnum("ModbusDataType", "Datentyp", DataTypeEnum.VALUES, DataTypeEnum.INT32);

            this.RegisterOrder = typeService.CreateEnum("ModbusRegisterOrder", "Register Reihenfolge", ByteOrderEnum.VALUES, ByteOrderEnum.LOW_HIGH);

            this.OutputValue1 = typeService.CreateDouble(PortTypes.Number, "Register Wert");

            this.ErrorMessage = typeService.CreateString(PortTypes.String, "RAW / Error");

            SchedulerService = context.GetService <ISchedulerService>();
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BasicNode"/> class.
        /// </summary>
        /// <param name="context">The node context.</param>
        public InputSelector(INodeContext context)
            : base(context, INPUT_PREFIX)
        {
            context.ThrowIfNull("context");
            mTypeService = context.GetService <ITypeService>();

            // Initialize the input count, allowing range 2..99.
            mInputCount          = mTypeService.CreateInt(PortTypes.Integer, "InputCount", 2);
            mInputCount.MinValue = 2;
            mInputCount.MaxValue = 50;

            // Initialize inputs using a helper function that grows/shrinks the list of inputs
            // whenever the input count is changed
            mInputs = new List <AnyValueObject>();
            ListHelpers.ConnectListToCounter(mInputs, mInputCount,
                                             mTypeService.GetValueObjectCreator(PortTypes.Any, INPUT_PREFIX),
                                             updateOutputValues);

            // Initialize the input for the index of the input to select.
            mSelectIndexInput           = mTypeService.CreateInt(PortTypes.Integer, "InputSelectIndex");
            mSelectIndexInput.MinValue  = 0;
            mSelectIndexInput.MaxValue  = mInputCount.MaxValue - 1;
            mSelectIndexInput.ValueSet += updateOutputValues;

            // Initialize the selector for "send-on-select".
            mSelectAction = mTypeService.CreateEnum("ESelectAction2",
                                                    "SelectAction2", mSelectActionValues, "ResendCurrent");

            // Initialize the output
            mOutput = mTypeService.CreateAny(PortTypes.Any, "Output");
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UnifiPresenceDetectionNode"/> class.
        /// </summary>
        /// <param name="context">The node context.</param>
        public UnifiPresenceDetectionNode(INodeContext context)
            : base(context)
        {
            context.ThrowIfNull("context");

            // Get the TypeService from the context
            this.TypeService = context.GetService <ITypeService>();
            this.Trigger     = this.TypeService.CreateBool(PortTypes.Bool, "Trigger", false);
            this.BaseUrl     = this.TypeService.CreateString(PortTypes.String, "BaseURL", "https://127.0.0.1:8443");
            this.SiteId      = this.TypeService.CreateString(PortTypes.String, "UniFi Site", "default");
            this.Username    = this.TypeService.CreateString(PortTypes.String, "Username", "");
            this.Password    = this.TypeService.CreateString(PortTypes.String, "Password", "");

            this.DeviceAmount          = this.TypeService.CreateInt(PortTypes.Integer, "Anzahl Geräte", 1);
            this.DeviceAmount.MinValue = 1;
            this.DeviceAmount.MaxValue = 15;

            this.Devices = new List <IValueObject>();
            this.DeviceAmount.ValueSet += this.GenerateDevicePorts;

            this.ConnectedAmount  = this.TypeService.CreateInt(PortTypes.Integer, "Anzahl angemeldete Clients", 0);
            this.IsOneConnected   = this.TypeService.CreateBool(PortTypes.Bool, "Mindestens ein Device angemeldet", false);
            this.IsAllConnected   = this.TypeService.CreateBool(PortTypes.Bool, "Alle Devices angemeldet", false);
            this.ConnectedPersons = this.TypeService.CreateString(PortTypes.String, "Angemeldete Personen", "");

            this.Error = this.TypeService.CreateString(PortTypes.String, "Fehlermeldung", "");

            this.DeviceAmount.Value = 1;

            this.DefinedDevicesAndPersons = new Dictionary <string, string>();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="TimedStatistics"/> class.
        /// </summary>
        /// <param name="context">The node context.</param>
        public TimedStatistics(INodeContext context)
            : base(context)
        {
            context.ThrowIfNull("context");
            mSchedulerService = context.GetService <ISchedulerService>();
            var typeService = context.GetService <ITypeService>();

            // Initialize inputs
            mReset = typeService.CreateBool(PortTypes.Binary, "Reset", false);
            mInput = typeService.CreateDouble(PortTypes.Number, "Input");

            // Initialize Outputs
            mOutputAvg    = typeService.CreateDouble(PortTypes.Number, "Avg");
            mOutputMin    = typeService.CreateDouble(PortTypes.Number, "Min");
            mOutputMax    = typeService.CreateDouble(PortTypes.Number, "Max");
            mOutputChange = typeService.CreateDouble(PortTypes.Number, "Change");
            mOutputTrend  = typeService.CreateInt(PortTypes.Integer, "Trend");
            mOutputSum    = typeService.CreateDouble(PortTypes.Number, "Sum");
            mOutputNumber = typeService.CreateInt(PortTypes.Integer, "Number");

            // Default resolution of input values is 1.0
            mInputResolution = typeService.CreateDouble(PortTypes.Number,
                                                        "InputResolution", 1.0);

            // Default considered timespan is one minute
            mConsideredTime = typeService.CreateTimeSpan(PortTypes.TimeSpan,
                                                         "ConsideredTime", new TimeSpan(0, 0, 1, 0));
            // Considered timespan range is 0s (unlimited), or 5s .. 1 year
            mConsideredTime.MinValue  = new TimeSpan(0 /* ticks */);
            mConsideredTime.MaxValue  = new TimeSpan(366 /* days */, 0, 0, 0);
            mConsideredTime.ValueSet += updateFirstOutputAfterTimeRange;

            // Default timespan to send first values after is 0 (immediately)
            mFirstOutputAfterTime = typeService.CreateTimeSpan(PortTypes.TimeSpan,
                                                               "FirstOutputAfterTime", new TimeSpan(0 /* ticks */));
            // Range is 0 (immediately) to considered time
            mFirstOutputAfterTime.MinValue = new TimeSpan(0 /* ticks */);
            mFirstOutputAfterTime.MaxValue = mConsideredTime.Value;

            // Default update timespan is 0 (updates only upon receiving new values)
            mUpdateInterval = typeService.CreateTimeSpan(PortTypes.TimeSpan, "UpdateTime",
                                                         new TimeSpan(0, 0, 0, 0));
            // Update timespan range is 0s (never), or 0,5s .. 1 year
            mUpdateInterval.MinValue = new TimeSpan(0 /* ticks */);
            mUpdateInterval.MaxValue = new TimeSpan(366 /* days */, 0, 0, 0);

            // Default maximum number of stored entries is 50; range is 10 .. 2000
            mMaxEntries          = typeService.CreateInt(PortTypes.Integer, "MaxNumber", 50);
            mMaxEntries.MinValue = 10;
            mMaxEntries.MaxValue = 2000;

            mTimedValues = new LinkedList <TimedValue>();
        }
Esempio n. 5
0
        public KHueNodeBinary(INodeContext context) : base(context)
        {
            context.ThrowIfNull("context");

            _typeService = context.GetService <ITypeService>();

            Input        = _typeService.CreateBool(PortTypes.Binary, "Input");
            LightId      = _typeService.CreateInt(PortTypes.Integer, "Light ID");
            Username     = _typeService.CreateString(PortTypes.String, "Hue user name");
            IpAddress    = _typeService.CreateString(PortTypes.String, "Hue bridge IP address");
            ErrorMessage = _typeService.CreateString(PortTypes.String, "Error message");
        }
        public WakeOnLanNode(INodeContext context)
            : base(context)
        {
            context.ThrowIfNull("context");

            // Get the TypeService from the context
            var typeService = context.GetService <ITypeService>();

            // Initialize the ports Input and Output with a double value object and the translateable name "Input" / "Output".
            // The port type 'Number' accepts connections to any other number.
            this.Trigger    = typeService.CreateBool(PortTypes.Binary, "Trigger");
            this.MacAddress = typeService.CreateString(PortTypes.String, "MacAddress");
        }
Esempio n. 7
0
        public KHueNodeRgb(INodeContext context) : base(context)
        {
            context.ThrowIfNull("context");

            _typeService = context.GetService <ITypeService>();

            Red          = _typeService.CreateByte(PortTypes.Byte, "Red");
            Green        = _typeService.CreateByte(PortTypes.Byte, "Green");
            Blue         = _typeService.CreateByte(PortTypes.Byte, "Blue");
            LightId      = _typeService.CreateInt(PortTypes.Integer, "Light ID");
            Username     = _typeService.CreateString(PortTypes.String, "Hue user name");
            IpAddress    = _typeService.CreateString(PortTypes.String, "Hue bridge IP address");
            ErrorMessage = _typeService.CreateString(PortTypes.String, "Error message");
        }
        public DimmerNode(INodeContext context, ISchedulerService schedulerService) : base(context)
        {
            context.ThrowIfNull("context");
            schedulerService.ThrowIfNull("schedulerService");
            this._typeService      = context.GetService <ITypeService>();
            this._schedulerService = schedulerService;

            this.StartDimDelay  = this._typeService.CreateInt(PortTypes.Integer, "StartDimDelay", 400, "ms");
            this.DimPercent     = this._typeService.CreateInt(PortTypes.Integer, "DimPercent", 100, "%");
            this.Mode           = this._typeService.CreateEnum("BINARYDIMMODE", "Mode", Modes, MODE_SINGLE_BUTTON_SWITCHING);
            this.Mode.ValueSet += (sender, e) => { this.UpdateMode(); };
            UpdateMode();
            this.LightState  = this._typeService.CreateBool(PortTypes.Bool, "LightState");
            this.SwitchOnOff = this._typeService.CreateBool(PortTypes.Bool, "SwitchOnOff");
        }
Esempio n. 9
0
        public SendMail(INodeContext context) : base(context)
        {
            context.ThrowIfNull("context");
            ITypeService typeService = context.GetService <ITypeService>();

            this.SendTrigger  = typeService.CreateBool(PortTypes.Bool, "Trigger");
            this.To           = typeService.CreateString(PortTypes.String, "Empfängeradresse");
            this.From         = typeService.CreateString(PortTypes.String, "Senderadresse");
            this.SmtpHost     = typeService.CreateString(PortTypes.String, "SMTP Server");
            this.SmtpPort     = typeService.CreateInt(PortTypes.Integer, "SMTP Port");
            this.ErrorMessage = typeService.CreateString(PortTypes.String, "Fehlertext");
            this.Encryption   = typeService.CreateEnum("SmtpEncryption", "Verschlüsselung", EncryptionTypes.VALUES);
            this.SmtpUser     = typeService.CreateString(PortTypes.String, "SMTP Benutzer");
            this.SmtpPassword = typeService.CreateString(PortTypes.String, "SMTP Kennwort");
        }
Esempio n. 10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AirPressureConverterNode"/> class.
        /// </summary>
        /// <param name="context">The node context.</param>
        public AirPressureConverterNode(INodeContext context)
            : base(context)
        {
            context.ThrowIfNull("context");
            // Get the TypeService from the context
            var typeService = context.GetService <ITypeService>();

            this.Temperature          = typeService.CreateDouble(PortTypes.Temperature, "Temperatur (°C)");
            this.Temperature.MinValue = -50;
            this.Temperature.MaxValue = 50;

            this.AbsoluteAirPressure = typeService.CreateDouble(PortTypes.Float, "Absoluter Luftdruck (hPA)");
            this.MeasurementHeight   = typeService.CreateInt(PortTypes.Integer, "Messhöhe über N.N.");
            this.RelativeAirPressure = typeService.CreateDouble(PortTypes.Float, "Relative Luftfeuchtigkeit (hPA)");
        }
Esempio n. 11
0
        /// <summary>
        /// Initializes a new instance.
        /// </summary>
        /// <param name="context">The node context.</param>
        public XmlJsonParser(INodeContext context)
            : base(context, OUTPUT_PREFIX)
        {
            context.ThrowIfNull("context");
            mTypeService = context.GetService <ITypeService>();

            // Initialize the input.
            mInput = mTypeService.CreateString(PortTypes.String, INPUT_NAME);

            // Initialize the selector for "XML" or "JSON".
            mSelectInput = mTypeService.CreateEnum("ESelectCode", "SelectCode", mSelectInputValues, "XML");

            // Initialize the output etc. parameter count.
            mCount           = mTypeService.CreateInt(PortTypes.Integer, "OutputCount", 1);
            mCount.MinValue  = 1;
            mCount.MaxValue  = 50;
            mCount.ValueSet += updateSelectOperationCount;

            // Initialize operation selector parameters
            mSelectOperation = new List <EnumValueObject>();
            updateSelectOperationCount();

            // Initialize operation parameters using a helper function that grows/shrinks
            // the list whenever the count is changed
            mSelectParam = new List <StringValueObject>();
            ListHelpers.ConnectListToCounter(mSelectParam, mCount,
                                             mTypeService.GetValueObjectCreator(PortTypes.String, SEL_OP_PARAM_PREFIX),
                                             null, updateSelectParamDefault);
            updateSelectParamDefault();

            // Initialize path parameters using a helper function that grows/shrinks the
            // list whenever the count is changed
            mPath = new List <StringValueObject>();
            ListHelpers.ConnectListToCounter(mPath, mCount,
                                             mTypeService.GetValueObjectCreator(PortTypes.String, PATH_PREFIX), null);

            // Initialize outputs using a helper function that grows/shrinks the list of
            // outputs whenever the output count is changed
            mOutput = new List <AnyValueObject>();
            ListHelpers.ConnectListToCounter(mOutput, mCount,
                                             mTypeService.GetValueObjectCreator(PortTypes.Any, OUTPUT_PREFIX), null);

            // Initialize error text output
            mError = mTypeService.CreateString(PortTypes.String, "RuntimeError");

            mCommaCulture = new CultureInfo("de");
            mPointCulture = new CultureInfo("en");
        }
Esempio n. 12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SendByDifference"/> class.
        /// </summary>
        /// <param name="context">The node context.</param>
        public SendByDifference(INodeContext context)
            : base(context)
        {
            context.ThrowIfNull("context");
            var typeService = context.GetService <ITypeService>();

            // Initialize Input and Output with no defaults or restrictions
            mInput  = typeService.CreateDouble(PortTypes.Number, "Input");
            mOutput = typeService.CreateDouble(PortTypes.Number, "Output");

            // Initialize MinimumDifference parameter with a default of 2.0,
            // and restrict to positive values
            mMinimumDifference = typeService.CreateDouble(PortTypes.Number,
                                                          "MinimumDifference", 1.0);
            mMinimumDifference.MinValue = 0.0;
        }
Esempio n. 13
0
        public DewPointNode(INodeContext context) : base(context)
        {
            context.ThrowIfNull("context");

            this.typeService = context.GetService <ITypeService>();

            this.Temperature          = this.typeService.CreateDouble(PortTypes.Temperature, "Temperatur (°C)");
            this.Temperature.MinValue = -248;
            this.Temperature.MaxValue = 2000;

            this.Humidity          = this.typeService.CreateDouble(PortTypes.Float, "rel. Luftfeuchte (%)");
            this.Humidity.MinValue = 0;
            this.Humidity.MaxValue = 100;

            this.DewPoint = this.typeService.CreateDouble(PortTypes.Float, "Taupunkt (°C)");
        }
Esempio n. 14
0
        public WebRequestNode(INodeContext context)
            : base(context)
        {
            context.ThrowIfNull("context");
            this.TypeService = context.GetService <ITypeService>();

            this.Trigger       = this.TypeService.CreateBool(PortTypes.Binary, "Trigger");
            this.URL           = this.TypeService.CreateString(PortTypes.String, "URL");
            this.URL.ValueSet += RefreshVariables;
            this.Method        = this.TypeService.CreateEnum("HttpMethodType", "Method", new string[] {
                "GET", "POST", "HEAD", "PUT", "DELETE", "CONNECT", "OPTIONS", "PATCH"
            }, "GET");
            this.AuthType = this.TypeService.CreateEnum(
                "HttpAuthType",
                "AuthType",
                new string[]
            {
                AuthCredentials.AuthType.NoAuth.ToString(),
                AuthCredentials.AuthType.BasicAuth.ToString(),
                AuthCredentials.AuthType.BearerToken.ToString()
            },
                AuthCredentials.AuthType.NoAuth.ToString());
            this.AuthType.ValueSet += AuthType_ValueSet;
            this.Method.ValueSet   += UpdateBodyAndContentTypeInputVisibility;
            this.ContentType        = null;
            this.Body       = null;
            this.HeaderMode = this.TypeService.CreateEnum("HeaderModeType", "HeaderMode", new string[] {
                "HeaderMode.0",
                "HeaderMode.1",
                "HeaderMode.2",
                "HeaderMode.3",
                "HeaderMode.4",
                "HeaderMode.5",
                "HeaderMode.6",
                "HeaderMode.7",
                "HeaderMode.8",
                "HeaderMode.9",
                "HeaderMode.10"
            },
                                                          "HeaderMode.0");
            this.HeaderMode.ValueSet += UpdateHeaders;
            this.Headers              = new List <StringValueObject>();
            this.Variables            = new List <StringValueObject>();
            this.Response             = this.TypeService.CreateString(PortTypes.String, "Response");
            this.ErrorCode            = this.TypeService.CreateInt(PortTypes.Integer, "ErrorCode");
            this.ErrorMessage         = this.TypeService.CreateString(PortTypes.String, "ErrorMessage");
        }
Esempio n. 15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PlaceholderNodeBase"/> class.
        /// </summary>
        /// <param name="context">The node context.</param>
        public PlaceholderNodeBase(INodeContext context)
            : base(context)
        {
            context.ThrowIfNull("context");
            mTypeService = context.GetService <ITypeService>();

            // Initialize one template parameter, but allow more of them
            mTemplateCount          = mTypeService.CreateInt(PortTypes.Integer, TEMPLATE_PREFIX + "Count", 1);
            mTemplateCount.MinValue = 1;
            mTemplateCount.MaxValue = 10;
            mTemplates = new List <StringValueObject>();
            ListHelpers.ConnectListToCounter(mTemplates, mTemplateCount,
                                             mTypeService.GetValueObjectCreator(PortTypes.String, TEMPLATE_PREFIX + " "),
                                             updateTemplate);

            // Initialize token object storage and output per template parameter
            mTokensPerTemplate = new List <List <TokenBase> >();
            mOutputs           = new List <IValueObject>();
            updateTemplateCount();
            mTemplateCount.ValueSet += updateTemplateCount;

            // Initialize the input counts
            mBinInputCount = mTypeService.CreateInt(PortTypes.Integer, INPUT_BIN_PREFIX + "Count", 0);
            mIntInputCount = mTypeService.CreateInt(PortTypes.Integer, INPUT_INT_PREFIX + "Count", 0);
            mNumInputCount = mTypeService.CreateInt(PortTypes.Integer, INPUT_NUM_PREFIX + "Count", 0);
            mStrInputCount = mTypeService.CreateInt(PortTypes.Integer, INPUT_STR_PREFIX + "Count", 0);

            // Initialize inputs using helper functions that grow/shrink the list of
            // inputs whenever the input count is changed
            mBinInputs = new List <BoolValueObject>();
            ListHelpers.ConnectListToCounter(mBinInputs, mBinInputCount,
                                             mTypeService.GetValueObjectCreator(PortTypes.Bool, INPUT_BIN_PREFIX),
                                             updateOutputValues);
            mIntInputs = new List <IntValueObject>();
            ListHelpers.ConnectListToCounter(mIntInputs, mIntInputCount,
                                             mTypeService.GetValueObjectCreator(PortTypes.Integer, INPUT_INT_PREFIX),
                                             updateOutputValues);
            mNumInputs = new List <DoubleValueObject>();
            ListHelpers.ConnectListToCounter(mNumInputs, mNumInputCount,
                                             mTypeService.GetValueObjectCreator(PortTypes.Number, INPUT_NUM_PREFIX),
                                             updateOutputValues);
            mStrInputs = new List <StringValueObject>();
            ListHelpers.ConnectListToCounter(mStrInputs, mStrInputCount,
                                             mTypeService.GetValueObjectCreator(PortTypes.String, INPUT_STR_PREFIX),
                                             updateOutputValues);
        }
Esempio n. 16
0
        public Write(INodeContext context) : base(context)
        {
            context.ThrowIfNull("context");
            ITypeService typeService = context.GetService <ITypeService>();

            this.InfluxDbHost               = typeService.CreateString(PortTypes.String, "Influx DB host");
            this.InfluxDbPort               = typeService.CreateInt(PortTypes.Integer, "Influx DB Port", 8086);
            this.InfluxDbName               = typeService.CreateString(PortTypes.String, "Influx DB name");
            this.InfluxMeasureName          = typeService.CreateString(PortTypes.String, "Measure name");
            this.InfluxDbMeasureTags        = typeService.CreateString(PortTypes.String, "Measure tags");
            this.InfluxDbMeasureFieldName1  = typeService.CreateString(PortTypes.String, "Measure field name 1");
            this.InfluxDbMeasureFieldValue1 = typeService.CreateDouble(PortTypes.Float, "Measure value 1");
            this.InfluxDbMeasureFieldName2  = typeService.CreateString(PortTypes.String, "Measure field name 2");
            this.InfluxDbMeasureFieldValue2 = typeService.CreateDouble(PortTypes.Float, "Measure value 2");
            this.ErrorCode    = typeService.CreateInt(PortTypes.Integer, "HTTP status-code");
            this.ErrorMessage = typeService.CreateString(PortTypes.String, "SMTP Benutzer");
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="HumidityConverterNode"/> class.
        /// </summary>
        /// <param name="context">The node context.</param>
        public HumidityConverterNode(INodeContext context)
            : base(context)
        {
            context.ThrowIfNull("context");
            // Get the TypeService from the context
            var typeService = context.GetService <ITypeService>();

            this.Temperature          = typeService.CreateDouble(PortTypes.Temperature, "Temperatur (°C)");
            this.Temperature.MinValue = -50;
            this.Temperature.MaxValue = 50;

            this.RelativeHumidity          = typeService.CreateDouble(PortTypes.Float, "Relative Luftfeuchtigkeit (%)");
            this.RelativeHumidity.MinValue = 0;
            this.RelativeHumidity.MaxValue = 100;

            this.AbsoluteHumidity = typeService.CreateDouble(PortTypes.Float, "Absolute Luftfeuchtigkeit (g/m3)");
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="BasicNode"/> class.
        /// </summary>
        /// <param name="context">The node context.</param>
        public OutputSelector(INodeContext context)
            : base(context, OUTPUT_PREFIX)
        {
            context.ThrowIfNull("context");
            mTypeService = context.GetService <ITypeService>();

            // Initialize the input.
            mInput           = mTypeService.CreateAny(PortTypes.Any, "Input");
            mInput.ValueSet += updateOutputValues;

            // Initialize the output count.
            mOutputCount          = mTypeService.CreateInt(PortTypes.Integer, "OutputCount", 2);
            mOutputCount.MinValue = 1; // for use as Lock-out+ (Sperre+)
            mOutputCount.MaxValue = 50;

            // Initialize the input for the index of the output to select.
            mSelectIndexInput           = mTypeService.CreateInt(PortTypes.Integer, "OutputSelectIndex");
            mSelectIndexInput.MinValue  = -1;                    //  -1 selects no output
            mSelectIndexInput.MaxValue  = mOutputCount.MaxValue; // max selects no output
            mSelectIndexInput.ValueSet += updateOutputValues;

            // Initialize the selector for "send-on-select".
            mSelectAction = mTypeService.CreateEnum("ESelectAction3",
                                                    "SelectAction3", mSelectActionValues, "ResendCurrent");

            // Initialize outputs using a helper function that grows/shrinks the list of outputs
            // whenever the output count is changed
            mOutputs = new List <AnyValueObject>();
            ListHelpers.ConnectListToCounter(mOutputs, mOutputCount,
                                             mTypeService.GetValueObjectCreator(PortTypes.Any, OUTPUT_PREFIX), null);

            // Initialize outputs using a helper function that grows/shrinks the
            // list of outputs whenever the output count is changed
            mPrevOutputs = new List <AnyValueObject>();
            ListHelpers.ConnectListToCounter(mPrevOutputs, mOutputCount,
                                             mTypeService.GetValueObjectCreator(PortTypes.Any, ""), null, null);

            // Initialize the value to send upon "de-select".
            mIdleValueType = mTypeService.CreateEnum("EValueType",
                                                     "IdleValueType", mValueTypes, "none");
            updateIdleValueType();
            mIdleValueType.ValueSet += updateIdleValueType;
        }
Esempio n. 19
0
        public ModbusClientNode(INodeContext context)
        {
            context.ThrowIfNull("context");
            ITypeService typeService = context.GetService <ITypeService>();

            this.ModbusHost = typeService.CreateString(PortTypes.String, "Modbus TCP Server");
            this.ModbusPort = typeService.CreateInt(PortTypes.Integer, "Port", 502);

            this.ModbusAddress          = typeService.CreateInt(PortTypes.Integer, "Modbus Addresse");
            this.ModbusAddress.MinValue = 0;
            this.ModbusAddress.MaxValue = 65535;

            this.ReadCount          = typeService.CreateInt(PortTypes.Integer, "Anzahl bytes");
            this.ReadCount.MinValue = 1;
            this.ReadCount.MaxValue = 2;

            this.OutputValue  = typeService.CreateDouble(PortTypes.Float, "Wert");
            this.ErrorMessage = typeService.CreateString(PortTypes.String, "Error");

            SchedulerService = context.GetService <ISchedulerService>();
        }
Esempio n. 20
0
        public NotificationNode(INodeContext context)
            : base(context)
        {
            context.ThrowIfNull("context");

            this.SetupIgnoreSSLTrust();

            var typeService = context.GetService<ITypeService>();

            this.Trigger = typeService.CreateBool(PortTypes.Binary, "Trigger");
            this.Token = typeService.CreateString(PortTypes.String, "Token");
            this.UserKey = typeService.CreateString(PortTypes.String, "UserKey");
            this.Message = typeService.CreateString(PortTypes.String, "Message");

            this.Variables = new List<StringValueObject>();

            this.VariableCount = typeService.CreateInt(PortTypes.Integer, "VariableCount", 0);
            this.VariableCount.MinValue = 0;
            this.VariableCount.MaxValue = 99;

            ListHelpers.ConnectListToCounter(this.Variables, this.VariableCount, typeService.GetValueObjectCreator(PortTypes.String, "Variable"), null, null);
        }
Esempio n. 21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BasicNode"/> class.
        /// </summary>
        /// <param name="context">The node context.</param>
        public Statistics(INodeContext context)
            : base(context, INPUT_PREFIX)
        {
            context.ThrowIfNull("context");
            mTypeService = context.GetService <ITypeService>();

            // Initialize the input count.
            mInputCount          = mTypeService.CreateInt(PortTypes.Integer, "InputCount", 2);
            mInputCount.MinValue = 2;
            mInputCount.MaxValue = 50;

            // Initialize inputs using a helper function that grows/shrinks the list of inputs
            // whenever the input count is changed
            mInputs = new List <DoubleValueObject>();
            ListHelpers.ConnectListToCounter(mInputs, mInputCount,
                                             mTypeService.GetValueObjectCreator(PortTypes.Number, INPUT_PREFIX),
                                             updateOutputValues);

            // Initialize the selector for the aggregate function that shall be calculated.
            mSelectedFunction = mTypeService.CreateEnum("ESelectedFunction",
                                                        "SelectedFunction", mPriAllowedValues, /* defaultValue = */ "Avg");

            // Initialize the primary output
            mOutput1 = mTypeService.CreateDouble(PortTypes.Number, "Output1");

            // Initialize the selector for the secondary function (none by default) that shall
            // be calculated.
            string[] secAllowedValues = mAddAllowedValues.Concat(mPriAllowedValues).ToArray();
            mSecondaryFunction = mTypeService.CreateEnum("ESecondaryFunction",
                                                         "SecondaryFunction", secAllowedValues, /* defaultValue = */ "none");

            // Update output properties now, and whenever the function selections change
            updatePrimaryOutputProperties();
            updateSecondaryOutputProperties();
            mSelectedFunction.ValueSet  += updatePrimaryOutputProperties;
            mSecondaryFunction.ValueSet += updateSecondaryOutputProperties;
        }
Esempio n. 22
0
        public ModbusClientNode(INodeContext context)
        {
            context.ThrowIfNull("context");
            ITypeService typeService = context.GetService <ITypeService>();

            this.TimeSpan   = typeService.CreateInt(PortTypes.Integer, "Restart (Sek.)", 60);
            this.ModbusHost = typeService.CreateString(PortTypes.String, "Modbus TCP Server");
            this.ModbusPort = typeService.CreateInt(PortTypes.Integer, "Port", 502);
            this.ModbusID   = typeService.CreateInt(PortTypes.Integer, "Modbus ID", 3);

            // --------------------------------------------------------------------------------------- //
            this.ModbusAddress1          = typeService.CreateInt(PortTypes.Integer, "Modbus Addresse", 0);
            this.ModbusAddress1.MinValue = 0;
            this.ModbusAddress1.MaxValue = 65535;
            this.ReadCount1          = typeService.CreateInt(PortTypes.Integer, "Anzahl words", 2);
            this.ReadCount1.MinValue = 1;
            this.ReadCount1.MaxValue = 2;

            this.OutputValue1 = typeService.CreateDouble(PortTypes.Number, "Register Wert");

            this.ErrorMessage = typeService.CreateString(PortTypes.String, "RAW / Error");

            SchedulerService = context.GetService <ISchedulerService>();
        }