diff --git a/PepperDashEssentials/Factory/DeviceFactory.cs b/PepperDashEssentials/Factory/DeviceFactory.cs index 432802d0..86612747 100644 --- a/PepperDashEssentials/Factory/DeviceFactory.cs +++ b/PepperDashEssentials/Factory/DeviceFactory.cs @@ -87,9 +87,7 @@ namespace PepperDash.Essentials else if (typeName == "roomonwhenoccupancydetectedfeature") { - var props = JsonConvert.DeserializeObject(properties.ToString()); - - return new Room.Behaviours.RoomOnToDefaultSourceWhenOccupied(key, props); + return new Room.Behaviours.RoomOnToDefaultSourceWhenOccupied(dc); } return null; diff --git a/PepperDashEssentials/Factory/UiDeviceFactory.cs b/PepperDashEssentials/Factory/UiDeviceFactory.cs index a4387d1a..5499aa0c 100644 --- a/PepperDashEssentials/Factory/UiDeviceFactory.cs +++ b/PepperDashEssentials/Factory/UiDeviceFactory.cs @@ -49,12 +49,12 @@ namespace PepperDash.Essentials avDriver.CurrentRoom = room as EssentialsHuddleSpaceRoom; // Environment Driver - if (avDriver.CurrentRoom.Config.Environment != null && avDriver.CurrentRoom.Config.Environment.DeviceKeys.Count > 0) + if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0) { Debug.Console(0, panelController, "Adding environment driver"); mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props); - mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.Config.Environment); + mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment); } mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom); @@ -118,12 +118,12 @@ namespace PepperDash.Essentials avDriver.CurrentRoom = room as EssentialsHuddleVtc1Room; // Environment Driver - if (avDriver.CurrentRoom.Config.Environment != null && avDriver.CurrentRoom.Config.Environment.DeviceKeys.Count > 0) + if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0) { Debug.Console(0, panelController, "Adding environment driver"); mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props); - mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.Config.Environment); + mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment); } mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom); diff --git a/PepperDashEssentials/OTHER/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs b/PepperDashEssentials/OTHER/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs index 609597d8..3becfcfb 100644 --- a/PepperDashEssentials/OTHER/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs +++ b/PepperDashEssentials/OTHER/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs @@ -774,7 +774,7 @@ namespace PepperDash.Essentials.Fusion string roomConfigResponseArgs = args.Sig.StringValue.Replace("&", "and"); - Debug.Console(1, this, "Fusion Response: \n {0}", roomConfigResponseArgs); + Debug.Console(2, this, "Fusion Response: \n {0}", roomConfigResponseArgs); try { diff --git a/PepperDashEssentials/OTHER/Fusion/FusionCustomPropertiesBridge.cs b/PepperDashEssentials/OTHER/Fusion/FusionCustomPropertiesBridge.cs index 6dface95..c651604a 100644 --- a/PepperDashEssentials/OTHER/Fusion/FusionCustomPropertiesBridge.cs +++ b/PepperDashEssentials/OTHER/Fusion/FusionCustomPropertiesBridge.cs @@ -3,10 +3,13 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Core.Devices; using PepperDash.Essentials.Room.Behaviours; namespace PepperDash.Essentials.Fusion @@ -23,75 +26,79 @@ namespace PepperDash.Essentials.Fusion /// public void EvaluateRoomInfo(string roomKey, RoomInformation roomInfo) { - var runtimeConfigurableDevices = DeviceManager.AllDevices.Where(d => d is IRuntimeConfigurableDevice); - try { - foreach (var device in runtimeConfigurableDevices) + var reconfigurableDevices = DeviceManager.AllDevices.Where(d => d is ReconfigurableDevice); + + foreach (var device in reconfigurableDevices) { // Get the current device config so new values can be overwritten over existing - var deviceConfig = (device as IRuntimeConfigurableDevice).GetDeviceConfig(); + var deviceConfig = (device as ReconfigurableDevice).Config; if (device is RoomOnToDefaultSourceWhenOccupied) { - var devConfig = (deviceConfig as RoomOnToDefaultSourceWhenOccupiedConfig); + var devProps = JsonConvert.DeserializeObject(deviceConfig.Properties.ToString()); var enableFeature = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupied")); if (enableFeature != null) - devConfig.EnableRoomOnWhenOccupied = bool.Parse(enableFeature.CustomFieldValue); + devProps.EnableRoomOnWhenOccupied = bool.Parse(enableFeature.CustomFieldValue); var enableTime = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("RoomOnWhenOccupiedStartTime")); if (enableTime != null) - devConfig.OccupancyStartTime = enableTime.CustomFieldValue; + devProps.OccupancyStartTime = enableTime.CustomFieldValue; var disableTime = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("RoomOnWhenOccupiedEndTime")); if (disableTime != null) - devConfig.OccupancyEndTime = disableTime.CustomFieldValue; + devProps.OccupancyEndTime = disableTime.CustomFieldValue; var enableSunday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedSun")); if (enableSunday != null) - devConfig.EnableSunday = bool.Parse(enableSunday.CustomFieldValue); + devProps.EnableSunday = bool.Parse(enableSunday.CustomFieldValue); var enableMonday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedMon")); if (enableMonday != null) - devConfig.EnableMonday = bool.Parse(enableMonday.CustomFieldValue); + devProps.EnableMonday = bool.Parse(enableMonday.CustomFieldValue); var enableTuesday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedTue")); if (enableTuesday != null) - devConfig.EnableTuesday = bool.Parse(enableTuesday.CustomFieldValue); + devProps.EnableTuesday = bool.Parse(enableTuesday.CustomFieldValue); var enableWednesday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedWed")); if (enableWednesday != null) - devConfig.EnableWednesday = bool.Parse(enableWednesday.CustomFieldValue); + devProps.EnableWednesday = bool.Parse(enableWednesday.CustomFieldValue); var enableThursday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedThu")); if (enableThursday != null) - devConfig.EnableThursday = bool.Parse(enableThursday.CustomFieldValue); + devProps.EnableThursday = bool.Parse(enableThursday.CustomFieldValue); var enableFriday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedFri")); if (enableFriday != null) - devConfig.EnableFriday = bool.Parse(enableFriday.CustomFieldValue); + devProps.EnableFriday = bool.Parse(enableFriday.CustomFieldValue); var enableSaturday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedSat")); if (enableSaturday != null) - devConfig.EnableSaturday = bool.Parse(enableSaturday.CustomFieldValue); + devProps.EnableSaturday = bool.Parse(enableSaturday.CustomFieldValue); - deviceConfig = devConfig; + deviceConfig.Properties = JToken.FromObject(devProps); + } + else if (device is EssentialsRoomBase) + { + // Set the room name + deviceConfig.Name = roomInfo.Name; + + // Set the help message + var helpMessage = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("RoomHelpMessage")); + if (helpMessage != null) + { + deviceConfig.Properties["Help"]["Message"].Value(helpMessage.CustomFieldValue); + } } // Set the config on the device - (device as IRuntimeConfigurableDevice).SetDeviceConfig(deviceConfig); + (device as ReconfigurableDevice).SetConfig(deviceConfig); } - //var roomConfig = ConfigReader.ConfigObject.Rooms.FirstOrDefault(r => r.Key.Equals(roomKey); - //if(roomConfig != null) - //{ - // roomConfig.Name = roomInfo.Name; - - // // Update HelpMessage in room properties - // roomConfig.Properties. - //} } catch (Exception e) { diff --git a/PepperDashEssentials/Room/Behaviours/RoomOnToDefaultSourceWhenOccupied.cs b/PepperDashEssentials/Room/Behaviours/RoomOnToDefaultSourceWhenOccupied.cs index 823ed2b7..57e78ead 100644 --- a/PepperDashEssentials/Room/Behaviours/RoomOnToDefaultSourceWhenOccupied.cs +++ b/PepperDashEssentials/Room/Behaviours/RoomOnToDefaultSourceWhenOccupied.cs @@ -11,6 +11,7 @@ using Newtonsoft.Json.Linq; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Core.Devices; using PepperDash.Essentials.Devices.Common.Occupancy; namespace PepperDash.Essentials.Room.Behaviours @@ -18,9 +19,9 @@ namespace PepperDash.Essentials.Room.Behaviours /// /// A device that when linked to a room can power the room on when enabled during scheduled hours. /// - public class RoomOnToDefaultSourceWhenOccupied : Device, IRuntimeConfigurableDevice + public class RoomOnToDefaultSourceWhenOccupied : ReconfigurableDevice { - RoomOnToDefaultSourceWhenOccupiedConfig Config; + RoomOnToDefaultSourceWhenOccupiedConfig PropertiesConfig; public bool FeatureEnabled { get; private set; } @@ -42,10 +43,10 @@ namespace PepperDash.Essentials.Room.Behaviours private Fusion.EssentialsHuddleSpaceFusionSystemControllerBase FusionRoom; - public RoomOnToDefaultSourceWhenOccupied(string key, RoomOnToDefaultSourceWhenOccupiedConfig config) - : base(key) + public RoomOnToDefaultSourceWhenOccupied(DeviceConfig config) : + base (config) { - Config = config; + PropertiesConfig = JsonConvert.DeserializeObject(config.Properties.ToString()); FeatureEventGroup = new ScheduledEventGroup(this.Key); @@ -63,7 +64,7 @@ namespace PepperDash.Essentials.Room.Behaviours else Debug.Console(1, this, "Room has no RoomOccupancy object set"); - var fusionRoomKey = Config.RoomKey + "-fusion"; + var fusionRoomKey = PropertiesConfig.RoomKey + "-fusion"; FusionRoom = DeviceManager.GetDeviceForKey(fusionRoomKey) as Fusion.EssentialsHuddleSpaceFusionSystemControllerBase; @@ -79,45 +80,48 @@ namespace PepperDash.Essentials.Room.Behaviours return base.CustomActivate(); } + /// + /// Sets up device based on config values + /// void SetUpDevice() { - Room = DeviceManager.GetDeviceForKey(Config.RoomKey) as EssentialsRoomBase; + Room = DeviceManager.GetDeviceForKey(PropertiesConfig.RoomKey) as EssentialsRoomBase; if (Room != null) { try { - FeatureEnabledTime = DateTime.Parse(Config.OccupancyStartTime); + FeatureEnabledTime = DateTime.Parse(PropertiesConfig.OccupancyStartTime); if (FeatureEnabledTime != null) { Debug.Console(1, this, "Enabled Time: {0}", FeatureEnabledTime.ToString()); } else - Debug.Console(1, this, "Unable to parse {0} to DateTime", Config.OccupancyStartTime); + Debug.Console(1, this, "Unable to parse {0} to DateTime", PropertiesConfig.OccupancyStartTime); } catch (Exception e) { - Debug.Console(1, this, "Unable to parse OccupancyStartTime property: {0} \n Error: {1}", Config.OccupancyStartTime, e); + Debug.Console(1, this, "Unable to parse OccupancyStartTime property: {0} \n Error: {1}", PropertiesConfig.OccupancyStartTime, e); } try { - FeatureDisabledTime = DateTime.Parse(Config.OccupancyEndTime); + FeatureDisabledTime = DateTime.Parse(PropertiesConfig.OccupancyEndTime); if (FeatureDisabledTime != null) { Debug.Console(1, this, "Disabled Time: {0}", FeatureDisabledTime.ToString()); } else - Debug.Console(1, this, "Unable to parse {0} to DateTime", Config.OccupancyEndTime); + Debug.Console(1, this, "Unable to parse {0} to DateTime", PropertiesConfig.OccupancyEndTime); } catch (Exception e) { Debug.Console(1, this, "Unable to parse a DateTime config value \n Error: {1}", e); } - if (!Config.EnableRoomOnWhenOccupied) + if (!PropertiesConfig.EnableRoomOnWhenOccupied) FeatureEventGroup.ClearAllEvents(); else { @@ -133,30 +137,18 @@ namespace PepperDash.Essentials.Room.Behaviours FeatureEnabled = CheckIfFeatureShouldBeEnabled(); } else - Debug.Console(1, this, "Unable to get room from Device Manager with key: {0}", Config.RoomKey); + Debug.Console(1, this, "Unable to get room from Device Manager with key: {0}", PropertiesConfig.RoomKey); } - /// - /// Returns a JObject of the device config properties as they currently exist at runtime - /// - /// - public JToken GetLocalConfigProperties() + + protected override void CustomSetConfig(DeviceConfig config) { - return JToken.FromObject(Config); - } + var newPropertiesConfig = JsonConvert.DeserializeObject(config.Properties.ToString()); - public object GetDeviceConfig() - { - return Config; - } + if(newPropertiesConfig != null) + PropertiesConfig = newPropertiesConfig; - public void SetDeviceConfig(object config) - { - var newConfig = config as RoomOnToDefaultSourceWhenOccupiedConfig; - - Config = newConfig; - - ConfigWriter.UpdateDeviceProperties(this.Key, GetLocalConfigProperties()); + ConfigWriter.UpdateDeviceConfig(config); SetUpDevice(); } @@ -182,7 +174,7 @@ namespace PepperDash.Essentials.Room.Behaviours { if (SchEvent.Name == FeatureEnableEventName) { - if (Config.EnableRoomOnWhenOccupied) + if (PropertiesConfig.EnableRoomOnWhenOccupied) FeatureEnabled = true; Debug.Console(1, this, "*****Feature Enabled by event.*****"); @@ -204,7 +196,7 @@ namespace PepperDash.Essentials.Room.Behaviours { bool enabled = false; - if(Config.EnableRoomOnWhenOccupied) + if(PropertiesConfig.EnableRoomOnWhenOccupied) { Debug.Console(1, this, "Current Time: {0} \n FeatureEnabledTime: {1} \n FeatureDisabledTime: {2}", DateTime.Now, FeatureEnabledTime, FeatureDisabledTime); @@ -446,19 +438,19 @@ namespace PepperDash.Essentials.Room.Behaviours { ScheduledEventCommon.eWeekDays value = new ScheduledEventCommon.eWeekDays(); - if (Config.EnableSunday) + if (PropertiesConfig.EnableSunday) value = value | ScheduledEventCommon.eWeekDays.Sunday; - if (Config.EnableMonday) + if (PropertiesConfig.EnableMonday) value = value | ScheduledEventCommon.eWeekDays.Monday; - if (Config.EnableTuesday) + if (PropertiesConfig.EnableTuesday) value = value | ScheduledEventCommon.eWeekDays.Tuesday; - if (Config.EnableWednesday) + if (PropertiesConfig.EnableWednesday) value = value | ScheduledEventCommon.eWeekDays.Wednesday; - if (Config.EnableThursday) + if (PropertiesConfig.EnableThursday) value = value | ScheduledEventCommon.eWeekDays.Thursday; - if (Config.EnableFriday) + if (PropertiesConfig.EnableFriday) value = value | ScheduledEventCommon.eWeekDays.Friday; - if (Config.EnableSaturday) + if (PropertiesConfig.EnableSaturday) value = value | ScheduledEventCommon.eWeekDays.Saturday; return value; @@ -473,7 +465,7 @@ namespace PepperDash.Essentials.Room.Behaviours { if (type == ScheduledEventCommon.eCallbackReason.NormalExpiration) { - if(Config.EnableRoomOnWhenOccupied) + if(PropertiesConfig.EnableRoomOnWhenOccupied) FeatureEnabled = true; Debug.Console(1, this, "RoomOnToDefaultSourceWhenOccupied Feature Enabled."); diff --git a/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs b/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs index a1a821d4..ab1349f5 100644 --- a/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs +++ b/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs @@ -66,7 +66,7 @@ namespace PepperDash.Essentials } } - public EssentialsRoomPropertiesConfig Config { get; private set; } + public EssentialsRoomPropertiesConfig PropertiesConfig { get; private set; } public IRoutingSinkWithSwitching DefaultDisplay { get; private set; } public IRoutingSinkNoSwitching DefaultAudioDevice { get; private set; } @@ -156,7 +156,7 @@ namespace PepperDash.Essentials IRoutingSinkNoSwitching defaultAudio, EssentialsRoomPropertiesConfig config) : base(key, name) { - Config = config; + PropertiesConfig = config; DefaultDisplay = defaultDisplay; DefaultAudioDevice = defaultAudio; if (defaultAudio is IBasicVolumeControls) diff --git a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs index 12a54592..f30519d6 100644 --- a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs +++ b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs @@ -1,575 +1,575 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -using PepperDash.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +using PepperDash.Core; using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Room.Config; -using PepperDash.Essentials.Devices.Common.Codec; -using PepperDash.Essentials.Devices.Common.VideoCodec; - -namespace PepperDash.Essentials -{ - public class EssentialsHuddleVtc1Room : EssentialsRoomBase, IHasCurrentSourceInfoChange, - IPrivacy, IHasCurrentVolumeControls, IRunRouteAction, IRunDefaultCallRoute, IHasVideoCodec - { - public event EventHandler CurrentVolumeDeviceChange; - public event SourceInfoChangeHandler CurrentSingleSourceChange; - - - //************************ - // Call-related stuff - - public BoolFeedback InCallFeedback { get; private set; } - - /// - /// Make this more specific - /// - public List ActiveCalls { get; private set; } - - /// - /// States: 0 for on hook, 1 for video, 2 for audio, 3 for telekenesis - /// - public IntFeedback CallTypeFeedback { get; private set; } - - /// - /// - /// - public BoolFeedback PrivacyModeIsOnFeedback { get; private set; } - - /// - /// When something in the room is sharing with the far end or through other means - /// - public BoolFeedback IsSharingFeedback { get; private set; } - - //************************ - - - protected override Func OnFeedbackFunc - { - get - { - return () => - { - var disp = DefaultDisplay as DisplayBase; - var val = CurrentSourceInfo != null - && CurrentSourceInfo.Type == eSourceListItemType.Route - && disp != null; - //&& disp.PowerIsOnFeedback.BoolValue; - return val; - }; - } - } - /// - /// - /// - protected override Func IsWarmingFeedbackFunc - { - get - { - return () => - { - var disp = DefaultDisplay as DisplayBase; - if (disp != null) - return disp.IsWarmingUpFeedback.BoolValue; - else - return false; - }; - } - } - /// - /// - /// - protected override Func IsCoolingFeedbackFunc - { - get - { - return () => - { - var disp = DefaultDisplay as DisplayBase; - if (disp != null) - return disp.IsCoolingDownFeedback.BoolValue; - else - return false; - }; - } - } - - public EssentialsHuddleVtc1PropertiesConfig Config { get; private set; } - - public IRoutingSinkWithSwitching DefaultDisplay { get; private set; } - public IBasicVolumeControls DefaultAudioDevice { get; private set; } - public IBasicVolumeControls DefaultVolumeControls { get; private set; } - - public VideoCodecBase VideoCodec { get; private set; } - - public bool ExcludeFromGlobalFunctions { get; set; } - - /// - /// The config name of the source list - /// - public string SourceListKey { get; set; } - - public string DefaultSourceItem { get; set; } - - public ushort DefaultVolume { get; set; } - - /// - /// If room is off, enables power on to last source. Default true - /// - public bool EnablePowerOnToLastSource { get; set; } - string LastSourceKey; - - /// - /// Sets the volume control device, and attaches/removes InUseTrackers with "audio" - /// tag to device. - /// - public IBasicVolumeControls CurrentVolumeControls - { - get { return _CurrentAudioDevice; } - set - { - if (value == _CurrentAudioDevice) return; - - var oldDev = _CurrentAudioDevice; - // derigister this room from the device, if it can - if (oldDev is IInUseTracking) - (oldDev as IInUseTracking).InUseTracker.RemoveUser(this, "audio"); - var handler = CurrentVolumeDeviceChange; - if (handler != null) - CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.WillChange)); - _CurrentAudioDevice = value; - if (handler != null) - CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.DidChange)); - // register this room with new device, if it can - if (_CurrentAudioDevice is IInUseTracking) - (_CurrentAudioDevice as IInUseTracking).InUseTracker.AddUser(this, "audio"); - } - } - IBasicVolumeControls _CurrentAudioDevice; - - /// - /// The SourceListItem last run - containing names and icons - /// - public SourceListItem CurrentSourceInfo - { - get { return _CurrentSourceInfo; } - private set - { - if (value == _CurrentSourceInfo) return; - - var handler = CurrentSingleSourceChange; - // remove from in-use tracker, if so equipped - if(_CurrentSourceInfo != null && _CurrentSourceInfo.SourceDevice is IInUseTracking) - (_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.RemoveUser(this, "control"); - - if (handler != null) - handler(this, _CurrentSourceInfo, ChangeType.WillChange); - - _CurrentSourceInfo = value; - - // add to in-use tracking - if (_CurrentSourceInfo != null && _CurrentSourceInfo.SourceDevice is IInUseTracking) - (_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.AddUser(this, "control"); - if (handler != null) - handler(this, _CurrentSourceInfo, ChangeType.DidChange); - } - } - SourceListItem _CurrentSourceInfo; - - public string CurrentSourceInfoKey { get; private set; } - - /// - /// "codecOsd" - /// - public string DefaultCodecRouteString { get { return "codecOsd"; } } - - /// - /// Temporary implementation. Returns the schedule-ready object or null if none. Fow now, - /// always returns the VideoCodec if it is capable - /// - public IHasScheduleAwareness ScheduleSource { get { return VideoCodec as IHasScheduleAwareness; } } - - CCriticalSection SourceSelectLock = new CCriticalSection(); - - /// - /// - /// - /// - /// - public EssentialsHuddleVtc1Room(string key, string name, IRoutingSinkWithSwitching defaultDisplay, - IBasicVolumeControls defaultAudio, VideoCodecBase codec, EssentialsHuddleVtc1PropertiesConfig config) - : base(key, name) - { - if (codec == null) - throw new ArgumentNullException("codec cannot be null"); - Config = config; - DefaultDisplay = defaultDisplay; - VideoCodec = codec; - DefaultAudioDevice = defaultAudio; - - if (defaultAudio is IBasicVolumeControls) - DefaultVolumeControls = defaultAudio as IBasicVolumeControls; - else if (defaultAudio is IHasVolumeDevice) - DefaultVolumeControls = (defaultAudio as IHasVolumeDevice).VolumeDevice; - CurrentVolumeControls = DefaultVolumeControls; - - - var disp = DefaultDisplay as DisplayBase; - if (disp != null) - { - // Link power, warming, cooling to display - disp.PowerIsOnFeedback.OutputChange += (o, a) => - { - if (disp.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue) - { - if (!disp.PowerIsOnFeedback.BoolValue) - CurrentSourceInfo = null; - OnFeedback.FireUpdate(); - } - if (disp.PowerIsOnFeedback.BoolValue) - { - SetDefaultLevels(); - } - }; - - disp.IsWarmingUpFeedback.OutputChange += (o, a) => - { - IsWarmingUpFeedback.FireUpdate(); - if (!IsWarmingUpFeedback.BoolValue) - (CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(DefaultVolume); - }; - disp.IsCoolingDownFeedback.OutputChange += (o, a) => - { - IsCoolingDownFeedback.FireUpdate(); - }; - } - - InCallFeedback = new BoolFeedback(() => VideoCodec.IsInCall); - VideoCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate(); - - IsSharingFeedback = new BoolFeedback(() => VideoCodec.SharingContentIsOnFeedback.BoolValue); - VideoCodec.SharingContentIsOnFeedback.OutputChange += (o, a) => this.IsSharingFeedback.FireUpdate(); - - // link privacy to VC (for now?) - PrivacyModeIsOnFeedback = new BoolFeedback(() => VideoCodec.PrivacyModeIsOnFeedback.BoolValue); - VideoCodec.PrivacyModeIsOnFeedback.OutputChange += (o, a) => this.PrivacyModeIsOnFeedback.FireUpdate(); - - CallTypeFeedback = new IntFeedback(() => 0); - - SourceListKey = "default"; - EnablePowerOnToLastSource = true; - } - - - /// - /// - /// - protected override void EndShutdown() - { - VideoCodec.EndAllCalls(); - - SetDefaultLevels(); - - RunDefaultPresentRoute(); - - CrestronEnvironment.Sleep(1000); - - RunRouteAction("roomOff"); - } - - /// - /// Routes the default source item, if any. Returns true when default route exists - /// - public override bool RunDefaultPresentRoute() - { - if (DefaultSourceItem != null) - RunRouteAction(DefaultSourceItem); - - return DefaultSourceItem != null; - } - - /// - /// Sets up the room when started into call mode without presenting a source - /// - /// - public bool RunDefaultCallRoute() - { - RunRouteAction(DefaultCodecRouteString); - return true; - } - - /// - /// - /// - /// - public void RunRouteAction(string routeKey) - { - RunRouteAction(routeKey, null); - } - - /// - /// Gets a source from config list SourceListKey and dynamically build and executes the - /// route or commands - /// - /// - public void RunRouteAction(string routeKey, Action successCallback) - { - // Run this on a separate thread - new CTimer(o => - { - // try to prevent multiple simultaneous selections - SourceSelectLock.TryEnter(); - - try - { - - Debug.Console(1, this, "Run route action '{0}'", routeKey); - var dict = ConfigReader.ConfigObject.GetSourceListForKey(SourceListKey); - if (dict == null) - { - Debug.Console(1, this, "WARNING: Config source list '{0}' not found", SourceListKey); - return; - } - - // Try to get the list item by it's string key - if (!dict.ContainsKey(routeKey)) - { - Debug.Console(1, this, "WARNING: No item '{0}' found on config list '{1}'", - routeKey, SourceListKey); - return; - } - - // End usage timer on last source - if (!string.IsNullOrEmpty(LastSourceKey)) - { - var usageLastSource = dict[LastSourceKey].SourceDevice as IUsageTracking; - if (usageLastSource != null && usageLastSource.UsageTracker != null) - { - try - { - // There MAY have been failures in here. Protect - usageLastSource.UsageTracker.EndDeviceUsage(); - } - catch (Exception e) - { - Debug.Console(1, this, "*#* EXCEPTION in end usage tracking:\r{0}", e); - } - } - } - - // Let's run it - var item = dict[routeKey]; - if (routeKey.ToLower() != "roomoff") - { - - LastSourceKey = routeKey; - } - else - CurrentSourceInfoKey = null; - - // hand off the individual routes to this helper - foreach (var route in item.RouteList) - DoRouteItem(route); - - // Start usage timer on routed source - var usageNewSource = item.SourceDevice as IUsageTracking; - if (usageNewSource != null && usageNewSource.UsageTracker != null) // Have to make sure there is a usage tracker! - { - (item.SourceDevice as IUsageTracking).UsageTracker.StartDeviceUsage(); - } - - // See if this can be moved into common, base-class method ------------- - - - // Set volume control, using default if non provided - IBasicVolumeControls volDev = null; - // Handle special cases for volume control - if (string.IsNullOrEmpty(item.VolumeControlKey) - || item.VolumeControlKey.Equals("$defaultAudio", StringComparison.OrdinalIgnoreCase)) - volDev = DefaultVolumeControls; - else if (item.VolumeControlKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase)) - volDev = DefaultDisplay as IBasicVolumeControls; - // Or a specific device, probably rarely used. - else - { - var dev = DeviceManager.GetDeviceForKey(item.VolumeControlKey); - if (dev is IBasicVolumeControls) - volDev = dev as IBasicVolumeControls; - else if (dev is IHasVolumeDevice) - volDev = (dev as IHasVolumeDevice).VolumeDevice; - } - - if (volDev != CurrentVolumeControls) - { - // zero the volume on the device we are leaving. - // Set the volume to default on device we are entering - if (ZeroVolumeWhenSwtichingVolumeDevices && CurrentVolumeControls is IBasicVolumeWithFeedback) - { - var vd = CurrentVolumeControls as IBasicVolumeWithFeedback; - SavedVolumeLevels[vd] = (uint)vd.VolumeLevelFeedback.IntValue; - vd.SetVolume(0); - } - - CurrentVolumeControls = volDev; - if (ZeroVolumeWhenSwtichingVolumeDevices && CurrentVolumeControls is IBasicVolumeWithFeedback) - { - var vd = CurrentVolumeControls as IBasicVolumeWithFeedback; - ushort vol = (SavedVolumeLevels.ContainsKey(vd) ? (ushort)SavedVolumeLevels[vd] : DefaultVolume); - vd.SetVolume(vol); - } - } - // ----------------------------------------------------------------------- - - - - // store the name and UI info for routes - if (item.SourceKey == "$off") - { - CurrentSourceInfoKey = routeKey; - CurrentSourceInfo = null; - } - else if (item.SourceKey != null) - { - CurrentSourceInfoKey = routeKey; - CurrentSourceInfo = item; - } - - OnFeedback.FireUpdate(); - - // report back when done - if (successCallback != null) - successCallback(); - } - catch (Exception e) - { - Debug.Console(1, this, "ERROR in routing: {0}", e); - } - - SourceSelectLock.Leave(); - }, 0); // end of CTimer - } - - /// - /// - /// - /// - void DoRouteItem(SourceRouteListItem route) - { - // if there is a $defaultAll on route, run two separate - if (route.DestinationKey.Equals("$defaultAll", StringComparison.OrdinalIgnoreCase)) - { - // Going to assume a single-path route for now - var tempVideo = new SourceRouteListItem - { - DestinationKey = "$defaultDisplay", - SourceKey = route.SourceKey, - Type = eRoutingSignalType.Video - }; - DoRoute(tempVideo); - } - else - DoRoute(route); - } - - /// - /// - /// - /// - /// - bool DoRoute(SourceRouteListItem route) - { - IRoutingSinkNoSwitching dest = null; - - if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase)) - dest = DefaultAudioDevice as IRoutingSinkNoSwitching; - else if (route.DestinationKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase)) - dest = DefaultDisplay; - else - dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSinkNoSwitching; - - if (dest == null) - { - Debug.Console(1, this, "Cannot route, unknown destination '{0}'", route.DestinationKey); - return false; - } - - if (route.SourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase)) - { - dest.ReleaseRoute(); - if (dest is IPower) - (dest as IPower).PowerOff(); - } - else - { - var source = DeviceManager.GetDeviceForKey(route.SourceKey) as IRoutingOutputs; - if (source == null) - { - Debug.Console(1, this, "Cannot route unknown source '{0}' to {1}", route.SourceKey, route.DestinationKey); - return false; - } - dest.ReleaseAndMakeRoute(source, route.Type); - } - return true; - } - - public override void RoomVacatedForTimeoutPeriod(object o) - { - //Implement this - } - - /// - /// Does what it says - /// - public override void SetDefaultLevels() - { - Debug.Console(1, this, "Restoring default levels"); - var vc = CurrentVolumeControls as IBasicVolumeWithFeedback; - if (vc != null) - vc.SetVolume(DefaultVolume); - } - /// - /// Will power the room on with the last-used source - /// - public override void PowerOnToDefaultOrLastSource() - { - if (!EnablePowerOnToLastSource || LastSourceKey == null) - return; - RunRouteAction(LastSourceKey); - } - - /// - /// Runs "roomOff" action on all rooms not set to ExcludeFromGlobalFunctions - /// - public static void AllRoomsOff() - { - var allRooms = DeviceManager.AllDevices.Where(d => - d is EssentialsHuddleSpaceRoom && !(d as EssentialsHuddleSpaceRoom).ExcludeFromGlobalFunctions); - foreach (var room in allRooms) - (room as EssentialsHuddleSpaceRoom).RunRouteAction("roomOff"); - } - - #region IPrivacy Members - - - public void PrivacyModeOff() - { - VideoCodec.PrivacyModeOff(); - } - - public void PrivacyModeOn() - { - VideoCodec.PrivacyModeOn(); - } - - public void PrivacyModeToggle() - { - VideoCodec.PrivacyModeToggle(); - } - - #endregion - } +using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Room.Config; +using PepperDash.Essentials.Devices.Common.Codec; +using PepperDash.Essentials.Devices.Common.VideoCodec; + +namespace PepperDash.Essentials +{ + public class EssentialsHuddleVtc1Room : EssentialsRoomBase, IHasCurrentSourceInfoChange, + IPrivacy, IHasCurrentVolumeControls, IRunRouteAction, IRunDefaultCallRoute, IHasVideoCodec + { + public event EventHandler CurrentVolumeDeviceChange; + public event SourceInfoChangeHandler CurrentSingleSourceChange; + + + //************************ + // Call-related stuff + + public BoolFeedback InCallFeedback { get; private set; } + + /// + /// Make this more specific + /// + public List ActiveCalls { get; private set; } + + /// + /// States: 0 for on hook, 1 for video, 2 for audio, 3 for telekenesis + /// + public IntFeedback CallTypeFeedback { get; private set; } + + /// + /// + /// + public BoolFeedback PrivacyModeIsOnFeedback { get; private set; } + + /// + /// When something in the room is sharing with the far end or through other means + /// + public BoolFeedback IsSharingFeedback { get; private set; } + + //************************ + + + protected override Func OnFeedbackFunc + { + get + { + return () => + { + var disp = DefaultDisplay as DisplayBase; + var val = CurrentSourceInfo != null + && CurrentSourceInfo.Type == eSourceListItemType.Route + && disp != null; + //&& disp.PowerIsOnFeedback.BoolValue; + return val; + }; + } + } + /// + /// + /// + protected override Func IsWarmingFeedbackFunc + { + get + { + return () => + { + var disp = DefaultDisplay as DisplayBase; + if (disp != null) + return disp.IsWarmingUpFeedback.BoolValue; + else + return false; + }; + } + } + /// + /// + /// + protected override Func IsCoolingFeedbackFunc + { + get + { + return () => + { + var disp = DefaultDisplay as DisplayBase; + if (disp != null) + return disp.IsCoolingDownFeedback.BoolValue; + else + return false; + }; + } + } + + public EssentialsHuddleVtc1PropertiesConfig PropertiesConfig { get; private set; } + + public IRoutingSinkWithSwitching DefaultDisplay { get; private set; } + public IBasicVolumeControls DefaultAudioDevice { get; private set; } + public IBasicVolumeControls DefaultVolumeControls { get; private set; } + + public VideoCodecBase VideoCodec { get; private set; } + + public bool ExcludeFromGlobalFunctions { get; set; } + + /// + /// The config name of the source list + /// + public string SourceListKey { get; set; } + + public string DefaultSourceItem { get; set; } + + public ushort DefaultVolume { get; set; } + + /// + /// If room is off, enables power on to last source. Default true + /// + public bool EnablePowerOnToLastSource { get; set; } + string LastSourceKey; + + /// + /// Sets the volume control device, and attaches/removes InUseTrackers with "audio" + /// tag to device. + /// + public IBasicVolumeControls CurrentVolumeControls + { + get { return _CurrentAudioDevice; } + set + { + if (value == _CurrentAudioDevice) return; + + var oldDev = _CurrentAudioDevice; + // derigister this room from the device, if it can + if (oldDev is IInUseTracking) + (oldDev as IInUseTracking).InUseTracker.RemoveUser(this, "audio"); + var handler = CurrentVolumeDeviceChange; + if (handler != null) + CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.WillChange)); + _CurrentAudioDevice = value; + if (handler != null) + CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.DidChange)); + // register this room with new device, if it can + if (_CurrentAudioDevice is IInUseTracking) + (_CurrentAudioDevice as IInUseTracking).InUseTracker.AddUser(this, "audio"); + } + } + IBasicVolumeControls _CurrentAudioDevice; + + /// + /// The SourceListItem last run - containing names and icons + /// + public SourceListItem CurrentSourceInfo + { + get { return _CurrentSourceInfo; } + private set + { + if (value == _CurrentSourceInfo) return; + + var handler = CurrentSingleSourceChange; + // remove from in-use tracker, if so equipped + if(_CurrentSourceInfo != null && _CurrentSourceInfo.SourceDevice is IInUseTracking) + (_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.RemoveUser(this, "control"); + + if (handler != null) + handler(this, _CurrentSourceInfo, ChangeType.WillChange); + + _CurrentSourceInfo = value; + + // add to in-use tracking + if (_CurrentSourceInfo != null && _CurrentSourceInfo.SourceDevice is IInUseTracking) + (_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.AddUser(this, "control"); + if (handler != null) + handler(this, _CurrentSourceInfo, ChangeType.DidChange); + } + } + SourceListItem _CurrentSourceInfo; + + public string CurrentSourceInfoKey { get; private set; } + + /// + /// "codecOsd" + /// + public string DefaultCodecRouteString { get { return "codecOsd"; } } + + /// + /// Temporary implementation. Returns the schedule-ready object or null if none. Fow now, + /// always returns the VideoCodec if it is capable + /// + public IHasScheduleAwareness ScheduleSource { get { return VideoCodec as IHasScheduleAwareness; } } + + CCriticalSection SourceSelectLock = new CCriticalSection(); + + /// + /// + /// + /// + /// + public EssentialsHuddleVtc1Room(string key, string name, IRoutingSinkWithSwitching defaultDisplay, + IBasicVolumeControls defaultAudio, VideoCodecBase codec, EssentialsHuddleVtc1PropertiesConfig config) + : base(key, name) + { + if (codec == null) + throw new ArgumentNullException("codec cannot be null"); + PropertiesConfig = config; + DefaultDisplay = defaultDisplay; + VideoCodec = codec; + DefaultAudioDevice = defaultAudio; + + if (defaultAudio is IBasicVolumeControls) + DefaultVolumeControls = defaultAudio as IBasicVolumeControls; + else if (defaultAudio is IHasVolumeDevice) + DefaultVolumeControls = (defaultAudio as IHasVolumeDevice).VolumeDevice; + CurrentVolumeControls = DefaultVolumeControls; + + + var disp = DefaultDisplay as DisplayBase; + if (disp != null) + { + // Link power, warming, cooling to display + disp.PowerIsOnFeedback.OutputChange += (o, a) => + { + if (disp.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue) + { + if (!disp.PowerIsOnFeedback.BoolValue) + CurrentSourceInfo = null; + OnFeedback.FireUpdate(); + } + if (disp.PowerIsOnFeedback.BoolValue) + { + SetDefaultLevels(); + } + }; + + disp.IsWarmingUpFeedback.OutputChange += (o, a) => + { + IsWarmingUpFeedback.FireUpdate(); + if (!IsWarmingUpFeedback.BoolValue) + (CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(DefaultVolume); + }; + disp.IsCoolingDownFeedback.OutputChange += (o, a) => + { + IsCoolingDownFeedback.FireUpdate(); + }; + } + + InCallFeedback = new BoolFeedback(() => VideoCodec.IsInCall); + VideoCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate(); + + IsSharingFeedback = new BoolFeedback(() => VideoCodec.SharingContentIsOnFeedback.BoolValue); + VideoCodec.SharingContentIsOnFeedback.OutputChange += (o, a) => this.IsSharingFeedback.FireUpdate(); + + // link privacy to VC (for now?) + PrivacyModeIsOnFeedback = new BoolFeedback(() => VideoCodec.PrivacyModeIsOnFeedback.BoolValue); + VideoCodec.PrivacyModeIsOnFeedback.OutputChange += (o, a) => this.PrivacyModeIsOnFeedback.FireUpdate(); + + CallTypeFeedback = new IntFeedback(() => 0); + + SourceListKey = "default"; + EnablePowerOnToLastSource = true; + } + + + /// + /// + /// + protected override void EndShutdown() + { + VideoCodec.EndAllCalls(); + + SetDefaultLevels(); + + RunDefaultPresentRoute(); + + CrestronEnvironment.Sleep(1000); + + RunRouteAction("roomOff"); + } + + /// + /// Routes the default source item, if any. Returns true when default route exists + /// + public override bool RunDefaultPresentRoute() + { + if (DefaultSourceItem != null) + RunRouteAction(DefaultSourceItem); + + return DefaultSourceItem != null; + } + + /// + /// Sets up the room when started into call mode without presenting a source + /// + /// + public bool RunDefaultCallRoute() + { + RunRouteAction(DefaultCodecRouteString); + return true; + } + + /// + /// + /// + /// + public void RunRouteAction(string routeKey) + { + RunRouteAction(routeKey, null); + } + + /// + /// Gets a source from config list SourceListKey and dynamically build and executes the + /// route or commands + /// + /// + public void RunRouteAction(string routeKey, Action successCallback) + { + // Run this on a separate thread + new CTimer(o => + { + // try to prevent multiple simultaneous selections + SourceSelectLock.TryEnter(); + + try + { + + Debug.Console(1, this, "Run route action '{0}'", routeKey); + var dict = ConfigReader.ConfigObject.GetSourceListForKey(SourceListKey); + if (dict == null) + { + Debug.Console(1, this, "WARNING: Config source list '{0}' not found", SourceListKey); + return; + } + + // Try to get the list item by it's string key + if (!dict.ContainsKey(routeKey)) + { + Debug.Console(1, this, "WARNING: No item '{0}' found on config list '{1}'", + routeKey, SourceListKey); + return; + } + + // End usage timer on last source + if (!string.IsNullOrEmpty(LastSourceKey)) + { + var usageLastSource = dict[LastSourceKey].SourceDevice as IUsageTracking; + if (usageLastSource != null && usageLastSource.UsageTracker != null) + { + try + { + // There MAY have been failures in here. Protect + usageLastSource.UsageTracker.EndDeviceUsage(); + } + catch (Exception e) + { + Debug.Console(1, this, "*#* EXCEPTION in end usage tracking:\r{0}", e); + } + } + } + + // Let's run it + var item = dict[routeKey]; + if (routeKey.ToLower() != "roomoff") + { + + LastSourceKey = routeKey; + } + else + CurrentSourceInfoKey = null; + + // hand off the individual routes to this helper + foreach (var route in item.RouteList) + DoRouteItem(route); + + // Start usage timer on routed source + var usageNewSource = item.SourceDevice as IUsageTracking; + if (usageNewSource != null && usageNewSource.UsageTracker != null) // Have to make sure there is a usage tracker! + { + (item.SourceDevice as IUsageTracking).UsageTracker.StartDeviceUsage(); + } + + // See if this can be moved into common, base-class method ------------- + + + // Set volume control, using default if non provided + IBasicVolumeControls volDev = null; + // Handle special cases for volume control + if (string.IsNullOrEmpty(item.VolumeControlKey) + || item.VolumeControlKey.Equals("$defaultAudio", StringComparison.OrdinalIgnoreCase)) + volDev = DefaultVolumeControls; + else if (item.VolumeControlKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase)) + volDev = DefaultDisplay as IBasicVolumeControls; + // Or a specific device, probably rarely used. + else + { + var dev = DeviceManager.GetDeviceForKey(item.VolumeControlKey); + if (dev is IBasicVolumeControls) + volDev = dev as IBasicVolumeControls; + else if (dev is IHasVolumeDevice) + volDev = (dev as IHasVolumeDevice).VolumeDevice; + } + + if (volDev != CurrentVolumeControls) + { + // zero the volume on the device we are leaving. + // Set the volume to default on device we are entering + if (ZeroVolumeWhenSwtichingVolumeDevices && CurrentVolumeControls is IBasicVolumeWithFeedback) + { + var vd = CurrentVolumeControls as IBasicVolumeWithFeedback; + SavedVolumeLevels[vd] = (uint)vd.VolumeLevelFeedback.IntValue; + vd.SetVolume(0); + } + + CurrentVolumeControls = volDev; + if (ZeroVolumeWhenSwtichingVolumeDevices && CurrentVolumeControls is IBasicVolumeWithFeedback) + { + var vd = CurrentVolumeControls as IBasicVolumeWithFeedback; + ushort vol = (SavedVolumeLevels.ContainsKey(vd) ? (ushort)SavedVolumeLevels[vd] : DefaultVolume); + vd.SetVolume(vol); + } + } + // ----------------------------------------------------------------------- + + + + // store the name and UI info for routes + if (item.SourceKey == "$off") + { + CurrentSourceInfoKey = routeKey; + CurrentSourceInfo = null; + } + else if (item.SourceKey != null) + { + CurrentSourceInfoKey = routeKey; + CurrentSourceInfo = item; + } + + OnFeedback.FireUpdate(); + + // report back when done + if (successCallback != null) + successCallback(); + } + catch (Exception e) + { + Debug.Console(1, this, "ERROR in routing: {0}", e); + } + + SourceSelectLock.Leave(); + }, 0); // end of CTimer + } + + /// + /// + /// + /// + void DoRouteItem(SourceRouteListItem route) + { + // if there is a $defaultAll on route, run two separate + if (route.DestinationKey.Equals("$defaultAll", StringComparison.OrdinalIgnoreCase)) + { + // Going to assume a single-path route for now + var tempVideo = new SourceRouteListItem + { + DestinationKey = "$defaultDisplay", + SourceKey = route.SourceKey, + Type = eRoutingSignalType.Video + }; + DoRoute(tempVideo); + } + else + DoRoute(route); + } + + /// + /// + /// + /// + /// + bool DoRoute(SourceRouteListItem route) + { + IRoutingSinkNoSwitching dest = null; + + if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase)) + dest = DefaultAudioDevice as IRoutingSinkNoSwitching; + else if (route.DestinationKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase)) + dest = DefaultDisplay; + else + dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSinkNoSwitching; + + if (dest == null) + { + Debug.Console(1, this, "Cannot route, unknown destination '{0}'", route.DestinationKey); + return false; + } + + if (route.SourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase)) + { + dest.ReleaseRoute(); + if (dest is IPower) + (dest as IPower).PowerOff(); + } + else + { + var source = DeviceManager.GetDeviceForKey(route.SourceKey) as IRoutingOutputs; + if (source == null) + { + Debug.Console(1, this, "Cannot route unknown source '{0}' to {1}", route.SourceKey, route.DestinationKey); + return false; + } + dest.ReleaseAndMakeRoute(source, route.Type); + } + return true; + } + + public override void RoomVacatedForTimeoutPeriod(object o) + { + //Implement this + } + + /// + /// Does what it says + /// + public override void SetDefaultLevels() + { + Debug.Console(1, this, "Restoring default levels"); + var vc = CurrentVolumeControls as IBasicVolumeWithFeedback; + if (vc != null) + vc.SetVolume(DefaultVolume); + } + /// + /// Will power the room on with the last-used source + /// + public override void PowerOnToDefaultOrLastSource() + { + if (!EnablePowerOnToLastSource || LastSourceKey == null) + return; + RunRouteAction(LastSourceKey); + } + + /// + /// Runs "roomOff" action on all rooms not set to ExcludeFromGlobalFunctions + /// + public static void AllRoomsOff() + { + var allRooms = DeviceManager.AllDevices.Where(d => + d is EssentialsHuddleSpaceRoom && !(d as EssentialsHuddleSpaceRoom).ExcludeFromGlobalFunctions); + foreach (var room in allRooms) + (room as EssentialsHuddleSpaceRoom).RunRouteAction("roomOff"); + } + + #region IPrivacy Members + + + public void PrivacyModeOff() + { + VideoCodec.PrivacyModeOff(); + } + + public void PrivacyModeOn() + { + VideoCodec.PrivacyModeOn(); + } + + public void PrivacyModeToggle() + { + VideoCodec.PrivacyModeToggle(); + } + + #endregion + } } \ No newline at end of file diff --git a/PepperDashEssentials/Room/Types/EssentialsRoomBase.cs b/PepperDashEssentials/Room/Types/EssentialsRoomBase.cs index a364fa23..de0baccd 100644 --- a/PepperDashEssentials/Room/Types/EssentialsRoomBase.cs +++ b/PepperDashEssentials/Room/Types/EssentialsRoomBase.cs @@ -7,6 +7,7 @@ using Crestron.SimplSharp.Scheduler; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Devices; using PepperDash.Essentials.Devices.Common.Occupancy; namespace PepperDash.Essentials @@ -14,7 +15,7 @@ namespace PepperDash.Essentials /// /// /// - public abstract class EssentialsRoomBase : Device + public abstract class EssentialsRoomBase : ReconfigurableDevice { /// /// @@ -80,12 +81,9 @@ namespace PepperDash.Essentials /// public bool ZeroVolumeWhenSwtichingVolumeDevices { get; private set; } - /// - /// - /// - /// - /// - public EssentialsRoomBase(string key, string name) : base(key, name) + + public EssentialsRoomBase(DeviceConfig config) + : base(config) { // Setup the ShutdownPromptTimer ShutdownPromptTimer = new SecondsCountdownTimer(Key + "-offTimer"); @@ -124,6 +122,50 @@ namespace PepperDash.Essentials }); } + ///// + ///// + ///// + ///// + ///// + //public EssentialsRoomBase(string key, string name) : base(key, name) + //{ + // // Setup the ShutdownPromptTimer + // ShutdownPromptTimer = new SecondsCountdownTimer(Key + "-offTimer"); + // ShutdownPromptTimer.IsRunningFeedback.OutputChange += (o, a) => + // { + // if (!ShutdownPromptTimer.IsRunningFeedback.BoolValue) + // ShutdownType = eShutdownType.None; + // }; + // ShutdownPromptTimer.HasFinished += (o, a) => Shutdown(); // Shutdown is triggered + + // ShutdownPromptSeconds = 60; + // ShutdownVacancySeconds = 120; + // ShutdownType = eShutdownType.None; + + // RoomVacancyShutdownTimer = new SecondsCountdownTimer(Key + "-vacancyOffTimer"); + // //RoomVacancyShutdownTimer.IsRunningFeedback.OutputChange += (o, a) => + // //{ + // // if (!RoomVacancyShutdownTimer.IsRunningFeedback.BoolValue) + // // ShutdownType = ShutdownType.Vacancy; + // //}; + // RoomVacancyShutdownTimer.HasFinished += new EventHandler(RoomVacancyShutdownPromptTimer_HasFinished); // Shutdown is triggered + + // RoomVacancyShutdownPromptSeconds = 1500; // 25 min to prompt warning + // RoomVacancyShutdownSeconds = 240; // 4 min after prompt will trigger shutdown prompt + // VacancyMode = eVacancyMode.None; + + // OnFeedback = new BoolFeedback(OnFeedbackFunc); + + // IsWarmingUpFeedback = new BoolFeedback(IsWarmingFeedbackFunc); + // IsCoolingDownFeedback = new BoolFeedback(IsCoolingFeedbackFunc); + + // AddPostActivationAction(() => + // { + // if (RoomOccupancy != null) + // OnRoomOccupancyIsSet(); + // }); + //} + void RoomVacancyShutdownPromptTimer_HasFinished(object sender, EventArgs e) { switch (VacancyMode) diff --git a/PepperDashEssentials/UIDrivers/Essentials/EssentialsHeaderDriver.cs b/PepperDashEssentials/UIDrivers/Essentials/EssentialsHeaderDriver.cs index 1a51fb44..68d4cbcb 100644 --- a/PepperDashEssentials/UIDrivers/Essentials/EssentialsHeaderDriver.cs +++ b/PepperDashEssentials/UIDrivers/Essentials/EssentialsHeaderDriver.cs @@ -76,7 +76,7 @@ namespace PepperDash.Essentials avDriver.PopupInterlock.HideAndClear()); } - void SetUpHelpButton(EssentialsRoomPropertiesConfig roomConf) + public void SetUpHelpButton(EssentialsRoomPropertiesConfig roomConf) { // Help roomConf and popup if (roomConf.Help != null) @@ -107,7 +107,7 @@ namespace PepperDash.Essentials var room = DeviceManager.GetDeviceForKey(Config.DefaultRoomKey) as EssentialsHuddleSpaceRoom; if (room != null) - message = room.Config.HelpMessage; + message = room.PropertiesConfig.HelpMessage; else message = "Sorry, no help message available. No room connected."; //TriList.StringInput[UIStringJoin.HelpMessage].StringValue = message; @@ -227,7 +227,7 @@ namespace PepperDash.Essentials TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true); - var roomConf = currentRoom.Config; + var roomConf = currentRoom.PropertiesConfig; // Register for the PopupInterlock IsShowsFeedback event to tie the header carets subpage visiblity to it Parent.AvDriver.PopupInterlock.StatusChanged -= PopupInterlock_StatusChanged; @@ -289,7 +289,7 @@ namespace PepperDash.Essentials TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true); - var roomConf = currentRoom.Config; + var roomConf = currentRoom.PropertiesConfig; // Register for the PopupInterlock IsShowsFeedback event to tie the header carets subpage visiblity to it Parent.AvDriver.PopupInterlock.StatusChanged -= PopupInterlock_StatusChanged; diff --git a/PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs b/PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs index 48d81997..2c2e761d 100644 --- a/PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs +++ b/PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs @@ -164,7 +164,7 @@ namespace PepperDash.Essentials get { if (_TechDriver == null) - _TechDriver = new PepperDash.Essentials.UIDrivers.EssentialsHuddleTechPageDriver(TriList, CurrentRoom.Config.Tech); + _TechDriver = new PepperDash.Essentials.UIDrivers.EssentialsHuddleTechPageDriver(TriList, CurrentRoom.PropertiesConfig.Tech); return _TechDriver; } } @@ -220,9 +220,7 @@ namespace PepperDash.Essentials return; } - var roomConf = CurrentRoom.Config; - - TriList.SetString(UIStringJoin.CurrentRoomName, CurrentRoom.Name); + var roomConf = CurrentRoom.PropertiesConfig; if (Config.HeaderStyle.ToLower() == CrestronTouchpanelPropertiesConfig.Habanero) { @@ -724,63 +722,58 @@ namespace PepperDash.Essentials CurrentRoom.CurrentVolumeControls.VolumeDown(state); } - /// - /// Helper for property setter. Sets the panel to the given room, latching up all functionality - /// - void SetCurrentRoom(EssentialsHuddleSpaceRoom room) - { - if (_CurrentRoom == room) return; - // Disconnect current (probably never called) - if (_CurrentRoom != null) - { - // Disconnect current room - _CurrentRoom.CurrentVolumeDeviceChange -= this.CurrentRoom_CurrentAudioDeviceChange; - ClearAudioDeviceConnections(); - _CurrentRoom.CurrentSingleSourceChange -= this.CurrentRoom_SourceInfoChange; - DisconnectSource(_CurrentRoom.CurrentSourceInfo); + public void RefreshCurrentRoom(EssentialsHuddleSpaceRoom room) + { + if (_CurrentRoom != null) + { + // Disconnect current room + _CurrentRoom.CurrentVolumeDeviceChange -= this.CurrentRoom_CurrentAudioDeviceChange; + ClearAudioDeviceConnections(); + _CurrentRoom.CurrentSingleSourceChange -= this.CurrentRoom_SourceInfoChange; + DisconnectSource(_CurrentRoom.CurrentSourceInfo); _CurrentRoom.ShutdownPromptTimer.HasStarted -= ShutdownPromptTimer_HasStarted; _CurrentRoom.ShutdownPromptTimer.HasFinished -= ShutdownPromptTimer_HasFinished; _CurrentRoom.ShutdownPromptTimer.WasCancelled -= ShutdownPromptTimer_WasCancelled; - _CurrentRoom.OnFeedback.OutputChange += CurrentRoom_OnFeedback_OutputChange; + _CurrentRoom.OnFeedback.OutputChange -= CurrentRoom_OnFeedback_OutputChange; _CurrentRoom.IsWarmingUpFeedback.OutputChange -= CurrentRoom_IsWarmingFeedback_OutputChange; _CurrentRoom.IsCoolingDownFeedback.OutputChange -= IsCoolingDownFeedback_OutputChange; } - _CurrentRoom = room; + _CurrentRoom = room; - if (_CurrentRoom != null) - { - // get the source list config and set up the source list - var config = ConfigReader.ConfigObject.SourceLists; - if (config.ContainsKey(_CurrentRoom.SourceListKey)) - { - var srcList = config[_CurrentRoom.SourceListKey]; - // Setup sources list - uint i = 1; // counter for UI list - foreach (var kvp in srcList) - { - var srcConfig = kvp.Value; - if (!srcConfig.IncludeInSourceList) // Skip sources marked this way - continue; + if (_CurrentRoom != null) + { + // get the source list config and set up the source list + var config = ConfigReader.ConfigObject.SourceLists; + if (config.ContainsKey(_CurrentRoom.SourceListKey)) + { + var srcList = config[_CurrentRoom.SourceListKey]; + // Setup sources list + uint i = 1; // counter for UI list + foreach (var kvp in srcList) + { + var srcConfig = kvp.Value; + if (!srcConfig.IncludeInSourceList) // Skip sources marked this way + continue; - var actualSource = DeviceManager.GetDeviceForKey(srcConfig.SourceKey) as Device; - if (actualSource == null) - { - Debug.Console(1, "Cannot assign missing source '{0}' to source UI list", - srcConfig.SourceKey); - continue; - } - var routeKey = kvp.Key; + var actualSource = DeviceManager.GetDeviceForKey(srcConfig.SourceKey) as Device; + if (actualSource == null) + { + Debug.Console(1, "Cannot assign missing source '{0}' to source UI list", + srcConfig.SourceKey); + continue; + } + var routeKey = kvp.Key; var item = new SubpageReferenceListSourceItem(i++, SourcesSrl, srcConfig, b => { if (!b) UiSelectSource(routeKey); }); SourcesSrl.AddItem(item); // add to the SRL item.RegisterForSourceChange(_CurrentRoom); - } + } SourcesSrl.Count = (ushort)(i - 1); - } + } // Name and logo - TriList.StringInput[UIStringJoin.CurrentRoomName].StringValue = _CurrentRoom.Name; + TriList.StringInput[UIStringJoin.CurrentRoomName].StringValue = _CurrentRoom.Name; if (_CurrentRoom.LogoUrl == null) { TriList.BooleanInput[UIBoolJoin.LogoDefaultVisible].BoolValue = true; @@ -804,98 +797,31 @@ namespace PepperDash.Essentials _CurrentRoom.IsWarmingUpFeedback.OutputChange += CurrentRoom_IsWarmingFeedback_OutputChange; _CurrentRoom.IsCoolingDownFeedback.OutputChange += IsCoolingDownFeedback_OutputChange; - _CurrentRoom.CurrentVolumeDeviceChange += CurrentRoom_CurrentAudioDeviceChange; - RefreshAudioDeviceConnections(); - _CurrentRoom.CurrentSingleSourceChange += CurrentRoom_SourceInfoChange; - RefreshSourceInfo(); + _CurrentRoom.CurrentVolumeDeviceChange += CurrentRoom_CurrentAudioDeviceChange; + RefreshAudioDeviceConnections(); + _CurrentRoom.CurrentSingleSourceChange += CurrentRoom_SourceInfoChange; + RefreshSourceInfo(); (Parent as EssentialsPanelMainInterfaceDriver).HeaderDriver.SetupHeaderButtons(this, CurrentRoom); } - else - { - // Clear sigs that need to be - TriList.StringInput[UIStringJoin.CurrentRoomName].StringValue = "Select a room"; - } + else + { + // Clear sigs that need to be + TriList.StringInput[UIStringJoin.CurrentRoomName].StringValue = "Select a room"; + } + } + + /// + /// Helper for property setter. Sets the panel to the given room, latching up all functionality + /// + void SetCurrentRoom(EssentialsHuddleSpaceRoom room) + { + if (_CurrentRoom == room) return; + // Disconnect current (probably never called) + + RefreshCurrentRoom(room); } - //void SetupHeaderButtons() - //{ - // HeaderButtonsAreSetUp = false; - - // TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true); - - // var roomConf = CurrentRoom.Config; - - // // Gear - // TriList.SetString(UIStringJoin.HeaderButtonIcon5, "Gear"); - // TriList.SetSigHeldAction(UIBoolJoin.HeaderIcon5Press, 2000, - // ShowTech, - // null, - // () => - // { - // if (CurrentRoom.OnFeedback.BoolValue) - // PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPageVisible); - // else - // PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPagePowerOffVisible); - // }); - // TriList.SetSigFalseAction(UIBoolJoin.TechExitButton, () => - // PopupInterlock.HideAndClear()); - - // // Help button and popup - // if (CurrentRoom.Config.Help != null) - // { - // TriList.SetString(UIStringJoin.HelpMessage, roomConf.Help.Message); - // TriList.SetBool(UIBoolJoin.HelpPageShowCallButtonVisible, roomConf.Help.ShowCallButton); - // TriList.SetString(UIStringJoin.HelpPageCallButtonText, roomConf.Help.CallButtonText); - // if (roomConf.Help.ShowCallButton) - // TriList.SetSigFalseAction(UIBoolJoin.HelpPageShowCallButtonPress, () => { }); // ************ FILL IN - // else - // TriList.ClearBoolSigAction(UIBoolJoin.HelpPageShowCallButtonPress); - // } - // else // older config - // { - // TriList.SetString(UIStringJoin.HelpMessage, CurrentRoom.Config.HelpMessage); - // TriList.SetBool(UIBoolJoin.HelpPageShowCallButtonVisible, false); - // TriList.SetString(UIStringJoin.HelpPageCallButtonText, null); - // TriList.ClearBoolSigAction(UIBoolJoin.HelpPageShowCallButtonPress); - // } - // TriList.SetString(UIStringJoin.HeaderButtonIcon4, "Help"); - // TriList.SetSigFalseAction(UIBoolJoin.HeaderIcon4Press, () => - // { - // string message = null; - // var room = DeviceManager.GetDeviceForKey(Config.DefaultRoomKey) - // as EssentialsHuddleSpaceRoom; - // if (room != null) - // message = room.Config.HelpMessage; - // else - // message = "Sorry, no help message available. No room connected."; - // //TriList.StringInput[UIStringJoin.HelpMessage].StringValue = message; - // PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.HelpPageVisible); - // }); - // uint nextJoin = 3953; - - // //// Calendar button - // //if (_CurrentRoom.ScheduleSource != null) - // //{ - // // TriList.SetString(nextJoin, "Calendar"); - // // TriList.SetSigFalseAction(nextJoin, CalendarPress); - - // // nextJoin--; - // //} - - // //nextJoin--; - - // // blank any that remain - // for (var i = nextJoin; i > 3950; i--) - // { - // TriList.SetString(i, "Blank"); - // TriList.SetSigFalseAction(i, () => { }); - // } - - // HeaderButtonsAreSetUp = true; - //} - - /// /// For room on/off changes /// diff --git a/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs b/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs index 7b3aa686..1ef7b65b 100644 --- a/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs +++ b/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs @@ -155,7 +155,7 @@ namespace PepperDash.Essentials get { if (_TechDriver == null) - _TechDriver = new PepperDash.Essentials.UIDrivers.EssentialsHuddleTechPageDriver(TriList, CurrentRoom.Config.Tech); + _TechDriver = new PepperDash.Essentials.UIDrivers.EssentialsHuddleTechPageDriver(TriList, CurrentRoom.PropertiesConfig.Tech); return _TechDriver; } } @@ -235,9 +235,7 @@ namespace PepperDash.Essentials return; } - var roomConf = CurrentRoom.Config; - - TriList.SetString(UIStringJoin.CurrentRoomName, CurrentRoom.Name); + var roomConf = CurrentRoom.PropertiesConfig; if (Config.HeaderStyle.ToLower() == CrestronTouchpanelPropertiesConfig.Habanero) { @@ -894,7 +892,7 @@ namespace PepperDash.Essentials _CurrentRoom.ShutdownPromptTimer.HasFinished -= ShutdownPromptTimer_HasFinished; _CurrentRoom.ShutdownPromptTimer.WasCancelled -= ShutdownPromptTimer_WasCancelled; - _CurrentRoom.OnFeedback.OutputChange += CurrentRoom_OnFeedback_OutputChange; + _CurrentRoom.OnFeedback.OutputChange -= CurrentRoom_OnFeedback_OutputChange; _CurrentRoom.IsWarmingUpFeedback.OutputChange -= CurrentRoom_IsWarmingFeedback_OutputChange; _CurrentRoom.IsCoolingDownFeedback.OutputChange -= CurrentRoom_IsCoolingDownFeedback_OutputChange; _CurrentRoom.InCallFeedback.OutputChange -= CurrentRoom_InCallFeedback_OutputChange; @@ -1066,155 +1064,6 @@ namespace PepperDash.Essentials TriList.StringInput[UIStringJoin.CallSharedSourceNameText].StringValue = callListSharedSourceLabel; } - - ///// - ///// - ///// - //void SetupHeaderButtons() - //{ - // HeaderButtonsAreSetUp = false; - - // TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true); - - // var roomConf = CurrentRoom.Config; - - // // Gear - // TriList.SetString(UIStringJoin.HeaderButtonIcon5, "Gear"); - // TriList.SetSigHeldAction(UIBoolJoin.HeaderIcon5Press, 2000, - // ShowTech, - // null, - // () => - // { - // if (CurrentRoom.OnFeedback.BoolValue) - // PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPageVisible); - // else - // PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPagePowerOffVisible); - // }); - // TriList.SetSigFalseAction(UIBoolJoin.TechExitButton, () => - // PopupInterlock.HideAndClear()); - - // // Help button and popup - // if (CurrentRoom.Config.Help != null) - // { - // TriList.SetString(UIStringJoin.HelpMessage, roomConf.Help.Message); - // TriList.SetBool(UIBoolJoin.HelpPageShowCallButtonVisible, roomConf.Help.ShowCallButton); - // TriList.SetString(UIStringJoin.HelpPageCallButtonText, roomConf.Help.CallButtonText); - // if (roomConf.Help.ShowCallButton) - // TriList.SetSigFalseAction(UIBoolJoin.HelpPageShowCallButtonPress, () => { }); // ************ FILL IN - // else - // TriList.ClearBoolSigAction(UIBoolJoin.HelpPageShowCallButtonPress); - // } - // else // older config - // { - // TriList.SetString(UIStringJoin.HelpMessage, CurrentRoom.Config.HelpMessage); - // TriList.SetBool(UIBoolJoin.HelpPageShowCallButtonVisible, false); - // TriList.SetString(UIStringJoin.HelpPageCallButtonText, null); - // TriList.ClearBoolSigAction(UIBoolJoin.HelpPageShowCallButtonPress); - // } - // TriList.SetString(UIStringJoin.HeaderButtonIcon4, "Help"); - // TriList.SetSigFalseAction(UIBoolJoin.HeaderIcon4Press, () => - // { - // string message = null; - // var room = DeviceManager.GetDeviceForKey(Config.DefaultRoomKey) - // as EssentialsHuddleSpaceRoom; - // if (room != null) - // message = room.Config.HelpMessage; - // else - // message = "Sorry, no help message available. No room connected."; - // //TriList.StringInput[UIStringJoin.HelpMessage].StringValue = message; - // PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.HelpPageVisible); - // }); - // uint nextJoin = 3953; - - // // Calendar button - // if (_CurrentRoom.ScheduleSource != null) - // { - // TriList.SetString(nextJoin, "Calendar"); - // TriList.SetSigFalseAction(nextJoin, CalendarPress); - - // nextJoin--; - // } - - // // Call button - // TriList.SetString(nextJoin, "DND"); - // TriList.SetSigFalseAction(nextJoin, ShowActiveCallsList); - // HeaderCallButtonIconSig = TriList.StringInput[nextJoin]; - - // nextJoin--; - - // // blank any that remain - // for (var i = nextJoin; i > 3950; i--) - // { - // TriList.SetString(i, "Blank"); - // TriList.SetSigFalseAction(i, () => { }); - // } - - // TriList.SetSigFalseAction(UIBoolJoin.HeaderCallStatusLabelPress, ShowActiveCallsList); - - // // Set Call Status Subpage Position - - // if (nextJoin == 3951) - // { - // // Set to right position - // TriList.SetBool(UIBoolJoin.HeaderCallStatusLeftPositionVisible, false); - // TriList.SetBool(UIBoolJoin.HeaderCallStatusRightPositionVisible, true); - // } - // else if (nextJoin == 3950) - // { - // // Set to left position - // TriList.SetBool(UIBoolJoin.HeaderCallStatusLeftPositionVisible, true); - // TriList.SetBool(UIBoolJoin.HeaderCallStatusRightPositionVisible, false); - // } - - // HeaderButtonsAreSetUp = true; - - // ComputeHeaderCallStatus(CurrentRoom.VideoCodec); - //} - - ///// - ///// Evaluates the call status and sets the icon mode and text label - ///// - //public void ComputeHeaderCallStatus(VideoCodecBase codec) - //{ - // if (codec == null) - // { - // Debug.Console(1, "ComputeHeaderCallStatus() cannot execute. codec is null"); - // return; - // } - - // if (HeaderCallButtonIconSig == null) - // { - // Debug.Console(1, "ComputeHeaderCallStatus() cannot execute. HeaderCallButtonIconSig is null"); - // return; - // } - - // // Set mode of header button - // if (!codec.IsInCall) - // { - // HeaderCallButtonIconSig.StringValue = "DND"; - // //HeaderCallButton.SetIcon(HeaderListButton.OnHook); - // } - // else if (codec.ActiveCalls.Any(c => c.Type == eCodecCallType.Video)) - // HeaderCallButtonIconSig.StringValue = "Misc-06_Dark"; - // //HeaderCallButton.SetIcon(HeaderListButton.Camera); - // //TriList.SetUshort(UIUshortJoin.CallHeaderButtonMode, 2); - // else - // HeaderCallButtonIconSig.StringValue = "Misc-09_Dark"; - // //HeaderCallButton.SetIcon(HeaderListButton.Phone); - // //TriList.SetUshort(UIUshortJoin.CallHeaderButtonMode, 1); - - // // Set the call status text - // if (codec.ActiveCalls.Count > 0) - // { - // if (codec.ActiveCalls.Count == 1) - // TriList.SetString(UIStringJoin.HeaderCallStatusLabel, "1 Active Call"); - // else if (codec.ActiveCalls.Count > 1) - // TriList.SetString(UIStringJoin.HeaderCallStatusLabel, string.Format("{0} Active Calls", codec.ActiveCalls.Count)); - // } - // else - // TriList.SetString(UIStringJoin.HeaderCallStatusLabel, "No Active Calls"); - //} - /// /// /// diff --git a/Release Package/PepperDashEssentials.cpz b/Release Package/PepperDashEssentials.cpz index 080afe06..e0a109e4 100644 Binary files a/Release Package/PepperDashEssentials.cpz and b/Release Package/PepperDashEssentials.cpz differ diff --git a/Release Package/PepperDashEssentials.dll b/Release Package/PepperDashEssentials.dll index b8495e2e..cf210480 100644 Binary files a/Release Package/PepperDashEssentials.dll and b/Release Package/PepperDashEssentials.dll differ diff --git a/essentials-framework b/essentials-framework index 09ff7fdc..d351b879 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit 09ff7fdc86e72d4de5d8cf5dbc8cc057ef61bbc8 +Subproject commit d351b879c21418a7754d99041e0e33d954124335