private void OnOccupancySensorChange(GlsOccupancySensorBase device, GlsOccupancySensorChangeEventArgs args) { switch (args.EventId) { case GlsOccupancySensorBase.RoomOccupiedFeedbackEventId: _vacancyTimer.Stop(); if (RoomOccupied != null) { RoomOccupied(); } break; case GlsOccupancySensorBase.RoomVacantFeedbackEventId: _vacancyTimer.Reset(_timeout); break; } }
/// <summary> /// Catches events for feedbacks on the base class. Any extending wrapper class should call this delegate after it checks for it's own event IDs. /// </summary> /// <param name="device"></param> /// <param name="args"></param> protected virtual void OccSensor_GlsOccupancySensorChange(GlsOccupancySensorBase device, GlsOccupancySensorChangeEventArgs args) { if (args.EventId == GlsOccupancySensorBase.PirEnabledFeedbackEventId) { PirSensorEnabledFeedback.FireUpdate(); } else if (args.EventId == GlsOccupancySensorBase.LedFlashEnabledFeedbackEventId) { LedFlashEnabledFeedback.FireUpdate(); } else if (args.EventId == GlsOccupancySensorBase.ShortTimeoutEnabledFeedbackEventId) { ShortTimeoutEnabledFeedback.FireUpdate(); } else if (args.EventId == GlsOccupancySensorBase.PirSensitivityInOccupiedStateFeedbackEventId) { PirSensitivityInOccupiedStateFeedback.FireUpdate(); } else if (args.EventId == GlsOccupancySensorBase.PirSensitivityInVacantStateFeedbackEventId) { PirSensitivityInVacantStateFeedback.FireUpdate(); } }
/// <summary> /// Overrides the base class event delegate to fire feedbacks for event IDs that pertain to this extended class. /// Then calls the base delegate method to ensure any common event IDs are captured. /// </summary> /// <param name="device"></param> /// <param name="args"></param> protected override void OccSensor_GlsOccupancySensorChange(GlsOccupancySensorBase device, GlsOccupancySensorChangeEventArgs args) { if (args.EventId == GlsOccupancySensorBase.AndWhenVacatedFeedbackEventId) { AndWhenVacatedFeedback.FireUpdate(); } else if (args.EventId == GlsOccupancySensorBase.OrWhenVacatedFeedbackEventId) { OrWhenVacatedFeedback.FireUpdate(); } else if (args.EventId == GlsOccupancySensorBase.UsAEnabledFeedbackEventId) { UltrasonicAEnabledFeedback.FireUpdate(); } else if (args.EventId == GlsOccupancySensorBase.UsBEnabledFeedbackEventId) { UltrasonicBEnabledFeedback.FireUpdate(); } else if (args.EventId == GlsOccupancySensorBase.UsSensitivityInOccupiedStateFeedbackEventId) { UltrasonicSensitivityInOccupiedStateFeedback.FireUpdate(); } else if (args.EventId == GlsOccupancySensorBase.UsSensitivityInVacantStateFeedbackEventId) { UltrasonicSensitivityInVacantStateFeedback.FireUpdate(); } base.OccSensor_GlsOccupancySensorChange(device, args); }
/// <summary> /// Catches events for feedbacks on the base class. Any extending wrapper class should call this delegate after it checks for it's own event IDs. /// </summary> /// <param name="device"></param> /// <param name="args"></param> protected virtual void OccSensor_GlsOccupancySensorChange(GlsOccupancySensorBase device, GlsOccupancySensorChangeEventArgs args) { if (args.EventId == GlsOccupancySensorBase.PirEnabledFeedbackEventId) { PirSensorEnabledFeedback.FireUpdate(); } else if (args.EventId == GlsOccupancySensorBase.LedFlashEnabledFeedbackEventId) { LedFlashEnabledFeedback.FireUpdate(); } else if (args.EventId == GlsOccupancySensorBase.ShortTimeoutEnabledFeedbackEventId) { ShortTimeoutEnabledFeedback.FireUpdate(); } else if (args.EventId == GlsOccupancySensorBase.PirSensitivityInOccupiedStateFeedbackEventId) { PirSensitivityInOccupiedStateFeedback.FireUpdate(); } else if (args.EventId == GlsOccupancySensorBase.PirSensitivityInVacantStateFeedbackEventId) { PirSensitivityInVacantStateFeedback.FireUpdate(); } else if (args.EventId == GlsOccupancySensorBase.TimeoutFeedbackEventId) { CurrentTimeoutFeedback.FireUpdate(); } else if (args.EventId == GlsOccupancySensorBase.TimeoutLocalFeedbackEventId) { LocalTimoutFeedback.FireUpdate(); } else if (args.EventId == GlsOccupancySensorBase.GraceOccupancyDetectedFeedbackEventId) { GraceOccupancyDetectedFeedback.FireUpdate(); } else if (args.EventId == GlsOccupancySensorBase.RawOccupancyFeedbackEventId) { RawOccupancyFeedback.FireUpdate(); } else if (args.EventId == GlsOccupancySensorBase.InternalPhotoSensorValueFeedbackEventId) { InternalPhotoSensorValue.FireUpdate(); } else if (args.EventId == GlsOccupancySensorBase.ExternalPhotoSensorValueFeedbackEventId) { ExternalPhotoSensorValue.FireUpdate(); } }