Exemple #1
0
        private void CreateLight(INodeTemplateFactory factory, Guid gwInterface)
        {
            factory.CreateInterfaceType(LightInterfaceGuid, "IKEA.TRADFRI.LIGHT.NAME", "IKEA.TRADFRI.LIGHT.DESCRIPTION", 0, 0, false);

            factory.CreateNodeTemplate(LightContainerGuid, "IKEA.TRADFRI.LIGHT.NAME",
                                       "IKEA.TRADFRI.LIGHT.DESCRIPTION", "container", gwInterface, LightInterfaceGuid, false, false, true,
                                       false, true, NodeDataType.NoAttribute, 0, false);

            factory.CreatePropertyTemplate(new Guid("ae3582db-310e-4a10-9af9-27ef561e475a"), "IKEA.TRADFRI.DEVICE.ID.NAME", "IKEA.TRADFRI.DEVICE.ID.DESCRIPTION",
                                           DeviceIdPropertyKey, PropertyTemplateType.Numeric, LightContainerGuid, "COMMON.CATEGORY.ADDRESS", true, false, null, null, 0,
                                           0);

            factory.CreateNodeTemplate(LightGuid, "IKEA.TRADFRI.LIGHT.SWITCH.NAME", "IKEA.TRADFRI.LIGHT.SWITCH.DESCRIPTION",
                                       "ikea-light-switch", LightInterfaceGuid, GuidTemplateTypeAttribute.GetFromEnum(InterfaceTypeEnum.Value), true, true,
                                       false, true, false, NodeDataType.Boolean, 1, false);
            factory.ChangeDefaultVisuTemplate(LightGuid, VisuMobileObjectTemplateTypes.ToggleButton);

            factory.CreateNodeTemplate(LightDimmerGuid, "IKEA.TRADFRI.LIGHT.DIMMER.NAME", "IKEA.TRADFRI.LIGHT.DIMMER.DESCRIPTION",
                                       "ikea-light-dimmer", LightInterfaceGuid, GuidTemplateTypeAttribute.GetFromEnum(InterfaceTypeEnum.Value), true, true,
                                       false, true, false, NodeDataType.Integer, 1, false);

            factory.CreateNodeTemplate(LightColorGuid, "IKEA.TRADFRI.LIGHT.COLOR.NAME", "IKEA.TRADFRI.LIGHT.COLOR.DESCRIPTION",
                                       "ikea-light-dimmer", LightInterfaceGuid, GuidTemplateTypeAttribute.GetFromEnum(InterfaceTypeEnum.Value), true, true,
                                       false, true, false, NodeDataType.String, 1, false);
        }
Exemple #2
0
        private void CreateDimmer(INodeTemplateFactory factory)
        {
            var dimmer = new Guid("fd70966f-d53b-4d7d-a625-1b0113364eef");

            factory.CreateInterfaceType(dimmer, "LOXONE.MINISERVER.DIMMER.NAME", "LOXONE.MINISERVER.DIMMER.DESCRIPTION", 1, int.MaxValue, false);
            factory.CreateNodeTemplate(DimmerNode, "LOXONE.MINISERVER.DIMMER.NAME", "LOXONE.MINISERVER.DIMMER.DESCRIPTION", "loxone-dimmer", FolderNodeInterface, GuidTemplateTypeAttribute.GetFromEnum(InterfaceTypeEnum.Value), false, true, true, true, false, NodeDataType.Integer, int.MaxValue, false);
            factory.ChangeDefaultVisuTemplate(DimmerNode, VisuMobileObjectTemplateTypes.Slider);

            CreateUuidProperty(factory, DimmerNode);
        }
Exemple #3
0
        private void CreatePushButton(INodeTemplateFactory factory)
        {
            var pushButton = new Guid("ceae14b6-3574-4df9-9d92-f557912922dc");

            factory.CreateInterfaceType(pushButton, "LOXONE.MINISERVER.PUSH_BUTTON.NAME", "LOXONE.MINISERVER.PUSH_BUTTON.DESCRIPTION", 1, int.MaxValue, false);
            factory.CreateNodeTemplate(PushButtonNode, "LOXONE.MINISERVER.PUSH_BUTTON.NAME", "LOXONE.MINISERVER.PUSH_BUTTON.DESCRIPTION", "loxone-push-button", FolderNodeInterface, GuidTemplateTypeAttribute.GetFromEnum(InterfaceTypeEnum.Value), false, true, true, true, false, NodeDataType.Integer, int.MaxValue, false);
            factory.ChangeDefaultVisuTemplate(PushButtonNode, VisuMobileObjectTemplateTypes.ToggleButton);

            CreateUuidProperty(factory, PushButtonNode);
        }
