Esempio n. 1
0
        public RoomOnToDefaultSourceWhenOccupied(DeviceConfig config) :
            base(config)
        {
            PropertiesConfig = JsonConvert.DeserializeObject <RoomOnToDefaultSourceWhenOccupiedConfig>(config.Properties.ToString());

            FeatureEventGroup = new ScheduledEventGroup(this.Key);

            FeatureEventGroup.RetrieveAllEvents();

            // Add to the global class for tracking
            Scheduler.AddEventGroup(FeatureEventGroup);

            AddPostActivationAction(() =>
            {
                // Subscribe to room event to know when RoomOccupancy is set and ready to be subscribed to
                if (Room != null)
                {
                    Room.RoomOccupancyIsSet += new EventHandler <EventArgs>(RoomOccupancyIsSet);
                }

                else
                {
                    Debug.Console(1, this, "Room has no RoomOccupancy object set");
                }

                var fusionRoomKey = PropertiesConfig.RoomKey + "-fusion";

                FusionRoom = DeviceManager.GetDeviceForKey(fusionRoomKey) as Core.Fusion.EssentialsHuddleSpaceFusionSystemControllerBase;

                if (FusionRoom == null)
                {
                    Debug.Console(1, this, "Unable to get Fusion Room from Device Manager with key: {0}", fusionRoomKey);
                }
            });
        }
Esempio n. 2
0
        protected override void CustomSetConfig(DeviceConfig config)
        {
            var newPropertiesConfig = JsonConvert.DeserializeObject <RoomOnToDefaultSourceWhenOccupiedConfig>(config.Properties.ToString());

            if (newPropertiesConfig != null)
            {
                PropertiesConfig = newPropertiesConfig;
            }

            ConfigWriter.UpdateDeviceConfig(config);

            SetUpDevice();
        }