Exemple #1
0
        private BO.Zone getZone(HmdService.Zone z)
        {
            var zone = new BO.Zone(z._Id)
            {
                Name = z._Name,
                Reference = z._Id
            };

            //if (z._ListElement != null && z._ListElement.Length > 0)
            //{
            //    foreach (var zElem in z._ListElement)
            //    {
            //
            //    }
            //}
            return zone;
        }
Exemple #2
0
 private OnOffDevice getOnOffDevice(HmdService.TemplateDevice d, DeviceCategory deviceCategory)
 {
     var useOpenClose = d._DeviceAction.Count(a => a.Nom == "OPEN") > 0;
     return new OnOffDevice(useOpenClose)
     {
         Id = d._ID,
         Name = d._Name,
         NumericValue = this.getValue(d._Value),
         DeviceCategory = deviceCategory
     };
 }
Exemple #3
0
        private RawDevice getRawDevice(HmdService.TemplateDevice d)
        {
            var device = new RawDevice();

            device.Id = d._ID;
            device.Name = d._Name;
            //device.NumericValue = this.getValue(d._Value);
            device.Value = d._Value;
            device.DeviceCategory = DeviceCategory.Other;
            device.DeviceType = DeviceType.Other;
            device.DisplayType = DisplayType.Text;

            if (d._DeviceAction != null && d._DeviceAction.Length > 0)
            {// Search if there is a DIM action, which means the device support DIM
                if (d._DeviceAction.Count(a => (a.Nom == "DIM")) > 0)
                {
                    device.DeviceType = DeviceType.Dim;
                }
                else if (d._DeviceAction.Count(a => (a.Nom == "ON")) > 0 && d._DeviceAction.Count(a => (a.Nom == "OFF")) > 0)
                {
                    device.DeviceType = DeviceType.OnOff;
                }
            }

            if (d._DeviceAction != null && d._DeviceAction.Length > 0)
            {
                foreach (var action in d._DeviceAction)
                {
                    device.Actions.Add(new RawAction(action));
                }
            }

            switch (d._Type)
            {
                //case HmdService.DeviceListeDevices.APPAREIL:
                case HmdService.DeviceListeDevices.FREEBOX:
                //    break;
                case HmdService.DeviceListeDevices.AUDIO:
                    device.DisplayType = DisplayType.Text;
                    device.DeviceCategory = DeviceCategory.Multimedia;
                    break;
                //case HmdService.DeviceListeDevices.BATTERIE:
                //case HmdService.DeviceListeDevices.COMPTEUR:
                case HmdService.DeviceListeDevices.CONTACT:
                    device.DisplayType = DisplayType.Boolean;
                    device.DeviceCategory = DeviceCategory.Contact;
                    break;
                case HmdService.DeviceListeDevices.DETECTEUR:
                    device.DisplayType = DisplayType.Boolean;
                    device.DeviceCategory = DeviceCategory.Dectect;
                    break;
                case HmdService.DeviceListeDevices.ENERGIEINSTANTANEE:
                case HmdService.DeviceListeDevices.ENERGIETOTALE:
                    device.DisplayType = DisplayType.Numeric;
                    device.DeviceCategory = DeviceCategory.Energy;
                    break;
                case HmdService.DeviceListeDevices.GENERIQUEBOOLEEN:
                    device.DisplayType = DisplayType.Boolean;
                    break;
                //case HmdService.DeviceListeDevices.GENERIQUESTRING:
                //    break;
                case HmdService.DeviceListeDevices.GENERIQUEVALUE:
                    device.DisplayType = DisplayType.Numeric;
                    break;
                case HmdService.DeviceListeDevices.HUMIDITE:
                    device.DisplayType = DisplayType.Percentage;
                    device.DeviceCategory = DeviceCategory.Meteo;
                    break;
                //case HmdService.DeviceListeDevices.METEO:
                //case HmdService.DeviceListeDevices.MULTIMEDIA:
                //    break;
                case HmdService.DeviceListeDevices.PLUIECOURANT:
                case HmdService.DeviceListeDevices.PLUIETOTAL:
                    device.DisplayType = DisplayType.Numeric;
                    device.DeviceCategory = DeviceCategory.Meteo;
                    break;
                //case HmdService.DeviceListeDevices.TELECOMMANDE:
                //    break;
                case HmdService.DeviceListeDevices.TEMPERATURE:
                case HmdService.DeviceListeDevices.TEMPERATURECONSIGNE:
                    device.DisplayType = DisplayType.Temperature;
                    device.DeviceCategory = DeviceCategory.Meteo;
                    break;
                case HmdService.DeviceListeDevices.BAROMETRE:
                case HmdService.DeviceListeDevices.UV:
                case HmdService.DeviceListeDevices.VITESSEVENT:
                case HmdService.DeviceListeDevices.DIRECTIONVENT:
                    device.DisplayType = DisplayType.Text;
                    device.DeviceCategory = DeviceCategory.Meteo;
                    break;
                //case HmdService.DeviceListeDevices.VOLET:
                //    device.DisplayType = DisplayType.Boolean;
                //    device.DeviceCategory = DeviceCategory.Other;
                //    break;
            }

            return device;
        }
