From 59b2e9a8d6fe96241627a53c2ca43e50db70fb39 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Thu, 24 Oct 2019 11:28:13 -0600 Subject: [PATCH] Refactor complete --- .../CotijaEssentialsHuddleSpaceRoomBridge.cs | 2 +- PepperDashEssentials/ControlSystem.cs | 2 +- PepperDashEssentials/Factory/DeviceFactory.cs | 2 +- .../EssentialsHuddleVtc1FusionController.cs | 2 +- .../Room/Config/EssentialsRoomConfig.cs | 2 +- .../Room/Types/EssentialsDualDisplayRoom.cs | 112 +++++++++--------- .../Room/Types/EssentialsHuddleSpaceRoom.cs | 2 +- .../Room/Types/EssentialsHuddleVtc1Room.cs | 9 +- .../UI/EssentialsTouchpanelController.cs | 2 +- .../UI/SubpageReferenceListSourceItem.cs | 4 +- ...lsHuddleSpaceFusionSystemControllerBase.cs | 6 +- .../PepperDash_Essentials_Core.csproj | 1 + .../Room/Interfaces.cs | 4 + .../Touchpanels/Interfaces.cs | 14 +++ .../Factory/DeviceFactory.cs | 8 +- 15 files changed, 93 insertions(+), 79 deletions(-) create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Touchpanels/Interfaces.cs diff --git a/PepperDashEssentials/AppServer/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs b/PepperDashEssentials/AppServer/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs index 62a2957c..c5a9fcbf 100644 --- a/PepperDashEssentials/AppServer/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs +++ b/PepperDashEssentials/AppServer/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs @@ -93,7 +93,7 @@ namespace PepperDash.Essentials var sscRoom = Room as IHasCurrentSourceInfoChange; if(sscRoom != null) - sscRoom.CurrentSingleDisplaySourceChange += new SourceInfoChangeHandler(Room_CurrentSingleSourceChange); + sscRoom.CurrentSourceChange += new SourceInfoChangeHandler(Room_CurrentSingleSourceChange); var vcRoom = Room as IHasVideoCodec; if (vcRoom != null && vcRoom.VideoCodec != null) diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index c89f4948..151509f2 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -486,7 +486,7 @@ namespace PepperDash.Essentials DeviceManager.AddDevice(room); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleSpaceRoom, attempting to add to DeviceManager with Fusion"); - DeviceManager.AddDevice(new EssentialsHuddleSpaceFusionSystemControllerBase((EssentialsHuddleSpaceRoom)room, 0xf1)); + DeviceManager.AddDevice(new Core.Fusion.EssentialsHuddleSpaceFusionSystemControllerBase((EssentialsHuddleSpaceRoom)room, 0xf1)); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Cotija Bridge..."); diff --git a/PepperDashEssentials/Factory/DeviceFactory.cs b/PepperDashEssentials/Factory/DeviceFactory.cs index 8e83fb9d..ddee8361 100644 --- a/PepperDashEssentials/Factory/DeviceFactory.cs +++ b/PepperDashEssentials/Factory/DeviceFactory.cs @@ -87,7 +87,7 @@ namespace PepperDash.Essentials else if (typeName == "roomonwhenoccupancydetectedfeature") { - return new Room.Behaviours.RoomOnToDefaultSourceWhenOccupied(dc); + return new RoomOnToDefaultSourceWhenOccupied(dc); } return null; diff --git a/PepperDashEssentials/Fusion/EssentialsHuddleVtc1FusionController.cs b/PepperDashEssentials/Fusion/EssentialsHuddleVtc1FusionController.cs index 16d7e3d2..8ec55881 100644 --- a/PepperDashEssentials/Fusion/EssentialsHuddleVtc1FusionController.cs +++ b/PepperDashEssentials/Fusion/EssentialsHuddleVtc1FusionController.cs @@ -14,7 +14,7 @@ using PepperDash.Core; using PepperDash.Essentials; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; -using PepperDash.Core.Fusion; +using PepperDash.Essentials.Core.Fusion; using PepperDash.Essentials.Devices.Common; using PepperDash.Essentials.Devices.Common.Occupancy; diff --git a/PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs b/PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs index aa5fe12e..a6233f6d 100644 --- a/PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs +++ b/PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs @@ -65,7 +65,7 @@ namespace PepperDash.Essentials.Room.Config /// /// /// - public static PepperDash.Essentials.Devices.Common.Microphones.MicrophonePrivacyController GetMicrophonePrivacy( + public static Core.Privacy.MicrophonePrivacyController GetMicrophonePrivacy( EssentialsRoomPropertiesConfig props, EssentialsHuddleVtc1Room room) { var microphonePrivacy = props.MicrophonePrivacy; diff --git a/PepperDashEssentials/Room/Types/EssentialsDualDisplayRoom.cs b/PepperDashEssentials/Room/Types/EssentialsDualDisplayRoom.cs index 207fbf8d..4978744b 100644 --- a/PepperDashEssentials/Room/Types/EssentialsDualDisplayRoom.cs +++ b/PepperDashEssentials/Room/Types/EssentialsDualDisplayRoom.cs @@ -1,68 +1,68 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; +//using System; +//using System.Collections.Generic; +//using System.Linq; +//using System.Text; +//using Crestron.SimplSharp; -using Newtonsoft.Json; +//using Newtonsoft.Json; -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Devices; -using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Room.Config; -using PepperDash.Essentials.Devices.Common.Codec; -using PepperDash.Essentials.Devices.Common.VideoCodec; -using PepperDash.Essentials.Devices.Common.AudioCodec; +//using PepperDash.Core; +//using PepperDash.Essentials.Core; +//using PepperDash.Essentials.Core.Devices; +//using PepperDash.Essentials.Core.Config; +//using PepperDash.Essentials.Room.Config; +//using PepperDash.Essentials.Devices.Common.Codec; +//using PepperDash.Essentials.Devices.Common.VideoCodec; +//using PepperDash.Essentials.Devices.Common.AudioCodec; -namespace PepperDash.Essentials.Room.Types -{ - public class EssentialsDualDisplayRoom : EssentialsNDisplayRoomBase, IHasCurrentVolumeControls, - IRunRouteAction, IPrivacy, IPrivacy, IRunDefaultCallRoute, IHasVideoCodec, IHasAudioCodec - { - public event EventHandler CurrentVolumeDeviceChange; +//namespace PepperDash.Essentials.Room.Types +//{ +// public class EssentialsDualDisplayRoom : EssentialsNDisplayRoomBase, IHasCurrentVolumeControls, +// IRunRouteAction, IPrivacy, IRunDefaultCallRoute, IHasVideoCodec, IHasAudioCodec +// { +// public event EventHandler CurrentVolumeDeviceChange; - public EssentialsHuddleVtc1PropertiesConfig PropertiesConfig { get; private set; } +// public EssentialsHuddleVtc1PropertiesConfig PropertiesConfig { get; private set; } - //************************ - // Call-related stuff +// //************************ +// // Call-related stuff - public BoolFeedback InCallFeedback { get; private set; } +// public BoolFeedback InCallFeedback { get; private set; } - /// - /// States: 0 for on hook, 1 for video, 2 for audio, 3 for telekenesis - /// - public IntFeedback CallTypeFeedback { 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; } +// /// +// /// +// /// +// 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; } +// /// +// /// When something in the room is sharing with the far end or through other means +// /// +// public BoolFeedback IsSharingFeedback { get; private set; } - IRoutingSinkWithSwitching LeftDisplay { get; private set; } - IRoutingSinkWithSwitching RightDisplay { get; private set; } +// IRoutingSinkWithSwitching LeftDisplay { get; private set; } +// IRoutingSinkWithSwitching RightDisplay { get; private set; } - protected override Func OnFeedbackFunc - { - get - { - return () => - { - var leftDisp = LeftDisplay as DisplayBase; - var rightDisp = RightDisplay as DisplayBase; - var val = leftDisp != null && leftDisp.CurrentSourceInfo != null - && leftDisp.CurrentSourceInfo.Type == eSourceListItemType.Route - && rightDisp != null && rightDisp.CurrentSourceInfo != null - && rightDisp.CurrentSourceInfo.Type == eSourceListItemType.Route; - return val; - }; - } - } - } -} \ No newline at end of file +// protected override Func OnFeedbackFunc +// { +// get +// { +// return () => +// { +// var leftDisp = LeftDisplay as DisplayBase; +// var rightDisp = RightDisplay as DisplayBase; +// var val = leftDisp != null && leftDisp.CurrentSourceInfo != null +// && leftDisp.CurrentSourceInfo.Type == eSourceListItemType.Route +// && rightDisp != null && rightDisp.CurrentSourceInfo != null +// && rightDisp.CurrentSourceInfo.Type == eSourceListItemType.Route; +// return val; +// }; +// } +// } +// } +//} \ No newline at end of file diff --git a/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs b/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs index 429a6102..650a0eb5 100644 --- a/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs +++ b/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs @@ -13,7 +13,7 @@ using PepperDash.Essentials.Room.Config; namespace PepperDash.Essentials { - public class EssentialsHuddleSpaceRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange, IRunRouteAction, IRunDefaultPresentRoute, IHasCurrentVolumeControls + public class EssentialsHuddleSpaceRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange, IRunRouteAction, IRunDefaultPresentRoute, IHasCurrentVolumeControls, IHasDefaultDisplay { public event EventHandler CurrentVolumeDeviceChange; public event SourceInfoChangeHandler CurrentSourceChange; diff --git a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs index 3ea1705b..a6e2abee 100644 --- a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs +++ b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs @@ -16,8 +16,8 @@ using PepperDash.Essentials.Devices.Common.AudioCodec; namespace PepperDash.Essentials { - public class EssentialsHuddleVtc1Room : EssentialsRoomBase, IHasCurrentSourceInfoChange, - IPrivacy, IHasCurrentVolumeControls, IRunRouteAction, IRunDefaultCallRoute, IHasVideoCodec, IHasAudioCodec + public class EssentialsHuddleVtc1Room : EssentialsRoomBase, IHasCurrentSourceInfoChange, + IPrivacy, IHasCurrentVolumeControls, IRunRouteAction, IRunDefaultCallRoute, IHasVideoCodec, IHasAudioCodec, IHasDefaultDisplay { public event EventHandler CurrentVolumeDeviceChange; public event SourceInfoChangeHandler CurrentSourceChange; @@ -112,11 +112,6 @@ namespace PepperDash.Essentials public AudioCodecBase AudioCodec { 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; } diff --git a/PepperDashEssentials/UI/EssentialsTouchpanelController.cs b/PepperDashEssentials/UI/EssentialsTouchpanelController.cs index e15f5b6c..678355e3 100644 --- a/PepperDashEssentials/UI/EssentialsTouchpanelController.cs +++ b/PepperDashEssentials/UI/EssentialsTouchpanelController.cs @@ -13,7 +13,7 @@ using PepperDash.Essentials.Core.PageManagers; namespace PepperDash.Essentials { - public class EssentialsTouchpanelController : Device + public class EssentialsTouchpanelController : Device, IHasBasicTriListWithSmartObject { public BasicTriListWithSmartObject Panel { get; private set; } diff --git a/PepperDashEssentials/UI/SubpageReferenceListSourceItem.cs b/PepperDashEssentials/UI/SubpageReferenceListSourceItem.cs index e9701bae..8479d1e1 100644 --- a/PepperDashEssentials/UI/SubpageReferenceListSourceItem.cs +++ b/PepperDashEssentials/UI/SubpageReferenceListSourceItem.cs @@ -25,8 +25,8 @@ namespace PepperDash.Essentials public void RegisterForSourceChange(IHasCurrentSourceInfoChange room) { - room.CurrentSingleDisplaySourceChange -= room_CurrentSourceInfoChange; - room.CurrentSingleDisplaySourceChange += room_CurrentSourceInfoChange; + room.CurrentSourceChange -= room_CurrentSourceInfoChange; + room.CurrentSourceChange += room_CurrentSourceInfoChange; } void room_CurrentSourceInfoChange(EssentialsRoomBase room, SourceListItem info, ChangeType type) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs index e844e91f..a00b38b7 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs @@ -1123,7 +1123,7 @@ namespace PepperDash.Essentials.Core.Fusion //uint attrNum = Convert.ToUInt32(keyNum); // Check for UI devices - var uiDev = dev as EssentialsTouchpanelController; + var uiDev = dev as IHasBasicTriListWithSmartObject; if (uiDev != null) { if (uiDev.Panel is Crestron.SimplSharpPro.UI.XpanelForSmartGraphics) @@ -1204,7 +1204,7 @@ namespace PepperDash.Essentials.Core.Fusion display.UsageTracker.DeviceUsageEnded += new EventHandler(UsageTracker_DeviceUsageEnded); } - var defaultDisplay = (Room as EssentialsHuddleSpaceRoom).DefaultDisplay as DisplayBase; + var defaultDisplay = (Room as IHasDefaultDisplay).DefaultDisplay as DisplayBase; if (defaultDisplay == null) { Debug.Console(1, this, "Cannot link null display to Fusion because default display is null"); @@ -1269,7 +1269,7 @@ namespace PepperDash.Essentials.Core.Fusion string displayName = string.Format("Display {0} - ", displayIndex); - if (display == (Room as EssentialsHuddleSpaceRoom).DefaultDisplay) + if (display == (Room as IHasDefaultDisplay).DefaultDisplay) { // Display volume var defaultDisplayVolume = FusionRoom.CreateOffsetUshortSig(50, "Volume - Fader01", eSigIoMask.InputOutputSig); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj index 73ee7517..7c3cd563 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -229,6 +229,7 @@ + diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Interfaces.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Interfaces.cs index 8ce3a45d..e2a9f438 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Interfaces.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Interfaces.cs @@ -6,6 +6,10 @@ using Crestron.SimplSharp; namespace PepperDash.Essentials.Core { + public interface IHasDefaultDisplay + { + IRoutingSinkWithSwitching DefaultDisplay { get; } + } /// /// For rooms with routing diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Touchpanels/Interfaces.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Touchpanels/Interfaces.cs new file mode 100644 index 00000000..946f4f9d --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Touchpanels/Interfaces.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro.DeviceSupport; + +namespace PepperDash.Essentials.Core +{ + public interface IHasBasicTriListWithSmartObject + { + BasicTriListWithSmartObject Panel { get; } + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs index 6c2a86f3..671dec12 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs @@ -136,12 +136,12 @@ namespace PepperDash.Essentials.Devices.Common else if (typeName == "inroompc") { - return new InRoomPc(key, name); + return new Core.Devices.InRoomPc(key, name); } else if (typeName == "laptop") { - return new Laptop(key, name); + return new Core.Devices.Laptop(key, name); } else if (typeName == "mockvc") @@ -299,9 +299,9 @@ namespace PepperDash.Essentials.Devices.Common else if (typeName == "microphoneprivacycontroller") { - var props = JsonConvert.DeserializeObject(properties.ToString()); + var props = JsonConvert.DeserializeObject(properties.ToString()); - return new Microphones.MicrophonePrivacyController(key, props); + return new Core.Privacy.MicrophonePrivacyController(key, props); } else if (typeName == "roku") {