Exemple #1
0
        public static bool SetValueSucceed(ZWManager manager, ZWValueId valueId, ZWValueType valueType, object value, string[] possibleValues)
        {
            switch (valueType)
            {
            case ZWValueType.Button:
                return(manager.PressButton(valueId));

            case ZWValueType.Bool:
                return(manager.SetValue(valueId, (bool)value));

            case ZWValueType.Byte:
                return(manager.SetValue(valueId, (byte)value));

            case ZWValueType.Decimal:
                return(manager.SetValue(valueId, (float)value));

            case ZWValueType.Int:
                return(manager.SetValue(valueId, (int)value));

            case ZWValueType.Short:
                return(manager.SetValue(valueId, (short)value));

            case ZWValueType.String:
                return(manager.SetValue(valueId, (string)value));

            case ZWValueType.List:
                return(manager.SetValueListSelection(valueId, (string)value));
            }
            return(false);
        }
Exemple #2
0
        public static object GetValue(ZWManager manager, ZWValueId valueId, ZWValueType valueType, string[] possibleValues)
        {
            switch (valueType)
            {
            case ZWValueType.Button:
            {
                return(string.Empty);
            }

            case ZWValueType.Bool:
            {
                manager.GetValueAsBool(valueId, out bool result);
                return(result);
            }

            case ZWValueType.Byte:
            {
                manager.GetValueAsByte(valueId, out byte result);
                return(result);
            }

            case ZWValueType.Decimal:
            {
                manager.GetValueAsFloat(valueId, out float result);
                return(result);
            }

            case ZWValueType.Int:
            {
                manager.GetValueAsInt(valueId, out int result);
                return(result);
            }

            case ZWValueType.Short:
            {
                manager.GetValueAsShort(valueId, out short result);
                return(result);
            }

            case ZWValueType.String:
            {
                manager.GetValueAsString(valueId, out string result);
                return(result);
            }

            case ZWValueType.List:
            {
                manager.GetValueListSelection(valueId, out string result);
                return(result);
            }
            }
            return(null);
        }
Exemple #3
0
 public extern static value_id_t value_id_create(uint homeId, byte nodeId, ValueGenre genre, byte commandClass, byte instance, byte index, ZWValueType type);
Exemple #4
0
 public ValueId(uint homeId, byte nodeId, ValueGenre genre, byte commandClass, byte instance, byte index, ZWValueType type)
     : this(NativeMethods.value_id_create(homeId, nodeId, genre, commandClass, instance, index, type))
 {
     ownsHandle = true;
 }