Exemple #4
0
 private BO.Macro getMacro(HmdService.Macro m)
 {
     return new BO.Macro()
     {
         Name = m._Nom,
         Reference = m._ID
     };
 }
Exemple #5
0
 private NumericDevice getDimDevice(HmdService.TemplateDevice d, DeviceCategory deviceCategory)
 {
     return new NumericDevice()
     {
         Id = d._ID,
         Name = d._Name,
         NumericValue = this.getValue(d._Value),
         DeviceCategory = deviceCategory,
         DeviceType = DeviceType.Dim,
         DisplayType = DisplayType.Percentage
     };
 }
Exemple #6
0
        private List<BO.Device> getDevices(HmdService.TemplateDevice[] list)
        {
            if (list == null)
                return new List<BO.Device>();

            var devices = new List<BO.Device>(list.Length);
            foreach (var d in list)
            {
                var device = this.getDevice(d);
                if (device != null)
                    devices.Add(device);
            }
            return devices;
        }
Exemple #7
0
        private BO.Device getDevice(HmdService.TemplateDevice d)
        {
            if (d == null)
                return null;

            var isDim = false;
            if (d._DeviceAction != null && d._DeviceAction.Length > 0)
            {// Search if an action is a DIM
                isDim = (d._DeviceAction.Count(a => (a.Nom == "DIM")) > 0);
            }

            if (d._DeviceAction.Count(a => !a.Nom.Equals("Read", StringComparison.CurrentCultureIgnoreCase)) > 0)
            { // Not a read-only device
                switch (d._Type)
                {
                    case HmdService.DeviceListeDevices.LAMPE:
                        if (isDim)
                            return this.getDimDevice(d, DeviceCategory.Light);
                        return this.getOnOffDevice(d, DeviceCategory.Light);

                    case HmdService.DeviceListeDevices.SWITCH:
                        if (isDim)
                            return this.getDimDevice(d, DeviceCategory.Switch);
                        return this.getOnOffDevice(d, DeviceCategory.Switch);
                    case HmdService.DeviceListeDevices.APPAREIL:
                    case HmdService.DeviceListeDevices.GENERIQUEBOOLEEN:
                        return this.getOnOffDevice(d, DeviceCategory.Other);
                    case HmdService.DeviceListeDevices.VOLET:
                        return this.getOnOffDevice(d, DeviceCategory.Flap);
                }
            }
            return this.getRawDevice(d);
        }
Exemple #8
0
        private List<BO.DeviceAction> getAction(HmdService.DeviceAction action)
        {
            var list = new List<BO.DeviceAction>(3);
            switch (action.Nom)
            {
                case "ON":
                    list.Add(DeviceAction.Get<OnAction>());
                    break;
                case "OFF":
                    list.Add(DeviceAction.Get<OffAction>());
                    break;

                case "DIM":
                    list.Add(DeviceAction.Get<UpAction>());
                    list.Add(DeviceAction.Get<DownAction>());
                    break;

                case "Read":
                    break;
                default:
                    list.Add(new RawAction(action));
                    break;
            }
            return null;
        }