예제 #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>();
        }
예제 #2
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");
        }
예제 #3
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");
        }
예제 #4
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");
        }
예제 #5
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>();
        }
예제 #6
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");
            this.Subject      = typeService.CreateString(PortTypes.String, "Betreff");
            this.MailBody     = typeService.CreateString(PortTypes.String, "Mailtext");
        }
예제 #7
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>();
        }
예제 #8
0
 /// <summary>
 /// Called when the SecondaryFunction receives a new value, in order to update which
 /// of the outputs exist, and which labels they have.
 /// </summary>
 private void updateIdleValueType(object sender = null,
                                  ValueChangedEventArgs evArgs = null)
 {
     if (mIdleValueType.HasValue)
     {
         if (PortTypes.Bool == mIdleValueType.Value)
         {
             mIdleValue = mTypeService.CreateBool(PortTypes.Bool, "IdleValue");
         }
         else if (PortTypes.Integer == mIdleValueType.Value)
         {
             mIdleValue = mTypeService.CreateInt(PortTypes.Integer, "IdleValue");
         }
         else if (PortTypes.Number == mIdleValueType.Value)
         {
             mIdleValue = mTypeService.CreateDouble(PortTypes.Number, "IdleValue");
         }
         else if (PortTypes.TimeSpan == mIdleValueType.Value)
         {
             mIdleValue = mTypeService.CreateTimeSpan(PortTypes.TimeSpan, "IdleValue");
         }
         else if (PortTypes.Time == mIdleValueType.Value)
         {
             mIdleValue = mTypeService.CreateTimeSpan(PortTypes.Time, "IdleValue");
         }
         else if (PortTypes.Date == mIdleValueType.Value)
         {
             mIdleValue = mTypeService.CreateDateTime(PortTypes.Date, "IdleValue");
         }
         else if (PortTypes.DateTime == mIdleValueType.Value)
         {
             mIdleValue = mTypeService.CreateDateTime(PortTypes.DateTime, "IdleValue");
         }
         else if (PortTypes.String == mIdleValueType.Value)
         {
             mIdleValue = mTypeService.CreateString(PortTypes.String, "IdleValue");
         }
         else
         {
             mIdleValue = null;
         }
     }
     else
     {
         mIdleValue = null;
     }
 }
예제 #9
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");
        }