Exemple #4
0
        private void CreateSwitch(INodeTemplateFactory factory)
        {
            var switchGuid = new Guid("7a99a720-e031-4a76-b7ef-d734cf7e46a3");

            factory.CreateInterfaceType(switchGuid, "LOXONE.MINISERVER.SWITCH.NAME", "LOXONE.MINISERVER.SWITCH.DESCRIPTION", 1, int.MaxValue, false);
            factory.CreateNodeTemplate(SwitchNodeGuid, "LOXONE.MINISERVER.SWITCH.NAME", "LOXONE.MINISERVER.SWITCH.DESCRIPTION", "loxone-switch", FolderNodeInterface, GuidTemplateTypeAttribute.GetFromEnum(InterfaceTypeEnum.Value), false, true, true, true, false, NodeDataType.Boolean, int.MaxValue, false);
            factory.ChangeDefaultVisuTemplate(SwitchNodeGuid, VisuMobileObjectTemplateTypes.ToggleButton);

            CreateUuidProperty(factory, SwitchNodeGuid);
        }
Exemple #5
0
        public override void InitNodeTemplates(INodeTemplateFactory factory)
        {
            factory.CreateInterfaceType(InterfaceId, "MACHINE_FLAGS.NAME", "MACHINE_FLAGS.DESCRIPTION", int.MaxValue, 1, true);

            factory.CreateNodeTemplate(BusId, "MACHINE_FLAGS.NAME", "MACHINE_FLAGS.DESCRIPTION", "machine-flags", GuidTemplateTypeAttribute.GetFromEnum(InterfaceTypeEnum.Virtual),
                                       InterfaceId, false, true, true, false, true, NodeDataType.NoAttribute, Int32.MaxValue, false);

            factory.CreateNodeTemplate(ValueId, "MACHINE_FLAGS.NODE.NAME", "MACHINE_FLAGS.NODE.DESCRIPTION", "machine-flag", InterfaceId,
                                       GuidTemplateTypeAttribute.GetFromEnum(InterfaceTypeEnum.Value), false, true, false, true, false, NodeDataType.Double, Int32.MaxValue, false);
            factory.ChangeDefaultVisuTemplate(ValueId, VisuMobileObjectTemplateTypes.NumberBox);
        }
Exemple #6
0
        private void AddDpt1Nodes(INodeTemplateFactory factory, Guid parentNode)
        {
            var dpt1Guid = new Guid("e2fcfcb9-b08b-4597-9ce1-6d604fdbb510");

            factory.CreateNodeTemplate(dpt1Guid, "KNX.DPT1.NAME", "KNX.DPT1.DESCRIPTION", "knx-dpt1",
                                       parentNode, GuidTemplateTypeAttribute.GetFromEnum(InterfaceTypeEnum.Value), false, true, false, true, false,
                                       NodeDataType.Boolean, int.MaxValue, false);

            factory.ChangeDefaultVisuTemplate(dpt1Guid, VisuMobileObjectTemplateTypes.ToggleButton);

            InitDptType((int)DptType.Dpt1, dpt1Guid, factory);
        }
