Ejemplo n.º 1
0
        /// <summary>
        /// Sets the object to be used as the IOccupancyStatusProvider for the room. Can be an Occupancy Aggregator or a specific device
        /// </summary>
        /// <param name="statusProvider"></param>
        public void SetRoomOccupancy(IOccupancyStatusProvider statusProvider, int timeoutMinutes)
        {
            if (statusProvider == null)
            {
                Debug.Console(0, this, "ERROR: Occupancy sensor device is null");
                return;
            }

            Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Room Occupancy set to device: '{0}'", (statusProvider as Device).Key);
            Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Timeout Minutes from Config is: {0}", timeoutMinutes);

            // If status provider is fusion, set flag to remote
            if (statusProvider is Core.Fusion.EssentialsHuddleSpaceFusionSystemControllerBase)
            {
                OccupancyStatusProviderIsRemote = true;
            }

            if (timeoutMinutes > 0)
            {
                RoomVacancyShutdownSeconds = timeoutMinutes * 60;
            }

            Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "RoomVacancyShutdownSeconds set to {0}", RoomVacancyShutdownSeconds);

            RoomOccupancy = statusProvider;

            RoomOccupancy.RoomIsOccupiedFeedback.OutputChange -= RoomIsOccupiedFeedback_OutputChange;
            RoomOccupancy.RoomIsOccupiedFeedback.OutputChange += RoomIsOccupiedFeedback_OutputChange;

            OnRoomOccupancyIsSet();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Adds an IOccupancyStatusProvider device
 /// </summary>
 /// <param name="statusProvider"></param>
 public void AddOccupancyStatusProvider(IOccupancyStatusProvider statusProvider)
 {
     AggregatedOccupancyStatus.AddOutputIn(statusProvider.RoomIsOccupiedFeedback);
 }