Exemple #7
0
        private void CreateSwitch(INodeTemplateFactory factory, Guid gwInterface)
        {
            factory.CreateInterfaceType(RelayInterfaceGuid, "IKEA.TRADFRI.RELAY.NAME", "IKEA.TRADFRI.RELAY.DESCRIPTION", 0, 0, false);

            factory.CreateNodeTemplate(RelayContainerGuid, "IKEA.TRADFRI.RELAY.NAME",
                                       "IKEA.TRADFRI.RELAY.DESCRIPTION", "container", gwInterface, RelayInterfaceGuid, false, false, true,
                                       false, true, NodeDataType.NoAttribute, 0, false);

            factory.CreatePropertyTemplate(new Guid("7612c5bb-69f5-46ac-a421-ce199dd0a0c3"), "IKEA.TRADFRI.DEVICE.ID.NAME", "IKEA.TRADFRI.DEVICE.ID.DESCRIPTION",
                                           DeviceIdPropertyKey, PropertyTemplateType.Numeric, RelayContainerGuid, "COMMON.CATEGORY.ADDRESS", true, false, null, null, 0,
                                           0);

            factory.CreateNodeTemplate(RelayGuid, "IKEA.TRADFRI.RELAY.VALUE.NAME", "IKEA.TRADFRI.RELAY.VALUE.DESCRIPTION",
                                       "ikea-relay", RelayInterfaceGuid, GuidTemplateTypeAttribute.GetFromEnum(InterfaceTypeEnum.Value), true, true,
                                       false, true, false, NodeDataType.Boolean, 1, false);
            factory.ChangeDefaultVisuTemplate(RelayGuid, VisuMobileObjectTemplateTypes.ToggleButton);
        }
        private void CreatePropertiesForModbusValue(Guid nodeGuid, INodeTemplateFactory factory, bool isByteRegister, int registerLength)
        {
            var propGuid = GenerateNewGuid(nodeGuid, 1);

            factory.CreatePropertyTemplate(propGuid, "MODBUS.PROPERTY.REGISTER", "",
                                           "modbus-register", PropertyTemplateType.Range, nodeGuid, "COMMON.CATEGORY.ADDRESS", true, false,
                                           PropertyHelper.CreateRangeMetaString(0, short.MaxValue - 1), 0, 0, 0);

            var propConstraint = GenerateNewGuid(nodeGuid, 10);

            factory.CreatePropertyConstraint(propConstraint,
                                             "MODBUS.CONSTRAINT.REGISTER_ADDRESS.NAME", "MODBUS.CONSTRAINT.REGISTER_ADDRESS.DESCRIPTION",
                                             PropertyConstraint.UniqueOnCondition, PropertyConstraintLevel.Warn, propGuid);

            var modbusTablePropGuid     = GenerateNewGuid(nodeGuid, 2);
            var modbusRegLengthPropGuid = GenerateNewGuid(nodeGuid, 6);

            factory.CreatePropertyConstraintData(GenerateNewGuid(nodeGuid, 20), 1, -1, propConstraint, "modbus-table",
                                                 PropertyConstraintConditionType.Unique);
            factory.CreatePropertyConstraintData(GenerateNewGuid(nodeGuid, 30), 1, -1, propConstraint, "modbus-register-length",
                                                 PropertyConstraintConditionType.UniqueRange);

            if (isByteRegister)
            {
                factory.CreatePropertyTemplate(modbusTablePropGuid, "MODBUS.PROPERTY.TABLE", "", "modbus-table",
                                               PropertyTemplateType.Enum, nodeGuid, "COMMON.CATEGORY.ADDRESS", true, false,
                                               PropertyHelper.CreateEnumMetaString(typeof(ModBusTable), 0, 1), 0, 0, 0);

                factory.ChangeDefaultVisuTemplate(nodeGuid, VisuMobileObjectTemplateTypes.NumberBox);
                if (registerLength == 2)
                {
                    factory.CreatePropertyTemplate(GenerateNewGuid(nodeGuid, 3), "MODBUS.PROPERTY.BYTEORDER", "", "modbus-byte-order",
                                                   PropertyTemplateType.Enum, nodeGuid, "COMMON.CATEGORY.ADDRESS", true, false,
                                                   PropertyHelper.CreateEnumMetaString(typeof(ModBus4ByteOrder)), 0, 0, 0);
                }
                else if (registerLength == 4)
                {
                    factory.CreatePropertyTemplate(GenerateNewGuid(nodeGuid, 3), "MODBUS.PROPERTY.BYTEORDER", "", "modbus-byte-order",
                                                   PropertyTemplateType.Enum, nodeGuid, "COMMON.CATEGORY.ADDRESS", true, false,
                                                   PropertyHelper.CreateEnumMetaString(typeof(ModBus8ByteOrder)), 0, 0,
                                                   0);
                }

                factory.CreatePropertyTemplate(GenerateNewGuid(nodeGuid, 4), "COMMON.FACTOR.NAME", "COMMON.FACTOR.DESCRIPTION", "factor",
                                               PropertyTemplateType.Numeric, nodeGuid, "COMMON.CATEGORY.TRANSFORM", true, false, "", 1, 2, 1);
                factory.CreatePropertyTemplate(GenerateNewGuid(nodeGuid, 5), "COMMON.OFFSET.NAME", "COMMON.OFFSET.DESCRIPTION", "offset",
                                               PropertyTemplateType.Numeric, nodeGuid, "COMMON.CATEGORY.TRANSFORM", true, false, "", 0, 2, 2);

                factory.CreatePropertyTemplate(modbusRegLengthPropGuid, "MODBUS.REGISTER.LENGTH", "MODBUS.REGISTER.LENGTH", "modbus-register-length",
                                               PropertyTemplateType.Numeric, nodeGuid, "COMMON.CATEGORY.TRANSFORM", false, true, "", registerLength, 2, 2);
            }
            else
            {
                factory.ChangeDefaultVisuTemplate(nodeGuid, VisuMobileObjectTemplateTypes.ToggleButton);
                factory.CreatePropertyTemplate(modbusTablePropGuid, "MODBUS.PROPERTY.TABLE", "", "modbus-table",
                                               PropertyTemplateType.Enum, nodeGuid, "COMMON.CATEGORY.ADDRESS", true, false,
                                               PropertyHelper.CreateEnumMetaString(typeof(ModBusTable), 2, 3), 2, 0, 0);

                factory.CreatePropertyTemplate(modbusRegLengthPropGuid, "MODBUS.REGISTER.LENGTH", "MODBUS.REGISTER.LENGTH", "modbus-register-length",
                                               PropertyTemplateType.Numeric, nodeGuid, "COMMON.CATEGORY.TRANSFORM", false, true, "", 1, 2, 2);
            }
        }