From 8feabcd536d504bc708a1115b4bd669412844cd4 Mon Sep 17 00:00:00 2001 From: Nick Genovese Date: Thu, 26 Oct 2023 21:53:10 -0400 Subject: [PATCH 01/21] feature: removed everything that had obsolete marked --- .../Bridges/JoinMaps/DigitalLoggerJoinMap.cs | 43 - .../JoinMaps/GlsPartitionSensorJoinMap.cs | 143 -- .../JoinMaps/VideoCodecControllerJoinMap.cs | 1327 ----------------- .../DeviceTypeInterfaces/IHasBranding.cs | 10 - .../DeviceTypeInterfaces/IHasPhoneDialing.cs | 14 - .../ILanguageDefinition.cs | 17 - .../DeviceTypeInterfaces/ILanguageProvider.cs | 12 - .../DeviceTypeInterfaces/IPower.cs | 11 - .../DeviceTypeInterfaces/LanguageLabel.cs | 12 - .../Devices/GenericMonitoredTcpDevice.cs | 29 - .../Devices/PresentationDeviceType.cs | 12 - .../Display/BasicIrDisplay.cs | 16 +- .../Display/DisplayBase.cs | 7 +- .../Factory/ReadyEventArgs.cs | 21 - .../JoinMaps/JoinMapBase.cs | 112 -- .../Queues/ComsMessage.cs | 72 - .../Queues/GenericQueue.cs | 292 +--- .../Queues/IQueue.cs | 14 - .../Queues/IQueueMessage.cs | 9 - .../Queues/ProcessStringMessage.cs | 44 - .../Queues/StringResponseProcessor.cs | 104 -- .../Routing/RoutingInterfaces.cs | 9 - .../Shades/Shade Interfaces.cs | 35 +- .../Audio/GenericAudioOut.cs | 2 +- .../Codec/iHasDirectory.cs | 6 - .../Display/ComTcpDisplayBase.cs | 45 - .../DigitalLoggerPropertiesConfig.cs | 25 - .../Power Controllers/Digitallogger.cs | 356 ----- .../SoftCodec/BlueJeansPc.cs | 6 +- .../VideoCodec/VideoCodecBase.cs | 3 - .../Devices/Amplifier.cs | 2 +- .../Room/Types/EssentialsDualDisplayRoom.cs | 4 +- .../EssentialsShadeDriver.cs | 2 +- 33 files changed, 27 insertions(+), 2789 deletions(-) delete mode 100644 src/PepperDash.Essentials.Core/Bridges/JoinMaps/DigitalLoggerJoinMap.cs delete mode 100644 src/PepperDash.Essentials.Devices.Common/Display/ComTcpDisplayBase.cs delete mode 100644 src/PepperDash.Essentials.Devices.Common/Power Controllers/DigitalLoggerPropertiesConfig.cs delete mode 100644 src/PepperDash.Essentials.Devices.Common/Power Controllers/Digitallogger.cs diff --git a/src/PepperDash.Essentials.Core/Bridges/JoinMaps/DigitalLoggerJoinMap.cs b/src/PepperDash.Essentials.Core/Bridges/JoinMaps/DigitalLoggerJoinMap.cs deleted file mode 100644 index 7959a511..00000000 --- a/src/PepperDash.Essentials.Core/Bridges/JoinMaps/DigitalLoggerJoinMap.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; - -namespace PepperDash.Essentials.Core.Bridges -{ - [Obsolete("This Device will be moved to a plugin in a future update")] - public class DigitalLoggerJoinMap : JoinMapBase - { - public uint IsOnline { get; set; } - public uint CircuitNames { get; set; } - public uint CircuitState { get; set; } - public uint CircuitCycle { get; set; } - public uint CircuitIsCritical { get; set; } - public uint CircuitOnCmd { get; set; } - public uint CircuitOffCmd { get; set; } - - public DigitalLoggerJoinMap() - { - // Digital - IsOnline = 9; - CircuitState = 0; - CircuitCycle = 0; - CircuitIsCritical = 10; - CircuitOnCmd = 10; - CircuitOffCmd = 20; - // Serial - CircuitNames = 0; - // Analog - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - IsOnline = IsOnline + joinOffset; - CircuitNames = CircuitNames + joinOffset; - CircuitState = CircuitState + joinOffset; - CircuitCycle = CircuitCycle + joinOffset; - CircuitIsCritical = CircuitIsCritical + joinOffset; - CircuitOnCmd = CircuitOnCmd + joinOffset; - CircuitOffCmd = CircuitOffCmd + joinOffset; - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Bridges/JoinMaps/GlsPartitionSensorJoinMap.cs b/src/PepperDash.Essentials.Core/Bridges/JoinMaps/GlsPartitionSensorJoinMap.cs index 0ee3d049..cb0f07b2 100644 --- a/src/PepperDash.Essentials.Core/Bridges/JoinMaps/GlsPartitionSensorJoinMap.cs +++ b/src/PepperDash.Essentials.Core/Bridges/JoinMaps/GlsPartitionSensorJoinMap.cs @@ -155,146 +155,3 @@ namespace PepperDash.Essentials.Core.Bridges.JoinMaps } } } - -namespace PepperDash_Essentials_Core.Bridges.JoinMaps -{ - /// - /// - /// - [Obsolete("use PepperDash.Essentials.Core.Bridges.JoinMaps version")] - public class GlsPartitionSensorJoinMap:JoinMapBaseAdvanced - { - [JoinName("IsOnline")] - public JoinDataComplete IsOnline = new JoinDataComplete( - new JoinData - { - JoinNumber = 1, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Sensor Is Online", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("Name")] - public JoinDataComplete Name = new JoinDataComplete( - new JoinData - { - JoinNumber = 1, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Sensor Name", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("Enable")] - public JoinDataComplete Enable = new JoinDataComplete( - new JoinData - { - JoinNumber = 2, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Sensor Enable", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("PartitionSensed")] - public JoinDataComplete PartitionSensed = new JoinDataComplete( - new JoinData - { - JoinNumber = 3, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Sensor Partition Sensed", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("PartitionNotSensed")] - public JoinDataComplete PartitionNotSensed = new JoinDataComplete( - new JoinData - { - JoinNumber = 4, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Sensor Partition Not Sensed", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("IncreaseSensitivity")] - public JoinDataComplete IncreaseSensitivity = new JoinDataComplete( - new JoinData - { - JoinNumber = 6, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Sensor Increase Sensitivity", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("DecreaseSensitivity")] - public JoinDataComplete DecreaseSensitivity = new JoinDataComplete( - new JoinData - { - JoinNumber = 7, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Sensor Decrease Sensitivity", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("Sensitivity")] - public JoinDataComplete Sensitivity = new JoinDataComplete( - new JoinData - { - JoinNumber = 2, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Sensor Sensitivity", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Analog - }); - - /// - /// Constructor to use when instantiating this Join Map without inheriting from it - /// - /// Join this join map will start at - public GlsPartitionSensorJoinMap(uint joinStart) - : this(joinStart, typeof(GlsPartitionSensorJoinMap)) - { - - } - - /// - /// Constructor to use when extending this Join map - /// - /// Join this join map will start at - /// Type of the child join map - protected GlsPartitionSensorJoinMap(uint joinStart, Type type) - : base(joinStart, type) - { - - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Bridges/JoinMaps/VideoCodecControllerJoinMap.cs b/src/PepperDash.Essentials.Core/Bridges/JoinMaps/VideoCodecControllerJoinMap.cs index 74131e2b..755a586e 100644 --- a/src/PepperDash.Essentials.Core/Bridges/JoinMaps/VideoCodecControllerJoinMap.cs +++ b/src/PepperDash.Essentials.Core/Bridges/JoinMaps/VideoCodecControllerJoinMap.cs @@ -1849,1330 +1849,3 @@ namespace PepperDash.Essentials.Core.Bridges.JoinMaps } } } - - -namespace PepperDash_Essentials_Core.Bridges.JoinMaps -{ - [Obsolete("Use PepperDash.Essentials.Core.Bridges.JoinMaps")] - public class VideoCodecControllerJoinMap : JoinMapBaseAdvanced - { - - #region Digital - - [JoinName("IsOnline")] - public JoinDataComplete IsOnline = new JoinDataComplete( - new JoinData - { - JoinNumber = 1, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Device is Online", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("1")] - public JoinDataComplete Dtmf1 = new JoinDataComplete( - new JoinData - { - JoinNumber = 11, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "DTMF 1", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("2")] - public JoinDataComplete Dtmf2 = new JoinDataComplete( - new JoinData - { - JoinNumber = 12, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "DTMF 2", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("3")] - public JoinDataComplete Dtmf3 = new JoinDataComplete( - new JoinData - { - JoinNumber = 13, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "DTMF 3", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("4")] - public JoinDataComplete Dtmf4 = new JoinDataComplete( - new JoinData - { - JoinNumber = 14, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "DTMF 4", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("5")] - public JoinDataComplete Dtmf5 = new JoinDataComplete( - new JoinData - { - JoinNumber = 15, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "DTMF 5", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("6")] - public JoinDataComplete Dtmf6 = new JoinDataComplete( - new JoinData - { - JoinNumber = 16, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "DTMF 6", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("7")] - public JoinDataComplete Dtmf7 = new JoinDataComplete( - new JoinData - { - JoinNumber = 17, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "DTMF 7", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("8")] - public JoinDataComplete Dtmf8 = new JoinDataComplete( - new JoinData - { - JoinNumber = 18, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "DTMF 8", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("9")] - public JoinDataComplete Dtmf9 = new JoinDataComplete( - new JoinData - { - JoinNumber = 19, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "DTMF 9", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("0")] - public JoinDataComplete Dtmf0 = new JoinDataComplete( - new JoinData - { - JoinNumber = 20, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "DTMF 0", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("*")] - public JoinDataComplete DtmfStar = new JoinDataComplete( - new JoinData - { - JoinNumber = 21, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "DTMF *", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("#")] - public JoinDataComplete DtmfPound = new JoinDataComplete( - new JoinData - { - JoinNumber = 22, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "DTMF #", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("EndCall")] - public JoinDataComplete EndCall = new JoinDataComplete( - new JoinData - { - JoinNumber = 24, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Hang Up", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("HookState")] - public JoinDataComplete HookState = new JoinDataComplete( - new JoinData - { - JoinNumber = 31, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Current Hook State", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("SpeedDialStart")] - public JoinDataComplete SpeedDialStart = new JoinDataComplete( - new JoinData - { - JoinNumber = 41, - JoinSpan = 4 - }, - new JoinMetadata - { - Description = "Speed Dial", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("IncomingCall")] - public JoinDataComplete IncomingCall = new JoinDataComplete( - new JoinData - { - JoinNumber = 50, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Incoming Call", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("IncomingAnswer")] - public JoinDataComplete IncomingAnswer = new JoinDataComplete( - new JoinData - { - JoinNumber = 51, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Answer Incoming Call", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("IncomingReject")] - public JoinDataComplete IncomingReject = new JoinDataComplete( - new JoinData - { - JoinNumber = 52, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Reject Incoming Call", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("ManualDial")] - public JoinDataComplete ManualDial = new JoinDataComplete( - new JoinData - { - JoinNumber = 71, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Dial manual string", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("DialPhoneCall")] - public JoinDataComplete DialPhone = new JoinDataComplete( - new JoinData - { - JoinNumber = 72, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Dial Phone", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("PhoneHookState")] - public JoinDataComplete PhoneHookState = new JoinDataComplete( - new JoinData - { - JoinNumber = 72, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Dial Phone", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("EndPhoneCall")] - public JoinDataComplete HangUpPhone = new JoinDataComplete( - new JoinData - { - JoinNumber = 73, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Hang Up PHone", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("DirectorySearchBusy")] - public JoinDataComplete DirectorySearchBusy = new JoinDataComplete( - new JoinData - { - JoinNumber = 100, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Directory Search Busy FB", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("DirectoryEntryIsContact")] - public JoinDataComplete DirectoryEntryIsContact = new JoinDataComplete( - new JoinData - { - JoinNumber = 101, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Directory Selected Entry Is Contact FB", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("DirectoryLineSelected")] - public JoinDataComplete DirectoryLineSelected = new JoinDataComplete( - new JoinData - { - JoinNumber = 101, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Directory Line Selected FB", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("DirectoryIsRoot")] - public JoinDataComplete DirectoryIsRoot = new JoinDataComplete( - new JoinData - { - JoinNumber = 102, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Directory is on Root FB", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("DirectoryHasChanged")] - public JoinDataComplete DirectoryHasChanged = new JoinDataComplete( - new JoinData - { - JoinNumber = 103, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Directory has changed FB", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("DirectoryRoot")] - public JoinDataComplete DirectoryRoot = new JoinDataComplete( - new JoinData - { - JoinNumber = 104, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Go to Directory Root", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("DirectoryFolderBack")] - public JoinDataComplete DirectoryFolderBack = new JoinDataComplete( - new JoinData - { - JoinNumber = 105, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Go back one directory level", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("DirectoryDialSelectedLine")] - public JoinDataComplete DirectoryDialSelectedLine = new JoinDataComplete( - new JoinData - { - JoinNumber = 106, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Dial selected directory line", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - - [JoinName("CameraTiltUp")] - public JoinDataComplete CameraTiltUp = new JoinDataComplete( - new JoinData - { - JoinNumber = 111, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Tilt Up", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("CameraTiltDown")] - public JoinDataComplete CameraTiltDown = new JoinDataComplete( - new JoinData - { - JoinNumber = 112, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Tilt Down", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("CameraPanLeft")] - public JoinDataComplete CameraPanLeft = new JoinDataComplete( - new JoinData - { - JoinNumber = 113, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Pan Left", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("CameraPanRight")] - public JoinDataComplete CameraPanRight = new JoinDataComplete( - new JoinData - { - JoinNumber = 114, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Pan Right", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("CameraZoomIn")] - public JoinDataComplete CameraZoomIn = new JoinDataComplete( - new JoinData - { - JoinNumber = 115, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Zoom In", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("CameraZoomOut")] - public JoinDataComplete CameraZoomOut = new JoinDataComplete( - new JoinData - { - JoinNumber = 116, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Zoom Out", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("CameraPresetSave")] - public JoinDataComplete CameraPresetSave = new JoinDataComplete( - new JoinData - { - JoinNumber = 121, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Save Selected Preset", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("CameraModeAuto")] - public JoinDataComplete CameraModeAuto = new JoinDataComplete( - new JoinData - { - JoinNumber = 131, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Mode Auto", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("CameraModeManual")] - public JoinDataComplete CameraModeManual = new JoinDataComplete( - new JoinData - { - JoinNumber = 132, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Mode Manual", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("CameraModeOff")] - public JoinDataComplete CameraModeOff = new JoinDataComplete( - new JoinData - { - JoinNumber = 133, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Mode Off", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("CameraSelfView")] - public JoinDataComplete CameraSelfView = new JoinDataComplete( - new JoinData - { - JoinNumber = 141, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Self View Toggle/FB", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("CameraLayout")] - public JoinDataComplete CameraLayout = new JoinDataComplete( - new JoinData - { - JoinNumber = 142, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Layout Toggle", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("CameraSupportsAutoMode")] - public JoinDataComplete CameraSupportsAutoMode = new JoinDataComplete( - new JoinData - { - JoinNumber = 143, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Supports Auto Mode FB", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("CameraSupportsOffMode")] - public JoinDataComplete CameraSupportsOffMode = new JoinDataComplete( - new JoinData - { - JoinNumber = 144, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Supports Off Mode FB", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("UpdateMeetings")] - public JoinDataComplete UpdateMeetings = new JoinDataComplete( - new JoinData - { - JoinNumber = 160, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Update Meetings", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("DialMeeting1")] - public JoinDataComplete DialMeeting1 = new JoinDataComplete( - new JoinData - { - JoinNumber = 161, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Join first meeting", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("DialMeeting2")] - public JoinDataComplete DialMeeting2 = new JoinDataComplete( - new JoinData - { - JoinNumber = 162, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Join second meeting", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("DialMeeting3")] - public JoinDataComplete DialMeeting3 = new JoinDataComplete( - new JoinData - { - JoinNumber = 163, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Join third meeting", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("MicMuteOn")] - public JoinDataComplete MicMuteOn = new JoinDataComplete( - new JoinData - { - JoinNumber = 171, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Mic Mute On", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("MicMuteOff")] - public JoinDataComplete MicMuteOff = new JoinDataComplete( - new JoinData - { - JoinNumber = 172, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Mic Mute Off", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("MicMuteToggle")] - public JoinDataComplete MicMuteToggle = new JoinDataComplete( - new JoinData - { - JoinNumber = 173, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Mic Mute Toggle", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("VolumeUp")] - public JoinDataComplete VolumeUp = new JoinDataComplete( - new JoinData - { - JoinNumber = 174, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Volume Up", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("VolumeDown")] - public JoinDataComplete VolumeDown = new JoinDataComplete( - new JoinData - { - JoinNumber = 175, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Volume Down", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("VolumeMuteOn")] - public JoinDataComplete VolumeMuteOn = new JoinDataComplete( - new JoinData - { - JoinNumber = 176, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Volume Mute On", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("VolumeMuteOff")] - public JoinDataComplete VolumeMuteOff = new JoinDataComplete( - new JoinData - { - JoinNumber = 177, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Volume Mute Off", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("VolumeMuteToggle")] - public JoinDataComplete VolumeMuteToggle = new JoinDataComplete( - new JoinData - { - JoinNumber = 178, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Volume Mute Toggle", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("SourceShareStart")] - public JoinDataComplete SourceShareStart = new JoinDataComplete( - new JoinData - { - JoinNumber = 201, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Start Sharing & Feedback", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("SourceShareEnd")] - public JoinDataComplete SourceShareEnd = new JoinDataComplete( - new JoinData - { - JoinNumber = 202, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Stop Sharing & Feedback", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("AutoShareWhileInCall")] - public JoinDataComplete SourceShareAutoStart = new JoinDataComplete( - new JoinData - { - JoinNumber = 203, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "When high, will autostart sharing when a call is joined", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("RecievingContent")] - public JoinDataComplete RecievingContent = new JoinDataComplete( - new JoinData - { - JoinNumber = 204, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Recieving content from the far end", - JoinType = eJoinType.Digital, - JoinCapabilities = eJoinCapabilities.ToSIMPL - }); - - [JoinName("SelfviewPosition")] - public JoinDataComplete SelfviewPosition = new JoinDataComplete( - new JoinData - { - JoinNumber = 211, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "advance selfview position", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("ParticipantAudioMuteToggleStart")] - public JoinDataComplete ParticipantAudioMuteToggleStart = new JoinDataComplete( - new JoinData - { - JoinNumber = 500, - JoinSpan = 50 - }, - new JoinMetadata - { - Description = "Toggles the participant's audio mute status", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("ParticipantVideoMuteToggleStart")] - public JoinDataComplete ParticipantVideoMuteToggleStart = new JoinDataComplete( - new JoinData - { - JoinNumber = 800, - JoinSpan = 50 - }, - new JoinMetadata - { - Description = "Toggles the participant's video mute status", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("ParticipantPinToggleStart")] - public JoinDataComplete ParticipantPinToggleStart = new JoinDataComplete( - new JoinData - { - JoinNumber = 1100, - JoinSpan = 50 - }, - new JoinMetadata - { - Description = "Toggles the participant's pin status", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - #endregion - - - - #region Analog - - [JoinName("MinutesBeforeMeetingStart")] - public JoinDataComplete MinutesBeforeMeetingStart = new JoinDataComplete( - new JoinData - { - JoinNumber = 41, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Minutes before meeting start that a meeting is joinable", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Analog - }); - - [JoinName("CameraNumberSelect")] - public JoinDataComplete CameraNumberSelect = new JoinDataComplete( - new JoinData - { - JoinNumber = 60, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Number Select/FB", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Analog - }); - - [JoinName("DirectoryRowCount")] - public JoinDataComplete DirectoryRowCount = new JoinDataComplete( - new JoinData - { - JoinNumber = 101, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Directory Row Count FB", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Analog - }); - - [JoinName("DirectorySelectRow")] - public JoinDataComplete DirectorySelectRow = new JoinDataComplete( - new JoinData - { - JoinNumber = 101, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Directory Select Row", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Analog - }); - - [JoinName("CameraPresetSelect")] - public JoinDataComplete CameraPresetSelect = new JoinDataComplete( - new JoinData - { - JoinNumber = 121, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Preset Select", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Analog - }); - - [JoinName("ParticipantCount")] - public JoinDataComplete ParticipantCount = new JoinDataComplete( - new JoinData - { - JoinNumber = 151, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Current Participant Count", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Analog - }); - - [JoinName("Meeting Count Fb")] - public JoinDataComplete MeetingCount = new JoinDataComplete( - new JoinData - { - JoinNumber = 161, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Meeting Count", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Analog - }); - - [JoinName("VolumeLevel")] - public JoinDataComplete VolumeLevel = new JoinDataComplete( - new JoinData - { - JoinNumber = 174, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Volume Level", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Analog - }); - - #endregion - - - - #region Serials - - [JoinName("CurrentDialString")] - public JoinDataComplete CurrentDialString = new JoinDataComplete( - new JoinData - { - JoinNumber = 1, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Current Dial String", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("PhoneString")] - public JoinDataComplete PhoneDialString = new JoinDataComplete( - new JoinData - { - JoinNumber = 2, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Phone Dial String", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("CurrentCallName")] - public JoinDataComplete CurrentCallData = new JoinDataComplete( - new JoinData - { - JoinNumber = 2, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Current Call Data - XSIG", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("CallDirection")] - public JoinDataComplete CallDirection = new JoinDataComplete( - new JoinData - { - JoinNumber = 22, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Current Call Direction", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("IncomingCallName")] - public JoinDataComplete IncomingCallName = new JoinDataComplete( - new JoinData - { - JoinNumber = 51, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Incoming Call Name", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("IncomingCallNumber")] - public JoinDataComplete IncomingCallNumber = new JoinDataComplete( - new JoinData - { - JoinNumber = 52, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Incoming Call Number", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - - [JoinName("DirectorySearchString")] - public JoinDataComplete DirectorySearchString = new JoinDataComplete( - new JoinData - { - JoinNumber = 100, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Directory Search String", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("DirectoryEntries")] - public JoinDataComplete DirectoryEntries = new JoinDataComplete( - new JoinData - { - JoinNumber = 101, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Directory Entries - XSig, 255 entries", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("Schedule")] - public JoinDataComplete Schedule = new JoinDataComplete( - new JoinData - { - JoinNumber = 102, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Schedule Data - XSIG", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("CameraPresetNames")] - public JoinDataComplete CameraPresetNames = new JoinDataComplete( - new JoinData - { - JoinNumber = 121, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Preset Names - XSIG, max of 15", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("CameraLayoutStringFb")] - public JoinDataComplete CameraLayoutStringFb = new JoinDataComplete( - new JoinData - { - JoinNumber = 141, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Current Layout Fb", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("AvailableLayoutsFb")] - public JoinDataComplete AvailableLayoutsFb = new JoinDataComplete( - new JoinData - { - JoinNumber = 142, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "xSig of all available layouts", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("SelectLayout")] - public JoinDataComplete SelectLayout = new JoinDataComplete( - new JoinData - { - JoinNumber = 142, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Select Layout by string", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Serial - }); - - - [JoinName("CurrentParticipants")] - public JoinDataComplete CurrentParticipants = new JoinDataComplete( - new JoinData - { - JoinNumber = 151, - JoinSpan = 1 - }, - new JoinMetadata() - { - Description = "Current Participants XSig", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("CurrentSource")] - public JoinDataComplete CurrentSource = new JoinDataComplete( - new JoinData - { - JoinNumber = 201, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Current Source", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("SelfviewPositionFb")] - public JoinDataComplete SelfviewPositionFb = new JoinDataComplete( - new JoinData - { - JoinNumber = 211, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "advance selfview position", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("DirectoryEntrySelectedName")] - public JoinDataComplete DirectoryEntrySelectedName = new JoinDataComplete( - new JoinData - { - JoinNumber = 356, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Selected Directory Entry Name", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("DirectoryEntrySelectedNumber")] - public JoinDataComplete DirectoryEntrySelectedNumber = new JoinDataComplete( - new JoinData - { - JoinNumber = 357, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Selected Directory Entry Number", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("DirectorySelectedFolderName")] - public JoinDataComplete DirectorySelectedFolderName = new JoinDataComplete( - new JoinData - { - JoinNumber = 358, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Selected Directory Folder Name", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - #endregion - - - public VideoCodecControllerJoinMap(uint joinStart) - : base(joinStart, typeof(VideoCodecControllerJoinMap)) - { - } - - public VideoCodecControllerJoinMap(uint joinStart, Type type) - : base(joinStart, type) - { - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasBranding.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasBranding.cs index 63f4917a..10db107f 100644 --- a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasBranding.cs +++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasBranding.cs @@ -7,14 +7,4 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces bool BrandingEnabled { get; } void InitializeBranding(string roomKey); } -} - -namespace PepperDash_Essentials_Core.DeviceTypeInterfaces -{ - [Obsolete("Use PepperDash.Essentials.Core.DeviceTypeInterfaces")] - public interface IHasBranding - { - bool BrandingEnabled { get; } - void InitializeBranding(string roomKey); - } } \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasPhoneDialing.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasPhoneDialing.cs index 7f75adec..cd208d4b 100644 --- a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasPhoneDialing.cs +++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasPhoneDialing.cs @@ -12,18 +12,4 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces void EndPhoneCall(); void SendDtmfToPhone(string digit); } -} - -namespace PepperDash_Essentials_Core.DeviceTypeInterfaces -{ - [Obsolete("Use PepperDash.Essentials.Core.DeviceTypeInterfaces")] - public interface IHasPhoneDialing - { - BoolFeedback PhoneOffHookFeedback { get; } - StringFeedback CallerIdNameFeedback { get; } - StringFeedback CallerIdNumberFeedback { get; } - void DialPhoneCall(string number); - void EndPhoneCall(); - void SendDtmfToPhone(string digit); - } } \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ILanguageDefinition.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ILanguageDefinition.cs index abf138a4..181cac35 100644 --- a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ILanguageDefinition.cs +++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ILanguageDefinition.cs @@ -16,20 +16,3 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces List RoomNames { get; set; } } } - -namespace PepperDash_Essentials_Core.DeviceTypeInterfaces -{ - [Obsolete("Use PepperDash.Essentials.Core.DeviceTypeInterfaces")] - public interface ILanguageDefinition - { - string LocaleName { get; set; } - string FriendlyName { get; set; } - bool Enable { get; set; } - List UiLabels { get; set; } - List Sources { get; set; } - List Destinations { get; set; } - List SourceGroupNames { get; set; } - List DestinationGroupNames { get; set; } - List RoomNames { get; set; } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ILanguageProvider.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ILanguageProvider.cs index dd48723d..428f78c3 100644 --- a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ILanguageProvider.cs +++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ILanguageProvider.cs @@ -11,15 +11,3 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces } } - -namespace PepperDash_Essentials_Core.DeviceTypeInterfaces -{ - [Obsolete("Use PepperDash.Essentials.Core.DeviceTypeInterfaces")] - public interface ILanguageProvider - { - ILanguageDefinition CurrentLanguage { get; set; } - - event EventHandler CurrentLanguageChanged; - } - -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IPower.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IPower.cs index 0fcf32e9..b7c3345e 100644 --- a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IPower.cs +++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IPower.cs @@ -13,17 +13,6 @@ using PepperDash.Essentials.Core.SmartObjects; namespace PepperDash.Essentials.Core { - /// - /// Defines the ability to power a device on and off - /// - [Obsolete("Will be replaced by IHasPowerControlWithFeedback")] - public interface IPower - { - void PowerOn(); - void PowerOff(); - void PowerToggle(); - BoolFeedback PowerIsOnFeedback { get; } - } /// /// Adds feedback for current power state diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/LanguageLabel.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/LanguageLabel.cs index c7d26722..890d1416 100644 --- a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/LanguageLabel.cs +++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/LanguageLabel.cs @@ -10,16 +10,4 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces public string DisplayText { get; set; } public uint JoinNumber { get; set; } } -} - -namespace PepperDash_Essentials_Core.DeviceTypeInterfaces -{ - [Obsolete("Use PepperDash.Essentials.Core.DeviceTypeInterfaces")] - public class LanguageLabel - { - public string Key { get; set; } - public string Description { get; set; } - public string DisplayText { get; set; } - public uint JoinNumber { get; set; } - } } \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Devices/GenericMonitoredTcpDevice.cs b/src/PepperDash.Essentials.Core/Devices/GenericMonitoredTcpDevice.cs index e7267782..1bf8edb9 100644 --- a/src/PepperDash.Essentials.Core/Devices/GenericMonitoredTcpDevice.cs +++ b/src/PepperDash.Essentials.Core/Devices/GenericMonitoredTcpDevice.cs @@ -35,35 +35,6 @@ namespace PepperDash.Essentials.Core.Devices { } - - /// - /// Generic monitor for TCP reachability. Default with 30s poll, 120s warning and 300s error times - /// - [Obsolete] - public GenericCommunicationMonitoredDevice(string key, string name, string hostname, int port, string pollString) - : this(key, name, hostname, port, pollString, 30000, 120000, 300000) - { - } - - /// - /// Monitor for TCP reachability - /// - [Obsolete] - public GenericCommunicationMonitoredDevice(string key, string name, string hostname, int port, string pollString, - long pollTime, long warningTime, long errorTime) - : base(key, name) - { - Client = new GenericTcpIpClient(key + "-tcp", hostname, port, 512); - CommunicationMonitor = new GenericCommunicationMonitor(this, Client, pollTime, warningTime, errorTime, pollString); - - // ------------------------------------------------------DELETE THIS - CommunicationMonitor.StatusChange += (o, a) => - { - Debug.Console(2, this, "Communication monitor status change: {0}", a.Status); - }; - } - - public override bool CustomActivate() { CommunicationMonitor.Start(); diff --git a/src/PepperDash.Essentials.Core/Devices/PresentationDeviceType.cs b/src/PepperDash.Essentials.Core/Devices/PresentationDeviceType.cs index adb427fb..41555ae8 100644 --- a/src/PepperDash.Essentials.Core/Devices/PresentationDeviceType.cs +++ b/src/PepperDash.Essentials.Core/Devices/PresentationDeviceType.cs @@ -9,18 +9,6 @@ using Crestron.SimplSharpPro.UI; namespace PepperDash.Essentials.Core { - //[Obsolete] - //public class PresentationDeviceType - //{ - // public const ushort Default = 1; - // public const ushort CableSetTopBox = 2; - // public const ushort SatelliteSetTopBox = 3; - // public const ushort Dvd = 4; - // public const ushort Bluray = 5; - // public const ushort PC = 9; - // public const ushort Laptop = 10; - //} - public enum PresentationSourceType { None, Dvd, Laptop, PC, SetTopBox, VCR diff --git a/src/PepperDash.Essentials.Core/Display/BasicIrDisplay.cs b/src/PepperDash.Essentials.Core/Display/BasicIrDisplay.cs index 7a8eb8b1..00124ae7 100644 --- a/src/PepperDash.Essentials.Core/Display/BasicIrDisplay.cs +++ b/src/PepperDash.Essentials.Core/Display/BasicIrDisplay.cs @@ -20,9 +20,6 @@ namespace PepperDash.Essentials.Core public IrOutputPortController IrPort { get; private set; } public ushort IrPulseTime { get; set; } - [Obsolete("This property will be removed in version 2.0.0")] - public override BoolFeedback PowerIsOnFeedback { get; protected set; } - protected Func PowerIsOnFeedbackFunc { get { return () => _PowerIsOn; } @@ -46,14 +43,6 @@ namespace PepperDash.Essentials.Core IrPort = new IrOutputPortController(key + "-ir", port, irDriverFilepath); DeviceManager.AddDevice(IrPort); - PowerIsOnFeedback = new BoolFeedback(PowerIsOnFeedbackFunc); - - PowerIsOnFeedback.OutputChange += (o, a) => - { - Debug.Console(2, this, "Power on={0}", _PowerIsOn); - if (_PowerIsOn) StartWarmingTimer(); - else StartCoolingTimer(); - }; IsWarmingUpFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Warming up={0}", _IsWarmingUp); IsCoolingDownFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Cooling down={0}", _IsCoolingDown); @@ -117,20 +106,17 @@ namespace PepperDash.Essentials.Core { IrPort.Pulse(IROutputStandardCommands.IROut_POWER_ON, IrPulseTime); _PowerIsOn = true; - PowerIsOnFeedback.FireUpdate(); } public override void PowerOff() { _PowerIsOn = false; - PowerIsOnFeedback.FireUpdate(); IrPort.Pulse(IROutputStandardCommands.IROut_POWER_OFF, IrPulseTime); } public override void PowerToggle() { _PowerIsOn = false; - PowerIsOnFeedback.FireUpdate(); IrPort.Pulse(IROutputStandardCommands.IROut_POWER, IrPulseTime); } @@ -193,7 +179,7 @@ namespace PepperDash.Essentials.Core action(); }; - if (!PowerIsOnFeedback.BoolValue) + if (!_PowerIsOn) { PowerOn(); EventHandler oneTimer = null; diff --git a/src/PepperDash.Essentials.Core/Display/DisplayBase.cs b/src/PepperDash.Essentials.Core/Display/DisplayBase.cs index a8de2796..6101d232 100644 --- a/src/PepperDash.Essentials.Core/Display/DisplayBase.cs +++ b/src/PepperDash.Essentials.Core/Display/DisplayBase.cs @@ -20,7 +20,7 @@ namespace PepperDash.Essentials.Core /// /// /// - public abstract class DisplayBase : EssentialsDevice, IHasFeedback, IRoutingSinkWithSwitching, IHasPowerControl, IWarmingCooling, IUsageTracking, IPower + public abstract class DisplayBase : EssentialsDevice, IHasFeedback, IRoutingSinkWithSwitching, IHasPowerControl, IWarmingCooling, IUsageTracking { public event SourceInfoChangeHandler CurrentSourceChange; @@ -51,9 +51,6 @@ namespace PepperDash.Essentials.Core public BoolFeedback IsCoolingDownFeedback { get; protected set; } public BoolFeedback IsWarmingUpFeedback { get; private set; } - [Obsolete("This property will be removed in version 2.0.0")] - public abstract BoolFeedback PowerIsOnFeedback { get; protected set; } - public UsageTracking UsageTracker { get; set; } public uint WarmupTime { get; set; } @@ -269,7 +266,7 @@ namespace PepperDash.Essentials.Core abstract protected Func CurrentInputFeedbackFunc { get; } - public override BoolFeedback PowerIsOnFeedback { get; protected set; } + public BoolFeedback PowerIsOnFeedback { get; protected set; } abstract protected Func PowerIsOnFeedbackFunc { get; } diff --git a/src/PepperDash.Essentials.Core/Factory/ReadyEventArgs.cs b/src/PepperDash.Essentials.Core/Factory/ReadyEventArgs.cs index be8369d2..6ccc0600 100644 --- a/src/PepperDash.Essentials.Core/Factory/ReadyEventArgs.cs +++ b/src/PepperDash.Essentials.Core/Factory/ReadyEventArgs.cs @@ -23,24 +23,3 @@ namespace PepperDash.Essentials.Core bool IsReady { get; } } } - -namespace PepperDash_Essentials_Core -{ - [Obsolete("Use PepperDash.Essentials.Core")] - public class IsReadyEventArgs : EventArgs - { - public bool IsReady { get; set; } - - public IsReadyEventArgs(bool data) - { - IsReady = data; - } - } - - [Obsolete("Use PepperDash.Essentials.Core")] - public interface IHasReady - { - event EventHandler IsReadyEvent; - bool IsReady { get; } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBase.cs b/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBase.cs index 6dff477d..0f5519eb 100644 --- a/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBase.cs +++ b/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBase.cs @@ -81,97 +81,6 @@ namespace PepperDash.Essentials.Core } - /// - /// Base class for join maps - /// - [Obsolete("This is being deprecated in favor of JoinMapBaseAdvanced")] - public abstract class JoinMapBase - { - /// - /// Modifies all the join numbers by adding the offset. This should never be called twice - /// - /// - public abstract void OffsetJoinNumbers(uint joinStart); - - /// - /// The collection of joins and associated metadata - /// - public Dictionary Joins = new Dictionary(); - - /// - /// Prints the join information to console - /// - public void PrintJoinMapInfo() - { - CrestronConsole.ConsoleCommandResponse("{0}:\n", GetType().Name); - - // Get the joins of each type and print them - CrestronConsole.ConsoleCommandResponse("Digitals:"); - var digitals = Joins.Where(j => (j.Value.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value); - CrestronConsole.ConsoleCommandResponse("Found {0} Digital Joins", digitals.Count); - PrintJoinList(GetSortedJoins(digitals)); - - CrestronConsole.ConsoleCommandResponse("Analogs:"); - var analogs = Joins.Where(j => (j.Value.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value); - CrestronConsole.ConsoleCommandResponse("Found {0} Analog Joins", analogs.Count); - PrintJoinList(GetSortedJoins(analogs)); - - CrestronConsole.ConsoleCommandResponse("Serials:"); - var serials = Joins.Where(j => (j.Value.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value); - CrestronConsole.ConsoleCommandResponse("Found {0} Serial Joins", serials.Count); - PrintJoinList(GetSortedJoins(serials)); - - } - - /// - /// Returns a sorted list by JoinNumber - /// - /// - /// - List> GetSortedJoins(Dictionary joins) - { - var sortedJoins = joins.ToList(); - - sortedJoins.Sort((pair1, pair2) => pair1.Value.JoinNumber.CompareTo(pair2.Value.JoinNumber)); - - return sortedJoins; - } - - void PrintJoinList(List> joins) - { - foreach (var join in joins) - { - CrestronConsole.ConsoleCommandResponse( - @"Join Number: {0} | Label: '{1}' | JoinSpan: '{2}' | Type: '{3}' | Capabilities: '{4}'", - join.Value.JoinNumber, - join.Value.Label, - join.Value.JoinSpan, - join.Value.JoinType.ToString(), - join.Value.JoinCapabilities.ToString()); - } - } - - /// - /// Returns the join number for the join with the specified key - /// - /// - /// - public uint GetJoinForKey(string key) - { - return Joins.ContainsKey(key) ? Joins[key].JoinNumber : 0; - } - - /// - /// Returns the join span for the join with the specified key - /// - /// - /// - public uint GetJoinSpanForKey(string key) - { - return Joins.ContainsKey(key) ? Joins[key].JoinSpan : 0; - } - } - /// /// Base class for join maps /// @@ -432,27 +341,6 @@ namespace PepperDash.Essentials.Core public class JoinMetadata { private string _description; - - /// - /// Join number (based on join offset value) - /// - [JsonProperty("joinNumber")] - [Obsolete] - public uint JoinNumber { get; set; } - /// - /// Join range span. If join indicates the start of a range of joins, this indicated the maximum number of joins in the range - /// - [Obsolete] - [JsonProperty("joinSpan")] - public uint JoinSpan { get; set; } - - /// - /// A label for the join to better describe its usage - /// - [Obsolete("Use Description instead")] - [JsonProperty("label")] - public string Label { get { return _description; } set { _description = value; } } - /// /// A description for the join to better describe its usage /// diff --git a/src/PepperDash.Essentials.Core/Queues/ComsMessage.cs b/src/PepperDash.Essentials.Core/Queues/ComsMessage.cs index 3c01032e..596c5921 100644 --- a/src/PepperDash.Essentials.Core/Queues/ComsMessage.cs +++ b/src/PepperDash.Essentials.Core/Queues/ComsMessage.cs @@ -62,78 +62,6 @@ namespace PepperDash.Essentials.Core.Queues } } - /// - /// Shows either the byte[] or string to be sent - /// - public override string ToString() - { - return _bytes != null ? _bytes.ToString() : _string; - } - } -} - -namespace PepperDash_Essentials_Core.Queues -{ - /// - /// IBasicCommunication Message for IQueue - /// - [Obsolete("Use PepperDash.Essentials.Core.Queues")] - public class ComsMessage : IQueueMessage - { - private readonly byte[] _bytes; - private readonly IBasicCommunication _coms; - private readonly string _string; - private readonly bool _isByteMessage; - - /// - /// Constructor for a string message - /// - /// IBasicCommunication to send the message - /// Message to send - public ComsMessage(IBasicCommunication coms, string message) - { - Validate(coms, message); - _coms = coms; - _string = message; - } - - /// - /// Constructor for a byte message - /// - /// IBasicCommunication to send the message - /// Message to send - public ComsMessage(IBasicCommunication coms, byte[] message) - { - Validate(coms, message); - _coms = coms; - _bytes = message; - _isByteMessage = true; - } - - private void Validate(IBasicCommunication coms, object message) - { - if (coms == null) - throw new ArgumentNullException("coms"); - - if (message == null) - throw new ArgumentNullException("message"); - } - - /// - /// Dispatchs the string/byte[] to the IBasicCommunication specified - /// - public void Dispatch() - { - if (_isByteMessage) - { - _coms.SendBytes(_bytes); - } - else - { - _coms.SendText(_string); - } - } - /// /// Shows either the byte[] or string to be sent /// diff --git a/src/PepperDash.Essentials.Core/Queues/GenericQueue.cs b/src/PepperDash.Essentials.Core/Queues/GenericQueue.cs index d4fe1af3..dc7ff0d4 100644 --- a/src/PepperDash.Essentials.Core/Queues/GenericQueue.cs +++ b/src/PepperDash.Essentials.Core/Queues/GenericQueue.cs @@ -1,8 +1,9 @@ using System; +using System.Collections.Concurrent; +using System.Threading; using Crestron.SimplSharp; -using Crestron.SimplSharp.Reflection; -using Crestron.SimplSharpPro.CrestronThread; using PepperDash.Core; +using Thread = Crestron.SimplSharpPro.CrestronThread.Thread; namespace PepperDash.Essentials.Core.Queues { @@ -12,7 +13,7 @@ namespace PepperDash.Essentials.Core.Queues public class GenericQueue : IQueue { private readonly string _key; - protected readonly CrestronQueue _queue; + protected readonly ConcurrentQueue _queue; protected readonly Thread _worker; protected readonly CEvent _waitHandle = new CEvent(); @@ -33,7 +34,7 @@ namespace PepperDash.Essentials.Core.Queues { get { - return _queue.Size; + return int.MaxValue; } } @@ -137,7 +138,8 @@ namespace PepperDash.Essentials.Core.Queues { cap = capacity; // overrides default } - _queue = new CrestronQueue(cap); + + _queue = new ConcurrentQueue(); _worker = new Thread(ProcessQueue, null, Thread.eThreadStartOptions.Running) { Priority = priority, @@ -170,14 +172,9 @@ namespace PepperDash.Essentials.Core.Queues { while (true) { - IQueueMessage item = null; + if (_queue.TryDequeue(out var item) && item == null) + break; - if (_queue.Count > 0) - { - item = _queue.Dequeue(); - if (item == null) - break; - } if (item != null) { try @@ -188,7 +185,7 @@ namespace PepperDash.Essentials.Core.Queues if (_delayEnabled) Thread.Sleep(_delayTime); } - catch (System.Threading.ThreadAbortException) + catch (ThreadAbortException) { //swallowing this exception, as it should only happen on shut down } @@ -244,14 +241,13 @@ namespace PepperDash.Essentials.Core.Queues if (disposing) { - Debug.Console(2, this, "Disposing..."); - if (_queue != null && !_queue.Disposed) + using (_waitHandle) { - _queue.Clear(); - Enqueue(null); + Debug.Console(2, this, "Disposing..."); + _queue.Enqueue(null); + _waitHandle.Set(); + _worker.Join(); } - _worker.Abort(); - _waitHandle.Close(); } Disposed = true; @@ -271,261 +267,3 @@ namespace PepperDash.Essentials.Core.Queues } } } - -namespace PepperDash_Essentials_Core.Queues -{ - /// - /// Threadsafe processing of queued items with pacing if required - /// - [Obsolete("Use PepperDash.Essentials.Core.Queues")] - public class GenericQueue : IQueue - { - private readonly string _key; - protected readonly CrestronQueue _queue; - protected readonly Thread _worker; - protected readonly CEvent _waitHandle = new CEvent(); - - private bool _delayEnabled; - private int _delayTime; - - private const Thread.eThreadPriority _defaultPriority = Thread.eThreadPriority.MediumPriority; - - /// - /// If the instance has been disposed. - /// - public bool Disposed { get; private set; } - - /// - /// Returns the capacity of the CrestronQueue (fixed Size property) - /// - public int QueueCapacity - { - get - { - return _queue.Size; - } - } - - /// - /// Returns the number of elements currently in the CrestronQueue - /// - public int QueueCount - { - get - { - return _queue.Count; - } - } - - /// - /// Constructor with no thread priority - /// - /// - public GenericQueue(string key) - : this(key, _defaultPriority, 0, 0) - { - } - - /// - /// Constructor with queue size - /// - /// - /// Fixed size for the queue to hold - public GenericQueue(string key, int capacity) - : this(key, _defaultPriority, capacity, 0) - { - } - - /// - /// Constructor for generic queue with no pacing - /// - /// Key - /// Pacing in ms between actions - public GenericQueue(int pacing, string key) - : this(key, _defaultPriority, 0, pacing) - { - } - - /// - /// Constructor with pacing and capacity - /// - /// - /// - /// - public GenericQueue(string key, int pacing, int capacity) - : this(key, _defaultPriority, capacity, pacing) - { - } - - /// - /// Constructor with pacing and priority - /// - /// - /// - /// - public GenericQueue(string key, int pacing, Thread.eThreadPriority priority) - : this(key, priority, 0, pacing) - { - } - - /// - /// Constructor with pacing, priority and capacity - /// - /// - /// - /// - public GenericQueue(string key, Thread.eThreadPriority priority, int capacity) - : this(key, priority, capacity, 0) - { - } - - /// - /// Constructor with pacing, priority and capacity - /// - /// - /// - /// - /// - public GenericQueue(string key, int pacing, Thread.eThreadPriority priority, int capacity) - : this(key, priority, capacity, pacing) - { - } - - /// - /// Constructor for generic queue with no pacing - /// - /// Key - /// - /// - /// - protected GenericQueue(string key, Thread.eThreadPriority priority, int capacity, int pacing) - { - _key = key; - int cap = 25; // sets default - if (capacity > 0) - { - cap = capacity; // overrides default - } - _queue = new CrestronQueue(cap); - _worker = new Thread(ProcessQueue, null, Thread.eThreadStartOptions.Running) - { - Priority = priority - }; - - SetDelayValues(pacing); - } - - private void SetDelayValues(int pacing) - { - _delayEnabled = pacing > 0; - _delayTime = pacing; - - CrestronEnvironment.ProgramStatusEventHandler += programEvent => - { - if (programEvent != eProgramStatusEventType.Stopping) - return; - - Dispose(true); - }; - } - - /// - /// Thread callback - /// - /// The action used to process dequeued items - /// Null when the thread is exited - private object ProcessQueue(object obj) - { - while (true) - { - IQueueMessage item = null; - - if (_queue.Count > 0) - { - item = _queue.Dequeue(); - if (item == null) - break; - } - if (item != null) - { - try - { - Debug.Console(2, this, "Processing queue item: '{0}'", item.ToString()); - item.Dispatch(); - - if (_delayEnabled) - Thread.Sleep(_delayTime); - } - catch (Exception ex) - { - Debug.Console(0, this, Debug.ErrorLogLevel.Error, "Caught an exception in the Queue {0}", ex.Message); - Debug.Console(2, this, Debug.ErrorLogLevel.Error, "Stack Trace: {0}", ex.StackTrace); - - if (ex.InnerException != null) - { - Debug.Console(0, this, Debug.ErrorLogLevel.Error, "Caught an exception in the Queue {0}", ex.InnerException.Message); - Debug.Console(2, this, Debug.ErrorLogLevel.Error, "Stack Trace: {0}", ex.InnerException.StackTrace); - } - } - } - else _waitHandle.Wait(); - } - - return null; - } - - public void Enqueue(IQueueMessage item) - { - _queue.Enqueue(item); - _waitHandle.Set(); - } - - /// - /// Disposes the thread and cleans up resources. Thread cannot be restarted once - /// disposed. - /// - public void Dispose() - { - Dispose(true); - CrestronEnvironment.GC.SuppressFinalize(this); - } - - /// - /// Actually does the disposing. If you override this method, be sure to either call the base implementation - /// or clean up all the resources yourself. - /// - /// set to true unless called from finalizer - protected void Dispose(bool disposing) - { - if (Disposed) - return; - - if (disposing) - { - Debug.Console(2, this, "Disposing..."); - if (_queue != null && !_queue.Disposed) - { - _queue.Clear(); - Enqueue(null); - } - _worker.Abort(); - _waitHandle.Close(); - } - - Disposed = true; - } - - ~GenericQueue() - { - Dispose(true); - } - - /// - /// Key - /// - public string Key - { - get { return _key; } - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Queues/IQueue.cs b/src/PepperDash.Essentials.Core/Queues/IQueue.cs index 15803330..cb3bb947 100644 --- a/src/PepperDash.Essentials.Core/Queues/IQueue.cs +++ b/src/PepperDash.Essentials.Core/Queues/IQueue.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; using PepperDash.Core; namespace PepperDash.Essentials.Core.Queues @@ -13,13 +9,3 @@ namespace PepperDash.Essentials.Core.Queues bool Disposed { get; } } } - -namespace PepperDash_Essentials_Core.Queues -{ - [Obsolete("Use PepperDash.Essentials.Core.Queues")] - public interface IQueue : IKeyed, IDisposable where T : class - { - void Enqueue(T item); - bool Disposed { get; } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Queues/IQueueMessage.cs b/src/PepperDash.Essentials.Core/Queues/IQueueMessage.cs index 8ffd4d96..408bffca 100644 --- a/src/PepperDash.Essentials.Core/Queues/IQueueMessage.cs +++ b/src/PepperDash.Essentials.Core/Queues/IQueueMessage.cs @@ -6,13 +6,4 @@ namespace PepperDash.Essentials.Core.Queues { void Dispatch(); } -} - -namespace PepperDash_Essentials_Core.Queues -{ - [Obsolete("Use PepperDash.Essentials.Core.Queues")] - public interface IQueueMessage - { - void Dispatch(); - } } \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Queues/ProcessStringMessage.cs b/src/PepperDash.Essentials.Core/Queues/ProcessStringMessage.cs index d8ea4ada..5617326f 100644 --- a/src/PepperDash.Essentials.Core/Queues/ProcessStringMessage.cs +++ b/src/PepperDash.Essentials.Core/Queues/ProcessStringMessage.cs @@ -42,47 +42,3 @@ namespace PepperDash.Essentials.Core.Queues } } } - -namespace PepperDash_Essentials_Core.Queues -{ - /// - /// Message class for processing strings via an IQueue - /// - [Obsolete("Use PepperDash.Essentials.Core.Queues")] - public class ProcessStringMessage : IQueueMessage - { - private readonly Action _action; - private readonly string _message; - - /// - /// Constructor - /// - /// Message to be processed - /// Action to invoke on the message - public ProcessStringMessage(string message, Action action) - { - _message = message; - _action = action; - } - - /// - /// Processes the string with the given action - /// - public void Dispatch() - { - if (_action == null || String.IsNullOrEmpty(_message)) - return; - - _action(_message); - } - - /// - /// To string - /// - /// The current message - public override string ToString() - { - return _message ?? String.Empty; - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Queues/StringResponseProcessor.cs b/src/PepperDash.Essentials.Core/Queues/StringResponseProcessor.cs index e2db5d72..62020af0 100644 --- a/src/PepperDash.Essentials.Core/Queues/StringResponseProcessor.cs +++ b/src/PepperDash.Essentials.Core/Queues/StringResponseProcessor.cs @@ -104,107 +104,3 @@ namespace PepperDash.Essentials.Core.Queues } } } - -namespace PepperDash_Essentials_Core.Queues -{ - [Obsolete("Use PepperDash.Essentials.Core.Queues")] - public sealed class StringResponseProcessor : IKeyed, IDisposable - { - private readonly Action _processStringAction; - private readonly IQueue _queue; - private readonly IBasicCommunication _coms; - private readonly CommunicationGather _gather; - - private StringResponseProcessor(string key, Action processStringAction) - { - _processStringAction = processStringAction; - _queue = new GenericQueue(key); - - CrestronEnvironment.ProgramStatusEventHandler += programEvent => - { - if (programEvent != eProgramStatusEventType.Stopping) - return; - - Dispose(); - }; - } - - /// - /// Constructor that builds an instance and subscribes to coms TextReceived for processing - /// - /// Com port to process strings from - /// Action to process the incoming strings - public StringResponseProcessor(IBasicCommunication coms, Action processStringAction) - : this(coms.Key, processStringAction) - { - _coms = coms; - coms.TextReceived += OnResponseReceived; - } - - /// - /// Constructor that builds an instance and subscribes to gather Line Received for processing - /// - /// Gather to process strings from - /// Action to process the incoming strings - public StringResponseProcessor(CommunicationGather gather, Action processStringAction) - : this(gather.Port.Key, processStringAction) - { - _gather = gather; - gather.LineReceived += OnResponseReceived; - } - - private void OnResponseReceived(object sender, GenericCommMethodReceiveTextArgs args) - { - _queue.Enqueue(new ProcessStringMessage(args.Text, _processStringAction)); - } - - /// - /// Key - /// - public string Key - { - get { return _queue.Key; } - } - - /// - /// Disposes the instance and cleans up resources. - /// - public void Dispose() - { - Dispose(true); - CrestronEnvironment.GC.SuppressFinalize(this); - } - - private void Dispose(bool disposing) - { - if (Disposed) - return; - - if (disposing) - { - if (_coms != null) - _coms.TextReceived -= OnResponseReceived; - - if (_gather != null) - { - _gather.LineReceived -= OnResponseReceived; - _gather.Stop(); - } - - _queue.Dispose(); - } - - Disposed = true; - } - - /// - /// If the instance has been disposed or not. If it has, you can not use it anymore - /// - public bool Disposed { get; private set; } - - ~StringResponseProcessor() - { - Dispose(false); - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Routing/RoutingInterfaces.cs b/src/PepperDash.Essentials.Core/Routing/RoutingInterfaces.cs index dcec7ae2..bfaa27db 100644 --- a/src/PepperDash.Essentials.Core/Routing/RoutingInterfaces.cs +++ b/src/PepperDash.Essentials.Core/Routing/RoutingInterfaces.cs @@ -55,15 +55,6 @@ namespace PepperDash.Essentials.Core { } - - /// - /// For fixed-source endpoint devices - /// - [Obsolete("Please switch to IRoutingSink")] - public interface IRoutingSinkNoSwitching : IRoutingSink - { - - } /// /// Endpoint device like a display, that selects inputs diff --git a/src/PepperDash.Essentials.Core/Shades/Shade Interfaces.cs b/src/PepperDash.Essentials.Core/Shades/Shade Interfaces.cs index 2fded479..94a88c36 100644 --- a/src/PepperDash.Essentials.Core/Shades/Shade Interfaces.cs +++ b/src/PepperDash.Essentials.Core/Shades/Shade Interfaces.cs @@ -1,10 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -using PepperDash.Core; namespace PepperDash.Essentials.Core.Shades { @@ -16,16 +11,6 @@ namespace PepperDash.Essentials.Core.Shades List Shades { get; } } - /// - /// Requirements for a device that implements basic Open/Close shade control - /// - [Obsolete("Please use IShadesOpenCloseStop instead")] - public interface IShadesOpenClose - { - void Open(); - void Close(); - } - /// /// Requirements for a device that implements basic Open/Close/Stop shade control (Uses 3 relays) /// @@ -45,15 +30,6 @@ namespace PepperDash.Essentials.Core.Shades event EventHandler PresetSaved; } - /// - /// Requirements for a shade that implements press/hold raise/lower functions - /// - [Obsolete("Please use IShadesOpenCloseStop instead")] - public interface IShadesRaiseLower - { - void Raise(bool state); - void Lower(bool state); - } /// /// Requirements for a shade device that provides raising/lowering feedback @@ -73,15 +49,6 @@ namespace PepperDash.Essentials.Core.Shades BoolFeedback ShadeIsClosedFeedback { get; } } - /// - /// - /// - [Obsolete("Please use IShadesOpenCloseStop instead")] - public interface IShadesStop - { - void Stop(); - } - /// /// Used to implement raise/stop/lower/stop from single button /// @@ -125,7 +92,7 @@ namespace PepperDash.Essentials.Core.Shades BoolFeedback AllAreAtSceneFeedback { get; } } - public interface ICrestronBasicShade : IShadesOpenClosedFeedback, IShadesStop, + public interface ICrestronBasicShade : IShadesOpenClosedFeedback, IShadesStopOrMove, IShadesFeedback, IShadesRaiseLowerFeedback { diff --git a/src/PepperDash.Essentials.Devices.Common/Audio/GenericAudioOut.cs b/src/PepperDash.Essentials.Devices.Common/Audio/GenericAudioOut.cs index 70596904..250b29d5 100644 --- a/src/PepperDash.Essentials.Devices.Common/Audio/GenericAudioOut.cs +++ b/src/PepperDash.Essentials.Devices.Common/Audio/GenericAudioOut.cs @@ -15,7 +15,7 @@ namespace PepperDash.Essentials.Devices.Common /// /// Represents and audio endpoint /// - public class GenericAudioOut : EssentialsDevice, IRoutingSinkNoSwitching + public class GenericAudioOut : EssentialsDevice, IRoutingSink { public event SourceInfoChangeHandler CurrentSourceChange; diff --git a/src/PepperDash.Essentials.Devices.Common/Codec/iHasDirectory.cs b/src/PepperDash.Essentials.Devices.Common/Codec/iHasDirectory.cs index 1bb08b71..360d111e 100644 --- a/src/PepperDash.Essentials.Devices.Common/Codec/iHasDirectory.cs +++ b/src/PepperDash.Essentials.Devices.Common/Codec/iHasDirectory.cs @@ -38,12 +38,6 @@ namespace PepperDash.Essentials.Devices.Common.Codec void GetDirectoryParentFolderContents(); BoolFeedback CurrentDirectoryResultIsNotDirectoryRoot { get; } - - /// - /// Tracks the directory browse history when browsing beyond the root directory - /// - [Obsolete("Please use the Stack-based history instead")] - List DirectoryBrowseHistory { get; } } public interface IHasDirectoryHistoryStack : IHasDirectory diff --git a/src/PepperDash.Essentials.Devices.Common/Display/ComTcpDisplayBase.cs b/src/PepperDash.Essentials.Devices.Common/Display/ComTcpDisplayBase.cs deleted file mode 100644 index 84547c1b..00000000 --- a/src/PepperDash.Essentials.Devices.Common/Display/ComTcpDisplayBase.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using PepperDash.Core; -using PepperDash.Essentials.Core; - - -namespace PepperDash.Essentials.Devices.Displays -{ - [Obsolete("Please use TwoWayDisplayBase instead")] - public abstract class ComTcpDisplayBase : TwoWayDisplayBase - { - - ///// - ///// Sets the communication method for this - swaps out event handlers and output handlers - ///// - //public IBasicCommunication CommunicationMethod - //{ - // get { return _CommunicationMethod; } - // set - // { - // if (_CommunicationMethod != null) - // _CommunicationMethod.BytesReceived -= this.CommunicationMethod_BytesReceived; - // // Outputs??? - // _CommunicationMethod = value; - // if (_CommunicationMethod != null) - // _CommunicationMethod.BytesReceived += this.CommunicationMethod_BytesReceived; - // // Outputs? - // } - //} - //IBasicCommunication _CommunicationMethod; - - public ComTcpDisplayBase(string key, string name) - : base(key, name) - { - - } - - - //protected abstract void CommunicationMethod_BytesReceived(object sender, GenericCommMethodReceiveBytesArgs args); - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Devices.Common/Power Controllers/DigitalLoggerPropertiesConfig.cs b/src/PepperDash.Essentials.Devices.Common/Power Controllers/DigitalLoggerPropertiesConfig.cs deleted file mode 100644 index 1fae442b..00000000 --- a/src/PepperDash.Essentials.Devices.Common/Power Controllers/DigitalLoggerPropertiesConfig.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -using PepperDash.Core; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Devices.Common -{ - /// - /// - /// - public class DigitalLoggerPropertiesConfig - { - public CommunicationMonitorConfig CommunicationMonitorProperties { get; set; } - - public ControlPropertiesConfig Control { get; set; } - public string userName { get; set; } - public string password { get; set; } - public string address { get; set; } - } - -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Devices.Common/Power Controllers/Digitallogger.cs b/src/PepperDash.Essentials.Devices.Common/Power Controllers/Digitallogger.cs deleted file mode 100644 index ed885104..00000000 --- a/src/PepperDash.Essentials.Devices.Common/Power Controllers/Digitallogger.cs +++ /dev/null @@ -1,356 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DeviceSupport; -using PepperDash.Core; -using PepperDash.Essentials.Core; -using System.Text.RegularExpressions; -using Crestron.SimplSharp.Net.Http; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials; - - - -namespace PepperDash.Essentials.Devices.Common -{ - [Obsolete("This Device will be moved to a plugin in a future update")] - public class DigitalLogger : EssentialsBridgeableDevice - { - public IBasicCommunication Communication { get; private set; } - public CommunicationGather PortGather { get; private set; } - public StatusMonitorBase CommunicationMonitor { get; private set; } - - private HttpClient WebClient; - public string userName; - public string password; - public string address; - private bool OnlineStatus; - public BoolFeedback OnlineFeedback; - //private ushort CurrentPreset; - public IntFeedback PresetFeedback; - - public Dictionary CircuitStatus; - public uint CircuitCount; - - public Dictionary CircuitNameFeedbacks { get; private set; } - public Dictionary CircuitIsCritical{ get; private set; } - public Dictionary CircuitState { get; private set; } - - // new public Dictionary LevelControlPoints { get; private set; } - // public List PresetList = new List(); - - public bool isSubscribed; - - private CTimer SubscriptionTimer; - - CrestronQueue CommandQueue; - - bool CommandQueueInProgress = false; - - //new public Dictionary DialerControlPoints { get; private set; } - - //new public Dictionary SwitcherControlPoints { get; private set; } - - /// - /// Shows received lines as hex - /// - public bool ShowHexResponse { get; set; } - - public DigitalLogger(string key, string name, DigitalLoggerPropertiesConfig props) : - base(key, name) - { - CircuitCount = 8; - this.userName = props.userName; - this.password = props.password; - CommandQueue = new CrestronQueue(100); - - WebClient = new HttpClient(); - WebClient.UserName = this.userName; - WebClient.Password = this.password; - this.address = props.address; - WebClient.HostAddress = props.address; - - - - } - - public override bool CustomActivate() - { - /* - Communication.Connect(); - CommunicationMonitor.StatusChange += (o, a) => { Debug.Console(2, this, "Communication monitor state: {0}", CommunicationMonitor.Status); }; - CommunicationMonitor.Start(); - */ - - OnlineFeedback = new BoolFeedback(() => { return OnlineStatus; }); - CircuitStatus = new Dictionary(); - CircuitNameFeedbacks = new Dictionary(); - CircuitIsCritical = new Dictionary(); - CircuitState = new Dictionary(); - for (uint i = 0; i < CircuitCount; i++) - { - uint circuit = i; - CircuitStatus[circuit] = new DigitalLoggerCircuit(); - CircuitNameFeedbacks[circuit] = new StringFeedback(() => { - if (CircuitStatus[circuit].name != null) - { - return CircuitStatus[circuit].name; - } - else - { - return ""; - } - }); - CircuitIsCritical[circuit] = new BoolFeedback(() => - { - if (CircuitStatus.ContainsKey(circuit)) - { - return CircuitStatus[circuit].critical; - } - else - { - return false; - } - }); - CircuitState[circuit] = new BoolFeedback(() => - { - if (CircuitStatus.ContainsKey(circuit)) - { - return CircuitStatus[circuit].state; - } - else - { - return false; - } - }); - PollCircuit(circuit); - } - - CrestronConsole.AddNewConsoleCommand(SendLine, "send" + Key, "", ConsoleAccessLevelEnum.AccessOperator); - CrestronConsole.AddNewConsoleCommand(s => Communication.Connect(), "con" + Key, "", ConsoleAccessLevelEnum.AccessOperator); - - - - return true; - } - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new DigitalLoggerJoinMap(); - - var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - - joinMap.OffsetJoinNumbers(joinStart); - - Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - for (uint i = 1; i <= CircuitCount; i++) - { - var circuit = i; - CircuitNameFeedbacks[circuit - 1].LinkInputSig(trilist.StringInput[joinMap.CircuitNames + circuit]); - CircuitIsCritical[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitIsCritical + circuit]); - CircuitState[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitState + circuit]); - trilist.SetSigTrueAction(joinMap.CircuitCycle + circuit, () => CycleCircuit(circuit - 1)); - trilist.SetSigTrueAction(joinMap.CircuitOnCmd + circuit, () => TurnOnCircuit(circuit - 1)); - trilist.SetSigTrueAction(joinMap.CircuitOffCmd + circuit, () => TurnOffCircuit(circuit - 1)); - - } - } - - void socket_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e) - { - Debug.Console(2, this, "Socket Status Change: {0}", e.Client.ClientStatus.ToString()); - - if (e.Client.IsConnected) - { - OnlineStatus = true; - OnlineFeedback.FireUpdate(); - } - else - { - OnlineStatus = false; - OnlineFeedback.FireUpdate(); - if (SubscriptionTimer != null) - { - SubscriptionTimer.Stop(); - SubscriptionTimer = null; - } - - isSubscribed = false; - CommandQueue.Clear(); - CommandQueueInProgress = false; - } - } - - public void PollCircuit(uint circuit) - { - try - { - string PollCircuitResponse = SendRequest(String.Format("/restapi/relay/outlets/{0}/", circuit)); - CircuitStatus[circuit] = JsonConvert.DeserializeObject(PollCircuitResponse); - DigitalLoggerCircuit temp = CircuitStatus[circuit]; - Debug.Console(2, this, "DigitalLogger Circuit {0} Name: {1} State:{2}'", circuit, CircuitStatus[circuit].name, CircuitStatus[circuit].state); - CircuitNameFeedbacks[circuit].FireUpdate(); - CircuitState[circuit].FireUpdate(); - CircuitIsCritical[circuit].FireUpdate(); - } - catch (Exception e) - { - Debug.Console(0, this, "PollCircuit {0}", e); - - } - } - void Port_LineReceived(string response, HTTP_CALLBACK_ERROR error) - { - - - } - - public string SendRequest(string s) - { - HttpClientRequest request = new HttpClientRequest(); - string url = string.Format("http://{0}{1}", this.address, s); - request.Url = new UrlParser(url); - HttpClientResponse response = WebClient.Dispatch(request); - return response.ContentString; - } - /// - /// Sends a command to the DSP (with delimiter appended) - /// - /// Command to send - /// - public void SendLine(string s) - { - - HttpClientRequest request = new HttpClientRequest(); - string url = string.Format("http://{0}{1}", this.address, s); - request.Url = new UrlParser(url); - - HttpClientResponse response = WebClient.Dispatch(request); - } - - public void CycleCircuit(uint circuit) - { - SendLine(String.Format("/outlet?{0}=CCL", circuit)); - //PollCircuit(circuit); - - } - - public void TurnOnCircuit(uint circuit) - { - SendLine(String.Format("/outlet?{0}=ON", circuit)); - //PollCircuit(circuit); - } - - public void TurnOffCircuit(uint circuit) - { - SendLine(String.Format("/outlet?{0}=Off", circuit)); - //PollCircuit(circuit); - } - - /// - /// Adds a command from a child module to the queue - /// - /// Command object from child module - public void EnqueueCommand(QueuedCommand commandToEnqueue) - { - CommandQueue.Enqueue(commandToEnqueue); - //Debug.Console(1, this, "Command (QueuedCommand) Enqueued '{0}'. CommandQueue has '{1}' Elements.", commandToEnqueue.Command, CommandQueue.Count); - - if(!CommandQueueInProgress) - SendNextQueuedCommand(); - } - - /// - /// Adds a raw string command to the queue - /// - /// - public void EnqueueCommand(string command) - { - CommandQueue.Enqueue(command); - //Debug.Console(1, this, "Command (string) Enqueued '{0}'. CommandQueue has '{1}' Elements.", command, CommandQueue.Count); - - if (!CommandQueueInProgress) - SendNextQueuedCommand(); - } - - /// - /// Sends the next queued command to the DSP - /// - void SendNextQueuedCommand() - { - if (Communication.IsConnected && !CommandQueue.IsEmpty) - { - CommandQueueInProgress = true; - - if (CommandQueue.Peek() is QueuedCommand) - { - QueuedCommand nextCommand = new QueuedCommand(); - - nextCommand = (QueuedCommand)CommandQueue.Peek(); - - SendLine(nextCommand.Command); - } - else - { - string nextCommand = (string)CommandQueue.Peek(); - - SendLine(nextCommand); - } - } - - } - - - - public void CallPreset(ushort presetNumber) - { - SendLine(string.Format("Preset.Take = {0}", presetNumber)); - // SendLine("cgp 1"); - } - - public class QueuedCommand - { - public string Command { get; set; } - public string AttributeCode { get; set; } - // public QscDspControlPoint ControlPoint { get; set; } - } - - public class DigitalLoggerCircuit - { - public string name; - public bool locked; - public bool critical; - public bool transient_state; - public bool physical_state; - //public int cycle_delay; - public bool state; - } - - } - - public class DigitalLoggerFactory : EssentialsDeviceFactory - { - public DigitalLoggerFactory() - { - TypeNames = new List() { "digitallogger" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new DigitalLogger Device"); - var props = JsonConvert.DeserializeObject( - dc.Properties.ToString()); - return new DigitalLogger(dc.Key, dc.Name, props); - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Devices.Common/SoftCodec/BlueJeansPc.cs b/src/PepperDash.Essentials.Devices.Common/SoftCodec/BlueJeansPc.cs index 3e17f81d..868e7fca 100644 --- a/src/PepperDash.Essentials.Devices.Common/SoftCodec/BlueJeansPc.cs +++ b/src/PepperDash.Essentials.Devices.Common/SoftCodec/BlueJeansPc.cs @@ -13,7 +13,7 @@ using PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.Devices.Common.SoftCodec { - public class BlueJeansPc : InRoomPc, IRoutingInputs, IRunRouteAction, IRoutingSinkNoSwitching + public class BlueJeansPc : InRoomPc, IRoutingInputs, IRunRouteAction, IRoutingSink { public RoutingInputPort AnyVideoIn { get; private set; } @@ -93,9 +93,9 @@ namespace PepperDash.Essentials.Devices.Common.SoftCodec /// bool DoRoute(SourceRouteListItem route) { - IRoutingSinkNoSwitching dest = null; + IRoutingSink dest = null; - dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSinkNoSwitching; + dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSink; if (dest == null) { diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/VideoCodecBase.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/VideoCodecBase.cs index 9d8fbce1..1e83ad32 100644 --- a/src/PepperDash.Essentials.Devices.Common/VideoCodec/VideoCodecBase.cs +++ b/src/PepperDash.Essentials.Devices.Common/VideoCodec/VideoCodecBase.cs @@ -4,14 +4,11 @@ using System.Linq; using System.Text; using Crestron.SimplSharp.CrestronIO; using Crestron.SimplSharp.Reflection; -using Crestron.SimplSharp.Ssh; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharp; using PepperDash.Core; using PepperDash.Core.Intersystem; using PepperDash.Core.Intersystem.Tokens; -using PepperDash.Core.WebApi.Presets; -using Crestron.SimplSharp.Reflection; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Config; diff --git a/src/PepperDash.Essentials/Devices/Amplifier.cs b/src/PepperDash.Essentials/Devices/Amplifier.cs index b2725109..dc35de6b 100644 --- a/src/PepperDash.Essentials/Devices/Amplifier.cs +++ b/src/PepperDash.Essentials/Devices/Amplifier.cs @@ -11,7 +11,7 @@ using PepperDash.Essentials.Core.Routing; namespace PepperDash.Essentials { - public class Amplifier : EssentialsDevice, IRoutingSinkNoSwitching + public class Amplifier : EssentialsDevice, IRoutingSink { public event SourceInfoChangeHandler CurrentSourceChange; diff --git a/src/PepperDash.Essentials/Room/Types/EssentialsDualDisplayRoom.cs b/src/PepperDash.Essentials/Room/Types/EssentialsDualDisplayRoom.cs index 79b4b7c4..f02420e4 100644 --- a/src/PepperDash.Essentials/Room/Types/EssentialsDualDisplayRoom.cs +++ b/src/PepperDash.Essentials/Room/Types/EssentialsDualDisplayRoom.cs @@ -577,13 +577,13 @@ namespace PepperDash.Essentials IRoutingSink dest = null; if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase)) - dest = DefaultAudioDevice as IRoutingSinkNoSwitching; + dest = DefaultAudioDevice as IRoutingSink; else if (route.DestinationKey.Equals(LeftDisplay.Key, StringComparison.OrdinalIgnoreCase)) dest = LeftDisplay; else if (route.DestinationKey.Equals(RightDisplay.Key, StringComparison.OrdinalIgnoreCase)) dest = RightDisplay; else - dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSinkNoSwitching; + dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSink; if (dest == null) { diff --git a/src/PepperDash.Essentials/UIDrivers/Environment Drivers/EssentialsShadeDriver.cs b/src/PepperDash.Essentials/UIDrivers/Environment Drivers/EssentialsShadeDriver.cs index 9ab9ad54..63b38f9d 100644 --- a/src/PepperDash.Essentials/UIDrivers/Environment Drivers/EssentialsShadeDriver.cs +++ b/src/PepperDash.Essentials/UIDrivers/Environment Drivers/EssentialsShadeDriver.cs @@ -76,7 +76,7 @@ namespace PepperDash.Essentials { if (ShadeDevice is IShadesOpenCloseStop) DeviceType = eShadeDeviceType.OpenCloseStop; - else if (ShadeDevice is IShadesOpenClose) + else if (ShadeDevice is IShadesOpenCloseStop) DeviceType = eShadeDeviceType.OpenClose; } From b4911bfda1f705df07f30d686cd5cd7e096f6ab8 Mon Sep 17 00:00:00 2001 From: Nick Genovese Date: Tue, 31 Oct 2023 10:25:28 -0400 Subject: [PATCH 02/21] feat: removed crestron io devices --- .../Crestron IO/C2nIo/C2nIoController.cs | 106 --- .../Crestron IO/C2nRts/C2nRthsController.cs | 150 ---- .../Crestron IO/Cards/C3CardControllerBase.cs | 24 - .../Crestron IO/Cards/C3Com3Controller.cs | 29 - .../Crestron IO/Cards/C3Io16Controller.cs | 29 - .../Crestron IO/Cards/C3Ir8Controller.cs | 29 - .../Crestron IO/Cards/C3Ry16Controller.cs | 29 - .../Crestron IO/Cards/C3Ry8Controller.cs | 29 - .../Crestron IO/Cards/CenCi31Controller.cs | 118 --- .../Crestron IO/Cards/CenCi33Controller.cs | 133 --- .../Cards/InternalCardCageController.cs | 143 --- .../DinCenCn/DinCenCnController.cs | 51 -- .../Crestron IO/DinIo8/DinIo8Controller.cs | 80 -- .../{Inputs => }/GenericDigitalInputDevice.cs | 0 .../{Relay => }/GenericRelayDevice.cs | 0 .../GenericVersiportAnalogInputDevice.cs | 0 .../GenericVersiportInputDevice.cs | 0 .../GenericVersiportOutputDevice.cs | 0 .../Crestron IO/{Inputs => }/IAnalogInput.cs | 0 .../Crestron IO/{Inputs => }/IDigitalInput.cs | 0 .../{Outputs => }/IDigitalOutput.cs | 0 .../{DinCenCn => }/IHasCresnetBranches.cs | 0 .../{Relay => }/ISwitchedOutput.cs | 0 .../Inputs/CenIoDigIn104Controller.cs | 69 -- .../Crestron IO/Ir/CenIoIr104Controller.cs | 93 -- .../Crestron IO/Relay/CenIoRy104Controller.cs | 77 -- .../StatusSign/StatusSignController.cs | 225 ----- .../Gateways/CenCn2Controller.cs | 12 - .../Gateways/CenRfgwController.cs | 197 ----- .../Gateways/EssentialsRfGatewayConfig.cs | 25 - .../CenOdtOccupancySensorBaseController.cs | 777 ---------------- ...lsGlsOccupancySensorBaseController.cs.orig | 87 -- .../GlsOccupancySensorBaseController.cs | 541 ------------ .../GlsOccupancySensorPropertiesConfig.cs | 83 -- .../GlsOdtOccupancySensorController.cs | 284 ------ .../GlsOirOccupancySensorController.cs | 80 -- .../IOccupancyStatusProviderAggregator.cs | 109 --- .../Occupancy/OccupancyAggregatorConfig.cs | 17 - .../GlsPartitionSensorController.cs | 366 -------- .../GlsPartitionSensorPropertiesConfig.cs | 26 - .../PepperDash.Essentials.Core.csproj | 1 - .../Remotes/ButtonExtensions.cs | 47 - .../Remotes/CrestronRemotePropertiesConfig.cs | 19 - .../Remotes/Hrxx0WirelessRemoteController.cs | 827 ------------------ 44 files changed, 4912 deletions(-) delete mode 100644 src/PepperDash.Essentials.Core/Crestron IO/C2nIo/C2nIoController.cs delete mode 100644 src/PepperDash.Essentials.Core/Crestron IO/C2nRts/C2nRthsController.cs delete mode 100644 src/PepperDash.Essentials.Core/Crestron IO/Cards/C3CardControllerBase.cs delete mode 100644 src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Com3Controller.cs delete mode 100644 src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Io16Controller.cs delete mode 100644 src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Ir8Controller.cs delete mode 100644 src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Ry16Controller.cs delete mode 100644 src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Ry8Controller.cs delete mode 100644 src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi31Controller.cs delete mode 100644 src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi33Controller.cs delete mode 100644 src/PepperDash.Essentials.Core/Crestron IO/Cards/InternalCardCageController.cs delete mode 100644 src/PepperDash.Essentials.Core/Crestron IO/DinCenCn/DinCenCnController.cs delete mode 100644 src/PepperDash.Essentials.Core/Crestron IO/DinIo8/DinIo8Controller.cs rename src/PepperDash.Essentials.Core/Crestron IO/{Inputs => }/GenericDigitalInputDevice.cs (100%) rename src/PepperDash.Essentials.Core/Crestron IO/{Relay => }/GenericRelayDevice.cs (100%) rename src/PepperDash.Essentials.Core/Crestron IO/{Inputs => }/GenericVersiportAnalogInputDevice.cs (100%) rename src/PepperDash.Essentials.Core/Crestron IO/{Inputs => }/GenericVersiportInputDevice.cs (100%) rename src/PepperDash.Essentials.Core/Crestron IO/{Outputs => }/GenericVersiportOutputDevice.cs (100%) rename src/PepperDash.Essentials.Core/Crestron IO/{Inputs => }/IAnalogInput.cs (100%) rename src/PepperDash.Essentials.Core/Crestron IO/{Inputs => }/IDigitalInput.cs (100%) rename src/PepperDash.Essentials.Core/Crestron IO/{Outputs => }/IDigitalOutput.cs (100%) rename src/PepperDash.Essentials.Core/Crestron IO/{DinCenCn => }/IHasCresnetBranches.cs (100%) rename src/PepperDash.Essentials.Core/Crestron IO/{Relay => }/ISwitchedOutput.cs (100%) delete mode 100644 src/PepperDash.Essentials.Core/Crestron IO/Inputs/CenIoDigIn104Controller.cs delete mode 100644 src/PepperDash.Essentials.Core/Crestron IO/Ir/CenIoIr104Controller.cs delete mode 100644 src/PepperDash.Essentials.Core/Crestron IO/Relay/CenIoRy104Controller.cs delete mode 100644 src/PepperDash.Essentials.Core/Crestron IO/StatusSign/StatusSignController.cs delete mode 100644 src/PepperDash.Essentials.Core/Gateways/CenCn2Controller.cs delete mode 100644 src/PepperDash.Essentials.Core/Gateways/CenRfgwController.cs delete mode 100644 src/PepperDash.Essentials.Core/Gateways/EssentialsRfGatewayConfig.cs delete mode 100644 src/PepperDash.Essentials.Core/Occupancy/CenOdtOccupancySensorBaseController.cs delete mode 100644 src/PepperDash.Essentials.Core/Occupancy/EssentialsGlsOccupancySensorBaseController.cs.orig delete mode 100644 src/PepperDash.Essentials.Core/Occupancy/GlsOccupancySensorBaseController.cs delete mode 100644 src/PepperDash.Essentials.Core/Occupancy/GlsOccupancySensorPropertiesConfig.cs delete mode 100644 src/PepperDash.Essentials.Core/Occupancy/GlsOdtOccupancySensorController.cs delete mode 100644 src/PepperDash.Essentials.Core/Occupancy/GlsOirOccupancySensorController.cs delete mode 100644 src/PepperDash.Essentials.Core/Occupancy/IOccupancyStatusProviderAggregator.cs delete mode 100644 src/PepperDash.Essentials.Core/Occupancy/OccupancyAggregatorConfig.cs delete mode 100644 src/PepperDash.Essentials.Core/PartitionSensor/GlsPartitionSensorController.cs delete mode 100644 src/PepperDash.Essentials.Core/PartitionSensor/GlsPartitionSensorPropertiesConfig.cs delete mode 100644 src/PepperDash.Essentials.Core/Remotes/ButtonExtensions.cs delete mode 100644 src/PepperDash.Essentials.Core/Remotes/CrestronRemotePropertiesConfig.cs delete mode 100644 src/PepperDash.Essentials.Core/Remotes/Hrxx0WirelessRemoteController.cs diff --git a/src/PepperDash.Essentials.Core/Crestron IO/C2nIo/C2nIoController.cs b/src/PepperDash.Essentials.Core/Crestron IO/C2nIo/C2nIoController.cs deleted file mode 100644 index f1f1891d..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/C2nIo/C2nIoController.cs +++ /dev/null @@ -1,106 +0,0 @@ -using System; -using System.Collections.Generic; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.GeneralIO; -using PepperDash.Core; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.Core.Config; - -namespace PepperDash.Essentials.Core.CrestronIO -{ - public class C2NIoController:CrestronGenericBaseDevice, IComPorts, IIROutputPorts, IRelayPorts - { - private C2nIo _device; - - public C2NIoController(string key, Func preActivationFunc, DeviceConfig config):base(key, config.Name) - { - AddPreActivationAction(() => - { - _device = preActivationFunc(config); - - RegisterCrestronGenericBase(_device); - }); - } - - #region Implementation of IComPorts - - public CrestronCollection ComPorts - { - get { return _device.ComPorts; } - } - - public int NumberOfComPorts - { - get { return _device.NumberOfComPorts; } - } - - #endregion - - #region Implementation of IIROutputPorts - - public CrestronCollection IROutputPorts - { - get { return _device.IROutputPorts; } - } - - public int NumberOfIROutputPorts - { - get { return _device.NumberOfIROutputPorts; } - } - - #endregion - - #region Implementation of IRelayPorts - - public CrestronCollection RelayPorts - { - get { return _device.RelayPorts; } - } - - public int NumberOfRelayPorts - { - get { return _device.NumberOfRelayPorts; } - } - - #endregion - } - - public class C2NIoControllerFactory : EssentialsDeviceFactory - { - public C2NIoControllerFactory() - { - TypeNames = new List() { "c2nio" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new C2N-IO Device"); - - return new C2NIoController(dc.Key, GetC2NIoDevice, dc); - } - - static C2nIo GetC2NIoDevice(DeviceConfig dc) - { - var control = CommFactory.GetControlPropertiesConfig(dc); - var cresnetId = control.CresnetIdInt; - var branchId = control.ControlPortNumber; - var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey; - - if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase)) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nIo", parentKey); - return new C2nIo(cresnetId, Global.ControlSystem); - } - var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches; - - if (cresnetBridge != null) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nIo", parentKey); - return new C2nIo(cresnetId, cresnetBridge.CresnetBranches[branchId]); - } - Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey); - return null; - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/C2nRts/C2nRthsController.cs b/src/PepperDash.Essentials.Core/Crestron IO/C2nRts/C2nRthsController.cs deleted file mode 100644 index b906219b..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/C2nRts/C2nRthsController.cs +++ /dev/null @@ -1,150 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.GeneralIO; -using Full.Newtonsoft.Json; -using PepperDash.Core; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.Core.Config; - - -namespace PepperDash.Essentials.Core.CrestronIO -{ - [Description("Wrapper class for the C2N-RTHS sensor")] - public class C2nRthsController : CrestronGenericBridgeableBaseDevice - { - private C2nRths _device; - - public IntFeedback TemperatureFeedback { get; private set; } - public IntFeedback HumidityFeedback { get; private set; } - - public C2nRthsController(string key, Func preActivationFunc, - DeviceConfig config) - : base(key, config.Name) - { - - AddPreActivationAction(() => - { - _device = preActivationFunc(config); - - RegisterCrestronGenericBase(_device); - - TemperatureFeedback = new IntFeedback(() => _device.TemperatureFeedback.UShortValue); - HumidityFeedback = new IntFeedback(() => _device.HumidityFeedback.UShortValue); - - if (_device != null) _device.BaseEvent += DeviceOnBaseEvent; - }); - } - - - private void DeviceOnBaseEvent(GenericBase device, BaseEventArgs args) - { - switch (args.EventId) - { - case C2nRths.TemperatureFeedbackEventId: - TemperatureFeedback.FireUpdate(); - break; - case C2nRths.HumidityFeedbackEventId: - HumidityFeedback.FireUpdate(); - break; - } - } - - public void SetTemperatureFormat(bool setToC) - { - _device.TemperatureFormat.BoolValue = setToC; - } - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new C2nRthsControllerJoinMap(joinStart); - - var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - - if (bridge != null) - { - bridge.AddJoinMap(Key, joinMap); - } - else - { - Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); - } - - Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - - - trilist.SetBoolSigAction(joinMap.TemperatureFormat.JoinNumber, SetTemperatureFormat); - - - - IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); - TemperatureFeedback.LinkInputSig(trilist.UShortInput[joinMap.Temperature.JoinNumber]); - HumidityFeedback.LinkInputSig(trilist.UShortInput[joinMap.Humidity.JoinNumber]); - - trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name; - - trilist.OnlineStatusChange += (d, args) => - { - if (!args.DeviceOnLine) return; - - UpdateFeedbacksWhenOnline(); - - trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name; - }; - } - - private void UpdateFeedbacksWhenOnline() - { - IsOnline.FireUpdate(); - TemperatureFeedback.FireUpdate(); - HumidityFeedback.FireUpdate(); - } - - #region PreActivation - - private static C2nRths GetC2nRthsDevice(DeviceConfig dc) - { - var control = CommFactory.GetControlPropertiesConfig(dc); - var cresnetId = control.CresnetIdInt; - var branchId = control.ControlPortNumber; - var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey; - - if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase)) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nRths", parentKey); - return new C2nRths(cresnetId, Global.ControlSystem); - } - var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches; - - if (cresnetBridge != null) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nRths", parentKey); - return new C2nRths(cresnetId, cresnetBridge.CresnetBranches[branchId]); - } - Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey); - return null; - } - #endregion - - public class C2nRthsControllerFactory : EssentialsDeviceFactory - { - public C2nRthsControllerFactory() - { - TypeNames = new List() { "c2nrths" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new C2N-RTHS Device"); - - return new C2nRthsController(dc.Key, GetC2nRthsDevice, dc); - } - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3CardControllerBase.cs b/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3CardControllerBase.cs deleted file mode 100644 index bfb81acd..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3CardControllerBase.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using Crestron.SimplSharpProInternal; - -namespace PepperDash.Essentials.Core.CrestronIO.Cards -{ - public class C3CardControllerBase:CrestronGenericBaseDevice - { - private readonly C3Card _card; - - public C3CardControllerBase(string key, string name, C3Card hardware) : base(key, name, hardware) - { - _card = hardware; - } - - #region Overrides of Object - - public override string ToString() - { - return String.Format("{0} {1}", Key, _card.ToString()); - } - - #endregion - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Com3Controller.cs b/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Com3Controller.cs deleted file mode 100644 index 9658b2bb..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Com3Controller.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.ThreeSeriesCards; - -namespace PepperDash.Essentials.Core.CrestronIO.Cards -{ - public class C3Com3Controller:C3CardControllerBase, IComPorts - { - private readonly C3com3 _card; - - public C3Com3Controller(string key, string name, C3com3 hardware) : base(key, name, hardware) - { - _card = hardware; - } - - #region Implementation of IComPorts - - public CrestronCollection ComPorts - { - get { return _card.ComPorts; } - } - - public int NumberOfComPorts - { - get { return _card.NumberOfComPorts; } - } - - #endregion - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Io16Controller.cs b/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Io16Controller.cs deleted file mode 100644 index bdf4742d..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Io16Controller.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.ThreeSeriesCards; - -namespace PepperDash.Essentials.Core.CrestronIO.Cards -{ - public class C3Io16Controller:C3CardControllerBase,IIOPorts - { - private readonly C3io16 _card; - - public C3Io16Controller(string key, string name, C3io16 hardware) : base(key, name, hardware) - { - _card = hardware; - } - - #region Implementation of IIOPorts - - public CrestronCollection VersiPorts - { - get { return _card.VersiPorts; } - } - - public int NumberOfVersiPorts - { - get { return _card.NumberOfVersiPorts; } - } - - #endregion - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Ir8Controller.cs b/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Ir8Controller.cs deleted file mode 100644 index c35d2038..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Ir8Controller.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.ThreeSeriesCards; - -namespace PepperDash.Essentials.Core.CrestronIO.Cards -{ - public class C3Ir8Controller:C3CardControllerBase, IIROutputPorts - { - private readonly C3ir8 _card; - - public C3Ir8Controller(string key, string name, C3ir8 hardware) : base(key, name, hardware) - { - _card = hardware; - } - - #region Implementation of IIROutputPorts - - public CrestronCollection IROutputPorts - { - get { return _card.IROutputPorts; } - } - - public int NumberOfIROutputPorts - { - get { return _card.NumberOfIROutputPorts; } - } - - #endregion - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Ry16Controller.cs b/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Ry16Controller.cs deleted file mode 100644 index a68ecaf0..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Ry16Controller.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.ThreeSeriesCards; - -namespace PepperDash.Essentials.Core.CrestronIO.Cards -{ - public class C3Ry16Controller:C3CardControllerBase, IRelayPorts - { - private readonly C3ry16 _card; - - public C3Ry16Controller(string key, string name, C3ry16 hardware) : base(key, name, hardware) - { - _card = hardware; - } - - #region Implementation of IRelayPorts - - public CrestronCollection RelayPorts - { - get { return _card.RelayPorts; } - } - - public int NumberOfRelayPorts - { - get { return _card.NumberOfRelayPorts; } - } - - #endregion - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Ry8Controller.cs b/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Ry8Controller.cs deleted file mode 100644 index 2fc5fa1b..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Ry8Controller.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.ThreeSeriesCards; - -namespace PepperDash.Essentials.Core.CrestronIO.Cards -{ - public class C3Ry8Controller:C3CardControllerBase, IRelayPorts - { - private readonly C3ry8 _card; - - public C3Ry8Controller(string key, string name, C3ry8 hardware) : base(key, name, hardware) - { - _card = hardware; - } - - #region Implementation of IRelayPorts - - public CrestronCollection RelayPorts - { - get { return _card.RelayPorts; } - } - - public int NumberOfRelayPorts - { - get { return _card.NumberOfRelayPorts; } - } - - #endregion - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi31Controller.cs b/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi31Controller.cs deleted file mode 100644 index 7e29e0e0..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi31Controller.cs +++ /dev/null @@ -1,118 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using Crestron.SimplSharpPro.ThreeSeriesCards; -using Full.Newtonsoft.Json; -using PepperDash.Core; -using PepperDash.Essentials.Core.Config; - -namespace PepperDash.Essentials.Core.CrestronIO.Cards -{ - [ConfigSnippet("\"properties\":{\"card\":\"c3com3\"}")] - public class CenCi31Controller : CrestronGenericBaseDevice - { - private const string CardKeyTemplate = "{0}-card"; - private const string CardNameTemplate = "{0}:{1}:{2}"; - private const uint CardSlot = 1; - private readonly CenCi31 _cardCage; - private readonly CenCi31Configuration _config; - - private readonly Dictionary> _cardDict; - - public CenCi31Controller(string key, string name, CenCi31Configuration config, CenCi31 hardware) : base(key, name, hardware) - { - _cardCage = hardware; - - _config = config; - - _cardDict = new Dictionary> - { - { - "c3com3", - (c, s) => - new C3Com3Controller(String.Format(CardKeyTemplate, key), - String.Format(CardNameTemplate, key, s, "C3Com3"), new C3com3(_cardCage)) - }, - { - "c3io16", - (c, s) => - new C3Io16Controller(String.Format(CardKeyTemplate, key), - String.Format(CardNameTemplate, key, s,"C3Io16"), new C3io16(_cardCage)) - }, - { - "c3ir8", - (c, s) => - new C3Ir8Controller(String.Format(CardKeyTemplate, key), - String.Format(CardNameTemplate, key, s, "C3Ir8"), new C3ir8(_cardCage)) - }, - { - "c3ry16", - (c, s) => - new C3Ry16Controller(String.Format(CardKeyTemplate, key), - String.Format(CardNameTemplate, key, s, "C3Ry16"), new C3ry16(_cardCage)) - }, - { - "c3ry8", - (c, s) => - new C3Ry8Controller(String.Format(CardKeyTemplate, key), - String.Format(CardNameTemplate, key, s, "C3Ry8"), new C3ry8(_cardCage)) - }, - - }; - - GetCards(); - } - - private void GetCards() - { - Func cardBuilder; - - if (String.IsNullOrEmpty(_config.Card)) - { - Debug.Console(0, this, "No card specified"); - return; - } - - if (!_cardDict.TryGetValue(_config.Card.ToLower(), out cardBuilder)) - { - Debug.Console(0, "Unable to find factory for 3-Series card type {0}.", _config.Card); - return; - } - - var device = cardBuilder(_cardCage, CardSlot); - - DeviceManager.AddDevice(device); - } - } - - public class CenCi31Configuration - { - [JsonProperty("card")] - public string Card { get; set; } - } - - public class CenCi31ControllerFactory : EssentialsDeviceFactory - { - public CenCi31ControllerFactory() - { - TypeNames = new List {"cenci31"}; - } - #region Overrides of EssentialsDeviceFactory - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory attempting to build new CEN-CI-1"); - - var controlProperties = CommFactory.GetControlPropertiesConfig(dc); - var ipId = controlProperties.IpIdInt; - - var cardCage = new CenCi31(ipId, Global.ControlSystem); - var config = dc.Properties.ToObject(); - - return new CenCi31Controller(dc.Key, dc.Name, config, cardCage); - } - - #endregion - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi33Controller.cs b/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi33Controller.cs deleted file mode 100644 index d1eb0166..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi33Controller.cs +++ /dev/null @@ -1,133 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using Crestron.SimplSharpPro.ThreeSeriesCards; -using Full.Newtonsoft.Json; -using PepperDash.Core; -using PepperDash.Essentials.Core.Config; - -namespace PepperDash.Essentials.Core.CrestronIO.Cards -{ - [ConfigSnippet("\"properties\":{\"cards\":{\"1\":\"c3com3\",\"2\":\"c3ry16\",\"3\":\"c3ry8\"}}")] - public class CenCi33Controller : CrestronGenericBaseDevice - { - private const string CardKeyTemplate = "{0}-card{1}"; - private const string CardNameTemplate = "{0}:{1}:{2}"; - private const uint CardSlots = 3; - private readonly CenCi33 _cardCage; - private readonly CenCi33Configuration _config; - - private readonly Dictionary> _cardDict; - - public CenCi33Controller(string key, string name, CenCi33Configuration config, CenCi33 hardware) : base(key, name, hardware) - { - _cardCage = hardware; - - _config = config; - - _cardDict = new Dictionary> - { - { - "c3com3", - (c, s) => - new C3Com3Controller(String.Format(CardKeyTemplate, key, s), - String.Format(CardNameTemplate, key, s, "C3Com3"), new C3com3(s,_cardCage)) - }, - { - "c3io16", - (c, s) => - new C3Io16Controller(String.Format(CardKeyTemplate, key, s), - String.Format(CardNameTemplate, key, s, "C3Io16"), new C3io16(s,_cardCage)) - }, - { - "c3ir8", - (c, s) => - new C3Ir8Controller(String.Format(CardKeyTemplate, key, s), - String.Format(CardNameTemplate, key, s, "C3Ir8"), new C3ir8(s,_cardCage)) - }, - { - "c3ry16", - (c, s) => - new C3Ry16Controller(String.Format(CardKeyTemplate, key, s), - String.Format(CardNameTemplate, key, s, "C3Ry16"), new C3ry16(s,_cardCage)) - }, - { - "c3ry8", - (c, s) => - new C3Ry8Controller(String.Format(CardKeyTemplate, key, s), - String.Format(CardNameTemplate, key, s, "C3Ry8"), new C3ry8(s,_cardCage)) - }, - - }; - - GetCards(); - } - - private void GetCards() - { - if (_config.Cards == null) - { - Debug.Console(0, this, "No card configuration for this device found"); - return; - } - - for (uint i = 1; i <= CardSlots; i++) - { - string cardType; - if (!_config.Cards.TryGetValue(i, out cardType)) - { - Debug.Console(1, this, "No card found for slot {0}", i); - continue; - } - - if (String.IsNullOrEmpty(cardType)) - { - Debug.Console(0, this, "No card specified for slot {0}", i); - return; - } - - Func cardBuilder; - if (!_cardDict.TryGetValue(cardType.ToLower(), out cardBuilder)) - { - Debug.Console(0, "Unable to find factory for 3-Series card type {0}.", cardType); - return; - } - - var device = cardBuilder(_cardCage, i); - - DeviceManager.AddDevice(device); - } - } - } - - public class CenCi33Configuration - { - [JsonProperty("cards")] - public Dictionary Cards { get; set; } - } - - public class CenCi33ControllerFactory : EssentialsDeviceFactory - { - public CenCi33ControllerFactory() - { - TypeNames = new List {"cenci33"}; - } - #region Overrides of EssentialsDeviceFactory - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory attempting to build new CEN-CI-3"); - - var controlProperties = CommFactory.GetControlPropertiesConfig(dc); - var ipId = controlProperties.IpIdInt; - - var cardCage = new CenCi33(ipId, Global.ControlSystem); - var config = dc.Properties.ToObject(); - - return new CenCi33Controller(dc.Key, dc.Name, config, cardCage); - } - - #endregion - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Cards/InternalCardCageController.cs b/src/PepperDash.Essentials.Core/Crestron IO/Cards/InternalCardCageController.cs deleted file mode 100644 index 97286945..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/Cards/InternalCardCageController.cs +++ /dev/null @@ -1,143 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using Crestron.SimplSharpPro.ThreeSeriesCards; -using Full.Newtonsoft.Json; -using PepperDash.Core; -using PepperDash.Essentials.Core.Config; - -namespace PepperDash.Essentials.Core.CrestronIO.Cards -{ - [ConfigSnippet("\"properties\":{\"cards\":{\"1\":\"c3com3\",\"2\":\"c3ry16\",\"3\":\"c3ry8\"}}")] - public class InternalCardCageController : EssentialsDevice - { - private const string CardKeyTemplate = "{0}-card{1}"; - private const string CardNameTemplate = "{0}:{1}:{2}"; - private const uint CardSlots = 3; - - private readonly InternalCardCageConfiguration _config; - - private readonly Dictionary> _cardDict; - - public InternalCardCageController(string key, string name, InternalCardCageConfiguration config) : base(key, name) - { - _config = config; - - _cardDict = new Dictionary> - { - { - "c3com3", - (s) => - new C3Com3Controller(String.Format(CardKeyTemplate, key, s), - String.Format(CardNameTemplate, key, s, "C3Com3"), new C3com3(s,Global.ControlSystem)) - }, - { - "c3io16", - (s) => - new C3Io16Controller(String.Format(CardKeyTemplate, key, s), - String.Format(CardNameTemplate, key, s, "C3Io16"), new C3io16(s,Global.ControlSystem)) - }, - { - "c3ir8", - (s) => - new C3Ir8Controller(String.Format(CardKeyTemplate, key, s), - String.Format(CardNameTemplate, key, s, "C3Ir8"), new C3ir8(s,Global.ControlSystem)) - }, - { - "c3ry16", - (s) => - new C3Ry16Controller(String.Format(CardKeyTemplate, key, s), - String.Format(CardNameTemplate, key, s, "C3Ry16"), new C3ry16(s,Global.ControlSystem)) - }, - { - "c3ry8", - (s) => - new C3Ry8Controller(String.Format(CardKeyTemplate, key, s), - String.Format(CardNameTemplate, key, s, "C3Ry8"), new C3ry8(s,Global.ControlSystem)) - }, - - }; - - GetCards(); - } - - private void GetCards() - { - if (_config.Cards == null) - { - Debug.Console(0, this, "No card configuration for this device found"); - return; - } - - for (uint i = 1; i <= CardSlots; i++) - { - string cardType; - if (!_config.Cards.TryGetValue(i, out cardType)) - { - Debug.Console(0, this, "No card found for slot {0}", i); - continue; - } - - if (String.IsNullOrEmpty(cardType)) - { - Debug.Console(0, this, "No card specified for slot {0}", i); - continue; - } - - Func cardBuilder; - if (!_cardDict.TryGetValue(cardType.ToLower(), out cardBuilder)) - { - Debug.Console(0, "Unable to find factory for 3-Series card type {0}.", cardType); - continue; - } - - try - { - var device = cardBuilder(i); - - - DeviceManager.AddDevice(device); - } - catch (InvalidOperationException ex) - { - Debug.Console(0, this, Debug.ErrorLogLevel.Error, - "Unable to add card {0} to internal card cage.\r\nError Message: {1}\r\nStack Trace: {2}", - cardType, ex.Message, ex.StackTrace); - } - } - } - } - - public class InternalCardCageConfiguration - { - [JsonProperty("cards")] - public Dictionary Cards { get; set; } - } - - public class InternalCardCageControllerFactory : EssentialsDeviceFactory - { - public InternalCardCageControllerFactory() - { - TypeNames = new List {"internalcardcage"}; - } - #region Overrides of EssentialsDeviceFactory - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory attempting to build new Internal Card Cage Controller"); - - if (!Global.ControlSystem.SupportsThreeSeriesPlugInCards) - { - Debug.Console(0, Debug.ErrorLogLevel.Warning, "Current control system does NOT support 3-Series cards. Everything is NOT awesome."); - return null; - } - - var config = dc.Properties.ToObject(); - - return new InternalCardCageController(dc.Key, dc.Name, config); - } - - #endregion - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/DinCenCn/DinCenCnController.cs b/src/PepperDash.Essentials.Core/Crestron IO/DinCenCn/DinCenCnController.cs deleted file mode 100644 index 414b5432..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/DinCenCn/DinCenCnController.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System.Collections.Generic; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.GeneralIO; -using PepperDash.Core; -using PepperDash.Essentials.Core.Config; - - -namespace PepperDash.Essentials.Core -{ - public class DinCenCn2Controller : CrestronGenericBaseDevice, IHasCresnetBranches - { - private readonly DinCenCn2 _device; - - public CrestronCollection CresnetBranches - { - get { - return _device != null ? _device.Branches : null; - } - } - - public DinCenCn2Controller(string key, string name, DinCenCn2 device, DeviceConfig config) - : base(key, name, device) - { - _device = device; - } - - public class DinCenCn2ControllerFactory : EssentialsDeviceFactory - { - public DinCenCn2ControllerFactory() - { - TypeNames = new List() { "dincencn2", "dincencn2poe", "din-cencn2", "din-cencn2-poe" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new DIN-CEN-CN2 Device"); - - var control = CommFactory.GetControlPropertiesConfig(dc); - var ipid = control.IpIdInt; - - if (dc.Type.ToLower().Contains("poe")) - { - return new DinCenCn2Controller(dc.Key, dc.Name, new DinCenCn2Poe(ipid, Global.ControlSystem), dc); - } - - return new DinCenCn2Controller(dc.Key, dc.Name, new DinCenCn2(ipid, Global.ControlSystem), dc); - } - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/DinIo8/DinIo8Controller.cs b/src/PepperDash.Essentials.Core/Crestron IO/DinIo8/DinIo8Controller.cs deleted file mode 100644 index 794fe609..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/DinIo8/DinIo8Controller.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using System.Collections.Generic; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.GeneralIO; -using PepperDash.Core; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.Core.Config; - -namespace PepperDash.Essentials.Core.CrestronIO -{ - public class DinIo8Controller:CrestronGenericBaseDevice, IIOPorts - { - private DinIo8 _device; - - public DinIo8Controller(string key, Func preActivationFunc, DeviceConfig config):base(key, config.Name) - { - AddPreActivationAction(() => - { - _device = preActivationFunc(config); - - RegisterCrestronGenericBase(_device); - }); - } - - #region Implementation of IIOPorts - - public CrestronCollection VersiPorts - { - get { return _device.VersiPorts; } - } - - public int NumberOfVersiPorts - { - get { return _device.NumberOfVersiPorts; } - } - - #endregion - - - } - - public class DinIo8ControllerFactory : EssentialsDeviceFactory - { - public DinIo8ControllerFactory() - { - TypeNames = new List() { "DinIo8" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new DinIo8 Device"); - - return new DinIo8Controller(dc.Key, GetDinIo8Device, dc); - } - - static DinIo8 GetDinIo8Device(DeviceConfig dc) - { - var control = CommFactory.GetControlPropertiesConfig(dc); - var cresnetId = control.CresnetIdInt; - var branchId = control.ControlPortNumber; - var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey; - - if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase)) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new DinIo8", parentKey); - return new DinIo8(cresnetId, Global.ControlSystem); - } - var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches; - - if (cresnetBridge != null) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new DinIo8", parentKey); - return new DinIo8(cresnetId, cresnetBridge.CresnetBranches[branchId]); - } - Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey); - return null; - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericDigitalInputDevice.cs b/src/PepperDash.Essentials.Core/Crestron IO/GenericDigitalInputDevice.cs similarity index 100% rename from src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericDigitalInputDevice.cs rename to src/PepperDash.Essentials.Core/Crestron IO/GenericDigitalInputDevice.cs diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Relay/GenericRelayDevice.cs b/src/PepperDash.Essentials.Core/Crestron IO/GenericRelayDevice.cs similarity index 100% rename from src/PepperDash.Essentials.Core/Crestron IO/Relay/GenericRelayDevice.cs rename to src/PepperDash.Essentials.Core/Crestron IO/GenericRelayDevice.cs diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericVersiportAnalogInputDevice.cs b/src/PepperDash.Essentials.Core/Crestron IO/GenericVersiportAnalogInputDevice.cs similarity index 100% rename from src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericVersiportAnalogInputDevice.cs rename to src/PepperDash.Essentials.Core/Crestron IO/GenericVersiportAnalogInputDevice.cs diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericVersiportInputDevice.cs b/src/PepperDash.Essentials.Core/Crestron IO/GenericVersiportInputDevice.cs similarity index 100% rename from src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericVersiportInputDevice.cs rename to src/PepperDash.Essentials.Core/Crestron IO/GenericVersiportInputDevice.cs diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Outputs/GenericVersiportOutputDevice.cs b/src/PepperDash.Essentials.Core/Crestron IO/GenericVersiportOutputDevice.cs similarity index 100% rename from src/PepperDash.Essentials.Core/Crestron IO/Outputs/GenericVersiportOutputDevice.cs rename to src/PepperDash.Essentials.Core/Crestron IO/GenericVersiportOutputDevice.cs diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Inputs/IAnalogInput.cs b/src/PepperDash.Essentials.Core/Crestron IO/IAnalogInput.cs similarity index 100% rename from src/PepperDash.Essentials.Core/Crestron IO/Inputs/IAnalogInput.cs rename to src/PepperDash.Essentials.Core/Crestron IO/IAnalogInput.cs diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Inputs/IDigitalInput.cs b/src/PepperDash.Essentials.Core/Crestron IO/IDigitalInput.cs similarity index 100% rename from src/PepperDash.Essentials.Core/Crestron IO/Inputs/IDigitalInput.cs rename to src/PepperDash.Essentials.Core/Crestron IO/IDigitalInput.cs diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Outputs/IDigitalOutput.cs b/src/PepperDash.Essentials.Core/Crestron IO/IDigitalOutput.cs similarity index 100% rename from src/PepperDash.Essentials.Core/Crestron IO/Outputs/IDigitalOutput.cs rename to src/PepperDash.Essentials.Core/Crestron IO/IDigitalOutput.cs diff --git a/src/PepperDash.Essentials.Core/Crestron IO/DinCenCn/IHasCresnetBranches.cs b/src/PepperDash.Essentials.Core/Crestron IO/IHasCresnetBranches.cs similarity index 100% rename from src/PepperDash.Essentials.Core/Crestron IO/DinCenCn/IHasCresnetBranches.cs rename to src/PepperDash.Essentials.Core/Crestron IO/IHasCresnetBranches.cs diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Relay/ISwitchedOutput.cs b/src/PepperDash.Essentials.Core/Crestron IO/ISwitchedOutput.cs similarity index 100% rename from src/PepperDash.Essentials.Core/Crestron IO/Relay/ISwitchedOutput.cs rename to src/PepperDash.Essentials.Core/Crestron IO/ISwitchedOutput.cs diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Inputs/CenIoDigIn104Controller.cs b/src/PepperDash.Essentials.Core/Crestron IO/Inputs/CenIoDigIn104Controller.cs deleted file mode 100644 index 50647126..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/Inputs/CenIoDigIn104Controller.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.GeneralIO; -using PepperDash.Essentials.Core.Config; - - -using PepperDash.Core; - -namespace PepperDash.Essentials.Core -{ - /// - /// Wrapper class for CEN-IO-DIGIN-104 digital input module - /// - [Description("Wrapper class for the CEN-IO-DIGIN-104 diginal input module")] - public class CenIoDigIn104Controller : CrestronGenericBaseDevice, IDigitalInputPorts - { - public CenIoDi104 Di104 { get; private set; } - - public CenIoDigIn104Controller(string key, string name, CenIoDi104 di104) - : base(key, name) - { - Di104 = di104; - } - - #region IDigitalInputPorts Members - - public CrestronCollection DigitalInputPorts - { - get { return Di104.DigitalInputPorts; } - } - - public int NumberOfDigitalInputPorts - { - get { return Di104.NumberOfDigitalInputPorts; } - } - - #endregion - } - - public class CenIoDigIn104ControllerFactory : EssentialsDeviceFactory - { - public CenIoDigIn104ControllerFactory() - { - TypeNames = new List() { "ceniodigin104" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new CEN-DIGIN-104 Device"); - - var control = CommFactory.GetControlPropertiesConfig(dc); - if (control == null) - { - Debug.Console(1, "Factory failed to create a new CEN-DIGIN-104 Device, control properties not found"); - return null; - } - var ipid = control.IpIdInt; - if (ipid != 0) return new CenIoDigIn104Controller(dc.Key, dc.Name, new CenIoDi104(ipid, Global.ControlSystem)); - - Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device using IP-ID-{0}", ipid); - return null; - } - } - -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Ir/CenIoIr104Controller.cs b/src/PepperDash.Essentials.Core/Crestron IO/Ir/CenIoIr104Controller.cs deleted file mode 100644 index d994a11c..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/Ir/CenIoIr104Controller.cs +++ /dev/null @@ -1,93 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.GeneralIO; -using PepperDash.Essentials.Core.Config; - - -using PepperDash.Core; - -namespace PepperDash.Essentials.Core -{ - /// - /// Wrapper class for CEN-IO-IR-104 module - /// - [Description("Wrapper class for the CEN-IO-IR-104 module")] - public class CenIoIr104Controller : CrestronGenericBaseDevice, IIROutputPorts - { - private readonly CenIoIr104 _ir104; - - /// - /// Constructor - /// - /// - /// - /// - public CenIoIr104Controller(string key, string name, CenIoIr104 ir104) - : base(key, name, ir104) - { - _ir104 = ir104; - } - - #region IDigitalInputPorts Members - - /// - /// IR port collection - /// - public CrestronCollection IROutputPorts - { - get { return _ir104.IROutputPorts; } - } - - /// - /// Number of relay ports property - /// - public int NumberOfIROutputPorts - { - get { return _ir104.NumberOfIROutputPorts; } - } - - #endregion - } - - /// - /// CEN-IO-IR-104 controller fatory - /// - public class CenIoIr104ControllerFactory : EssentialsDeviceFactory - { - /// - /// Constructor - /// - public CenIoIr104ControllerFactory() - { - TypeNames = new List() { "cenioir104" }; - } - - /// - /// Build device CEN-IO-IR-104 - /// - /// - /// - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new CEN-IO-IR-104 Device"); - - var control = CommFactory.GetControlPropertiesConfig(dc); - if (control == null) - { - Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device, control properties not found"); - return null; - } - - var ipid = control.IpIdInt; - if(ipid != 0) return new CenIoIr104Controller(dc.Key, dc.Name, new CenIoIr104(ipid, Global.ControlSystem)); - - Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device using IP-ID-{0}", ipid); - return null; - } - } - -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Relay/CenIoRy104Controller.cs b/src/PepperDash.Essentials.Core/Crestron IO/Relay/CenIoRy104Controller.cs deleted file mode 100644 index ba13ede8..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/Relay/CenIoRy104Controller.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System.Collections.Generic; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.GeneralIO; -using PepperDash.Core; -using PepperDash.Essentials.Core.Config; - -namespace PepperDash.Essentials.Core -{ - /// - /// Wrapper class for CEN-IO-RY-104 relay module - /// - [Description("Wrapper class for the CEN-IO-RY-104 relay module")] - public class CenIoRy104Controller : CrestronGenericBaseDevice, IRelayPorts - { - private readonly CenIoRy104 _ry104; - - /// - /// Constructor - /// - /// - /// - /// - public CenIoRy104Controller(string key, string name, CenIoRy104 ry104) - : base(key, name, ry104) - { - _ry104 = ry104; - } - - /// - /// Relay port collection - /// - public CrestronCollection RelayPorts - { - get { return _ry104.RelayPorts; } - } - - /// - /// Number of relay ports property - /// - public int NumberOfRelayPorts - { - get { return _ry104.NumberOfRelayPorts; } - } - } - - /// - /// CEN-IO-RY Controller factory - /// - public class CenIoRy104ControllerFactory : EssentialsDeviceFactory - { - /// - /// Constructor - /// - public CenIoRy104ControllerFactory() - { - TypeNames = new List() { "ceniory104" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create a new CEN-IO-RY-104 Device"); - - var controlPropertiesConfig = CommFactory.GetControlPropertiesConfig(dc); - if (controlPropertiesConfig == null) - { - Debug.Console(1, "Factory failed to create a new CEN-IO-RY-104 Device, control properties not found"); - return null; - } - - var ipid = controlPropertiesConfig.IpIdInt; - if (ipid != 0) return new CenIoRy104Controller(dc.Key, dc.Name, new CenIoRy104(ipid, Global.ControlSystem)); - - Debug.Console(1, "Factory failed to create a new CEN-IO-RY-104 Device using IP-ID-{0}", ipid); - return null; - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/StatusSign/StatusSignController.cs b/src/PepperDash.Essentials.Core/Crestron IO/StatusSign/StatusSignController.cs deleted file mode 100644 index 3fd66f3b..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/StatusSign/StatusSignController.cs +++ /dev/null @@ -1,225 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.GeneralIO; -using Full.Newtonsoft.Json; -using PepperDash.Core; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.Core.Config; - -namespace PepperDash.Essentials.Core.CrestronIO -{ - [Description("Wrapper class for the Crestron StatusSign device")] - public class StatusSignController : CrestronGenericBridgeableBaseDevice - { - private StatusSign _device; - - public BoolFeedback RedLedEnabledFeedback { get; private set; } - public BoolFeedback GreenLedEnabledFeedback { get; private set; } - public BoolFeedback BlueLedEnabledFeedback { get; private set; } - - public IntFeedback RedLedBrightnessFeedback { get; private set; } - public IntFeedback GreenLedBrightnessFeedback { get; private set; } - public IntFeedback BlueLedBrightnessFeedback { get; private set; } - - public StatusSignController(string key, Func preActivationFunc, DeviceConfig config) : base(key, config.Name) - { - AddPreActivationAction(() => - { - _device = preActivationFunc(config); - - RegisterCrestronGenericBase(_device); - - RedLedEnabledFeedback = - new BoolFeedback( - () => - _device.Leds[(uint)StatusSign.Led.eLedColor.Red] - .ControlFeedback.BoolValue); - GreenLedEnabledFeedback = - new BoolFeedback( - () => - _device.Leds[(uint)StatusSign.Led.eLedColor.Green] - .ControlFeedback.BoolValue); - BlueLedEnabledFeedback = - new BoolFeedback( - () => - _device.Leds[(uint)StatusSign.Led.eLedColor.Blue] - .ControlFeedback.BoolValue); - - RedLedBrightnessFeedback = - new IntFeedback(() => (int)_device.Leds[(uint)StatusSign.Led.eLedColor.Red].BrightnessFeedback); - GreenLedBrightnessFeedback = - new IntFeedback(() => (int)_device.Leds[(uint)StatusSign.Led.eLedColor.Green].BrightnessFeedback); - BlueLedBrightnessFeedback = - new IntFeedback(() => (int)_device.Leds[(uint)StatusSign.Led.eLedColor.Blue].BrightnessFeedback); - - if (_device != null) _device.BaseEvent += _device_BaseEvent; - - }); - } - - void _device_BaseEvent(GenericBase device, BaseEventArgs args) - { - switch (args.EventId) - { - case StatusSign.LedBrightnessFeedbackEventId: - RedLedBrightnessFeedback.FireUpdate(); - GreenLedBrightnessFeedback.FireUpdate(); - BlueLedBrightnessFeedback.FireUpdate(); - break; - case StatusSign.LedControlFeedbackEventId: - RedLedEnabledFeedback.FireUpdate(); - GreenLedEnabledFeedback.FireUpdate(); - BlueLedEnabledFeedback.FireUpdate(); - break; - } - } - - public void EnableLedControl(bool red, bool green, bool blue) - { - _device.Leds[(uint) StatusSign.Led.eLedColor.Red].Control.BoolValue = red; - _device.Leds[(uint)StatusSign.Led.eLedColor.Green].Control.BoolValue = green; - _device.Leds[(uint)StatusSign.Led.eLedColor.Blue].Control.BoolValue = blue; - } - - public void SetColor(uint red, uint green, uint blue) - { - try - { - _device.Leds[(uint)StatusSign.Led.eLedColor.Red].Brightness = - (StatusSign.Led.eBrightnessPercentageValues)SimplSharpDeviceHelper.PercentToUshort(red); - } - catch (InvalidOperationException) - { - Debug.Console(1, this, "Error converting value to Red LED brightness. value: {0}", red); - } - try - { - _device.Leds[(uint)StatusSign.Led.eLedColor.Green].Brightness = - (StatusSign.Led.eBrightnessPercentageValues)SimplSharpDeviceHelper.PercentToUshort(green); - } - catch (InvalidOperationException) - { - Debug.Console(1, this, "Error converting value to Green LED brightness. value: {0}", green); - } - - try - { - _device.Leds[(uint)StatusSign.Led.eLedColor.Blue].Brightness = - (StatusSign.Led.eBrightnessPercentageValues)SimplSharpDeviceHelper.PercentToUshort(blue); - } - catch (InvalidOperationException) - { - Debug.Console(1, this, "Error converting value to Blue LED brightness. value: {0}", blue); - } - } - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new StatusSignControllerJoinMap(joinStart); - - var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - - if (bridge != null) - { - bridge.AddJoinMap(Key, joinMap); - } - else - { - Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); - } - - Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - - trilist.SetBoolSigAction(joinMap.RedControl.JoinNumber, b => EnableControl(trilist, joinMap, this)); - trilist.SetBoolSigAction(joinMap.GreenControl.JoinNumber, b => EnableControl(trilist, joinMap, this)); - trilist.SetBoolSigAction(joinMap.BlueControl.JoinNumber, b => EnableControl(trilist, joinMap, this)); - - trilist.SetUShortSigAction(joinMap.RedLed.JoinNumber, u => SetColor(trilist, joinMap, this)); - trilist.SetUShortSigAction(joinMap.GreenLed.JoinNumber, u => SetColor(trilist, joinMap, this)); - trilist.SetUShortSigAction(joinMap.BlueLed.JoinNumber, u => SetColor(trilist, joinMap, this)); - - trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name; - - IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); - RedLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RedControl.JoinNumber]); - BlueLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.BlueControl.JoinNumber]); - GreenLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.GreenControl.JoinNumber]); - - RedLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.RedLed.JoinNumber]); - BlueLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.BlueLed.JoinNumber]); - GreenLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.GreenLed.JoinNumber]); - } - - private static void EnableControl(BasicTriList triList, StatusSignControllerJoinMap joinMap, - StatusSignController device) - { - var redEnable = triList.BooleanOutput[joinMap.RedControl.JoinNumber].BoolValue; - var greenEnable = triList.BooleanOutput[joinMap.GreenControl.JoinNumber].BoolValue; - var blueEnable = triList.BooleanOutput[joinMap.BlueControl.JoinNumber].BoolValue; - device.EnableLedControl(redEnable, greenEnable, blueEnable); - } - - private static void SetColor(BasicTriList triList, StatusSignControllerJoinMap joinMap, - StatusSignController device) - { - var redBrightness = triList.UShortOutput[joinMap.RedLed.JoinNumber].UShortValue; - var greenBrightness = triList.UShortOutput[joinMap.GreenLed.JoinNumber].UShortValue; - var blueBrightness = triList.UShortOutput[joinMap.BlueLed.JoinNumber].UShortValue; - - device.SetColor(redBrightness, greenBrightness, blueBrightness); - } - - #region PreActivation - - private static StatusSign GetStatusSignDevice(DeviceConfig dc) - { - var control = CommFactory.GetControlPropertiesConfig(dc); - var cresnetId = control.CresnetIdInt; - var branchId = control.ControlPortNumber; - var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey; - - if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase)) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new StatusSign", parentKey); - return new StatusSign(cresnetId, Global.ControlSystem); - } - var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches; - - if (cresnetBridge != null) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new StatusSign", parentKey); - return new StatusSign(cresnetId, cresnetBridge.CresnetBranches[branchId]); - } - Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey); - return null; - } - #endregion - - public class StatusSignControllerFactory : EssentialsDeviceFactory - { - public StatusSignControllerFactory() - { - TypeNames = new List() { "statussign" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new StatusSign Device"); - - var control = CommFactory.GetControlPropertiesConfig(dc); - var cresnetId = control.CresnetIdInt; - - return new StatusSignController(dc.Key, GetStatusSignDevice, dc); - } - } - } - - -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Gateways/CenCn2Controller.cs b/src/PepperDash.Essentials.Core/Gateways/CenCn2Controller.cs deleted file mode 100644 index 7134106f..00000000 --- a/src/PepperDash.Essentials.Core/Gateways/CenCn2Controller.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -namespace PepperDash_Essentials_Core.Gateways -{ - public class CenCn2Controller - { - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Gateways/CenRfgwController.cs b/src/PepperDash.Essentials.Core/Gateways/CenRfgwController.cs deleted file mode 100644 index 588a5701..00000000 --- a/src/PepperDash.Essentials.Core/Gateways/CenRfgwController.cs +++ /dev/null @@ -1,197 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.Gateways; -using Full.Newtonsoft.Json; -using Crestron.SimplSharpPro.DeviceSupport; - - -using PepperDash.Core; -using PepperDash.Essentials.Core.Config; - - -namespace PepperDash.Essentials.Core -{ - [Description("Wrapper class for Crestron Infinet-EX Gateways")] - public class CenRfgwController : CrestronGenericBaseDevice, IHasReady - { - public event EventHandler IsReadyEvent; - - public bool IsReady { get; private set; } - - private GatewayBase _gateway; - - public GatewayBase GateWay - { - get { return _gateway; } - } - - /// - /// Constructor for the on-board gateway - /// - /// - /// - /// - public CenRfgwController(string key, string name, GatewayBase gateway) : - base(key, name, gateway) - { - _gateway = gateway; - IsReady = true; - FireIsReadyEvent(IsReady); - } - - public CenRfgwController(string key, Func preActivationFunc, DeviceConfig config) : - base(key, config.Name) - { - IsReady = false; - FireIsReadyEvent(IsReady); - AddPreActivationAction(() => - { - _gateway = preActivationFunc(config); - - IsReady = true; - RegisterCrestronGenericBase(_gateway); - FireIsReadyEvent(IsReady); - - }); - } - - public static GatewayBase GetNewIpRfGateway(DeviceConfig dc) - { - var control = CommFactory.GetControlPropertiesConfig(dc); - var type = dc.Type; - var ipId = control.IpIdInt; - - if (type.Equals("cenrfgwex", StringComparison.InvariantCultureIgnoreCase)) - { - return new CenRfgwEx(ipId, Global.ControlSystem); - } - if (type.Equals("cenerfgwpoe", StringComparison.InvariantCultureIgnoreCase)) - { - return new CenErfgwPoe(ipId, Global.ControlSystem); - } - return null; - } - - private void FireIsReadyEvent(bool data) - { - var handler = IsReadyEvent; - if (handler == null) return; - - handler(this, new IsReadyEventArgs(data)); - - } - - public static GatewayBase GetNewSharedIpRfGateway(DeviceConfig dc) - { - var control = CommFactory.GetControlPropertiesConfig(dc); - var ipId = control.IpIdInt; - - if (dc.Type.Equals("cenrfgwex", StringComparison.InvariantCultureIgnoreCase)) - { - return new CenRfgwExEthernetSharable(ipId, Global.ControlSystem); - } - if (dc.Type.Equals("cenerfgwpoe", StringComparison.InvariantCultureIgnoreCase)) - { - return new CenErfgwPoeEthernetSharable(ipId, Global.ControlSystem); - } - return null; - } - - public static GatewayBase GetCenRfgwCresnetController(DeviceConfig dc) - { - var control = CommFactory.GetControlPropertiesConfig(dc); - var type = dc.Type; - var cresnetId = control.CresnetIdInt; - var branchId = control.ControlPortNumber; - var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey; - - if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase)) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new CenRfgw", parentKey); - if (type.Equals("cenerfgwpoe", StringComparison.InvariantCultureIgnoreCase)) - { - return new CenErfgwPoeCresnet(cresnetId, Global.ControlSystem); - } - if (type.Equals("cenrfgwex", StringComparison.InvariantCultureIgnoreCase)) - { - return new CenRfgwExCresnet(cresnetId, Global.ControlSystem); - } - } - var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as ICresnetBridge; - - if (cresnetBridge != null) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new CenRfgw", parentKey); - - if (type.Equals("cenerfgwpoe", StringComparison.InvariantCultureIgnoreCase)) - { - return new CenErfgwPoeCresnet(cresnetId, cresnetBridge.Branches[branchId]); - } - if (type.Equals("cenrfgwex", StringComparison.InvariantCultureIgnoreCase)) - { - return new CenRfgwExCresnet(cresnetId, cresnetBridge.Branches[branchId]); - } - } - Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey); - return null; - } - - - - - - - - public enum EExGatewayType - { - Ethernet, - EthernetShared, - Cresnet - } - - - #region Factory - - public class CenRfgwControllerFactory : EssentialsDeviceFactory - { - public CenRfgwControllerFactory() - { - TypeNames = new List {"cenrfgwex", "cenerfgwpoe"}; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - - Debug.Console(1, "Factory Attempting to create new CEN-GWEXER Device"); - - var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); - - EExGatewayType gatewayType = - (EExGatewayType) Enum.Parse(typeof (EExGatewayType), props.GatewayType, true); - - switch (gatewayType) - { - case (EExGatewayType.Ethernet): - return new CenRfgwController(dc.Key, dc.Name, GetNewIpRfGateway(dc)); - case (EExGatewayType.EthernetShared): - return new CenRfgwController(dc.Key, dc.Name, GetNewSharedIpRfGateway(dc)); - case (EExGatewayType.Cresnet): - return new CenRfgwController(dc.Key, GetCenRfgwCresnetController, dc); - } - return null; - } - } - - #endregion - } - - -} - - diff --git a/src/PepperDash.Essentials.Core/Gateways/EssentialsRfGatewayConfig.cs b/src/PepperDash.Essentials.Core/Gateways/EssentialsRfGatewayConfig.cs deleted file mode 100644 index 353e73b9..00000000 --- a/src/PepperDash.Essentials.Core/Gateways/EssentialsRfGatewayConfig.cs +++ /dev/null @@ -1,25 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; -using PepperDash.Core; -using PepperDash.Essentials.Core.Config; - - -namespace PepperDash.Essentials.Core -{ - public class EssentialsRfGatewayConfig - { - [JsonProperty("control")] - public EssentialsControlPropertiesConfig Control { get; set; } - - [JsonProperty("gatewayType")] - public string GatewayType { get; set; } - - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Occupancy/CenOdtOccupancySensorBaseController.cs b/src/PepperDash.Essentials.Core/Occupancy/CenOdtOccupancySensorBaseController.cs deleted file mode 100644 index 5b778a6d..00000000 --- a/src/PepperDash.Essentials.Core/Occupancy/CenOdtOccupancySensorBaseController.cs +++ /dev/null @@ -1,777 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Resources; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.GeneralIO; -using Full.Newtonsoft.Json; -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Core.Bridges; - -namespace PepperDash.Essentials.Core -{ - [Description("Wrapper class for CEN-ODT-C-POE")] - [ConfigSnippet("\"properties\": {\"control\": {\"method\": \"cresnet\",\"cresnetId\": \"97\"},\"enablePir\": true,\"enableLedFlash\": true,\"enableRawStates\":true,\"remoteTimeout\": 30,\"internalPhotoSensorMinChange\": 0,\"externalPhotoSensorMinChange\": 0,\"enableUsA\": true,\"enableUsB\": true,\"orWhenVacatedState\": true}")] - public class CenOdtOccupancySensorBaseController : CrestronGenericBridgeableBaseDevice, IOccupancyStatusProvider - { - public CenOdtCPoe OccSensor { get; private set; } - - public GlsOccupancySensorPropertiesConfig PropertiesConfig { get; private set; } - - public BoolFeedback RoomIsOccupiedFeedback { get; private set; } - - public BoolFeedback GraceOccupancyDetectedFeedback { get; private set; } - - public BoolFeedback RawOccupancyFeedback { get; private set; } - - public BoolFeedback PirSensorEnabledFeedback { get; private set; } - - public BoolFeedback LedFlashEnabledFeedback { get; private set; } - - public BoolFeedback ShortTimeoutEnabledFeedback { get; private set; } - - public IntFeedback PirSensitivityInVacantStateFeedback { get; private set; } - - public IntFeedback PirSensitivityInOccupiedStateFeedback { get; private set; } - - public IntFeedback CurrentTimeoutFeedback { get; private set; } - - public IntFeedback RemoteTimeoutFeedback { get; private set; } - - public IntFeedback InternalPhotoSensorValue { get; set; } - - public IntFeedback ExternalPhotoSensorValue { get; set; } - - public BoolFeedback OrWhenVacatedFeedback { get; private set; } - - public BoolFeedback AndWhenVacatedFeedback { get; private set; } - - public BoolFeedback UltrasonicAEnabledFeedback { get; private set; } - - public BoolFeedback UltrasonicBEnabledFeedback { get; private set; } - - public IntFeedback UltrasonicSensitivityInVacantStateFeedback { get; private set; } - - public IntFeedback UltrasonicSensitivityInOccupiedStateFeedback { get; private set; } - - public BoolFeedback RawOccupancyPirFeedback { get; private set; } - - public BoolFeedback RawOccupancyUsFeedback { get; private set; } - - public BoolFeedback IdentityModeFeedback { get; private set; } - - // Debug properties - public bool InTestMode { get; private set; } - - public bool TestRoomIsOccupiedFeedback { get; private set; } - - public Func RoomIsOccupiedFeedbackFunc - { - get - { - return () => InTestMode ? TestRoomIsOccupiedFeedback : OccSensor.OccupancyDetectedFeedback.BoolValue; - } - } - - public CenOdtOccupancySensorBaseController(string key, string name, CenOdtCPoe sensor, GlsOccupancySensorPropertiesConfig config) - : base(key, name, sensor) - { - PropertiesConfig = config; - - OccSensor = sensor; - - RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc); - - PirSensorEnabledFeedback = new BoolFeedback(() => OccSensor.PassiveInfraredSensorEnabledFeedback.BoolValue); - - LedFlashEnabledFeedback = new BoolFeedback(() => OccSensor.LedFlashEnabledFeedback.BoolValue); - - ShortTimeoutEnabledFeedback = new BoolFeedback(() => OccSensor.ShortTimeoutEnabledFeedback.BoolValue); - - PirSensitivityInVacantStateFeedback = new IntFeedback(() => (int)OccSensor.PassiveInfraredSensorSensitivityInVacantStateFeedback); - - PirSensitivityInOccupiedStateFeedback = new IntFeedback(() => (int)OccSensor.PassiveInfraredSensorSensitivityInOccupiedStateFeedback); - - CurrentTimeoutFeedback = new IntFeedback(() => OccSensor.CurrentTimeoutFeedback.UShortValue); - - RemoteTimeoutFeedback = new IntFeedback(() => OccSensor.RemoteTimeout.UShortValue); - - GraceOccupancyDetectedFeedback = new BoolFeedback(() => OccSensor.GraceOccupancyDetectedFeedback.BoolValue); - - RawOccupancyFeedback = new BoolFeedback(() => OccSensor.RawOccupancyDetectedFeedback.BoolValue); - - InternalPhotoSensorValue = new IntFeedback(() => OccSensor.InternalPhotoSensorValueFeedback.UShortValue); - - //ExternalPhotoSensorValue = new IntFeedback(() => OccSensor.ex.UShortValue); - - AndWhenVacatedFeedback = new BoolFeedback(() => OccSensor.AndWhenVacatedFeedback.BoolValue); - - OrWhenVacatedFeedback = new BoolFeedback(() => OccSensor.OrWhenVacatedFeedback.BoolValue); - - UltrasonicAEnabledFeedback = new BoolFeedback(() => OccSensor.UltrasonicSensorSideAEnabledFeedback.BoolValue); - - UltrasonicBEnabledFeedback = new BoolFeedback(() => OccSensor.UltrasonicSensorSideBEnabledFeedback.BoolValue); - - RawOccupancyPirFeedback = new BoolFeedback(() => OccSensor.RawOccupancyDetectedByPassiveInfraredSensorFeedback.BoolValue); - - RawOccupancyUsFeedback = new BoolFeedback(() => OccSensor.RawOccupancyDetectedByUltrasonicSensorFeedback.BoolValue); - - IdentityModeFeedback = new BoolFeedback(()=>OccSensor.IdentityModeOnFeedback.BoolValue); - - UltrasonicSensitivityInVacantStateFeedback = new IntFeedback(() => (int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback); - - UltrasonicSensitivityInOccupiedStateFeedback = new IntFeedback(() => (int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback); - - OccSensor.BaseEvent += new Crestron.SimplSharpPro.BaseEventHandler(OccSensor_BaseEvent); - - OccSensor.CenOccupancySensorChange += new GenericEventHandler(OccSensor_CenOccupancySensorChange); - - AddPostActivationAction(() => - { - OccSensor.OnlineStatusChange += (o, a) => - { - if (a.DeviceOnLine) - { - ApplySettingsToSensorFromConfig(); - } - }; - - if (OccSensor.IsOnline) - { - ApplySettingsToSensorFromConfig(); - - } - }); - } - - /// - /// Applies any sensor settings defined in config - /// - protected virtual void ApplySettingsToSensorFromConfig() - { - Debug.Console(1, this, "Checking config for settings to apply"); - - if (PropertiesConfig.EnablePir != null) - { - SetPirEnable((bool)PropertiesConfig.EnablePir); - } - - if (PropertiesConfig.EnableLedFlash != null) - { - SetLedFlashEnable((bool)PropertiesConfig.EnableLedFlash); - } - - if (PropertiesConfig.RemoteTimeout != null) - { - SetRemoteTimeout((ushort)PropertiesConfig.RemoteTimeout); - } - - if (PropertiesConfig.ShortTimeoutState != null) - { - SetShortTimeoutState((bool)PropertiesConfig.ShortTimeoutState); - } - - if (PropertiesConfig.EnableRawStates != null) - { - EnableRawStates((bool)PropertiesConfig.EnableRawStates); - } - - if (PropertiesConfig.InternalPhotoSensorMinChange != null) - { - SetInternalPhotoSensorMinChange((ushort)PropertiesConfig.InternalPhotoSensorMinChange); - } - - if (PropertiesConfig.EnableUsA != null) - { - SetUsAEnable((bool)PropertiesConfig.EnableUsA); - } - - if (PropertiesConfig.EnableUsB != null) - { - SetUsBEnable((bool)PropertiesConfig.EnableUsB); - } - - if (PropertiesConfig.OrWhenVacatedState != null) - { - SetOrWhenVacatedState((bool)PropertiesConfig.OrWhenVacatedState); - } - - if (PropertiesConfig.AndWhenVacatedState != null) - { - SetAndWhenVacatedState((bool)PropertiesConfig.AndWhenVacatedState); - } - - // TODO [ ] feature/cenoodtcpoe-sensor-sensitivity-configuration - if (PropertiesConfig.UsSensitivityOccupied != null) - { - SetUsSensitivityOccupied((ushort)PropertiesConfig.UsSensitivityOccupied); - } - - if (PropertiesConfig.UsSensitivityVacant != null) - { - SetUsSensitivityVacant((ushort)PropertiesConfig.UsSensitivityVacant); - } - - if (PropertiesConfig.PirSensitivityOccupied != null) - { - SetPirSensitivityOccupied((ushort)PropertiesConfig.PirSensitivityOccupied); - } - - if (PropertiesConfig.PirSensitivityVacant != null) - { - SetPirSensitivityVacant((ushort)PropertiesConfig.PirSensitivityVacant); - } - } - - /// - /// 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. - /// - /// - /// - protected virtual void OccSensor_CenOccupancySensorChange(object device, GenericEventArgs 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.RawOccupancyPirFeedbackEventId) - RawOccupancyPirFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.RawOccupancyUsFeedbackEventId) - RawOccupancyUsFeedback.FireUpdate(); - } - - protected virtual void OccSensor_BaseEvent(Crestron.SimplSharpPro.GenericBase device, Crestron.SimplSharpPro.BaseEventArgs args) - { - Debug.Console(2, this, "PoEOccupancySensorChange EventId: {0}", args.EventId); - - if (args.EventId == Crestron.SimplSharpPro.GeneralIO.GlsOccupancySensorBase.RoomOccupiedFeedbackEventId - || args.EventId == Crestron.SimplSharpPro.GeneralIO.GlsOccupancySensorBase.RoomVacantFeedbackEventId) - { - Debug.Console(1, this, "Occupancy State: {0}", OccSensor.OccupancyDetectedFeedback.BoolValue); - RoomIsOccupiedFeedback.FireUpdate(); - } - else if (args.EventId == GlsOccupancySensorBase.TimeoutFeedbackEventId) - CurrentTimeoutFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.TimeoutLocalFeedbackEventId) - RemoteTimeoutFeedback.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(); - else 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(); - } - - public void SetTestMode(bool mode) - { - InTestMode = mode; - - Debug.Console(1, this, "In Mock Mode: '{0}'", InTestMode); - } - - public void SetTestOccupiedState(bool state) - { - if (!InTestMode) - Debug.Console(1, "Mock mode not enabled"); - else - { - TestRoomIsOccupiedFeedback = state; - - RoomIsOccupiedFeedback.FireUpdate(); - } - } - - /// - /// Sets the identity mode on or off - /// - /// - public void SetIdentityMode(bool state) - { - if (state) - OccSensor.IdentityModeOn(); - else - OccSensor.IdentityModeOff(); - - Debug.Console(1, this, "Identity Mode: {0}", OccSensor.IdentityModeOnFeedback.BoolValue ? "On" : "Off"); - } - - /// - /// Enables or disables the PIR sensor - /// - /// - public void SetPirEnable(bool state) - { - if (state) - { - OccSensor.EnablePassiveInfraredSensor(); - } - else - { - OccSensor.DisablePassiveInfraredSensor(); - } - } - - /// - /// Enables or disables the LED Flash - /// - /// - public void SetLedFlashEnable(bool state) - { - if (state) - { - OccSensor.EnableLedFlash(); - } - else - { - OccSensor.DisableLedFlash(); - } - } - - /// - /// Enables or disables short timeout based on state - /// - /// - public void SetShortTimeoutState(bool state) - { - if (state) - { - OccSensor.EnableShortTimeout(); - } - else - { - OccSensor.DisableShortTimeout(); - } - } - - public void IncrementPirSensitivityInOccupiedState(bool pressRelease) - { - if ((int)OccSensor.PassiveInfraredSensorSensitivityInOccupiedStateFeedback != 3) - { - OccSensor.PassiveInfraredSensorSensitivityInOccupiedState = OccSensor.PassiveInfraredSensorSensitivityInOccupiedStateFeedback + 1; - } - } - - public void DecrementPirSensitivityInOccupiedState(bool pressRelease) - { - if ((int)OccSensor.PassiveInfraredSensorSensitivityInOccupiedStateFeedback != 0) - { - OccSensor.PassiveInfraredSensorSensitivityInOccupiedState = OccSensor.PassiveInfraredSensorSensitivityInOccupiedStateFeedback - 1; - } - } - - public void IncrementPirSensitivityInVacantState(bool pressRelease) - { - if ((int)OccSensor.PassiveInfraredSensorSensitivityInVacantStateFeedback != 3) - { - OccSensor.PassiveInfraredSensorSensitivityInVacantState = OccSensor.PassiveInfraredSensorSensitivityInVacantStateFeedback + 1; - } - } - - public void DecrementPirSensitivityInVacantState(bool pressRelease) - { - if ((int)OccSensor.PassiveInfraredSensorSensitivityInVacantStateFeedback != 0) - { - OccSensor.PassiveInfraredSensorSensitivityInVacantState = OccSensor.PassiveInfraredSensorSensitivityInVacantStateFeedback - 1; - } - } - - public void IncrementUsSensitivityInOccupiedState(bool pressRelease) - { - if ((int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback < 3) - { - OccSensor.UltrasonicSensorSensitivityInOccupiedState = OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback + 1; - } - else if ((int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback > 4) - { - OccSensor.UltrasonicSensorSensitivityInOccupiedState = OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback - 1; - } - else if ((int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback == 4) - { - OccSensor.UltrasonicSensorSensitivityInOccupiedState = 0; - } - } - - public void DecrementUsSensitivityInOccupiedState(bool pressRelease) - { - if ((int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback > 0 - && (int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback < 4) - { - OccSensor.UltrasonicSensorSensitivityInOccupiedState = OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback - 1; - } - else if ((int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback > 3 - && (int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback < 7) - { - OccSensor.UltrasonicSensorSensitivityInOccupiedState = OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback + 1; - } - } - - public void IncrementUsSensitivityInVacantState(bool pressRelease) - { - if ((int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback < 3) - { - OccSensor.UltrasonicSensorSensitivityInVacantState = OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback + 1; - } - else if ((int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback > 4) - { - OccSensor.UltrasonicSensorSensitivityInVacantState = OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback - 1; - } - else if ((int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback == 4) - { - OccSensor.UltrasonicSensorSensitivityInVacantState = 0; - } - } - - public void DecrementUsSensitivityInVacantState(bool pressRelease) - { - if ((int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback > 0 - && (int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback < 4) - { - OccSensor.UltrasonicSensorSensitivityInVacantState = OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback - 1; - } - else if ((int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback > 3 - && (int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback < 7) - { - OccSensor.UltrasonicSensorSensitivityInVacantState = OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback + 1; - } - } - - public void ForceOccupied() - { - OccSensor.ForceOccupied(); - } - - public void ForceVacant() - { - OccSensor.ForceVacant(); - } - - public void EnableRawStates(bool state) - { - if (state) - { - OccSensor.EnableRawStates(); - } - else - OccSensor.DisableRawStates(); - } - - public void SetRemoteTimeout(ushort time) - { - OccSensor.RemoteTimeout.UShortValue = time; - } - - public void SetInternalPhotoSensorMinChange(ushort value) - { - OccSensor.InternalPhotoSensorMinimumChange.UShortValue = value; - } - - /// - /// Sets the OrWhenVacated state - /// - /// - public void SetOrWhenVacatedState(bool state) - { - if (state) - { - OccSensor.OrWhenVacated(); - } - } - - /// - /// Sets the AndWhenVacated state - /// - /// - public void SetAndWhenVacatedState(bool state) - { - if (state) - { - OccSensor.AndWhenVacated(); - } - } - - /// - /// Enables or disables the Ultrasonic A sensor - /// - /// - public void SetUsAEnable(bool state) - { - if (state) - { - OccSensor.EnableUltrasonicSensorSideA(); - } - else - { - OccSensor.DisableUltrasonicSensorSideA(); - } - } - - - /// - /// Enables or disables the Ultrasonic B sensor - /// - /// - public void SetUsBEnable(bool state) - { - if (state) - { - OccSensor.EnableUltrasonicSensorSideB(); - } - else - { - OccSensor.DisableUltrasonicSensorSideB(); - } - } - - /// - /// Sets the US sensor sensitivity for occupied state - /// - /// - public void SetUsSensitivityOccupied(ushort sensitivity) - { - var level = (eSensitivityLevel) sensitivity; - if (level == 0) return; - - OccSensor.UltrasonicSensorSensitivityInOccupiedState = level; - } - - /// - /// Sets the US sensor sensitivity for vacant state - /// - /// - public void SetUsSensitivityVacant(ushort sensitivity) - { - var level = (eSensitivityLevel)sensitivity; - if (level == 0) return; - - OccSensor.UltrasonicSensorSensitivityInVacantState = level; - } - - /// - /// Sets the PIR sensor sensitivity for occupied state - /// - /// - public void SetPirSensitivityOccupied(ushort sensitivity) - { - var level = (eSensitivityLevel)sensitivity; - if (level == 0) return; - - OccSensor.PassiveInfraredSensorSensitivityInOccupiedState = level; - } - - /// - /// Sets the PIR sensor sensitivity for vacant state - /// - /// - public void SetPirSensitivityVacant(ushort sensitivity) - { - var level = (eSensitivityLevel)sensitivity; - if (level == 0) return; - - OccSensor.PassiveInfraredSensorSensitivityInVacantState = level; - } - - /// - /// Method to print current settings to console - /// - public void GetSettings() - { - var dash = new string('*', 50); - CrestronConsole.PrintLine(string.Format("{0}\n", dash)); - - Debug.Console(0, this, "Vacancy Detected: {0}", - OccSensor.VacancyDetectedFeedback.BoolValue); - - Debug.Console(0, Key, "Timeout Current: {0} | Remote: {1}", - OccSensor.CurrentTimeoutFeedback.UShortValue, - OccSensor.RemoteTimeout.UShortValue); - - Debug.Console(0, Key, "Short Timeout Enabled: {0}", - OccSensor.ShortTimeoutEnabledFeedback.BoolValue); - - Debug.Console(0, Key, "PIR Sensor Enabled: {0} | Sensitivity Occupied: {1} | Sensitivity Vacant: {2}", - OccSensor.PassiveInfraredSensorEnabledFeedback.BoolValue, - OccSensor.PassiveInfraredSensorSensitivityInOccupiedStateFeedback, - OccSensor.PassiveInfraredSensorSensitivityInVacantStateFeedback); - - Debug.Console(0, Key, "Ultrasonic Enabled A: {0} | B: {1}", - OccSensor.UltrasonicSensorSideAEnabledFeedback.BoolValue, - OccSensor.UltrasonicSensorSideBEnabledFeedback.BoolValue); - - Debug.Console(0, Key, "Ultrasonic Sensitivity Occupied: {0} | Vacant: {1}", - OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback, - OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback); - - CrestronConsole.PrintLine(string.Format("{0}\n", dash)); - } - - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge); - } - - protected void LinkOccSensorToApi(CenOdtOccupancySensorBaseController occController, - BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - CenOdtOccupancySensorBaseJoinMap joinMap = new CenOdtOccupancySensorBaseJoinMap(joinStart); - - var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - - if (bridge != null) - { - bridge.AddJoinMap(Key, joinMap); - } - else - { - Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); - } - - Debug.Console(1, occController, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - - occController.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.Online.JoinNumber]); - trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name; - - trilist.OnlineStatusChange += new Crestron.SimplSharpPro.OnlineStatusChangeEventHandler((d, args) => - { - if (args.DeviceOnLine) - { - trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name; - } - } - ); - - // Occupied status - trilist.SetSigTrueAction(joinMap.ForceOccupied.JoinNumber, new Action(() => occController.ForceOccupied())); - trilist.SetSigTrueAction(joinMap.ForceVacant.JoinNumber, new Action(() => occController.ForceVacant())); - occController.RoomIsOccupiedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RoomOccupiedFeedback.JoinNumber]); - occController.RoomIsOccupiedFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.RoomVacantFeedback.JoinNumber]); - occController.RawOccupancyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyFeedback.JoinNumber]); - trilist.SetBoolSigAction(joinMap.EnableRawStates.JoinNumber, new Action((b) => occController.EnableRawStates(b))); - - // Timouts - trilist.SetUShortSigAction(joinMap.Timeout.JoinNumber, new Action((u) => occController.SetRemoteTimeout(u))); - occController.CurrentTimeoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.Timeout.JoinNumber]); - occController.RemoteTimeoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeoutLocalFeedback.JoinNumber]); - - // LED Flash - trilist.SetSigTrueAction(joinMap.EnableLedFlash.JoinNumber, new Action(() => occController.SetLedFlashEnable(true))); - trilist.SetSigTrueAction(joinMap.DisableLedFlash.JoinNumber, new Action(() => occController.SetLedFlashEnable(false))); - occController.LedFlashEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.EnableLedFlash.JoinNumber]); - - // Short Timeout - trilist.SetSigTrueAction(joinMap.EnableShortTimeout.JoinNumber, new Action(() => occController.SetShortTimeoutState(true))); - trilist.SetSigTrueAction(joinMap.DisableShortTimeout.JoinNumber, new Action(() => occController.SetShortTimeoutState(false))); - occController.ShortTimeoutEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableShortTimeout.JoinNumber]); - - // PIR Sensor - trilist.SetSigTrueAction(joinMap.EnablePir.JoinNumber, new Action(() => occController.SetPirEnable(true))); - trilist.SetSigTrueAction(joinMap.DisablePir.JoinNumber, new Action(() => occController.SetPirEnable(false))); - occController.PirSensorEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnablePir.JoinNumber]); - - // PIR Sensitivity in Occupied State - trilist.SetBoolSigAction(joinMap.IncrementPirInOccupiedState.JoinNumber, new Action((b) => occController.IncrementPirSensitivityInOccupiedState(b))); - trilist.SetBoolSigAction(joinMap.DecrementPirInOccupiedState.JoinNumber, new Action((b) => occController.DecrementPirSensitivityInOccupiedState(b))); - occController.PirSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInOccupiedState.JoinNumber]); - - // PIR Sensitivity in Vacant State - trilist.SetBoolSigAction(joinMap.IncrementPirInVacantState.JoinNumber, new Action((b) => occController.IncrementPirSensitivityInVacantState(b))); - trilist.SetBoolSigAction(joinMap.DecrementPirInVacantState.JoinNumber, new Action((b) => occController.DecrementPirSensitivityInVacantState(b))); - occController.PirSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInVacantState.JoinNumber]); - - // OR When Vacated - trilist.SetBoolSigAction(joinMap.OrWhenVacated.JoinNumber, new Action((b) => occController.SetOrWhenVacatedState(b))); - occController.OrWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.OrWhenVacated.JoinNumber]); - - // AND When Vacated - trilist.SetBoolSigAction(joinMap.AndWhenVacated.JoinNumber, new Action((b) => occController.SetAndWhenVacatedState(b))); - occController.AndWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AndWhenVacated.JoinNumber]); - - // Ultrasonic A Sensor - trilist.SetSigTrueAction(joinMap.EnableUsA.JoinNumber, new Action(() => occController.SetUsAEnable(true))); - trilist.SetSigTrueAction(joinMap.DisableUsA.JoinNumber, new Action(() => occController.SetUsAEnable(false))); - occController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsA.JoinNumber]); - - // Ultrasonic B Sensor - trilist.SetSigTrueAction(joinMap.EnableUsB.JoinNumber, new Action(() => occController.SetUsBEnable(true))); - trilist.SetSigTrueAction(joinMap.DisableUsB.JoinNumber, new Action(() => occController.SetUsBEnable(false))); - occController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsB.JoinNumber]); - - // US Sensitivity in Occupied State - trilist.SetBoolSigAction(joinMap.IncrementUsInOccupiedState.JoinNumber, new Action((b) => occController.IncrementUsSensitivityInOccupiedState(b))); - trilist.SetBoolSigAction(joinMap.DecrementUsInOccupiedState.JoinNumber, new Action((b) => occController.DecrementUsSensitivityInOccupiedState(b))); - occController.UltrasonicSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInOccupiedState.JoinNumber]); - - // US Sensitivity in Vacant State - trilist.SetBoolSigAction(joinMap.IncrementUsInVacantState.JoinNumber, new Action((b) => occController.IncrementUsSensitivityInVacantState(b))); - trilist.SetBoolSigAction(joinMap.DecrementUsInVacantState.JoinNumber, new Action((b) => occController.DecrementUsSensitivityInVacantState(b))); - occController.UltrasonicSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInVacantState.JoinNumber]); - - //Sensor Raw States - occController.RawOccupancyPirFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyPirFeedback.JoinNumber]); - occController.RawOccupancyUsFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyUsFeedback.JoinNumber]); - - // Identity mode - trilist.SetBoolSigAction(joinMap.IdentityMode.JoinNumber, occController.SetIdentityMode); - occController.IdentityModeFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IdentityModeFeedback.JoinNumber]); - } - - public class CenOdtOccupancySensorBaseControllerFactory : EssentialsDeviceFactory - { - public CenOdtOccupancySensorBaseControllerFactory() - { - TypeNames = new List() { "cenodtcpoe", "cenodtocc" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device"); - - var typeName = dc.Type.ToLower(); - var key = dc.Key; - var name = dc.Name; - var comm = CommFactory.GetControlPropertiesConfig(dc); - - var props = dc.Properties.ToObject(); - - var occSensor = new CenOdtCPoe(comm.IpIdInt, Global.ControlSystem); - - if (occSensor == null) - { - Debug.Console(0, "ERROR: Unable to create Occupancy Sensor Device. Key: '{0}'", key); - return null; - } - - return new CenOdtOccupancySensorBaseController(key, name, occSensor, props); - } - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Occupancy/EssentialsGlsOccupancySensorBaseController.cs.orig b/src/PepperDash.Essentials.Core/Occupancy/EssentialsGlsOccupancySensorBaseController.cs.orig deleted file mode 100644 index f65e1b37..00000000 --- a/src/PepperDash.Essentials.Core/Occupancy/EssentialsGlsOccupancySensorBaseController.cs.orig +++ /dev/null @@ -1,87 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.GeneralIO; - -using PepperDash.Core; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Devices.Common.Occupancy -{ - public class EssentialsGlsOccupancySensorBaseController : CrestronGenericBaseDevice, IOccupancyStatusProvider - { - public GlsOccupancySensorBase OccSensor { get; private set; } - - public BoolFeedback RoomIsOccupiedFeedback { get; private set; } - -<<<<<<< HEAD - /// - /// Set by debugging functions - /// - public bool InMockMode { get; private set; } - - public bool MockRoomIsOccupiedFeedback { get; private set; } -======= - // Debug properties - public bool InTestMode { get; private set; } - - public bool TestRoomIsOccupiedFeedback { get; private set; } ->>>>>>> origin/feature/ecs-342-neil - - public Func RoomIsOccupiedFeedbackFunc - { - get - { -<<<<<<< HEAD - return () => InMockMode ? MockRoomIsOccupiedFeedback : OccSensor.OccupancyDetectedFeedback.BoolValue; -======= - return () => InTestMode ? TestRoomIsOccupiedFeedback : OccSensor.OccupancyDetectedFeedback.BoolValue; ->>>>>>> origin/feature/ecs-342-neil - } - } - - public EssentialsGlsOccupancySensorBaseController(string key, string name, GlsOccupancySensorBase sensor, GlsOccupancySensorConfigurationProperties props) - : base(key, name, sensor) - { - OccSensor = sensor; - RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc); - - OccSensor.GlsOccupancySensorChange += new GlsOccupancySensorChangeEventHandler(sensor_GlsOccupancySensorChange); - } - - void sensor_GlsOccupancySensorChange(GlsOccupancySensorBase device, GlsOccupancySensorChangeEventArgs args) - { - RoomIsOccupiedFeedback.FireUpdate(); - } - - public void SetTestMode(bool mode) - { - InTestMode = mode; - - Debug.Console(1, this, "In Mock Mode: '{0}'", InTestMode); - } - - public void SetTestOccupiedState(bool state) - { - if (!InTestMode) - Debug.Console(1, "Mock mode not enabled"); - else - { - TestRoomIsOccupiedFeedback = state; - - RoomIsOccupiedFeedback.FireUpdate(); - } - } - } - - /// - /// - /// - public class GlsOccupancySensorConfigurationProperties - { - public string CresnetId { get; set; } - public string Model { get; set; } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Occupancy/GlsOccupancySensorBaseController.cs b/src/PepperDash.Essentials.Core/Occupancy/GlsOccupancySensorBaseController.cs deleted file mode 100644 index 013af926..00000000 --- a/src/PepperDash.Essentials.Core/Occupancy/GlsOccupancySensorBaseController.cs +++ /dev/null @@ -1,541 +0,0 @@ -extern alias Full; - -using System; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.GeneralIO; -using Full.Newtonsoft.Json; -using PepperDash.Core; -using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Core.Bridges; - -namespace PepperDash.Essentials.Core -{ - [Description("Wrapper class for Single Technology GLS Occupancy Sensors")] - [ConfigSnippet("\"properties\": {\"control\": {\"method\": \"cresnet\",\"cresnetId\": \"97\"},\"enablePir\": true,\"enableLedFlash\": true,\"enableRawStates\":true,\"remoteTimeout\": 30,\"internalPhotoSensorMinChange\": 0,\"externalPhotoSensorMinChange\": 0}")] - public abstract class GlsOccupancySensorBaseController : CrestronGenericBridgeableBaseDevice, IOccupancyStatusProvider - { - public GlsOccupancySensorPropertiesConfig PropertiesConfig { get; private set; } - - protected GlsOccupancySensorBase OccSensor; - - public BoolFeedback RoomIsOccupiedFeedback { get; private set; } - - public BoolFeedback GraceOccupancyDetectedFeedback { get; private set; } - - public BoolFeedback RawOccupancyFeedback { get; private set; } - - public BoolFeedback PirSensorEnabledFeedback { get; private set; } - - public BoolFeedback LedFlashEnabledFeedback { get; private set; } - - public BoolFeedback ShortTimeoutEnabledFeedback { get; private set; } - - public IntFeedback PirSensitivityInVacantStateFeedback { get; private set; } - - public IntFeedback PirSensitivityInOccupiedStateFeedback { get; private set; } - - public IntFeedback CurrentTimeoutFeedback { get; private set; } - - public IntFeedback LocalTimoutFeedback { get; private set; } - - public IntFeedback InternalPhotoSensorValue { get; set; } - - public IntFeedback ExternalPhotoSensorValue { get; set; } - - // Debug properties - public bool InTestMode { get; private set; } - - public bool TestRoomIsOccupiedFeedback { get; private set; } - - public Func RoomIsOccupiedFeedbackFunc - { - get - { - return () => InTestMode ? TestRoomIsOccupiedFeedback : OccSensor.OccupancyDetectedFeedback.BoolValue; - } - } - - protected GlsOccupancySensorBaseController(string key, DeviceConfig config) - : this(key, config.Name, config) - { - } - - protected GlsOccupancySensorBaseController(string key, string name, DeviceConfig config) - : base(key, name) - { - - var props = config.Properties.ToObject(); - - if (props != null) - { - PropertiesConfig = props; - } - else - { - Debug.Console(1, this, "props are null. Unable to deserialize into GlsOccupancySensorPropertiesConfig"); - } - - AddPostActivationAction(() => - { - OccSensor.OnlineStatusChange += (o, a) => - { - if (a.DeviceOnLine) - { - ApplySettingsToSensorFromConfig(); - } - }; - - if (OccSensor.IsOnline) - { - ApplySettingsToSensorFromConfig(); - - } - }); - } - - - /// - /// Applies any sensor settings defined in config - /// - protected virtual void ApplySettingsToSensorFromConfig() - { - Debug.Console(1, this, "Attempting to apply settings to sensor from config"); - - if (PropertiesConfig.EnablePir != null) - { - Debug.Console(1, this, "EnablePir found, attempting to set value from config"); - SetPirEnable((bool)PropertiesConfig.EnablePir); - } - else - { - Debug.Console(1, this, "EnablePir null, no value specified in config"); - } - - if (PropertiesConfig.EnableLedFlash != null) - { - Debug.Console(1, this, "EnableLedFlash found, attempting to set value from config"); - SetLedFlashEnable((bool)PropertiesConfig.EnableLedFlash); - } - - if (PropertiesConfig.RemoteTimeout != null) - { - Debug.Console(1, this, "RemoteTimeout found, attempting to set value from config"); - SetRemoteTimeout((ushort)PropertiesConfig.RemoteTimeout); - } - else - { - Debug.Console(1, this, "RemoteTimeout null, no value specified in config"); - } - - if (PropertiesConfig.ShortTimeoutState != null) - { - SetShortTimeoutState((bool)PropertiesConfig.ShortTimeoutState); - } - - if (PropertiesConfig.EnableRawStates != null) - { - EnableRawStates((bool)PropertiesConfig.EnableRawStates); - } - - if (PropertiesConfig.InternalPhotoSensorMinChange != null) - { - SetInternalPhotoSensorMinChange((ushort)PropertiesConfig.InternalPhotoSensorMinChange); - } - - if (PropertiesConfig.ExternalPhotoSensorMinChange != null) - { - SetExternalPhotoSensorMinChange((ushort)PropertiesConfig.ExternalPhotoSensorMinChange); - } - } - - protected void RegisterGlsOccupancySensorBaseController(GlsOccupancySensorBase occSensor) - { - OccSensor = occSensor; - - RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc); - - PirSensorEnabledFeedback = new BoolFeedback(() => OccSensor.PirEnabledFeedback.BoolValue); - - LedFlashEnabledFeedback = new BoolFeedback(() => OccSensor.LedFlashEnabledFeedback.BoolValue); - - ShortTimeoutEnabledFeedback = new BoolFeedback(() => OccSensor.ShortTimeoutEnabledFeedback.BoolValue); - - PirSensitivityInVacantStateFeedback = - new IntFeedback(() => OccSensor.PirSensitivityInVacantStateFeedback.UShortValue); - - PirSensitivityInOccupiedStateFeedback = - new IntFeedback(() => OccSensor.PirSensitivityInOccupiedStateFeedback.UShortValue); - - CurrentTimeoutFeedback = new IntFeedback(() => OccSensor.CurrentTimeoutFeedback.UShortValue); - - LocalTimoutFeedback = new IntFeedback(() => OccSensor.LocalTimeoutFeedback.UShortValue); - - GraceOccupancyDetectedFeedback = - new BoolFeedback(() => OccSensor.GraceOccupancyDetectedFeedback.BoolValue); - - RawOccupancyFeedback = new BoolFeedback(() => OccSensor.RawOccupancyFeedback.BoolValue); - - InternalPhotoSensorValue = new IntFeedback(() => OccSensor.InternalPhotoSensorValueFeedback.UShortValue); - - ExternalPhotoSensorValue = new IntFeedback(() => OccSensor.ExternalPhotoSensorValueFeedback.UShortValue); - - OccSensor.BaseEvent += OccSensor_BaseEvent; - - OccSensor.GlsOccupancySensorChange += OccSensor_GlsOccupancySensorChange; - } - - - /// - /// 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. - /// - /// - /// - protected virtual void OccSensor_GlsOccupancySensorChange(GlsOccupancySensorBase device, GlsOccupancySensorChangeEventArgs args) - { - switch (args.EventId) - { - case GlsOccupancySensorBase.PirEnabledFeedbackEventId: - PirSensorEnabledFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.LedFlashEnabledFeedbackEventId: - LedFlashEnabledFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.ShortTimeoutEnabledFeedbackEventId: - ShortTimeoutEnabledFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.PirSensitivityInOccupiedStateFeedbackEventId: - PirSensitivityInOccupiedStateFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.PirSensitivityInVacantStateFeedbackEventId: - PirSensitivityInVacantStateFeedback.FireUpdate(); - break; - } - } - - protected virtual void OccSensor_BaseEvent(Crestron.SimplSharpPro.GenericBase device, Crestron.SimplSharpPro.BaseEventArgs args) - { - Debug.Console(2, this, "GlsOccupancySensorChange EventId: {0}", args.EventId); - - switch (args.EventId) - { - case GlsOccupancySensorBase.RoomVacantFeedbackEventId: - case GlsOccupancySensorBase.RoomOccupiedFeedbackEventId: - Debug.Console(1, this, "Occupancy State: {0}", OccSensor.OccupancyDetectedFeedback.BoolValue); - RoomIsOccupiedFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.TimeoutFeedbackEventId: - CurrentTimeoutFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.TimeoutLocalFeedbackEventId: - LocalTimoutFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.GraceOccupancyDetectedFeedbackEventId: - GraceOccupancyDetectedFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.RawOccupancyFeedbackEventId: - RawOccupancyFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.InternalPhotoSensorValueFeedbackEventId: - InternalPhotoSensorValue.FireUpdate(); - break; - case GlsOccupancySensorBase.ExternalPhotoSensorValueFeedbackEventId: - ExternalPhotoSensorValue.FireUpdate(); - break; - } - } - - public void SetTestMode(bool mode) - { - InTestMode = mode; - - Debug.Console(1, this, "In Mock Mode: '{0}'", InTestMode); - } - - public void SetTestOccupiedState(bool state) - { - if (!InTestMode) - Debug.Console(1, "Mock mode not enabled"); - else - { - TestRoomIsOccupiedFeedback = state; - - RoomIsOccupiedFeedback.FireUpdate(); - } - } - - /// - /// Enables or disables the PIR sensor - /// - /// - public void SetPirEnable(bool state) - { - Debug.Console(1, this, "Setting EnablePir to: {0}", state); - - OccSensor.EnablePir.BoolValue = state; - OccSensor.DisablePir.BoolValue = !state; - } - - /// - /// Enables or disables the LED Flash - /// - /// - public void SetLedFlashEnable(bool state) - { - OccSensor.EnableLedFlash.BoolValue = state; - OccSensor.DisableLedFlash.BoolValue = !state; - } - - /// - /// Enables or disables short timeout based on state - /// - /// - public void SetShortTimeoutState(bool state) - { - OccSensor.EnableShortTimeout.BoolValue = state; - OccSensor.DisableShortTimeout.BoolValue = !state; - } - - public void IncrementPirSensitivityInOccupiedState(bool pressRelease) - { - OccSensor.IncrementPirSensitivityInOccupiedState.BoolValue = pressRelease; - } - - public void DecrementPirSensitivityInOccupiedState(bool pressRelease) - { - OccSensor.DecrementPirSensitivityInOccupiedState.BoolValue = pressRelease; - } - - public void IncrementPirSensitivityInVacantState(bool pressRelease) - { - OccSensor.IncrementPirSensitivityInVacantState.BoolValue = pressRelease; - } - - public void DecrementPirSensitivityInVacantState(bool pressRelease) - { - OccSensor.DecrementPirSensitivityInVacantState.BoolValue = pressRelease; - } - - /// - /// Pulse ForceOccupied on the sensor for .5 seconds - /// - public void ForceOccupied() - { - CrestronInvoke.BeginInvoke((o) => - { - ForceOccupied(true); - CrestronEnvironment.Sleep(500); - ForceOccupied(false); - }); - } - - public void ForceOccupied(bool value) - { - OccSensor.ForceOccupied.BoolValue = value; - } - - /// - /// Pulse ForceVacant on the sensor for .5 seconds - /// - public void ForceVacant() - { - CrestronInvoke.BeginInvoke((o) => - { - ForceVacant(true); - CrestronEnvironment.Sleep(500); - ForceVacant(false); - }); - } - - public void ForceVacant(bool value) - { - OccSensor.ForceVacant.BoolValue = value; - } - - public void EnableRawStates(bool state) - { - OccSensor.EnableRawStates.BoolValue = state; - } - - public void SetRemoteTimeout(ushort time) - { - Debug.Console(1, this, "Setting RemoteTimout to: {0}", time); - - OccSensor.RemoteTimeout.UShortValue = time; - } - - public void SetInternalPhotoSensorMinChange(ushort value) - { - OccSensor.InternalPhotoSensorMinimumChange.UShortValue = value; - } - - public void SetExternalPhotoSensorMinChange(ushort value) - { - OccSensor.ExternalPhotoSensorMinimumChange.UShortValue = value; - } - - /// - /// Method to print current occ settings to console. - /// - public virtual void GetSettings() - { - var dash = new string('*', 50); - CrestronConsole.PrintLine(string.Format("{0}\n", dash)); - - Debug.Console(0, this, "Vacancy Detected: {0}", - OccSensor.VacancyDetectedFeedback.BoolValue); - - Debug.Console(0, this, "Timeout Current: {0} | Local: {1}", - OccSensor.CurrentTimeoutFeedback.UShortValue, - OccSensor.LocalTimeoutFeedback.UShortValue); - - Debug.Console(0, this, "Short Timeout Enabled: {0}", - OccSensor.ShortTimeoutEnabledFeedback.BoolValue); - - Debug.Console(0, this, "PIR Sensor Enabled: {0} | Sensitivity Occupied: {1} | Sensitivity Vacant: {2}", - OccSensor.PirEnabledFeedback.BoolValue, - OccSensor.PirSensitivityInOccupiedStateFeedback.UShortValue, - OccSensor.PirSensitivityInVacantStateFeedback.UShortValue); - - CrestronConsole.PrintLine(string.Format("{0}\n", dash)); - } - - protected void LinkOccSensorToApi(GlsOccupancySensorBaseController occController, BasicTriList trilist, - uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new GlsOccupancySensorBaseJoinMap(joinStart); - - var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - - if (bridge != null) - { - bridge.AddJoinMap(Key, joinMap); - } - else - { - Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); - } - - Debug.Console(1, occController, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - - occController.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); - trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name; - - trilist.OnlineStatusChange += (d, args) => - { - if (args.DeviceOnLine) - { - trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name; - } - }; - - LinkSingleTechSensorToApi(occController, trilist, joinMap); - - LinkDualTechSensorToApi(occController, trilist, joinMap); - } - - private static void LinkDualTechSensorToApi(GlsOccupancySensorBaseController occController, BasicTriList trilist, - GlsOccupancySensorBaseJoinMap joinMap) - { - var odtOccController = occController as GlsOdtOccupancySensorController; - - if (odtOccController == null) - { - return; - } - // OR When Vacated - trilist.SetBoolSigAction(joinMap.OrWhenVacated.JoinNumber, odtOccController.SetOrWhenVacatedState); - odtOccController.OrWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.OrWhenVacated.JoinNumber]); - - // AND When Vacated - trilist.SetBoolSigAction(joinMap.AndWhenVacated.JoinNumber, odtOccController.SetAndWhenVacatedState); - odtOccController.AndWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AndWhenVacated.JoinNumber]); - - // Ultrasonic A Sensor - trilist.SetSigTrueAction(joinMap.EnableUsA.JoinNumber, () => odtOccController.SetUsAEnable(true)); - trilist.SetSigTrueAction(joinMap.DisableUsA.JoinNumber, () => odtOccController.SetUsAEnable(false)); - odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsA.JoinNumber]); - - // Ultrasonic B Sensor - trilist.SetSigTrueAction(joinMap.EnableUsB.JoinNumber, () => odtOccController.SetUsBEnable(true)); - trilist.SetSigTrueAction(joinMap.DisableUsB.JoinNumber, () => odtOccController.SetUsBEnable(false)); - odtOccController.UltrasonicBEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsB.JoinNumber]); - - // US Sensitivity in Occupied State - trilist.SetBoolSigAction(joinMap.IncrementUsInOccupiedState.JoinNumber, - odtOccController.IncrementUsSensitivityInOccupiedState); - trilist.SetBoolSigAction(joinMap.DecrementUsInOccupiedState.JoinNumber, - odtOccController.DecrementUsSensitivityInOccupiedState); - odtOccController.UltrasonicSensitivityInOccupiedStateFeedback.LinkInputSig( - trilist.UShortInput[joinMap.UsSensitivityInOccupiedState.JoinNumber]); - - // US Sensitivity in Vacant State - trilist.SetBoolSigAction(joinMap.IncrementUsInVacantState.JoinNumber, - odtOccController.IncrementUsSensitivityInVacantState); - trilist.SetBoolSigAction(joinMap.DecrementUsInVacantState.JoinNumber, - odtOccController.DecrementUsSensitivityInVacantState); - odtOccController.UltrasonicSensitivityInVacantStateFeedback.LinkInputSig( - trilist.UShortInput[joinMap.UsSensitivityInVacantState.JoinNumber]); - - //Sensor Raw States - odtOccController.RawOccupancyPirFeedback.LinkInputSig( - trilist.BooleanInput[joinMap.RawOccupancyPirFeedback.JoinNumber]); - odtOccController.RawOccupancyUsFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyUsFeedback.JoinNumber]); - } - - private static void LinkSingleTechSensorToApi(GlsOccupancySensorBaseController occController, BasicTriList trilist, - GlsOccupancySensorBaseJoinMap joinMap) - { -// Occupied status - trilist.SetBoolSigAction(joinMap.ForceOccupied.JoinNumber, occController.ForceOccupied); - trilist.SetBoolSigAction(joinMap.ForceVacant.JoinNumber, occController.ForceVacant); - occController.RoomIsOccupiedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RoomOccupiedFeedback.JoinNumber]); - occController.RoomIsOccupiedFeedback.LinkComplementInputSig( - trilist.BooleanInput[joinMap.RoomVacantFeedback.JoinNumber]); - occController.RawOccupancyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyFeedback.JoinNumber]); - trilist.SetBoolSigAction(joinMap.EnableRawStates.JoinNumber, occController.EnableRawStates); - - // Timouts - trilist.SetUShortSigAction(joinMap.Timeout.JoinNumber, occController.SetRemoteTimeout); - occController.CurrentTimeoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.Timeout.JoinNumber]); - occController.LocalTimoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeoutLocalFeedback.JoinNumber]); - - // LED Flash - trilist.SetSigTrueAction(joinMap.EnableLedFlash.JoinNumber, () => occController.SetLedFlashEnable(true)); - trilist.SetSigTrueAction(joinMap.DisableLedFlash.JoinNumber, () => occController.SetLedFlashEnable(false)); - occController.LedFlashEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.EnableLedFlash.JoinNumber]); - - // Short Timeout - trilist.SetSigTrueAction(joinMap.EnableShortTimeout.JoinNumber, () => occController.SetShortTimeoutState(true)); - trilist.SetSigTrueAction(joinMap.DisableShortTimeout.JoinNumber, () => occController.SetShortTimeoutState(false)); - occController.ShortTimeoutEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableShortTimeout.JoinNumber]); - - // PIR Sensor - trilist.SetSigTrueAction(joinMap.EnablePir.JoinNumber, () => occController.SetPirEnable(true)); - trilist.SetSigTrueAction(joinMap.DisablePir.JoinNumber, () => occController.SetPirEnable(false)); - occController.PirSensorEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnablePir.JoinNumber]); - - // PIR Sensitivity in Occupied State - trilist.SetBoolSigAction(joinMap.IncrementPirInOccupiedState.JoinNumber, - occController.IncrementPirSensitivityInOccupiedState); - trilist.SetBoolSigAction(joinMap.DecrementPirInOccupiedState.JoinNumber, - occController.DecrementPirSensitivityInOccupiedState); - occController.PirSensitivityInOccupiedStateFeedback.LinkInputSig( - trilist.UShortInput[joinMap.PirSensitivityInOccupiedState.JoinNumber]); - - // PIR Sensitivity in Vacant State - trilist.SetBoolSigAction(joinMap.IncrementPirInVacantState.JoinNumber, - occController.IncrementPirSensitivityInVacantState); - trilist.SetBoolSigAction(joinMap.DecrementPirInVacantState.JoinNumber, - occController.DecrementPirSensitivityInVacantState); - occController.PirSensitivityInVacantStateFeedback.LinkInputSig( - trilist.UShortInput[joinMap.PirSensitivityInVacantState.JoinNumber]); - } - } - - - -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Occupancy/GlsOccupancySensorPropertiesConfig.cs b/src/PepperDash.Essentials.Core/Occupancy/GlsOccupancySensorPropertiesConfig.cs deleted file mode 100644 index 958edaf8..00000000 --- a/src/PepperDash.Essentials.Core/Occupancy/GlsOccupancySensorPropertiesConfig.cs +++ /dev/null @@ -1,83 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -using Full.Newtonsoft.Json; - -namespace PepperDash.Essentials.Core -{ - /// - /// Defines configuration properties for Crestron GLS series occupancy sensors - /// - public class GlsOccupancySensorPropertiesConfig - { - // Single Technology Sensors (PIR): GlsOccupancySensorBase - [JsonProperty("enablePir")] - public bool? EnablePir { get; set; } - - [JsonProperty("enableLedFlash")] - public bool? EnableLedFlash { get; set; } - - [JsonProperty("shortTimeoutState")] - public bool? ShortTimeoutState { get; set; } - - [JsonProperty("enableRawStates")] - public bool? EnableRawStates { get; set; } - - [JsonProperty("remoteTimeout")] - public ushort? RemoteTimeout { get; set; } - - [JsonProperty("internalPhotoSensorMinChange")] - public ushort? InternalPhotoSensorMinChange { get; set; } - - [JsonProperty("externalPhotoSensorMinChange")] - public ushort? ExternalPhotoSensorMinChange { get; set; } - - // Dual Technology Sensors: GlsOdtCCn - [JsonProperty("enableUsA")] - public bool? EnableUsA { get; set; } - - [JsonProperty("enableUsB")] - public bool? EnableUsB { get; set; } - - [JsonProperty("orWhenVacatedState")] - public bool? OrWhenVacatedState { get; set; } - - [JsonProperty("andWhenVacatedState")] - public bool? AndWhenVacatedState { get; set; } - - // PoE Sensors: CenOdtCPoe - - /// - /// Sets the sensitivity level for US while sensor is in occupied state - /// 1 = low; 2 = medium; 3 = high; 4 = xlow; 5 = 2xlow; 6 = 3xlow - /// - [JsonProperty("usSensitivityOccupied")] - public ushort? UsSensitivityOccupied { get; set; } - - /// - /// Sets the sensitivity level for US while sensor is in vacant state - /// 1 = low; 2 = medium; 3 = high; 4 = xlow; 5 = 2xlow; 6 = 3xlow - /// - [JsonProperty("usSensitivityVacant")] - public ushort? UsSensitivityVacant { get; set; } - - /// - /// Sets the sensitivity level for PIR while sensor is in occupied state - /// 1 = low; 2 = medium; 3 = high - /// - [JsonProperty("pirSensitivityOccupied")] - public ushort? PirSensitivityOccupied { get; set; } - - /// - /// Sets the sensitivity level for PIR while sensor is in vacant state - /// 1 = low; 2 = medium; 3 = high - /// - [JsonProperty("pirSensitivityVacant")] - public ushort? PirSensitivityVacant { get; set; } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Occupancy/GlsOdtOccupancySensorController.cs b/src/PepperDash.Essentials.Core/Occupancy/GlsOdtOccupancySensorController.cs deleted file mode 100644 index dd6b3605..00000000 --- a/src/PepperDash.Essentials.Core/Occupancy/GlsOdtOccupancySensorController.cs +++ /dev/null @@ -1,284 +0,0 @@ -using System; -using System.Collections.Generic; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.GeneralIO; - -using PepperDash.Core; -using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Core.Bridges; - -namespace PepperDash.Essentials.Core -{ - [Description("Wrapper class for Dual Technology GLS Occupancy Sensors")] - [ConfigSnippet("\"properties\": {\"control\": {\"method\": \"cresnet\",\"cresnetId\": \"97\"},\"enablePir\": true,\"enableLedFlash\": true,\"enableRawStates\":true,\"remoteTimeout\": 30,\"internalPhotoSensorMinChange\": 0,\"externalPhotoSensorMinChange\": 0,\"enableUsA\": true,\"enableUsB\": true,\"orWhenVacatedState\": true}")] - public class GlsOdtOccupancySensorController : GlsOccupancySensorBaseController - { - private GlsOdtCCn _occSensor; - - public BoolFeedback OrWhenVacatedFeedback { get; private set; } - - public BoolFeedback AndWhenVacatedFeedback { get; private set; } - - public BoolFeedback UltrasonicAEnabledFeedback { get; private set; } - - public BoolFeedback UltrasonicBEnabledFeedback { get; private set; } - - public IntFeedback UltrasonicSensitivityInVacantStateFeedback { get; private set; } - - public IntFeedback UltrasonicSensitivityInOccupiedStateFeedback { get; private set; } - - public BoolFeedback RawOccupancyPirFeedback { get; private set; } - - public BoolFeedback RawOccupancyUsFeedback { get; private set; } - - - public GlsOdtOccupancySensorController(string key, Func preActivationFunc, - DeviceConfig config) - : base(key, config.Name, config) - { - AddPreActivationAction(() => - { - _occSensor = preActivationFunc(config); - - RegisterCrestronGenericBase(_occSensor); - - RegisterGlsOccupancySensorBaseController(_occSensor); - - AndWhenVacatedFeedback = new BoolFeedback(() => _occSensor.AndWhenVacatedFeedback.BoolValue); - - OrWhenVacatedFeedback = new BoolFeedback(() => _occSensor.OrWhenVacatedFeedback.BoolValue); - - UltrasonicAEnabledFeedback = new BoolFeedback(() => _occSensor.UsAEnabledFeedback.BoolValue); - - UltrasonicBEnabledFeedback = new BoolFeedback(() => _occSensor.UsBEnabledFeedback.BoolValue); - - RawOccupancyPirFeedback = new BoolFeedback(() => _occSensor.RawOccupancyPirFeedback.BoolValue); - - RawOccupancyUsFeedback = new BoolFeedback(() => _occSensor.RawOccupancyUsFeedback.BoolValue); - - UltrasonicSensitivityInVacantStateFeedback = new IntFeedback(() => _occSensor.UsSensitivityInVacantStateFeedback.UShortValue); - - UltrasonicSensitivityInOccupiedStateFeedback = new IntFeedback(() => _occSensor.UsSensitivityInOccupiedStateFeedback.UShortValue); - - }); - } - - protected override void ApplySettingsToSensorFromConfig() - { - base.ApplySettingsToSensorFromConfig(); - - if (PropertiesConfig.EnableUsA != null) - { - Debug.Console(1, this, "EnableUsA found, attempting to set value from config"); - SetUsAEnable((bool)PropertiesConfig.EnableUsA); - } - else - { - Debug.Console(1, this, "EnableUsA null, no value specified in config"); - } - - - if (PropertiesConfig.EnableUsB != null) - { - Debug.Console(1, this, "EnableUsB found, attempting to set value from config"); - SetUsBEnable((bool)PropertiesConfig.EnableUsB); - } - else - { - Debug.Console(1, this, "EnablePir null, no value specified in config"); - } - - - if (PropertiesConfig.OrWhenVacatedState != null) - { - SetOrWhenVacatedState((bool)PropertiesConfig.OrWhenVacatedState); - } - - if (PropertiesConfig.AndWhenVacatedState != null) - { - SetAndWhenVacatedState((bool)PropertiesConfig.AndWhenVacatedState); - } - } - - /// - /// 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. - /// - /// - /// - protected override void OccSensor_GlsOccupancySensorChange(GlsOccupancySensorBase device, GlsOccupancySensorChangeEventArgs args) - { - switch (args.EventId) - { - case GlsOccupancySensorBase.AndWhenVacatedFeedbackEventId: - AndWhenVacatedFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.OrWhenVacatedFeedbackEventId: - OrWhenVacatedFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.UsAEnabledFeedbackEventId: - UltrasonicAEnabledFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.UsBEnabledFeedbackEventId: - UltrasonicBEnabledFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.UsSensitivityInOccupiedStateFeedbackEventId: - UltrasonicSensitivityInOccupiedStateFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.UsSensitivityInVacantStateFeedbackEventId: - UltrasonicSensitivityInVacantStateFeedback.FireUpdate(); - break; - } - - base.OccSensor_GlsOccupancySensorChange(device, args); - } - - /// - /// 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. - /// - /// - /// - protected override void OccSensor_BaseEvent(Crestron.SimplSharpPro.GenericBase device, Crestron.SimplSharpPro.BaseEventArgs args) - { - switch (args.EventId) - { - case GlsOccupancySensorBase.RawOccupancyPirFeedbackEventId: - RawOccupancyPirFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.RawOccupancyUsFeedbackEventId: - RawOccupancyUsFeedback.FireUpdate(); - break; - } - - base.OccSensor_BaseEvent(device, args); - } - - /// - /// Sets the OrWhenVacated state - /// - /// - public void SetOrWhenVacatedState(bool state) - { - _occSensor.OrWhenVacated.BoolValue = state; - } - - /// - /// Sets the AndWhenVacated state - /// - /// - public void SetAndWhenVacatedState(bool state) - { - _occSensor.AndWhenVacated.BoolValue = state; - } - - /// - /// Enables or disables the Ultrasonic A sensor - /// - /// - public void SetUsAEnable(bool state) - { - _occSensor.EnableUsA.BoolValue = state; - _occSensor.DisableUsA.BoolValue = !state; - } - - - /// - /// Enables or disables the Ultrasonic B sensor - /// - /// - public void SetUsBEnable(bool state) - { - _occSensor.EnableUsB.BoolValue = state; - _occSensor.DisableUsB.BoolValue = !state; - } - - public void IncrementUsSensitivityInOccupiedState(bool pressRelease) - { - _occSensor.IncrementUsSensitivityInOccupiedState.BoolValue = pressRelease; - } - - public void DecrementUsSensitivityInOccupiedState(bool pressRelease) - { - _occSensor.DecrementUsSensitivityInOccupiedState.BoolValue = pressRelease; - } - - public void IncrementUsSensitivityInVacantState(bool pressRelease) - { - _occSensor.IncrementUsSensitivityInVacantState.BoolValue = pressRelease; - } - - public void DecrementUsSensitivityInVacantState(bool pressRelease) - { - _occSensor.DecrementUsSensitivityInVacantState.BoolValue = pressRelease; - } - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge); - } - - /// - /// Method to print occ sensor settings to console. - /// - public override void GetSettings() - { - base.GetSettings(); - - Debug.Console(0, this, "Ultrasonic Enabled A: {0} | B: {1}", - _occSensor.UsAEnabledFeedback.BoolValue, - _occSensor.UsBEnabledFeedback.BoolValue); - - Debug.Console(0, this, "Ultrasonic Sensitivity Occupied: {0} | Vacant: {1}", - _occSensor.UsSensitivityInOccupiedStateFeedback.UShortValue, - _occSensor.UsSensitivityInVacantStateFeedback.UShortValue); - - var dash = new string('*', 50); - CrestronConsole.PrintLine(string.Format("{0}\n", dash)); - } - - } - - public class GlsOdtOccupancySensorControllerFactory : EssentialsDeviceFactory - { - public GlsOdtOccupancySensorControllerFactory() - { - TypeNames = new List { "glsodtccn" }; - } - - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device"); - - return new GlsOdtOccupancySensorController(dc.Key, GetGlsOdtCCn, dc); - } - - private static GlsOdtCCn GetGlsOdtCCn(DeviceConfig dc) - { - var control = CommFactory.GetControlPropertiesConfig(dc); - var cresnetId = control.CresnetIdInt; - var branchId = control.ControlPortNumber; - var parentKey = String.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey; - - if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase)) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOdtCCn", parentKey); - return new GlsOdtCCn(cresnetId, Global.ControlSystem); - } - var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches; - - if (cresnetBridge != null) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOdtCCn", parentKey); - return new GlsOdtCCn(cresnetId, cresnetBridge.CresnetBranches[branchId]); - } - Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey); - return null; - } - } - - - -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Occupancy/GlsOirOccupancySensorController.cs b/src/PepperDash.Essentials.Core/Occupancy/GlsOirOccupancySensorController.cs deleted file mode 100644 index 573d94ac..00000000 --- a/src/PepperDash.Essentials.Core/Occupancy/GlsOirOccupancySensorController.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using System.Collections.Generic; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.GeneralIO; -using PepperDash.Core; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.Core.Config; - -namespace PepperDash.Essentials.Core -{ - public class GlsOirOccupancySensorController:GlsOccupancySensorBaseController - { - private GlsOirCCn _occSensor; - - public GlsOirOccupancySensorController(string key, Func preActivationFunc,DeviceConfig config) : this(key,config.Name, preActivationFunc, config) - { - } - - public GlsOirOccupancySensorController(string key, string name, Func preActivationFunc, DeviceConfig config) : base(key, name, config) - { - AddPreActivationAction(() => - { - _occSensor = preActivationFunc(config); - - RegisterCrestronGenericBase(_occSensor); - - RegisterGlsOccupancySensorBaseController(_occSensor); - }); - } - - #region Overrides of CrestronGenericBridgeableBaseDevice - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge); - } - - #endregion - } - - public class GlsOccupancySensorBaseControllerFactory : EssentialsDeviceFactory - { - public GlsOccupancySensorBaseControllerFactory() - { - TypeNames = new List { "glsoirccn" }; - } - - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new GlsOirOccupancySensorController Device"); - - return new GlsOirOccupancySensorController(dc.Key, GetGlsOirCCn, dc); - } - - private static GlsOirCCn GetGlsOirCCn(DeviceConfig dc) - { - var control = CommFactory.GetControlPropertiesConfig(dc); - var cresnetId = control.CresnetIdInt; - var branchId = control.ControlPortNumber; - var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey; - - if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase)) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOirCCn", parentKey); - return new GlsOirCCn(cresnetId, Global.ControlSystem); - } - var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches; - - if (cresnetBridge != null) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOirCCn", parentKey); - return new GlsOirCCn(cresnetId, cresnetBridge.CresnetBranches[branchId]); - } - Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey); - return null; - } - - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Occupancy/IOccupancyStatusProviderAggregator.cs b/src/PepperDash.Essentials.Core/Occupancy/IOccupancyStatusProviderAggregator.cs deleted file mode 100644 index dfa4fef1..00000000 --- a/src/PepperDash.Essentials.Core/Occupancy/IOccupancyStatusProviderAggregator.cs +++ /dev/null @@ -1,109 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.GeneralIO; -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Config; - -namespace PepperDash.Essentials.Core -{ - /// - /// Aggregates the RoomIsOccupied feedbacks of one or more IOccupancyStatusProvider objects - /// - public class IOccupancyStatusProviderAggregator : EssentialsDevice, IOccupancyStatusProvider - { - /// - /// Aggregated feedback of all linked IOccupancyStatusProvider devices - /// - public BoolFeedback RoomIsOccupiedFeedback - { - get - { - return _aggregatedOccupancyStatus.Output; - } - } - - private readonly BoolFeedbackOr _aggregatedOccupancyStatus; - - public IOccupancyStatusProviderAggregator(string key, string name) - : base(key, name) - { - _aggregatedOccupancyStatus = new BoolFeedbackOr(); - } - - public IOccupancyStatusProviderAggregator(string key, string name, OccupancyAggregatorConfig config) - : this(key, name) - { - AddPostActivationAction(() => - { - if (config.DeviceKeys.Count == 0) - { - return; - } - - foreach (var deviceKey in config.DeviceKeys) - { - var device = DeviceManager.GetDeviceForKey(deviceKey); - - if (device == null) - { - Debug.Console(0, this, Debug.ErrorLogLevel.Notice, - "Unable to retrieve Occupancy provider with key {0}", deviceKey); - continue; - } - - var provider = device as IOccupancyStatusProvider; - - if (provider == null) - { - Debug.Console(0, this, Debug.ErrorLogLevel.Notice, - "Device with key {0} does NOT implement IOccupancyStatusProvider. Please check configuration."); - continue; - } - - AddOccupancyStatusProvider(provider); - } - }); - } - - /// - /// Adds an IOccupancyStatusProvider device - /// - /// - public void AddOccupancyStatusProvider(IOccupancyStatusProvider statusProvider) - { - _aggregatedOccupancyStatus.AddOutputIn(statusProvider.RoomIsOccupiedFeedback); - } - - public void RemoveOccupancyStatusProvider(IOccupancyStatusProvider statusProvider) - { - _aggregatedOccupancyStatus.RemoveOutputIn(statusProvider.RoomIsOccupiedFeedback); - } - - public void ClearOccupancyStatusProviders() - { - _aggregatedOccupancyStatus.ClearOutputs(); - } - } - - public class OccupancyAggregatorFactory : EssentialsDeviceFactory - { - public OccupancyAggregatorFactory() - { - TypeNames = new List { "occupancyAggregator", "occAggregate" }; - } - - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device"); - - var config = dc.Properties.ToObject(); - - return new IOccupancyStatusProviderAggregator(dc.Key, dc.Name, config); - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Occupancy/OccupancyAggregatorConfig.cs b/src/PepperDash.Essentials.Core/Occupancy/OccupancyAggregatorConfig.cs deleted file mode 100644 index 884ebfdd..00000000 --- a/src/PepperDash.Essentials.Core/Occupancy/OccupancyAggregatorConfig.cs +++ /dev/null @@ -1,17 +0,0 @@ -extern alias Full; - -using System.Collections.Generic; -using Full.Newtonsoft.Json; - -namespace PepperDash.Essentials.Core -{ - public class OccupancyAggregatorConfig - { - [JsonProperty("deviceKeys")] public List DeviceKeys { get; set; } - - public OccupancyAggregatorConfig() - { - DeviceKeys = new List(); - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/PartitionSensor/GlsPartitionSensorController.cs b/src/PepperDash.Essentials.Core/PartitionSensor/GlsPartitionSensorController.cs deleted file mode 100644 index 511eda66..00000000 --- a/src/PepperDash.Essentials.Core/PartitionSensor/GlsPartitionSensorController.cs +++ /dev/null @@ -1,366 +0,0 @@ -extern alias Full; - -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.GeneralIO; -using Full.Newtonsoft.Json; -using PepperDash.Core; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.Core.Bridges.JoinMaps; - -using System; -using System.Collections.Generic; -using PepperDash.Essentials.Core.Config; -using PepperDash_Essentials_Core.PartitionSensor; - -namespace PepperDash.Essentials.Core -{ - [Description("Wrapper class for GLS Cresnet Partition Sensor")] - public class GlsPartitionSensorController : CrestronGenericBridgeableBaseDevice, IPartitionStateProvider - { - - public GlsPartitionSensorPropertiesConfig PropertiesConfig { get; private set; } - - private GlsPartCn _partitionSensor; - - public BoolFeedback EnableFeedback { get; private set; } - public BoolFeedback PartitionPresentFeedback { get; private set; } - public BoolFeedback PartitionNotSensedFeedback { get; private set; } - public IntFeedback SensitivityFeedback { get; private set; } - - public bool InTestMode { get; private set; } - public bool TestEnableFeedback { get; private set; } - public bool TestPartitionSensedFeedback { get; private set; } - public int TestSensitivityFeedback { get; private set; } - - - public GlsPartitionSensorController(string key, Func preActivationFunc, DeviceConfig config) - : base(key, config.Name) - { - - var props = config.Properties.ToObject(); - if (props != null) - { - PropertiesConfig = props; - } - else - { - Debug.Console(1, this, "props are null. Unable to deserialize into GlsPartSensorPropertiesConfig"); - } - - AddPreActivationAction(() => - { - _partitionSensor = preActivationFunc(config); - - RegisterCrestronGenericBase(_partitionSensor); - - EnableFeedback = new BoolFeedback(() => InTestMode ? TestEnableFeedback : _partitionSensor.EnableFeedback.BoolValue); - PartitionPresentFeedback = new BoolFeedback(() => InTestMode ? TestPartitionSensedFeedback : _partitionSensor.PartitionSensedFeedback.BoolValue); - PartitionNotSensedFeedback = new BoolFeedback(() => InTestMode ? !TestPartitionSensedFeedback : _partitionSensor.PartitionNotSensedFeedback.BoolValue); - SensitivityFeedback = new IntFeedback(() => InTestMode ? TestSensitivityFeedback : _partitionSensor.SensitivityFeedback.UShortValue); - - if (_partitionSensor != null) - { - _partitionSensor.BaseEvent += PartitionSensor_BaseEvent; - } - }); - - AddPostActivationAction(() => - { - _partitionSensor.OnlineStatusChange += (o, a) => - { - if (a.DeviceOnLine) - { - ApplySettingsToSensorFromConfig(); - } - }; - - if (_partitionSensor.IsOnline) - { - ApplySettingsToSensorFromConfig(); - } - }); - } - - private void ApplySettingsToSensorFromConfig() - { - if (_partitionSensor.IsOnline == false) return; - - // Default to enable - _partitionSensor.Enable.BoolValue = true; - - Debug.Console(1, this, "Attempting to apply settings to sensor from config"); - - if (PropertiesConfig.Sensitivity != null) - { - Debug.Console(1, this, "Sensitivity found, attempting to set value '{0}' from config", - PropertiesConfig.Sensitivity); - _partitionSensor.Sensitivity.UShortValue = (ushort)PropertiesConfig.Sensitivity; - } - else - { - Debug.Console(1, this, "Sensitivity null, no value specified in config"); - } - - if (PropertiesConfig.Enable != null) - { - Debug.Console(1, this, "Enable found, attempting to set value '{0}' from config", - PropertiesConfig.Enable); - _partitionSensor.Enable.BoolValue = (bool)PropertiesConfig.Enable; - } - else - { - Debug.Console(1, this, "Enable null, no value specified in config"); - } - - } - - private void PartitionSensor_BaseEvent(GenericBase device, BaseEventArgs args) - { - Debug.Console(2, this, "EventId: {0}, Index: {1}", args.EventId, args.Index); - - switch (args.EventId) - { - case (GlsPartCn.EnableFeedbackEventId): - { - EnableFeedback.FireUpdate(); - break; - } - case (GlsPartCn.PartitionSensedFeedbackEventId): - { - Debug.Console(1, this, "Partition Sensed State: {0}", _partitionSensor.PartitionSensedFeedback.BoolValue); - PartitionPresentFeedback.FireUpdate(); - break; - } - case (GlsPartCn.PartitionNotSensedFeedbackEventId): - { - Debug.Console(1, this, "Partition Not Sensed State: {0}", _partitionSensor.PartitionNotSensedFeedback.BoolValue); - PartitionNotSensedFeedback.FireUpdate(); - break; - } - case (GlsPartCn.SensitivityFeedbackEventId): - { - SensitivityFeedback.FireUpdate(); - break; - } - default: - { - Debug.Console(2, this, "Unhandled args.EventId: {0}", args.EventId); - break; - } - } - } - - public void SetTestMode(bool mode) - { - InTestMode = mode; - Debug.Console(1, this, "InTestMode: {0}", InTestMode.ToString()); - } - - public void SetTestEnableState(bool state) - { - if (InTestMode) - { - TestEnableFeedback = state; - - EnableFeedback.FireUpdate(); - - Debug.Console(1, this, "TestEnableFeedback: {0}", TestEnableFeedback.ToString()); - return; - } - - Debug.Console(1, this, "InTestMode: {0}, unable to set enable state: {1}", InTestMode.ToString(), state.ToString()); - } - - public void SetTestPartitionSensedState(bool state) - { - if (InTestMode) - { - TestPartitionSensedFeedback = state; - - PartitionPresentFeedback.FireUpdate(); - PartitionNotSensedFeedback.FireUpdate(); - - Debug.Console(1, this, "TestPartitionSensedFeedback: {0}", TestPartitionSensedFeedback.ToString()); - return; - } - - Debug.Console(1, this, "InTestMode: {0}, unable to set partition state: {1}", InTestMode.ToString(), state.ToString()); - } - - public void SetTestSensitivityValue(int value) - { - if (InTestMode) - { - TestSensitivityFeedback = value; - - SensitivityFeedback.FireUpdate(); - Debug.Console(1, this, "TestSensitivityFeedback: {0}", TestSensitivityFeedback); - return; - } - - Debug.Console(1, this, "InTestMode: {0}, unable to set sensitivity value: {1}", InTestMode.ToString(), value); - } - - public void GetSettings() - { - var dash = new string('*', 50); - CrestronConsole.PrintLine(string.Format("{0}\n", dash)); - - Debug.Console(0, this, "Enabled State: {0}", _partitionSensor.EnableFeedback.BoolValue); - - Debug.Console(0, this, "Partition Sensed State: {0}", _partitionSensor.PartitionSensedFeedback.BoolValue); - Debug.Console(0, this, "Partition Not Sensed State: {0}", _partitionSensor.PartitionNotSensedFeedback.BoolValue); - - Debug.Console(0, this, "Sensitivity Value: {0}", _partitionSensor.SensitivityFeedback.UShortValue); - - CrestronConsole.PrintLine(string.Format("{0}\n", dash)); - } - - public void SetEnableState(bool state) - { - Debug.Console(2, this, "Sensor is {0}, SetEnableState: {1}", _partitionSensor == null ? "null" : "not null", state); - if (_partitionSensor == null) - return; - - _partitionSensor.Enable.BoolValue = state; - } - - public void IncreaseSensitivity() - { - Debug.Console(2, this, "Sensor is {0}, IncreaseSensitivity", _partitionSensor == null ? "null" : "not null"); - if (_partitionSensor == null) - return; - - _partitionSensor.IncreaseSensitivity(); - } - - public void DecreaseSensitivity() - { - Debug.Console(2, this, "Sensor is {0}, DecreaseSensitivity", _partitionSensor == null ? "null" : "not null"); - if (_partitionSensor == null) - return; - - _partitionSensor.DecreaseSensitivity(); - } - - public void SetSensitivity(ushort value) - { - Debug.Console(2, this, "Sensor is {0}, SetSensitivity: {1}", _partitionSensor == null ? "null" : "not null", value); - if (_partitionSensor == null) - return; - - _partitionSensor.Sensitivity.UShortValue = value; - } - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new GlsPartitionSensorJoinMap(joinStart); - var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - - if (bridge != null) - { - bridge.AddJoinMap(Key, joinMap); - } - else - { - Debug.Console(0, this, "Please update config to use 'type': 'EiscApiAdvanced' to get all join map features for this device"); - } - - Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - Debug.Console(0, this, "Linking to Bridge Type {0}", GetType().Name); - - IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); - trilist.StringInput[joinMap.Name.JoinNumber].StringValue = _partitionSensor.Name; - - trilist.SetBoolSigAction(joinMap.Enable.JoinNumber, SetEnableState); - EnableFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Enable.JoinNumber]); - - PartitionPresentFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PartitionSensed.JoinNumber]); - PartitionNotSensedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PartitionNotSensed.JoinNumber]); - - trilist.SetSigTrueAction(joinMap.IncreaseSensitivity.JoinNumber, IncreaseSensitivity); - trilist.SetSigTrueAction(joinMap.DecreaseSensitivity.JoinNumber, DecreaseSensitivity); - - SensitivityFeedback.LinkInputSig(trilist.UShortInput[joinMap.Sensitivity.JoinNumber]); - trilist.SetUShortSigAction(joinMap.Sensitivity.JoinNumber, SetSensitivity); - - FeedbacksFireUpdates(); - - // update when device is online - _partitionSensor.OnlineStatusChange += (o, a) => - { - if (a.DeviceOnLine) - { - FeedbacksFireUpdates(); - } - }; - - // update when trilist is online - trilist.OnlineStatusChange += (o, a) => - { - if (a.DeviceOnLine) - { - trilist.StringInput[joinMap.Name.JoinNumber].StringValue = _partitionSensor.Name; - FeedbacksFireUpdates(); - } - }; - } - - private void FeedbacksFireUpdates() - { - IsOnline.FireUpdate(); - EnableFeedback.FireUpdate(); - PartitionPresentFeedback.FireUpdate(); - PartitionNotSensedFeedback.FireUpdate(); - SensitivityFeedback.FireUpdate(); - } - - #region PreActivation - - private static GlsPartCn GetGlsPartCnDevice(DeviceConfig dc) - { - var control = CommFactory.GetControlPropertiesConfig(dc); - var cresnetId = control.CresnetIdInt; - var branchId = control.ControlPortNumber; - var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey; - - if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase)) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsPartCn", parentKey); - return new GlsPartCn(cresnetId, Global.ControlSystem); - } - var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches; - - if (cresnetBridge != null) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsPartCn", parentKey); - return new GlsPartCn(cresnetId, cresnetBridge.CresnetBranches[branchId]); - } - Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey); - return null; - } - #endregion - - - public class GlsPartitionSensorControllerFactory : EssentialsDeviceFactory - { - public GlsPartitionSensorControllerFactory() - { - TypeNames = new List { "glspartcn" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new GlsPartitionSensorController Device"); - - return new GlsPartitionSensorController(dc.Key, GetGlsPartCnDevice, dc); - } - } - - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/PartitionSensor/GlsPartitionSensorPropertiesConfig.cs b/src/PepperDash.Essentials.Core/PartitionSensor/GlsPartitionSensorPropertiesConfig.cs deleted file mode 100644 index 03611dd2..00000000 --- a/src/PepperDash.Essentials.Core/PartitionSensor/GlsPartitionSensorPropertiesConfig.cs +++ /dev/null @@ -1,26 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Full.Newtonsoft.Json; - -namespace PepperDash_Essentials_Core.PartitionSensor -{ - public class GlsPartitionSensorPropertiesConfig - { - /// - /// Sets the sensor sensitivity - /// - /// - /// The sensitivity range shall be between 1(lowest) to 10 (highest). - /// - [JsonProperty("sensitivity")] - public ushort? Sensitivity { get; set; } - - [JsonProperty("enable")] - public bool? Enable { get; set; } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj b/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj index db87a84d..8ea0cf86 100644 --- a/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj +++ b/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj @@ -35,6 +35,5 @@ - \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Remotes/ButtonExtensions.cs b/src/PepperDash.Essentials.Core/Remotes/ButtonExtensions.cs deleted file mode 100644 index 58cf7d7c..00000000 --- a/src/PepperDash.Essentials.Core/Remotes/ButtonExtensions.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; - -using PepperDash.Core; - -namespace PepperDash.Essentials.Core -{ - public static class ButtonExtensions - { - public static Button SetButtonAction(this Button button, Action a) - { - button.UserObject = a; - return button; - } - - public static Button SetButtonAction(this CrestronCollection public interface IShades { - List Shades { get; } + List Shades { get; } } /// diff --git a/src/PepperDash.Essentials.Core/Shades/ShadeController.cs b/src/PepperDash.Essentials.Core/Shades/ShadeController.cs index fc50f631..6dff9803 100644 --- a/src/PepperDash.Essentials.Core/Shades/ShadeController.cs +++ b/src/PepperDash.Essentials.Core/Shades/ShadeController.cs @@ -16,14 +16,14 @@ namespace PepperDash.Essentials.Core.Shades { ShadeControllerConfigProperties Config; - public List Shades { get; private set; } + public List Shades { get; private set; } public ShadeController(string key, string name, ShadeControllerConfigProperties config) : base(key, name) { Config = config; - Shades = new List(); + Shades = new List(); } public override bool CustomActivate() diff --git a/src/PepperDash.Essentials.Devices.Common/Displays/BasicIrDisplay.cs b/src/PepperDash.Essentials.Devices.Common/Displays/BasicIrDisplay.cs new file mode 100644 index 00000000..59e67278 --- /dev/null +++ b/src/PepperDash.Essentials.Devices.Common/Displays/BasicIrDisplay.cs @@ -0,0 +1,224 @@ +using System; +using System.Collections.Generic; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Core.Routing; + +namespace PepperDash.Essentials.Devices.Common.Displays +{ + public class BasicIrDisplay : DisplayBase, IBasicVolumeControls, IBridgeAdvanced + { + public IrOutputPortController IrPort { get; private set; } + public ushort IrPulseTime { get; set; } + + protected Func PowerIsOnFeedbackFunc + { + get { return () => _PowerIsOn; } + } + protected override Func IsCoolingDownFeedbackFunc + { + get { return () => _IsCoolingDown; } + } + protected override Func IsWarmingUpFeedbackFunc + { + get { return () => _IsWarmingUp; } + } + + bool _PowerIsOn; + bool _IsWarmingUp; + bool _IsCoolingDown; + + public BasicIrDisplay(string key, string name, IROutputPort port, string irDriverFilepath) + : base(key, name) + { + IrPort = new IrOutputPortController(key + "-ir", port, irDriverFilepath); + DeviceManager.AddDevice(IrPort); + + IsWarmingUpFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Warming up={0}", _IsWarmingUp); + IsCoolingDownFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Cooling down={0}", _IsCoolingDown); + + InputPorts.AddRange(new RoutingPortCollection + { + new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, new Action(Hdmi1), this, false), + new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, new Action(Hdmi2), this, false), + new RoutingInputPort(RoutingPortNames.HdmiIn3, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, new Action(Hdmi3), this, false), + new RoutingInputPort(RoutingPortNames.HdmiIn4, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, new Action(Hdmi4), this, false), + new RoutingInputPort(RoutingPortNames.ComponentIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, new Action(Component1), this, false), + new RoutingInputPort(RoutingPortNames.CompositeIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, new Action(Video1), this, false), + new RoutingInputPort(RoutingPortNames.AntennaIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, new Action(Antenna), this, false), + }); + } + + public void Hdmi1() + { + IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_1, IrPulseTime); + } + + public void Hdmi2() + { + IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_2, IrPulseTime); + } + + public void Hdmi3() + { + IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_3, IrPulseTime); + } + + public void Hdmi4() + { + IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_4, IrPulseTime); + } + + public void Component1() + { + IrPort.Pulse(IROutputStandardCommands.IROut_COMPONENT_1, IrPulseTime); + } + + public void Video1() + { + IrPort.Pulse(IROutputStandardCommands.IROut_VIDEO_1, IrPulseTime); + } + + public void Antenna() + { + IrPort.Pulse(IROutputStandardCommands.IROut_ANTENNA, IrPulseTime); + } + + #region IPower Members + + public override void PowerOn() + { + IrPort.Pulse(IROutputStandardCommands.IROut_POWER_ON, IrPulseTime); + _PowerIsOn = true; + } + + public override void PowerOff() + { + _PowerIsOn = false; + IrPort.Pulse(IROutputStandardCommands.IROut_POWER_OFF, IrPulseTime); + } + + public override void PowerToggle() + { + _PowerIsOn = false; + IrPort.Pulse(IROutputStandardCommands.IROut_POWER, IrPulseTime); + } + + #endregion + + #region IBasicVolumeControls Members + + public void VolumeUp(bool pressRelease) + { + IrPort.PressRelease(IROutputStandardCommands.IROut_VOL_PLUS, pressRelease); + } + + public void VolumeDown(bool pressRelease) + { + IrPort.PressRelease(IROutputStandardCommands.IROut_VOL_MINUS, pressRelease); + } + + public void MuteToggle() + { + IrPort.Pulse(IROutputStandardCommands.IROut_MUTE, 200); + } + + #endregion + + void StartWarmingTimer() + { + _IsWarmingUp = true; + IsWarmingUpFeedback.FireUpdate(); + new CTimer(o => { + _IsWarmingUp = false; + IsWarmingUpFeedback.FireUpdate(); + }, 10000); + } + + void StartCoolingTimer() + { + _IsCoolingDown = true; + IsCoolingDownFeedback.FireUpdate(); + new CTimer(o => + { + _IsCoolingDown = false; + IsCoolingDownFeedback.FireUpdate(); + }, 7000); + } + + #region IRoutingSink Members + + /// + /// Typically called by the discovery routing algorithm. + /// + /// A delegate containing the input selector method to call + public override void ExecuteSwitch(object inputSelector) + { + Debug.Console(2, this, "Switching to input '{0}'", (inputSelector as Action).ToString()); + + Action finishSwitch = () => + { + var action = inputSelector as Action; + if (action != null) + action(); + }; + + if (!_PowerIsOn) + { + PowerOn(); + EventHandler oneTimer = null; + oneTimer = (o, a) => + { + if (IsWarmingUpFeedback.BoolValue) return; // Only catch done warming + IsWarmingUpFeedback.OutputChange -= oneTimer; + finishSwitch(); + }; + IsWarmingUpFeedback.OutputChange += oneTimer; + } + else // Do it! + finishSwitch(); + } + + #endregion + + public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); + } + } + + public class BasicIrDisplayFactory : EssentialsDeviceFactory + { + public BasicIrDisplayFactory() + { + TypeNames = new List() { "basicirdisplay" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new BasicIrDisplay Device"); + var ir = IRPortHelper.GetIrPort(dc.Properties); + if (ir != null) + { + var display = new BasicIrDisplay(dc.Key, dc.Name, ir.Port, ir.FileName); + display.IrPulseTime = 200; // Set default pulse time for IR commands. + return display; + } + + return null; + } + } + +} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Devices.Common/Displays/DisplayBase.cs b/src/PepperDash.Essentials.Devices.Common/Displays/DisplayBase.cs new file mode 100644 index 00000000..d93d57ff --- /dev/null +++ b/src/PepperDash.Essentials.Devices.Common/Displays/DisplayBase.cs @@ -0,0 +1,315 @@ +extern alias Full; +using System; +using System.Collections.Generic; +using System.Linq; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro.DeviceSupport; +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; +using Feedback = PepperDash.Essentials.Core.Feedback; +using JsonConvert = Full::Newtonsoft.Json.JsonConvert; + + +namespace PepperDash.Essentials.Devices.Common.Displays +{ + public abstract class DisplayBase : EssentialsDevice, IHasFeedback, IRoutingSinkWithSwitching, IHasPowerControl, IWarmingCooling, IUsageTracking + { + public event SourceInfoChangeHandler CurrentSourceChange; + + public string CurrentSourceInfoKey { get; set; } + public SourceListItem CurrentSourceInfo + { + get + { + return _CurrentSourceInfo; + } + set + { + if (value == _CurrentSourceInfo) return; + + var handler = CurrentSourceChange; + + if (handler != null) + handler(_CurrentSourceInfo, ChangeType.WillChange); + + _CurrentSourceInfo = value; + + if (handler != null) + handler(_CurrentSourceInfo, ChangeType.DidChange); + } + } + SourceListItem _CurrentSourceInfo; + + public BoolFeedback IsCoolingDownFeedback { get; protected set; } + public BoolFeedback IsWarmingUpFeedback { get; private set; } + + public UsageTracking UsageTracker { get; set; } + + public uint WarmupTime { get; set; } + public uint CooldownTime { get; set; } + + /// + /// Bool Func that will provide a value for the PowerIsOn Output. Must be implemented + /// by concrete sub-classes + /// + abstract protected Func IsCoolingDownFeedbackFunc { get; } + abstract protected Func IsWarmingUpFeedbackFunc { get; } + + + protected CTimer WarmupTimer; + protected CTimer CooldownTimer; + + #region IRoutingInputs Members + + public RoutingPortCollection InputPorts { get; private set; } + + #endregion + + protected DisplayBase(string key, string name) + : base(key, name) + { + IsCoolingDownFeedback = new BoolFeedback("IsCoolingDown", IsCoolingDownFeedbackFunc); + IsWarmingUpFeedback = new BoolFeedback("IsWarmingUp", IsWarmingUpFeedbackFunc); + + InputPorts = new RoutingPortCollection(); + + } + + public abstract void PowerOn(); + public abstract void PowerOff(); + public abstract void PowerToggle(); + + public virtual FeedbackCollection Feedbacks + { + get + { + return new FeedbackCollection + { + IsCoolingDownFeedback, + IsWarmingUpFeedback + }; + } + } + + public abstract void ExecuteSwitch(object selector); + + protected void LinkDisplayToApi(DisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey, + EiscApiAdvanced bridge) + { + var joinMap = new DisplayControllerJoinMap(joinStart); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + if (bridge != null) + { + bridge.AddJoinMap(Key, joinMap); + } + else + { + Debug.Console(0,this,"Please update config to use 'eiscapiadvanced' to get all join map features for this device."); + } + + LinkDisplayToApi(displayDevice, trilist, joinMap); + } + + protected void LinkDisplayToApi(DisplayBase displayDevice, BasicTriList trilist, DisplayControllerJoinMap joinMap) + { + Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + Debug.Console(0, "Linking to Display: {0}", displayDevice.Name); + + trilist.StringInput[joinMap.Name.JoinNumber].StringValue = displayDevice.Name; + + var commMonitor = displayDevice as ICommunicationMonitor; + if (commMonitor != null) + { + commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); + } + + var inputNumber = 0; + var inputKeys = new List(); + + var inputNumberFeedback = new IntFeedback(() => inputNumber); + + // Two way feedbacks + var twoWayDisplay = displayDevice as TwoWayDisplayBase; + + if (twoWayDisplay != null) + { + trilist.SetBool(joinMap.IsTwoWayDisplay.JoinNumber, true); + + twoWayDisplay.CurrentInputFeedback.OutputChange += (o, a) => Debug.Console(0, "CurrentInputFeedback_OutputChange {0}", a.StringValue); + + + inputNumberFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputSelect.JoinNumber]); + } + + // Power Off + trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, () => + { + inputNumber = 102; + inputNumberFeedback.FireUpdate(); + displayDevice.PowerOff(); + }); + + var twoWayDisplayDevice = displayDevice as TwoWayDisplayBase; + if (twoWayDisplayDevice != null) + { + twoWayDisplayDevice.PowerIsOnFeedback.OutputChange += (o, a) => + { + if (!a.BoolValue) + { + inputNumber = 102; + inputNumberFeedback.FireUpdate(); + + } + else + { + inputNumber = 0; + inputNumberFeedback.FireUpdate(); + } + }; + + twoWayDisplayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff.JoinNumber]); + twoWayDisplayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn.JoinNumber]); + } + + // PowerOn + trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, () => + { + inputNumber = 0; + inputNumberFeedback.FireUpdate(); + displayDevice.PowerOn(); + }); + + + + for (int i = 0; i < displayDevice.InputPorts.Count; i++) + { + if (i < joinMap.InputNamesOffset.JoinSpan) + { + inputKeys.Add(displayDevice.InputPorts[i].Key); + var tempKey = inputKeys.ElementAt(i); + trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset.JoinNumber + i), + () => displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector)); + Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}", + joinMap.InputSelectOffset.JoinNumber + i, displayDevice.InputPorts[tempKey].Key.ToString()); + trilist.StringInput[(ushort)(joinMap.InputNamesOffset.JoinNumber + i)].StringValue = displayDevice.InputPorts[i].Key.ToString(); + } + else + Debug.Console(0, displayDevice, Debug.ErrorLogLevel.Warning, "Device has {0} inputs. The Join Map allows up to {1} inputs. Discarding inputs {2} - {3} from bridge.", + displayDevice.InputPorts.Count, joinMap.InputNamesOffset.JoinSpan, i + 1, displayDevice.InputPorts.Count); + } + + Debug.Console(2, displayDevice, "Setting Input Select Action on Analog Join {0}", joinMap.InputSelect); + trilist.SetUShortSigAction(joinMap.InputSelect.JoinNumber, (a) => + { + if (a == 0) + { + displayDevice.PowerOff(); + inputNumber = 0; + } + else if (a > 0 && a < displayDevice.InputPorts.Count && a != inputNumber) + { + displayDevice.ExecuteSwitch(displayDevice.InputPorts.ElementAt(a - 1).Selector); + inputNumber = a; + } + else if (a == 102) + { + displayDevice.PowerToggle(); + + } + if (twoWayDisplay != null) + inputNumberFeedback.FireUpdate(); + }); + + + var volumeDisplay = displayDevice as IBasicVolumeControls; + if (volumeDisplay == null) return; + + trilist.SetBoolSigAction(joinMap.VolumeUp.JoinNumber, volumeDisplay.VolumeUp); + trilist.SetBoolSigAction(joinMap.VolumeDown.JoinNumber, volumeDisplay.VolumeDown); + trilist.SetSigTrueAction(joinMap.VolumeMute.JoinNumber, volumeDisplay.MuteToggle); + + var volumeDisplayWithFeedback = volumeDisplay as IBasicVolumeWithFeedback; + + if (volumeDisplayWithFeedback == null) return; + trilist.SetSigTrueAction(joinMap.VolumeMuteOn.JoinNumber, volumeDisplayWithFeedback.MuteOn); + trilist.SetSigTrueAction(joinMap.VolumeMuteOff.JoinNumber, volumeDisplayWithFeedback.MuteOff); + + + trilist.SetUShortSigAction(joinMap.VolumeLevel.JoinNumber, volumeDisplayWithFeedback.SetVolume); + volumeDisplayWithFeedback.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.VolumeLevel.JoinNumber]); + volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMute.JoinNumber]); + volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMuteOn.JoinNumber]); + volumeDisplayWithFeedback.MuteFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.VolumeMuteOff.JoinNumber]); + } + + } + + public abstract class TwoWayDisplayBase : DisplayBase, IRoutingFeedback, IHasPowerControlWithFeedback + { + public StringFeedback CurrentInputFeedback { get; private set; } + + abstract protected Func CurrentInputFeedbackFunc { get; } + + public BoolFeedback PowerIsOnFeedback { get; protected set; } + + abstract protected Func PowerIsOnFeedbackFunc { get; } + + + public static MockDisplay DefaultDisplay + { + get + { + if (_DefaultDisplay == null) + _DefaultDisplay = new MockDisplay("default", "Default Display"); + return _DefaultDisplay; + } + } + static MockDisplay _DefaultDisplay; + + public TwoWayDisplayBase(string key, string name) + : base(key, name) + { + CurrentInputFeedback = new StringFeedback(CurrentInputFeedbackFunc); + + WarmupTime = 7000; + CooldownTime = 15000; + + PowerIsOnFeedback = new BoolFeedback("PowerOnFeedback", PowerIsOnFeedbackFunc); + + Feedbacks.Add(CurrentInputFeedback); + Feedbacks.Add(PowerIsOnFeedback); + + PowerIsOnFeedback.OutputChange += PowerIsOnFeedback_OutputChange; + + } + + void PowerIsOnFeedback_OutputChange(object sender, EventArgs e) + { + if (UsageTracker != null) + { + if (PowerIsOnFeedback.BoolValue) + UsageTracker.StartDeviceUsage(); + else + UsageTracker.EndDeviceUsage(); + } + } + + public event EventHandler NumericSwitchChange; + + /// + /// Raise an event when the status of a switch object changes. + /// + /// Arguments defined as IKeyName sender, output, input, and eRoutingSignalType + protected void OnSwitchChange(RoutingNumericEventArgs e) + { + var newEvent = NumericSwitchChange; + if (newEvent != null) newEvent(this, e); + } + } +} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Devices.Common/Display/InputInterfaces.cs b/src/PepperDash.Essentials.Devices.Common/Displays/InputInterfaces.cs similarity index 100% rename from src/PepperDash.Essentials.Devices.Common/Display/InputInterfaces.cs rename to src/PepperDash.Essentials.Devices.Common/Displays/InputInterfaces.cs diff --git a/src/PepperDash.Essentials.Devices.Common/Displays/MockDisplay.cs b/src/PepperDash.Essentials.Devices.Common/Displays/MockDisplay.cs new file mode 100644 index 00000000..ffbb00cd --- /dev/null +++ b/src/PepperDash.Essentials.Devices.Common/Displays/MockDisplay.cs @@ -0,0 +1,211 @@ +using System; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro.DeviceSupport; +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.Core.Routing; + +namespace PepperDash.Essentials.Devices.Common.Displays +{ + public class MockDisplay : TwoWayDisplayBase, IBasicVolumeWithFeedback, IBridgeAdvanced + + { + public RoutingInputPort HdmiIn1 { get; private set; } + public RoutingInputPort HdmiIn2 { get; private set; } + public RoutingInputPort HdmiIn3 { get; private set; } + public RoutingInputPort ComponentIn1 { get; private set; } + public RoutingInputPort VgaIn1 { get; private set; } + + bool _PowerIsOn; + bool _IsWarmingUp; + bool _IsCoolingDown; + + protected override Func PowerIsOnFeedbackFunc + { + get + { + return () => + { + Debug.Console(2, this, "*************************************************** Display Power is {0}", _PowerIsOn ? "on" : "off"); + return _PowerIsOn; + }; + } } + protected override Func IsCoolingDownFeedbackFunc + { + get + { + return () => + { + Debug.Console(2, this, "*************************************************** {0}", _IsCoolingDown ? "Display is cooling down" : "Display has finished cooling down"); + return _IsCoolingDown; + }; + } + } + protected override Func IsWarmingUpFeedbackFunc + { + get + { + return () => + { + Debug.Console(2, this, "*************************************************** {0}", _IsWarmingUp ? "Display is warming up" : "Display has finished warming up"); + return _IsWarmingUp; + }; + } + } + protected override Func CurrentInputFeedbackFunc { get { return () => "Not Implemented"; } } + + int VolumeHeldRepeatInterval = 200; + ushort VolumeInterval = 655; + ushort _FakeVolumeLevel = 31768; + bool _IsMuted; + + public MockDisplay(string key, string name) + : base(key, name) + { + HdmiIn1 = new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, null, this); + HdmiIn2 = new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, null, this); + HdmiIn3 = new RoutingInputPort(RoutingPortNames.HdmiIn3, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, null, this); + ComponentIn1 = new RoutingInputPort(RoutingPortNames.ComponentIn, eRoutingSignalType.Video, + eRoutingPortConnectionType.Component, null, this); + VgaIn1 = new RoutingInputPort(RoutingPortNames.VgaIn, eRoutingSignalType.Video, + eRoutingPortConnectionType.Composite, null, this); + InputPorts.AddRange(new[] { HdmiIn1, HdmiIn2, HdmiIn3, ComponentIn1, VgaIn1 }); + + VolumeLevelFeedback = new IntFeedback(() => { return _FakeVolumeLevel; }); + MuteFeedback = new BoolFeedback("MuteOn", () => _IsMuted); + + WarmupTime = 10000; + CooldownTime = 10000; + } + + public override void PowerOn() + { + if (!PowerIsOnFeedback.BoolValue && !_IsWarmingUp && !_IsCoolingDown) + { + _IsWarmingUp = true; + IsWarmingUpFeedback.InvokeFireUpdate(); + // Fake power-up cycle + WarmupTimer = new CTimer(o => + { + _IsWarmingUp = false; + _PowerIsOn = true; + IsWarmingUpFeedback.InvokeFireUpdate(); + PowerIsOnFeedback.InvokeFireUpdate(); + }, WarmupTime); + } + } + + public override void PowerOff() + { + // If a display has unreliable-power off feedback, just override this and + // remove this check. + if (PowerIsOnFeedback.BoolValue && !_IsWarmingUp && !_IsCoolingDown) + { + _IsCoolingDown = true; + IsCoolingDownFeedback.InvokeFireUpdate(); + // Fake cool-down cycle + CooldownTimer = new CTimer(o => + { + Debug.Console(2, this, "Cooldown timer ending"); + _IsCoolingDown = false; + IsCoolingDownFeedback.InvokeFireUpdate(); + _PowerIsOn = false; + PowerIsOnFeedback.InvokeFireUpdate(); + }, CooldownTime); + } + } + + public override void PowerToggle() + { + if (PowerIsOnFeedback.BoolValue && !IsWarmingUpFeedback.BoolValue) + PowerOff(); + else if (!PowerIsOnFeedback.BoolValue && !IsCoolingDownFeedback.BoolValue) + PowerOn(); + } + + public override void ExecuteSwitch(object selector) + { + Debug.Console(2, this, "ExecuteSwitch: {0}", selector); + + if (!_PowerIsOn) + { + PowerOn(); + } + } + + + + #region IBasicVolumeWithFeedback Members + + public IntFeedback VolumeLevelFeedback { get; private set; } + + public void SetVolume(ushort level) + { + _FakeVolumeLevel = level; + VolumeLevelFeedback.InvokeFireUpdate(); + } + + public void MuteOn() + { + _IsMuted = true; + MuteFeedback.InvokeFireUpdate(); + } + + public void MuteOff() + { + _IsMuted = false; + MuteFeedback.InvokeFireUpdate(); + } + + public BoolFeedback MuteFeedback { get; private set; } + + #endregion + + #region IBasicVolumeControls Members + + public void VolumeUp(bool pressRelease) + { + //while (pressRelease) + //{ + Debug.Console(2, this, "Volume Down {0}", pressRelease); + if (pressRelease) + { + var newLevel = _FakeVolumeLevel + VolumeInterval; + SetVolume((ushort)newLevel); + CrestronEnvironment.Sleep(VolumeHeldRepeatInterval); + } + //} + } + + public void VolumeDown(bool pressRelease) + { + //while (pressRelease) + //{ + Debug.Console(2, this, "Volume Up {0}", pressRelease); + if (pressRelease) + { + var newLevel = _FakeVolumeLevel - VolumeInterval; + SetVolume((ushort)newLevel); + CrestronEnvironment.Sleep(VolumeHeldRepeatInterval); + } + //} + } + + public void MuteToggle() + { + _IsMuted = !_IsMuted; + MuteFeedback.InvokeFireUpdate(); + } + + #endregion + + public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); + } + } +} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Devices.Common/Shades/ShadeBase.cs b/src/PepperDash.Essentials.Devices.Common/Shades/ShadeBase.cs new file mode 100644 index 00000000..2c506750 --- /dev/null +++ b/src/PepperDash.Essentials.Devices.Common/Shades/ShadeBase.cs @@ -0,0 +1,22 @@ +using PepperDash.Essentials.Core.Shades; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Devices.Common.Shades +{ + public abstract class ShadeBase : EssentialsDevice, IShadesOpenCloseStop + { + public ShadeBase(string key, string name) + : base(key, name) + { + + } + + #region iShadesOpenClose Members + + public abstract void Open(); + public abstract void Stop(); + public abstract void Close(); + + #endregion + } +} diff --git a/src/PepperDash.Essentials.Devices.Common/SoftCodec/BlueJeansPc.cs b/src/PepperDash.Essentials.Devices.Common/SoftCodec/BlueJeansPc.cs index 868e7fca..67b205e5 100644 --- a/src/PepperDash.Essentials.Devices.Common/SoftCodec/BlueJeansPc.cs +++ b/src/PepperDash.Essentials.Devices.Common/SoftCodec/BlueJeansPc.cs @@ -1,19 +1,17 @@ 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.Routing; -using PepperDash.Essentials.Core.Devices; using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Core.Routing; +using PepperDash.Essentials.Devices.Common.Sources; namespace PepperDash.Essentials.Devices.Common.SoftCodec { - public class BlueJeansPc : InRoomPc, IRoutingInputs, IRunRouteAction, IRoutingSink + public class BlueJeansPc : InRoomPc, IRunRouteAction, IRoutingSink { public RoutingInputPort AnyVideoIn { get; private set; } diff --git a/src/PepperDash.Essentials.Devices.Common/Sources/InRoomPc.cs b/src/PepperDash.Essentials.Devices.Common/Sources/InRoomPc.cs new file mode 100644 index 00000000..af5f274f --- /dev/null +++ b/src/PepperDash.Essentials.Devices.Common/Sources/InRoomPc.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Core.Routing; + +namespace PepperDash.Essentials.Devices.Common.Sources +{ + public class InRoomPc : EssentialsDevice, IHasFeedback, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo, IUsageTracking + { + public uint DisplayUiType { get { return DisplayUiConstants.TypeLaptop; } } + public string IconName { get; set; } + public BoolFeedback HasPowerOnFeedback { get; private set; } + + public RoutingOutputPort AnyVideoOut { get; private set; } + + #region IRoutingOutputs Members + + /// + /// Options: hdmi + /// + public RoutingPortCollection OutputPorts { get; private set; } + + #endregion + + public InRoomPc(string key, string name) + : base(key, name) + { + IconName = "PC"; + HasPowerOnFeedback = new BoolFeedback("HasPowerFeedback", + () => this.GetVideoStatuses() != VideoStatusOutputs.NoStatus); + OutputPorts = new RoutingPortCollection(); + OutputPorts.Add(AnyVideoOut = new RoutingOutputPort(RoutingPortNames.AnyVideoOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.None, 0, this)); + } + + #region IHasFeedback Members + + /// + /// Passes through the VideoStatuses list + /// + public FeedbackCollection Feedbacks + { + get + { + var newList = new FeedbackCollection(); + newList.AddRange(this.GetVideoStatuses().ToList()); + return newList; + } + } + + #endregion + + #region IUsageTracking Members + + public UsageTracking UsageTracker { get; set; } + + #endregion + } + + public class InRoomPcFactory : EssentialsDeviceFactory + { + public InRoomPcFactory() + { + TypeNames = new List() { "inroompc" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new InRoomPc Device"); + return new InRoomPc(dc.Key, dc.Name); + } + } + +} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Devices.Common/Sources/Laptop.cs b/src/PepperDash.Essentials.Devices.Common/Sources/Laptop.cs new file mode 100644 index 00000000..dd1f38c2 --- /dev/null +++ b/src/PepperDash.Essentials.Devices.Common/Sources/Laptop.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Core.Routing; + +namespace PepperDash.Essentials.Devices.Common.Sources +{ + public class Laptop : EssentialsDevice, IHasFeedback, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo, IUsageTracking + { + public uint DisplayUiType { get { return DisplayUiConstants.TypeLaptop; } } + public string IconName { get; set; } + public BoolFeedback HasPowerOnFeedback { get; private set; } + + public RoutingOutputPort AnyVideoOut { get; private set; } + + #region IRoutingOutputs Members + + /// + /// Options: hdmi + /// + public RoutingPortCollection OutputPorts { get; private set; } + + #endregion + + public Laptop(string key, string name) + : base(key, name) + { + IconName = "Laptop"; + HasPowerOnFeedback = new BoolFeedback("HasPowerFeedback", + () => this.GetVideoStatuses() != VideoStatusOutputs.NoStatus); + OutputPorts = new RoutingPortCollection(); + OutputPorts.Add(AnyVideoOut = new RoutingOutputPort(RoutingPortNames.AnyOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.None, 0, this)); + } + + #region IHasFeedback Members + + /// + /// Passes through the VideoStatuses list + /// + public FeedbackCollection Feedbacks + { + get + { + var newList = new FeedbackCollection(); + newList.AddRange(this.GetVideoStatuses().ToList()); + return newList; + } + } + + #endregion + + #region IUsageTracking Members + + public UsageTracking UsageTracker { get; set; } + + #endregion + } + + public class LaptopFactory : EssentialsDeviceFactory + { + public LaptopFactory() + { + TypeNames = new List() { "laptop" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new Laptop Device"); + return new Laptop(dc.Key, dc.Name); + } + } +} \ No newline at end of file diff --git a/src/PepperDash.Essentials/Fusion/EssentialsHuddleVtc1FusionController.cs b/src/PepperDash.Essentials/Fusion/EssentialsHuddleVtc1FusionController.cs index 5ee5a893..e84dc974 100644 --- a/src/PepperDash.Essentials/Fusion/EssentialsHuddleVtc1FusionController.cs +++ b/src/PepperDash.Essentials/Fusion/EssentialsHuddleVtc1FusionController.cs @@ -9,6 +9,7 @@ using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Fusion; +using PepperDash.Essentials.Devices.Common.Sources; namespace PepperDash.Essentials.Fusion { @@ -212,7 +213,7 @@ namespace PepperDash.Essentials.Fusion break; } - var laptops = dict.Where(d => d.Value.SourceDevice is Core.Devices.Laptop); + var laptops = dict.Where(d => d.Value.SourceDevice is Laptop); i = 1; foreach (var kvp in laptops) { diff --git a/src/PepperDash.Essentials/UIDrivers/EssentialsHuddle/EssentialsHuddleTechPageDriver.cs b/src/PepperDash.Essentials/UIDrivers/EssentialsHuddle/EssentialsHuddleTechPageDriver.cs index 57aed03e..c07e0b1c 100644 --- a/src/PepperDash.Essentials/UIDrivers/EssentialsHuddle/EssentialsHuddleTechPageDriver.cs +++ b/src/PepperDash.Essentials/UIDrivers/EssentialsHuddle/EssentialsHuddleTechPageDriver.cs @@ -12,8 +12,11 @@ using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.SmartObjects; using PepperDash.Essentials.Core.Touchpanels.Keyboards; +using PepperDash.Essentials.Devices.Common.Displays; using PepperDash.Essentials.Devices.Displays; using PepperDash.Essentials.Room.Config; +using DisplayBase = PepperDash.Essentials.Core.DisplayBase; +using TwoWayDisplayBase = PepperDash.Essentials.Core.TwoWayDisplayBase; namespace PepperDash.Essentials.UIDrivers { From ba9cc9f00cc708bd22b54f14f8d9070f39c40a95 Mon Sep 17 00:00:00 2001 From: Nick Genovese Date: Mon, 6 Nov 2023 15:46:07 -0500 Subject: [PATCH 10/21] feat(wip): still working on re-arranging base classes --- .../{Factory => }/DeviceFactory.cs | 15 --------------- .../Somfy => Shades}/RelayControlledShade.cs | 12 ++++-------- .../Shades/ShadeController.cs | 17 +++++++---------- .../EssentialsShadeDriver.cs | 1 - 4 files changed, 11 insertions(+), 34 deletions(-) rename src/PepperDash.Essentials.Devices.Common/{Factory => }/DeviceFactory.cs (69%) rename src/PepperDash.Essentials.Devices.Common/{Environment/Somfy => Shades}/RelayControlledShade.cs (92%) rename src/{PepperDash.Essentials.Core => PepperDash.Essentials.Devices.Common}/Shades/ShadeController.cs (82%) diff --git a/src/PepperDash.Essentials.Devices.Common/Factory/DeviceFactory.cs b/src/PepperDash.Essentials.Devices.Common/DeviceFactory.cs similarity index 69% rename from src/PepperDash.Essentials.Devices.Common/Factory/DeviceFactory.cs rename to src/PepperDash.Essentials.Devices.Common/DeviceFactory.cs index c5ab29b1..b5ee9a89 100644 --- a/src/PepperDash.Essentials.Devices.Common/Factory/DeviceFactory.cs +++ b/src/PepperDash.Essentials.Devices.Common/DeviceFactory.cs @@ -2,24 +2,9 @@ using System; using System.Linq; -using System.Collections.Generic; -using Crestron.SimplSharp; -using Crestron.SimplSharp.CrestronIO; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.GeneralIO; using Crestron.SimplSharp.Reflection; - -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; using PepperDash.Core; using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Core.CrestronIO; - -using PepperDash.Essentials.Devices.Common; -using PepperDash.Essentials.Devices.Common.DSP; -using PepperDash.Essentials.Devices.Common.VideoCodec; -using PepperDash.Essentials.Devices.Common.Environment; namespace PepperDash.Essentials.Devices.Common { diff --git a/src/PepperDash.Essentials.Devices.Common/Environment/Somfy/RelayControlledShade.cs b/src/PepperDash.Essentials.Devices.Common/Shades/RelayControlledShade.cs similarity index 92% rename from src/PepperDash.Essentials.Devices.Common/Environment/Somfy/RelayControlledShade.cs rename to src/PepperDash.Essentials.Devices.Common/Shades/RelayControlledShade.cs index 852d554f..a8fc5fd4 100644 --- a/src/PepperDash.Essentials.Devices.Common/Environment/Somfy/RelayControlledShade.cs +++ b/src/PepperDash.Essentials.Devices.Common/Shades/RelayControlledShade.cs @@ -1,16 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Collections.Generic; using Crestron.SimplSharp; - using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.CrestronIO; using PepperDash.Essentials.Core.Shades; -namespace PepperDash.Essentials.Devices.Common.Environment.Somfy +namespace PepperDash.Essentials.Devices.Common.Shades { /// /// Controls a single shade using three relays @@ -122,9 +118,9 @@ namespace PepperDash.Essentials.Devices.Common.Environment.Somfy public override EssentialsDevice BuildDevice(DeviceConfig dc) { Debug.Console(1, "Factory Attempting to create new Generic Comm Device"); - var props = Newtonsoft.Json.JsonConvert.DeserializeObject(dc.Properties.ToString()); + var props = Newtonsoft.Json.JsonConvert.DeserializeObject(dc.Properties.ToString()); - return new Environment.Somfy.RelayControlledShade(dc.Key, dc.Name, props); + return new RelayControlledShade(dc.Key, dc.Name, props); } } diff --git a/src/PepperDash.Essentials.Core/Shades/ShadeController.cs b/src/PepperDash.Essentials.Devices.Common/Shades/ShadeController.cs similarity index 82% rename from src/PepperDash.Essentials.Core/Shades/ShadeController.cs rename to src/PepperDash.Essentials.Devices.Common/Shades/ShadeController.cs index 6dff9803..a229cb6d 100644 --- a/src/PepperDash.Essentials.Core/Shades/ShadeController.cs +++ b/src/PepperDash.Essentials.Devices.Common/Shades/ShadeController.cs @@ -1,13 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - +using System.Collections.Generic; using PepperDash.Core; +using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Core.Shades; -namespace PepperDash.Essentials.Core.Shades +namespace PepperDash.Essentials.Devices.Common.Shades { /// /// Class that contains the shades to be controlled in a room @@ -40,7 +37,7 @@ namespace PepperDash.Essentials.Core.Shades return base.CustomActivate(); } - void AddShade(ShadeBase shade) + void AddShade(IShadesOpenCloseStop shade) { Shades.Add(shade); } @@ -67,9 +64,9 @@ namespace PepperDash.Essentials.Core.Shades public override EssentialsDevice BuildDevice(DeviceConfig dc) { Debug.Console(1, "Factory Attempting to create new ShadeController Device"); - var props = Newtonsoft.Json.JsonConvert.DeserializeObject(dc.Properties.ToString()); + var props = Newtonsoft.Json.JsonConvert.DeserializeObject(dc.Properties.ToString()); - return new Core.Shades.ShadeController(dc.Key, dc.Name, props); + return new ShadeController(dc.Key, dc.Name, props); } } diff --git a/src/PepperDash.Essentials/UIDrivers/Environment Drivers/EssentialsShadeDriver.cs b/src/PepperDash.Essentials/UIDrivers/Environment Drivers/EssentialsShadeDriver.cs index 63b38f9d..1d8ad7c2 100644 --- a/src/PepperDash.Essentials/UIDrivers/Environment Drivers/EssentialsShadeDriver.cs +++ b/src/PepperDash.Essentials/UIDrivers/Environment Drivers/EssentialsShadeDriver.cs @@ -8,7 +8,6 @@ using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Shades; -using PepperDash.Essentials.Devices.Common.Environment.Somfy; namespace PepperDash.Essentials { From 8023ef6c1b0ed5beb84bf82d8ff247612f21fa6f Mon Sep 17 00:00:00 2001 From: Nick Genovese Date: Wed, 8 Nov 2023 14:26:58 -0500 Subject: [PATCH 11/21] feat: removed rooms and cisco codec --- .../Display/MockDisplay.cs | 2 + .../Codec/iHasCallHistory.cs | 6 - .../CiscoCodec/BookingsDataClasses.cs | 448 --- .../VideoCodec/CiscoCodec/CiscoCamera.cs | 323 -- .../CiscoCodec/CiscoCodecJoinMap.cs | 205 -- .../VideoCodec/CiscoCodec/CiscoSparkCodec.cs | 2615 ----------------- .../CiscoSparkCodecPropertiesConfig.cs | 91 - .../VideoCodec/CiscoCodec/HttpApiServer.cs | 106 - .../CiscoCodec/PhonebookDataClasses.cs | 397 --- .../VideoCodec/CiscoCodec/eCommandType.cs | 4 + .../CiscoCodec/eExternalSourceMode.cs | 4 + .../CiscoCodec/eExternalSourceType.cs | 4 + .../VideoCodec/CiscoCodec/xConfiguration.cs | 1879 ------------ .../VideoCodec/CiscoCodec/xEvent.cs | 166 -- .../VideoCodec/CiscoCodec/xStatus.cs | 2281 -------------- .../VideoCodec/CiscoCodec/xStatusSparkPlus.cs | 1552 ---------- .../Audio/EssentialsVolumeLevelConfig.cs | 29 - src/PepperDash.Essentials/ControlSystem.cs | 94 +- .../Devices/Amplifier.cs | 72 - .../EssentialsHuddleVtc1FusionController.cs | 359 --- ...ssentialsTechRoomFusionSystemController.cs | 106 - .../{UI => }/HttpLogoServer.cs | 0 ...sentialsDualDisplayRoomPropertiesConfig.cs | 17 - .../EssentialsHuddleRoomPropertiesConfig.cs | 44 - .../EssentialsHuddleVtc1PropertiesConfig.cs | 19 - .../EssentialsNDisplayRoomPropertiesConfig.cs | 41 - .../EssentialsPresentationPropertiesConfig.cs | 26 - .../Room/Config/EssentialsRoomConfig.cs | 413 --- .../Config/EssentialsRoomEmergencyConfig.cs | 36 - .../Room/Config/EssentialsTechRoomConfig.cs | 77 - .../Room/Config/SimplRoomPropertiesConfig.cs | 32 - .../EsentialsRoomEmergencyContactClosure.cs | 58 - .../Types/EssentialsCombinedHuddleVtc1Room.cs | 968 ------ .../Room/Types/EssentialsDualDisplayRoom.cs | 675 ----- .../Room/Types/EssentialsHuddleSpaceRoom.cs | 566 ---- .../Room/Types/EssentialsHuddleVtc1Room.cs | 948 ------ .../Room/Types/EssentialsNDisplayRoomBase.cs | 35 - .../Room/Types/EssentialsTechRoom.cs | 519 ---- .../Interfaces/IEssentialsHuddleSpaceRoom.cs | 25 - .../Interfaces/IEssentialsHuddleVtc1Room.cs | 28 - .../UI/DualDisplaySourceSRLController.cs | 28 - .../UI/EssentialsTouchpanelController.cs | 290 -- .../UI/JoinConstants/UIBoolJoin.cs | 991 ------- .../UI/JoinConstants/UISmartObjectJoin.cs | 88 - .../UI/JoinConstants/UIStringlJoin.cs | 348 --- .../UI/JoinConstants/UIUshortJoin.cs | 54 - .../UI/SmartObjectHeaderButtonList.cs | 58 - .../UI/SubpageReferenceListActivityItem.cs | 39 - .../UI/SubpageReferenceListCallStagingItem.cs | 39 - .../UI/SubpageReferenceListSourceItem.cs | 71 - .../UIDrivers/DualDisplayRouting.cs | 231 -- .../EssentialsEnvironmentDriver.cs | 256 -- .../EssentialsLightingDriver.cs | 210 -- .../EssentialsShadeDriver.cs | 116 - .../Essentials/EssentialsHeaderDriver.cs | 399 --- .../EssentialsPanelMainInterfaceDriver.cs | 168 -- ...tialsPresentationPanelAvFunctionsDriver.cs | 1048 ------- .../EssentialsHuddlePanelAvFunctionsDriver.cs | 1128 ------- .../EssentialsHuddleTechPageDriver.cs | 329 --- .../EssentialsHuddlePresentationUiDriver.cs | 49 - ...entialsHuddleVtc1PanelAvFunctionsDriver.cs | 1652 ----------- .../UIDrivers/JoinedSigInterlock.cs | 175 -- .../SingleSubpageModalAndBackDriver.cs | 55 - .../Page Drivers/SingleSubpageModalDriver.cs | 43 - .../UIDrivers/ScreenSaverController.cs | 152 - .../UIDrivers/SigInterlock.cs | 99 - .../UIDrivers/SmartObjectRoomsList.cs | 94 - .../UIDrivers/SourceChangeArgs.cs | 16 - .../VC/EssentialsVideoCodecUiDriver.cs | 2000 ------------- .../UIDrivers/enums and base.cs | 158 - 70 files changed, 59 insertions(+), 25595 deletions(-) delete mode 100644 src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/BookingsDataClasses.cs delete mode 100644 src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/CiscoCamera.cs delete mode 100644 src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/CiscoCodecJoinMap.cs delete mode 100644 src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs delete mode 100644 src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/CiscoSparkCodecPropertiesConfig.cs delete mode 100644 src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/HttpApiServer.cs delete mode 100644 src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/PhonebookDataClasses.cs create mode 100644 src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/eCommandType.cs create mode 100644 src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/eExternalSourceMode.cs create mode 100644 src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/eExternalSourceType.cs delete mode 100644 src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/xConfiguration.cs delete mode 100644 src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/xEvent.cs delete mode 100644 src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/xStatus.cs delete mode 100644 src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/xStatusSparkPlus.cs delete mode 100644 src/PepperDash.Essentials/Audio/EssentialsVolumeLevelConfig.cs delete mode 100644 src/PepperDash.Essentials/Devices/Amplifier.cs delete mode 100644 src/PepperDash.Essentials/Fusion/EssentialsHuddleVtc1FusionController.cs delete mode 100644 src/PepperDash.Essentials/Fusion/EssentialsTechRoomFusionSystemController.cs rename src/PepperDash.Essentials/{UI => }/HttpLogoServer.cs (100%) delete mode 100644 src/PepperDash.Essentials/Room/Config/EssentialsDualDisplayRoomPropertiesConfig.cs delete mode 100644 src/PepperDash.Essentials/Room/Config/EssentialsHuddleRoomPropertiesConfig.cs delete mode 100644 src/PepperDash.Essentials/Room/Config/EssentialsHuddleVtc1PropertiesConfig.cs delete mode 100644 src/PepperDash.Essentials/Room/Config/EssentialsNDisplayRoomPropertiesConfig.cs delete mode 100644 src/PepperDash.Essentials/Room/Config/EssentialsPresentationPropertiesConfig.cs delete mode 100644 src/PepperDash.Essentials/Room/Config/EssentialsRoomConfig.cs delete mode 100644 src/PepperDash.Essentials/Room/Config/EssentialsRoomEmergencyConfig.cs delete mode 100644 src/PepperDash.Essentials/Room/Config/EssentialsTechRoomConfig.cs delete mode 100644 src/PepperDash.Essentials/Room/Config/SimplRoomPropertiesConfig.cs delete mode 100644 src/PepperDash.Essentials/Room/Emergency/EsentialsRoomEmergencyContactClosure.cs delete mode 100644 src/PepperDash.Essentials/Room/Types/EssentialsCombinedHuddleVtc1Room.cs delete mode 100644 src/PepperDash.Essentials/Room/Types/EssentialsDualDisplayRoom.cs delete mode 100644 src/PepperDash.Essentials/Room/Types/EssentialsHuddleSpaceRoom.cs delete mode 100644 src/PepperDash.Essentials/Room/Types/EssentialsHuddleVtc1Room.cs delete mode 100644 src/PepperDash.Essentials/Room/Types/EssentialsNDisplayRoomBase.cs delete mode 100644 src/PepperDash.Essentials/Room/Types/EssentialsTechRoom.cs delete mode 100644 src/PepperDash.Essentials/Room/Types/Interfaces/IEssentialsHuddleSpaceRoom.cs delete mode 100644 src/PepperDash.Essentials/Room/Types/Interfaces/IEssentialsHuddleVtc1Room.cs delete mode 100644 src/PepperDash.Essentials/UI/DualDisplaySourceSRLController.cs delete mode 100644 src/PepperDash.Essentials/UI/EssentialsTouchpanelController.cs delete mode 100644 src/PepperDash.Essentials/UI/JoinConstants/UIBoolJoin.cs delete mode 100644 src/PepperDash.Essentials/UI/JoinConstants/UISmartObjectJoin.cs delete mode 100644 src/PepperDash.Essentials/UI/JoinConstants/UIStringlJoin.cs delete mode 100644 src/PepperDash.Essentials/UI/JoinConstants/UIUshortJoin.cs delete mode 100644 src/PepperDash.Essentials/UI/SmartObjectHeaderButtonList.cs delete mode 100644 src/PepperDash.Essentials/UI/SubpageReferenceListActivityItem.cs delete mode 100644 src/PepperDash.Essentials/UI/SubpageReferenceListCallStagingItem.cs delete mode 100644 src/PepperDash.Essentials/UI/SubpageReferenceListSourceItem.cs delete mode 100644 src/PepperDash.Essentials/UIDrivers/DualDisplayRouting.cs delete mode 100644 src/PepperDash.Essentials/UIDrivers/Environment Drivers/EssentialsEnvironmentDriver.cs delete mode 100644 src/PepperDash.Essentials/UIDrivers/Environment Drivers/EssentialsLightingDriver.cs delete mode 100644 src/PepperDash.Essentials/UIDrivers/Environment Drivers/EssentialsShadeDriver.cs delete mode 100644 src/PepperDash.Essentials/UIDrivers/Essentials/EssentialsHeaderDriver.cs delete mode 100644 src/PepperDash.Essentials/UIDrivers/Essentials/EssentialsPanelMainInterfaceDriver.cs delete mode 100644 src/PepperDash.Essentials/UIDrivers/Essentials/EssentialsPresentationPanelAvFunctionsDriver.cs delete mode 100644 src/PepperDash.Essentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs delete mode 100644 src/PepperDash.Essentials/UIDrivers/EssentialsHuddle/EssentialsHuddleTechPageDriver.cs delete mode 100644 src/PepperDash.Essentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddlePresentationUiDriver.cs delete mode 100644 src/PepperDash.Essentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs delete mode 100644 src/PepperDash.Essentials/UIDrivers/JoinedSigInterlock.cs delete mode 100644 src/PepperDash.Essentials/UIDrivers/Page Drivers/SingleSubpageModalAndBackDriver.cs delete mode 100644 src/PepperDash.Essentials/UIDrivers/Page Drivers/SingleSubpageModalDriver.cs delete mode 100644 src/PepperDash.Essentials/UIDrivers/ScreenSaverController.cs delete mode 100644 src/PepperDash.Essentials/UIDrivers/SigInterlock.cs delete mode 100644 src/PepperDash.Essentials/UIDrivers/SmartObjectRoomsList.cs delete mode 100644 src/PepperDash.Essentials/UIDrivers/SourceChangeArgs.cs delete mode 100644 src/PepperDash.Essentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs delete mode 100644 src/PepperDash.Essentials/UIDrivers/enums and base.cs diff --git a/src/PepperDash.Essentials.Core/Display/MockDisplay.cs b/src/PepperDash.Essentials.Core/Display/MockDisplay.cs index 70a1596e..4b60882b 100644 --- a/src/PepperDash.Essentials.Core/Display/MockDisplay.cs +++ b/src/PepperDash.Essentials.Core/Display/MockDisplay.cs @@ -218,6 +218,8 @@ namespace PepperDash.Essentials.Core } } + + [Obsolete("Please use PepperDash.Essentials.Devices.Common")] public class MockDisplayFactory : EssentialsDeviceFactory { public MockDisplayFactory() diff --git a/src/PepperDash.Essentials.Devices.Common/Codec/iHasCallHistory.cs b/src/PepperDash.Essentials.Devices.Common/Codec/iHasCallHistory.cs index b0451d7b..07e53b3d 100644 --- a/src/PepperDash.Essentials.Devices.Common/Codec/iHasCallHistory.cs +++ b/src/PepperDash.Essentials.Devices.Common/Codec/iHasCallHistory.cs @@ -2,12 +2,6 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -using PepperDash.Core; -using PepperDash.Essentials.Devices.Common.Codec; using PepperDash.Essentials.Devices.Common.VideoCodec; using Full.Newtonsoft.Json; diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/BookingsDataClasses.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/BookingsDataClasses.cs deleted file mode 100644 index 05456ad4..00000000 --- a/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/BookingsDataClasses.cs +++ /dev/null @@ -1,448 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -using PepperDash.Core; -using PepperDash.Essentials.Devices.Common.Codec; - -namespace PepperDash.Essentials.Devices.Common.VideoCodec -{ - public class CiscoCodecBookings - { - public class TotalRows - { - public string Value { get; set; } - } - - public class ResultInfo - { - public TotalRows TotalRows { get; set; } - } - - public class LastUpdated - { - string _value; - - public DateTime Value { - get - { - DateTime _valueDateTime; - try - { - _valueDateTime = DateTime.Parse(_value); - return _valueDateTime; - } - catch - { - return new DateTime(); - } - } - set - { - _value = value.ToString(); - } - } - } - - public class Id - { - public string Value { get; set; } - } - - public class Title - { - public string Value { get; set; } - } - - public class Agenda - { - public string Value { get; set; } - } - - public class Privacy - { - public string Value { get; set; } - } - - public class FirstName - { - public string Value { get; set; } - } - - public class LastName - { - public string Value { get; set; } - } - - public class Email - { - public string Value { get; set; } - } - - public class Id2 - { - public string Value { get; set; } - } - - public class Organizer - { - public FirstName FirstName { get; set; } - public LastName LastName { get; set; } - public Email Email { get; set; } - public Id2 Id { get; set; } - - public Organizer() - { - FirstName = new FirstName(); - LastName = new LastName(); - Email = new Email(); - } - } - - public class StartTime - { - public DateTime Value { get; set; } - } - - public class StartTimeBuffer - { - public string Value { get; set; } - } - - public class EndTime - { - public DateTime Value { get; set; } - } - - public class EndTimeBuffer - { - public string Value { get; set; } - } - - public class Time - { - public StartTime StartTime { get; set; } - public StartTimeBuffer StartTimeBuffer { get; set; } - public EndTime EndTime { get; set; } - public EndTimeBuffer EndTimeBuffer { get; set; } - - public Time() - { - StartTime = new StartTime(); - EndTime = new EndTime(); - } - } - - public class MaximumMeetingExtension - { - public string Value { get; set; } - } - - public class MeetingExtensionAvailability - { - public string Value { get; set; } - } - - public class BookingStatus - { - public string Value { get; set; } - } - - public class BookingStatusMessage - { - public string Value { get; set; } - } - - public class Enabled - { - public string Value { get; set; } - } - - public class Url - { - public string Value { get; set; } - } - - public class MeetingNumber - { - public string Value { get; set; } - } - - public class Password - { - public string Value { get; set; } - } - - public class HostKey - { - public string Value { get; set; } - } - - public class DialInNumbers - { - } - - public class Webex - { - public Enabled Enabled { get; set; } - public Url Url { get; set; } - public MeetingNumber MeetingNumber { get; set; } - public Password Password { get; set; } - public HostKey HostKey { get; set; } - public DialInNumbers DialInNumbers { get; set; } - } - - public class Encryption - { - public string Value { get; set; } - } - - public class Role - { - public string Value { get; set; } - } - - public class Recording - { - public string Value { get; set; } - } - - public class Number - { - public string Value { get; set; } - } - - public class Protocol - { - public string Value { get; set; } - } - - public class CallRate - { - public string Value { get; set; } - } - - public class CallType - { - public string Value { get; set; } - } - - public class Call - { - public string id { get; set; } - public Number Number { get; set; } - public Protocol Protocol { get; set; } - public CallRate CallRate { get; set; } - public CallType CallType { get; set; } - } - - public class Calls - { - public List Call {get; set;} - } - - public class ConnectMode - { - public string Value { get; set; } - } - - public class DialInfo - { - public Calls Calls { get; set; } - public ConnectMode ConnectMode { get; set; } - - public DialInfo() - { - Calls = new Calls(); - ConnectMode = new ConnectMode(); - } - } - - public class Booking - { - public string id { get; set; } - public Id Id { get; set; } - public Title Title { get; set; } - public Agenda Agenda { get; set; } - public Privacy Privacy { get; set; } - public Organizer Organizer { get; set; } - public Time Time { get; set; } - public MaximumMeetingExtension MaximumMeetingExtension { get; set; } - public MeetingExtensionAvailability MeetingExtensionAvailability { get; set; } - public BookingStatus BookingStatus { get; set; } - public BookingStatusMessage BookingStatusMessage { get; set; } - public Webex Webex { get; set; } - public Encryption Encryption { get; set; } - public Role Role { get; set; } - public Recording Recording { get; set; } - public DialInfo DialInfo { get; set; } - - public Booking() - { - Time = new Time(); - Id = new Id(); - Organizer = new Organizer(); - Title = new Title(); - Agenda = new Agenda(); - Privacy = new Privacy(); - DialInfo = new DialInfo(); - } - } - - public class BookingsListResult - { - public string status { get; set; } - public ResultInfo ResultInfo { get; set; } - //public LastUpdated LastUpdated { get; set; } - public List Booking { get; set; } - } - - public class CommandResponse - { - public BookingsListResult BookingsListResult { get; set; } - } - - public class RootObject - { - public CommandResponse CommandResponse { get; set; } - } - - /// - /// Extracts the necessary meeting values from the Cisco bookings response ans converts them to the generic class - /// - /// - /// - public static List GetGenericMeetingsFromBookingResult(List bookings) - { - var meetings = new List(); - - if (Debug.Level > 0) - { - Debug.Console(1, "Meetings List:\n"); - } - - foreach(Booking b in bookings) - { - var meeting = new Meeting(); - - if(b.Id != null) - meeting.Id = b.Id.Value; - if(b.Organizer != null) - meeting.Organizer = string.Format("{0}, {1}", b.Organizer.LastName.Value, b.Organizer.FirstName.Value); - if(b.Title != null) - meeting.Title = b.Title.Value; - if(b.Agenda != null) - meeting.Agenda = b.Agenda.Value; - if(b.Time != null) - { - meeting.StartTime = b.Time.StartTime.Value; - meeting.EndTime = b.Time.EndTime.Value; - } - if(b.Privacy != null) - meeting.Privacy = CodecCallPrivacy.ConvertToDirectionEnum(b.Privacy.Value); - -//#warning Update this ConnectMode conversion after testing onsite. Expected value is "OBTP", but in PD NYC Test scenarios, "Manual" is being returned for OBTP meetings - if (b.DialInfo.ConnectMode != null) - if (b.DialInfo.ConnectMode.Value.ToLower() == "obtp" || b.DialInfo.ConnectMode.Value.ToLower() == "manual") - meeting.IsOneButtonToPushMeeting = true; - - meeting.Dialable = b.DialInfo.Calls.Call.Count > 0; - - if (b.DialInfo.Calls.Call != null) - { - foreach (Call c in b.DialInfo.Calls.Call) - { - meeting.Calls.Add(new PepperDash.Essentials.Devices.Common.Codec.Call() - { - Number = c.Number.Value, - Protocol = c.Protocol.Value, - CallRate = c.CallRate.Value, - CallType = c.CallType.Value - }); - } - } - - - meetings.Add(meeting); - - if(Debug.Level > 0) - { - Debug.Console(1, "Title: {0}, ID: {1}, Organizer: {2}, Agenda: {3}", meeting.Title, meeting.Id, meeting.Organizer, meeting.Agenda); - Debug.Console(1, " Start Time: {0}, End Time: {1}, Duration: {2}", meeting.StartTime, meeting.EndTime, meeting.Duration); - Debug.Console(1, " Joinable: {0}\n", meeting.Joinable); - } - } - - meetings.OrderBy(m => m.StartTime); - - return meetings; - } - - public static List GetGenericMeetingsFromBookingResult(List bookings, int joinableCooldownSeconds) - { - var meetings = new List(); - - if (Debug.Level > 0) - { - Debug.Console(1, "Meetings List:\n"); - } - - foreach (Booking b in bookings) - { - var meeting = new Meeting(joinableCooldownSeconds); - - if (b.Id != null) - meeting.Id = b.Id.Value; - if (b.Organizer != null) - meeting.Organizer = string.Format("{0}, {1}", b.Organizer.LastName.Value, b.Organizer.FirstName.Value); - if (b.Title != null) - meeting.Title = b.Title.Value; - if (b.Agenda != null) - meeting.Agenda = b.Agenda.Value; - if (b.Time != null) - { - meeting.StartTime = b.Time.StartTime.Value; - meeting.EndTime = b.Time.EndTime.Value; - } - if (b.Privacy != null) - meeting.Privacy = CodecCallPrivacy.ConvertToDirectionEnum(b.Privacy.Value); - - //#warning Update this ConnectMode conversion after testing onsite. Expected value is "OBTP", but in PD NYC Test scenarios, "Manual" is being returned for OBTP meetings - if (b.DialInfo.ConnectMode != null) - if (b.DialInfo.ConnectMode.Value.ToLower() == "obtp" || b.DialInfo.ConnectMode.Value.ToLower() == "manual") - meeting.IsOneButtonToPushMeeting = true; - - if (b.DialInfo.Calls.Call != null) - { - foreach (Call c in b.DialInfo.Calls.Call) - { - meeting.Calls.Add(new PepperDash.Essentials.Devices.Common.Codec.Call() - { - Number = c.Number.Value, - Protocol = c.Protocol.Value, - CallRate = c.CallRate.Value, - CallType = c.CallType.Value - }); - } - } - - - meetings.Add(meeting); - - if (Debug.Level > 0) - { - Debug.Console(1, "Title: {0}, ID: {1}, Organizer: {2}, Agenda: {3}", meeting.Title, meeting.Id, meeting.Organizer, meeting.Agenda); - Debug.Console(1, " Start Time: {0}, End Time: {1}, Duration: {2}", meeting.StartTime, meeting.EndTime, meeting.Duration); - Debug.Console(1, " Joinable: {0}\n", meeting.Joinable); - } - } - - meetings.OrderBy(m => m.StartTime); - - return meetings; - } - - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/CiscoCamera.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/CiscoCamera.cs deleted file mode 100644 index 9e8b0554..00000000 --- a/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/CiscoCamera.cs +++ /dev/null @@ -1,323 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DeviceSupport; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.Devices.Common.Cameras; - -namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco -{ - public class CiscoFarEndCamera : CameraBase, IHasCameraPtzControl, IAmFarEndCamera, IBridgeAdvanced - { - protected CiscoSparkCodec ParentCodec { get; private set; } - - protected string CallId { - get - { - return (ParentCodec as CiscoSparkCodec).GetCallId(); - } - } - - public CiscoFarEndCamera(string key, string name, CiscoSparkCodec codec) - : base(key, name) - { - Capabilities = eCameraCapabilities.Pan | eCameraCapabilities.Tilt | eCameraCapabilities.Zoom; - - ParentCodec = codec; - } - - #region IHasCameraPtzControl Members - - public void PositionHome() - { - // Not supported on far end camera - } - - #endregion - - #region IHasCameraPanControl Members - - public void PanLeft() - { - ParentCodec.EnqueueCommand(string.Format("xCommand Call FarEndControl Camera Move Value: Left CallId: {0}", CallId)); - } - - public void PanRight() - { - ParentCodec.EnqueueCommand(string.Format("xCommand Call FarEndControl Camera Move Value: Right CallId: {0}", CallId)); - } - - public void PanStop() - { - Stop(); - } - - #endregion - - #region IHasCameraTiltControl Members - - public void TiltDown() - { - ParentCodec.EnqueueCommand(string.Format("xCommand Call FarEndControl Camera Move Value: Down CallId: {0}", CallId)); - } - - public void TiltUp() - { - ParentCodec.EnqueueCommand(string.Format("xCommand Call FarEndControl Camera Move Value: Up CallId: {0}", CallId)); - } - - public void TiltStop() - { - Stop(); - } - - #endregion - - #region IHasCameraZoomControl Members - - public void ZoomIn() - { - ParentCodec.EnqueueCommand(string.Format("xCommand Call FarEndControl Camera Move Value: ZoomIn CallId: {0}", CallId)); - } - - public void ZoomOut() - { - ParentCodec.EnqueueCommand(string.Format("xCommand Call FarEndControl Camera Move Value: ZoomOut CallId: {0}", CallId)); - } - - public void ZoomStop() - { - Stop(); - } - - #endregion - - - void Stop() - { - ParentCodec.EnqueueCommand(string.Format("xCommand Call FarEndControl Camera Stop CallId: {0}", CallId)); - } - - public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - LinkCameraToApi(this, trilist, joinStart, joinMapKey, bridge); - } - } - - public class CiscoSparkCamera : CameraBase, IHasCameraPtzControl, IHasCameraFocusControl, IBridgeAdvanced - { - /// - /// The codec this camera belongs to - /// - protected CiscoSparkCodec ParentCodec { get; private set; } - - /// - /// The ID of the camera on the codec - /// - public uint CameraId { get; private set; } - - /// - /// Valid range 1-15 - /// - protected uint PanSpeed { get; private set; } - - /// - /// Valid range 1-15 - /// - protected uint TiltSpeed { get; private set; } - - /// - /// Valid range 1-15 - /// - protected uint ZoomSpeed { get; private set; } - - private bool isPanning; - - private bool isTilting; - - private bool isZooming; - - private bool isFocusing; - - private bool isMoving - { - get - { - return isPanning || isTilting || isZooming || isFocusing; - - } - } - - public CiscoSparkCamera(string key, string name, CiscoSparkCodec codec, uint id) - : base(key, name) - { - // Default to all capabilties - Capabilities = eCameraCapabilities.Pan | eCameraCapabilities.Tilt | eCameraCapabilities.Zoom | eCameraCapabilities.Focus; - - ParentCodec = codec; - - CameraId = id; - - // Set default speeds - PanSpeed = 7; - TiltSpeed = 7; - ZoomSpeed = 7; - } - - - // Takes a string from the camera capabilities value and converts from "ptzf" to enum bitmask - public void SetCapabilites(string capabilites) - { - var c = capabilites.ToLower(); - - if (c.Contains("p")) - Capabilities = Capabilities | eCameraCapabilities.Pan; - - if (c.Contains("t")) - Capabilities = Capabilities | eCameraCapabilities.Tilt; - - if (c.Contains("z")) - Capabilities = Capabilities | eCameraCapabilities.Zoom; - - if (c.Contains("f")) - Capabilities = Capabilities | eCameraCapabilities.Focus; - } - - #region IHasCameraPtzControl Members - - public void PositionHome() - { - // Not supported on Internal Spark Camera - - - } - - #endregion - - #region IHasCameraPanControl Members - - public void PanLeft() - { - if (!isMoving) - { - ParentCodec.EnqueueCommand(string.Format("xCommand Camera Ramp CameraId: {0} Pan: Left PanSpeed: {1}", CameraId, PanSpeed)); - isPanning = true; - } - } - - public void PanRight() - { - if (!isMoving) - { - ParentCodec.EnqueueCommand(string.Format("xCommand Camera Ramp CameraId: {0} Pan: Right PanSpeed: {1}", CameraId, PanSpeed)); - isPanning = true; - } - } - - public void PanStop() - { - ParentCodec.EnqueueCommand(string.Format("xCommand Camera Ramp CameraId: {0} Pan: Stop", CameraId)); - isPanning = false; - } - - #endregion - - - - #region IHasCameraTiltControl Members - - public void TiltDown() - { - if (!isMoving) - { - ParentCodec.EnqueueCommand(string.Format("xCommand Camera Ramp CameraId: {0} Tilt: Down TiltSpeed: {1}", CameraId, TiltSpeed)); - isTilting = true; - } - } - - public void TiltUp() - { - if (!isMoving) - { - ParentCodec.EnqueueCommand(string.Format("xCommand Camera Ramp CameraId: {0} Tilt: Up TiltSpeed: {1}", CameraId, TiltSpeed)); - isTilting = true; - } - } - - public void TiltStop() - { - ParentCodec.EnqueueCommand(string.Format("xCommand Camera Ramp CameraId: {0} Tilt: Stop", CameraId)); - isTilting = false; - } - - #endregion - - #region IHasCameraZoomControl Members - - public void ZoomIn() - { - if (!isMoving) - { - ParentCodec.EnqueueCommand(string.Format("xCommand Camera Ramp CameraId: {0} Zoom: In ZoomSpeed: {1}", CameraId, ZoomSpeed)); - isZooming = true; - } - } - - public void ZoomOut() - { - if (!isMoving) - { - ParentCodec.EnqueueCommand(string.Format("xCommand Camera Ramp CameraId: {0} Zoom: Out ZoomSpeed: {1}", CameraId, ZoomSpeed)); - isZooming = true; - } - } - - public void ZoomStop() - { - ParentCodec.EnqueueCommand(string.Format("xCommand Camera Ramp CameraId: {0} Zoom: Stop", CameraId)); - isZooming = false; - } - - #endregion - - #region IHasCameraFocusControl Members - - public void FocusNear() - { - if (!isMoving) - { - ParentCodec.EnqueueCommand(string.Format("xCommand Camera Ramp CameraId: {0} Focus: Near", CameraId)); - isFocusing = true; - } - } - - public void FocusFar() - { - if (!isMoving) - { - ParentCodec.EnqueueCommand(string.Format("xCommand Camera Ramp CameraId: {0} Focus: Far", CameraId)); - isFocusing = true; - } - } - - public void FocusStop() - { - ParentCodec.EnqueueCommand(string.Format("xCommand Camera Ramp CameraId: {0} Focus: Stop", CameraId)); - isFocusing = false; - } - - public void TriggerAutoFocus() - { - ParentCodec.EnqueueCommand(string.Format("xCommand Camera TriggerAutofocus CameraId: {0}", CameraId)); - } - - #endregion - - public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - LinkCameraToApi(this, trilist, joinStart, joinMapKey, bridge); - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/CiscoCodecJoinMap.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/CiscoCodecJoinMap.cs deleted file mode 100644 index 2396afdc..00000000 --- a/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/CiscoCodecJoinMap.cs +++ /dev/null @@ -1,205 +0,0 @@ -using System; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Bridges.JoinMaps; - - -namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco -{ - public class CiscoCodecJoinMap : VideoCodecControllerJoinMap - { - #region Digital - - [JoinName("PresentationLocalOnly")] - public JoinDataComplete PresentationLocalOnly = new JoinDataComplete( - new JoinData - { - JoinNumber = 205, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Presentation Local Only Feedback", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("PresentationLocalRemote")] - public JoinDataComplete PresentationLocalRemote = new JoinDataComplete( - new JoinData - { - JoinNumber = 206, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Presentation Local and Remote Feedback", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("ActivateDoNotDisturbMode")] - public JoinDataComplete ActivateDoNotDisturbMode = new JoinDataComplete( - new JoinData - { - JoinNumber = 241, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Activates Do Not Disturb Mode. FB High if active.", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("DeactivateDoNotDisturbMode")] - public JoinDataComplete DeactivateDoNotDisturbMode = new JoinDataComplete( - new JoinData - { - JoinNumber = 242, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Deactivates Do Not Disturb Mode. FB High if deactivated.", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("ToggleDoNotDisturbMode")] - public JoinDataComplete ToggleDoNotDisturbMode = new JoinDataComplete( - new JoinData - { - JoinNumber = 243, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Toggles Do Not Disturb Mode.", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("ActivateStandby")] - public JoinDataComplete ActivateStandby = new JoinDataComplete( - new JoinData - { - JoinNumber = 246, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Activates Standby Mode. FB High if active.", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("DeactivateStandby")] - public JoinDataComplete DeactivateStandby = new JoinDataComplete( - new JoinData - { - JoinNumber = 247, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Deactivates Standby Mode. FB High if deactivated.", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("ActivateHalfWakeMode")] - public JoinDataComplete ActivateHalfWakeMode = new JoinDataComplete( - new JoinData - { - JoinNumber = 248, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Activates Half Wake Mode. FB High if active.", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("EnteringStandbyMode")] - public JoinDataComplete EnteringStandbyMode = new JoinDataComplete( - new JoinData - { - JoinNumber = 249, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "High to indicate that the codec is entering standby mode", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - #endregion - - - #region Analog - - [JoinName("RingtoneVolume")] - public JoinDataComplete RingtoneVolume = new JoinDataComplete( - new JoinData - { - JoinNumber = 21, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Ringtone volume set/FB. Valid values are 0 - 100 in increments of 5 (5, 10, 15, 20, etc.)", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Analog - }); - - [JoinName("PresentationSource")] - public JoinDataComplete PresentationSource = new JoinDataComplete( - new JoinData - { - JoinNumber = 201, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Presentation set/FB. Valid values are 0 - 6 depending on the codec model.", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Analog - }); - - - #endregion - - - #region Serials - - [JoinName("CommandToDevice")] - public JoinDataComplete CommandToDevice = new JoinDataComplete( - new JoinData - { - JoinNumber = 5, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Sends a serial command to the device. Do not include the delimiter, it will be added automatically.", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Serial - }); - - - - #endregion - - public CiscoCodecJoinMap(uint joinStart) - : base(joinStart, typeof(CiscoCodecJoinMap)) - { - } - - public CiscoCodecJoinMap(uint joinStart, Type type) - : base(joinStart, type) - { - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs deleted file mode 100644 index 1eccf076..00000000 --- a/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs +++ /dev/null @@ -1,2615 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.CrestronThread; -using Crestron.SimplSharpPro.DeviceSupport; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; - -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Core.DeviceTypeInterfaces; -using PepperDash.Essentials.Core.Routing; -using PepperDash.Essentials.Devices.Common.Cameras; -using PepperDash.Essentials.Devices.Common.Codec; -using PepperDash.Essentials.Devices.Common.VideoCodec; -using PepperDash.Essentials.Core.Queues; - -namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco -{ - enum eCommandType { SessionStart, SessionEnd, Command, GetStatus, GetConfiguration }; - public enum eExternalSourceType {camera, desktop, document_camera, mediaplayer, PC, whiteboard, other} - public enum eExternalSourceMode {Ready, NotReady, Hidden, Error} - - public class CiscoSparkCodec : VideoCodecBase, IHasCallHistory, IHasCallFavorites, IHasDirectory, - IHasScheduleAwareness, IOccupancyStatusProvider, IHasCodecLayouts, IHasCodecSelfView, - ICommunicationMonitor, IRouting, IHasCodecCameras, IHasCameraAutoMode, IHasCodecRoomPresets, - IHasExternalSourceSwitching, IHasBranding, IHasCameraOff, IHasCameraMute, IHasDoNotDisturbMode, - IHasHalfWakeMode, IHasCallHold, IJoinCalls - { - private CiscoSparkCodecPropertiesConfig _config; - - private bool _externalSourceChangeRequested; - - public event EventHandler DirectoryResultReturned; - - private CTimer _brandingTimer; - - public CommunicationGather PortGather { get; private set; } - - public StatusMonitorBase CommunicationMonitor { get; private set; } - - private GenericQueue _receiveQueue; - - public BoolFeedback PresentationViewMaximizedFeedback { get; private set; } - - private string _currentPresentationView; - - public BoolFeedback RoomIsOccupiedFeedback { get; private set; } - - public IntFeedback PeopleCountFeedback { get; private set; } - - public BoolFeedback CameraAutoModeIsOnFeedback { get; private set; } - - public BoolFeedback SelfviewIsOnFeedback { get; private set; } - - public StringFeedback SelfviewPipPositionFeedback { get; private set; } - - public StringFeedback LocalLayoutFeedback { get; private set; } - - public BoolFeedback LocalLayoutIsProminentFeedback { get; private set; } - - public BoolFeedback FarEndIsSharingContentFeedback { get; private set; } - - public IntFeedback RingtoneVolumeFeedback { get; private set; } - - private CodecCommandWithLabel _currentSelfviewPipPosition; - - private CodecCommandWithLabel _currentLocalLayout; - - /// - /// List the available positions for the selfview PIP window - /// - public List SelfviewPipPositions = new List() - { - new CodecCommandWithLabel("CenterLeft", "Center Left"), - new CodecCommandWithLabel("CenterRight", "Center Right"), - new CodecCommandWithLabel("LowerLeft", "Lower Left"), - new CodecCommandWithLabel("LowerRight", "Lower Right"), - new CodecCommandWithLabel("UpperCenter", "Upper Center"), - new CodecCommandWithLabel("UpperLeft", "Upper Left"), - new CodecCommandWithLabel("UpperRight", "Upper Right"), - }; - - /// - /// Lists the available options for local layout - /// - public List LocalLayouts = new List() - { - //new CodecCommandWithLabel("auto", "Auto"), - //new CiscoCodecLocalLayout("custom", "Custom"), // Left out for now - new CodecCommandWithLabel("equal","Equal"), - new CodecCommandWithLabel("overlay","Overlay"), - new CodecCommandWithLabel("prominent","Prominent"), - new CodecCommandWithLabel("single","Single") - }; - - private CiscoCodecConfiguration.RootObject CodecConfiguration = new CiscoCodecConfiguration.RootObject(); - - private CiscoCodecStatus.RootObject CodecStatus = new CiscoCodecStatus.RootObject(); - - public CodecCallHistory CallHistory { get; private set; } - - public CodecCallFavorites CallFavorites { get; private set; } - - /// - /// The root level of the directory - /// - public CodecDirectory DirectoryRoot { get; private set; } - - /// - /// Represents the current state of the directory and is computed on get - /// - public CodecDirectory CurrentDirectoryResult - { - get - { - if (DirectoryBrowseHistory.Count > 0) - return DirectoryBrowseHistory[DirectoryBrowseHistory.Count - 1]; - else - return DirectoryRoot; - } - } - - public BoolFeedback CurrentDirectoryResultIsNotDirectoryRoot { get; private set; } - - /// - /// Tracks the directory browse history when browsing beyond the root directory - /// - public List DirectoryBrowseHistory { get; private set; } - - public CodecScheduleAwareness CodecSchedule { get; private set; } - - /// - /// Gets and returns the scaled volume of the codec - /// - protected override Func VolumeLevelFeedbackFunc - { - get - { - return () => CrestronEnvironment.ScaleWithLimits(CodecStatus.Status.Audio.Volume.IntValue, 100, 0, 65535, 0); - } - } - - protected override Func PrivacyModeIsOnFeedbackFunc - { - get - { - return () => CodecStatus.Status.Audio.Microphones.Mute.BoolValue; - } - } - - protected override Func StandbyIsOnFeedbackFunc - { - get - { - return () => CodecStatus.Status.Standby.State.BoolValue; - } - } - - /// - /// Gets the value of the currently shared source, or returns null - /// - protected override Func SharingSourceFeedbackFunc - { - get - { - return () => _presentationSourceKey; - } - } - - protected override Func SharingContentIsOnFeedbackFunc - { - get - { - return () => CodecStatus.Status.Conference.Presentation.Mode.BoolValue; - } - } - - protected Func FarEndIsSharingContentFeedbackFunc - { - get - { - return () => CodecStatus.Status.Conference.Presentation.Mode.Value == "Receiving"; - } - } - - protected override Func MuteFeedbackFunc - { - get - { - return () => CodecStatus.Status.Audio.VolumeMute.BoolValue; - } - } - - protected Func RoomIsOccupiedFeedbackFunc - { - get - { - return () => CodecStatus.Status.RoomAnalytics.PeoplePresence.BoolValue; - } - } - - protected Func PeopleCountFeedbackFunc - { - get - { - return () => CodecStatus.Status.RoomAnalytics.PeopleCount.Current.IntValue; - } - } - - protected Func SpeakerTrackIsOnFeedbackFunc - { - get - { - return () => CodecStatus.Status.Cameras.SpeakerTrack.Status.BoolValue; - } - } - - protected Func SelfViewIsOnFeedbackFunc - { - get - { - return () => CodecStatus.Status.Video.Selfview.Mode.BoolValue; - } - } - - protected Func SelfviewPipPositionFeedbackFunc - { - get - { - return () => _currentSelfviewPipPosition.Label; - } - } - - protected Func LocalLayoutFeedbackFunc - { - get - { - return () => _currentLocalLayout.Label; - } - } - - protected Func LocalLayoutIsProminentFeedbackFunc - { - get - { - return () => _currentLocalLayout.Label == "Prominent"; - } - } - - - private string _cliFeedbackRegistrationExpression; - - private CodecSyncState _syncState; - - public CodecPhonebookSyncState PhonebookSyncState { get; private set; } - - private StringBuilder _jsonMessage; - - private bool _jsonFeedbackMessageIsIncoming; - - public bool CommDebuggingIsOn; - - string Delimiter = "\r\n"; - - public IntFeedback PresentationSourceFeedback { get; private set; } - - public BoolFeedback PresentationSendingLocalOnlyFeedback { get; private set; } - - public BoolFeedback PresentationSendingLocalRemoteFeedback { get; private set; } - - /// - /// Used to track the current connector used for the presentation source - /// - private int _presentationSource; - - /// - /// Used to track the connector that is desired to be the current presentation source (until the command is send) - /// - private int _desiredPresentationSource; - - private string _presentationSourceKey; - - private bool _presentationLocalOnly; - - private bool _presentationLocalRemote; - - private string _phonebookMode = "Local"; // Default to Local - - private uint _phonebookResultsLimit = 255; // Could be set later by config. - - private CTimer _loginMessageReceivedTimer; - private CTimer _retryConnectionTimer; - - // **___________________________________________________________________** - // Timers to be moved to the global system timer at a later point.... - private CTimer BookingsRefreshTimer; - private CTimer PhonebookRefreshTimer; - // **___________________________________________________________________** - - public RoutingInputPort CodecOsdIn { get; private set; } - public RoutingInputPort HdmiIn2 { get; private set; } - public RoutingInputPort HdmiIn3 { get; private set; } - public RoutingOutputPort HdmiOut1 { get; private set; } - public RoutingOutputPort HdmiOut2 { get; private set; } - - - // Constructor for IBasicCommunication - public CiscoSparkCodec(DeviceConfig config, IBasicCommunication comm) - : base(config) - { - var props = JsonConvert.DeserializeObject(config.Properties.ToString()); - - _config = props; - - // Use the configured phonebook results limit if present - if (props.PhonebookResultsLimit > 0) - { - _phonebookResultsLimit = props.PhonebookResultsLimit; - } - - // The queue that will collect the repsonses in the order they are received - _receiveQueue = new GenericQueue(this.Key + "-rxQueue", 25); - - RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc); - PeopleCountFeedback = new IntFeedback(PeopleCountFeedbackFunc); - CameraAutoModeIsOnFeedback = new BoolFeedback(SpeakerTrackIsOnFeedbackFunc); - SelfviewIsOnFeedback = new BoolFeedback(SelfViewIsOnFeedbackFunc); - SelfviewPipPositionFeedback = new StringFeedback(SelfviewPipPositionFeedbackFunc); - LocalLayoutFeedback = new StringFeedback(LocalLayoutFeedbackFunc); - LocalLayoutIsProminentFeedback = new BoolFeedback(LocalLayoutIsProminentFeedbackFunc); - FarEndIsSharingContentFeedback = new BoolFeedback(FarEndIsSharingContentFeedbackFunc); - CameraIsOffFeedback = new BoolFeedback(() => CodecStatus.Status.Video.Input.MainVideoMute.BoolValue); - CameraIsMutedFeedback = CameraIsOffFeedback; - SupportsCameraOff = true; - - DoNotDisturbModeIsOnFeedback = new BoolFeedback(() => CodecStatus.Status.Conference.DoNotDisturb.BoolValue); - HalfWakeModeIsOnFeedback = new BoolFeedback(() => CodecStatus.Status.Standby.State.Value.ToLower() == "halfwake"); - EnteringStandbyModeFeedback = new BoolFeedback(() => CodecStatus.Status.Standby.State.Value.ToLower() == "enteringstandby"); - - PresentationViewMaximizedFeedback = new BoolFeedback(() => _currentPresentationView == "Maximized"); - - RingtoneVolumeFeedback = new IntFeedback(() => CodecConfiguration.Configuration.Audio.SoundsAndAlerts.RingVolume.Volume); - - PresentationSourceFeedback = new IntFeedback(() => _presentationSource); - PresentationSendingLocalOnlyFeedback = new BoolFeedback(() => _presentationLocalOnly); - PresentationSendingLocalRemoteFeedback = new BoolFeedback(() => _presentationLocalRemote); - - Communication = comm; - - if (props.CommunicationMonitorProperties != null) - { - CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, props.CommunicationMonitorProperties); - } - else - { - var command = string.Format("xCommand Peripherals HeartBeat ID: {0}{1}", CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_MAC_ADDRESS, Delimiter); - CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, 30000, 120000, 300000, command); - } - - if (props.Sharing != null) - AutoShareContentWhileInCall = props.Sharing.AutoShareContentWhileInCall; - - ShowSelfViewByDefault = props.ShowSelfViewByDefault; - - DeviceManager.AddDevice(CommunicationMonitor); - - _phonebookMode = props.PhonebookMode; - - _syncState = new CodecSyncState(Key + "--Sync", this); - - PhonebookSyncState = new CodecPhonebookSyncState(Key + "--PhonebookSync"); - - _syncState.InitialSyncCompleted += new EventHandler(SyncState_InitialSyncCompleted); - - PortGather = new CommunicationGather(Communication, Delimiter); - PortGather.IncludeDelimiter = true; - PortGather.LineReceived += this.Port_LineReceived; - - CodecInfo = new CiscoCodecInfo(CodecStatus, CodecConfiguration); - - CallHistory = new CodecCallHistory(); - - - if (props.Favorites != null) - { - CallFavorites = new CodecCallFavorites(); - CallFavorites.Favorites = props.Favorites; - } - - DirectoryRoot = new CodecDirectory(); - - DirectoryBrowseHistory = new List(); - - CurrentDirectoryResultIsNotDirectoryRoot = new BoolFeedback(() => DirectoryBrowseHistory.Count > 0); - - CurrentDirectoryResultIsNotDirectoryRoot.FireUpdate(); - - CodecSchedule = new CodecScheduleAwareness(); - - //Set Feedback Actions - SetFeedbackActions(); - - CodecOsdIn = new RoutingInputPort(RoutingPortNames.CodecOsd, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, new Action(StopSharing), this); - HdmiIn2 = new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, new Action(SelectPresentationSource1), this); - HdmiIn3 = new RoutingInputPort(RoutingPortNames.HdmiIn3, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, new Action(SelectPresentationSource2), this); - - HdmiOut1 = new RoutingOutputPort(RoutingPortNames.HdmiOut1, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, null, this); - HdmiOut2 = new RoutingOutputPort(RoutingPortNames.HdmiOut2, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, null, this); - - InputPorts.Add(CodecOsdIn); - InputPorts.Add(HdmiIn2); - InputPorts.Add(HdmiIn3); - OutputPorts.Add(HdmiOut1); - CreateOsdSource(); - - ExternalSourceListEnabled = props.ExternalSourceListEnabled; - ExternalSourceInputPort = props.ExternalSourceInputPort; - - if (props.UiBranding == null) - { - return; - } - Debug.Console(2, this, "Setting branding properties enable: {0} _brandingUrl {1}", props.UiBranding.Enable, - props.UiBranding.BrandingUrl); - - BrandingEnabled = props.UiBranding.Enable; - - _brandingUrl = props.UiBranding.BrandingUrl; - } - - private void SetFeedbackActions() - { - CodecStatus.Status.Audio.Volume.ValueChangedAction = VolumeLevelFeedback.FireUpdate; - CodecStatus.Status.Audio.VolumeMute.ValueChangedAction = MuteFeedback.FireUpdate; - CodecStatus.Status.Audio.Microphones.Mute.ValueChangedAction = PrivacyModeIsOnFeedback.FireUpdate; - CodecStatus.Status.Standby.State.ValueChangedAction = new Action(() => - { - StandbyIsOnFeedback.FireUpdate(); - HalfWakeModeIsOnFeedback.FireUpdate(); - EnteringStandbyModeFeedback.FireUpdate(); - }); - CodecStatus.Status.RoomAnalytics.PeoplePresence.ValueChangedAction = RoomIsOccupiedFeedback.FireUpdate; - CodecStatus.Status.RoomAnalytics.PeopleCount.Current.ValueChangedAction = PeopleCountFeedback.FireUpdate; - CodecStatus.Status.Cameras.SpeakerTrack.Status.ValueChangedAction = CameraAutoModeIsOnFeedback.FireUpdate; - CodecStatus.Status.Cameras.SpeakerTrack.Availability.ValueChangedAction = () => { SupportsCameraAutoMode = CodecStatus.Status.Cameras.SpeakerTrack.Availability.BoolValue; }; - CodecStatus.Status.Video.Selfview.Mode.ValueChangedAction = SelfviewIsOnFeedback.FireUpdate; - CodecStatus.Status.Video.Selfview.PIPPosition.ValueChangedAction = ComputeSelfviewPipStatus; - CodecStatus.Status.Video.Layout.LayoutFamily.Local.ValueChangedAction = ComputeLocalLayout; - CodecStatus.Status.Conference.Presentation.Mode.ValueChangedAction = () => - { - SharingContentIsOnFeedback.FireUpdate(); - FarEndIsSharingContentFeedback.FireUpdate(); - }; - CodecStatus.Status.Conference.DoNotDisturb.ValueChangedAction = DoNotDisturbModeIsOnFeedback.FireUpdate; - - CodecConfiguration.Configuration.Audio.SoundsAndAlerts.RingVolume.ValueChangedAction = RingtoneVolumeFeedback.FireUpdate; - - try - { - CodecStatus.Status.Video.Input.MainVideoMute.ValueChangedAction = CameraIsOffFeedback.FireUpdate; - } - catch (Exception ex) - { - Debug.Console(0, this, "Error setting MainVideuMute Action: {0}", ex); - - if (ex.InnerException != null) - { - Debug.Console(0, this, "Error setting MainVideuMute Action: {0}", ex); - } - } - } - - /// - /// Creates the fake OSD source, and connects it's AudioVideo output to the CodecOsdIn input - /// to enable routing - /// - void CreateOsdSource() - { - OsdSource = new DummyRoutingInputsDevice(Key + "[osd]"); - DeviceManager.AddDevice(OsdSource); - var tl = new TieLine(OsdSource.AudioVideoOutputPort, CodecOsdIn); - TieLineCollection.Default.Add(tl); - } - - public void InitializeBranding(string roomKey) - { - Debug.Console(1, this, "Initializing Branding for room {0}", roomKey); - - if (!BrandingEnabled) - { - return; - } - - var mcBridgeKey = String.Format("mobileControlBridge-{0}", roomKey); - - var mcBridge = DeviceManager.GetDeviceForKey(mcBridgeKey) as IMobileControlRoomBridge; - - if (!String.IsNullOrEmpty(_brandingUrl)) - { - Debug.Console(1, this, "Branding URL found: {0}", _brandingUrl); - if (_brandingTimer != null) - { - _brandingTimer.Stop(); - _brandingTimer.Dispose(); - } - - _brandingTimer = new CTimer((o) => - { - if (_sendMcUrl) - { - SendMcBrandingUrl(mcBridge); - _sendMcUrl = false; - } - else - { - SendBrandingUrl(); - _sendMcUrl = true; - } - }, 0, 15000); - } else if (String.IsNullOrEmpty(_brandingUrl)) - { - Debug.Console(1, this, "No Branding URL found"); - if (mcBridge == null) return; - - Debug.Console(2, this, "Setting QR code URL: {0}", mcBridge.QrCodeUrl); - - mcBridge.UserCodeChanged += (o, a) => SendMcBrandingUrl(mcBridge); - mcBridge.UserPromptedForCode += (o, a) => DisplayUserCode(mcBridge.UserCode); - - SendMcBrandingUrl(mcBridge); - } - } - - /// - /// Displays the code for the specified duration - /// - /// Mobile Control user code - private void DisplayUserCode(string code) - { - EnqueueCommand(string.Format("xcommand userinterface message alert display title:\"Mobile Control User Code:\" text:\"{0}\" duration: 30", code)); - } - - private void SendMcBrandingUrl(IMobileControlRoomBridge mcBridge) - { - if (mcBridge == null) - { - return; - } - - Debug.Console(1, this, "Sending url: {0}", mcBridge.QrCodeUrl); - - EnqueueCommand("xconfiguration userinterface custommessage: \"Scan the QR code with a mobile phone to get started\""); - EnqueueCommand("xconfiguration userinterface osd halfwakemessage: \"Tap the touch panel or scan the QR code with a mobile phone to get started\""); - - var checksum = !String.IsNullOrEmpty(mcBridge.QrCodeChecksum) - ? String.Format("checksum: {0} ", mcBridge.QrCodeChecksum) - : String.Empty; - - EnqueueCommand(String.Format( - "xcommand userinterface branding fetch {1}type: branding url: {0}", - mcBridge.QrCodeUrl, checksum)); - EnqueueCommand(String.Format( - "xcommand userinterface branding fetch {1}type: halfwakebranding url: {0}", - mcBridge.QrCodeUrl, checksum)); - } - - private void SendBrandingUrl() - { - Debug.Console(1, this, "Sending url: {0}", _brandingUrl); - - EnqueueCommand(String.Format("xcommand userinterface branding fetch type: branding url: {0}", - _brandingUrl)); - EnqueueCommand(String.Format("xcommand userinterface branding fetch type: halfwakebranding url: {0}", - _brandingUrl)); - } - /// - /// Starts the HTTP feedback server and syncronizes state of codec - /// - /// - public override bool CustomActivate() - { - CrestronConsole.AddNewConsoleCommand(SetCommDebug, "SetCodecCommDebug", "0 for Off, 1 for on", ConsoleAccessLevelEnum.AccessOperator); - CrestronConsole.AddNewConsoleCommand(GetPhonebook, "GetCodecPhonebook", "Triggers a refresh of the codec phonebook", ConsoleAccessLevelEnum.AccessOperator); - CrestronConsole.AddNewConsoleCommand(GetBookings, "GetCodecBookings", "Triggers a refresh of the booking data for today", ConsoleAccessLevelEnum.AccessOperator); - - PhonebookSyncState.InitialSyncCompleted += new EventHandler(PhonebookSyncState_InitialSyncCompleted); - - return base.CustomActivate(); - } - - void PhonebookSyncState_InitialSyncCompleted(object sender, EventArgs e) - { - OnDirectoryResultReturned(DirectoryRoot); - } - - #region Overrides of Device - - public override void Initialize() - { - var socket = Communication as ISocketStatus; - if (socket != null) - { - socket.ConnectionChange += new EventHandler(socket_ConnectionChange); - } - - Communication.Connect(); - - CommunicationMonitor.Start(); - - const string prefix = "xFeedback register "; - - _cliFeedbackRegistrationExpression = - prefix + "/Configuration" + Delimiter + - prefix + "/Status/Audio" + Delimiter + - prefix + "/Status/Call" + Delimiter + - prefix + "/Status/Conference/Presentation" + Delimiter + - prefix + "/Status/Conference/DoNotDisturb" + Delimiter + - prefix + "/Status/Cameras/SpeakerTrack" + Delimiter + - prefix + "/Status/RoomAnalytics" + Delimiter + - prefix + "/Status/RoomPreset" + Delimiter + - prefix + "/Status/Standby" + Delimiter + - prefix + "/Status/Video/Selfview" + Delimiter + - prefix + "/Status/Video/Layout" + Delimiter + - prefix + "/Status/Video/Input/MainVideoMute" + Delimiter + - prefix + "/Bookings" + Delimiter + - prefix + "/Event/Bookings" + Delimiter + - prefix + "/Event/CameraPresetListUpdated" + Delimiter + - prefix + "/Event/UserInterface/Presentation/ExternalSource/Selected/SourceIdentifier" + Delimiter + - prefix + "/Event/CallDisconnect" + Delimiter; // Keep CallDisconnect last to detect when feedback registration completes correctly - - } - - #endregion - - /// - /// Fires when initial codec sync is completed. Used to then send commands to get call history, phonebook, bookings, etc. - /// - /// - /// - void SyncState_InitialSyncCompleted(object sender, EventArgs e) - { - // Check for camera config info first - if (_config.CameraInfo.Count > 0) - { - Debug.Console(0, this, "Reading codec cameraInfo from config properties."); - SetUpCameras(_config.CameraInfo); - } - else - { - Debug.Console(0, this, "No cameraInfo defined in video codec config. Attempting to get camera info from codec status data"); - try - { - var cameraInfo = new List(); - - Debug.Console(0, this, "Codec reports {0} cameras", CodecStatus.Status.Cameras.Camera.Count); - - foreach (var camera in CodecStatus.Status.Cameras.Camera) - { - Debug.Console(0, this, -@"Camera id: {0} -Name: {1} -ConnectorID: {2}" -, camera.id -, camera.Manufacturer.Value -, camera.Model.Value); - - var id = Convert.ToUInt16(camera.id); - var info = new CameraInfo() { CameraNumber = id, Name = string.Format("{0} {1}", camera.Manufacturer.Value, camera.Model.Value), SourceId = camera.DetectedConnector.ConnectorId }; - cameraInfo.Add(info); - } - - Debug.Console(0, this, "Successfully got cameraInfo for {0} cameras from codec.", cameraInfo.Count); - - SetUpCameras(cameraInfo); - } - catch (Exception ex) - { - Debug.Console(2, this, "Error generating camera info from codec status data: {0}", ex); - } - } - - //CommDebuggingIsOn = false; - - GetCallHistory(); - - PhonebookRefreshTimer = new CTimer(CheckCurrentHour, 3600000, 3600000); // check each hour to see if the phonebook should be downloaded - GetPhonebook(null); - - BookingsRefreshTimer = new CTimer(GetBookings, 900000, 900000); // 15 minute timer to check for new booking info - GetBookings(null); - - // Fire the ready event - SetIsReady(); - } - - public void SetCommDebug(string s) - { - if (s == "1") - { - CommDebuggingIsOn = true; - Debug.Console(0, this, "Comm Debug Enabled."); - } - else - { - CommDebuggingIsOn = false; - Debug.Console(0, this, "Comm Debug Disabled."); - } - } - - void socket_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e) - { - Debug.Console(1, this, "Socket status change {0}", e.Client.ClientStatus); - if (e.Client.IsConnected) - { - if(!_syncState.LoginMessageWasReceived) - _loginMessageReceivedTimer = new CTimer(o => DisconnectClientAndReconnect(), 5000); - } - else - { - _syncState.CodecDisconnected(); - PhonebookSyncState.CodecDisconnected(); - - if (PhonebookRefreshTimer != null) - { - PhonebookRefreshTimer.Stop(); - PhonebookRefreshTimer = null; - } - - if (BookingsRefreshTimer != null) - { - BookingsRefreshTimer.Stop(); - BookingsRefreshTimer = null; - } - } - } - - void DisconnectClientAndReconnect() - { - Debug.Console(1, this, "Retrying connection to codec."); - - Communication.Disconnect(); - - _retryConnectionTimer = new CTimer(o => Communication.Connect(), 2000); - - //CrestronEnvironment.Sleep(2000); - - //Communication.Connect(); - } - - /// - /// Gathers responses from the codec (including the delimiter. Responses are checked to see if they contain JSON data and if so, the data is collected until a complete JSON - /// message is received before forwarding the message to be deserialized. - /// - /// - /// - void Port_LineReceived(object dev, GenericCommMethodReceiveTextArgs args) - { - if (CommDebuggingIsOn) - { - if (!_jsonFeedbackMessageIsIncoming) - Debug.Console(1, this, "RX: '{0}'", ComTextHelper.GetDebugText(args.Text)); - } - - if(args.Text.ToLower().Contains("xcommand")) - { - Debug.Console(1, this, "Received command echo response. Ignoring"); - return; - } - - if (args.Text == "{" + Delimiter) // Check for the beginning of a new JSON message - { - _jsonFeedbackMessageIsIncoming = true; - - if (CommDebuggingIsOn) - Debug.Console(1, this, "Incoming JSON message..."); - - _jsonMessage = new StringBuilder(); - } - else if (args.Text == "}" + Delimiter) // Check for the end of a JSON message - { - _jsonFeedbackMessageIsIncoming = false; - - _jsonMessage.Append(args.Text); - - if (CommDebuggingIsOn) - Debug.Console(1, this, "Complete JSON Received:\n{0}", _jsonMessage.ToString()); - - // Enqueue the complete message to be deserialized - - _receiveQueue.Enqueue(new ProcessStringMessage(_jsonMessage.ToString(), DeserializeResponse)); - - return; - } - - if(_jsonFeedbackMessageIsIncoming) - { - _jsonMessage.Append(args.Text); - - //Debug.Console(1, this, "Building JSON:\n{0}", JsonMessage.ToString()); - return; - } - - if (!_syncState.InitialSyncComplete) - { - switch (args.Text.Trim().ToLower()) // remove the whitespace - { - case "*r login successful": - { - _syncState.LoginMessageReceived(); - - if(_loginMessageReceivedTimer != null) - _loginMessageReceivedTimer.Stop(); - - //SendText("echo off"); - SendText("xPreferences outputmode json"); - break; - } - case "xpreferences outputmode json": - { - if (_syncState.JsonResponseModeSet) - return; - - _syncState.JsonResponseModeMessageReceived(); - - if (!_syncState.InitialStatusMessageWasReceived) - SendText("xStatus"); - break; - } - case "xfeedback register /event/calldisconnect": - { - _syncState.FeedbackRegistered(); - break; - } - } - } - } - - /// - /// Enqueues a command to be sent to the codec. - /// - /// - public void EnqueueCommand(string command) - { - _syncState.AddCommandToQueue(command); - } - - /// - /// Appends the delimiter and send the command to the codec. - /// Should not be used for sending general commands to the codec. Use EnqueueCommand instead. - /// Should be used to get initial Status and Configuration as well as set up Feedback Registration - /// - /// - public void SendText(string command) - { - if (CommDebuggingIsOn) - Debug.Console(1, this, "Sending: '{0}'", ComTextHelper.GetDebugText(command + Delimiter)); - - Communication.SendText(command + Delimiter); - } - - void DeserializeResponse(string response) - { - try - { - //// Serializer settings. We want to ignore null values and missing members - //JsonSerializerSettings settings = new JsonSerializerSettings(); - //settings.NullValueHandling = NullValueHandling.Ignore; - //settings.MissingMemberHandling = MissingMemberHandling.Ignore; - //settings.ObjectCreationHandling = ObjectCreationHandling.Auto; - - if (response.IndexOf("\"Status\":{") > -1 || response.IndexOf("\"Status\": {") > -1) - { - // Status Message - - // Temp object so we can inpsect for call data before simply deserializing - CiscoCodecStatus.RootObject tempCodecStatus = new CiscoCodecStatus.RootObject(); - - JsonConvert.PopulateObject(response, tempCodecStatus); - - // Check to see if the message contains /Status/Conference/Presentation/LocalInstance and extract source value - var conference = tempCodecStatus.Status.Conference; - - if (conference.Presentation != null && conference.Presentation.LocalInstance == null) - { - // Handles an empty presentation object response - return; - } - - if (conference.Presentation.LocalInstance.Count > 0) - { - if (!string.IsNullOrEmpty(conference.Presentation.LocalInstance[0].ghost)) - { - _presentationSource = 0; - _presentationLocalOnly = false; - _presentationLocalRemote = false; - } - else if (conference.Presentation.LocalInstance[0].Source != null) - { - _presentationSource = conference.Presentation.LocalInstance[0].Source.IntValue; - - // Check for any values in the SendingMode property - if (conference.Presentation.LocalInstance.Any((i) => !string.IsNullOrEmpty(i.SendingMode.Value))) - { - _presentationLocalOnly = conference.Presentation.LocalInstance.Any((i) => i.SendingMode.LocalOnly); - _presentationLocalRemote = conference.Presentation.LocalInstance.Any((i) => i.SendingMode.LocalRemote); - } - } - - PresentationSourceFeedback.FireUpdate(); - PresentationSendingLocalOnlyFeedback.FireUpdate(); - PresentationSendingLocalRemoteFeedback.FireUpdate(); - } - - // Check to see if this is a call status message received after the initial status message - if (tempCodecStatus.Status.Call.Count > 0) - { - // Iterate through the call objects in the response - foreach (CiscoCodecStatus.Call call in tempCodecStatus.Status.Call) - { - var tempActiveCall = ActiveCalls.FirstOrDefault(c => c.Id.Equals(call.id)); - - if (tempActiveCall != null) - { - bool changeDetected = false; - - eCodecCallStatus newStatus = eCodecCallStatus.Unknown; - - // Update properties of ActiveCallItem - if(call.Status != null) - if (!string.IsNullOrEmpty(call.Status.Value)) - { - tempActiveCall.Status = CodecCallStatus.ConvertToStatusEnum(call.Status.Value); - tempActiveCall.IsOnHold = tempActiveCall.Status == eCodecCallStatus.OnHold; - - if (newStatus == eCodecCallStatus.Connected) - GetCallHistory(); - - changeDetected = true; - } - if (call.CallType != null) - if (!string.IsNullOrEmpty(call.CallType.Value)) - { - tempActiveCall.Type = CodecCallType.ConvertToTypeEnum(call.CallType.Value); - changeDetected = true; - } - if (call.DisplayName != null) - if (!string.IsNullOrEmpty(call.DisplayName.Value)) - { - tempActiveCall.Name = call.DisplayName.Value; - changeDetected = true; - } - if (call.Direction != null) - { - if (!string.IsNullOrEmpty(call.Direction.Value)) - { - tempActiveCall.Direction = CodecCallDirection.ConvertToDirectionEnum(call.Direction.Value); - changeDetected = true; - } - } - if(call.Duration != null) - { - if(!string.IsNullOrEmpty(call.Duration.Value)) - { - tempActiveCall.Duration = call.Duration.DurationValue; - changeDetected = true; - } - } - if(call.PlacedOnHold != null) - { - tempActiveCall.IsOnHold = call.PlacedOnHold.BoolValue; - changeDetected = true; - } - - if (changeDetected) - { - SetSelfViewMode(); - OnCallStatusChange(tempActiveCall); - ListCalls(); - } - } - else if( call.ghost == null ) // if the ghost value is present the call has ended already - { - // Create a new call item - var newCallItem = new CodecActiveCallItem() - { - Id = call.id, - Status = CodecCallStatus.ConvertToStatusEnum(call.Status.Value), - Name = call.DisplayName.Value, - Number = call.RemoteNumber.Value, - Type = CodecCallType.ConvertToTypeEnum(call.CallType.Value), - Direction = CodecCallDirection.ConvertToDirectionEnum(call.Direction.Value), - Duration = call.Duration.DurationValue, - IsOnHold = call.PlacedOnHold.BoolValue, - }; - - // Add it to the ActiveCalls List - ActiveCalls.Add(newCallItem); - - ListCalls(); - - SetSelfViewMode(); - OnCallStatusChange(newCallItem); - } - - } - - } - - // Check for Room Preset data (comes in partial, so we need to handle these responses differently to prevent appending duplicate items - var tempPresets = tempCodecStatus.Status.RoomPreset; - - if (tempPresets.Count > 0) - { - // Create temporary list to store the existing items from the CiscoCodecStatus.RoomPreset collection - var existingRoomPresets = new List(); - // Add the existing items to the temporary list - existingRoomPresets.AddRange(CodecStatus.Status.RoomPreset); - // Populate the CodecStatus object (this will append new values to the RoomPreset collection - JsonConvert.PopulateObject(response, CodecStatus); - - var jResponse = JObject.Parse(response); - - - IList roomPresets = jResponse["Status"]["RoomPreset"].Children().ToList(); - // Iterate the new items in this response agains the temporary list. Overwrite any existing items and add new ones. - foreach (var camPreset in tempPresets) - { - var preset = camPreset as CiscoCodecStatus.RoomPreset; - if (preset == null) continue; - // First fine the existing preset that matches the id - var existingPreset = existingRoomPresets.FirstOrDefault(p => p.id.Equals(preset.id)); - if (existingPreset != null) - { - Debug.Console(1, this, "Existing Room Preset with ID: {0} found. Updating.", existingPreset.id); - - JToken updatedPreset = null; - - // Find the JToken from the response with the matching id - foreach (var jPreset in roomPresets) - { - if (jPreset["id"].Value() == existingPreset.id) - updatedPreset = jPreset; - } - - if (updatedPreset != null) - { - // use PopulateObject to overlay the partial data onto the existing object - JsonConvert.PopulateObject(updatedPreset.ToString(), existingPreset); - } - - } - else - { - Debug.Console(1, this, "New Room Preset with ID: {0}. Adding.", preset.id); - existingRoomPresets.Add(preset); - } - } - - // Replace the list in the CodecStatus object with the processed list - CodecStatus.Status.RoomPreset = existingRoomPresets; - - // Generecise the list - NearEndPresets = existingRoomPresets.GetGenericPresets(); - - var handler = CodecRoomPresetsListHasChanged; - if (handler != null) - { - handler(this, new EventArgs()); - } - } - else - { - JsonConvert.PopulateObject(response, CodecStatus); - } - - if (!_syncState.InitialStatusMessageWasReceived) - { - _syncState.InitialStatusMessageReceived(); - - if (!_syncState.InitialConfigurationMessageWasReceived) - { - SendText("xConfiguration"); - } - } - } - else if (response.IndexOf("\"Configuration\":{") > -1 || response.IndexOf("\"Configuration\": {") > -1) - { - // Configuration Message - - JsonConvert.PopulateObject(response, CodecConfiguration); - - if (!_syncState.InitialConfigurationMessageWasReceived) - { - _syncState.InitialConfigurationMessageReceived(); - if (!_syncState.FeedbackWasRegistered) - { - SendText(_cliFeedbackRegistrationExpression); - } - } - - } - else if (response.IndexOf("\"Event\":{") > -1 || response.IndexOf("\"Event\": {") > -1) - { - if (response.IndexOf("\"CallDisconnect\":{") > -1 || response.IndexOf("\"CallDisconnect\": {") > -1) - { - CiscoCodecEvents.RootObject eventReceived = new CiscoCodecEvents.RootObject(); - - JsonConvert.PopulateObject(response, eventReceived); - - EvalutateDisconnectEvent(eventReceived); - } - else if (response.IndexOf("\"Bookings\":{") > -1 || response.IndexOf("\"Bookings\": {") > -1) // The list has changed, reload it - { - GetBookings(null); - } - - else if (response.IndexOf("\"UserInterface\":{") > -1 || response.IndexOf("\"UserInterface\": {") > -1) // External Source Trigger - { - CiscoCodecEvents.RootObject eventReceived = new CiscoCodecEvents.RootObject(); - JsonConvert.PopulateObject(response, eventReceived); - Debug.Console(2, this, "*** Got an External Source Selection {0} {1}", eventReceived, eventReceived.Event.UserInterface, eventReceived.Event.UserInterface.Presentation.ExternalSource.Selected.SourceIdentifier.Value); - - if (RunRouteAction != null && !_externalSourceChangeRequested) - { - RunRouteAction(eventReceived.Event.UserInterface.Presentation.ExternalSource.Selected.SourceIdentifier.Value, null); - } - - _externalSourceChangeRequested = false; - } - } - else if (response.IndexOf("\"CommandResponse\":{") > -1 || response.IndexOf("\"CommandResponse\": {") > -1) - { - // CommandResponse Message - - if (response.IndexOf("\"CallHistoryRecentsResult\":{") > -1 || response.IndexOf("\"CallHistoryRecentsResult\": {") > -1) - { - var codecCallHistory = new CiscoCallHistory.RootObject(); - - JsonConvert.PopulateObject(response, codecCallHistory); - - CallHistory.ConvertCiscoCallHistoryToGeneric(codecCallHistory.CommandResponse.CallHistoryRecentsResult.Entry); - } - else if (response.IndexOf("\"CallHistoryDeleteEntryResult\":{") > -1 || response.IndexOf("\"CallHistoryDeleteEntryResult\": {") > -1) - { - GetCallHistory(); - } - else if (response.IndexOf("\"PhonebookSearchResult\":{") > -1 || response.IndexOf("\"PhonebookSearchResult\": {") > -1) - { - var codecPhonebookResponse = new CiscoCodecPhonebook.RootObject(); - - JsonConvert.PopulateObject(response, codecPhonebookResponse); - - if (!PhonebookSyncState.InitialPhonebookFoldersWasReceived) - { - // Check if the phonebook has any folders - PhonebookSyncState.InitialPhonebookFoldersReceived(); - - PhonebookSyncState.SetPhonebookHasFolders(codecPhonebookResponse.CommandResponse.PhonebookSearchResult.Folder.Count > 0); - - if (PhonebookSyncState.PhonebookHasFolders) - { - DirectoryRoot.AddFoldersToDirectory(CiscoCodecPhonebook.GetRootFoldersFromSearchResult(codecPhonebookResponse.CommandResponse.PhonebookSearchResult)); - } - - // Get the number of contacts in the phonebook - GetPhonebookContacts(); - } - else if (!PhonebookSyncState.NumberOfContactsWasReceived) - { - // Store the total number of contacts in the phonebook - PhonebookSyncState.SetNumberOfContacts(Int32.Parse(codecPhonebookResponse.CommandResponse.PhonebookSearchResult.ResultInfo.TotalRows.Value)); - - DirectoryRoot.AddContactsToDirectory(CiscoCodecPhonebook.GetRootContactsFromSearchResult(codecPhonebookResponse.CommandResponse.PhonebookSearchResult)); - - PhonebookSyncState.PhonebookRootEntriesReceived(); - - PrintDirectory(DirectoryRoot); - } - else if (PhonebookSyncState.InitialSyncComplete) - { - var directoryResults = new CodecDirectory(); - - if(codecPhonebookResponse.CommandResponse.PhonebookSearchResult.ResultInfo.TotalRows.Value != "0") - directoryResults = CiscoCodecPhonebook.ConvertCiscoPhonebookToGeneric(codecPhonebookResponse.CommandResponse.PhonebookSearchResult); - - PrintDirectory(directoryResults); - - DirectoryBrowseHistory.Add(directoryResults); - - OnDirectoryResultReturned(directoryResults); - - } - } - else if (response.IndexOf("\"BookingsListResult\":{") > -1) - { - var codecBookings = new CiscoCodecBookings.RootObject(); - - JsonConvert.PopulateObject(response, codecBookings); - - if(codecBookings.CommandResponse.BookingsListResult.ResultInfo.TotalRows.Value != "0") - CodecSchedule.Meetings = CiscoCodecBookings.GetGenericMeetingsFromBookingResult(codecBookings.CommandResponse.BookingsListResult.Booking); - - BookingsRefreshTimer.Reset(900000, 900000); - } - - } - - } - catch (Exception ex) - { - Debug.Console(1, this, "Error Deserializing feedback from codec: {0}", ex); - - if (ex is Newtonsoft.Json.JsonReaderException) - { - Debug.Console(1, this, "Received malformed response from codec."); - - //Communication.Disconnect(); - - //Initialize(); - } - - } - } - - /// - /// Call when directory results are updated - /// - /// - void OnDirectoryResultReturned(CodecDirectory result) - { - CurrentDirectoryResultIsNotDirectoryRoot.FireUpdate(); - - // This will return the latest results to all UIs. Multiple indendent UI Directory browsing will require a different methodology - var handler = DirectoryResultReturned; - if (handler != null) - { - Debug.Console(2, this, "Directory result returned"); - handler(this, new DirectoryEventArgs() - { - Directory = result, - DirectoryIsOnRoot = !CurrentDirectoryResultIsNotDirectoryRoot.BoolValue - }); - } - - PrintDirectory(result); - } - - /// - /// Evaluates an event received from the codec - /// - /// - void EvalutateDisconnectEvent(CiscoCodecEvents.RootObject eventReceived) - { - if (eventReceived.Event.CallDisconnect != null) - { - var tempActiveCall = ActiveCalls.FirstOrDefault(c => c.Id.Equals(eventReceived.Event.CallDisconnect.CallId.Value)); - - // Remove the call from the Active calls list - if (tempActiveCall != null) - { - ActiveCalls.Remove(tempActiveCall); - - ListCalls(); - - SetSelfViewMode(); - // Notify of the call disconnection - SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Disconnected, tempActiveCall); - - GetCallHistory(); - } - } - } - - /// - /// - /// - /// - public override void ExecuteSwitch(object selector) - { - (selector as Action)(); - _presentationSourceKey = selector.ToString(); - } - - /// - /// This is necessary for devices that are "routers" in the middle of the path, even though it only has one output and - /// may only have one input. - /// - public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType) - { - ExecuteSwitch(inputSelector); - _presentationSourceKey = inputSelector.ToString(); - } - - - /// - /// Gets the ID of the last connected call - /// - /// - public string GetCallId() - { - string callId = null; - - if (ActiveCalls.Count > 1) - { - var lastCallIndex = ActiveCalls.Count - 1; - callId = ActiveCalls[lastCallIndex].Id; - } - else if (ActiveCalls.Count == 1) - callId = ActiveCalls[0].Id; - - return callId; - - } - - public void GetCallHistory() - { - EnqueueCommand("xCommand CallHistory Recents Limit: 20 Order: OccurrenceTime"); - } - - /// - /// Required for IHasScheduleAwareness - /// - public void GetSchedule() - { - GetBookings(null); - } - - /// - /// Gets the bookings for today - /// - /// - public void GetBookings(object command) - { - Debug.Console(1, this, "Retrieving Booking Info from Codec. Current Time: {0}", DateTime.Now.ToLocalTime()); - - EnqueueCommand("xCommand Bookings List Days: 1 DayOffset: 0"); - } - - /// - /// Checks to see if it is 2am (or within that hour) and triggers a download of the phonebook - /// - /// - public void CheckCurrentHour(object o) - { - if (DateTime.Now.Hour == 2) - { - Debug.Console(1, this, "Checking hour to see if phonebook should be downloaded. Current hour is {0}", DateTime.Now.Hour); - - GetPhonebook(null); - PhonebookRefreshTimer.Reset(3600000, 3600000); - } - } - - /// - /// Triggers a refresh of the codec phonebook - /// - /// Just to allow this method to be called from a console command - public void GetPhonebook(string command) - { - PhonebookSyncState.CodecDisconnected(); - - DirectoryRoot = new CodecDirectory(); - - GetPhonebookFolders(); - } - - private void GetPhonebookFolders() - { - // Get Phonebook Folders (determine local/corporate from config, and set results limit) - EnqueueCommand(string.Format("xCommand Phonebook Search PhonebookType: {0} ContactType: Folder", _phonebookMode)); - } - - private void GetPhonebookContacts() - { - // Get Phonebook Folders (determine local/corporate from config, and set results limit) - EnqueueCommand(string.Format("xCommand Phonebook Search PhonebookType: {0} ContactType: Contact Limit: {1}", _phonebookMode, _phonebookResultsLimit)); - } - - /// - /// Searches the codec phonebook for all contacts matching the search string - /// - /// - public void SearchDirectory(string searchString) - { - EnqueueCommand(string.Format("xCommand Phonebook Search SearchString: \"{0}\" PhonebookType: {1} ContactType: Contact Limit: {2}", searchString, _phonebookMode, _phonebookResultsLimit)); - } - - /// - /// // Get contents of a specific folder in the phonebook - /// - /// - public void GetDirectoryFolderContents(string folderId) - { - EnqueueCommand(string.Format("xCommand Phonebook Search FolderId: {0} PhonebookType: {1} ContactType: Any Limit: {2}", folderId, _phonebookMode, _phonebookResultsLimit)); - } - - /// - /// Sets the parent folder contents or the directory root as teh current directory and fires the event. Used to browse up a level - /// - /// - public void GetDirectoryParentFolderContents() - { - var currentDirectory = new CodecDirectory(); - - if (DirectoryBrowseHistory.Count > 0) - { - var lastItemIndex = DirectoryBrowseHistory.Count - 1; - var parentDirectoryContents = DirectoryBrowseHistory[lastItemIndex]; - - DirectoryBrowseHistory.Remove(DirectoryBrowseHistory[lastItemIndex]); - - currentDirectory = parentDirectoryContents; - - } - else - { - currentDirectory = DirectoryRoot; - } - - OnDirectoryResultReturned(currentDirectory); - } - - /// - /// Clears the session browse history and fires the event with the directory root - /// - public void SetCurrentDirectoryToRoot() - { - DirectoryBrowseHistory.Clear(); - - OnDirectoryResultReturned(DirectoryRoot); - } - - /// - /// Prints the directory to console - /// - /// - void PrintDirectory(CodecDirectory directory) - { - if (Debug.Level > 0) - { - Debug.Console(1, this, "Directory Results:\n"); - - foreach (DirectoryItem item in directory.CurrentDirectoryResults) - { - if (item is DirectoryFolder) - { - Debug.Console(1, this, "[+] {0}", item.Name); - } - else if (item is DirectoryContact) - { - Debug.Console(1, this, "{0}", item.Name); - } - } - Debug.Console(1, this, "Directory is on Root Level: {0}", !CurrentDirectoryResultIsNotDirectoryRoot.BoolValue); - } - - } - - /// - /// Simple dial method - /// - /// - public override void Dial(string number) - { - EnqueueCommand(string.Format("xCommand Dial Number: \"{0}\"", number)); - } - - /// - /// Dials a specific meeting - /// - /// - public override void Dial(Meeting meeting) - { - foreach (Call c in meeting.Calls) - { - Dial(c.Number, c.Protocol, c.CallRate, c.CallType, meeting.Id); - } - } - - /// - /// Detailed dial method - /// - /// - /// - /// - /// - /// - public void Dial(string number, string protocol, string callRate, string callType, string meetingId) - { - EnqueueCommand(string.Format("xCommand Dial Number: \"{0}\" Protocol: {1} CallRate: {2} CallType: {3} BookingId: {4}", number, protocol, callRate, callType, meetingId)); - } - - - public override void EndCall(CodecActiveCallItem activeCall) - { - EnqueueCommand(string.Format("xCommand Call Disconnect CallId: {0}", activeCall.Id)); - } - - public override void EndAllCalls() - { - foreach (CodecActiveCallItem activeCall in ActiveCalls) - { - EnqueueCommand(string.Format("xCommand Call Disconnect CallId: {0}", activeCall.Id)); - } - } - - public override void AcceptCall(CodecActiveCallItem item) - { - EnqueueCommand("xCommand Call Accept"); - } - - public override void RejectCall(CodecActiveCallItem item) - { - EnqueueCommand("xCommand Call Reject"); - } - - #region IHasCallHold Members - - public void HoldCall(CodecActiveCallItem activeCall) - { - EnqueueCommand(string.Format("xCommand Call Hold CallId: {0}", activeCall.Id)); - } - - public void ResumeCall(CodecActiveCallItem activeCall) - { - EnqueueCommand(string.Format("xCommand Call Resume CallId: {0}", activeCall.Id)); - } - - #endregion - - #region IJoinCalls - - public void JoinCall(CodecActiveCallItem activeCall) - { - EnqueueCommand(string.Format("xCommand Call Join CallId: {0}", activeCall.Id)); - } - - public void JoinAllCalls() - { - StringBuilder ids = new StringBuilder(); - - foreach (var call in ActiveCalls) - { - if (call.IsActiveCall) - { - ids.Append(string.Format(" CallId: {0}", call.Id)); - } - } - - if (ids.Length > 0) - { - EnqueueCommand(string.Format("xCommand Call Join {0}", ids.ToString())); - } - } - - #endregion - - /// - /// Sends tones to the last connected call - /// - /// - public override void SendDtmf(string s) - { - EnqueueCommand(string.Format("xCommand Call DTMFSend CallId: {0} DTMFString: \"{1}\"", GetCallId(), s)); - } - - /// - /// Sends tones to a specific call - /// - /// - /// - public override void SendDtmf(string s, CodecActiveCallItem activeCall) - { - EnqueueCommand(string.Format("xCommand Call DTMFSend CallId: {0} DTMFString: \"{1}\"", activeCall.Id, s)); - } - - public void SelectPresentationSource(int source) - { - _desiredPresentationSource = source; - - StartSharing(); - } - - /// - /// Sets the ringtone volume level - /// - /// level from 0 - 100 in increments of 5 - public void SetRingtoneVolume(int volume) - { - if (volume < 0 || volume > 100) - { - Debug.Console(0, this, "Cannot set ringtone volume to '{0}'. Value must be between 0 - 100", volume); - return; - } - - if (volume % 5 != 0) - { - Debug.Console(0, this, "Cannot set ringtone volume to '{0}'. Value must be between 0 - 100 and a multiple of 5", volume); - return; - } - - EnqueueCommand(string.Format("xConfiguration Audio SoundsAndAlerts RingVolume: {0}", volume)); - } - - /// - /// Select source 1 as the presetnation source - /// - public void SelectPresentationSource1() - { - SelectPresentationSource(2); - } - - /// - /// Select source 2 as the presetnation source - /// - public void SelectPresentationSource2() - { - SelectPresentationSource(3); - } - - - - /// - /// Starts presentation sharing - /// - public override void StartSharing() - { - string sendingMode = string.Empty; - - if (IsInCall) - sendingMode = "LocalRemote"; - else - sendingMode = "LocalOnly"; - - if (_desiredPresentationSource > 0) - EnqueueCommand(string.Format("xCommand Presentation Start PresentationSource: {0} SendingMode: {1}", _desiredPresentationSource, sendingMode)); - } - - /// - /// Stops sharing the current presentation - /// - public override void StopSharing() - { - _desiredPresentationSource = 0; - - EnqueueCommand("xCommand Presentation Stop"); - } - - - - public override void PrivacyModeOn() - { - EnqueueCommand("xCommand Audio Microphones Mute"); - } - - public override void PrivacyModeOff() - { - EnqueueCommand("xCommand Audio Microphones Unmute"); - } - - public override void PrivacyModeToggle() - { - EnqueueCommand("xCommand Audio Microphones ToggleMute"); - } - - public override void MuteOff() - { - EnqueueCommand("xCommand Audio Volume Unmute"); - } - - public override void MuteOn() - { - EnqueueCommand("xCommand Audio Volume Mute"); - } - - public override void MuteToggle() - { - EnqueueCommand("xCommand Audio Volume ToggleMute"); - } - - /// - /// Increments the voluem - /// - /// - public override void VolumeUp(bool pressRelease) - { - EnqueueCommand("xCommand Audio Volume Increase"); - } - - /// - /// Decrements the volume - /// - /// - public override void VolumeDown(bool pressRelease) - { - EnqueueCommand("xCommand Audio Volume Decrease"); - } - - /// - /// Scales the level and sets the codec to the specified level within its range - /// - /// level from slider (0-65535 range) - public override void SetVolume(ushort level) - { - var scaledLevel = CrestronEnvironment.ScaleWithLimits(level, 65535, 0, 100, 0); - EnqueueCommand(string.Format("xCommand Audio Volume Set Level: {0}", scaledLevel)); - } - - /// - /// Recalls the default volume on the codec - /// - public void VolumeSetToDefault() - { - EnqueueCommand("xCommand Audio Volume SetToDefault"); - } - - /// - /// Puts the codec in standby mode - /// - public override void StandbyActivate() - { - EnqueueCommand("xCommand Standby Activate"); - } - - /// - /// Wakes the codec from standby - /// - public override void StandbyDeactivate() - { - EnqueueCommand("xCommand Standby Deactivate"); - } - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new CiscoCodecJoinMap(joinStart); - - var customJoins = JoinMapHelper.TryGetJoinMapAdvancedForDevice(joinMapKey); - - if (customJoins != null) - { - joinMap.SetCustomJoinData(customJoins); - } - - if (bridge != null) - { - bridge.AddJoinMap(Key, joinMap); - } - - LinkVideoCodecToApi(this, trilist, joinStart, joinMapKey, bridge); - - LinkCiscoCodecToApi(trilist, joinMap); - } - - public void LinkCiscoCodecToApi(BasicTriList trilist, CiscoCodecJoinMap joinMap) - { - // Custom commands to codec - trilist.SetStringSigAction(joinMap.CommandToDevice.JoinNumber, (s) => this.EnqueueCommand(s)); - - - var dndCodec = this as IHasDoNotDisturbMode; - if (dndCodec != null) - { - dndCodec.DoNotDisturbModeIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.ActivateDoNotDisturbMode.JoinNumber]); - dndCodec.DoNotDisturbModeIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.DeactivateDoNotDisturbMode.JoinNumber]); - - trilist.SetSigFalseAction(joinMap.ActivateDoNotDisturbMode.JoinNumber, () => dndCodec.ActivateDoNotDisturbMode()); - trilist.SetSigFalseAction(joinMap.DeactivateDoNotDisturbMode.JoinNumber, () => dndCodec.DeactivateDoNotDisturbMode()); - trilist.SetSigFalseAction(joinMap.ToggleDoNotDisturbMode.JoinNumber, () => dndCodec.ToggleDoNotDisturbMode()); - } - - var halfwakeCodec = this as IHasHalfWakeMode; - if (halfwakeCodec != null) - { - halfwakeCodec.StandbyIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.ActivateStandby.JoinNumber]); - halfwakeCodec.StandbyIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.DeactivateStandby.JoinNumber]); - halfwakeCodec.HalfWakeModeIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.ActivateHalfWakeMode.JoinNumber]); - halfwakeCodec.EnteringStandbyModeFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnteringStandbyMode.JoinNumber]); - - trilist.SetSigFalseAction(joinMap.ActivateStandby.JoinNumber, () => halfwakeCodec.StandbyActivate()); - trilist.SetSigFalseAction(joinMap.DeactivateStandby.JoinNumber, () => halfwakeCodec.StandbyDeactivate()); - trilist.SetSigFalseAction(joinMap.ActivateHalfWakeMode.JoinNumber, () => halfwakeCodec.HalfwakeActivate()); - } - - // Ringtone volume - trilist.SetUShortSigAction(joinMap.RingtoneVolume.JoinNumber, (u) => SetRingtoneVolume(u)); - RingtoneVolumeFeedback.LinkInputSig(trilist.UShortInput[joinMap.RingtoneVolume.JoinNumber]); - - // Presentation Source - trilist.SetUShortSigAction(joinMap.PresentationSource.JoinNumber, (u) => SelectPresentationSource(u)); - PresentationSourceFeedback.LinkInputSig(trilist.UShortInput[joinMap.PresentationSource.JoinNumber]); - - PresentationSendingLocalOnlyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PresentationLocalOnly.JoinNumber]); - PresentationSendingLocalRemoteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PresentationLocalRemote.JoinNumber]); - } - - /// - /// Reboots the codec - /// - public void Reboot() - { - EnqueueCommand("xCommand SystemUnit Boot Action: Restart"); - } - - /// - /// Sets SelfView Mode based on config - /// - void SetSelfViewMode() - { - if (!IsInCall) - { - SelfViewModeOff(); - } - else - { - if (ShowSelfViewByDefault) - SelfViewModeOn(); - else - SelfViewModeOff(); - } - } - - /// - /// Turns on Selfview Mode - /// - public void SelfViewModeOn() - { - EnqueueCommand("xCommand Video Selfview Set Mode: On"); - } - - /// - /// Turns off Selfview Mode - /// - public void SelfViewModeOff() - { - EnqueueCommand("xCommand Video Selfview Set Mode: Off"); - } - - /// - /// Toggles Selfview mode on/off - /// - public void SelfViewModeToggle() - { - string mode = string.Empty; - - if (CodecStatus.Status.Video.Selfview.Mode.BoolValue) - mode = "Off"; - else - mode = "On"; - - EnqueueCommand(string.Format("xCommand Video Selfview Set Mode: {0}", mode)); - } - - /// - /// Sets a specified position for the selfview PIP window - /// - /// - public void SelfviewPipPositionSet(CodecCommandWithLabel position) - { - EnqueueCommand(string.Format("xCommand Video Selfview Set Mode: On PIPPosition: {0}", position.Command)); - } - - /// - /// Toggles to the next selfview PIP position - /// - public void SelfviewPipPositionToggle() - { - if (_currentSelfviewPipPosition != null) - { - var nextPipPositionIndex = SelfviewPipPositions.IndexOf(_currentSelfviewPipPosition) + 1; - - if (nextPipPositionIndex >= SelfviewPipPositions.Count) // Check if we need to loop back to the first item in the list - nextPipPositionIndex = 0; - - SelfviewPipPositionSet(SelfviewPipPositions[nextPipPositionIndex]); - } - } - - /// - /// Sets a specific local layout - /// - /// - public void LocalLayoutSet(CodecCommandWithLabel layout) - { - EnqueueCommand(string.Format("xCommand Video Layout LayoutFamily Set Target: local LayoutFamily: {0}", layout.Command)); - } - - /// - /// Toggles to the next local layout - /// - public void LocalLayoutToggle() - { - if(_currentLocalLayout != null) - { - var nextLocalLayoutIndex = LocalLayouts.IndexOf(_currentLocalLayout) + 1; - - if (nextLocalLayoutIndex >= LocalLayouts.Count) // Check if we need to loop back to the first item in the list - nextLocalLayoutIndex = 0; - - LocalLayoutSet(LocalLayouts[nextLocalLayoutIndex]); - } - } - - /// - /// Toggles between single/prominent layouts - /// - public void LocalLayoutToggleSingleProminent() - { - if (_currentLocalLayout != null) - { - if (_currentLocalLayout.Label != "Prominent") - LocalLayoutSet(LocalLayouts.FirstOrDefault(l => l.Label.Equals("Prominent"))); - else - LocalLayoutSet(LocalLayouts.FirstOrDefault(l => l.Label.Equals("Single"))); - } - - } - - /// - /// - /// - public void MinMaxLayoutToggle() - { - if (PresentationViewMaximizedFeedback.BoolValue) - _currentPresentationView = "Minimized"; - else - _currentPresentationView = "Maximized"; - - EnqueueCommand(string.Format("xCommand Video PresentationView Set View: {0}", _currentPresentationView)); - PresentationViewMaximizedFeedback.FireUpdate(); - } - - /// - /// Calculates the current selfview PIP position - /// - void ComputeSelfviewPipStatus() - { - _currentSelfviewPipPosition = SelfviewPipPositions.FirstOrDefault(p => p.Command.ToLower().Equals(CodecStatus.Status.Video.Selfview.PIPPosition.Value.ToLower())); - - if(_currentSelfviewPipPosition != null) - SelfviewIsOnFeedback.FireUpdate(); - } - - /// - /// Calculates the current local Layout - /// - void ComputeLocalLayout() - { - _currentLocalLayout = LocalLayouts.FirstOrDefault(l => l.Command.ToLower().Equals(CodecStatus.Status.Video.Layout.LayoutFamily.Local.Value.ToLower())); - - if (_currentLocalLayout != null) - LocalLayoutFeedback.FireUpdate(); - } - - public void RemoveCallHistoryEntry(CodecCallHistory.CallHistoryEntry entry) - { - EnqueueCommand(string.Format("xCommand CallHistory DeleteEntry CallHistoryId: {0} AcknowledgeConsecutiveDuplicates: True", entry.OccurrenceHistoryId)); - } - - #region IHasCameraSpeakerTrack - - public void CameraAutoModeToggle() - { - if (!CameraAutoModeIsOnFeedback.BoolValue) - { - EnqueueCommand("xCommand Cameras SpeakerTrack Activate"); - } - else - { - EnqueueCommand("xCommand Cameras SpeakerTrack Deactivate"); - } - } - - public void CameraAutoModeOn() - { - if (CameraIsOffFeedback.BoolValue) - { - CameraMuteOff(); - } - - EnqueueCommand("xCommand Cameras SpeakerTrack Activate"); - } - - public void CameraAutoModeOff() - { - if (CameraIsOffFeedback.BoolValue) - { - CameraMuteOff(); - } - - EnqueueCommand("xCommand Cameras SpeakerTrack Deactivate"); - } - - #endregion - - /// - /// Builds the cameras List. Could later be modified to build from config data - /// - void SetUpCameras(List cameraInfo) - { - // Add the internal camera - Cameras = new List(); - - var camCount = CodecStatus.Status.Cameras.Camera.Count; - - // Deal with the case of 1 or no reported cameras - if (camCount <= 1) - { - var internalCamera = new CiscoSparkCamera(Key + "-camera1", "Near End", this, 1); - - if (camCount > 0) - { - // Try to get the capabilities from the codec - if (CodecStatus.Status.Cameras.Camera[0] != null && CodecStatus.Status.Cameras.Camera[0].Capabilities != null) - { - internalCamera.SetCapabilites(CodecStatus.Status.Cameras.Camera[0].Capabilities.Options.Value); - } - } - - Cameras.Add(internalCamera); - //DeviceManager.AddDevice(internalCamera); - } - else - { - // Setup all the cameras - for (int i = 0; i < camCount; i++) - { - var cam = CodecStatus.Status.Cameras.Camera[i]; - - var id = (uint)i; - var name = string.Format("Camera {0}", id); - - // Check for a config object that matches the camera number - var camInfo = cameraInfo.FirstOrDefault(c => c.CameraNumber == i + 1); - if (camInfo != null) - { - id = (uint)camInfo.SourceId; - name = camInfo.Name; - } - - var key = string.Format("{0}-camera{1}", Key, id); - var camera = new CiscoSparkCamera(key, name, this, id); - - if (cam.Capabilities != null) - { - camera.SetCapabilites(cam.Capabilities.Options.Value); - } - - Cameras.Add(camera); - } - } - - // Add the far end camera - var farEndCamera = new CiscoFarEndCamera(Key + "-cameraFar", "Far End", this); - Cameras.Add(farEndCamera); - - SelectedCameraFeedback = new StringFeedback(() => SelectedCamera.Key); - - ControllingFarEndCameraFeedback = new BoolFeedback(() => SelectedCamera is IAmFarEndCamera); - - NearEndPresets = new List(15); - - FarEndRoomPresets = new List(15); - - // Add the far end presets - for (int i = 1; i <= FarEndRoomPresets.Capacity; i++) - { - var label = string.Format("Far End Preset {0}", i); - FarEndRoomPresets.Add(new CodecRoomPreset(i, label, true, false)); - } - - SelectedCamera = Cameras[0]; ; // call the method to select the camera and ensure the feedbacks get updated. - - } - - #region IHasCodecCameras Members - - public event EventHandler CameraSelected; - - public List Cameras { get; private set; } - - public StringFeedback SelectedCameraFeedback { get; private set; } - - private CameraBase _selectedCamera; - - /// - /// Returns the selected camera - /// - public CameraBase SelectedCamera - { - get - { - return _selectedCamera; - } - private set - { - _selectedCamera = value; - SelectedCameraFeedback.FireUpdate(); - ControllingFarEndCameraFeedback.FireUpdate(); - if (CameraIsOffFeedback.BoolValue) - CameraMuteOff(); - - var handler = CameraSelected; - if (handler != null) - { - handler(this, new CameraSelectedEventArgs(SelectedCamera)); - } - } - } - - public void SelectCamera(string key) - { - var camera = Cameras.FirstOrDefault(c => c.Key.IndexOf(key, StringComparison.OrdinalIgnoreCase) > -1); - if (camera != null) - { - Debug.Console(2, this, "Selected Camera with key: '{0}'", camera.Key); - SelectedCamera = camera; - } - else - Debug.Console(2, this, "Unable to select camera with key: '{0}'", key); - - var ciscoCam = camera as CiscoSparkCamera; - if (ciscoCam != null) - { - EnqueueCommand(string.Format("xCommand Video Input SetMainVideoSource SourceId: {0}", ciscoCam.CameraId)); - } - } - - public CameraBase FarEndCamera { get; private set; } - - public BoolFeedback ControllingFarEndCameraFeedback { get; private set; } - - #endregion - - /// - /// - /// - public class CiscoCodecInfo : VideoCodecInfo - { - public CiscoCodecStatus.RootObject CodecStatus { get; private set; } - - public CiscoCodecConfiguration.RootObject CodecConfiguration { get; private set; } - - public override bool MultiSiteOptionIsEnabled - { - get - { - if (!string.IsNullOrEmpty(CodecStatus.Status.SystemUnit.Software.OptionKeys.MultiSite.Value) && CodecStatus.Status.SystemUnit.Software.OptionKeys.MultiSite.Value.ToLower() == "true") - return true; - else - return false; - } - - } - public override string IpAddress - { - get - { - var address = string.Empty; - if (CodecConfiguration.Configuration.Network.Count > 0) - { - if(!string.IsNullOrEmpty(CodecConfiguration.Configuration.Network[0].IPv4.Address.Value)) - address = CodecConfiguration.Configuration.Network[0].IPv4.Address.Value; - } - - if (string.IsNullOrEmpty(address) && CodecStatus.Status.Network.Count > 0) - { - if(!string.IsNullOrEmpty(CodecStatus.Status.Network[0].IPv4.Address.Value)) - address = CodecStatus.Status.Network[0].IPv4.Address.Value; - } - return address; - } - } - public override string E164Alias - { - get - { - if (CodecConfiguration.Configuration.H323 != null && CodecConfiguration.Configuration.H323.H323Alias.E164 != null) - { - return CodecConfiguration.Configuration.H323.H323Alias.E164.Value; - } - else - { - return string.Empty; - } - } - } - public override string H323Id - { - get - { - if (CodecConfiguration.Configuration.H323 != null && CodecConfiguration.Configuration.H323.H323Alias != null - && CodecConfiguration.Configuration.H323.H323Alias.ID != null) - { - return CodecConfiguration.Configuration.H323.H323Alias.ID.Value; - } - else - { - return string.Empty; - } - } - } - public override string SipPhoneNumber - { - get - { - if (CodecStatus.Status.SIP != null && CodecStatus.Status.SIP.Registration.Count > 0) - { - var match = Regex.Match(CodecStatus.Status.SIP.Registration[0].URI.Value, @"(\d+)"); // extract numbers only - if (match.Success) - { - Debug.Console(1, "Extracted phone number as '{0}' from string '{1}'", match.Groups[1].Value, CodecStatus.Status.SIP.Registration[0].URI.Value); - return match.Groups[1].Value; - } - else - { - Debug.Console(1, "Unable to extract phone number from string: '{0}'", CodecStatus.Status.SIP.Registration[0].URI.Value); - return string.Empty; - } - } - else - { - Debug.Console(1, "Unable to extract phone number. No SIP Registration items found"); - return string.Empty; - } - } - } - - public override string SipUri - { - get - { - if (CodecStatus.Status.SIP != null && CodecStatus.Status.SIP.AlternateURI.Primary.URI.Value != null) - { - return CodecStatus.Status.SIP.AlternateURI.Primary.URI.Value; - } - else if (CodecStatus.Status.UserInterface != null && - CodecStatus.Status.UserInterface.ContactInfo.ContactMethod[0].Number.Value != null) - { - return CodecStatus.Status.UserInterface.ContactInfo.ContactMethod[0].Number.Value; - } - else - return string.Empty; - } - } - - public override bool AutoAnswerEnabled - { - get - { - if (CodecConfiguration.Configuration.Conference.AutoAnswer.Mode.Value == null) return false; - return CodecConfiguration.Configuration.Conference.AutoAnswer.Mode.Value.ToLower() == "on"; - } - } - - public CiscoCodecInfo(CiscoCodecStatus.RootObject status, CiscoCodecConfiguration.RootObject configuration) - { - CodecStatus = status; - CodecConfiguration = configuration; - } - } - - - #region IHasCameraPresets Members - - public event EventHandler CodecRoomPresetsListHasChanged; - - public List NearEndPresets { get; private set; } - - public List FarEndRoomPresets { get; private set; } - - public void CodecRoomPresetSelect(int preset) - { - Debug.Console(1, this, "Selecting Preset: {0}", preset); - if (SelectedCamera is IAmFarEndCamera) - SelectFarEndPreset(preset); - else - EnqueueCommand(string.Format("xCommand RoomPreset Activate PresetId: {0}", preset)); - } - - public void CodecRoomPresetStore(int preset, string description) - { - EnqueueCommand(string.Format("xCommand RoomPreset Store PresetId: {0} Description: \"{1}\" Type: All", preset, description)); - } - - #endregion - - public void SelectFarEndPreset(int preset) - { - EnqueueCommand(string.Format("xCommand Call FarEndControl RoomPreset Activate CallId: {0} PresetId: {1}", GetCallId(), preset)); - } - - - #region IHasExternalSourceSwitching Members - - /// - /// Wheather the Cisco supports External Source Lists or not - /// - public bool ExternalSourceListEnabled - { - get; - private set; - } - - /// - /// The name of the RoutingInputPort to which the upstream external switcher is connected - /// - public string ExternalSourceInputPort { get; private set; } - - public bool BrandingEnabled { get; private set; } - private string _brandingUrl; - private bool _sendMcUrl; - - /// - /// Adds an external source to the Cisco - /// - /// - /// - /// - public void AddExternalSource(string connectorId, string key, string name, eExternalSourceType type) - { - int id = 2; - if (connectorId.ToLower() == "hdmiin3") - { - id = 3; - } - EnqueueCommand(string.Format("xCommand UserInterface Presentation ExternalSource Add ConnectorId: {0} SourceIdentifier: \"{1}\" Name: \"{2}\" Type: {3}", id, key, name, type.ToString())); - // SendText(string.Format("xCommand UserInterface Presentation ExternalSource State Set SourceIdentifier: \"{0}\" State: Ready", key)); - Debug.Console(2, this, "Adding ExternalSource {0} {1}", connectorId, name); - - } - - - /// - /// Sets the state of the External Source - /// - /// - /// - public void SetExternalSourceState(string key, eExternalSourceMode mode) - { - EnqueueCommand(string.Format("xCommand UserInterface Presentation ExternalSource State Set SourceIdentifier: \"{0}\" State: {1}", key, mode.ToString())); - } - /// - /// Clears all external sources on the codec - /// - public void ClearExternalSources() - { - EnqueueCommand("xCommand UserInterface Presentation ExternalSource RemoveAll"); - - } - - /// - /// Sets the selected source of the available external sources on teh Touch10 UI - /// - public void SetSelectedSource(string key) - { - EnqueueCommand(string.Format("xCommand UserInterface Presentation ExternalSource Select SourceIdentifier: {0}", key)); - _externalSourceChangeRequested = true; - } - - /// - /// Action that will run when the External Source is selected. - /// - public Action RunRouteAction { private get; set; } - - - - - - - #endregion - #region ExternalDevices - - - - #endregion - - #region IHasCameraOff Members - - public BoolFeedback CameraIsOffFeedback { get; private set; } - - public void CameraOff() - { - CameraMuteOn(); - } - - #endregion - - public BoolFeedback CameraIsMutedFeedback { get; private set; } - - /// - /// Mutes the outgoing camera video - /// - public void CameraMuteOn() - { - EnqueueCommand("xCommand Video Input MainVideo Mute"); - } - - /// - /// Unmutes the outgoing camera video - /// - public void CameraMuteOff() - { - EnqueueCommand("xCommand Video Input MainVideo Unmute"); - } - - /// - /// Toggles the camera mute state - /// - public void CameraMuteToggle() - { - if (CameraIsMutedFeedback.BoolValue) - CameraMuteOff(); - else - CameraMuteOn(); - } - - #region IHasDoNotDisturbMode Members - - public BoolFeedback DoNotDisturbModeIsOnFeedback { get; private set; } - - public void ActivateDoNotDisturbMode() - { - EnqueueCommand("xCommand Conference DoNotDisturb Activate"); - } - - public void DeactivateDoNotDisturbMode() - { - EnqueueCommand("xCommand Conference DoNotDisturb Deactivate"); - } - - public void ToggleDoNotDisturbMode() - { - if (DoNotDisturbModeIsOnFeedback.BoolValue) - { - DeactivateDoNotDisturbMode(); - } - else - { - ActivateDoNotDisturbMode(); - } - } - - #endregion - - #region IHasHalfWakeMode Members - - public BoolFeedback HalfWakeModeIsOnFeedback { get; private set; } - - public BoolFeedback EnteringStandbyModeFeedback { get; private set; } - - public void HalfwakeActivate() - { - EnqueueCommand("xCommand Standby Halfwake"); - } - - #endregion - } - - - - /// - /// Tracks the initial sycnronization state of the codec when making a connection - /// - public class CodecSyncState : IKeyed - { - bool _InitialSyncComplete; - private readonly CiscoSparkCodec _parent; - - public event EventHandler InitialSyncCompleted; - private readonly CrestronQueue _commandQueue; - - public string Key { get; private set; } - - public bool InitialSyncComplete - { - get { return _InitialSyncComplete; } - private set - { - if (value == true) - { - var handler = InitialSyncCompleted; - if (handler != null) - handler(this, new EventArgs()); - } - _InitialSyncComplete = value; - } - } - - public bool LoginMessageWasReceived { get; private set; } - - public bool JsonResponseModeSet { get; private set; } - - public bool InitialStatusMessageWasReceived { get; private set; } - - public bool InitialConfigurationMessageWasReceived { get; private set; } - - public bool FeedbackWasRegistered { get; private set; } - - public CodecSyncState(string key, CiscoSparkCodec parent) - { - Key = key; - _parent = parent; - _commandQueue = new CrestronQueue(50); - CodecDisconnected(); - } - - private void ProcessQueuedCommands() - { - while (InitialSyncComplete) - { - var query = _commandQueue.Dequeue(); - - _parent.SendText(query); - } - } - - public void AddCommandToQueue(string query) - { - _commandQueue.Enqueue(query); - } - - public void LoginMessageReceived() - { - LoginMessageWasReceived = true; - Debug.Console(1, this, "Login Message Received."); - CheckSyncStatus(); - } - - public void JsonResponseModeMessageReceived() - { - JsonResponseModeSet = true; - Debug.Console(1, this, "Json Response Mode Message Received."); - CheckSyncStatus(); - } - - public void InitialStatusMessageReceived() - { - InitialStatusMessageWasReceived = true; - Debug.Console(1, this, "Initial Codec Status Message Received."); - CheckSyncStatus(); - } - - public void InitialConfigurationMessageReceived() - { - InitialConfigurationMessageWasReceived = true; - Debug.Console(1, this, "Initial Codec Configuration Message Received."); - CheckSyncStatus(); - } - - public void FeedbackRegistered() - { - FeedbackWasRegistered = true; - Debug.Console(1, this, "Initial Codec Feedback Registration Successful."); - CheckSyncStatus(); - } - - public void CodecDisconnected() - { - _commandQueue.Clear(); - LoginMessageWasReceived = false; - JsonResponseModeSet = false; - InitialConfigurationMessageWasReceived = false; - InitialStatusMessageWasReceived = false; - FeedbackWasRegistered = false; - InitialSyncComplete = false; - } - - void CheckSyncStatus() - { - if (LoginMessageWasReceived && JsonResponseModeSet && InitialConfigurationMessageWasReceived && InitialStatusMessageWasReceived && FeedbackWasRegistered) - { - InitialSyncComplete = true; - Debug.Console(1, this, "Initial Codec Sync Complete!"); - Debug.Console(1, this, "{0} Command queued. Processing now...", _commandQueue.Count); - - // Invoke a thread for the queue - CrestronInvoke.BeginInvoke((o) => { - ProcessQueuedCommands(); - }); - } - else - InitialSyncComplete = false; - } - } - - public class CiscoSparkCodecFactory : EssentialsDeviceFactory - { - public CiscoSparkCodecFactory() - { - TypeNames = new List() { "ciscospark", "ciscowebex", "ciscowebexpro", "ciscoroomkit", "ciscosparkpluscodec" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new Cisco Codec Device"); - - var comm = CommFactory.CreateCommForDevice(dc); - return new VideoCodec.Cisco.CiscoSparkCodec(dc, comm); - } - } - -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/CiscoSparkCodecPropertiesConfig.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/CiscoSparkCodecPropertiesConfig.cs deleted file mode 100644 index 38b81654..00000000 --- a/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/CiscoSparkCodecPropertiesConfig.cs +++ /dev/null @@ -1,91 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -using PepperDash.Core; -using PepperDash.Essentials.Core; - -using Full.Newtonsoft.Json; - -namespace PepperDash.Essentials.Devices.Common.Codec -{ - public class CiscoSparkCodecPropertiesConfig - { - [JsonProperty("communicationMonitorProperties")] - public CommunicationMonitorConfig CommunicationMonitorProperties { get; set; } - - [JsonProperty("favorites")] - public List Favorites { get; set; } - - /// - /// Valid values: "Local" or "Corporate" - /// - [JsonProperty("phonebookMode")] - public string PhonebookMode { get; set; } - - [JsonProperty("showSelfViewByDefault")] - public bool ShowSelfViewByDefault { get; set; } - - [JsonProperty("sharing")] - public SharingProperties Sharing { get; set; } - - /// - /// Enables external source switching capability - /// - [JsonProperty("externalSourceListEnabled")] - public bool ExternalSourceListEnabled { get; set; } - - /// - /// The name of the routing input port on the codec to which the external switch is connected - /// - [JsonProperty("externalSourceInputPort")] - public string ExternalSourceInputPort { get; set; } - - /// - /// Optionsal property to set the limit of any phonebook queries for directory or searching - /// - [JsonProperty("phonebookResultsLimit")] - public uint PhonebookResultsLimit { get; set; } - - [JsonProperty("UiBranding")] - public BrandingLogoProperties UiBranding { get; set; } - - [JsonProperty("cameraInfo")] - public List CameraInfo { get; set; } - - - public CiscoSparkCodecPropertiesConfig() - { - CameraInfo = new List(); - } - } - - public class SharingProperties - { - [JsonProperty("autoShareContentWhileInCall")] - public bool AutoShareContentWhileInCall { get; set; } - } - - public class BrandingLogoProperties - { - [JsonProperty("enable")] - public bool Enable { get; set; } - - [JsonProperty("brandingUrl")] - public string BrandingUrl { get; set; } - } - - /// - /// Describes configuration information for the near end cameras - /// - public class CameraInfo - { - public int CameraNumber { get; set; } - public string Name { get; set; } - public int SourceId { get; set; } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/HttpApiServer.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/HttpApiServer.cs deleted file mode 100644 index affe9c2f..00000000 --- a/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/HttpApiServer.cs +++ /dev/null @@ -1,106 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharp.Net.Http; - -using PepperDash.Core; - - -namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco -{ - public class HttpApiServer - { - public static Dictionary ExtensionContentTypes; - - public event EventHandler ApiRequest; - public Crestron.SimplSharp.Net.Http.HttpServer HttpServer { get; private set; } - - public string HtmlRoot { get; set; } - - - /// - /// SIMPL+ can only execute the default constructor. If you have variables that require initialization, please - /// use an Initialize method - /// - public HttpApiServer() - { - ExtensionContentTypes = new Dictionary - { - { ".css", "text/css" }, - { ".htm", "text/html" }, - { ".html", "text/html" }, - { ".jpg", "image/jpeg" }, - { ".jpeg", "image/jpeg" }, - { ".js", "application/javascript" }, - { ".json", "application/json" }, - { ".xml", "text/xml" }, - { ".map", "application/x-navimap" }, - { ".pdf", "application.pdf" }, - { ".png", "image/png" }, - { ".txt", "text/plain" }, - }; - HtmlRoot = @"\HTML"; - } - - - public void Start(int port) - { - // TEMP - this should be inserted by configuring class - - HttpServer = new Crestron.SimplSharp.Net.Http.HttpServer(); - HttpServer.ServerName = "Cisco API Server"; - HttpServer.KeepAlive = true; - HttpServer.Port = port; - HttpServer.OnHttpRequest += Server_Request; - HttpServer.Open(); - - CrestronEnvironment.ProgramStatusEventHandler += (a) => - { - if (a == eProgramStatusEventType.Stopping) - { - HttpServer.Close(); - Debug.Console(1, "Shutting down HTTP Server on port {0}", HttpServer.Port); - } - }; - } - - void Server_Request(object sender, OnHttpRequestArgs args) - { - if (args.Request.Header.RequestType == "OPTIONS") - { - Debug.Console(2, "Asking for OPTIONS"); - args.Response.Header.SetHeaderValue("Access-Control-Allow-Origin", "*"); - args.Response.Header.SetHeaderValue("Access-Control-Allow-Methods", "GET, POST, PATCH, PUT, DELETE, OPTIONS"); - return; - } - - string path = Uri.UnescapeDataString(args.Request.Path); - var host = args.Request.DataConnection.RemoteEndPointAddress; - //string authToken; - - Debug.Console(2, "HTTP Request: {2}: Path='{0}' ?'{1}'", path, args.Request.QueryString, host); - - // ----------------------------------- ADD AUTH HERE - if (path.StartsWith("/cisco/api")) - { - var handler = ApiRequest; - if (ApiRequest != null) - ApiRequest(this, args); - } - } - - public static string GetContentType(string extension) - { - string type; - if (ExtensionContentTypes.ContainsKey(extension)) - type = ExtensionContentTypes[extension]; - else - type = "text/plain"; - return type; - } - - } - -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/PhonebookDataClasses.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/PhonebookDataClasses.cs deleted file mode 100644 index c88261f5..00000000 --- a/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/PhonebookDataClasses.cs +++ /dev/null @@ -1,397 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -using PepperDash.Core; -using PepperDash.Essentials.Devices.Common.Codec; - -namespace PepperDash.Essentials.Devices.Common.VideoCodec -{ - public class CiscoCodecPhonebook - { - public class Offset - { - public string Value { get; set; } - } - - public class Limit - { - public string Value { get; set; } - } - - public class TotalRows - { - public string Value { get; set; } - } - - public class ResultInfo - { - public Offset Offset { get; set; } - public Limit Limit { get; set; } - public TotalRows TotalRows { get; set; } - } - - public class LocalId - { - public string Value { get; set; } - } - - public class FolderId - { - public string Value { get; set; } - } - - public class ParentFolderId - { - public string Value { get; set; } - } - - public class Name - { - public string Value { get; set; } - } - - public class Folder - { - public string id { get; set; } - public LocalId LocalId { get; set; } - public FolderId FolderId { get; set; } - public Name Name { get; set; } - public ParentFolderId ParentFolderId { get; set; } - } - - public class Name2 - { - public string Value { get; set; } - } - - public class ContactId - { - public string Value { get; set; } - } - - public class FolderId2 - { - public string Value { get; set; } - } - - public class Title - { - public string Value { get; set; } - } - - public class ContactMethodId - { - public string Value { get; set; } - } - - public class Number - { - public string Value { get; set; } - } - - public class Device - { - public string Value { get; set; } - } - - public class CallType - { - public string Value { get; set; } - } - - public class ContactMethod - { - public string id { get; set; } - public ContactMethodId ContactMethodId { get; set; } - public Number Number { get; set; } - public Device Device { get; set; } - public CallType CallType { get; set; } - - public ContactMethod() - { - ContactMethodId = new ContactMethodId(); - Number = new Number(); - Device = new Device(); - CallType = new CallType(); - } - } - - public class Contact - { - public string id { get; set; } - public Name2 Name { get; set; } - public ContactId ContactId { get; set; } - public FolderId2 FolderId { get; set; } - public Title Title { get; set; } - public List ContactMethod { get; set; } - - public Contact() - { - Name = new Name2(); - ContactId = new ContactId(); - FolderId = new FolderId2(); - Title = new Title(); - ContactMethod = new List(); - } - } - - public class PhonebookSearchResult - { - public string status { get; set; } - public ResultInfo ResultInfo { get; set; } - public List Folder { get; set; } - public List Contact { get; set; } - - public PhonebookSearchResult() - { - Folder = new List(); - Contact = new List(); - ResultInfo = new ResultInfo(); - } - } - - public class CommandResponse - { - public PhonebookSearchResult PhonebookSearchResult { get; set; } - } - - public class RootObject - { - public CommandResponse CommandResponse { get; set; } - - } - - - /// - /// Extracts the folders with no ParentFolder and returns them sorted alphabetically - /// - /// - /// - public static List GetRootFoldersFromSearchResult(PhonebookSearchResult result) - { - var rootFolders = new List(); - - if (result.Folder.Count == 0) - { - return null; - } - else if (result.Folder.Count > 0) - { - if (Debug.Level > 0) - Debug.Console(1, "Phonebook Folders:\n"); - - foreach (Folder f in result.Folder) - { - var folder = new DirectoryFolder(); - - folder.Name = f.Name.Value; - folder.FolderId = f.FolderId.Value; - - if (f.ParentFolderId == null) - rootFolders.Add(folder); - - if (Debug.Level > 0) - Debug.Console(1, "+ {0}", folder.Name); - } - } - - rootFolders.OrderBy(f => f.Name); - - return rootFolders; - } - - - /// - /// Extracts the contacts with no FolderId and returns them sorted alphabetically - /// - /// - /// - public static List GetRootContactsFromSearchResult(PhonebookSearchResult result) - { - var rootContacts = new List(); - - if (result.Contact.Count == 0) - { - return null; - } - else if (result.Contact.Count > 0) - { - if (Debug.Level > 0) - Debug.Console(1, "Root Contacts:\n"); - - foreach (Contact c in result.Contact) - { - var contact = new DirectoryContact(); - - if (string.IsNullOrEmpty(c.FolderId.Value)) - { - contact.Name = c.Name.Value; - contact.ContactId = c.ContactId.Value; - - if(!string.IsNullOrEmpty(c.Title.Value)) - contact.Title = c.Title.Value; - - if (Debug.Level > 0) - Debug.Console(1, "{0}\nContact Methods:", contact.Name); - - foreach (ContactMethod m in c.ContactMethod) - { - - var tempContactMethod = new PepperDash.Essentials.Devices.Common.Codec.ContactMethod(); - - eContactMethodCallType callType = eContactMethodCallType.Unknown; - if (!string.IsNullOrEmpty(m.CallType.Value)) - { - if (!string.IsNullOrEmpty(m.CallType.Value)) - { - if (m.CallType.Value.ToLower() == "audio") - callType = eContactMethodCallType.Audio; - else if (m.CallType.Value.ToLower() == "video") - callType = eContactMethodCallType.Video; - - tempContactMethod.CallType = callType; - } - } - - eContactMethodDevice device = eContactMethodDevice.Unknown; - if (!string.IsNullOrEmpty(m.Device.Value)) - { - - if (m.Device.Value.ToLower() == "mobile") - device = eContactMethodDevice.Mobile; - else if (m.Device.Value.ToLower() == "telephone") - device = eContactMethodDevice.Telephone; - else if (m.Device.Value.ToLower() == "video") - device = eContactMethodDevice.Video; - else if (m.Device.Value.ToLower() == "other") - device = eContactMethodDevice.Other; - - tempContactMethod.Device = device; - } - - if (Debug.Level > 0) - Debug.Console(1, "Number: {0}", m.Number.Value); - - tempContactMethod.Number = m.Number.Value; - tempContactMethod.ContactMethodId = m.ContactMethodId.Value; - - contact.ContactMethods.Add(tempContactMethod); - } - rootContacts.Add(contact); - } - } - } - - rootContacts.OrderBy(f => f.Name); - - return rootContacts; - } - - - /// - /// Converts data returned from a cisco codec to the generic Directory format. - /// - /// - /// - /// - public static CodecDirectory ConvertCiscoPhonebookToGeneric(PhonebookSearchResult result) - { - var directory = new Codec.CodecDirectory(); - - var folders = new List(); - - var contacts = new List(); - - try - { - if (result.Folder.Count > 0) - { - foreach (Folder f in result.Folder) - { - var folder = new DirectoryFolder(); - - folder.Name = f.Name.Value; - folder.FolderId = f.FolderId.Value; - - if (f.ParentFolderId != null) - { - folder.ParentFolderId = f.ParentFolderId.Value; - } - - folders.Add(folder); - } - - folders.OrderBy(f => f.Name); - - directory.AddFoldersToDirectory(folders); - } - - if (result.Contact.Count > 0) - { - foreach (Contact c in result.Contact) - { - var contact = new DirectoryContact(); - - contact.Name = c.Name.Value; - contact.ContactId = c.ContactId.Value; - if (!string.IsNullOrEmpty(c.Title.Value)) - contact.Title = c.Title.Value; - - if (c.FolderId != null) - { - contact.FolderId = c.FolderId.Value; - } - - foreach (ContactMethod m in c.ContactMethod) - { - eContactMethodCallType callType = eContactMethodCallType.Unknown; - if (!string.IsNullOrEmpty(m.CallType.Value)) - { - if (m.CallType.Value.ToLower() == "audio") - callType = eContactMethodCallType.Audio; - else if (m.CallType.Value.ToLower() == "video") - callType = eContactMethodCallType.Video; - } - - eContactMethodDevice device = eContactMethodDevice.Unknown; - - if (!string.IsNullOrEmpty(m.Device.Value)) - { - if (m.Device.Value.ToLower() == "mobile") - device = eContactMethodDevice.Mobile; - else if (m.Device.Value.ToLower() == "telephone") - device = eContactMethodDevice.Telephone; - else if (m.Device.Value.ToLower() == "video") - device = eContactMethodDevice.Video; - else if (m.Device.Value.ToLower() == "other") - device = eContactMethodDevice.Other; - } - - contact.ContactMethods.Add(new PepperDash.Essentials.Devices.Common.Codec.ContactMethod() - { - Number = m.Number.Value, - ContactMethodId = m.ContactMethodId.Value, - CallType = callType, - Device = device - }); - } - contacts.Add(contact); - } - - contacts.OrderBy(c => c.Name); - - directory.AddContactsToDirectory(contacts); - } - } - catch (Exception e) - { - Debug.Console(1, "Error converting Cisco Phonebook results to generic: {0}", e); - } - - return directory; - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/eCommandType.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/eCommandType.cs new file mode 100644 index 00000000..b68f280d --- /dev/null +++ b/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/eCommandType.cs @@ -0,0 +1,4 @@ +namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco +{ + enum eCommandType { SessionStart, SessionEnd, Command, GetStatus, GetConfiguration }; +} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/eExternalSourceMode.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/eExternalSourceMode.cs new file mode 100644 index 00000000..1f96f5e1 --- /dev/null +++ b/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/eExternalSourceMode.cs @@ -0,0 +1,4 @@ +namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco +{ + public enum eExternalSourceMode {Ready, NotReady, Hidden, Error} +} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/eExternalSourceType.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/eExternalSourceType.cs new file mode 100644 index 00000000..66ebe390 --- /dev/null +++ b/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/eExternalSourceType.cs @@ -0,0 +1,4 @@ +namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco +{ + public enum eExternalSourceType {camera, desktop, document_camera, mediaplayer, PC, whiteboard, other} +} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/xConfiguration.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/xConfiguration.cs deleted file mode 100644 index 7fc983e2..00000000 --- a/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/xConfiguration.cs +++ /dev/null @@ -1,1879 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using Crestron.SimplSharp; - -using PepperDash.Core; - -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; - - -namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco -{ - /// - /// This class exists to capture serialized data sent back by a Cisco codec in JSON output mode - /// - public class CiscoCodecConfiguration - { - public class DefaultVolume - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Dereverberation - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Mode - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class NoiseReduction - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class EchoControl - { - public Dereverberation Dereverberation { get; set; } - public Mode Mode { get; set; } - public NoiseReduction NoiseReduction { get; set; } - } - - public class Level - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Mode2 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Microphone - { - public string id { get; set; } - public EchoControl EchoControl { get; set; } - public Level Level { get; set; } - public Mode2 Mode { get; set; } - } - - public class Input - { - public List Microphone { get; set; } - } - - public class Enabled - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Mute - { - public Enabled Enabled { get; set; } - } - - public class Microphones - { - public Mute Mute { get; set; } - } - - public class Mode3 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class InternalSpeaker - { - public Mode3 Mode { get; set; } - } - - public class Output - { - public InternalSpeaker InternalSpeaker { get; set; } - } - - public class RingTone - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class RingVolume : ValueProperty - { - public string valueSpaceRef { get; set; } - - string _Value; - - /// - /// Sets Value and triggers the action when set - /// - public string Value - { - get - { - return _Value; - } - set - { - _Value = value; - OnValueChanged(); - } - } - - public int Volume - { - get - { - return Int32.Parse(_Value); - } - } - } - - public class SoundsAndAlerts - { - public RingTone RingTone { get; set; } - public RingVolume RingVolume { get; set; } - - public SoundsAndAlerts() - { - RingVolume = new RingVolume(); - } - } - - public class Audio - { - public DefaultVolume DefaultVolume { get; set; } - public Input Input { get; set; } - public Microphones Microphones { get; set; } - public Output Output { get; set; } - public SoundsAndAlerts SoundsAndAlerts { get; set; } - - - public Audio() - { - SoundsAndAlerts = new SoundsAndAlerts(); - } - } - - public class DefaultMode - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Backlight - { - public DefaultMode DefaultMode { get; set; } - } - - public class DefaultLevel - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Mode4 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Brightness - { - public DefaultLevel DefaultLevel { get; set; } - public Mode4 Mode { get; set; } - } - - public class Mode5 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Focus - { - public Mode5 Mode { get; set; } - } - - public class Level2 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Mode6 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Gamma - { - public Level2 Level { get; set; } - public Mode6 Mode { get; set; } - } - - public class Mirror - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Level3 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Mode7 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Whitebalance - { - public Level3 Level { get; set; } - public Mode7 Mode { get; set; } - } - - public class Framerate - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Camera - { - public string id { get; set; } - public Framerate Framerate { get; set; } - public Backlight Backlight { get; set; } - public Brightness Brightness { get; set; } - public Focus Focus { get; set; } - public Gamma Gamma { get; set; } - public Mirror Mirror { get; set; } - public Whitebalance Whitebalance { get; set; } - } - - public class Closeup - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Mode8 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class SpeakerTrack - { - public Closeup Closeup { get; set; } - public Mode8 Mode { get; set; } - } - - public class Cameras - { - //[JsonConverter(typeof(CameraConverter)), JsonProperty("Camera")] - //public List Camera { get; set; } - //[JsonProperty("SpeakerTrack")] - public SpeakerTrack SpeakerTrack { get; set; } - - public Cameras() - { - //Camera = new List(); - SpeakerTrack = new SpeakerTrack(); - } - } - - public class CameraConverter : JsonConverter - { - // this is currently not working - public override bool CanConvert(System.Type objectType) - { - return objectType == typeof(Camera) || objectType == typeof(List); // This should not be called but is required for implmentation - } - - public override object ReadJson(JsonReader reader, System.Type objectType, object existingValue, JsonSerializer serializer) - { - try - { - if (reader.TokenType == JsonToken.StartArray) - { - var l = new List(); - reader.Read(); - while (reader.TokenType != JsonToken.EndArray) - { - l.Add(reader.Value as Camera); - reader.Read(); - } - Debug.Console(1, "[xConfiguration]: Cameras converted as list"); - return l; - } - else - { - Debug.Console(1, "[xConfiguration]: Camera converted as single object and added to list"); - return new List { reader.Value as Camera }; - } - } - catch (Exception e) - { - Debug.Console(1, "[xConfiguration]: Unable to convert JSON for camera objects: {0}", e); - - return new List(); - } - } - - public override bool CanWrite - { - get - { - return false; - } - } - - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - { - throw new NotImplementedException("Write not implemented"); - } - } - - public class Delay - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Mode9 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Mute2 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class AutoAnswer - { - public Delay Delay { get; set; } - public Mode9 Mode { get; set; } - public Mute2 Mute { get; set; } - - public AutoAnswer() - { - Mode = new Mode9(); - Delay = new Delay(); - Mute = new Mute2(); - } - } - - public class Protocol - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Rate - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class DefaultCall - { - public Protocol Protocol { get; set; } - public Rate Rate { get; set; } - } - - public class DefaultTimeout - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class DoNotDisturb - { - public DefaultTimeout DefaultTimeout { get; set; } - } - - public class Mode10 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Encryption - { - public Mode10 Mode { get; set; } - } - - public class Mode11 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class FarEndControl - { - public Mode11 Mode { get; set; } - } - - public class MaxReceiveCallRate - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class MaxTotalReceiveCallRate - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class MaxTotalTransmitCallRate - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class MaxTransmitCallRate - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Mode12 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class MultiStream - { - public Mode12 Mode { get; set; } - } - - public class Conference - { - public AutoAnswer AutoAnswer { get; set; } - public DefaultCall DefaultCall { get; set; } - public DoNotDisturb DoNotDisturb { get; set; } - public Encryption Encryption { get; set; } - public FarEndControl FarEndControl { get; set; } - public MaxReceiveCallRate MaxReceiveCallRate { get; set; } - public MaxTotalReceiveCallRate MaxTotalReceiveCallRate { get; set; } - public MaxTotalTransmitCallRate MaxTotalTransmitCallRate { get; set; } - public MaxTransmitCallRate MaxTransmitCallRate { get; set; } - public MultiStream MultiStream { get; set; } - - public Conference() - { - AutoAnswer = new AutoAnswer(); - } - } - - public class LoginName - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Mode13 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Password - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Authentication - { - public LoginName LoginName { get; set; } - public Mode13 Mode { get; set; } - public Password Password { get; set; } - } - - public class Mode14 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class CallSetup - { - public Mode14 Mode { get; set; } - } - - public class KeySize - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Encryption2 - { - public KeySize KeySize { get; set; } - } - - public class Address - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Gatekeeper - { - public Address Address { get; set; } - } - - public class E164 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class ID - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class H323Alias - { - public E164 E164 { get; set; } - public ID ID { get; set; } - } - - public class Address2 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Mode15 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class NAT - { - public Address2 Address { get; set; } - public Mode15 Mode { get; set; } - } - - public class H323 - { - public Authentication Authentication { get; set; } - public CallSetup CallSetup { get; set; } - public Encryption2 Encryption { get; set; } - public Gatekeeper Gatekeeper { get; set; } - public H323Alias H323Alias { get; set; } - public NAT NAT { get; set; } - } - - public class Name - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Domain - { - public Name Name { get; set; } - } - - public class Address3 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Server - { - public string id { get; set; } - public Address3 Address { get; set; } - } - - public class DNS - { - public Domain Domain { get; set; } - public List Server { get; set; } - } - - public class AnonymousIdentity - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Md5 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Peap - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Tls - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Ttls - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Eap - { - public Md5 Md5 { get; set; } - public Peap Peap { get; set; } - public Tls Tls { get; set; } - public Ttls Ttls { get; set; } - } - - public class Identity - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Mode16 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Password2 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class TlsVerify - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class UseClientCertificate - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class IEEE8021X - { - public AnonymousIdentity AnonymousIdentity { get; set; } - public Eap Eap { get; set; } - public Identity Identity { get; set; } - public Mode16 Mode { get; set; } - public Password2 Password { get; set; } - public TlsVerify TlsVerify { get; set; } - public UseClientCertificate UseClientCertificate { get; set; } - } - - public class IPStack - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Address4 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Assignment - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Gateway - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class SubnetMask - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class IPv4 - { - public Address4 Address { get; set; } - public Assignment Assignment { get; set; } - public Gateway Gateway { get; set; } - public SubnetMask SubnetMask { get; set; } - - public IPv4() - { - Address = new Address4(); - } - } - - public class Address5 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Assignment2 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class DHCPOptions - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Gateway2 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class IPv6 - { - public Address5 Address { get; set; } - public Assignment2 Assignment { get; set; } - public DHCPOptions DHCPOptions { get; set; } - public Gateway2 Gateway { get; set; } - } - - public class MTU - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Audio2 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Data - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class ICMPv6 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class NTP - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Signalling - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Video - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Diffserv - { - public Audio2 Audio { get; set; } - public Data Data { get; set; } - public ICMPv6 ICMPv6 { get; set; } - public NTP NTP { get; set; } - public Signalling Signalling { get; set; } - public Video Video { get; set; } - } - - public class Mode17 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class QoS - { - public Diffserv Diffserv { get; set; } - public Mode17 Mode { get; set; } - } - - public class Allow - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class RemoteAccess - { - public Allow Allow { get; set; } - } - - public class Speed - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Mode18 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class VlanId - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Voice - { - public Mode18 Mode { get; set; } - public VlanId VlanId { get; set; } - } - - public class VLAN - { - public Voice Voice { get; set; } - } - - public class Network - { - public string id { get; set; } - public DNS DNS { get; set; } - public IEEE8021X IEEE8021X { get; set; } - public IPStack IPStack { get; set; } - public IPv4 IPv4 { get; set; } - public IPv6 IPv6 { get; set; } - public MTU MTU { get; set; } - public QoS QoS { get; set; } - public RemoteAccess RemoteAccess { get; set; } - public Speed Speed { get; set; } - public VLAN VLAN { get; set; } - - public Network() - { - IPv4 = new IPv4(); - } - } - - public class Mode19 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class CDP - { - public Mode19 Mode { get; set; } - } - - public class Mode20 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class H3232 - { - public Mode20 Mode { get; set; } - } - - public class Mode21 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class HTTP - { - public Mode21 Mode { get; set; } - } - - public class MinimumTLSVersion - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Server2 - { - public MinimumTLSVersion MinimumTLSVersion { get; set; } - } - - public class StrictTransportSecurity - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class VerifyClientCertificate - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class VerifyServerCertificate - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class HTTPS - { - public Server2 Server { get; set; } - public StrictTransportSecurity StrictTransportSecurity { get; set; } - public VerifyClientCertificate VerifyClientCertificate { get; set; } - public VerifyServerCertificate VerifyServerCertificate { get; set; } - } - - public class Mode22 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Address6 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Server3 - { - public string id { get; set; } - public Address6 Address { get; set; } - } - - public class NTP2 - { - public Mode22 Mode { get; set; } - public List Server { get; set; } - } - - public class Mode23 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class SIP - { - public Mode23 Mode { get; set; } - } - - public class CommunityName - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Address7 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Host - { - public string id { get; set; } - public Address7 Address { get; set; } - } - - public class Mode24 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class SystemContact - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class SystemLocation - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class SNMP - { - public CommunityName CommunityName { get; set; } - public List Host { get; set; } - public Mode24 Mode { get; set; } - public SystemContact SystemContact { get; set; } - public SystemLocation SystemLocation { get; set; } - } - - public class Mode25 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class SSH - { - public Mode25 Mode { get; set; } - } - - public class Mode26 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class UPnP - { - public Mode26 Mode { get; set; } - } - - public class WelcomeText - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class NetworkServices - { - public CDP CDP { get; set; } - public H3232 H323 { get; set; } - public HTTP HTTP { get; set; } - public HTTPS HTTPS { get; set; } - public NTP2 NTP { get; set; } - public SIP SIP { get; set; } - public SNMP SNMP { get; set; } - public SSH SSH { get; set; } - public UPnP UPnP { get; set; } - public WelcomeText WelcomeText { get; set; } - } - - public class Cameras2 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class ControlSystems - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class TouchPanels - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Profile - { - public Cameras2 Cameras { get; set; } - public ControlSystems ControlSystems { get; set; } - public TouchPanels TouchPanels { get; set; } - } - - public class Peripherals - { - public Profile Profile { get; set; } - } - - public class ID2 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Type - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class URL - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Server4 - { - public string id { get; set; } - public ID2 ID { get; set; } - public Type Type { get; set; } - public URL URL { get; set; } - } - - public class Phonebook - { - public List Server { get; set; } - } - - public class Connectivity - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Address8 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class AlternateAddress - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Domain2 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Path - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Protocol2 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class ExternalManager - { - public Address8 Address { get; set; } - public AlternateAddress AlternateAddress { get; set; } - public Domain2 Domain { get; set; } - public Path Path { get; set; } - public Protocol2 Protocol { get; set; } - } - - public class HttpMethod - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class LoginName2 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Mode27 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Password3 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Provisioning - { - public Connectivity Connectivity { get; set; } - public ExternalManager ExternalManager { get; set; } - public HttpMethod HttpMethod { get; set; } - public LoginName2 LoginName { get; set; } - public Mode27 Mode { get; set; } - public Password3 Password { get; set; } - } - - public class Mode28 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class CallControl - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class FromClients - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class ToClients - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class ContentShare - { - public FromClients FromClients { get; set; } - public ToClients ToClients { get; set; } - } - - public class Services - { - public CallControl CallControl { get; set; } - public ContentShare ContentShare { get; set; } - } - - public class Proximity - { - public Mode28 Mode { get; set; } - public Services Services { get; set; } - } - - public class PeopleCountOutOfCall - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class PeoplePresenceDetector - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class RoomAnalytics - { - public PeopleCountOutOfCall PeopleCountOutOfCall { get; set; } - public PeoplePresenceDetector PeoplePresenceDetector { get; set; } - } - - public class Password4 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class UserName - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Authentication2 - { - public Password4 Password { get; set; } - public UserName UserName { get; set; } - } - - public class DefaultTransport - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class DisplayName - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class DefaultCandidate - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Mode29 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Ice - { - public DefaultCandidate DefaultCandidate { get; set; } - public Mode29 Mode { get; set; } - } - - public class ListenPort - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Address9 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Proxy - { - public string id { get; set; } - public Address9 Address { get; set; } - } - - public class Password5 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Server5 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class UserName2 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Turn - { - public Password5 Password { get; set; } - public Server5 Server { get; set; } - public UserName2 UserName { get; set; } - } - - public class URI - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class SIP2 - { - public Authentication2 Authentication { get; set; } - public DefaultTransport DefaultTransport { get; set; } - public DisplayName DisplayName { get; set; } - public Ice Ice { get; set; } - public ListenPort ListenPort { get; set; } - public List Proxy { get; set; } - public Turn Turn { get; set; } - public URI URI { get; set; } - } - - public class BaudRate - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class LoginRequired - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Mode30 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class SerialPort - { - public BaudRate BaudRate { get; set; } - public LoginRequired LoginRequired { get; set; } - public Mode30 Mode { get; set; } - } - - public class BootAction - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Control - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Delay2 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class StandbyAction - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class WakeupAction - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Standby - { - public BootAction BootAction { get; set; } - public Control Control { get; set; } - public Delay2 Delay { get; set; } - public StandbyAction StandbyAction { get; set; } - public WakeupAction WakeupAction { get; set; } - } - - public class Name2 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class SystemUnit - { - public Name2 Name { get; set; } - } - - public class DateFormat - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class TimeFormat - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Zone - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Time - { - public DateFormat DateFormat { get; set; } - public TimeFormat TimeFormat { get; set; } - public Zone Zone { get; set; } - } - - public class Type2 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class ContactInfo - { - public Type2 Type { get; set; } - } - - public class Mode31 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class KeyTones - { - public Mode31 Mode { get; set; } - } - - public class Language - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Output2 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class OSD - { - public Output2 Output { get; set; } - } - - public class UserInterface - { - public ContactInfo ContactInfo { get; set; } - public KeyTones KeyTones { get; set; } - public Language Language { get; set; } - public OSD OSD { get; set; } - } - - public class Filter - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Group - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Admin - { - public Filter Filter { get; set; } - public Group Group { get; set; } - } - - public class Attribute - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class BaseDN - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Encryption3 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class MinimumTLSVersion2 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Mode32 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Address10 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Port - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Server6 - { - public Address10 Address { get; set; } - public Port Port { get; set; } - } - - public class VerifyServerCertificate2 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class LDAP - { - public Admin Admin { get; set; } - public Attribute Attribute { get; set; } - public BaseDN BaseDN { get; set; } - public Encryption3 Encryption { get; set; } - public MinimumTLSVersion2 MinimumTLSVersion { get; set; } - public Mode32 Mode { get; set; } - public Server6 Server { get; set; } - public VerifyServerCertificate2 VerifyServerCertificate { get; set; } - } - - public class UserManagement - { - public LDAP LDAP { get; set; } - } - - public class DefaultMainSource - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class CameraId - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Mode33 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class CameraControl - { - public CameraId CameraId { get; set; } - public Mode33 Mode { get; set; } - } - - public class InputSourceType - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Name3 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class PreferredResolution - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class PresentationSelection - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Quality - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Visibility - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Connector - { - public string id { get; set; } - public CameraControl CameraControl { get; set; } - public InputSourceType InputSourceType { get; set; } - public Name3 Name { get; set; } - public PreferredResolution PreferredResolution { get; set; } - public PresentationSelection PresentationSelection { get; set; } - public Quality Quality { get; set; } - public Visibility Visibility { get; set; } - } - - public class Input2 - { - public List Connector { get; set; } - } - - public class Monitors - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Mode34 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class CEC - { - public Mode34 Mode { get; set; } - } - - public class MonitorRole - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Resolution - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Connector2 - { - public string id { get; set; } - public CEC CEC { get; set; } - public MonitorRole MonitorRole { get; set; } - public Resolution Resolution { get; set; } - } - - public class Output3 - { - public List Connector { get; set; } - } - - public class DefaultSource - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Presentation - { - public DefaultSource DefaultSource { get; set; } - } - - public class FullscreenMode - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Mode35 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class OnMonitorRole - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class PIPPosition - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Default - { - public FullscreenMode FullscreenMode { get; set; } - public Mode35 Mode { get; set; } - public OnMonitorRole OnMonitorRole { get; set; } - public PIPPosition PIPPosition { get; set; } - } - - public class Duration - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class Mode36 - { - public string valueSpaceRef { get; set; } - public string Value { get; set; } - } - - public class OnCall - { - public Duration Duration { get; set; } - public Mode36 Mode { get; set; } - } - - public class Selfview - { - public Default Default { get; set; } - public OnCall OnCall { get; set; } - } - - public class Video2 - { - public DefaultMainSource DefaultMainSource { get; set; } - public Input2 Input { get; set; } - public Monitors Monitors { get; set; } - public Output3 Output { get; set; } - public Presentation Presentation { get; set; } - public Selfview Selfview { get; set; } - } - - public class Configuration - { - public Audio Audio { get; set; } - public Cameras Cameras { get; set; } - public Conference Conference { get; set; } - public H323 H323 { get; set; } - public List Network { get; set; } - public NetworkServices NetworkServices { get; set; } - public Peripherals Peripherals { get; set; } - public Phonebook Phonebook { get; set; } - public Provisioning Provisioning { get; set; } - public Proximity Proximity { get; set; } - public RoomAnalytics RoomAnalytics { get; set; } - public SIP2 SIP { get; set; } - public SerialPort SerialPort { get; set; } - public Standby Standby { get; set; } - public SystemUnit SystemUnit { get; set; } - public Time Time { get; set; } - public UserInterface UserInterface { get; set; } - public UserManagement UserManagement { get; set; } - public Video2 Video { get; set; } - - public Configuration() - { - Audio = new Audio(); - Conference = new Conference(); - Network = new List(); - } - } - - public class RootObject - { - public Configuration Configuration { get; set; } - - public RootObject() - { - Configuration = new Configuration(); - } - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/xEvent.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/xEvent.cs deleted file mode 100644 index a797103c..00000000 --- a/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/xEvent.cs +++ /dev/null @@ -1,166 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco -{ - /// - /// This class exists to capture serialized data sent back by a Cisco codec in JSON output mode - /// - public class CiscoCodecEvents - { - public class CauseValue - { - public string id { get; set; } - public string Value { get; set; } - } - - public class CauseType - { - public string id { get; set; } - public string Value { get; set; } - } - - public class CauseString - { - public string id { get; set; } - public string Value { get; set; } - } - - public class OrigCallDirection - { - public string id { get; set; } - public string Value { get; set; } - } - - public class RemoteURI - { - public string id { get; set; } - public string Value { get; set; } - } - - public class DisplayName - { - public string id { get; set; } - public string Value { get; set; } - } - - public class CallId - { - public string id { get; set; } - public string Value { get; set; } - } - - public class CauseCode - { - public string id { get; set; } - public string Value { get; set; } - } - - public class CauseOrigin - { - public string id { get; set; } - public string Value { get; set; } - } - - public class Protocol - { - public string id { get; set; } - public string Value { get; set; } - } - - public class Duration - { - public string id { get; set; } - public string Value { get; set; } - } - - public class CallType - { - public string id { get; set; } - public string Value { get; set; } - } - - public class CallRate - { - public string id { get; set; } - public string Value { get; set; } - } - - public class Encryption - { - public string id { get; set; } - public string Value { get; set; } - } - - public class RequestedURI - { - public string id { get; set; } - public string Value { get; set; } - } - - public class PeopleCountAverage - { - public string id { get; set; } - public string Value { get; set; } - } - - public class CallDisconnect - { - public string id { get; set; } - public CauseValue CauseValue { get; set; } - public CauseType CauseType { get; set; } - public CauseString CauseString { get; set; } - public OrigCallDirection OrigCallDirection { get; set; } - public RemoteURI RemoteURI { get; set; } - public DisplayName DisplayName { get; set; } - public CallId CallId { get; set; } - public CauseCode CauseCode { get; set; } - public CauseOrigin CauseOrigin { get; set; } - public Protocol Protocol { get; set; } - public Duration Duration { get; set; } - public CallType CallType { get; set; } - public CallRate CallRate { get; set; } - public Encryption Encryption { get; set; } - public RequestedURI RequestedURI { get; set; } - public PeopleCountAverage PeopleCountAverage { get; set; } - } - public class UserInterface - { - public string id { get; set; } - public Presentation Presentation { get; set; } - } - public class Presentation - { - public string id { get; set; } - public ExternalSource ExternalSource { get; set; } - } - public class ExternalSource - { - public string id { get; set; } - public Selected Selected { get; set; } - } - public class Selected - { - public string id { get; set; } - public SourceIdentifier SourceIdentifier { get; set; } - } - public class SourceIdentifier - { - public string id { get; set; } - public string Value { get; set; } - } - public class Event - { - public CallDisconnect CallDisconnect { get; set; } - public UserInterface UserInterface { get; set; } - } - - public class RootObject - { - public Event Event { get; set; } - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/xStatus.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/xStatus.cs deleted file mode 100644 index 6b7ee2e5..00000000 --- a/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/xStatus.cs +++ /dev/null @@ -1,2281 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharp.CrestronXml.Serialization; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; - -using PepperDash.Core; -using PepperDash.Essentials.Devices.Common.VideoCodec.CiscoCodec; -using PepperDash.Essentials.Core.Presets; - -namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco -{ - // Helper Classes for Proerties - public abstract class ValueProperty - { - /// - /// Triggered when Value is set - /// - public Action ValueChangedAction { get; set; } - - protected void OnValueChanged() - { - var a = ValueChangedAction; - if (a != null) - a(); - } - - } - - /// - /// This class exists to capture serialized data sent back by a Cisco codec in JSON output mode - /// - public class CiscoCodecStatus - { - - public class ConnectionStatus - { - public string Value { get; set; } - } - - public class EcReferenceDelay - { - public string Value { get; set; } - } - - public class Microphone - { - public string id { get; set; } - public ConnectionStatus ConnectionStatus { get; set; } - public EcReferenceDelay EcReferenceDelay { get; set; } - } - - public class Connectors - { - public List Microphone { get; set; } - } - - public class Input - { - public Connectors Connectors { get; set; } - } - - public class Mute : ValueProperty - { - public bool BoolValue { get; private set; } - - public string Value - { - set - { - // If the incoming value is "On" it sets the BoolValue true, otherwise sets it false - BoolValue = value == "On"; - OnValueChanged(); - } - } - } - - public class Microphones - { - public Mute Mute { get; set; } - - public Microphones() - { - Mute = new Mute(); - } - } - - public class ConnectionStatus2 - { - public string Value { get; set; } - } - - public class DelayMs - { - public string Value { get; set; } - } - - public class Line - { - public string id { get; set; } - public ConnectionStatus2 ConnectionStatus { get; set; } - public DelayMs DelayMs { get; set; } - } - - public class Connectors2 - { - public List Line { get; set; } - } - - public class Output - { - public Connectors2 Connectors { get; set; } - } - - public class Volume : ValueProperty - { - string _Value; - - /// - /// Sets Value and triggers the action when set - /// - public string Value - { - get - { - return _Value; - } - set - { - _Value = value; - OnValueChanged(); - } - } - - /// - /// Converted value of _Value for use as feedback - /// - public int IntValue - { - get - { - if (!string.IsNullOrEmpty(_Value)) - return Convert.ToInt32(_Value); - else - return 0; - } - } - } - - public class VolumeMute : ValueProperty - { - public bool BoolValue { get; private set; } - - public string Value - { - set - { - // If the incoming value is "On" it sets the BoolValue true, otherwise sets it false - BoolValue = value == "On"; - OnValueChanged(); - } - } - } - - public class Audio - { - public Input Input { get; set; } - public Microphones Microphones { get; set; } // Can we have this setter fire the update on the CiscoCodec feedback? - public Output Output { get; set; } - public Volume Volume { get; set; } - public VolumeMute VolumeMute { get; set; } - - public Audio() - { - Volume = new Volume(); - VolumeMute = new VolumeMute(); - Microphones = new Microphones(); - } - } - - public class Id - { - public string Value { get; set; } - } - - public class Current - { - public Id Id { get; set; } - } - - public class Bookings - { - public Current Current { get; set; } - } - - public class Options - { - public string Value { get; set; } - } - - public class Capabilities - { - public Options Options { get; set; } - } - - public class Connected - { - public string Value { get; set; } - } - - public class Framerate - { - public string Value { get; set; } - } - - public class Flip - { - public string Value { get; set; } - } - - public class HardwareID - { - public string Value { get; set; } - } - - public class Manufacturer - { - public string Value { get; set; } - } - - public class Model - { - public string Value { get; set; } - } - - public class Pan - { - public string Value { get; set; } - } - - public class Tilt - { - public string Value { get; set; } - } - - public class Zoom - { - public string Value { get; set; } - } - - public class Position - { - public Pan Pan { get; set; } - public Tilt Tilt { get; set; } - public Zoom Zoom { get; set; } - } - - public class SoftwareID - { - public string Value { get; set; } - } - - public class DectectedConnector - { - public string Value { get; set; } - - public int ConnectorId - { - get - { - if(!string.IsNullOrEmpty(Value)) - { - return Convert.ToUInt16(Value); - } - else - return -1; - } - } - } - - public class Camera - { - public string id { get; set; } - public Capabilities Capabilities { get; set; } - public Connected Connected { get; set; } - public DectectedConnector DetectedConnector { get; set; } - public Flip Flip { get; set; } - public HardwareID HardwareID { get; set; } - public MacAddress MacAddress { get; set; } - public Manufacturer Manufacturer { get; set; } - public Model Model { get; set; } - public Position Position { get; set; } - public SerialNumber SerialNumber { get; set; } - public SoftwareID SoftwareID { get; set; } - - public Camera() - { - Manufacturer = new Manufacturer(); - Model = new Model(); - DetectedConnector = new DectectedConnector(); - } - } - - public class Availability : ValueProperty - { - string _Value; - public bool BoolValue { get; private set; } - - public string Value - { - get - { - return _Value; - } - set - { - // If the incoming value is "Available" it sets the BoolValue true, otherwise sets it false - _Value = value; - BoolValue = value == "Available"; - OnValueChanged(); - } - } - } - - public class CallStatus : ValueProperty - { - string _Value; - public bool BoolValue { get; private set; } - - - public string Value - { - get - { - return _Value; - } - set - { - // If the incoming value is "Active" it sets the BoolValue true, otherwise sets it false - _Value = value; - BoolValue = value == "Connected"; - OnValueChanged(); - } - } - } - - public class Status2 : ValueProperty - { - string _Value; - public bool BoolValue { get; private set; } - - - public string Value - { - get - { - return _Value; - } - set - { - // If the incoming value is "Active" it sets the BoolValue true, otherwise sets it false - _Value = value; - BoolValue = value == "Active"; - OnValueChanged(); - } - } - } - - public class SpeakerTrack - { - public Availability Availability { get; set; } - public Status2 Status { get; set; } - - public SpeakerTrack() - { - Status = new Status2(); - Availability = new Availability(); - } - } - - public class Cameras - { - // [JsonConverter(typeof(CameraConverter))] - public List Camera { get; set; } - public SpeakerTrack SpeakerTrack { get; set; } - - public Cameras() - { - Camera = new List(); - SpeakerTrack = new SpeakerTrack(); - } - } - - //public class CameraConverter : JsonConverter - //{ - - // public override bool CanConvert(System.Type objectType) - // { - // return true; // objectType == typeof(Camera) || objectType == typeof(List); // This should not be called but is required for implmentation - // } - - // public override object ReadJson(JsonReader reader, System.Type objectType, object existingValue, JsonSerializer serializer) - // { - // try - // { - // if (reader.TokenType == JsonToken.StartArray) - // { - // var l = new List(); - // reader.Read(); - // while (reader.TokenType != JsonToken.EndArray) - // { - // l.Add(reader.Value as Camera); - // reader.Read(); - // } - // Debug.Console(1, "[xStatus]: Cameras converted as list"); - // return l; - // } - // else - // { - // Debug.Console(1, "[xStatus]: Camera converted as single object and added to list"); - // return new List { reader.Value as Camera }; - // } - // } - // catch (Exception e) - // { - // Debug.Console(1, "[xStatus]: Unable to convert JSON for camera objects: {0}", e); - - // return new List(); - // } - // } - - // public override bool CanWrite - // { - // get - // { - // return false; - // } - // } - - // public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - // { - // throw new NotImplementedException("Write not implemented"); - // } - //} - - - public class MaxActiveCalls - { - public string Value { get; set; } - } - - public class MaxAudioCalls - { - public string Value { get; set; } - } - - public class MaxCalls - { - public string Value { get; set; } - } - - public class MaxVideoCalls - { - public string Value { get; set; } - } - - public class Conference - { - public MaxActiveCalls MaxActiveCalls { get; set; } - public MaxAudioCalls MaxAudioCalls { get; set; } - public MaxCalls MaxCalls { get; set; } - public MaxVideoCalls MaxVideoCalls { get; set; } - } - - public class Capabilities2 - { - public Conference Conference { get; set; } - } - - public class CallId - { - public string Value { get; set; } - } - - public class ActiveSpeaker - { - public CallId CallId { get; set; } - } - - public class DoNotDisturb : ValueProperty - { - string _Value; - - public bool BoolValue { get; private set; } - - public string Value - { - get - { - return _Value; - } - set - { - _Value = value; - // If the incoming value is "On" it sets the BoolValue true, otherwise sets it false - BoolValue = value == "On" || value == "Active"; - OnValueChanged(); - } - } - } - - public class Mode - { - public string Value { get; set; } - } - - public class Multipoint - { - public Mode Mode { get; set; } - } - - public class CallId2 - { - public string Value { get; set; } - } - - public class Mode2 : ValueProperty - { - string _Value; - - public bool BoolValue { get; private set; } - - - - public string Value - { - get - { - return _Value; - } - set - { - _Value = value; - // If the incoming value is "Sending" it sets the BoolValue true, otherwise sets it false - BoolValue = value == "Sending"; - OnValueChanged(); - } - } - } - - public class Mode3 - { - public string Value { get; set; } - } - - public class ReleaseFloorAvailability - { - public string Value { get; set; } - } - - public class RequestFloorAvailability - { - public string Value { get; set; } - } - - public class Whiteboard - { - public Mode3 Mode { get; set; } - public ReleaseFloorAvailability ReleaseFloorAvailability { get; set; } - public RequestFloorAvailability RequestFloorAvailability { get; set; } - } - - public class Source2 : ValueProperty - { - string _Value; - - /// - /// Sets Value and triggers the action when set - /// - public string Value - { - get - { - return _Value; - } - set - { - _Value = value; - OnValueChanged(); - } - } - - /// - /// Converted value of _Value for use as feedback - /// - public int IntValue - { - get - { - if (!string.IsNullOrEmpty(_Value)) - return Convert.ToInt32(_Value); - else - return 0; - } - } - } - - public class SendingMode : ValueProperty - { - string _Value; - - /// - /// Sets Value and triggers the action when set - /// - public string Value - { - get - { - return _Value; - } - set - { - _Value = value; - OnValueChanged(); - } - } - - public bool LocalOnly - { - get - { - if(string.IsNullOrEmpty(_Value)) - return false; - - return _Value.ToLower() == "localonly"; - } - } - - public bool LocalRemote - { - get - { - if(string.IsNullOrEmpty(_Value)) - return false; - - return _Value.ToLower() == "localremote"; - } - } - } - - public class LocalInstance - { - public string id { get; set; } - public string ghost { get; set; } - public SendingMode SendingMode { get; set; } - public Source2 Source { get; set; } - - public LocalInstance() - { - Source = new Source2(); - SendingMode = new SendingMode(); - } - } - - public class Presentation - { - public CallId2 CallId { get; set; } - public Mode2 Mode { get; set; } - public Whiteboard Whiteboard { get; set; } - public List LocalInstance { get; set; } - - public Presentation() - { - Mode = new Mode2(); - LocalInstance = new List(); - } - } - - public class CallId3 - { - public string Value { get; set; } - } - - public class Mode4 - { - public string Value { get; set; } - } - - public class SpeakerLock - { - public CallId3 CallId { get; set; } - public Mode4 Mode { get; set; } - } - - public class Conference2 - { - public ActiveSpeaker ActiveSpeaker { get; set; } - public DoNotDisturb DoNotDisturb { get; set; } - public Multipoint Multipoint { get; set; } - public Presentation Presentation { get; set; } - public SpeakerLock SpeakerLock { get; set; } - - public Conference2() - { - Presentation = new Presentation(); - DoNotDisturb = new DoNotDisturb(); - } - } - - public class Description - { - public string Value { get; set; } - } - - public class Level - { - public string Value { get; set; } - } - - public class References - { - public string Value { get; set; } - } - - public class Type - { - public string Value { get; set; } - } - - public class Message - { - public string id { get; set; } - public Description Description { get; set; } - public Level Level { get; set; } - public References References { get; set; } - public Type Type { get; set; } - } - - public class Diagnostics - { - public List Message { get; set; } - } - - public class Conference3 - { - } - - public class Experimental - { - public Conference3 Conference { get; set; } - } - - public class Address - { - public string Value { get; set; } - } - - public class Port - { - public string Value { get; set; } - } - - public class Reason - { - public string Value { get; set; } - } - - public class Status3 - { - public string Value { get; set; } - } - - public class Gatekeeper - { - public Address Address { get; set; } - public Port Port { get; set; } - public Reason Reason { get; set; } - public Status3 Status { get; set; } - } - - public class Reason2 - { - public string Value { get; set; } - } - - public class Status4 - { - public string Value { get; set; } - } - - public class Mode5 - { - public Reason2 Reason { get; set; } - public Status4 Status { get; set; } - } - - public class H323 - { - public Gatekeeper Gatekeeper { get; set; } - public Mode5 Mode { get; set; } - } - - public class Expression - { - public string id { get; set; } - public string Value { get; set; } - } - - public class Format - { - public string Value { get; set; } - } - - public class URL - { - public string Value { get; set; } - } - - public class HttpFeedback - { - public string id { get; set; } - public List Expression { get; set; } - public Format Format { get; set; } - public URL URL { get; set; } - } - - public class MediaChannels - { - } - - public class Address2 - { - public string Value { get; set; } - } - - public class Capabilities3 - { - public string Value { get; set; } - } - - public class DeviceId - { - public string Value { get; set; } - } - - public class Duplex - { - public string Value { get; set; } - } - - public class Platform - { - public string Value { get; set; } - } - - public class PortID - { - public string Value { get; set; } - } - - public class PrimaryMgmtAddress - { - public string Value { get; set; } - } - - public class SysName - { - public string Value { get; set; } - } - - public class SysObjectID - { - public string Value { get; set; } - } - - public class VTPMgmtDomain - { - public string Value { get; set; } - } - - public class Version - { - public string Value { get; set; } - } - - public class VoIPApplianceVlanID - { - public string Value { get; set; } - } - - public class CDP - { - public Address2 Address { get; set; } - public Capabilities3 Capabilities { get; set; } - public DeviceId DeviceId { get; set; } - public Duplex Duplex { get; set; } - public Platform Platform { get; set; } - public PortID PortID { get; set; } - public PrimaryMgmtAddress PrimaryMgmtAddress { get; set; } - public SysName SysName { get; set; } - public SysObjectID SysObjectID { get; set; } - public VTPMgmtDomain VTPMgmtDomain { get; set; } - public Version Version { get; set; } - public VoIPApplianceVlanID VoIPApplianceVlanID { get; set; } - } - - public class Name - { - public string Value { get; set; } - } - - public class Domain - { - public Name Name { get; set; } - } - - public class Address3 - { - public string Value { get; set; } - } - - public class Server - { - public string id { get; set; } - public Address3 Address { get; set; } - } - - public class DNS - { - public Domain Domain { get; set; } - public List Server { get; set; } - } - - public class MacAddress - { - public string Value { get; set; } - } - - public class Speed - { - public string Value { get; set; } - } - - public class Ethernet - { - public MacAddress MacAddress { get; set; } - public Speed Speed { get; set; } - } - - public class Address4 - { - public string Value { get; set; } - } - - public class Gateway - { - public string Value { get; set; } - } - - public class SubnetMask - { - public string Value { get; set; } - } - - public class IPv4 - { - public Address4 Address { get; set; } - public Gateway Gateway { get; set; } - public SubnetMask SubnetMask { get; set; } - - public IPv4() - { - Address = new Address4(); - } - } - - public class Address5 - { - public string Value { get; set; } - } - - public class Gateway2 - { - public string Value { get; set; } - } - - public class IPv6 - { - public Address5 Address { get; set; } - public Gateway2 Gateway { get; set; } - } - - public class VlanId - { - public string Value { get; set; } - } - - public class Voice - { - public VlanId VlanId { get; set; } - } - - public class VLAN - { - public Voice Voice { get; set; } - } - - public class Network - { - public string id { get; set; } - public CDP CDP { get; set; } - public DNS DNS { get; set; } - public Ethernet Ethernet { get; set; } - public IPv4 IPv4 { get; set; } - public IPv6 IPv6 { get; set; } - public VLAN VLAN { get; set; } - - public Network() - { - IPv4 = new IPv4(); - } - } - - public class CurrentAddress - { - public string Value { get; set; } - } - - public class Address6 - { - public string Value { get; set; } - } - - public class Server2 - { - public string id { get; set; } - public Address6 Address { get; set; } - } - - public class Status5 - { - public string Value { get; set; } - } - - public class NTP - { - public CurrentAddress CurrentAddress { get; set; } - public List Server { get; set; } - public Status5 Status { get; set; } - } - - public class NetworkServices - { - public NTP NTP { get; set; } - } - - public class HardwareInfo - { - public string Value { get; set; } - } - - public class ID2 - { - public string Value { get; set; } - } - - public class Name2 - { - public string Value { get; set; } - } - - public class SoftwareInfo - { - public string Value { get; set; } - } - - public class Status6 - { - public string Value { get; set; } - } - - public class Type2 - { - public string Value { get; set; } - } - - public class UpgradeStatus - { - public string Value { get; set; } - } - - public class ConnectedDevice - { - public string id { get; set; } - public HardwareInfo HardwareInfo { get; set; } - public ID2 ID { get; set; } - public Name2 Name { get; set; } - public SoftwareInfo SoftwareInfo { get; set; } - public Status6 Status { get; set; } - public Type2 Type { get; set; } - public UpgradeStatus UpgradeStatus { get; set; } - } - - public class Peripherals - { - public List ConnectedDevice { get; set; } - } - - public class Enabled - { - public string Value { get; set; } - } - - public class LastLoggedInUserId - { - public string Value { get; set; } - } - - public class LoggedIn - { - public string Value { get; set; } - } - - public class ExtensionMobility - { - public Enabled Enabled { get; set; } - public LastLoggedInUserId LastLoggedInUserId { get; set; } - public LoggedIn LoggedIn { get; set; } - } - - public class CUCM - { - public ExtensionMobility ExtensionMobility { get; set; } - } - - public class CompletedAt - { - public string Value { get; set; } - } - - public class URL2 - { - public string Value { get; set; } - } - - public class VersionId - { - public string Value { get; set; } - } - - public class Current2 - { - public CompletedAt CompletedAt { get; set; } - public URL2 URL { get; set; } - public VersionId VersionId { get; set; } - } - - public class LastChange - { - public string Value { get; set; } - } - - public class Message2 - { - public string Value { get; set; } - } - - public class Phase - { - public string Value { get; set; } - } - - public class SessionId - { - public string Value { get; set; } - } - - public class Status7 - { - public string Value { get; set; } - } - - public class URL3 - { - public string Value { get; set; } - } - - public class VersionId2 - { - public string Value { get; set; } - } - - public class UpgradeStatus2 - { - public LastChange LastChange { get; set; } - public Message2 Message { get; set; } - public Phase Phase { get; set; } - public SessionId SessionId { get; set; } - public Status7 Status { get; set; } - public URL3 URL { get; set; } - public VersionId2 VersionId { get; set; } - } - - public class Software - { - public Current2 Current { get; set; } - public UpgradeStatus2 UpgradeStatus { get; set; } - } - - public class Status8 - { - public string Value { get; set; } - } - - public class Provisioning - { - public CUCM CUCM { get; set; } - public Software Software { get; set; } - public Status8 Status { get; set; } - } - - public class Availability2 - { - public string Value { get; set; } - } - - public class Services - { - public Availability2 Availability { get; set; } - } - - public class Proximity - { - public Services Services { get; set; } - } - - public class Current3 : ValueProperty - { - string _Value; - - /// - /// Sets Value and triggers the action when set - /// - public string Value - { - get - { - return _Value; - } - set - { - _Value = value; - OnValueChanged(); - } - } - - /// - /// Converted value of _Value for use as feedback - /// - public int IntValue - { - get - { - if (!string.IsNullOrEmpty(_Value)) - return Convert.ToInt32(_Value); - else - return 0; - } - } - } - - public class PeopleCount - { - public Current3 Current { get; set; } - - public PeopleCount() - { - Current = new Current3(); - } - } - - public class PeoplePresence : ValueProperty - { - public bool BoolValue { get; private set; } - - public string Value - { - set - { - // If the incoming value is "Yes" it sets the BoolValue true, otherwise sets it false - BoolValue = value == "Yes"; - OnValueChanged(); - } - } - } - - public class RoomAnalytics - { - public PeopleCount PeopleCount { get; set; } - public PeoplePresence PeoplePresence { get; set; } - - public RoomAnalytics() - { - PeopleCount = new PeopleCount(); - PeoplePresence = new PeoplePresence(); - } - } - - public class Primary - { - public URI URI { get; set; } - - public Primary() - { - URI = new URI(); - } - } - - public class AlternateURI - { - public Primary Primary { get; set; } - - public AlternateURI() - { - Primary = new Primary(); - } - } - - public class Authentication - { - public string Value { get; set; } - } - - public class DisplayName - { - public string Value { get; set; } - } - - public class Mode6 - { - public string Value { get; set; } - } - - public class URI - { - public string Value { get; set; } - } - - public class CallForward - { - public DisplayName DisplayName { get; set; } - public Mode6 Mode { get; set; } - public URI URI { get; set; } - } - - public class MessagesWaiting - { - public string Value { get; set; } - } - - public class URI2 - { - public string Value { get; set; } - } - - public class Mailbox - { - public MessagesWaiting MessagesWaiting { get; set; } - public URI2 URI { get; set; } - } - - public class Address7 - { - public string Value { get; set; } - } - - public class Status9 - { - public string Value { get; set; } - } - - public class Proxy - { - public string id { get; set; } - public Address7 Address { get; set; } - public Status9 Status { get; set; } - } - - public class Reason3 - { - public string Value { get; set; } - } - - public class Status10 - { - public string Value { get; set; } - } - - public class URI3 - { - public string Value { get; set; } - } - - public class Registration - { - public string id { get; set; } - public Reason3 Reason { get; set; } - public Status10 Status { get; set; } - public URI3 URI { get; set; } - - public Registration() - { - URI = new URI3(); - } - } - - public class Secure - { - public string Value { get; set; } - } - - public class Verified - { - public string Value { get; set; } - } - - public class SIP - { - public AlternateURI AlternateURI { get; set; } - public Authentication Authentication { get; set; } - public CallForward CallForward { get; set; } - public Mailbox Mailbox { get; set; } - public List Proxy { get; set; } - public List Registration { get; set; } - public Secure Secure { get; set; } - public Verified Verified { get; set; } - - public SIP() - { - AlternateURI = new AlternateURI(); - Registration = new List(); - } - } - - public class Mode7 - { - public string Value { get; set; } - } - - public class FIPS - { - public Mode7 Mode { get; set; } - } - - public class CallHistory - { - public string Value { get; set; } - } - - public class Configurations - { - public string Value { get; set; } - } - - public class DHCP - { - public string Value { get; set; } - } - - public class InternalLogging - { - public string Value { get; set; } - } - - public class LocalPhonebook - { - public string Value { get; set; } - } - - public class Persistency - { - public CallHistory CallHistory { get; set; } - public Configurations Configurations { get; set; } - public DHCP DHCP { get; set; } - public InternalLogging InternalLogging { get; set; } - public LocalPhonebook LocalPhonebook { get; set; } - } - - public class Security - { - public FIPS FIPS { get; set; } - public Persistency Persistency { get; set; } - } - - public class State : ValueProperty - { - string _value; - - public bool BoolValue { get; private set; } - - public string Value // Valid values are Standby/EnteringStandby/Halfwake/Off - { - get { return _value; } - set - { - _value = value; - // If the incoming value is "On" it sets the BoolValue true, otherwise sets it false - BoolValue = value == "On" || value == "Standby"; - OnValueChanged(); - } - } - } - - public class Standby - { - public State State { get; set; } - - public Standby() - { - State = new State(); - } - } - - public class CompatibilityLevel - { - public string Value { get; set; } - } - - public class SerialNumber - { - public string Value { get; set; } - } - - public class Module - { - public CompatibilityLevel CompatibilityLevel { get; set; } - public SerialNumber SerialNumber { get; set; } - } - - public class Hardware - { - public Module Module { get; set; } - } - - public class ProductId - { - public string Value { get; set; } - } - - public class ProductPlatform - { - public string Value { get; set; } - } - - public class ProductType - { - public string Value { get; set; } - } - - public class DisplayName2 - { - public string Value { get; set; } - } - - public class Name3 - { - public string Value { get; set; } - } - - public class Encryption - { - public string Value { get; set; } - } - - public class MultiSite - { - public string Value { get; set; } - } - - public class RemoteMonitoring - { - public string Value { get; set; } - } - - public class OptionKeys - { - public Encryption Encryption { get; set; } - public MultiSite MultiSite { get; set; } - public RemoteMonitoring RemoteMonitoring { get; set; } - - public OptionKeys() - { - MultiSite = new MultiSite(); - } - } - - public class ReleaseDate - { - public string Value { get; set; } - } - - public class Version2 - { - public string Value { get; set; } - } - - public class Software2 - { - public DisplayName2 DisplayName { get; set; } - public Name3 Name { get; set; } - public OptionKeys OptionKeys { get; set; } - public ReleaseDate ReleaseDate { get; set; } - public Version2 Version { get; set; } - - public Software2() - { - OptionKeys = new OptionKeys(); - } - } - - public class NumberOfActiveCalls - { - public string Value { get; set; } - } - - public class NumberOfInProgressCalls - { - public string Value { get; set; } - } - - public class NumberOfSuspendedCalls - { - public string Value { get; set; } - } - - public class State2 - { - public NumberOfActiveCalls NumberOfActiveCalls { get; set; } - public NumberOfInProgressCalls NumberOfInProgressCalls { get; set; } - public NumberOfSuspendedCalls NumberOfSuspendedCalls { get; set; } - } - - public class Uptime - { - public string Value { get; set; } - } - - public class SystemUnit - { - public Hardware Hardware { get; set; } - public ProductId ProductId { get; set; } - public ProductPlatform ProductPlatform { get; set; } - public ProductType ProductType { get; set; } - public Software2 Software { get; set; } - public State2 State { get; set; } - public Uptime Uptime { get; set; } - - public SystemUnit() - { - Software = new Software2(); - } - } - - public class SystemTime - { - public DateTime Value { get; set; } - } - - public class Time - { - public SystemTime SystemTime { get; set; } - } - - public class Number - { - public string Value { get; set; } - } - - public class ContactMethod - { - public string id { get; set; } - public Number Number { get; set; } - } - - public class Name4 - { - public string Value { get; set; } - } - - public class ContactInfo - { - public List ContactMethod { get; set; } - public Name4 Name { get; set; } - } - - public class UserInterface - { - public ContactInfo ContactInfo { get; set; } - } - - public class PIPPosition - { - public string Value { get; set; } - } - - public class ActiveSpeaker2 - { - public PIPPosition PIPPosition { get; set; } - } - - public class Connected2 - { - public string Value { get; set; } - } - - public class SignalState - { - public string Value { get; set; } - } - - public class SourceId - { - public string Value { get; set; } - } - - public class Type3 - { - public string Value { get; set; } - } - - public class Connector - { - public string id { get; set; } - public Connected2 Connected { get; set; } - public SignalState SignalState { get; set; } - public SourceId SourceId { get; set; } - public Type3 Type { get; set; } - } - - public class MainVideoSource - { - public string Value { get; set; } - } - - public class MainVideoMute : ValueProperty - { - public bool BoolValue { get; private set; } - - public string Value - { - set - { - // If the incoming value is "On" it sets the BoolValue true, otherwise sets it false - BoolValue = value == "On"; - OnValueChanged(); - } - } - - } - - public class ConnectorId - { - public string Value { get; set; } - } - - public class FormatStatus - { - public string Value { get; set; } - } - - public class FormatType - { - public string Value { get; set; } - } - - public class MediaChannelId - { - public string Value { get; set; } - } - - public class Height - { - public string Value { get; set; } - } - - public class RefreshRate - { - public string Value { get; set; } - } - - public class Width - { - public string Value { get; set; } - } - - public class Resolution - { - public Height Height { get; set; } - public RefreshRate RefreshRate { get; set; } - public Width Width { get; set; } - } - - public class Source - { - public string id { get; set; } - public ConnectorId ConnectorId { get; set; } - public FormatStatus FormatStatus { get; set; } - public FormatType FormatType { get; set; } - public MediaChannelId MediaChannelId { get; set; } - public Resolution Resolution { get; set; } - } - - public class Input2 - { - public List Connector { get; set; } - public MainVideoSource MainVideoSource { get; set; } - public MainVideoMute MainVideoMute { get; set; } - public List Source { get; set; } - - public Input2() - { - MainVideoMute = new MainVideoMute(); - } - } - - public class Local : ValueProperty - { - string _Value; - - public string Value // Valid values are On/Off - { - get - { - return _Value; - } - set - { - _Value = value; - OnValueChanged(); - } - } - } - - public class LayoutFamily - { - public Local Local { get; set; } - - public LayoutFamily() - { - Local = new Local(); - } - } - - public class Layout - { - public LayoutFamily LayoutFamily { get; set; } - - public Layout() - { - LayoutFamily = new LayoutFamily(); - } - } - - public class Monitors - { - public string Value { get; set; } - } - - public class Connected3 - { - public string Value { get; set; } - } - - public class Name5 - { - public string Value { get; set; } - } - - public class PreferredFormat - { - public string Value { get; set; } - } - - public class ConnectedDevice2 - { - public Name5 Name { get; set; } - public PreferredFormat PreferredFormat { get; set; } - } - - public class MonitorRole - { - public string Value { get; set; } - } - - public class Height2 - { - public string Value { get; set; } - } - - public class RefreshRate2 - { - public string Value { get; set; } - } - - public class Width2 - { - public string Value { get; set; } - } - - public class Resolution2 - { - public Height2 Height { get; set; } - public RefreshRate2 RefreshRate { get; set; } - public Width2 Width { get; set; } - } - - public class Type4 - { - public string Value { get; set; } - } - - public class Connector2 - { - public string id { get; set; } - public Connected3 Connected { get; set; } - public ConnectedDevice2 ConnectedDevice { get; set; } - public MonitorRole MonitorRole { get; set; } - public Resolution2 Resolution { get; set; } - public Type4 Type { get; set; } - } - - public class Output2 - { - public List Connector { get; set; } - } - - public class PIPPosition2 - { - public string Value { get; set; } - } - - public class Presentation2 - { - public PIPPosition2 PIPPosition { get; set; } - } - - public class FullscreenMode - { - public string Value { get; set; } - } - - public class Mode8 : ValueProperty - { - public bool BoolValue { get; private set; } - - public string Value // Valid values are On/Off - { - set - { - // If the incoming value is "On" it sets the BoolValue true, otherwise sets it false - BoolValue = value == "On"; - OnValueChanged(); - } - } - } - - - public class OnMonitorRole - { - public string Value { get; set; } - } - - public class PIPPosition3 : ValueProperty - { - string _Value; - - public string Value - { - get - { - return _Value; - } - set - { - _Value = value; - OnValueChanged(); - } - } - } - - public class Selfview - { - public FullscreenMode FullscreenMode { get; set; } - public Mode8 Mode { get; set; } - public OnMonitorRole OnMonitorRole { get; set; } - public PIPPosition3 PIPPosition { get; set; } - - public Selfview() - { - Mode = new Mode8(); - PIPPosition = new PIPPosition3(); - } - } - - public class Video - { - public ActiveSpeaker2 ActiveSpeaker { get; set; } - public Input2 Input { get; set; } - public Layout Layout { get; set; } - public Monitors Monitors { get; set; } - public Output2 Output { get; set; } - public Presentation2 Presentation { get; set; } - public Selfview Selfview { get; set; } - - public Video() - { - Selfview = new Selfview(); - Layout = new Layout(); - Input = new Input2(); - } - } - - public class AnswerState - { - public string Value { get; set; } - } - - public class CallType - { - public string Value { get; set; } - } - - public class CallbackNumber - { - public string Value { get; set; } - } - - public class DeviceType - { - public string Value { get; set; } - } - - public class Direction - { - public string Value { get; set; } - } - - public class Duration : ValueProperty - { - private string _Value; - - public string Value - { - get - { - return _Value; - } - set - { - _Value = value; - OnValueChanged(); - } - } - - public TimeSpan DurationValue - { - get - { - return new TimeSpan(0, 0, Int32.Parse(_Value)); - } - } - } - - public class FacilityServiceId - { - public string Value { get; set; } - } - - public class HoldReason - { - public string Value { get; set; } - } - - public class PlacedOnHold : ValueProperty - { - public bool BoolValue { get; private set; } - - public string Value - { - set - { - // If the incoming value is "True" it sets the BoolValue true, otherwise sets it false - BoolValue = value == "True"; - OnValueChanged(); - } - } - } - - public class Protocol - { - public string Value { get; set; } - } - - public class ReceiveCallRate - { - public string Value { get; set; } - } - - public class RemoteNumber - { - public string Value { get; set; } - } - - public class TransmitCallRate - { - public string Value { get; set; } - } - - public class Call - { - public string id { get; set; } - public AnswerState AnswerState { get; set; } - public CallType CallType { get; set; } - public CallbackNumber CallbackNumber { get; set; } - public DeviceType DeviceType { get; set; } - public Direction Direction { get; set; } - public DisplayName DisplayName { get; set; } - public Duration Duration { get; set; } - public Encryption Encryption { get; set; } - public FacilityServiceId FacilityServiceId { get; set; } - public string ghost { get; set; } - public HoldReason HoldReason { get; set; } - public PlacedOnHold PlacedOnHold { get; set; } - public Protocol Protocol { get; set; } - public ReceiveCallRate ReceiveCallRate { get; set; } - public RemoteNumber RemoteNumber { get; set; } - public CallStatus Status { get; set; } - public TransmitCallRate TransmitCallRate { get; set; } - - public Call() - { - CallType = new CallType(); - Status = new CallStatus(); - Duration = new Duration(); - } - } - - public class Type5 - { - public string Value { get; set; } - } - - public class Description2 : ValueProperty - { - string _Value; - - public string Value - { - get - { - return _Value; - } - set - { - _Value = value; - OnValueChanged(); - } - } - } - - public class Defined : ValueProperty - { - public bool BoolValue { get; private set; } - - public string Value // Valid values are True/False - { - set - { - // If the incoming value is "True" it sets the BoolValue true, otherwise sets it false - BoolValue = value == "True"; - OnValueChanged(); - } - } - } - - public class RoomPreset : ConvertiblePreset - { - public string id { get; set; } - public Defined Defined { get; set; } - public Description2 Description { get; set; } - public Type5 Type { get; set; } - - public RoomPreset() - { - Defined = new Defined(); - Description = new Description2(); - Type = new Type5(); - } - - public override PresetBase ConvertCodecPreset() - { - try - { - var preset = new CodecRoomPreset(UInt16.Parse(id), Description.Value, Defined.BoolValue, true); - - Debug.Console(2, "Preset ID {0} Converted from Cisco Codec Preset to Essentials Preset"); - - return preset; - } - catch (Exception e) - { - Debug.Console(2, "Unable to convert preset: {0}. Error: {1}", id, e); - return null; - } - } -} - - - - public class Status - { - public Audio Audio { get; set; } - public Bookings Bookings { get; set; } - public List Call { get; set; } - public Cameras Cameras { get; set; } - public Capabilities2 Capabilities { get; set; } - public Conference2 Conference { get; set; } - public Diagnostics Diagnostics { get; set; } - public Experimental Experimental { get; set; } - public H323 H323 { get; set; } - public List HttpFeedback { get; set; } - public MediaChannels MediaChannels { get; set; } - public List Network { get; set; } - public NetworkServices NetworkServices { get; set; } - public Peripherals Peripherals { get; set; } - public Provisioning Provisioning { get; set; } - public Proximity Proximity { get; set; } - public RoomAnalytics RoomAnalytics { get; set; } - - public List RoomPreset { get; set; } - - public SIP SIP { get; set; } - public Security Security { get; set; } - public Standby Standby { get; set; } - public SystemUnit SystemUnit { get; set; } - public Time Time { get; set; } - public UserInterface UserInterface { get; set; } - public Video Video { get; set; } - - public Status() - { - Audio = new Audio(); - Call = new List(); - Standby = new Standby(); - Cameras = new Cameras(); - RoomAnalytics = new RoomAnalytics(); - RoomPreset = new List(); - Conference = new Conference2(); - SystemUnit = new SystemUnit(); - Video = new Video(); - Conference = new Conference2(); - Network = new List(); - } - } - - public class RootObject - { - public Status Status { get; set; } - - public RootObject() - { - Status = new Status(); - } - } - } -} diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/xStatusSparkPlus.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/xStatusSparkPlus.cs deleted file mode 100644 index 9f7bf0b6..00000000 --- a/src/PepperDash.Essentials.Devices.Common/VideoCodec/CiscoCodec/xStatusSparkPlus.cs +++ /dev/null @@ -1,1552 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -namespace PepperDash.Essentials.Devices.Common.VideoCodec.CiscoCodec -{ - public class xStatusSparkPlus - { - public class ConnectionStatus - { - public string Value { get; set; } - } - - public class EcReferenceDelay - { - public string Value { get; set; } - } - - public class Microphone - { - public string id { get; set; } - public ConnectionStatus ConnectionStatus { get; set; } - public EcReferenceDelay EcReferenceDelay { get; set; } - } - - public class Connectors - { - public List Microphone { get; set; } - } - - public class Input - { - public Connectors Connectors { get; set; } - } - - public class Mute - { - public string Value { get; set; } - } - - public class Microphones - { - public Mute Mute { get; set; } - } - - public class ConnectionStatus2 - { - public string Value { get; set; } - } - - public class DelayMs - { - public string Value { get; set; } - } - - public class Line - { - public string id { get; set; } - public ConnectionStatus2 ConnectionStatus { get; set; } - public DelayMs DelayMs { get; set; } - } - - public class Connectors2 - { - public List Line { get; set; } - } - - public class Output - { - public Connectors2 Connectors { get; set; } - } - - public class Volume - { - public string Value { get; set; } - } - - public class VolumeMute - { - public string Value { get; set; } - } - - public class Audio - { - public Input Input { get; set; } - public Microphones Microphones { get; set; } - public Output Output { get; set; } - public Volume Volume { get; set; } - public VolumeMute VolumeMute { get; set; } - } - - public class Id - { - public string Value { get; set; } - } - - public class Current - { - public Id Id { get; set; } - } - - public class Bookings - { - public Current Current { get; set; } - } - - public class Options - { - public string Value { get; set; } - } - - public class Capabilities - { - public Options Options { get; set; } - } - - public class Connected - { - public string Value { get; set; } - } - - public class Flip - { - public string Value { get; set; } - } - - public class HardwareID - { - public string Value { get; set; } - } - - public class MacAddress - { - public string Value { get; set; } - } - - public class Manufacturer - { - public string Value { get; set; } - } - - public class Model - { - public string Value { get; set; } - } - - public class Pan - { - public string Value { get; set; } - } - - public class Tilt - { - public string Value { get; set; } - } - - public class Zoom - { - public string Value { get; set; } - } - - public class Position - { - public Pan Pan { get; set; } - public Tilt Tilt { get; set; } - public Zoom Zoom { get; set; } - } - - public class SerialNumber - { - public string Value { get; set; } - } - - public class SoftwareID - { - public string Value { get; set; } - } - - public class Camera - { - public string id { get; set; } - public Capabilities Capabilities { get; set; } - public Connected Connected { get; set; } - public Flip Flip { get; set; } - public HardwareID HardwareID { get; set; } - public MacAddress MacAddress { get; set; } - public Manufacturer Manufacturer { get; set; } - public Model Model { get; set; } - public Position Position { get; set; } - public SerialNumber SerialNumber { get; set; } - public SoftwareID SoftwareID { get; set; } - } - - public class Availability - { - public string Value { get; set; } - } - - public class Status2 - { - public string Value { get; set; } - } - - public class SpeakerTrack - { - public Availability Availability { get; set; } - public Status2 Status { get; set; } - } - - public class Cameras - { - public List Camera { get; set; } - public SpeakerTrack SpeakerTrack { get; set; } - } - - public class MaxActiveCalls - { - public string Value { get; set; } - } - - public class MaxAudioCalls - { - public string Value { get; set; } - } - - public class MaxCalls - { - public string Value { get; set; } - } - - public class MaxVideoCalls - { - public string Value { get; set; } - } - - public class Conference - { - public MaxActiveCalls MaxActiveCalls { get; set; } - public MaxAudioCalls MaxAudioCalls { get; set; } - public MaxCalls MaxCalls { get; set; } - public MaxVideoCalls MaxVideoCalls { get; set; } - } - - public class Capabilities2 - { - public Conference Conference { get; set; } - } - - public class CallId - { - public string Value { get; set; } - } - - public class ActiveSpeaker - { - public CallId CallId { get; set; } - } - - public class DoNotDisturb - { - public string Value { get; set; } - } - - public class Mode - { - public string Value { get; set; } - } - - public class Line2 - { - public string id { get; set; } - public Mode Mode { get; set; } - } - - public class Mode2 - { - public string Value { get; set; } - } - - public class Multipoint - { - public Mode2 Mode { get; set; } - } - - public class CallId2 - { - public string Value { get; set; } - } - - public class SendingMode - { - public string Value { get; set; } - } - - public class Source - { - public string Value { get; set; } - } - - public class LocalInstance - { - public string id { get; set; } - public SendingMode SendingMode { get; set; } - public Source Source { get; set; } - } - - public class Mode3 - { - public string Value { get; set; } - } - - public class Mode4 - { - public string Value { get; set; } - } - - public class ReleaseFloorAvailability - { - public string Value { get; set; } - } - - public class RequestFloorAvailability - { - public string Value { get; set; } - } - - public class Whiteboard - { - public Mode4 Mode { get; set; } - public ReleaseFloorAvailability ReleaseFloorAvailability { get; set; } - public RequestFloorAvailability RequestFloorAvailability { get; set; } - } - - public class Presentation - { - public CallId2 CallId { get; set; } - public List LocalInstance { get; set; } - public Mode3 Mode { get; set; } - public Whiteboard Whiteboard { get; set; } - } - - public class CallId3 - { - public string Value { get; set; } - } - - public class Mode5 - { - public string Value { get; set; } - } - - public class SpeakerLock - { - public CallId3 CallId { get; set; } - public Mode5 Mode { get; set; } - } - - public class Conference2 - { - public ActiveSpeaker ActiveSpeaker { get; set; } - public DoNotDisturb DoNotDisturb { get; set; } - public List Line { get; set; } - public Multipoint Multipoint { get; set; } - public Presentation Presentation { get; set; } - public SpeakerLock SpeakerLock { get; set; } - } - - public class Conference3 - { - } - - public class Experimental - { - public Conference3 Conference { get; set; } - } - - public class Address - { - public string Value { get; set; } - } - - public class Port - { - public string Value { get; set; } - } - - public class Reason - { - public string Value { get; set; } - } - - public class Status3 - { - public string Value { get; set; } - } - - public class Gatekeeper - { - public Address Address { get; set; } - public Port Port { get; set; } - public Reason Reason { get; set; } - public Status3 Status { get; set; } - } - - public class Reason2 - { - public string Value { get; set; } - } - - public class Status4 - { - public string Value { get; set; } - } - - public class Mode6 - { - public Reason2 Reason { get; set; } - public Status4 Status { get; set; } - } - - public class H323 - { - public Gatekeeper Gatekeeper { get; set; } - public Mode6 Mode { get; set; } - } - - public class Expression - { - public string id { get; set; } - public string Value { get; set; } - } - - public class Format - { - public string Value { get; set; } - } - - public class URL - { - public string Value { get; set; } - } - - public class HttpFeedback - { - public string id { get; set; } - public List Expression { get; set; } - public Format Format { get; set; } - public URL URL { get; set; } - } - - public class MediaChannels - { - } - - public class Address2 - { - public string Value { get; set; } - } - - public class Capabilities3 - { - public string Value { get; set; } - } - - public class DeviceId - { - public string Value { get; set; } - } - - public class Duplex - { - public string Value { get; set; } - } - - public class Platform - { - public string Value { get; set; } - } - - public class PortID - { - public string Value { get; set; } - } - - public class PrimaryMgmtAddress - { - public string Value { get; set; } - } - - public class SysName - { - public string Value { get; set; } - } - - public class SysObjectID - { - public string Value { get; set; } - } - - public class VTPMgmtDomain - { - public string Value { get; set; } - } - - public class Version - { - public string Value { get; set; } - } - - public class VoIPApplianceVlanID - { - public string Value { get; set; } - } - - public class CDP - { - public Address2 Address { get; set; } - public Capabilities3 Capabilities { get; set; } - public DeviceId DeviceId { get; set; } - public Duplex Duplex { get; set; } - public Platform Platform { get; set; } - public PortID PortID { get; set; } - public PrimaryMgmtAddress PrimaryMgmtAddress { get; set; } - public SysName SysName { get; set; } - public SysObjectID SysObjectID { get; set; } - public VTPMgmtDomain VTPMgmtDomain { get; set; } - public Version Version { get; set; } - public VoIPApplianceVlanID VoIPApplianceVlanID { get; set; } - } - - public class Name - { - public string Value { get; set; } - } - - public class Domain - { - public Name Name { get; set; } - } - - public class Address3 - { - public string Value { get; set; } - } - - public class Server - { - public string id { get; set; } - public Address3 Address { get; set; } - } - - public class DNS - { - public Domain Domain { get; set; } - public List Server { get; set; } - } - - public class MacAddress2 - { - public string Value { get; set; } - } - - public class Speed - { - public string Value { get; set; } - } - - public class Ethernet - { - public MacAddress2 MacAddress { get; set; } - public Speed Speed { get; set; } - } - - public class Address4 - { - public string Value { get; set; } - } - - public class Gateway - { - public string Value { get; set; } - } - - public class SubnetMask - { - public string Value { get; set; } - } - - public class IPv4 - { - public Address4 Address { get; set; } - public Gateway Gateway { get; set; } - public SubnetMask SubnetMask { get; set; } - } - - public class Address5 - { - public string Value { get; set; } - } - - public class Gateway2 - { - public string Value { get; set; } - } - - public class IPv6 - { - public Address5 Address { get; set; } - public Gateway2 Gateway { get; set; } - } - - public class VlanId - { - public string Value { get; set; } - } - - public class Voice - { - public VlanId VlanId { get; set; } - } - - public class VLAN - { - public Voice Voice { get; set; } - } - - public class Network - { - public string id { get; set; } - public CDP CDP { get; set; } - public DNS DNS { get; set; } - public Ethernet Ethernet { get; set; } - public IPv4 IPv4 { get; set; } - public IPv6 IPv6 { get; set; } - public VLAN VLAN { get; set; } - } - - public class CurrentAddress - { - public string Value { get; set; } - } - - public class Address6 - { - public string Value { get; set; } - } - - public class Server2 - { - public string id { get; set; } - public Address6 Address { get; set; } - } - - public class Status5 - { - public string Value { get; set; } - } - - public class NTP - { - public CurrentAddress CurrentAddress { get; set; } - public List Server { get; set; } - public Status5 Status { get; set; } - } - - public class NetworkServices - { - public NTP NTP { get; set; } - } - - public class HardwareInfo - { - public string Value { get; set; } - } - - public class ID2 - { - public string Value { get; set; } - } - - public class Name2 - { - public string Value { get; set; } - } - - public class SoftwareInfo - { - public string Value { get; set; } - } - - public class Status6 - { - public string Value { get; set; } - } - - public class Type - { - public string Value { get; set; } - } - - public class UpgradeStatus - { - public string Value { get; set; } - } - - public class ConnectedDevice - { - public string id { get; set; } - public HardwareInfo HardwareInfo { get; set; } - public ID2 ID { get; set; } - public Name2 Name { get; set; } - public SoftwareInfo SoftwareInfo { get; set; } - public Status6 Status { get; set; } - public Type Type { get; set; } - public UpgradeStatus UpgradeStatus { get; set; } - } - - public class Peripherals - { - public List ConnectedDevice { get; set; } - } - - public class Enabled - { - public string Value { get; set; } - } - - public class LastLoggedInUserId - { - public string Value { get; set; } - } - - public class LoggedIn - { - public string Value { get; set; } - } - - public class ExtensionMobility - { - public Enabled Enabled { get; set; } - public LastLoggedInUserId LastLoggedInUserId { get; set; } - public LoggedIn LoggedIn { get; set; } - } - - public class CUCM - { - public ExtensionMobility ExtensionMobility { get; set; } - } - - public class CompletedAt - { - public string Value { get; set; } - } - - public class URL2 - { - public string Value { get; set; } - } - - public class VersionId - { - public string Value { get; set; } - } - - public class Current2 - { - public CompletedAt CompletedAt { get; set; } - public URL2 URL { get; set; } - public VersionId VersionId { get; set; } - } - - public class LastChange - { - public string Value { get; set; } - } - - public class Message - { - public string Value { get; set; } - } - - public class Phase - { - public string Value { get; set; } - } - - public class SessionId - { - public string Value { get; set; } - } - - public class Status7 - { - public string Value { get; set; } - } - - public class URL3 - { - public string Value { get; set; } - } - - public class VersionId2 - { - public string Value { get; set; } - } - - public class UpgradeStatus2 - { - public LastChange LastChange { get; set; } - public Message Message { get; set; } - public Phase Phase { get; set; } - public SessionId SessionId { get; set; } - public Status7 Status { get; set; } - public URL3 URL { get; set; } - public VersionId2 VersionId { get; set; } - } - - public class Software - { - public Current2 Current { get; set; } - public UpgradeStatus2 UpgradeStatus { get; set; } - } - - public class Status8 - { - public string Value { get; set; } - } - - public class Provisioning - { - public CUCM CUCM { get; set; } - public Software Software { get; set; } - public Status8 Status { get; set; } - } - - public class Availability2 - { - public string Value { get; set; } - } - - public class Services - { - public Availability2 Availability { get; set; } - } - - public class Proximity - { - public Services Services { get; set; } - } - - public class Current3 - { - public string Value { get; set; } - } - - public class PeopleCount - { - public Current3 Current { get; set; } - } - - public class PeoplePresence - { - public string Value { get; set; } - } - - public class RoomAnalytics - { - public PeopleCount PeopleCount { get; set; } - public PeoplePresence PeoplePresence { get; set; } - } - - public class URI - { - public string Value { get; set; } - } - - public class Primary - { - public URI URI { get; set; } - } - - public class AlternateURI - { - public Primary Primary { get; set; } - } - - public class Authentication - { - public string Value { get; set; } - } - - public class DisplayName - { - public string Value { get; set; } - } - - public class Mode7 - { - public string Value { get; set; } - } - - public class URI2 - { - public string Value { get; set; } - } - - public class CallForward - { - public DisplayName DisplayName { get; set; } - public Mode7 Mode { get; set; } - public URI2 URI { get; set; } - } - - public class MessagesWaiting - { - public string Value { get; set; } - } - - public class URI3 - { - public string Value { get; set; } - } - - public class Mailbox - { - public MessagesWaiting MessagesWaiting { get; set; } - public URI3 URI { get; set; } - } - - public class Address7 - { - public string Value { get; set; } - } - - public class Status9 - { - public string Value { get; set; } - } - - public class Proxy - { - public string id { get; set; } - public Address7 Address { get; set; } - public Status9 Status { get; set; } - } - - public class Reason3 - { - public string Value { get; set; } - } - - public class Status10 - { - public string Value { get; set; } - } - - public class URI4 - { - public string Value { get; set; } - } - - public class Registration - { - public string id { get; set; } - public Reason3 Reason { get; set; } - public Status10 Status { get; set; } - public URI4 URI { get; set; } - } - - public class Secure - { - public string Value { get; set; } - } - - public class Verified - { - public string Value { get; set; } - } - - public class SIP - { - public AlternateURI AlternateURI { get; set; } - public Authentication Authentication { get; set; } - public CallForward CallForward { get; set; } - public Mailbox Mailbox { get; set; } - public List Proxy { get; set; } - public List Registration { get; set; } - public Secure Secure { get; set; } - public Verified Verified { get; set; } - } - - public class Mode8 - { - public string Value { get; set; } - } - - public class FIPS - { - public Mode8 Mode { get; set; } - } - - public class CallHistory - { - public string Value { get; set; } - } - - public class Configurations - { - public string Value { get; set; } - } - - public class DHCP - { - public string Value { get; set; } - } - - public class InternalLogging - { - public string Value { get; set; } - } - - public class LocalPhonebook - { - public string Value { get; set; } - } - - public class Persistency - { - public CallHistory CallHistory { get; set; } - public Configurations Configurations { get; set; } - public DHCP DHCP { get; set; } - public InternalLogging InternalLogging { get; set; } - public LocalPhonebook LocalPhonebook { get; set; } - } - - public class Security - { - public FIPS FIPS { get; set; } - public Persistency Persistency { get; set; } - } - - public class State - { - public string Value { get; set; } - } - - public class Standby - { - public State State { get; set; } - } - - public class CompatibilityLevel - { - public string Value { get; set; } - } - - public class SerialNumber2 - { - public string Value { get; set; } - } - - public class Module - { - public CompatibilityLevel CompatibilityLevel { get; set; } - public SerialNumber2 SerialNumber { get; set; } - } - - public class Hardware - { - public Module Module { get; set; } - } - - public class ProductId - { - public string Value { get; set; } - } - - public class ProductPlatform - { - public string Value { get; set; } - } - - public class ProductType - { - public string Value { get; set; } - } - - public class DisplayName2 - { - public string Value { get; set; } - } - - public class Name3 - { - public string Value { get; set; } - } - - public class Encryption - { - public string Value { get; set; } - } - - public class MultiSite - { - public string Value { get; set; } - } - - public class RemoteMonitoring - { - public string Value { get; set; } - } - - public class OptionKeys - { - public Encryption Encryption { get; set; } - public MultiSite MultiSite { get; set; } - public RemoteMonitoring RemoteMonitoring { get; set; } - } - - public class ReleaseDate - { - public string Value { get; set; } - } - - public class Version2 - { - public string Value { get; set; } - } - - public class Software2 - { - public DisplayName2 DisplayName { get; set; } - public Name3 Name { get; set; } - public OptionKeys OptionKeys { get; set; } - public ReleaseDate ReleaseDate { get; set; } - public Version2 Version { get; set; } - } - - public class NumberOfActiveCalls - { - public string Value { get; set; } - } - - public class NumberOfInProgressCalls - { - public string Value { get; set; } - } - - public class NumberOfSuspendedCalls - { - public string Value { get; set; } - } - - public class State2 - { - public NumberOfActiveCalls NumberOfActiveCalls { get; set; } - public NumberOfInProgressCalls NumberOfInProgressCalls { get; set; } - public NumberOfSuspendedCalls NumberOfSuspendedCalls { get; set; } - } - - public class Uptime - { - public string Value { get; set; } - } - - public class SystemUnit - { - public Hardware Hardware { get; set; } - public ProductId ProductId { get; set; } - public ProductPlatform ProductPlatform { get; set; } - public ProductType ProductType { get; set; } - public Software2 Software { get; set; } - public State2 State { get; set; } - public Uptime Uptime { get; set; } - } - - public class SystemTime - { - public DateTime Value { get; set; } - } - - public class Time - { - public SystemTime SystemTime { get; set; } - } - - public class Number - { - public string Value { get; set; } - } - - public class ContactMethod - { - public string id { get; set; } - public Number Number { get; set; } - } - - public class Name4 - { - public string Value { get; set; } - } - - public class ContactInfo - { - public List ContactMethod { get; set; } - public Name4 Name { get; set; } - } - - public class UserInterface - { - public ContactInfo ContactInfo { get; set; } - } - - public class PIPPosition - { - public string Value { get; set; } - } - - public class ActiveSpeaker2 - { - public PIPPosition PIPPosition { get; set; } - } - - public class Connected2 - { - public string Value { get; set; } - } - - public class DeviceType - { - public string Value { get; set; } - } - - public class Name5 - { - public string Value { get; set; } - } - - public class PowerStatus - { - public string Value { get; set; } - } - - public class VendorId - { - public string Value { get; set; } - } - - public class CEC - { - public string id { get; set; } - public DeviceType DeviceType { get; set; } - public Name5 Name { get; set; } - public PowerStatus PowerStatus { get; set; } - public VendorId VendorId { get; set; } - } - - public class ConnectedDevice2 - { - public List CEC { get; set; } - } - - public class SignalState - { - public string Value { get; set; } - } - - public class SourceId - { - public string Value { get; set; } - } - - public class Type2 - { - public string Value { get; set; } - } - - public class Connector - { - public string id { get; set; } - public Connected2 Connected { get; set; } - public ConnectedDevice2 ConnectedDevice { get; set; } - public SignalState SignalState { get; set; } - public SourceId SourceId { get; set; } - public Type2 Type { get; set; } - } - - public class MainVideoSource - { - public string Value { get; set; } - } - - public class ConnectorId - { - public string Value { get; set; } - } - - public class FormatStatus - { - public string Value { get; set; } - } - - public class FormatType - { - public string Value { get; set; } - } - - public class MediaChannelId - { - public string Value { get; set; } - } - - public class Height - { - public string Value { get; set; } - } - - public class RefreshRate - { - public string Value { get; set; } - } - - public class Width - { - public string Value { get; set; } - } - - public class Resolution - { - public Height Height { get; set; } - public RefreshRate RefreshRate { get; set; } - public Width Width { get; set; } - } - - public class Source2 - { - public string id { get; set; } - public ConnectorId ConnectorId { get; set; } - public FormatStatus FormatStatus { get; set; } - public FormatType FormatType { get; set; } - public MediaChannelId MediaChannelId { get; set; } - public Resolution Resolution { get; set; } - } - - public class Input2 - { - public List Connector { get; set; } - public MainVideoSource MainVideoSource { get; set; } - public List Source { get; set; } - } - - public class Local - { - public string Value { get; set; } - } - - public class LayoutFamily - { - public Local Local { get; set; } - } - - public class Layout - { - public LayoutFamily LayoutFamily { get; set; } - } - - public class Monitors - { - public string Value { get; set; } - } - - public class Connected3 - { - public string Value { get; set; } - } - - public class DeviceType2 - { - public string Value { get; set; } - } - - public class Name6 - { - public string Value { get; set; } - } - - public class PowerStatus2 - { - public string Value { get; set; } - } - - public class VendorId2 - { - public string Value { get; set; } - } - - public class CEC2 - { - public string id { get; set; } - public DeviceType2 DeviceType { get; set; } - public Name6 Name { get; set; } - public PowerStatus2 PowerStatus { get; set; } - public VendorId2 VendorId { get; set; } - } - - public class Name7 - { - public string Value { get; set; } - } - - public class PreferredFormat - { - public string Value { get; set; } - } - - public class ConnectedDevice3 - { - public List CEC { get; set; } - public Name7 Name { get; set; } - public PreferredFormat PreferredFormat { get; set; } - } - - public class MonitorRole - { - public string Value { get; set; } - } - - public class Height2 - { - public string Value { get; set; } - } - - public class RefreshRate2 - { - public string Value { get; set; } - } - - public class Width2 - { - public string Value { get; set; } - } - - public class Resolution2 - { - public Height2 Height { get; set; } - public RefreshRate2 RefreshRate { get; set; } - public Width2 Width { get; set; } - } - - public class Type3 - { - public string Value { get; set; } - } - - public class Connector2 - { - public string id { get; set; } - public Connected3 Connected { get; set; } - public ConnectedDevice3 ConnectedDevice { get; set; } - public MonitorRole MonitorRole { get; set; } - public Resolution2 Resolution { get; set; } - public Type3 Type { get; set; } - } - - public class Output2 - { - public List Connector { get; set; } - } - - public class PIPPosition2 - { - public string Value { get; set; } - } - - public class Presentation2 - { - public PIPPosition2 PIPPosition { get; set; } - } - - public class FullscreenMode - { - public string Value { get; set; } - } - - public class Mode9 - { - public string Value { get; set; } - } - - public class OnMonitorRole - { - public string Value { get; set; } - } - - public class PIPPosition3 - { - public string Value { get; set; } - } - - public class Selfview - { - public FullscreenMode FullscreenMode { get; set; } - public Mode9 Mode { get; set; } - public OnMonitorRole OnMonitorRole { get; set; } - public PIPPosition3 PIPPosition { get; set; } - } - - public class Video - { - public ActiveSpeaker2 ActiveSpeaker { get; set; } - public Input2 Input { get; set; } - public Layout Layout { get; set; } - public Monitors Monitors { get; set; } - public Output2 Output { get; set; } - public Presentation2 Presentation { get; set; } - public Selfview Selfview { get; set; } - } - - public class Status - { - public Audio Audio { get; set; } - public Bookings Bookings { get; set; } - public Cameras Cameras { get; set; } - public Capabilities2 Capabilities { get; set; } - public Conference2 Conference { get; set; } - public Experimental Experimental { get; set; } - public H323 H323 { get; set; } - public List HttpFeedback { get; set; } - public MediaChannels MediaChannels { get; set; } - public List Network { get; set; } - public NetworkServices NetworkServices { get; set; } - public Peripherals Peripherals { get; set; } - public Provisioning Provisioning { get; set; } - public Proximity Proximity { get; set; } - public RoomAnalytics RoomAnalytics { get; set; } - public SIP SIP { get; set; } - public Security Security { get; set; } - public Standby Standby { get; set; } - public SystemUnit SystemUnit { get; set; } - public Time Time { get; set; } - public UserInterface UserInterface { get; set; } - public Video Video { get; set; } - } - - public class RootObject - { - public Status Status { get; set; } - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/Audio/EssentialsVolumeLevelConfig.cs b/src/PepperDash.Essentials/Audio/EssentialsVolumeLevelConfig.cs deleted file mode 100644 index c1b1cc2c..00000000 --- a/src/PepperDash.Essentials/Audio/EssentialsVolumeLevelConfig.cs +++ /dev/null @@ -1,29 +0,0 @@ -extern alias Full; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Devices.Common.DSP; -using System; -using System.Text.RegularExpressions; - -namespace PepperDash.Essentials -{ - /// - /// - /// - public class EssentialsRoomVolumesConfig - { - public EssentialsVolumeLevelConfig Master { get; set; } - public EssentialsVolumeLevelConfig Program { get; set; } - public EssentialsVolumeLevelConfig AudioCallRx { get; set; } - public EssentialsVolumeLevelConfig AudioCallTx { get; set; } - } - - /// - /// - /// - public class EssentialsVolumeLevelConfig - { - public string DeviceKey { get; set; } - public string Label { get; set; } - public int Level { get; set; } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/ControlSystem.cs b/src/PepperDash.Essentials/ControlSystem.cs index 09c95323..812c15bb 100644 --- a/src/PepperDash.Essentials/ControlSystem.cs +++ b/src/PepperDash.Essentials/ControlSystem.cs @@ -5,18 +5,12 @@ using Crestron.SimplSharp.Reflection; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.CrestronThread; using Crestron.SimplSharpPro.Diagnostics; -using Full.Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.DeviceTypeInterfaces; -using PepperDash.Essentials.Core.Fusion; -using PepperDash.Essentials.Devices.Common; -using PepperDash.Essentials.Fusion; -using PepperDash.Essentials.Room.Config; using System; -using System.Collections.Generic; using System.Linq; namespace PepperDash.Essentials @@ -492,63 +486,65 @@ namespace PepperDash.Essentials return; } - uint fusionIpId = 0xf1; + // uint fusionIpId = 0xf1; foreach (var roomConfig in ConfigReader.ConfigObject.Rooms) { - var room = EssentialsRoomConfigHelper.GetRoomObject(roomConfig) as IEssentialsRoom; - if (room != null) - { - // default to no join map key - string fusionJoinMapKey = string.Empty; - - if (room.Config.Properties["fusion"] != null) + /* + var room = EssentialsRoomConfigHelper.GetRoomObject(roomConfig) as IEssentialsRoom; + if (room != null) { - Debug.Console(2, "Custom Fusion config found. Using custom values"); + // default to no join map key + string fusionJoinMapKey = string.Empty; - var fusionConfig = room.Config.Properties["fusion"].ToObject(); - - if (fusionConfig != null) + if (room.Config.Properties["fusion"] != null) { - fusionIpId = fusionConfig.IpIdInt; - fusionJoinMapKey = fusionConfig.JoinMapKey; - } - } + Debug.Console(2, "Custom Fusion config found. Using custom values"); - AddRoomAndBuildMC(room); + var fusionConfig = room.Config.Properties["fusion"].ToObject(); - if (room is IEssentialsHuddleSpaceRoom) - { - - Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleSpaceRoom, attempting to add to DeviceManager with Fusion with IP-ID {0:X2}", fusionIpId); - DeviceManager.AddDevice(new Core.Fusion.EssentialsHuddleSpaceFusionSystemControllerBase(room, fusionIpId, fusionJoinMapKey)); - - } - else if (room is IEssentialsHuddleVtc1Room) - { - - if (!(room is EssentialsCombinedHuddleVtc1Room)) - { - Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleVtc1Room, attempting to add to DeviceManager with Fusion with IP-ID {0:X2}", fusionIpId); - DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController((IEssentialsHuddleVtc1Room)room, fusionIpId, fusionJoinMapKey)); + if (fusionConfig != null) + { + fusionIpId = fusionConfig.IpIdInt; + fusionJoinMapKey = fusionConfig.JoinMapKey; + } } + AddRoomAndBuildMC(room); + + if (room is IEssentialsHuddleSpaceRoom) + { + + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleSpaceRoom, attempting to add to DeviceManager with Fusion with IP-ID {0:X2}", fusionIpId); + DeviceManager.AddDevice(new Core.Fusion.EssentialsHuddleSpaceFusionSystemControllerBase(room, fusionIpId, fusionJoinMapKey)); + + } + else if (room is IEssentialsHuddleVtc1Room) + { + + if (!(room is EssentialsCombinedHuddleVtc1Room)) + { + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleVtc1Room, attempting to add to DeviceManager with Fusion with IP-ID {0:X2}", fusionIpId); + DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController((IEssentialsHuddleVtc1Room)room, fusionIpId, fusionJoinMapKey)); + } + + } + else if (room is EssentialsTechRoom) + { + + Debug.Console(0, Debug.ErrorLogLevel.Notice, + "Room is EssentialsTechRoom, Attempting to add to DeviceManager with Fusion with IP-ID {0:X2}", fusionIpId); + DeviceManager.AddDevice(new EssentialsTechRoomFusionSystemController((EssentialsTechRoom)room, fusionIpId, fusionJoinMapKey)); + + } + fusionIpId += 1; } - else if (room is EssentialsTechRoom) + else { - - Debug.Console(0, Debug.ErrorLogLevel.Notice, - "Room is EssentialsTechRoom, Attempting to add to DeviceManager with Fusion with IP-ID {0:X2}", fusionIpId); - DeviceManager.AddDevice(new EssentialsTechRoomFusionSystemController((EssentialsTechRoom)room, fusionIpId, fusionJoinMapKey)); + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Notice: Cannot create room from config, key '{0}' - Is this intentional? This may be a valid configuration.", roomConfig.Key); } - fusionIpId += 1; - } - else - { - Debug.Console(0, Debug.ErrorLogLevel.Notice, "Notice: Cannot create room from config, key '{0}' - Is this intentional? This may be a valid configuration.", roomConfig.Key); - - } + */ } Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Rooms Loaded."); diff --git a/src/PepperDash.Essentials/Devices/Amplifier.cs b/src/PepperDash.Essentials/Devices/Amplifier.cs deleted file mode 100644 index dc35de6b..00000000 --- a/src/PepperDash.Essentials/Devices/Amplifier.cs +++ /dev/null @@ -1,72 +0,0 @@ -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.Core.Routing; - -namespace PepperDash.Essentials -{ - public class Amplifier : EssentialsDevice, IRoutingSink - { - public event SourceInfoChangeHandler CurrentSourceChange; - - public string CurrentSourceInfoKey { get; set; } - public SourceListItem CurrentSourceInfo - { - get - { - return _CurrentSourceInfo; - } - set - { - if (value == _CurrentSourceInfo) return; - - var handler = CurrentSourceChange; - - if (handler != null) - handler(_CurrentSourceInfo, ChangeType.WillChange); - - _CurrentSourceInfo = value; - - if (handler != null) - handler(_CurrentSourceInfo, ChangeType.DidChange); - } - } - SourceListItem _CurrentSourceInfo; - - public RoutingInputPort AudioIn { get; private set; } - - public Amplifier(string key, string name) - : base(key, name) - { - AudioIn = new RoutingInputPort(RoutingPortNames.AnyAudioIn, eRoutingSignalType.Audio, - eRoutingPortConnectionType.None, null, this); - InputPorts = new RoutingPortCollection { AudioIn }; - } - - #region IRoutingInputs Members - - public RoutingPortCollection InputPorts { get; private set; } - - #endregion - } - - public class AmplifierFactory : EssentialsDeviceFactory - { - public AmplifierFactory() - { - TypeNames = new List() { "amplifier" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new Amplifier Device"); - return new Amplifier(dc.Key, dc.Name); - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/Fusion/EssentialsHuddleVtc1FusionController.cs b/src/PepperDash.Essentials/Fusion/EssentialsHuddleVtc1FusionController.cs deleted file mode 100644 index e84dc974..00000000 --- a/src/PepperDash.Essentials/Fusion/EssentialsHuddleVtc1FusionController.cs +++ /dev/null @@ -1,359 +0,0 @@ -using System; -using System.Linq; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.Fusion; - - -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Core.Fusion; -using PepperDash.Essentials.Devices.Common.Sources; - -namespace PepperDash.Essentials.Fusion -{ - public class EssentialsHuddleVtc1FusionController : EssentialsHuddleSpaceFusionSystemControllerBase - { - BooleanSigData CodecIsInCall; - - public EssentialsHuddleVtc1FusionController(IEssentialsHuddleVtc1Room room, uint ipId, string joinMapKey) - : base(room, ipId, joinMapKey) - { - - } - - /// - /// Called in base class constructor before RVI and GUID files are built - /// - protected override void ExecuteCustomSteps() - { - SetUpCodec(); - } - - /// - /// Creates a static asset for the codec and maps the joins to the main room symbol - /// - void SetUpCodec() - { - try - { - var codec = (Room as IEssentialsHuddleVtc1Room).VideoCodec; - - if (codec == null) - { - Debug.Console(1, this, "Cannot link codec to Fusion because codec is null"); - return; - } - - codec.UsageTracker = new UsageTracking(codec); - codec.UsageTracker.UsageIsTracked = true; - codec.UsageTracker.DeviceUsageEnded += UsageTracker_DeviceUsageEnded; - - var codecPowerOnAction = new Action(b => { if (!b) codec.StandbyDeactivate(); }); - var codecPowerOffAction = new Action(b => { if (!b) codec.StandbyActivate(); }); - - // Map FusionRoom Attributes: - - // Codec volume - var codecVolume = FusionRoom.CreateOffsetUshortSig(JoinMap.VolumeFader1.JoinNumber, JoinMap.VolumeFader1.AttributeName, eSigIoMask.InputOutputSig); - codecVolume.OutputSig.UserObject = new Action(b => (codec as IBasicVolumeWithFeedback).SetVolume(b)); - (codec as IBasicVolumeWithFeedback).VolumeLevelFeedback.LinkInputSig(codecVolume.InputSig); - - // In Call Status - CodecIsInCall = FusionRoom.CreateOffsetBoolSig(JoinMap.VcCodecInCall.JoinNumber, JoinMap.VcCodecInCall.AttributeName, eSigIoMask.InputSigOnly); - codec.CallStatusChange += new EventHandler(codec_CallStatusChange); - - // Online status - if (codec is ICommunicationMonitor) - { - var c = codec as ICommunicationMonitor; - var codecOnline = FusionRoom.CreateOffsetBoolSig(JoinMap.VcCodecOnline.JoinNumber, JoinMap.VcCodecOnline.AttributeName, eSigIoMask.InputSigOnly); - codecOnline.InputSig.BoolValue = c.CommunicationMonitor.Status == MonitorStatus.IsOk; - c.CommunicationMonitor.StatusChange += (o, a) => - { - codecOnline.InputSig.BoolValue = a.Status == MonitorStatus.IsOk; - }; - Debug.Console(0, this, "Linking '{0}' communication monitor to Fusion '{1}'", codec.Key, JoinMap.VcCodecOnline.AttributeName); - } - - // Codec IP Address - bool codecHasIpInfo = false; - var codecComm = codec.Communication; - - string codecIpAddress = string.Empty; - int codecIpPort = 0; - - StringSigData codecIpAddressSig; - StringSigData codecIpPortSig; - - if(codecComm is GenericSshClient) - { - codecIpAddress = (codecComm as GenericSshClient).Hostname; - codecIpPort = (codecComm as GenericSshClient).Port; - codecHasIpInfo = true; - } - else if (codecComm is GenericTcpIpClient) - { - codecIpAddress = (codecComm as GenericTcpIpClient).Hostname; - codecIpPort = (codecComm as GenericTcpIpClient).Port; - codecHasIpInfo = true; - } - - if (codecHasIpInfo) - { - codecIpAddressSig = FusionRoom.CreateOffsetStringSig(JoinMap.VcCodecIpAddress.JoinNumber, JoinMap.VcCodecIpAddress.AttributeName, eSigIoMask.InputSigOnly); - codecIpAddressSig.InputSig.StringValue = codecIpAddress; - - codecIpPortSig = FusionRoom.CreateOffsetStringSig(JoinMap.VcCodecIpPort.JoinNumber, JoinMap.VcCodecIpPort.AttributeName, eSigIoMask.InputSigOnly); - codecIpPortSig.InputSig.StringValue = codecIpPort.ToString(); - } - - var tempAsset = new FusionAsset(); - - var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(c => c.Key.Equals(codec.Key)); - - if (FusionStaticAssets.ContainsKey(deviceConfig.Uid)) - { - tempAsset = FusionStaticAssets[deviceConfig.Uid]; - } - else - { - // Create a new asset - tempAsset = new FusionAsset(FusionRoomGuids.GetNextAvailableAssetNumber(FusionRoom), codec.Name, "Codec", ""); - FusionStaticAssets.Add(deviceConfig.Uid, tempAsset); - } - - var codecAsset = FusionRoom.CreateStaticAsset(tempAsset.SlotNumber, tempAsset.Name, "Codec", tempAsset.InstanceId); - codecAsset.PowerOn.OutputSig.UserObject = codecPowerOnAction; - codecAsset.PowerOff.OutputSig.UserObject = codecPowerOffAction; - codec.StandbyIsOnFeedback.LinkComplementInputSig(codecAsset.PowerOn.InputSig); - - // TODO: Map relevant attributes on asset symbol - - codecAsset.TrySetMakeModel(codec); - codecAsset.TryLinkAssetErrorToCommunication(codec); - } - catch (Exception e) - { - Debug.Console(1, this, "Error setting up codec in Fusion: {0}", e); - } - } - - void codec_CallStatusChange(object sender, PepperDash.Essentials.Devices.Common.Codec.CodecCallStatusItemChangeEventArgs e) - { - var codec = (Room as IEssentialsHuddleVtc1Room).VideoCodec; - - CodecIsInCall.InputSig.BoolValue = codec.IsInCall; - } - - // These methods are overridden because they access the room class which is of a different type - - protected override void CreateSymbolAndBasicSigs(uint ipId) - { - Debug.Console(0, this, "Creating Fusion Room symbol with GUID: {0} and IP-ID {1:X2}", RoomGuid, ipId); - - FusionRoom = new FusionRoom(ipId, Global.ControlSystem, Room.Name, RoomGuid); - FusionRoom.ExtenderRoomViewSchedulingDataReservedSigs.Use(); - FusionRoom.ExtenderFusionRoomDataReservedSigs.Use(); - - FusionRoom.Register(); - - FusionRoom.FusionStateChange += FusionRoom_FusionStateChange; - - FusionRoom.ExtenderRoomViewSchedulingDataReservedSigs.DeviceExtenderSigChange += FusionRoomSchedule_DeviceExtenderSigChange; - FusionRoom.ExtenderFusionRoomDataReservedSigs.DeviceExtenderSigChange += ExtenderFusionRoomDataReservedSigs_DeviceExtenderSigChange; - FusionRoom.OnlineStatusChange += FusionRoom_OnlineStatusChange; - - CrestronConsole.AddNewConsoleCommand(RequestFullRoomSchedule, "FusReqRoomSchedule", "Requests schedule of the room for the next 24 hours", ConsoleAccessLevelEnum.AccessOperator); - CrestronConsole.AddNewConsoleCommand(ModifyMeetingEndTimeConsoleHelper, "FusReqRoomSchMod", "Ends or extends a meeting by the specified time", ConsoleAccessLevelEnum.AccessOperator); - CrestronConsole.AddNewConsoleCommand(CreateAdHocMeeting, "FusCreateMeeting", "Creates and Ad Hoc meeting for on hour or until the next meeting", ConsoleAccessLevelEnum.AccessOperator); - - // Room to fusion room - Room.OnFeedback.LinkInputSig(FusionRoom.SystemPowerOn.InputSig); - - // Moved to - CurrentRoomSourceNameSig = FusionRoom.CreateOffsetStringSig(JoinMap.Display1CurrentSourceName.JoinNumber, JoinMap.Display1CurrentSourceName.AttributeName, eSigIoMask.InputSigOnly); - // Don't think we need to get current status of this as nothing should be alive yet. - (Room as IEssentialsHuddleVtc1Room).CurrentSourceChange += Room_CurrentSourceInfoChange; - - - FusionRoom.SystemPowerOn.OutputSig.SetSigFalseAction((Room as IEssentialsHuddleVtc1Room).PowerOnToDefaultOrLastSource); - FusionRoom.SystemPowerOff.OutputSig.SetSigFalseAction(() => (Room as IEssentialsHuddleVtc1Room).RunRouteAction("roomOff", Room.SourceListKey)); - - - CrestronEnvironment.EthernetEventHandler += CrestronEnvironment_EthernetEventHandler; - } - - protected override void SetUpSources() - { - // Sources - var dict = ConfigReader.ConfigObject.GetSourceListForKey((Room as IEssentialsHuddleVtc1Room).SourceListKey); - if (dict != null) - { - // NEW PROCESS: - // Make these lists and insert the fusion attributes by iterating these - var setTopBoxes = dict.Where(d => d.Value.SourceDevice is ISetTopBoxControls); - uint i = 1; - foreach (var kvp in setTopBoxes) - { - TryAddRouteActionSigs(JoinMap.Display1DiscPlayerSourceStart.AttributeName + " " + i, JoinMap.Display1DiscPlayerSourceStart.JoinNumber + i, kvp.Key, kvp.Value.SourceDevice); - i++; - if (i > JoinMap.Display1SetTopBoxSourceStart.JoinSpan) // We only have five spots - break; - } - - var discPlayers = dict.Where(d => d.Value.SourceDevice is IDiscPlayerControls); - i = 1; - foreach (var kvp in discPlayers) - { - TryAddRouteActionSigs(JoinMap.Display1DiscPlayerSourceStart.AttributeName + " " + i, JoinMap.Display1DiscPlayerSourceStart.JoinNumber + i, kvp.Key, kvp.Value.SourceDevice); - i++; - if (i > 5) // We only have five spots - break; - } - - var laptops = dict.Where(d => d.Value.SourceDevice is Laptop); - i = 1; - foreach (var kvp in laptops) - { - TryAddRouteActionSigs(JoinMap.Display1LaptopSourceStart.AttributeName + " " + i, JoinMap.Display1LaptopSourceStart.JoinNumber + i, kvp.Key, kvp.Value.SourceDevice); - i++; - if (i > JoinMap.Display1LaptopSourceStart.JoinSpan) // We only have ten spots??? - break; - } - - foreach (var kvp in dict) - { - var usageDevice = kvp.Value.SourceDevice as IUsageTracking; - - if (usageDevice != null) - { - usageDevice.UsageTracker = new UsageTracking(usageDevice as Device); - usageDevice.UsageTracker.UsageIsTracked = true; - usageDevice.UsageTracker.DeviceUsageEnded += new EventHandler(UsageTracker_DeviceUsageEnded); - } - } - - } - else - { - Debug.Console(1, this, "WARNING: Config source list '{0}' not found for room '{1}'", - (Room as IEssentialsHuddleVtc1Room).SourceListKey, Room.Key); - } - } - - protected override void SetUpDisplay() - { - try - { - //Setup Display Usage Monitoring - - var displays = DeviceManager.AllDevices.Where(d => d is DisplayBase); - - // Consider updating this in multiple display systems - - foreach (DisplayBase display in displays) - { - display.UsageTracker = new UsageTracking(display); - display.UsageTracker.UsageIsTracked = true; - display.UsageTracker.DeviceUsageEnded += new EventHandler(UsageTracker_DeviceUsageEnded); - } - - var defaultDisplay = (Room as IEssentialsHuddleVtc1Room).DefaultDisplay as DisplayBase; - if (defaultDisplay == null) - { - Debug.Console(1, this, "Cannot link null display to Fusion because default display is null"); - return; - } - - var dispPowerOnAction = new Action(b => { if (!b) defaultDisplay.PowerOn(); }); - var dispPowerOffAction = new Action(b => { if (!b) defaultDisplay.PowerOff(); }); - - // Display to fusion room sigs - FusionRoom.DisplayPowerOn.OutputSig.UserObject = dispPowerOnAction; - FusionRoom.DisplayPowerOff.OutputSig.UserObject = dispPowerOffAction; - - var defaultDisplayTwoWay = defaultDisplay as IHasPowerControlWithFeedback; - if (defaultDisplayTwoWay != null) - { - defaultDisplayTwoWay.PowerIsOnFeedback.LinkInputSig(FusionRoom.DisplayPowerOn.InputSig); - } - - if (defaultDisplay is IDisplayUsage) - (defaultDisplay as IDisplayUsage).LampHours.LinkInputSig(FusionRoom.DisplayUsage.InputSig); - - MapDisplayToRoomJoins(1, JoinMap.Display1Start.JoinNumber, defaultDisplay); - - var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(d => d.Key.Equals(defaultDisplay.Key)); - - //Check for existing asset in GUIDs collection - - var tempAsset = new FusionAsset(); - - if (FusionStaticAssets.ContainsKey(deviceConfig.Uid)) - { - tempAsset = FusionStaticAssets[deviceConfig.Uid]; - } - else - { - // Create a new asset - tempAsset = new FusionAsset(FusionRoomGuids.GetNextAvailableAssetNumber(FusionRoom), defaultDisplay.Name, "Display", ""); - FusionStaticAssets.Add(deviceConfig.Uid, tempAsset); - } - - var dispAsset = FusionRoom.CreateStaticAsset(tempAsset.SlotNumber, tempAsset.Name, "Display", tempAsset.InstanceId); - dispAsset.PowerOn.OutputSig.UserObject = dispPowerOnAction; - dispAsset.PowerOff.OutputSig.UserObject = dispPowerOffAction; - - - var defaultTwoWayDisplay = defaultDisplay as IHasPowerControlWithFeedback; - if (defaultTwoWayDisplay != null) - { - defaultTwoWayDisplay.PowerIsOnFeedback.LinkInputSig(FusionRoom.DisplayPowerOn.InputSig); - if (defaultDisplay is IDisplayUsage) - (defaultDisplay as IDisplayUsage).LampHours.LinkInputSig(FusionRoom.DisplayUsage.InputSig); - - defaultTwoWayDisplay.PowerIsOnFeedback.LinkInputSig(dispAsset.PowerOn.InputSig); - } - - // Use extension methods - dispAsset.TrySetMakeModel(defaultDisplay); - dispAsset.TryLinkAssetErrorToCommunication(defaultDisplay); - } - catch (Exception e) - { - Debug.Console(1, this, "Error setting up display in Fusion: {0}", e); - } - - } - - protected override void MapDisplayToRoomJoins(int displayIndex, uint joinOffset, DisplayBase display) - { - string displayName = string.Format("Display {0} - ", displayIndex); - - - if (display == (Room as IEssentialsHuddleVtc1Room).DefaultDisplay) - { - // Power on - var defaultDisplayPowerOn = FusionRoom.CreateOffsetBoolSig((uint)joinOffset, displayName + "Power On", eSigIoMask.InputOutputSig); - defaultDisplayPowerOn.OutputSig.UserObject = new Action(b => { if (!b) display.PowerOn(); }); - - // Power Off - var defaultDisplayPowerOff = FusionRoom.CreateOffsetBoolSig((uint)joinOffset + 1, displayName + "Power Off", eSigIoMask.InputOutputSig); - defaultDisplayPowerOn.OutputSig.UserObject = new Action(b => { if (!b) display.PowerOff(); }); ; - - var displayTwoWay = display as IHasPowerControlWithFeedback; - if (displayTwoWay != null) - { - displayTwoWay.PowerIsOnFeedback.LinkInputSig(defaultDisplayPowerOn.InputSig); - displayTwoWay.PowerIsOnFeedback.LinkInputSig(defaultDisplayPowerOn.InputSig); - } - - // Current Source - var defaultDisplaySourceNone = FusionRoom.CreateOffsetBoolSig((uint)joinOffset + 8, displayName + "Source None", eSigIoMask.InputOutputSig); - defaultDisplaySourceNone.OutputSig.UserObject = new Action(b => { if (!b) (Room as IEssentialsHuddleVtc1Room).RunRouteAction("roomOff", Room.SourceListKey); }); ; - } - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/Fusion/EssentialsTechRoomFusionSystemController.cs b/src/PepperDash.Essentials/Fusion/EssentialsTechRoomFusionSystemController.cs deleted file mode 100644 index 0630c53a..00000000 --- a/src/PepperDash.Essentials/Fusion/EssentialsTechRoomFusionSystemController.cs +++ /dev/null @@ -1,106 +0,0 @@ -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.Core.Fusion; - -namespace PepperDash.Essentials.Fusion -{ - public class EssentialsTechRoomFusionSystemController : EssentialsHuddleSpaceFusionSystemControllerBase - { - public EssentialsTechRoomFusionSystemController(EssentialsTechRoom room, uint ipId, string joinMapKey) - : base(room, ipId, joinMapKey) - { - - } - - protected override void SetUpDisplay() - { - try - { - - var displays = (Room as EssentialsTechRoom).Displays; - - Debug.Console(1, this, "Setting up Static Assets for {0} Displays", displays.Count); - - foreach (var display in displays.Values.Cast()) - { - var disp = display; // Local scope variable - - Debug.Console(2, this, "Setting up Static Asset for {0}", disp.Key); - - disp.UsageTracker = new UsageTracking(disp) { UsageIsTracked = true }; - disp.UsageTracker.DeviceUsageEnded += UsageTracker_DeviceUsageEnded; - - var dispPowerOnAction = new Action(b => - { - if (!b) - { - disp.PowerOn(); - } - }); - var dispPowerOffAction = new Action(b => - { - if (!b) - { - disp.PowerOff(); - } - }); - - var deviceConfig = ConfigReader.ConfigObject.GetDeviceForKey(disp.Key); - - FusionAsset tempAsset; - - if (FusionStaticAssets.ContainsKey(deviceConfig.Uid)) - { - // Used existing asset - tempAsset = FusionStaticAssets[deviceConfig.Uid]; - } - else - { - // Create a new asset - tempAsset = new FusionAsset(FusionRoomGuids.GetNextAvailableAssetNumber(FusionRoom), - disp.Name, "Display", ""); - FusionStaticAssets.Add(deviceConfig.Uid, tempAsset); - } - - var dispAsset = FusionRoom.CreateStaticAsset(tempAsset.SlotNumber, tempAsset.Name, "Display", - tempAsset.InstanceId); - - if (dispAsset != null) - { - dispAsset.PowerOn.OutputSig.UserObject = dispPowerOnAction; - dispAsset.PowerOff.OutputSig.UserObject = dispPowerOffAction; - - // Use extension methods - dispAsset.TrySetMakeModel(disp); - dispAsset.TryLinkAssetErrorToCommunication(disp); - } - - var defaultTwoWayDisplay = disp as IHasPowerControlWithFeedback; - if (defaultTwoWayDisplay != null) - { - defaultTwoWayDisplay.PowerIsOnFeedback.LinkInputSig(FusionRoom.DisplayPowerOn.InputSig); - if (disp is IDisplayUsage) - { - (disp as IDisplayUsage).LampHours.LinkInputSig(FusionRoom.DisplayUsage.InputSig); - } - - if(dispAsset != null) - defaultTwoWayDisplay.PowerIsOnFeedback.LinkInputSig(dispAsset.PowerOn.InputSig); - } - - } - } - catch (Exception e) - { - Debug.Console(1, this, "Error setting up displays in Fusion: {0}", e); - } - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UI/HttpLogoServer.cs b/src/PepperDash.Essentials/HttpLogoServer.cs similarity index 100% rename from src/PepperDash.Essentials/UI/HttpLogoServer.cs rename to src/PepperDash.Essentials/HttpLogoServer.cs diff --git a/src/PepperDash.Essentials/Room/Config/EssentialsDualDisplayRoomPropertiesConfig.cs b/src/PepperDash.Essentials/Room/Config/EssentialsDualDisplayRoomPropertiesConfig.cs deleted file mode 100644 index d048b2b4..00000000 --- a/src/PepperDash.Essentials/Room/Config/EssentialsDualDisplayRoomPropertiesConfig.cs +++ /dev/null @@ -1,17 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -using Full.Newtonsoft.Json; - -namespace PepperDash.Essentials.Room.Config -{ - public class EssentialsDualDisplayRoomPropertiesConfig : EssentialsNDisplayRoomPropertiesConfig - { - - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/Room/Config/EssentialsHuddleRoomPropertiesConfig.cs b/src/PepperDash.Essentials/Room/Config/EssentialsHuddleRoomPropertiesConfig.cs deleted file mode 100644 index 47ffa0b3..00000000 --- a/src/PepperDash.Essentials/Room/Config/EssentialsHuddleRoomPropertiesConfig.cs +++ /dev/null @@ -1,44 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Converters; -using Full.Newtonsoft.Json.Linq; - -namespace PepperDash.Essentials.Room.Config -{ - /// - /// - /// - public class EssentialsHuddleRoomPropertiesConfig : EssentialsRoomPropertiesConfig - { - /// - /// The key of the default display device - /// - [JsonProperty("defaultDisplayKey")] - public string DefaultDisplayKey { get; set; } - - /// - /// The key of the default audio device - /// - [JsonProperty("defaultAudioKey")] - public string DefaultAudioKey { get; set; } - - /// - /// The key of the source list for the room - /// - [JsonProperty("sourceListKey")] - public string SourceListKey { get; set; } - - /// - /// The key of the default source item from the source list - /// - [JsonProperty("defaultSourceItem")] - public string DefaultSourceItem { get; set; } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/Room/Config/EssentialsHuddleVtc1PropertiesConfig.cs b/src/PepperDash.Essentials/Room/Config/EssentialsHuddleVtc1PropertiesConfig.cs deleted file mode 100644 index 0eb5e594..00000000 --- a/src/PepperDash.Essentials/Room/Config/EssentialsHuddleVtc1PropertiesConfig.cs +++ /dev/null @@ -1,19 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Full.Newtonsoft.Json; - -namespace PepperDash.Essentials.Room.Config -{ - - public class EssentialsHuddleVtc1PropertiesConfig : EssentialsConferenceRoomPropertiesConfig - { - [JsonProperty("defaultDisplayKey")] - public string DefaultDisplayKey { get; set; } - - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/Room/Config/EssentialsNDisplayRoomPropertiesConfig.cs b/src/PepperDash.Essentials/Room/Config/EssentialsNDisplayRoomPropertiesConfig.cs deleted file mode 100644 index 22eccc24..00000000 --- a/src/PepperDash.Essentials/Room/Config/EssentialsNDisplayRoomPropertiesConfig.cs +++ /dev/null @@ -1,41 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -using PepperDash.Core; -using PepperDash.Essentials.Core; - -using Full.Newtonsoft.Json; - -namespace PepperDash.Essentials.Room.Config -{ - /// - /// - /// - public class EssentialsNDisplayRoomPropertiesConfig : EssentialsConferenceRoomPropertiesConfig - { - [JsonProperty("defaultAudioBehavior")] - public string DefaultAudioBehavior { get; set; } - [JsonProperty("defaultVideoBehavior")] - public string DefaultVideoBehavior { get; set; } - [JsonProperty("displays")] - public Dictionary Displays { get; set; } - - public EssentialsNDisplayRoomPropertiesConfig() - { - Displays = new Dictionary(); - } - - } - - public class DisplayItem : IKeyName - { - public string Key { get; set; } - public string Name { get; set; } - } - -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/Room/Config/EssentialsPresentationPropertiesConfig.cs b/src/PepperDash.Essentials/Room/Config/EssentialsPresentationPropertiesConfig.cs deleted file mode 100644 index a40e0fdc..00000000 --- a/src/PepperDash.Essentials/Room/Config/EssentialsPresentationPropertiesConfig.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -namespace PepperDash.Essentials.Room.Config -{ - /// - /// - /// - public class EssentialsPresentationRoomPropertiesConfig : EssentialsRoomPropertiesConfig - { - public string DefaultAudioBehavior { get; set; } - public string DefaultAudioKey { get; set; } - public string DefaultVideoBehavior { get; set; } - public List DisplayKeys { get; set; } - public string SourceListKey { get; set; } - public bool HasDsp { get; set; } - - public EssentialsPresentationRoomPropertiesConfig() - { - DisplayKeys = new List(); - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/Room/Config/EssentialsRoomConfig.cs b/src/PepperDash.Essentials/Room/Config/EssentialsRoomConfig.cs deleted file mode 100644 index 7d095e6f..00000000 --- a/src/PepperDash.Essentials/Room/Config/EssentialsRoomConfig.cs +++ /dev/null @@ -1,413 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using Crestron.SimplSharp; -using Full.Newtonsoft.Json; - -using PepperDash.Core; -using PepperDash.Essentials; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Config; - -namespace PepperDash.Essentials.Room.Config -{ - public class EssentialsRoomConfigHelper - { - /// - /// Returns a room object from this config data - /// - /// - public static IKeyed GetRoomObject(DeviceConfig roomConfig) - { - var typeName = roomConfig.Type.ToLower(); - - switch (typeName) - { - case "huddle" : - { - return new EssentialsHuddleSpaceRoom(roomConfig); - } - case "huddlevtc1" : - { - return new EssentialsHuddleVtc1Room(roomConfig); - } - case "ddvc01bridge" : - { - return new Device(roomConfig.Key, roomConfig.Name); // placeholder device that does nothing. - } - case "dualdisplay" : - { - return new EssentialsDualDisplayRoom(roomConfig); - } - case "combinedhuddlevtc1" : - { - return new EssentialsCombinedHuddleVtc1Room(roomConfig); - } - case "techroom" : - { - return new EssentialsTechRoom(roomConfig); - } - default : - { - return Core.DeviceFactory.GetDevice(roomConfig); - } - } - } - - /// - /// Gets and operating, standalone emergegncy object that can be plugged into a room. - /// Returns null if there is no emergency defined - /// - public static EssentialsRoomEmergencyBase GetEmergency(EssentialsRoomPropertiesConfig props, IEssentialsRoom room) - { - // This emergency - var emergency = props.Emergency; - if (emergency != null) - { - //switch on emergency type here. Right now only contact and shutdown - var e = new EssentialsRoomEmergencyContactClosure(room.Key + "-emergency", props.Emergency, room); - DeviceManager.AddDevice(e); - } - return null; - } - - /// - /// - /// - /// - /// - /// - public static Core.Privacy.MicrophonePrivacyController GetMicrophonePrivacy( - EssentialsRoomPropertiesConfig props, IPrivacy room) - { - var microphonePrivacy = props.MicrophonePrivacy; - if (microphonePrivacy == null) - { - Debug.Console(0, "Cannot create microphone privacy with null properties"); - return null; - } - // Get the MicrophonePrivacy device from the device manager - var mP = (DeviceManager.GetDeviceForKey(props.MicrophonePrivacy.DeviceKey) as - Core.Privacy.MicrophonePrivacyController); - // Set this room as the IPrivacy device - if (mP == null) - { - Debug.Console(0, "ERROR: Selected device {0} is not MicrophonePrivacyController", props.MicrophonePrivacy.DeviceKey); - return null; - } - mP.SetPrivacyDevice(room); - - var behaviour = props.MicrophonePrivacy.Behaviour.ToLower(); - - if (behaviour == null) - { - Debug.Console(0, "WARNING: No behaviour defined for MicrophonePrivacyController"); - return null; - } - if (behaviour == "trackroomstate") - { - // Tie LED enable to room power state - var essRoom = room as IEssentialsRoom; - essRoom.OnFeedback.OutputChange += (o, a) => - { - if (essRoom.OnFeedback.BoolValue) - mP.EnableLeds = true; - else - mP.EnableLeds = false; - }; - - mP.EnableLeds = essRoom.OnFeedback.BoolValue; - } - else if (behaviour == "trackcallstate") - { - // Tie LED enable to room power state - var inCallRoom = room as IHasInCallFeedback; - inCallRoom.InCallFeedback.OutputChange += (o, a) => - { - if (inCallRoom.InCallFeedback.BoolValue) - mP.EnableLeds = true; - else - mP.EnableLeds = false; - }; - - mP.EnableLeds = inCallRoom.InCallFeedback.BoolValue; - } - - return mP; - } - - } - - /// - /// - /// - public class EssentialsRoomPropertiesConfig - { - [JsonProperty("addresses")] - public EssentialsRoomAddressPropertiesConfig Addresses { get; set; } - - [JsonProperty("description")] - public string Description { get; set; } - - [JsonProperty("emergency")] - public EssentialsRoomEmergencyConfig Emergency { get; set; } - - [JsonProperty("help")] - public EssentialsHelpPropertiesConfig Help { get; set; } - - [JsonProperty("helpMessage")] - public string HelpMessage { get; set; } - - /// - /// Read this value to get the help message. It checks for the old and new config format. - /// - public string HelpMessageForDisplay - { - get - { - if(Help != null && !string.IsNullOrEmpty(Help.Message)) - { - return Help.Message; - } - else - { - return HelpMessage; - } - } - } - - [JsonProperty("environment")] - public EssentialsEnvironmentPropertiesConfig Environment { get; set; } - - [JsonProperty("logo")] - public EssentialsLogoPropertiesConfig LogoLight { get; set; } - - [JsonProperty("logoDark")] - public EssentialsLogoPropertiesConfig LogoDark { get; set; } - - [JsonProperty("microphonePrivacy")] - public EssentialsRoomMicrophonePrivacyConfig MicrophonePrivacy { get; set; } - - [JsonProperty("occupancy")] - public EssentialsRoomOccSensorConfig Occupancy { get; set; } - - [JsonProperty("oneButtonMeeting")] - public EssentialsOneButtonMeetingPropertiesConfig OneButtonMeeting { get; set; } - - [JsonProperty("shutdownVacancySeconds")] - public int ShutdownVacancySeconds { get; set; } - - [JsonProperty("shutdownPromptSeconds")] - public int ShutdownPromptSeconds { get; set; } - - [JsonProperty("tech")] - public EssentialsRoomTechConfig Tech { get; set; } - - [JsonProperty("volumes")] - public EssentialsRoomVolumesConfig Volumes { get; set; } - - [JsonProperty("fusion")] - public EssentialsRoomFusionConfig Fusion { get; set; } - - [JsonProperty("essentialsRoomUiBehaviorConfig", NullValueHandling=NullValueHandling.Ignore)] - public EssentialsRoomUiBehaviorConfig UiBehavior { get; set; } - - [JsonProperty("zeroVolumeWhenSwtichingVolumeDevices")] - public bool ZeroVolumeWhenSwtichingVolumeDevices { get; set; } - - /// - /// Indicates if this room represents a combination of other rooms - /// - [JsonProperty("isRoomCombinationScenario")] - public bool IsRoomCombinationScenario { get; set; } - - public EssentialsRoomPropertiesConfig() - { - LogoLight = new EssentialsLogoPropertiesConfig(); - LogoDark = new EssentialsLogoPropertiesConfig(); - } - } - - public class EssentialsRoomUiBehaviorConfig - { - [JsonProperty("disableActivityButtonsWhileWarmingCooling")] - public bool DisableActivityButtonsWhileWarmingCooling { get; set; } - } - - public class EssentialsAvRoomPropertiesConfig : EssentialsRoomPropertiesConfig - { - [JsonProperty("defaultAudioKey")] - public string DefaultAudioKey { get; set; } - [JsonProperty("sourceListKey")] - public string SourceListKey { get; set; } - [JsonProperty("destinationListKey")] - public string DestinationListKey { get; set; } - [JsonProperty("defaultSourceItem")] - public string DefaultSourceItem { get; set; } - /// - /// Indicates if the room supports advanced sharing - /// - [JsonProperty("supportsAdvancedSharing")] - public bool SupportsAdvancedSharing { get; set; } - /// - /// Indicates if non-tech users can change the share mode - /// - [JsonProperty("userCanChangeShareMode")] - public bool UserCanChangeShareMode { get; set; } - } - - public class EssentialsConferenceRoomPropertiesConfig : EssentialsAvRoomPropertiesConfig - { - [JsonProperty("videoCodecKey")] - public string VideoCodecKey { get; set; } - [JsonProperty("audioCodecKey")] - public string AudioCodecKey { get; set; } - } - - public class EssentialsEnvironmentPropertiesConfig - { - public bool Enabled { get; set; } - - [JsonProperty("deviceKeys")] - public List DeviceKeys { get; set; } - - public EssentialsEnvironmentPropertiesConfig() - { - DeviceKeys = new List(); - } - - } - - public class EssentialsRoomFusionConfig - { - public uint IpIdInt - { - get - { - try - { - return Convert.ToUInt32(IpId, 16); - } - catch (Exception) - { - throw new FormatException(string.Format("ERROR:Unable to convert IP ID: {0} to hex. Error:\n{1}", IpId)); - } - - } - } - - [JsonProperty("ipId")] - public string IpId { get; set; } - - [JsonProperty("joinMapKey")] - public string JoinMapKey { get; set; } - - } - - public class EssentialsRoomMicrophonePrivacyConfig - { - [JsonProperty("deviceKey")] - public string DeviceKey { get; set; } - - [JsonProperty("behaviour")] - public string Behaviour { get; set; } - } - - /// - /// Properties for the help text box - /// - public class EssentialsHelpPropertiesConfig - { - [JsonProperty("message")] - public string Message { get; set; } - - [JsonProperty("showCallButton")] - public bool ShowCallButton { get; set; } - - /// - /// Defaults to "Call Help Desk" - /// - [JsonProperty("callButtonText")] - public string CallButtonText { get; set; } - - public EssentialsHelpPropertiesConfig() - { - CallButtonText = "Call Help Desk"; - } - } - - /// - /// - /// - public class EssentialsOneButtonMeetingPropertiesConfig - { - [JsonProperty("enable")] - public bool Enable { get; set; } - } - - public class EssentialsRoomAddressPropertiesConfig - { - [JsonProperty("phoneNumber")] - public string PhoneNumber { get; set; } - - [JsonProperty("sipAddress")] - public string SipAddress { get; set; } - } - - - /// - /// Properties for the room's logo on panels - /// - public class EssentialsLogoPropertiesConfig - { - [JsonProperty("type")] - public string Type { get; set; } - - [JsonProperty("url")] - public string Url { get; set; } - /// - /// Gets either the custom URL, a local-to-processor URL, or null if it's a default logo - /// - public string GetLogoUrlLight() - { - if (Type == "url") - return Url; - if (Type == "system") - return string.Format("http://{0}:8080/logo.png", - CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0)); - return null; - } - - public string GetLogoUrlDark() - { - if (Type == "url") - return Url; - if (Type == "system") - return string.Format("http://{0}:8080/logo-dark.png", - CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0)); - return null; - } - } - - /// - /// Represents occupancy sensor(s) setup for a room - /// - public class EssentialsRoomOccSensorConfig - { - [JsonProperty("deviceKey")] - public string DeviceKey { get; set; } - - [JsonProperty("timeoutMinutes")] - public int TimeoutMinutes { get; set; } - } - - public class EssentialsRoomTechConfig - { - [JsonProperty("password")] - public string Password { get; set; } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/Room/Config/EssentialsRoomEmergencyConfig.cs b/src/PepperDash.Essentials/Room/Config/EssentialsRoomEmergencyConfig.cs deleted file mode 100644 index 69d04579..00000000 --- a/src/PepperDash.Essentials/Room/Config/EssentialsRoomEmergencyConfig.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -namespace PepperDash.Essentials.Room.Config -{ - /// - /// - /// - public class EssentialsRoomEmergencyConfig - { - public EssentialsRoomEmergencyTriggerConfig Trigger { get; set; } - - public string Behavior { get; set; } - } - - /// - /// - /// - public class EssentialsRoomEmergencyTriggerConfig - { - /// - /// contact, - /// - public string Type { get; set; } - /// - /// Input number if contact - /// - public int Number { get; set; } - - public bool TriggerOnClose { get; set; } - - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/Room/Config/EssentialsTechRoomConfig.cs b/src/PepperDash.Essentials/Room/Config/EssentialsTechRoomConfig.cs deleted file mode 100644 index 6d933662..00000000 --- a/src/PepperDash.Essentials/Room/Config/EssentialsTechRoomConfig.cs +++ /dev/null @@ -1,77 +0,0 @@ -extern alias Full; - -using System.Collections.Generic; -using Full.Newtonsoft.Json; - -namespace PepperDash.Essentials.Room.Config -{ - public class EssentialsTechRoomConfig - { - /// - /// The key of the dummy device used to enable routing - /// - [JsonProperty("dummySourceKey")] - public string DummySourceKey { get; set; } - - /// - /// The keys of the displays assigned to this room - /// - [JsonProperty("displays")] - public List Displays { get; set; } - - /// - /// The keys of the tuners assinged to this room - /// - [JsonProperty("tuners")] - public List Tuners { get; set; } - - /// - /// PIN to access the room as a normal user - /// - [JsonProperty("userPin")] - public string UserPin { get; set; } - - /// - /// PIN to access the room as a tech user - /// - [JsonProperty("techPin")] - public string TechPin { get; set; } - - /// - /// Name of the presets file. Path prefix is assumed to be /html/presets/lists/ - /// - [JsonProperty("presetsFileName")] - public string PresetsFileName { get; set; } - - [JsonProperty("scheduledEvents")] - public List ScheduledEvents { get; set; } - - /// - /// Indicates that the room is the primary when true - /// - [JsonProperty("isPrimary")] - public bool IsPrimary { get; set; } - - /// - /// Indicates which tuners should mirror preset recall when two rooms are configured in a primary->secondary scenario - /// - [JsonProperty("mirroredTuners")] - public Dictionary MirroredTuners { get; set; } - - [JsonProperty("helpMessage")] - public string HelpMessage { get; set; } - - /// - /// Indicates the room - /// - [JsonProperty("isTvPresetsProvider")] - public bool IsTvPresetsProvider; - - public EssentialsTechRoomConfig() - { - Displays = new List(); - Tuners = new List(); - ScheduledEvents = new List(); - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/Room/Config/SimplRoomPropertiesConfig.cs b/src/PepperDash.Essentials/Room/Config/SimplRoomPropertiesConfig.cs deleted file mode 100644 index ad508154..00000000 --- a/src/PepperDash.Essentials/Room/Config/SimplRoomPropertiesConfig.cs +++ /dev/null @@ -1,32 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -using Full.Newtonsoft.Json; - -namespace PepperDash.Essentials.Room.Config -{ - public class SimplRoomPropertiesConfig : EssentialsHuddleVtc1PropertiesConfig - { - [JsonProperty("roomPhoneNumber")] - public string RoomPhoneNumber { get; set; } - [JsonProperty("roomURI")] - public string RoomURI { get; set; } - [JsonProperty("speedDials")] - public List SpeedDials { get; set; } - [JsonProperty("volumeSliderNames")] - public List VolumeSliderNames { get; set; } - } - - public class SimplSpeedDial - { - [JsonProperty("name")] - public string Name { get; set; } - [JsonProperty("number")] - public string Number { get; set; } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/Room/Emergency/EsentialsRoomEmergencyContactClosure.cs b/src/PepperDash.Essentials/Room/Emergency/EsentialsRoomEmergencyContactClosure.cs deleted file mode 100644 index c40ed496..00000000 --- a/src/PepperDash.Essentials/Room/Emergency/EsentialsRoomEmergencyContactClosure.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; - -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Room.Config; - -namespace PepperDash.Essentials.Room -{ - - - - public class EssentialsRoomEmergencyContactClosure : EssentialsRoomEmergencyBase - { - IEssentialsRoom Room; - string Behavior; - bool TriggerOnClose; - - public EssentialsRoomEmergencyContactClosure(string key, EssentialsRoomEmergencyConfig config, IEssentialsRoom room) : - base(key) - { - Room = room; - var cs = Global.ControlSystem; - - if (config.Trigger.Type.Equals("contact", StringComparison.OrdinalIgnoreCase)) - { - var portNum = (uint)config.Trigger.Number; - if (portNum <= cs.NumberOfDigitalInputPorts) - { - cs.DigitalInputPorts[portNum].Register(); - cs.DigitalInputPorts[portNum].StateChange += EsentialsRoomEmergencyContactClosure_StateChange; - } - } - Behavior = config.Behavior; - TriggerOnClose = config.Trigger.TriggerOnClose; - } - - void EsentialsRoomEmergencyContactClosure_StateChange(DigitalInput digitalInput, DigitalInputEventArgs args) - { - if (args.State && TriggerOnClose || !args.State && !TriggerOnClose) - RunEmergencyBehavior(); - } - - /// - /// - /// - public void RunEmergencyBehavior() - { - if (Behavior.Equals("shutdown")) - Room.Shutdown(); - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/Room/Types/EssentialsCombinedHuddleVtc1Room.cs b/src/PepperDash.Essentials/Room/Types/EssentialsCombinedHuddleVtc1Room.cs deleted file mode 100644 index 8be5508e..00000000 --- a/src/PepperDash.Essentials/Room/Types/EssentialsCombinedHuddleVtc1Room.cs +++ /dev/null @@ -1,968 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -using Full.Newtonsoft.Json; - -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; -using PepperDash.Essentials.Devices.Common.AudioCodec; -using PepperDash.Essentials.Core.DeviceTypeInterfaces; - -namespace PepperDash.Essentials -{ - public class EssentialsCombinedHuddleVtc1Room : EssentialsRoomBase, IEssentialsHuddleVtc1Room - { - private bool _codecExternalSourceChange; - public event EventHandler CurrentVolumeDeviceChange; - public event SourceInfoChangeHandler CurrentSourceChange; - - - //************************ - // 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 displays = Displays.OfType().ToList(); - - var val = CurrentSourceInfo != null - && CurrentSourceInfo.Type == eSourceListItemType.Route - && displays.Count > 0; - //&& disp.PowerIsOnFeedback.BoolValue; - return val; - }; - } - } - /// - /// - /// - protected override Func IsWarmingFeedbackFunc - { - get - { - return () => Displays.OfType().Any((d) => d.IsWarmingUpFeedback.BoolValue); - } - } - /// - /// - /// - protected override Func IsCoolingFeedbackFunc - { - get - { - return () => Displays.OfType().Any((d) => d.IsCoolingDownFeedback.BoolValue); - } - } - - public EssentialsHuddleVtc1PropertiesConfig PropertiesConfig { get; private set; } - - private List Displays; - - 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 AudioCodecBase AudioCodec { get; private set; } - - public bool ExcludeFromGlobalFunctions { 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; } - set - { - if (value == _CurrentSourceInfo) return; - - var handler = CurrentSourceChange; - // 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(_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(_CurrentSourceInfo, ChangeType.DidChange); - - var vc = VideoCodec as IHasExternalSourceSwitching; - if (vc != null && !_codecExternalSourceChange) - { - vc.SetSelectedSource(CurrentSourceInfoKey); - } - - _codecExternalSourceChange = false; - } - } - SourceListItem _CurrentSourceInfo; - - public string CurrentSourceInfoKey { get; 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 EssentialsCombinedHuddleVtc1Room(DeviceConfig config) - : base(config) - { - try - { - PropertiesConfig = JsonConvert.DeserializeObject - (config.Properties.ToString()); - - VideoCodec = DeviceManager.GetDeviceForKey(PropertiesConfig.VideoCodecKey) as - PepperDash.Essentials.Devices.Common.VideoCodec.VideoCodecBase; - - - if (VideoCodec == null) - throw new ArgumentNullException("codec cannot be null"); - - AudioCodec = DeviceManager.GetDeviceForKey(PropertiesConfig.AudioCodecKey) as - PepperDash.Essentials.Devices.Common.AudioCodec.AudioCodecBase; - if (AudioCodec == null) - Debug.Console(0, this, "No Audio Codec Found"); - - DefaultAudioDevice = DeviceManager.GetDeviceForKey(PropertiesConfig.DefaultAudioKey) as IBasicVolumeControls; - - Displays = new List(); - - Initialize(); - } - catch (Exception e) - { - Debug.Console(1, this, "Error building room: \n{0}", e); - } - } - - public override void Initialize() - { - try - { - //if (DefaultAudioDevice is IBasicVolumeControls) - // DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls; - //else if (DefaultAudioDevice is IHasVolumeDevice) - // DefaultVolumeControls = (DefaultAudioDevice as IHasVolumeDevice).VolumeDevice; - //CurrentVolumeControls = DefaultVolumeControls; - - - //// Combines call feedback from both codecs if available - //InCallFeedback = new BoolFeedback(() => - //{ - // bool inAudioCall = false; - // bool inVideoCall = false; - - // if (AudioCodec != null) - // inAudioCall = AudioCodec.IsInCall; - - // if (VideoCodec != null) - // inVideoCall = VideoCodec.IsInCall; - - // if (inAudioCall || inVideoCall) - // return true; - // else - // return false; - //}); - - //SetupDisplays(); - - //// Get Microphone Privacy object, if any MUST HAPPEN AFTER setting InCallFeedback - //this.MicrophonePrivacy = EssentialsRoomConfigHelper.GetMicrophonePrivacy(PropertiesConfig, this); - - //Debug.Console(2, this, "Microphone Privacy Config evaluated."); - - //// Get emergency object, if any - //this.Emergency = EssentialsRoomConfigHelper.GetEmergency(PropertiesConfig, this); - - //Debug.Console(2, this, "Emergency Config evaluated."); - - - //VideoCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate(); - //VideoCodec.IsReadyChange += (o, a) => { this.SetCodecExternalSources(); SetCodecBranding(); }; - - //if (AudioCodec != null) - // AudioCodec.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); - - SetSourceListKey(); - - //EnablePowerOnToLastSource = true; - } - catch (Exception e) - { - Debug.Console(0, this, "Error Initializing Room: {0}", e); - } - } - - private void SetupDisplays() - { - //DefaultDisplay = DeviceManager.GetDeviceForKey(PropertiesConfig.DefaultDisplayKey) as IRoutingSinkWithSwitching; - - var destinationList = ConfigReader.ConfigObject.DestinationLists[PropertiesConfig.DestinationListKey]; - - Displays.Clear(); - - foreach (var destination in destinationList) - { - var dest = destination.Value.SinkDevice as IRoutingSinkWithSwitching; - - if (dest != null) - { - Displays.Add(dest); - } - - var display = dest as DisplayBase; - if (display != null) - { - // Link power, warming, cooling to display - var dispTwoWay = display as IHasPowerControlWithFeedback; - if (dispTwoWay != null) - { - dispTwoWay.PowerIsOnFeedback.OutputChange -= PowerIsOnFeedback_OutputChange; - dispTwoWay.PowerIsOnFeedback.OutputChange += PowerIsOnFeedback_OutputChange; - - if (dispTwoWay.PowerIsOnFeedback.BoolValue) - { - SetDefaultLevels(); - } - } - - display.IsWarmingUpFeedback.OutputChange -= IsWarmingUpFeedback_OutputChange; - display.IsWarmingUpFeedback.OutputChange += IsWarmingUpFeedback_OutputChange; - - display.IsCoolingDownFeedback.OutputChange -= IsCoolingDownFeedback_OutputChange; - display.IsCoolingDownFeedback.OutputChange += IsCoolingDownFeedback_OutputChange; - - } - } - } - - void IsCoolingDownFeedback_OutputChange(object sender, FeedbackEventArgs e) - { - IsCoolingDownFeedback.FireUpdate(); - } - - void IsWarmingUpFeedback_OutputChange(object sender, FeedbackEventArgs e) - { - IsWarmingUpFeedback.FireUpdate(); - if (!IsWarmingUpFeedback.BoolValue) - (CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(DefaultVolume); - } - - void PowerIsOnFeedback_OutputChange(object sender, FeedbackEventArgs e) - { - var dispTwoWay = sender as IHasPowerControlWithFeedback; - - if (dispTwoWay != null && dispTwoWay.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue) - { - //if (!dispTwoWay.PowerIsOnFeedback.BoolValue) - // CurrentSourceInfo = null; - OnFeedback.FireUpdate(); - } - } - - - - - - private void SetSourceListKey() - { - if (!string.IsNullOrEmpty(PropertiesConfig.SourceListKey)) - { - SetSourceListKey(PropertiesConfig.SourceListKey); - } - else - { - SetSourceListKey(Key); - } - - SetUpVideoCodec(); - } - - protected override void CustomSetConfig(DeviceConfig config) - { - var newPropertiesConfig = JsonConvert.DeserializeObject(config.Properties.ToString()); - - if (newPropertiesConfig != null) - PropertiesConfig = newPropertiesConfig; - - ConfigWriter.UpdateRoomConfig(config); - } - - public override bool Deactivate() - { - // Stop listining to this event when room deactivated - VideoCodec.IsReadyChange -= VideoCodec_IsReadyChange; - - // Clear occupancy - RoomOccupancy = null; - - Debug.Console(0, this, "Room '{0}' Deactivated", Name); - - return base.Deactivate(); - } - - public override bool CustomActivate() - { - try - { - if (DefaultAudioDevice is IBasicVolumeControls) - DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls; - else if (DefaultAudioDevice is IHasVolumeDevice) - DefaultVolumeControls = (DefaultAudioDevice as IHasVolumeDevice).VolumeDevice; - CurrentVolumeControls = DefaultVolumeControls; - - - // Combines call feedback from both codecs if available - InCallFeedback = new BoolFeedback(() => - { - bool inAudioCall = false; - bool inVideoCall = false; - - if (AudioCodec != null) - inAudioCall = AudioCodec.IsInCall; - - if (VideoCodec != null) - inVideoCall = VideoCodec.IsInCall; - - if (inAudioCall || inVideoCall) - return true; - else - return false; - }); - - SetupDisplays(); - - // Get Microphone Privacy object, if any MUST HAPPEN AFTER setting InCallFeedback - this.MicrophonePrivacy = EssentialsRoomConfigHelper.GetMicrophonePrivacy(PropertiesConfig, this); - - Debug.Console(2, this, "Microphone Privacy Config evaluated."); - - // Get emergency object, if any - this.Emergency = EssentialsRoomConfigHelper.GetEmergency(PropertiesConfig, this); - - Debug.Console(2, this, "Emergency Config evaluated."); - - if (AudioCodec != null) - { - AudioCodec.CallStatusChange -= AudioCodec_CallStatusChange; - AudioCodec.CallStatusChange += AudioCodec_CallStatusChange; - } - - VideoCodec.CallStatusChange -= VideoCodec_CallStatusChange; - VideoCodec.CallStatusChange += VideoCodec_CallStatusChange; - - VideoCodec.IsReadyChange -= VideoCodec_IsReadyChange; - VideoCodec.IsReadyChange += VideoCodec_IsReadyChange; - - VideoCodec.SharingContentIsOnFeedback.OutputChange -= SharingContentIsOnFeedback_OutputChange; - VideoCodec.SharingContentIsOnFeedback.OutputChange += SharingContentIsOnFeedback_OutputChange; - - - IsSharingFeedback = new BoolFeedback(() => VideoCodec.SharingContentIsOnFeedback.BoolValue); - - // link privacy to VC (for now?) - PrivacyModeIsOnFeedback = new BoolFeedback(() => VideoCodec.PrivacyModeIsOnFeedback.BoolValue); - - VideoCodec.PrivacyModeIsOnFeedback.OutputChange -= PrivacyModeIsOnFeedback_OutputChange; - VideoCodec.PrivacyModeIsOnFeedback.OutputChange += PrivacyModeIsOnFeedback_OutputChange; - - CallTypeFeedback = new IntFeedback(() => 0); - - SetSourceListKey(); - - EnablePowerOnToLastSource = true; - - - // Add Occupancy object from config - if (PropertiesConfig.Occupancy != null) - { - Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Setting Occupancy Provider for room"); - this.SetRoomOccupancy(DeviceManager.GetDeviceForKey(PropertiesConfig.Occupancy.DeviceKey) as - IOccupancyStatusProvider, PropertiesConfig.Occupancy.TimeoutMinutes); - } - - this.LogoUrlLightBkgnd = PropertiesConfig.LogoLight.GetLogoUrlLight(); - this.LogoUrlDarkBkgnd = PropertiesConfig.LogoDark.GetLogoUrlDark(); - - this.DefaultSourceItem = PropertiesConfig.DefaultSourceItem; - this.DefaultVolume = (ushort)(PropertiesConfig.Volumes.Master.Level * 65535 / 100); - - } - catch (Exception e) - { - Debug.Console(0, this, "Error Activiating Room: {0}", e); - } - - - Debug.Console(0, this, "Room '{0}' Activated", Name); - return base.CustomActivate(); - } - - void AudioCodec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e) - { - InCallFeedback.FireUpdate(); - } - - void PrivacyModeIsOnFeedback_OutputChange(object sender, FeedbackEventArgs e) - { - PrivacyModeIsOnFeedback.FireUpdate(); - } - - void VideoCodec_IsReadyChange(object sender, EventArgs e) - { - SetUpVideoCodec(); - } - - void SetUpVideoCodec() - { - SetCodecExternalSources(); - SetCodecBranding(); - } - - void VideoCodec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e) - { - InCallFeedback.FireUpdate(); - } - - void SharingContentIsOnFeedback_OutputChange(object sender, FeedbackEventArgs e) - { - IsSharingFeedback.FireUpdate(); - } - - - - /// - /// - /// - protected override void EndShutdown() - { - VideoCodec.EndAllCalls(); - - SetDefaultLevels(); - - RunDefaultPresentRoute(); - - CrestronEnvironment.Sleep(1000); - - Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Shutting down room"); - - RunRouteAction("roomOff"); - VideoCodec.StopSharing(); - VideoCodec.StandbyActivate(); - } - - /// - /// 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 RunRouteActionCodec(string routeKey, string sourceListKey) - { - _codecExternalSourceChange = true; - RunRouteAction(routeKey, sourceListKey); - } - - /// - /// - /// - /// - public void RunRouteAction(string routeKey) - { - RunRouteAction(routeKey, new Action(() => { })); - } - - /// - /// - /// - /// - /// - /// - public void RunRouteAction(string routeKey, string sourceListKey) - { - if (string.IsNullOrEmpty(sourceListKey)) - { - Debug.Console(1, this, "No sourceListKey present. RunRouteAction assumes default source list."); - RunRouteAction(routeKey, new Action(() => { })); - } - else - { - Debug.Console(1, this, "sourceListKey present but not yet implemented"); - throw new NotImplementedException(); - } - } - - /// - /// - /// - /// - /// - /// - public void RunRouteAction(string routeKey, string sourceListKey, Action successCallback) - { - if (string.IsNullOrEmpty(sourceListKey)) - { - RunRouteAction(routeKey, successCallback); - } - else - throw new NotImplementedException(); - } - - - /// - /// 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(0, this, Debug.ErrorLogLevel.Notice, "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(); - - if (OnFeedback.BoolValue) - { - if (VideoCodec.UsageTracker.InUseTracker.InUseFeedback.BoolValue) - { - Debug.Console(1, this, "Video Codec in use, deactivating standby on codec"); - VideoCodec.StandbyDeactivate(); - } - - if (VideoCodec.StandbyIsOnFeedback.BoolValue) - { - VideoCodec.StandbyDeactivate(); - } - else - { - Debug.Console(1, this, "Video codec not in standby. No need to wake."); - } - } - else - { - Debug.Console(1, this, "Room OnFeedback state: {0}", OnFeedback.BoolValue); - } - - // 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)) - { - foreach (var display in Displays) - { - var tempVideo = new SourceRouteListItem - { - DestinationKey = display.Key, - SourceKey = route.SourceKey, - Type = eRoutingSignalType.Video - }; - DoRoute(tempVideo); - } - } - else - DoRoute(route); - } - - /// - /// - /// - /// - /// - bool DoRoute(SourceRouteListItem route) - { - IRoutingSink dest = null; - - if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase)) - dest = DefaultAudioDevice as IRoutingSink; - //else if (route.DestinationKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase)) - // dest = DefaultDisplay; - else - dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSink; - - 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 IHasPowerControl) - (dest as IHasPowerControl).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 IEssentialsRoom && !(d as IEssentialsHuddleSpaceRoom).ExcludeFromGlobalFunctions); - foreach (var room in allRooms) - (room as IEssentialsHuddleSpaceRoom).RunRouteAction("roomOff"); - } - - - /// - /// Setup the external sources for the Cisco Touch 10 devices that support IHasExternalSourceSwitch - /// - private void SetCodecExternalSources() - { - var videoCodecWithExternalSwitching = VideoCodec as IHasExternalSourceSwitching; - - if (videoCodecWithExternalSwitching == null || !videoCodecWithExternalSwitching.ExternalSourceListEnabled) - { - return; - } - - try - { - // Get the tie line that the external switcher is connected to - string codecInputConnectorName = ConfigReader.ConfigObject.TieLines.SingleOrDefault( - x => x.DestinationKey == VideoCodec.Key && x.DestinationPort == videoCodecWithExternalSwitching.ExternalSourceInputPort).DestinationPort; - - videoCodecWithExternalSwitching.ClearExternalSources(); - videoCodecWithExternalSwitching.RunRouteAction = RunRouteActionCodec; - var srcList = ConfigReader.ConfigObject.SourceLists.SingleOrDefault(x => x.Key == SourceListKey).Value.OrderBy(kv => kv.Value.Order); ; - - foreach (var kvp in srcList) - { - var srcConfig = kvp.Value; - - if (kvp.Key != DefaultCodecRouteString && kvp.Key != "roomOff") - { - videoCodecWithExternalSwitching.AddExternalSource(codecInputConnectorName, kvp.Key, srcConfig.PreferredName, PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.eExternalSourceType.desktop); - videoCodecWithExternalSwitching.SetExternalSourceState(kvp.Key, PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.eExternalSourceMode.Ready); - } - } - - Debug.Console(1, this, "Successfully set up codec external sources for room: {0}", Name); - } - catch (Exception e) - { - Debug.Console(2, this, "Error setting codec external sources: {0}", e); - } - } - - private void SetCodecBranding() - { - var vcWithBranding = VideoCodec as IHasBranding; - - if (vcWithBranding == null) return; - - Debug.Console(1, this, "Setting Codec Branding"); - vcWithBranding.InitializeBranding(Key); - } - - #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/src/PepperDash.Essentials/Room/Types/EssentialsDualDisplayRoom.cs b/src/PepperDash.Essentials/Room/Types/EssentialsDualDisplayRoom.cs deleted file mode 100644 index f02420e4..00000000 --- a/src/PepperDash.Essentials/Room/Types/EssentialsDualDisplayRoom.cs +++ /dev/null @@ -1,675 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -using Full.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; - -namespace PepperDash.Essentials -{ - public class EssentialsDualDisplayRoom : EssentialsNDisplayRoomBase, IHasCurrentVolumeControls, - IRunRouteAction, IPrivacy, IRunDefaultCallRoute, IHasVideoCodec, IHasAudioCodec, IHasInCallFeedback - { - public event EventHandler CurrentVolumeDeviceChange; - - public EssentialsDualDisplayRoomPropertiesConfig PropertiesConfig { get; private set; } - - //************************ - // Call-related stuff - - 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; } - - /// - /// - /// - 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; } - - public IRoutingSinkWithSwitching LeftDisplay { get; private set; } - public 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; - }; - } - } - - /// - /// - /// - protected override Func IsWarmingFeedbackFunc - { - get - { - return () => - { - var leftDisp = LeftDisplay as DisplayBase; - var rightDisp = RightDisplay as DisplayBase; - if (leftDisp != null && RightDisplay != null) - return leftDisp.IsWarmingUpFeedback.BoolValue || rightDisp.IsWarmingUpFeedback.BoolValue; - else - return false; - }; - } - } - - /// - /// - /// - protected override Func IsCoolingFeedbackFunc - { - get - { - return () => - { - var leftDisp = LeftDisplay as DisplayBase; - var rightDisp = RightDisplay as DisplayBase; - if (leftDisp != null && RightDisplay != null) - return leftDisp.IsCoolingDownFeedback.BoolValue || rightDisp.IsCoolingDownFeedback.BoolValue; - else - return false; - }; - } - } - - public IBasicVolumeControls DefaultAudioDevice { get; private set; } - public IBasicVolumeControls DefaultVolumeControls { get; private set; } - - public VideoCodecBase VideoCodec { get; private set; } - - public AudioCodecBase AudioCodec { get; private set; } - - public bool ExcludeFromGlobalFunctions { 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; - - /// - /// "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 EssentialsDualDisplayRoom(DeviceConfig config) - : base(config) - { - try - { - PropertiesConfig = JsonConvert.DeserializeObject - (config.Properties.ToString()); - - var leftDisp = PropertiesConfig.Displays[eSourceListItemDestinationTypes.leftDisplay]; - if (leftDisp != null) - { - if (!string.IsNullOrEmpty(leftDisp.Key)) - { - LeftDisplay = DeviceManager.GetDeviceForKey(leftDisp.Key) as IRoutingSinkWithSwitching; - Displays.Add(eSourceListItemDestinationTypes.leftDisplay, LeftDisplay); - } - else - Debug.Console(0, this, "Unable to get LeftDisplay for Room"); - } - - var rightDisp = PropertiesConfig.Displays[eSourceListItemDestinationTypes.rightDisplay]; - if (rightDisp != null) - { - if (!string.IsNullOrEmpty(rightDisp.Key)) - { - LeftDisplay = DeviceManager.GetDeviceForKey(rightDisp.Key) as IRoutingSinkWithSwitching; - Displays.Add(eSourceListItemDestinationTypes.rightDisplay, RightDisplay); - } - else - Debug.Console(0, this, "Unable to get LeftDisplay for Room"); - } - - VideoCodec = DeviceManager.GetDeviceForKey(PropertiesConfig.VideoCodecKey) as - PepperDash.Essentials.Devices.Common.VideoCodec.VideoCodecBase; - if (VideoCodec == null) - throw new ArgumentNullException("codec cannot be null"); - - AudioCodec = DeviceManager.GetDeviceForKey(PropertiesConfig.AudioCodecKey) as - PepperDash.Essentials.Devices.Common.AudioCodec.AudioCodecBase; - if (AudioCodec == null) - Debug.Console(0, this, "No Audio Codec Found"); - - DefaultAudioDevice = DeviceManager.GetDeviceForKey(PropertiesConfig.DefaultAudioKey) as IBasicVolumeControls; - - InitializeRoom(); - } - catch (Exception e) - { - Debug.Console(1, this, "Error building room \n{0}", e); - } - } - - void InitializeRoom() - { - if (DefaultAudioDevice is IBasicVolumeControls) - DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls; - else if (DefaultAudioDevice is IHasVolumeDevice) - DefaultVolumeControls = (DefaultAudioDevice as IHasVolumeDevice).VolumeDevice; - CurrentVolumeControls = DefaultVolumeControls; - - - var leftDisp = LeftDisplay as DisplayBase; - if (leftDisp != null) - InitializeDisplay(leftDisp); - - var rightDisp = RightDisplay as DisplayBase; - if (rightDisp != null) - InitializeDisplay(rightDisp); - - // Get Microphone Privacy object, if any - this.MicrophonePrivacy = EssentialsRoomConfigHelper.GetMicrophonePrivacy(PropertiesConfig, this); - - Debug.Console(2, this, "Microphone Privacy Config evaluated."); - - // Get emergency object, if any - this.Emergency = EssentialsRoomConfigHelper.GetEmergency(PropertiesConfig, this); - - Debug.Console(2, this, "Emergency Config evaluated."); - - // Combines call feedback from both codecs if available - InCallFeedback = new BoolFeedback(() => - { - bool inAudioCall = false; - bool inVideoCall = false; - - if (AudioCodec != null) - inAudioCall = AudioCodec.IsInCall; - - if (VideoCodec != null) - inVideoCall = VideoCodec.IsInCall; - - if (inAudioCall || inVideoCall) - return true; - else - return false; - }); - - VideoCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate(); - - if (AudioCodec != null) - AudioCodec.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); - - SetSourceListKey(); - EnablePowerOnToLastSource = true; - } - - private void SetSourceListKey() - { - if (!string.IsNullOrEmpty(PropertiesConfig.SourceListKey)) - { - SetSourceListKey(PropertiesConfig.SourceListKey); - } - else - { - SetSourceListKey(Key); - } - - } - - void InitializeDisplay(DisplayBase disp) - { - if (disp != null) - { - // Link power, warming, cooling to display - var dispTwoWay = disp as IHasPowerControlWithFeedback; - if (dispTwoWay != null) - { - dispTwoWay.PowerIsOnFeedback.OutputChange += (o, a) => - { - if (dispTwoWay.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue) - { - if (!dispTwoWay.PowerIsOnFeedback.BoolValue) - disp.CurrentSourceInfo = null; - OnFeedback.FireUpdate(); - } - if (dispTwoWay.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(); - }; - } - } - - protected override void CustomSetConfig(DeviceConfig config) - { - var newPropertiesConfig = JsonConvert.DeserializeObject(config.Properties.ToString()); - - if (newPropertiesConfig != null) - PropertiesConfig = newPropertiesConfig; - - ConfigWriter.UpdateRoomConfig(config); - } - - public override bool CustomActivate() - { - // Add Occupancy object from config - if (PropertiesConfig.Occupancy != null) - this.SetRoomOccupancy(DeviceManager.GetDeviceForKey(PropertiesConfig.Occupancy.DeviceKey) as - IOccupancyStatusProvider, PropertiesConfig.Occupancy.TimeoutMinutes); - - this.LogoUrlLightBkgnd = PropertiesConfig.LogoLight.GetLogoUrlLight(); - this.LogoUrlDarkBkgnd = PropertiesConfig.LogoDark.GetLogoUrlDark(); - this.DefaultSourceItem = PropertiesConfig.DefaultSourceItem; - this.DefaultVolume = (ushort)(PropertiesConfig.Volumes.Master.Level * 65535 / 100); - - return base.CustomActivate(); - } - - /// - /// - /// - protected override void EndShutdown() - { - VideoCodec.EndAllCalls(); - - SetDefaultLevels(); - - RunDefaultPresentRoute(); - - CrestronEnvironment.Sleep(1000); - - RunRouteAction("roomOff", SourceListKey); - } - - /// - /// Routes the default source item, if any. Returns true when default route exists - /// - public override bool RunDefaultPresentRoute() - { - if (DefaultSourceItem != null) - RunRouteAction(DefaultSourceItem, SourceListKey); - - return DefaultSourceItem != null; - } - - /// - /// Sets up the room when started into call mode without presenting a source - /// - /// - public bool RunDefaultCallRoute() - { - RunRouteAction(DefaultCodecRouteString, SourceListKey); - return true; - } - - /// - /// - /// - /// - public void RunRouteAction(string routeKey, string sourceListKey) - { - RunRouteAction(routeKey, sourceListKey, null); - } - - /// - /// Gets a source from config list SourceListKey and dynamically build and executes the - /// route or commands - /// - /// - public void RunRouteAction(string routeKey, string sourceListKey, 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, item, routeKey); - - // 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; - - // 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") - { - LeftDisplay.CurrentSourceInfoKey = routeKey; - LeftDisplay.CurrentSourceInfo = null; - RightDisplay.CurrentSourceInfoKey = routeKey; - RightDisplay.CurrentSourceInfo = null; - } - //else if (item.SourceKey != null) - //{ - // if(item.RouteList - // 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, SourceListItem sourceItem, string sourceItemKey) - { - // 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, sourceItem, sourceItemKey); - } - else - DoRoute(route, sourceItem, sourceItemKey); - } - - /// - /// - /// - /// - /// - bool DoRoute(SourceRouteListItem route, SourceListItem sourceItem, string sourceItemKey) - { - IRoutingSink dest = null; - - if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase)) - dest = DefaultAudioDevice as IRoutingSink; - else if (route.DestinationKey.Equals(LeftDisplay.Key, StringComparison.OrdinalIgnoreCase)) - dest = LeftDisplay; - else if (route.DestinationKey.Equals(RightDisplay.Key, StringComparison.OrdinalIgnoreCase)) - dest = RightDisplay; - else - dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSink; - - 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 IHasPowerControl) - (dest as IHasPowerControl).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); - - dest.CurrentSourceInfoKey = sourceItemKey; - dest.CurrentSourceInfo = sourceItem; - } - 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, SourceListKey); - } - - /// - /// Runs "roomOff" action on all rooms not set to ExcludeFromGlobalFunctions - /// - public static void AllRoomsOff() - { - var allRooms = DeviceManager.AllDevices.Where(d => - d is IEssentialsHuddleSpaceRoom && !(d as IEssentialsHuddleSpaceRoom).ExcludeFromGlobalFunctions); - foreach (var room in allRooms) - (room as IEssentialsHuddleSpaceRoom).RunRouteAction("roomOff", (room as IEssentialsHuddleSpaceRoom).SourceListKey); - } - - #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/src/PepperDash.Essentials/Room/Types/EssentialsHuddleSpaceRoom.cs b/src/PepperDash.Essentials/Room/Types/EssentialsHuddleSpaceRoom.cs deleted file mode 100644 index 7581f1b7..00000000 --- a/src/PepperDash.Essentials/Room/Types/EssentialsHuddleSpaceRoom.cs +++ /dev/null @@ -1,566 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -using Full.Newtonsoft.Json; - -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Room.Config; - -namespace PepperDash.Essentials -{ - public class EssentialsHuddleSpaceRoom : EssentialsRoomBase, IEssentialsHuddleSpaceRoom - { - public event EventHandler CurrentVolumeDeviceChange; - public event SourceInfoChangeHandler CurrentSourceChange; - - 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 EssentialsHuddleRoomPropertiesConfig PropertiesConfig { get; private set; } - - public IRoutingSinkWithSwitching DefaultDisplay { get; private set; } - public IRoutingSink DefaultAudioDevice { get; private set; } - public IBasicVolumeControls DefaultVolumeControls { get; private set; } - - public bool ExcludeFromGlobalFunctions { 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; - - /// - /// - /// - 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; } - set - { - if (value == _CurrentSourceInfo) return; - - var handler = CurrentSourceChange; - // 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(_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( _CurrentSourceInfo, ChangeType.DidChange); - } - } - SourceListItem _CurrentSourceInfo; - - public string CurrentSourceInfoKey { get; set; } - - public EssentialsHuddleSpaceRoom(DeviceConfig config) - : base(config) - { - try - { - PropertiesConfig = JsonConvert.DeserializeObject - (config.Properties.ToString()); - DefaultDisplay = DeviceManager.GetDeviceForKey(PropertiesConfig.DefaultDisplayKey) as IRoutingSinkWithSwitching; - - - DefaultAudioDevice = DeviceManager.GetDeviceForKey(PropertiesConfig.DefaultAudioKey) as IRoutingSinkWithSwitching; - - InitializeRoom(); - } - catch (Exception e) - { - Debug.Console(1, this, "Error building room: \n{0}", e); - } - } - - void InitializeRoom() - { - if (DefaultAudioDevice is IBasicVolumeControls) - DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls; - else if (DefaultAudioDevice is IHasVolumeDevice) - DefaultVolumeControls = (DefaultAudioDevice as IHasVolumeDevice).VolumeDevice; - CurrentVolumeControls = DefaultVolumeControls; - - var disp = DefaultDisplay as DisplayBase; - if (disp != null) - { - // Link power, warming, cooling to display - var dispTwoWay = disp as IHasPowerControlWithFeedback; - if (dispTwoWay != null) - { - dispTwoWay.PowerIsOnFeedback.OutputChange += (o, a) => - { - if (dispTwoWay.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue) - { - if (!dispTwoWay.PowerIsOnFeedback.BoolValue) - CurrentSourceInfo = null; - OnFeedback.FireUpdate(); - } - }; - } - - disp.IsWarmingUpFeedback.OutputChange += (o, a) => - { - IsWarmingUpFeedback.FireUpdate(); - if (!IsWarmingUpFeedback.BoolValue) - (DefaultDisplay as IBasicVolumeWithFeedback).SetVolume(DefaultVolume); - }; - disp.IsCoolingDownFeedback.OutputChange += (o, a) => - { - IsCoolingDownFeedback.FireUpdate(); - }; - } - - SetupEnvironmentalControlDevices(); - - SetSourceListKey(); - - EnablePowerOnToLastSource = true; - } - - private void SetupEnvironmentalControlDevices() - { - if (PropertiesConfig.Environment != null) - { - if (PropertiesConfig.Environment.Enabled) - { - foreach (var d in PropertiesConfig.Environment.DeviceKeys) - { - var envDevice = DeviceManager.GetDeviceForKey(d) as EssentialsDevice; - EnvironmentalControlDevices.Add(envDevice); - } - } - } - } - - private void SetSourceListKey() - { - if (!string.IsNullOrEmpty(PropertiesConfig.SourceListKey)) - { - SetSourceListKey(PropertiesConfig.SourceListKey); - } - else - { - SetSourceListKey(Key); - } - - } - - protected override void CustomSetConfig(DeviceConfig config) - { - var newPropertiesConfig = JsonConvert.DeserializeObject(config.Properties.ToString()); - - if (newPropertiesConfig != null) - PropertiesConfig = newPropertiesConfig; - - ConfigWriter.UpdateRoomConfig(config); - } - - /// - /// - /// - protected override void EndShutdown() - { - SetDefaultLevels(); - - RunDefaultPresentRoute(); - - CrestronEnvironment.Sleep(1000); - - Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Shutting down room"); - - RunRouteAction("roomOff"); - } - - /// - /// Routes the default source item, if any - /// - public override bool RunDefaultPresentRoute() - { - if (DefaultSourceItem == null) - { - Debug.Console(0, this, "Unable to run default present route, DefaultSourceItem is null."); - return false; - } - - RunRouteAction(DefaultSourceItem); - return true; - } - - public override bool CustomActivate() - { - // Add Occupancy object from config - if (PropertiesConfig.Occupancy != null) - this.SetRoomOccupancy(DeviceManager.GetDeviceForKey(PropertiesConfig.Occupancy.DeviceKey) as - IOccupancyStatusProvider, PropertiesConfig.Occupancy.TimeoutMinutes); - - this.LogoUrlLightBkgnd = PropertiesConfig.LogoLight.GetLogoUrlLight(); - this.LogoUrlDarkBkgnd = PropertiesConfig.LogoDark.GetLogoUrlDark(); - this.DefaultSourceItem = PropertiesConfig.DefaultSourceItem; - this.DefaultVolume = (ushort)(PropertiesConfig.Volumes.Master.Level * 65535 / 100); - - return base.CustomActivate(); - } - - /// - /// - /// - /// - public void RunRouteAction(string routeKey) - { - RunRouteAction(routeKey, new Action(() => { })); - } - - /// - /// - /// - /// - /// - /// - public void RunRouteAction(string routeKey, string sourceListKey) - { - RunRouteAction(routeKey, new Action(() => { })); - } - - /// - /// - /// - /// - /// - /// - public void RunRouteAction(string routeKey, string sourceListKey, Action successCallback) - { - if (string.IsNullOrEmpty(sourceListKey)) - { - RunRouteAction(routeKey, successCallback); - } - else - throw new NotImplementedException(); - } - - /// - /// 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 => - { - Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "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; - } - - var item = dict[routeKey]; - //Debug.Console(2, this, "Action {0} has {1} steps", - // item.SourceKey, item.RouteList.Count); - - // End usage timer on last source - if (!string.IsNullOrEmpty(LastSourceKey)) - { - var lastSource = dict[LastSourceKey].SourceDevice; - - try - { - if (lastSource != null && lastSource is IUsageTracking) - (lastSource as IUsageTracking).UsageTracker.EndDeviceUsage(); - } - catch (Exception e) - { - Debug.Console(1, this, "*#* EXCEPTION in end usage tracking (257):\r{0}", e); - } - } - - // Let's run it - if (routeKey.ToLower() != "roomoff") - { - LastSourceKey = routeKey; - } - else - { - CurrentSourceInfoKey = null; - } - - foreach (var route in item.RouteList) - { - // 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); - - //var tempAudio = new SourceRouteListItem - //{ - // DestinationKey = "$defaultAudio", - // SourceKey = route.SourceKey, - // Type = eRoutingSignalType.Audio - //}; - //DoRoute(tempAudio); - //continue; -- not sure why this was here - } - else - DoRoute(route); - } - - // Start usage timer on routed source - if (item.SourceDevice is IUsageTracking) - { - (item.SourceDevice as IUsageTracking).UsageTracker.StartDeviceUsage(); - } - - - - - // 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; - } - // And finally, set the "control". This will trigger event - //CurrentControlDevice = DeviceManager.GetDeviceForKey(item.SourceKey) as Device; - - OnFeedback.FireUpdate(); - - // report back when done - if (successCallback != null) - successCallback(); - - }, 0); // end of CTimer - } - - /// - /// Will power the room on with the last-used source - /// - public override void PowerOnToDefaultOrLastSource() - { - if (!EnablePowerOnToLastSource || LastSourceKey == null) - return; - RunRouteAction(LastSourceKey); - } - - /// - /// 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); - } - - /// - /// - /// - /// - /// - bool DoRoute(SourceRouteListItem route) - { - IRoutingSink dest = null; - - if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase)) - dest = DefaultAudioDevice; - else if (route.DestinationKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase)) - dest = DefaultDisplay; - else - dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSink; - - 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 IHasPowerControl) - (dest as IHasPowerControl).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 - } - - /// - /// 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"); - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/Room/Types/EssentialsHuddleVtc1Room.cs b/src/PepperDash.Essentials/Room/Types/EssentialsHuddleVtc1Room.cs deleted file mode 100644 index 9c8c87e1..00000000 --- a/src/PepperDash.Essentials/Room/Types/EssentialsHuddleVtc1Room.cs +++ /dev/null @@ -1,948 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -using Full.Newtonsoft.Json; - -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; -using PepperDash.Essentials.Devices.Common.AudioCodec; -using PepperDash.Essentials.Core.DeviceTypeInterfaces; - -namespace PepperDash.Essentials -{ - public class EssentialsHuddleVtc1Room : EssentialsRoomBase, IEssentialsHuddleVtc1Room - { - private IEssentialsRoomCombiner _roomCombiner; - - private bool _codecExternalSourceChange; - public event EventHandler CurrentVolumeDeviceChange; - public event SourceInfoChangeHandler CurrentSourceChange; - - - //************************ - // 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 AudioCodecBase AudioCodec { get; private set; } - - public bool ExcludeFromGlobalFunctions { 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; } - set - { - if (value == _CurrentSourceInfo) return; - - var handler = CurrentSourceChange; - // 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(_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(_CurrentSourceInfo, ChangeType.DidChange); - - var vc = VideoCodec as IHasExternalSourceSwitching; - if (vc != null && !_codecExternalSourceChange) - { - vc.SetSelectedSource(CurrentSourceInfoKey); - } - - _codecExternalSourceChange = false; - } - } - SourceListItem _CurrentSourceInfo; - - public string CurrentSourceInfoKey { get; 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(DeviceConfig config) - : base(config) - { - try - { - PropertiesConfig = JsonConvert.DeserializeObject - (config.Properties.ToString()); - DefaultDisplay = DeviceManager.GetDeviceForKey((PropertiesConfig as EssentialsHuddleVtc1PropertiesConfig).DefaultDisplayKey) as IRoutingSinkWithSwitching; - - VideoCodec = DeviceManager.GetDeviceForKey(PropertiesConfig.VideoCodecKey) as - PepperDash.Essentials.Devices.Common.VideoCodec.VideoCodecBase; - - - if (VideoCodec == null) - { - Debug.Console(0, Debug.ErrorLogLevel.Error, "No Video Codec set. Please check 'videoCodecKey' property in room config"); - throw new ArgumentNullException("VideoCodec cannot be null"); - } - - AudioCodec = DeviceManager.GetDeviceForKey(PropertiesConfig.AudioCodecKey) as - PepperDash.Essentials.Devices.Common.AudioCodec.AudioCodecBase; - if (AudioCodec == null) - Debug.Console(0, this, "No Audio Codec Found"); - - DefaultAudioDevice = DeviceManager.GetDeviceForKey(PropertiesConfig.DefaultAudioKey) as IBasicVolumeControls; - if (DefaultAudioDevice == null) - { - Debug.Console(0, Debug.ErrorLogLevel.Error, "No Default Audio Device set. Please check 'defaultAudioKey' property in room config"); - throw new ArgumentNullException("DefaultAudioDevice cannot be null"); - } - - Initialize(); - } - catch (Exception e) - { - Debug.Console(1, this, "Error building room: \n{0}", e); - } - } - - - private void SetupEnvironmentalControlDevices() - { - if (PropertiesConfig.Environment != null) - { - if (PropertiesConfig.Environment.Enabled) - { - EnvironmentalControlDevices.Clear(); - - foreach (var d in PropertiesConfig.Environment.DeviceKeys) - { - var envDevice = DeviceManager.GetDeviceForKey(d) as EssentialsDevice; - EnvironmentalControlDevices.Add(envDevice); - } - } - } - } - - - private void SetSourceListKey() - { - if (!string.IsNullOrEmpty(PropertiesConfig.SourceListKey)) - { - SetSourceListKey(PropertiesConfig.SourceListKey); - } - else - { - SetSourceListKey(Key); - } - - SetUpVideoCodec(); - } - - protected override void CustomSetConfig(DeviceConfig config) - { - var newPropertiesConfig = JsonConvert.DeserializeObject(config.Properties.ToString()); - - if (newPropertiesConfig != null) - PropertiesConfig = newPropertiesConfig; - - ConfigWriter.UpdateRoomConfig(config); - } - - public override bool Deactivate() - { - - // Stop listining to this event when room deactivated - VideoCodec.IsReadyChange -= VideoCodec_IsReadyChange; - - // Clear occupancy - RoomOccupancy = null; - - Debug.Console(0, this, "Room '{0}' Deactivated", Name); - - return base.Deactivate(); - } - - public override bool CustomActivate() - { - try - { - if (DefaultAudioDevice is IBasicVolumeControls) - DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls; - else if (DefaultAudioDevice is IHasVolumeDevice) - DefaultVolumeControls = (DefaultAudioDevice as IHasVolumeDevice).VolumeDevice; - CurrentVolumeControls = DefaultVolumeControls; - - - // Combines call feedback from both codecs if available - InCallFeedback = new BoolFeedback(() => - { - bool inAudioCall = false; - bool inVideoCall = false; - - if (AudioCodec != null) - inAudioCall = AudioCodec.IsInCall; - - if (VideoCodec != null) - inVideoCall = VideoCodec.IsInCall; - - if (inAudioCall || inVideoCall) - return true; - else - return false; - }); - - var disp = DefaultDisplay as DisplayBase; - if (disp != null) - { - // Link power, warming, cooling to display - var dispTwoWay = disp as IHasPowerControlWithFeedback; - if (dispTwoWay != null) - { - dispTwoWay.PowerIsOnFeedback.OutputChange -= PowerIsOnFeedback_OutputChange; - dispTwoWay.PowerIsOnFeedback.OutputChange += PowerIsOnFeedback_OutputChange; - } - - disp.IsWarmingUpFeedback.OutputChange -= IsWarmingUpFeedback_OutputChange; - disp.IsWarmingUpFeedback.OutputChange += IsWarmingUpFeedback_OutputChange; - - disp.IsCoolingDownFeedback.OutputChange -= IsCoolingDownFeedback_OutputChange; - disp.IsCoolingDownFeedback.OutputChange += IsCoolingDownFeedback_OutputChange; - } - - - - // Get Microphone Privacy object, if any MUST HAPPEN AFTER setting InCallFeedback - this.MicrophonePrivacy = EssentialsRoomConfigHelper.GetMicrophonePrivacy(PropertiesConfig, this); - - Debug.Console(2, this, "Microphone Privacy Config evaluated."); - - // Get emergency object, if any - this.Emergency = EssentialsRoomConfigHelper.GetEmergency(PropertiesConfig, this); - - Debug.Console(2, this, "Emergency Config evaluated."); - - if (AudioCodec != null) - { - AudioCodec.CallStatusChange -= AudioCodec_CallStatusChange; - AudioCodec.CallStatusChange += AudioCodec_CallStatusChange; - } - - VideoCodec.CallStatusChange -= VideoCodec_CallStatusChange; - VideoCodec.CallStatusChange += VideoCodec_CallStatusChange; - - VideoCodec.IsReadyChange -= VideoCodec_IsReadyChange; - VideoCodec.IsReadyChange += VideoCodec_IsReadyChange; - - VideoCodec.SharingContentIsOnFeedback.OutputChange -= SharingContentIsOnFeedback_OutputChange; - VideoCodec.SharingContentIsOnFeedback.OutputChange += SharingContentIsOnFeedback_OutputChange; - - - IsSharingFeedback = new BoolFeedback(() => VideoCodec.SharingContentIsOnFeedback.BoolValue); - - // link privacy to VC (for now?) - PrivacyModeIsOnFeedback = new BoolFeedback(() => VideoCodec.PrivacyModeIsOnFeedback.BoolValue); - - VideoCodec.PrivacyModeIsOnFeedback.OutputChange -= PrivacyModeIsOnFeedback_OutputChange; - VideoCodec.PrivacyModeIsOnFeedback.OutputChange += PrivacyModeIsOnFeedback_OutputChange; - - CallTypeFeedback = new IntFeedback(() => 0); - - SetupEnvironmentalControlDevices(); - - SetSourceListKey(); - - EnablePowerOnToLastSource = true; - - - // Add Occupancy object from config - if (PropertiesConfig.Occupancy != null) - { - Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Setting Occupancy Provider for room"); - this.SetRoomOccupancy(DeviceManager.GetDeviceForKey(PropertiesConfig.Occupancy.DeviceKey) as - IOccupancyStatusProvider, PropertiesConfig.Occupancy.TimeoutMinutes); - } - - this.LogoUrlLightBkgnd = PropertiesConfig.LogoLight.GetLogoUrlLight(); - this.LogoUrlDarkBkgnd = PropertiesConfig.LogoDark.GetLogoUrlDark(); - - this.DefaultSourceItem = PropertiesConfig.DefaultSourceItem; - this.DefaultVolume = (ushort)(PropertiesConfig.Volumes.Master.Level * 65535 / 100); - } - catch (Exception e) - { - Debug.Console(0, this, "Error Activiating Room: {0}", e); - } - - Debug.Console(0, this, "Room '{0}' Activated", Name); - return base.CustomActivate(); - } - - void PrivacyModeIsOnFeedback_OutputChange(object sender, FeedbackEventArgs e) - { - PrivacyModeIsOnFeedback.FireUpdate(); - } - - void SharingContentIsOnFeedback_OutputChange(object sender, FeedbackEventArgs e) - { - IsSharingFeedback.FireUpdate(); - } - - void AudioCodec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e) - { - InCallFeedback.FireUpdate(); - } - - void VideoCodec_IsReadyChange(object sender, EventArgs e) - { - SetUpVideoCodec(); - } - - void SetUpVideoCodec() - { - SetCodecExternalSources(); - SetCodecBranding(); - } - - void VideoCodec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e) - { - InCallFeedback.FireUpdate(); - } - - void IsCoolingDownFeedback_OutputChange(object sender, FeedbackEventArgs e) - { - IsCoolingDownFeedback.FireUpdate(); - } - - void IsWarmingUpFeedback_OutputChange(object sender, FeedbackEventArgs e) - { - IsWarmingUpFeedback.FireUpdate(); - if (!IsWarmingUpFeedback.BoolValue) - (CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(DefaultVolume); - - } - - void PowerIsOnFeedback_OutputChange(object sender, FeedbackEventArgs e) - { - var dispTwoWay = DefaultDisplay as IHasPowerControlWithFeedback; - - if (dispTwoWay.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue) - { - if (!dispTwoWay.PowerIsOnFeedback.BoolValue) - CurrentSourceInfo = null; - OnFeedback.FireUpdate(); - } - if (dispTwoWay.PowerIsOnFeedback.BoolValue) - { - SetDefaultLevels(); - } - - } - - - - /// - /// - /// - protected override void EndShutdown() - { - VideoCodec.EndAllCalls(); - - SetDefaultLevels(); - - RunDefaultPresentRoute(); - - CrestronEnvironment.Sleep(1000); - - Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Shutting down room"); - - RunRouteAction("roomOff"); - VideoCodec.StopSharing(); - VideoCodec.StandbyActivate(); - } - - /// - /// 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() - { - Debug.Console(2, this, "RunDefaultCallRoute() Currently Sharing Content: {0}", VideoCodec.SharingContentIsOnFeedback.BoolValue); - - if (VideoCodec.SharingContentIsOnFeedback.BoolValue) - { - Debug.Console(2, this, "Currently sharing content. Ignoring request to run default call route."); - return false; - } - - RunRouteAction(DefaultCodecRouteString); - return true; - } - - public void RunRouteActionCodec(string routeKey, string sourceListKey) - { - _codecExternalSourceChange = true; - RunRouteAction(routeKey, sourceListKey); - } - - /// - /// - /// - /// - public void RunRouteAction(string routeKey) - { - RunRouteAction(routeKey, new Action(() => { })); - } - - /// - /// - /// - /// - /// - /// - public void RunRouteAction(string routeKey, string sourceListKey) - { - if (string.IsNullOrEmpty(sourceListKey)) - { - Debug.Console(1, this, "No sourceListKey present. RunRouteAction assumes default source list."); - RunRouteAction(routeKey, new Action(() => { })); - } - else - { - Debug.Console(1, this, "sourceListKey present but not yet implemented"); - - RunRouteAction(routeKey, new Action(() => { })); - } - } - - /// - /// - /// - /// - /// - /// - public void RunRouteAction(string routeKey, string sourceListKey, Action successCallback) - { - if (string.IsNullOrEmpty(sourceListKey)) - { - RunRouteAction(routeKey, successCallback); - } - else - { - Debug.Console(1, this, "sourceListKey present but not yet implemented"); - - RunRouteAction(routeKey, successCallback); - } - } - - /// - /// 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(0, this, Debug.ErrorLogLevel.Notice, "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(); - - if (OnFeedback.BoolValue) - { - if (VideoCodec.UsageTracker.InUseTracker.InUseFeedback.BoolValue) - { - Debug.Console(1, this, "Video Codec in use, deactivating standby on codec"); - VideoCodec.StandbyDeactivate(); - } - - if (VideoCodec.StandbyIsOnFeedback.BoolValue) - { - VideoCodec.StandbyDeactivate(); - } - else - { - Debug.Console(1, this, "Video codec not in standby. No need to wake."); - } - } - else - { - Debug.Console(1, this, "Room OnFeedback state: {0}", OnFeedback.BoolValue); - } - - // 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) - { - IRoutingSink dest = null; - - if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase)) - dest = DefaultAudioDevice as IRoutingSink; - else if (route.DestinationKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase)) - dest = DefaultDisplay; - else - dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSink; - - - 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 IHasPowerControl) - (dest as IHasPowerControl).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 - } - - protected override bool AllowVacancyTimerToStart() - { - bool allowVideo = true; - bool allowAudio = true; - - if (VideoCodec != null) - { - Debug.Console(2,this, Debug.ErrorLogLevel.Notice, "Room {0} {1} in a video call", Key, VideoCodec.IsInCall ? "is" : "is not"); - allowVideo = !VideoCodec.IsInCall; - } - - if (AudioCodec != null) - { - Debug.Console(2,this, Debug.ErrorLogLevel.Notice, "Room {0} {1} in an audio call", Key, AudioCodec.IsInCall ? "is" : "is not"); - allowAudio = !AudioCodec.IsInCall; - } - - Debug.Console(2, this, "Room {0} allowing vacancy timer to start: {1}", Key, allowVideo && allowAudio); - - return allowVideo && allowAudio; - } - - /// - /// 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 IEssentialsRoom && !(d as IEssentialsHuddleSpaceRoom).ExcludeFromGlobalFunctions); - foreach (var room in allRooms) - (room as IEssentialsHuddleSpaceRoom).RunRouteAction("roomOff"); - } - - - /// - /// Setup the external sources for the Cisco Touch 10 devices that support IHasExternalSourceSwitch - /// - private void SetCodecExternalSources() - { - var videoCodecWithExternalSwitching = VideoCodec as IHasExternalSourceSwitching; - - if (videoCodecWithExternalSwitching == null || !videoCodecWithExternalSwitching.ExternalSourceListEnabled) - { - return; - } - - try - { - // Get the tie line that the external switcher is connected to - string codecInputConnectorName = ConfigReader.ConfigObject.TieLines.SingleOrDefault( - x => x.DestinationKey == VideoCodec.Key && x.DestinationPort == videoCodecWithExternalSwitching.ExternalSourceInputPort).DestinationPort; - - videoCodecWithExternalSwitching.ClearExternalSources(); - videoCodecWithExternalSwitching.RunRouteAction = RunRouteActionCodec; - var srcList = ConfigReader.ConfigObject.SourceLists.SingleOrDefault(x => x.Key == SourceListKey).Value.OrderBy(kv => kv.Value.Order); ; - - foreach (var kvp in srcList) - { - var srcConfig = kvp.Value; - - if (kvp.Key != DefaultCodecRouteString && kvp.Key != "roomOff") - { - videoCodecWithExternalSwitching.AddExternalSource(codecInputConnectorName, kvp.Key, srcConfig.PreferredName, PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.eExternalSourceType.desktop); - videoCodecWithExternalSwitching.SetExternalSourceState(kvp.Key, PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.eExternalSourceMode.Ready); - } - } - Debug.Console(1, this, "Successfully set up codec external sources for room: {0}", Name); - - } - catch (Exception e) - { - Debug.Console(2, this, "Error setting codec external sources: {0}", e); - } - } - - private void SetCodecBranding() - { - var vcWithBranding = VideoCodec as IHasBranding; - - if (vcWithBranding == null) return; - - Debug.Console(1, this, "Setting Codec Branding"); - vcWithBranding.InitializeBranding(Key); - } - - #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/src/PepperDash.Essentials/Room/Types/EssentialsNDisplayRoomBase.cs b/src/PepperDash.Essentials/Room/Types/EssentialsNDisplayRoomBase.cs deleted file mode 100644 index 42b54f24..00000000 --- a/src/PepperDash.Essentials/Room/Types/EssentialsNDisplayRoomBase.cs +++ /dev/null @@ -1,35 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -using Full.Newtonsoft.Json; - -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Devices; -using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Room.Config; - -namespace PepperDash.Essentials -{ - /// - /// Base class for rooms with more than a single display - /// - public abstract class EssentialsNDisplayRoomBase : EssentialsRoomBase, IHasMultipleDisplays - { - //public event SourceInfoChangeHandler CurrentSingleSourceChange; - - public Dictionary Displays { get; protected set;} - - public EssentialsNDisplayRoomBase(DeviceConfig config) - : base (config) - { - Displays = new Dictionary(); - - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/Room/Types/EssentialsTechRoom.cs b/src/PepperDash.Essentials/Room/Types/EssentialsTechRoom.cs deleted file mode 100644 index 5ff997c1..00000000 --- a/src/PepperDash.Essentials/Room/Types/EssentialsTechRoom.cs +++ /dev/null @@ -1,519 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using Crestron.SimplSharp; -using Crestron.SimplSharp.Scheduler; -using Crestron.SimplSharpPro.DeviceSupport; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Core.DeviceTypeInterfaces; -using PepperDash.Essentials.Core.Presets; -using PepperDash.Essentials.Devices.Common; -using PepperDash.Essentials.Room.Config; - -namespace PepperDash.Essentials -{ - public class EssentialsTechRoom : EssentialsRoomBase, ITvPresetsProvider, IBridgeAdvanced, IRunDirectRouteAction - { - public EssentialsTechRoomConfig PropertiesConfig { get; private set; } - private readonly Dictionary _displays; - - private readonly DevicePresetsModel _tunerPresets; - private readonly Dictionary _tuners; - - private Dictionary _currentPresets; - private ScheduledEventGroup _roomScheduledEventGroup; - - /// - /// - /// - protected override Func IsWarmingFeedbackFunc - { - get - { - return () => - { - return _displays.All(kv => kv.Value.IsWarmingUpFeedback.BoolValue); - }; - } - } - /// - /// - /// - protected override Func IsCoolingFeedbackFunc - { - get - { - return () => - { - return _displays.All(kv => kv.Value.IsCoolingDownFeedback.BoolValue); - }; - } - } - - public EssentialsTechRoom(DeviceConfig config) : base(config) - { - PropertiesConfig = config.Properties.ToObject(); - - _tunerPresets = new DevicePresetsModel(String.Format("{0}-presets", config.Key), PropertiesConfig.PresetsFileName); - - _tunerPresets.SetFileName(PropertiesConfig.PresetsFileName); - - _tunerPresets.PresetRecalled += TunerPresetsOnPresetRecalled; - - _tuners = GetDevices(PropertiesConfig.Tuners); - _displays = GetDevices(PropertiesConfig.Displays); - - RoomPowerIsOnFeedback = new BoolFeedback(() => RoomPowerIsOn); - - SetUpTunerPresetsFeedback(); - - SubscribeToDisplayFeedbacks(); - - CreateOrUpdateScheduledEvents(); - } - - public Dictionary CurrentPresetsFeedbacks { get; private set; } - - public Dictionary Tuners - { - get { return _tuners; } - } - - public Dictionary Displays - { - get { return _displays; } - } - - public BoolFeedback RoomPowerIsOnFeedback { get; private set; } - - public bool RoomPowerIsOn - { - get { return _displays.All(kv => kv.Value.PowerIsOnFeedback.BoolValue); } - } - - #region ITvPresetsProvider Members - - public DevicePresetsModel TvPresets - { - get { return _tunerPresets; } - } - - #endregion - - private void TunerPresetsOnPresetRecalled(ISetTopBoxNumericKeypad device, string channel) - { - //Debug.Console(2, this, "TunerPresetsOnPresetRecalled"); - - if (!_currentPresets.ContainsKey(device.Key)) - { - return; - } - - //Debug.Console(2, this, "Tuner Key: {0} Channel: {1}", device.Key, channel); - - _currentPresets[device.Key] = channel; - - if (CurrentPresetsFeedbacks.ContainsKey(device.Key)) - { - CurrentPresetsFeedbacks[device.Key].FireUpdate(); - } - } - - private void SetUpTunerPresetsFeedback() - { - _currentPresets = new Dictionary(); - CurrentPresetsFeedbacks = new Dictionary(); - - foreach (var setTopBox in _tuners) - { - var tuner = setTopBox.Value; - _currentPresets.Add(tuner.Key, String.Empty); - CurrentPresetsFeedbacks.Add(tuner.Key, new StringFeedback(() => _currentPresets[tuner.Key])); - } - } - - private void SubscribeToDisplayFeedbacks() - { - foreach (var display in _displays) - { - display.Value.PowerIsOnFeedback.OutputChange += - (sender, args) => - { - RoomPowerIsOnFeedback.InvokeFireUpdate(); - IsWarmingUpFeedback.InvokeFireUpdate(); - IsCoolingDownFeedback.InvokeFireUpdate(); - }; - } - } - - private void CreateOrUpdateScheduledEvents() - { - var eventsConfig = PropertiesConfig.ScheduledEvents; - - GetOrCreateScheduleGroup(); - - foreach (var eventConfig in eventsConfig) - { - CreateOrUpdateSingleEvent(eventConfig); - } - - _roomScheduledEventGroup.UserGroupCallBack += HandleScheduledEvent; - } - - private void GetOrCreateScheduleGroup() - { - if (_roomScheduledEventGroup == null) - { - _roomScheduledEventGroup = Scheduler.GetEventGroup(Key) ?? new ScheduledEventGroup(Key); - - Scheduler.AddEventGroup(_roomScheduledEventGroup); - } - - _roomScheduledEventGroup.RetrieveAllEvents(); - } - - private void CreateOrUpdateSingleEvent(ScheduledEventConfig scheduledEvent) - { - if (!_roomScheduledEventGroup.ScheduledEvents.ContainsKey(scheduledEvent.Key)) - { - SchedulerUtilities.CreateEventFromConfig(scheduledEvent, _roomScheduledEventGroup, HandleScheduledEvent); - return; - } - - var roomEvent = _roomScheduledEventGroup.ScheduledEvents[scheduledEvent.Key]; - - //if (SchedulerUtilities.CheckEventTimeForMatch(roomEvent, DateTime.Parse(scheduledEvent.Time)) && - // SchedulerUtilities.CheckEventRecurrenceForMatch(roomEvent, scheduledEvent.Days)) - //{ - // Debug.Console(1, this, "Existing event matches new event properties. Nothing to update"); - // return; - //} - - Debug.Console(1, this, - "Existing event does not match new config properties. Deleting existing event '{0}' and creating new event from configuration", - roomEvent.Name); - - _roomScheduledEventGroup.DeleteEvent(roomEvent); - - SchedulerUtilities.CreateEventFromConfig(scheduledEvent, _roomScheduledEventGroup, HandleScheduledEvent); - } - - public void AddOrUpdateScheduledEvent(ScheduledEventConfig scheduledEvent) - { - //update config based on key of scheduleEvent - GetOrCreateScheduleGroup(); - var existingEventIndex = PropertiesConfig.ScheduledEvents.FindIndex((e) => e.Key == scheduledEvent.Key); - - if (existingEventIndex < 0) - { - PropertiesConfig.ScheduledEvents.Add(scheduledEvent); - } - else - { - PropertiesConfig.ScheduledEvents[existingEventIndex] = scheduledEvent; - } - - //create or update event based on config - CreateOrUpdateSingleEvent(scheduledEvent); - //save config - Config.Properties = JToken.FromObject(PropertiesConfig); - - CustomSetConfig(Config); - //Fire Event - OnScheduledEventUpdate(); - } - - public List GetScheduledEvents() - { - return PropertiesConfig.ScheduledEvents ?? new List(); - } - - private void OnScheduledEventUpdate() - { - var handler = ScheduledEventsChanged; - - if (handler == null) - { - return; - } - - handler(this, new ScheduledEventEventArgs {ScheduledEvents = PropertiesConfig.ScheduledEvents}); - } - - public event EventHandler ScheduledEventsChanged; - - private void HandleScheduledEvent(ScheduledEvent schevent, ScheduledEventCommon.eCallbackReason type) - { - var eventConfig = PropertiesConfig.ScheduledEvents.FirstOrDefault(e => e.Key == schevent.Name); - - if (eventConfig == null) - { - Debug.Console(1, this, "Event with name {0} not found", schevent.Name); - return; - } - - Debug.Console(1, this, "Running actions for event {0}", schevent.Name); - - if (eventConfig.Acknowledgeable) - { - schevent.Acknowledge(); - } - - CrestronInvoke.BeginInvoke((o) => - { - Debug.Console(2, this, "There are {0} actions to execute for this event.", eventConfig.Actions.Count); - - foreach (var a in eventConfig.Actions) - { - Debug.Console(2, this, -@"Attempting to run action: -Key: {0} -MethodName: {1} -Params: {2}" - , a.DeviceKey, a.MethodName, a.Params); - DeviceJsonApi.DoDeviceAction(a); - } - }); - } - - - public void RoomPowerOn() - { - Debug.Console(2, this, "Room Powering On"); - - var dummySource = DeviceManager.GetDeviceForKey(PropertiesConfig.DummySourceKey) as IRoutingOutputs; - - if (dummySource == null) - { - Debug.Console(1, this, "Unable to get source with key: {0}", PropertiesConfig.DummySourceKey); - return; - } - - foreach (var display in _displays) - { - RunDirectRoute(dummySource, display.Value); - } - } - - public void RoomPowerOff() - { - Debug.Console(2, this, "Room Powering Off"); - - foreach (var display in _displays) - { - display.Value.PowerOff(); - } - } - - private Dictionary GetDevices(ICollection config) where T : IKeyed - { - try - { - var returnValue = DeviceManager.AllDevices.OfType() - .Where(d => config.Contains(d.Key)) - .ToDictionary(d => d.Key, d => d); - - return returnValue; - } - catch - { - Debug.Console(0, this, Debug.ErrorLogLevel.Error, - "Error getting devices. Check Essentials Configuration"); - return null; - } - } - - #region Overrides of EssentialsRoomBase - - protected override Func OnFeedbackFunc - { - get { return () => RoomPowerIsOn; } - } - - protected override void EndShutdown() - { - } - - public override void SetDefaultLevels() - { - } - - public override void PowerOnToDefaultOrLastSource() - { - } - - public override bool RunDefaultPresentRoute() - { - return false; - } - - public override void RoomVacatedForTimeoutPeriod(object o) - { - } - - #endregion - - #region Implementation of IBridgeAdvanced - - public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - - var joinMap = new EssentialsTechRoomJoinMap(joinStart); - var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); - - if (!String.IsNullOrEmpty(joinMapSerialized)) - { - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - } - - if (bridge != null) - { - bridge.AddJoinMap(Key, joinMap); - } - - if (PropertiesConfig.IsPrimary) - { - Debug.Console(1, this, "Linking Primary system Tuner Preset Mirroring"); - if (PropertiesConfig.MirroredTuners != null && PropertiesConfig.MirroredTuners.Count > 0) - { - foreach (var tuner in PropertiesConfig.MirroredTuners) - { - var f = CurrentPresetsFeedbacks[tuner.Value]; - - if (f == null) - { - Debug.Console(1, this, "Unable to find feedback with key: {0}", tuner.Value); - continue; - } - - var join = joinMap.CurrentPreset.JoinNumber + tuner.Key; - f.LinkInputSig(trilist.StringInput[(uint)(join)]); - Debug.Console(1, this, "Linked Current Preset feedback for tuner: {0} to serial join: {1}", tuner.Value, join); - } - } - - //i = 0; - //foreach (var feedback in CurrentPresetsFeedbacks) - //{ - // feedback.Value.LinkInputSig(trilist.StringInput[(uint) (joinMap.CurrentPreset.JoinNumber + i)]); - // i++; - //} - - trilist.OnlineStatusChange += (device, args) => - { - if (!args.DeviceOnLine) - { - return; - } - - foreach (var feedback in CurrentPresetsFeedbacks) - { - feedback.Value.FireUpdate(); - } - }; - - return; - } - else - { - Debug.Console(1, this, "Linking Secondary system Tuner Preset Mirroring"); - - if (PropertiesConfig.MirroredTuners != null && PropertiesConfig.MirroredTuners.Count > 0) - { - foreach (var tuner in PropertiesConfig.MirroredTuners) - { - var t = _tuners[tuner.Value]; - - if (t == null) - { - Debug.Console(1, this, "Unable to find tuner with key: {0}", tuner.Value); - continue; - } - - var join = joinMap.CurrentPreset.JoinNumber + tuner.Key; - trilist.SetStringSigAction(join, s => _tunerPresets.Dial(s, t)); - Debug.Console(1, this, "Linked preset recall action for tuner: {0} to serial join: {1}", tuner.Value, join); - } - - //foreach (var setTopBox in _tuners) - //{ - // var tuner = setTopBox; - - // trilist.SetStringSigAction(joinMap.CurrentPreset.JoinNumber + i, s => _tunerPresets.Dial(s, tuner.Value)); - - //} - } - } - } - - #endregion - - private class EssentialsTechRoomJoinMap : JoinMapBaseAdvanced - { - [JoinName("currentPreset")] - public JoinDataComplete CurrentPreset = new JoinDataComplete(new JoinData {JoinNumber = 1, JoinSpan = 16}, - new JoinMetadata {Description = "Current Tuner Preset", JoinType = eJoinType.Serial}); - - public EssentialsTechRoomJoinMap(uint joinStart) : base(joinStart, typeof(EssentialsTechRoomJoinMap)) - { - } - } - - #region IRunDirectRouteAction Members - - private void RunDirectRoute(IRoutingOutputs source, IRoutingSink dest) - { - if (dest == null) - { - Debug.Console(1, this, "Cannot route, unknown destination '{0}'", dest.Key); - return; - } - - if (source == null) - { - dest.ReleaseRoute(); - if (dest is IHasPowerControl) - (dest as IHasPowerControl).PowerOff(); - } - else - { - dest.ReleaseAndMakeRoute(source, eRoutingSignalType.Video); - } - } - - /// - /// Attempts to route directly between a source and destination - /// - /// - /// - public void RunDirectRoute(string sourceKey, string destinationKey) - { - IRoutingSink dest = null; - - dest = DeviceManager.GetDeviceForKey(destinationKey) as IRoutingSink; - - var source = DeviceManager.GetDeviceForKey(sourceKey) as IRoutingOutputs; - - if (source == null || dest == null) - { - Debug.Console(1, this, "Cannot route unknown source or destination '{0}' to {1}", sourceKey, destinationKey); - return; - } - RunDirectRoute(source, dest); - } - - #endregion - } - - public class ScheduledEventEventArgs : EventArgs - { - public List ScheduledEvents; - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/Room/Types/Interfaces/IEssentialsHuddleSpaceRoom.cs b/src/PepperDash.Essentials/Room/Types/Interfaces/IEssentialsHuddleSpaceRoom.cs deleted file mode 100644 index dccae06a..00000000 --- a/src/PepperDash.Essentials/Room/Types/Interfaces/IEssentialsHuddleSpaceRoom.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; - -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Room.Config; - - - -namespace PepperDash.Essentials -{ - public interface IEssentialsHuddleSpaceRoom : IEssentialsRoom, IHasCurrentSourceInfoChange, IRunRouteAction, IRunDefaultPresentRoute, IHasDefaultDisplay, IHasCurrentVolumeControls, IRoomOccupancy, - IEmergency, IMicrophonePrivacy - { - bool ExcludeFromGlobalFunctions { get; } - - void RunRouteAction(string routeKey); - - EssentialsHuddleRoomPropertiesConfig PropertiesConfig { get; } - - IBasicVolumeControls CurrentVolumeControls { get; } - - event EventHandler CurrentVolumeDeviceChange; - } - - -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/Room/Types/Interfaces/IEssentialsHuddleVtc1Room.cs b/src/PepperDash.Essentials/Room/Types/Interfaces/IEssentialsHuddleVtc1Room.cs deleted file mode 100644 index 85937828..00000000 --- a/src/PepperDash.Essentials/Room/Types/Interfaces/IEssentialsHuddleVtc1Room.cs +++ /dev/null @@ -1,28 +0,0 @@ - -using PepperDash.Essentials.Core; -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 -{ - public interface IEssentialsHuddleVtc1Room : IEssentialsRoom, IHasCurrentSourceInfoChange, - IPrivacy, IHasCurrentVolumeControls, IRunRouteAction, IRunDefaultCallRoute, IHasVideoCodec, IHasAudioCodec, IHasDefaultDisplay, IHasInCallFeedback, - IRoomOccupancy, IEmergency, IMicrophonePrivacy - { - EssentialsHuddleVtc1PropertiesConfig PropertiesConfig { get; } - - bool ExcludeFromGlobalFunctions { get; } - - void RunRouteAction(string routeKey); - - IHasScheduleAwareness ScheduleSource { get; } - - new BoolFeedback InCallFeedback { get; } - - new BoolFeedback PrivacyModeIsOnFeedback { get; } - - string DefaultCodecRouteString { get; } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UI/DualDisplaySourceSRLController.cs b/src/PepperDash.Essentials/UI/DualDisplaySourceSRLController.cs deleted file mode 100644 index c91d72f1..00000000 --- a/src/PepperDash.Essentials/UI/DualDisplaySourceSRLController.cs +++ /dev/null @@ -1,28 +0,0 @@ -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using System.Text; -//using Crestron.SimplSharp; -//using Crestron.SimplSharpPro; -//using Crestron.SimplSharpPro.DeviceSupport; -//using Crestron.SimplSharpPro.UI; - -//using PepperDash.Essentials.Core; - -//namespace PepperDash.Essentials -//{ -// public class DualDisplaySourceSRLController : SubpageReferenceList -// { -// public DualDisplaySourceSRLController(BasicTriListWithSmartObject triList, -// uint smartObjectId, EssentialsPresentationRoom room) -// : base(triList, smartObjectId, 3, 3, 3) -// { -// var srcList = room.s items.Values.ToList().OrderBy(s => s.Order); -// foreach (var item in srcList) -// { -// GetBoolFeedbackSig(index, 1).UserObject = new Action(routeAction); - -// } -// } -// } -//} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UI/EssentialsTouchpanelController.cs b/src/PepperDash.Essentials/UI/EssentialsTouchpanelController.cs deleted file mode 100644 index 630f4f67..00000000 --- a/src/PepperDash.Essentials/UI/EssentialsTouchpanelController.cs +++ /dev/null @@ -1,290 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharp.CrestronIO; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.UI; -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Core.PageManagers; -using PepperDash.Essentials.Core.UI; -using Full.Newtonsoft.Json; - -namespace PepperDash.Essentials -{ - public class EssentialsTouchpanelController : TouchpanelBase - { - public PanelDriverBase PanelDriver { get; private set; } - - CTimer BacklightTransitionedOnTimer; - - /// - /// Config constructor - /// - public EssentialsTouchpanelController(string key, string name, BasicTriListWithSmartObject panel, CrestronTouchpanelPropertiesConfig config) - : base(key, name, panel, config) - { - } - - - /// - /// Sets up drivers and links them to the room specified - /// - /// key of room to link the drivers to - protected override void SetupPanelDrivers(string roomKey) - { - // Clear out any existing actions - Panel.ClearAllSigActions(); - - Debug.Console(0, this, "Linking TP '{0}' to Room '{1}'", Key, roomKey); - - var mainDriver = new EssentialsPanelMainInterfaceDriver(Panel, _config); - // Then the sub drivers - - // spin up different room drivers depending on room type - var room = DeviceManager.GetDeviceForKey(roomKey); - if (room is IEssentialsHuddleSpaceRoom) - { - // Screen Saver Driver - - mainDriver.ScreenSaverController = new ScreenSaverController(mainDriver, _config); - - // Header Driver - Debug.Console(0, this, "Adding header driver"); - mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, _config); - - // AV Driver - Debug.Console(0, this, "Adding huddle space AV driver"); - var avDriver = new EssentialsHuddlePanelAvFunctionsDriver(mainDriver, _config); - avDriver.DefaultRoomKey = roomKey; - mainDriver.AvDriver = avDriver; - avDriver.CurrentRoom = room as IEssentialsHuddleSpaceRoom; - - // Environment Driver - if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0) - { - Debug.Console(0, this, "Adding environment driver"); - mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, _config); - - mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment); - } - - mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom); - - if (Panel is TswFt5ButtonSystem) - { - var tsw = Panel as TswFt5ButtonSystem; - // Wire up hard keys - tsw.Power.UserObject = new Action(b => { if (!b) avDriver.PowerButtonPressed(); }); - if (mainDriver.EnvironmentDriver != null) - tsw.Lights.UserObject = new Action(b => - { - if (!b) - { - mainDriver.EnvironmentDriver.Toggle(); - } - }); - tsw.Up.UserObject = new Action(avDriver.VolumeUpPress); - tsw.Down.UserObject = new Action(avDriver.VolumeDownPress); - } - } - else if (room is IEssentialsHuddleVtc1Room) - { - Debug.Console(0, this, "Adding huddle space VTC AV driver"); - - // Screen Saver Driver - mainDriver.ScreenSaverController = new ScreenSaverController(mainDriver, _config); - - // Header Driver - mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, _config); - - // AV Driver - var avDriver = new EssentialsHuddleVtc1PanelAvFunctionsDriver(mainDriver, _config); - - var codecDriver = new PepperDash.Essentials.UIDrivers.VC.EssentialsVideoCodecUiDriver(Panel, avDriver, - (room as IEssentialsHuddleVtc1Room).VideoCodec, mainDriver.HeaderDriver); - avDriver.SetVideoCodecDriver(codecDriver); - avDriver.DefaultRoomKey = roomKey; - mainDriver.AvDriver = avDriver; - avDriver.CurrentRoom = room as IEssentialsHuddleVtc1Room; - - // Environment Driver - if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0) - { - Debug.Console(0, this, "Adding environment driver"); - mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, _config); - - mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment); - } - - mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom); - - - if (Panel is TswFt5ButtonSystem) - { - var tsw = Panel as TswFt5ButtonSystem; - // Wire up hard keys - tsw.Power.UserObject = new Action(b => { if (!b) avDriver.EndMeetingPress(); }); - if (mainDriver.EnvironmentDriver != null) - tsw.Lights.UserObject = new Action(b => - { - if (!b) - { - mainDriver.EnvironmentDriver.Toggle(); - } - }); - tsw.Up.UserObject = new Action(avDriver.VolumeUpPress); - tsw.Down.UserObject = new Action(avDriver.VolumeDownPress); - } - - LoadAndShowDriver(mainDriver); - } - else - { - Debug.Console(0, this, "ERROR: Cannot load AvFunctionsDriver for room '{0}'", roomKey); - } - - } - - public void LoadAndShowDriver(PanelDriverBase driver) - { - if (PanelDriver != null) - { - var mainDriver = PanelDriver as EssentialsPanelMainInterfaceDriver; - if (mainDriver != null) - { - mainDriver.Dispose(); - } - } - - PanelDriver = driver; - driver.Show(); - } - - protected override void ExtenderSystemReservedSigs_DeviceExtenderSigChange(DeviceExtender currentDeviceExtender, SigEventArgs args) - { - // If the sig is transitioning on, mark it in case it was home button that transitioned it - var blOnSig = (Panel as TswFt5ButtonSystem).ExtenderSystemReservedSigs.BacklightOnFeedback; - if (args.Sig == blOnSig && blOnSig.BoolValue) - { - BacklightTransitionedOnTimer = new CTimer(o => - { - BacklightTransitionedOnTimer = null; - }, 200); - } - } - - public void PulseBool(uint join) - { - var act = Panel.BooleanInput[join].UserObject as Action; - if (act != null) - { - act(true); - act(false); - } - } - - public void SetBoolSig(uint join, bool value) - { - var act = Panel.BooleanInput[join].UserObject as Action; - if (act != null) - act(value); - } - - public void SetIntSig(uint join, ushort value) - { - var act = Panel.BooleanInput[join].UserObject as Action; - if (act != null) - { - act(value); - } - } - } - - public class EssentialsTouchpanelControllerFactory : EssentialsDeviceFactory - { - public EssentialsTouchpanelControllerFactory() - { - TypeNames = new List() { "crestronapp", "tsw550", "tsw750", "tsw1050", "tsw560", "tsw760", "tsw1060", "tsw570", "tsw770", "ts770", "tsw1070", "ts1070", "xpanel" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - var comm = CommFactory.GetControlPropertiesConfig(dc); - var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); - - var panel = GetPanelForType(dc.Type, comm.IpIdInt, props.ProjectName); - - if (panel == null) - { - Debug.Console(0, "Unable to create Touchpanel for type {0}. Touchpanel Controller WILL NOT function correctly", dc.Type); - } - - Debug.Console(1, "Factory Attempting to create new EssentialsTouchpanelController"); - - var panelController = new EssentialsTouchpanelController(dc.Key, dc.Name, panel, props); - - return panelController; - } - - private BasicTriListWithSmartObject GetPanelForType(string type, uint id, string projectName) - { - type = type.ToLower(); - try - { - if (type == "crestronapp") - { - var app = new CrestronApp(id, Global.ControlSystem); - app.ParameterProjectName.Value = projectName; - return app; - } - else if (type == "xpanel") - return new XpanelForSmartGraphics(id, Global.ControlSystem); - else if (type == "tsw550") - return new Tsw550(id, Global.ControlSystem); - else if (type == "tsw552") - return new Tsw552(id, Global.ControlSystem); - else if (type == "tsw560") - return new Tsw560(id, Global.ControlSystem); - else if (type == "tsw750") - return new Tsw750(id, Global.ControlSystem); - else if (type == "tsw752") - return new Tsw752(id, Global.ControlSystem); - else if (type == "tsw760") - return new Tsw760(id, Global.ControlSystem); - else if (type == "tsw1050") - return new Tsw1050(id, Global.ControlSystem); - else if (type == "tsw1052") - return new Tsw1052(id, Global.ControlSystem); - else if (type == "tsw1060") - return new Tsw1060(id, Global.ControlSystem); - else if (type == "tsw570") - return new Tsw570(id, Global.ControlSystem); - else if (type == "tsw770") - return new Tsw770(id, Global.ControlSystem); - else if (type == "ts770") - return new Ts770(id, Global.ControlSystem); - else if (type == "tsw1070") - return new Tsw1070(id, Global.ControlSystem); - else if (type == "ts1070") - return new Ts1070(id, Global.ControlSystem); - else - { - Debug.Console(0, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create TSW controller with type '{0}'", type); - return null; - } - } - catch (Exception e) - { - Debug.Console(0, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create TSW base class. Panel will not function: {0}", e.Message); - return null; - } - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UI/JoinConstants/UIBoolJoin.cs b/src/PepperDash.Essentials/UI/JoinConstants/UIBoolJoin.cs deleted file mode 100644 index a76f5bcb..00000000 --- a/src/PepperDash.Essentials/UI/JoinConstants/UIBoolJoin.cs +++ /dev/null @@ -1,991 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; - -namespace PepperDash.Essentials -{ - /// - /// Where all UI element common joins are defined - /// - public class UIBoolJoin - { - /// - /// 901 - /// - public const uint VolumeUpPress = 901; - /// - /// 902 - /// - public const uint VolumeDownPress = 902; - - //**************************************************** - // Codec General - - /// - /// 1001 - /// - public const uint CallEndPress = 1001; - /// - /// 1002 - /// - public const uint CallEndAllConfirmPress = 1002; - /// - /// 1003 - For tapping the text field to reveal the keyboard - /// - public const uint CodecDirectorySearchTextPress = 1003; - /// - /// 1004 - /// - public const uint CallStopSharingPress = 1004; - /// - /// 1005 - /// - public const uint CallSharedSourceInfoVisible = 1005; - /// - /// 1006 - /// - public const uint CallEndAllConfirmVisible = 1006; - /// - /// 1007 - /// - public const uint MeetingPasswordVisible = 1007; - /// - /// 1008 - /// - public const uint MeetingLeavePress = 1008; - - - - - - // Audio Conference - /// - /// 1101 - /// - public const uint ACKeypadVisible = 1101; - /// - /// 1102 - /// - public const uint ACStagingPopoverVisible = 1102; - /// - /// 1111 - /// - public const uint ACSpeedDial1Press = 1111; - /// - /// 1112 - /// - public const uint ACSpeedDial2Press = 1112; - /// - /// 1113 - /// - public const uint ACSpeedDial3Press = 1113; - /// - /// 1114 - /// - public const uint ACSpeedDial4Press = 1114; - /// - /// 1121 - /// - public const uint ACSpeedDial1Visible = 1121; - /// - /// 1122 - /// - public const uint ACSpeedDial2Visible = 1122; - /// - /// 1123 - /// - public const uint ACSpeedDial3Visible = 1123; - /// - /// 1124 - /// - public const uint ACSpeedDial4Visible = 1124; - - //****************************************************** - // Video Conference - /// - /// 1201 - /// - public const uint VCKeypadWithFavoritesVisible = 1201; - /// - /// 1202 - /// - public const uint VCStagingInactivePopoverWithRecentsVisible = 1202; - /// - /// - /// - public const uint VCStagingActivePopoverVisible = 1203; - /// - /// - /// - public const uint VCKeypadVisible = 1204; - /// - /// 1205 - /// - public const uint VCDirectoryVisible = 1205; - /// - /// 1206 - /// - public const uint VCRecentsVisible = 1206; - - /// - /// 1202 - /// - public const uint VCStagingInactivePopoverWithoutRecentsVisible = 1207; - - /// - /// 1208 - /// - public const uint VCCameraAutoVisible = 1208; - - /// - /// 1209 - /// - public const uint VCCameraManualVisible = 1209; - - /// - /// 1210 - /// - public const uint VCCameraOffVisible = 1210; - - /// - /// 1211 - 1215 - /// - public const uint VCFavoritePressStart = 1211; - // RANGE IN USE - public const uint VCFavoritePressEnd = 1215; - /// - /// 1221 - 1225 - /// - public const uint VCFavoriteVisibleStart = 1221; - // RANGE IN USE - public const uint VCFavoriteVisibleEnd = 1225; - - /// - /// 1230 - /// - public const uint VCStagingMeetNowPress = 1230; - /// - /// 1231 - /// - public const uint VCStagingRecentsPress = 1231; - /// - /// 1232 - /// - public const uint VCStagingDirectoryPress = 1232; - /// - /// 1233 - /// - public const uint VCStagingKeypadPress = 1233; - /// - /// 1234 - /// - public const uint VCStagingConnectPress = 1234; - /// - /// 1235 - /// - public const uint VCStagingCameraPress = 1235; - /// - /// 1236 - /// - public const uint VCStagingConnectEnable = 1236; - /// - /// 1237 - When the user touches the text field, should trigger keyboard - /// - public const uint VCKeypadTextPress = 1237; - /// - /// 1238 - /// - public const uint VCKeypadBackspacePress = 1238; - /// - /// 1239 - /// - public const uint VCKeypadBackspaceVisible = 1239; - /// - /// 1240 - /// - public const uint VCDirectoryBackPress = 1240; - /// - /// 1241 For touching the text area to bring up keyboard - /// - public const uint VCDirectorySearchTextPress = 1241; - /// - /// 1242 - /// - public const uint VCStagingSelfViewLayoutPress = 1242; - /// - /// 1243 - /// - public const uint VCDirectoryBackVisible = 1243; - /// - /// 1244 - /// - public const uint VCDirectoryBackspacePress = 1244; - /// - /// 1245 - /// - public const uint VCDirectoryBackspaceVisible = 1245; - /// - /// 1251 - /// - public const uint VCSelfViewTogglePress = 1251; - /// - /// 1252 - /// - public const uint VCLayoutTogglePress = 1252; - /// - /// 1253 - /// - public const uint VCSelfViewPipTogglePress = 1253; - /// - /// 1254 - /// - public const uint VCLayoutToggleEnable = 1254; - /// - /// 1255 - /// - public const uint VCMinMaxPress = 1255; - /// - /// 1256 - /// - public const uint VCMinMaxEnable = 1256; - - /// - /// 1260 - /// - public const uint VCCameraModeBarVisible = 1260; - - /// - /// 1261 - /// - public const uint VCCameraSelectBarWithoutModeVisible = 1261; - - /// - /// 1262 - /// - public const uint VCCameraAutoModeIsOnFb = 1262; - - /// - /// 1271 - /// - public const uint VCCameraZoomIn = 1271; - /// - /// 1272 - /// - public const uint VCCameraZoomOut = 1272; - - - /// - /// 1280 - /// - public const uint VCCameraPresetSavedLabelVisible = 1280; - /// - /// 1281 - /// - public const uint VCCameraPreset1 = 1281; - /// - /// 1282 - /// - public const uint VCCameraPreset2 = 1282; - /// - /// 1283 - /// - public const uint VCCameraPreset3 = 1283; - - - /// - /// 1291 - /// - public const uint VCCameraPreset1Visible = 1291; - /// - /// 1292 - /// - public const uint VCCameraPreset2Visible = 1292; - /// - /// 1293 - /// - public const uint VCCameraPreset3Visible = 1293; - - - // Letter joins start at 2921; - - //****************************************************** - - // Environment Joins - - // Popup Container - - /// - /// 2001 - 2004 - /// - public const uint EnvironmentBackgroundSubpageVisibleBase = 2000; - - - // ColumnOne - - /// - /// 2011 - 2015 - /// - public const uint EnvironmentColumnOneLightingTypeVisibleBase = 2010; - - /// - /// 2016 - 2020 - /// - public const uint EnvironmentColumnOneShadingTypeVisibleBase = 2015; - - // ColumnTwo - - /// - /// 2021 - 2025 - /// - public const uint EnvironmentColumnTwoLightingTypeVisibleBase = 2020; - - /// - /// 2026 - 2030 - /// - public const uint EnvironmentColumnTwoShadingTypeVisibleBase = 2025; - - // ColumnThree - - /// - /// 2031 - 2035 - /// - public const uint EnvironmentColumnThreeLightingTypeVisibleBase = 2030; - - /// - /// 2036 - 2040 - /// - public const uint EnvironmentColumnThreeShadingTypeVisibleBase = 2035; - - // ColumnFour - - /// - /// 2041 - 2045 - /// - public const uint EnvironmentColumnFourLightingTypeVisibleBase = 2040; - - /// - /// 2046 - 2050 - /// - public const uint EnvironmentColumnFourShadingTypeVisibleBase = 2045; - - // Button press - - /// - /// 2051 - 2060 - /// - public const uint EnvironmentColumnOneButtonPressBase = 2050; - - /// - /// 2061 - 2070 - /// - public const uint EnvironmentColumnTwoButtonPressBase = 2060; - - /// - /// 2071 - 2080 - /// - public const uint EnvironmentColumnThreeButtonPressBase = 2070; - - /// - /// 2081 - 2090 - /// - public const uint EnvironmentColumnFourButtonPressBase = 2080; - - // Button visibility - - /// - /// 2151 - 2160 - /// - public const uint EnvironmentColumnOneButtonVisibleBase = 2150; - - /// - /// 2161 - 2170 - /// - public const uint EnvironmentColumnTwoButtonVisibleBase = 2160; - - /// - /// 2171 - 2180 - /// - public const uint EnvironmentColumnThreeButtonVisibleBase = 2170; - - /// - /// 2181 - 2190 - /// - public const uint EnvironmentColumnFourButtonVisibleBase = 2180; - - - //****************************************************** - - /// - /// 3101 - /// - public const uint TechExitButton = 3101; - /// - /// 3106 - /// - public const uint TechCommonItemsVisbible = 3106; - /// - /// 3107 - /// - public const uint TechSystemStatusVisible = 3107; - /// - /// 3108 - /// - public const uint TechDisplayControlsVisible = 3108; - /// - /// 3109 - /// - public const uint TechPanelSetupVisible = 3109; - /// - /// 3110 - /// - public const uint TechAdvancedVolumeVisible = 3110; - /// - /// 3111 - /// - public const uint TechAboutVisible = 3111; - /// - /// 3112 - /// - public const uint TechSchedulerVisible = 3112; - - //***************************************************** - /// - /// 3811 - /// - public const uint VolumeSingleMute1Visible = 3811; - /// - /// 3812 - /// - public const uint VolumeSlider1Press = 3812; - /// - /// 3813 - /// - public const uint Volume1ProgramMutePressAndFB = 3813; - /// - /// 3821 - /// - public const uint Volume2Visible = 3821; - /// - /// 3822 - /// - public const uint VolumeSlider2Press = 3822; - /// - /// 3823 - /// - public const uint Volume2MutePressAndFB = 3823; - /// - /// 3831 - /// - public const uint Volume3Visible = 3831; - /// - /// 3832 - /// - public const uint VolumeSlider3Press = 3832; - /// - /// 3833 - /// - public const uint Volume3MutePressAndFB = 3833; - /// - /// 3841 - /// - public const uint Volume4Visible = 3841; - /// - /// 3842 - /// - public const uint VolumeSlider4Press = 3842; - /// - /// 3843 - /// - public const uint Volume4MutePressAndFB = 3843; - /// - /// 3851 - /// - public const uint Volume5Visible = 3851; - /// - /// 3852 - /// - public const uint VolumeSlider5Press = 3852; - /// - /// 3853 - /// - public const uint Volume5MutePressAndFB = 3853; - /// - /// 3861 - /// - public const uint Volume6Visible = 3861; - /// - /// 3862 - /// - public const uint VolumeSlider6Press = 3862; - /// - /// 3863 - /// - public const uint Volume6MutePressAndFB = 3863; - - /// - /// 3869 - when the system is off and the gear is pressed - /// - public const uint VolumesPagePowerOffVisible = 3869; - /// - /// 3870 - /// - public const uint VolumesPageVisible = 3870; - /// - /// 3871 - /// - public const uint VolumeDualMute1Visible = 3871; - /// - /// 3874 - /// - public const uint Volume1SpeechMutePressAndFB = 3874; - /// - /// 3875 - /// - public const uint Volume1BackerVisibility = 3875; - /// - /// 3891 - /// - public const uint VolumeDefaultPress = 3891; - /// - /// 3951 - /// - /// 3952 - /// - public const uint HeaderIcon2Press = 3952; - /// - /// 3953 - /// - public const uint HeaderIcon3Press = 3953; - /// - /// 3954 - /// - public const uint HeaderIcon4Press = 3954; - /// - /// 3955 - /// - public const uint HeaderIcon5Press = 3955; - - /// 3960 - /// - public const uint HeaderPopupCaretsSubpageVisibile = 3960; - /// - /// 3961 - /// - public const uint HeaderCaret1Visible = 3961; - /// - /// 3962 - /// - public const uint HeaderCaret2Visible = 3962; - /// - /// 3963 - /// - public const uint HeaderCaret3Visible = 3963; - /// - /// 3964 - /// - public const uint HeaderCaret4Visible = 3964; - /// - /// 3965 - /// - public const uint HeaderCaret5Visible = 3965; - - /// - /// 3999 - /// - public const uint GenericModalVisible = 3999; - /// - /// 12345 - /// - public const uint AvNoControlsSubVisible = 12345; - - // 10000 - 14999 are general "source" pages - - /// - /// 15001 - /// - public const uint StartPageVisible = 15001; - /// - /// 15002 Shows the start page in the source controls area of the screen - /// - public const uint TapToBeginVisible = 15002; - /// - /// 15003 Message text when no source is showing - /// - public const uint SelectASourceVisible = 15003; - /// - /// 15004 - /// - public const uint RoomIsOn = 15004; - /// - /// 15005 Shows always-on volume control subpage with only audio mute - /// - public const uint VolumeControlsSingleMuteVisible = 15005; - /// - /// 15006 Shows always-on volume control subpage with mic and audio mutes - /// - public const uint VolumeControlsDualMuteVisible = 15006; - /// - /// 15010 - /// - public const uint ShowPanelSetupPress = 15010; - /// - /// 15011 - Top bar with room name and button that pops up dialog with room data - /// - public const uint TopBarHabaneroVisible = 15011; - /// - /// 15012 - /// - public const uint SourceStagingBarVisible = 15012; - /// - /// 15013 - /// - public const uint PowerOffStep1Visible = 15013; - /// - /// 15014 - /// - public const uint PowerOffStep2Visible = 15014; - /// - /// 15015 - /// - public const uint ShowPowerOffPress = 15015; - /// - /// 15016 - /// - public const uint PowerOffMorePress = 15016; - /// - /// 15017 - /// - public const uint StagingPageAdditionalArrowsVisible = 15017; - /// - /// 15018 The Header with dynamic buttons - /// - public const uint TopBarHabaneroDynamicVisible = 15018; - /// - /// 15019 Shown when system is starting and not ready for use - /// - public const uint SystemInitializingVisible = 15019; - /// - /// 15020 - /// - public const uint PanelSetupVisible = 15020; - /// - /// 15021 - /// - public const uint SourceWaitOverlayVisible = 15021; - /// - /// 15022 - /// - public const uint ActivityFooterVisible = 15022; - /// - /// 15024 - /// - public const uint HeaderCallStatusLeftPositionVisible = 15024; - /// - /// 15025 - /// - public const uint HeaderCallStatusRightPositionVisible = 15025; - /// - /// 15027 - /// - public const uint HeaderCallStatusLabelPress = 15027; - /// - /// 15028 The gear button in header - /// - public const uint FIXFIX_HeaderGearButtonPress_FIXFIX = 15028; - /// - /// 15029 the room button in header - /// - public const uint HeaderRoomButtonPress = 15029; - /// - /// 15030 Visibility for room data popup - /// - public const uint RoomHeaderInfoPageVisible = 15030; - /// - /// 15031 - /// - public const uint AllRoomsOffPress = 15031; - /// - /// 15032 - /// - public const uint DisplayPowerTogglePress = 15032; - /// - /// 15033 - /// - public const uint PowerOffCancelPress = 15033; - /// - /// 15034 - /// - public const uint PowerOffConfirmPress = 15034; - /// - /// 15035 - /// - public const uint VolumeButtonPopupPress = 15035; - /// - /// 15035 - /// - public const uint VolumeButtonPopupVisible = 15035; - /// - /// 15036 - /// - public const uint VolumeGaugePopupVisible = 15036; - /// - /// 15037 - /// - public const uint GearButtonVisible = 15037; - /// - /// 15038 - /// - public const uint CalendarHeaderButtonVisible = 15038; - /// - /// 15039 - /// - public const uint CalendarHeaderButtonPress = 15039; - /// - /// 15040 - /// - public const uint CallStatusPageVisible = 15040; - /// - /// 15041 - /// - public const uint LightsPageVisible = 15041; - /// - /// 15042 Closes whichever interlocked modal is open - /// - public const uint InterlockedModalClosePress = 15042; - /// - /// 15043 Vis for modal backer for full-screen source - /// - public const uint SourceBackgroundOverlayVisible = 15043; - /// - /// 15044 Close button for source modal overlay - /// - public const uint SourceBackgroundOverlayClosePress = 15044; - /// - /// 15045 - /// - public const uint ZoomRoomContentSharingVisible = 15045; - /// - /// 15046 - /// - public const uint MeetingsOrContacMethodsListVisible = 15046; - /// - /// 15047 The "Join" button on the next meeting ribbon - /// - public const uint NextMeetingJoinPress = 15047; - /// - /// 15048 Dismisses the ribbon - /// - public const uint NextMeetingModalClosePress = 15048; - /// - /// 15049 - /// - public const uint NextMeetingModalVisible = 15049; - /// - /// 15050 - /// - public const uint NextMeetingNotificationRibbonVisible = 15050; - /// - /// 15051 - /// - public const uint Display1SelectPressAndFb = 15051; - /// - /// 15052 - /// - public const uint Display1ControlButtonEnable = 15052; - /// - /// 15053 - /// - public const uint Display1ControlButtonPress = 15053; - /// - /// 15054 - /// - public const uint Display1AudioButtonEnable = 15054; - /// - /// 15055 - /// - public const uint Display1AudioButtonPressAndFb = 15055; - /// - /// 15056 - /// - public const uint Display2SelectPressAndFb = 15056; - /// - /// 15057 - /// - public const uint Display2ControlButtonEnable = 15057; - /// - /// 15058 - /// - public const uint Display2ControlButtonPress = 15058; - /// - /// 15059 - /// - public const uint Display2AudioButtonEnable = 15059; - /// - /// 15060 - /// - public const uint Display2AudioButtonPressAndFb = 15060; - /// - /// 15061 Reveals the dual-display subpage - /// - public const uint DualDisplayPageVisible = 15061; - /// - /// 15062 Reveals the toggle switch for the sharing mode - /// - public const uint ToggleSharingModeVisible = 15062; - /// - /// 15063 Press for the toggle mode switch - /// - public const uint ToggleSharingModePress = 15063; - /// - /// 15064 - /// - public const uint LogoDefaultVisible = 15064; - /// - /// 15065 - /// - public const uint LogoUrlVisible = 15065; - /// - /// 15066 - Reveals the active calls header item - /// - public const uint HeaderActiveCallsListVisible = 15066; - /// - /// 15067 - /// - public const uint NotificationRibbonVisible = 15067; - /// - /// 15068 - /// - public const uint HeaderMeetingInfoVisible = 15068; - - /// - /// 15083 - Press for Call help desk on AC/VC - /// - public const uint HelpPageShowCallButtonPress = 15083; - /// - /// 15084 - Show the "call help desk" button on help page - /// - public const uint HelpPageShowCallButtonVisible = 15084; - /// - /// 15085 Visibility join for help subpage - /// - public const uint HelpPageVisible = 15085; - /// - /// 15086 Press for help header button - /// - public const uint HelpPress = 15086; - /// - /// 15088 - /// - public const uint DateOnlyVisible = 15088; - /// - /// 15089 - /// - public const uint TimeOnlyVisible = 15089; - /// - /// 15090 - /// - public const uint DateAndTimeVisible = 15090; - /// - /// 15091 - /// - public const uint SetupFullDistrib = 15091; - - /// - /// 15092 - /// - public const uint StartMCPageVisible = 15092; - - - /// - /// 15093 - /// - public const uint RoomHeaderInfoMCPageVisible = 15093; - - /// - /// 15094 - /// - public const uint MCScreenSaverVisible = 15094; - - /// - /// 15095 - /// - public const uint MCScreenSaverPosition1Visible = 15095; - - /// - /// 15096 - /// - public const uint MCScreenSaverPosition2Visible = 15096; - - /// - /// 15097 - /// - public const uint MCScreenSaverPosition3Visible = 15097; - - /// - /// 15098 - /// - public const uint MCScreenSaverPosition4Visible = 15098; - - /// - /// 15099 - /// - public const uint MCScreenSaverClosePress = 15099; - - // PIN dialogs ************************************ - - /// - /// 15201 - /// - public const uint PinDialog4DigitVisible = 15201; - /// - /// 15206 - /// - public const uint PinDialogCancelPress = 15206; - /// - /// 15207 - /// - public const uint PinDialogErrorVisible = 15207; - /// - /// 15211 - /// - public const uint PinDialogDot1 = 15211; - /// - /// 15212 - /// - public const uint PinDialogDot2 = 15212; - /// - /// 15213 - /// - public const uint PinDialogDot3 = 15213; - /// - /// 15214 - /// - public const uint PinDialogDot4 = 15214; - - // Password Prompt Dialog ************************** - - /// - /// 15301 - /// - public const uint PasswordPromptDialogVisible = 15301; - /// - /// 15302 - /// - public const uint PasswordPromptTextPress = 15302; - /// - /// 15306 - /// - public const uint PasswordPromptCancelPress = 15306; - /// - /// 15307 - /// - public const uint PasswordPromptErrorVisible = 15307; - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UI/JoinConstants/UISmartObjectJoin.cs b/src/PepperDash.Essentials/UI/JoinConstants/UISmartObjectJoin.cs deleted file mode 100644 index b48d78c9..00000000 --- a/src/PepperDash.Essentials/UI/JoinConstants/UISmartObjectJoin.cs +++ /dev/null @@ -1,88 +0,0 @@ -namespace PepperDash.Essentials -{ - public class UISmartObjectJoin - { - //****************************************************** - // Conference - /// - /// 1001 - The list that reveals in header to show calls - /// - public const uint CodecActiveCallsHeaderList = 1001; - - // Video Conference - - /// - /// 1201 - /// - public const uint VCDialKeypad = 1201; - - /// - /// 1202 - /// - public const uint VCDirectoryList = 1202; - /// - /// 1203 - /// - public const uint VCRecentsList = 1203; - /// - /// 1204 - /// - public const uint VCFavoritesList = 1204; - /// - /// 1205 Layout buttons dynamic list - /// - public const uint VCLayoutsList = 1205; - - /// - /// 1206 VC Camera Mode horizontal list - /// - public const uint VCCameraMode = 1206; - - /// - /// 1207 VC Camera Mode Dpad - /// - public const uint VCCameraDpad = 1207; - - /// - /// 1208 VC Camera Select - /// - public const uint VCCameraSelect = 1208; - - - //****************************************************** - // General - - /// - /// 3200 The staging, source-select list - /// - public const uint SourceStagingSRL = 3200; - /// - /// 3901 The Tech page menu list - /// - public const uint TechMenuList = 3901; - /// - /// 3902 Tech page statuses - /// - public const uint TechStatusList = 3902; - /// - /// 3903 - /// - public const uint TechPinDialogKeypad = 3903; - /// - /// 3904 - Display controls on the tech page - /// - public const uint TechDisplayControlsList = 3904; - /// - /// 15018 - /// - public const uint HeaderButtonList = 15018; - /// - /// 15022 The main activity footer - /// - public const uint ActivityFooterSRL = 15022; - /// - /// 15023 - The header meetings SRL - /// - public const uint MeetingListSRL = 15023; - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UI/JoinConstants/UIStringlJoin.cs b/src/PepperDash.Essentials/UI/JoinConstants/UIStringlJoin.cs deleted file mode 100644 index 6741be35..00000000 --- a/src/PepperDash.Essentials/UI/JoinConstants/UIStringlJoin.cs +++ /dev/null @@ -1,348 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; - -namespace PepperDash.Essentials -{ - /// - /// Common string join number constants - /// - public class UIStringJoin - { - //****************************************************** - // Codec - /// - /// 1001 - /// - public const uint CodecAddressEntryText = 1001; - /// - /// 1002 - /// - public const uint CodecDirectorySearchEntryText = 1002; - /// - /// 1004 - /// - public const uint CallSharedSourceNameText = 1004; - /// - /// 1005 - /// - public const uint MeetingIdText = 1005; - /// - /// 1006 - /// - public const uint MeetingHostText = 1006; - /// - /// 1007 - /// - public const uint MeetingPasswordText = 1007; - /// - /// 1008 - /// - public const uint MeetingLeaveText = 1008; - /// - /// 1009 - /// - public const uint MeetingNameText = 1009; - - /// - /// 1240 - Used to determine text for meeting start button - /// - public const uint MeetingStartButtonText = 1240; - - - - - /// - /// 1201 - 1230 range of joins for recents list - /// - public const uint VCRecentListTextStart = 1201; - // RANGE IN USE - public const uint VCRecentListTextEnd = 1230; - /// - /// 1231 - 1261 range of joins for recent list time - /// - public const uint VCRecentListTimeTextStart = 1231; - // RANGE IN USE - public const uint VCRecentListTimeTextEnd = 1260; - - - /// - /// 1281 - /// - public const uint VCCameraPresetLabel1 = 1281; - /// - /// 1282 - /// - public const uint VCCameraPresetLabel2 = 1282; - /// - /// 1283 - /// - public const uint VCCameraPresetLabel3 = 1283; - - /// - /// 1291 - the current layout mode - /// - public const uint VCLayoutModeText = 1291; - - /// - /// 1301 - 1400 - /// - public const uint VCDirectoryListTextStart = 1301; - // RANGE IN USE - public const uint VCDirectoryListTextEnd = 1556; - - /// - /// 1611 - 1615 - /// - public const uint VCFavoritesStart = 1611; - // RANGE IN USE - public const uint VCFavoritesTextEnd = 1615; - - - //****************************************************** - // Keyboard - /// - /// 1901 - /// - //public const uint KeypadText = 2901; - - //****************************************************** - - // Environment Joins - - /// - /// 2001 - 2010 - /// - public const uint EnvironmentColumnOneLabelBase = 2000; - - /// - /// 2011 - 2020 - /// - public const uint EnvironmentColumnTwoLabelBase = 2010; - - /// - /// 2021 - 2030 - /// - public const uint EnvironmentColumnThreeLabelBase = 2020; - - /// - /// 2031 - 2040 - /// - public const uint EnvironmentColumnFourLabelBase = 2030; - - // 2050, 2060, 2070 and 2080 reserved for column device name labels - - //****************************************************** - - /// - /// 3101 - This is the start of the range 3101 - 3120 - /// - public const uint TechMenuButtonTextStart = 3101; - - //----- through 3120 - - /// - /// 3201 - /// - public const uint PasswordPromptMessageText = 3201; - /// - /// 3202 - /// - public const uint PasswordPromptPasswordText = 3202; - - /// - /// 3812 - /// - public const uint AdvancedVolumeSlider1Text = 3812; - /// - /// 3822 - /// - public const uint AdvancedVolumeSlider2Text = 3822; - /// - /// 3832 - /// - public const uint AdvancedVolumeSlider3Text = 3832; - /// - /// 3842 - /// - public const uint AdvancedVolumeSlider4Text = 3842; - /// - /// 3852 - /// - public const uint AdvancedVolumeSlider5Text = 3852; - /// - /// 3862 - /// - public const uint AdvancedVolumeSlider6Text = 3862; - - /// - /// 3901 - /// - public const uint CurrentRoomName = 3901; - /// - /// 3902 - /// - public const uint CurrentSourceName = 3902; - /// - /// 3903 - /// - public const uint CurrentSourceIcon = 3903; - /// - /// 3904 - Phone number for room header - /// - public const uint RoomPhoneText = 3904; - /// - /// 3905 - Video address/number for room header - /// - public const uint RoomVideoAddressText = 3905; - /// - /// 3906 - The separator for verbose-header text on addresses - /// - public const uint RoomAddressPipeText = 3906; - /// - /// 3907 - The user code for mobile control - /// - public const uint RoomUserCode = 3907; - /// - /// 3908 - The url for the mobile control server - /// - public const uint RoomMcUrl = 3908; - /// - /// 3909 - The url for the mobile control QR Code image - /// - public const uint RoomMcQrCodeUrl = 3909; - /// - /// 3911 - /// - public const uint PowerOffMessage = 3911; - /// - /// 3912 - /// - public const uint StartPageMessage = 3912; - /// - /// 3913 - /// - public const uint StartActivityText = 3913; - /// - /// 3914 Title bar label for source overlay - /// - public const uint SourceBackgroundOverlayTitle = 3914; - - /// - /// 3915 - /// - public const uint NotificationRibbonText = 3915; - /// - /// 3916 The "active call" label - /// - public const uint HeaderCallStatusLabel = 3916; - /// - /// 3919 Mesage on init page - /// - public const uint SystemInitializingMessage = 3919; - /// - /// 3922 - /// - public const uint HelpMessage = 3922; - /// - /// 3923 - /// - public const uint LogoUrlLightBkgnd = 3923; - - - /// - /// 3924 - the text on the "call help desk" button - /// - public const uint HelpPageCallButtonText = 3924; - - /// - /// 3925 - /// - public const uint LogoUrlDarkBkgnd = 3925; - - /// - /// 3951 - /// - public const uint HeaderButtonIcon1 = 3951; - /// - /// 3952 - /// - public const uint HeaderButtonIcon2 = 3952; - /// - /// 3953 - /// - public const uint HeaderButtonIcon3 = 3953; - /// - /// 3954 - /// - public const uint HeaderButtonIcon4 = 3954; - /// - /// 3955 - /// - public const uint HeaderButtonIcon5 = 3955; - - /// - /// 3961 Name of source on display 1 - /// - public const uint Display1SourceLabel = 3961; - /// - /// 3962 Title above display 1 - /// - public const uint Display1TitleLabel = 3962; - /// - /// 3964 Name of source on display 2 - /// - public const uint Display2SourceLabel = 3964; - /// - /// 3965 Title above display 2 - /// - public const uint Display2TitleLabel = 3965; - - /// - /// 3966 - /// - public const uint NextMeetingStartTimeText = 3966; - /// - /// 3967 - /// - public const uint NextMeetingEndTimeText = 3967; - /// - /// 3968 - /// - public const uint NextMeetingTitleText = 3968; - /// - /// 3969 - /// - public const uint NextMeetingNameText = 3969; - /// - /// 3970 - /// - public const uint NextMeetingButtonLabel = 3970; - /// - /// 3971 - /// - public const uint NextMeetingSecondaryButtonLabel = 3971; - /// - /// 3972 - /// - public const uint NextMeetingFollowingMeetingText = 3972; - /// - /// 3976 - /// - public const uint MeetingsOrContactMethodListIcon = 3976; - /// - /// 3977 - /// - public const uint MeetingsOrContactMethodListTitleText = 3977; - - // ------------------------------------ - // - // MODAL JOINS 3991 - 3999 - // - // ------------------------------------ - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UI/JoinConstants/UIUshortJoin.cs b/src/PepperDash.Essentials/UI/JoinConstants/UIUshortJoin.cs deleted file mode 100644 index 73356bf3..00000000 --- a/src/PepperDash.Essentials/UI/JoinConstants/UIUshortJoin.cs +++ /dev/null @@ -1,54 +0,0 @@ -namespace PepperDash.Essentials -{ - /// - /// - /// - public class UIUshortJoin - { - // Video Codec - /// - /// 1234: values 0 = Connect, 1 = End, 2 = Start Meeting - /// - public const uint VCStagingConnectButtonMode = 1234; - - /// - /// 3812 - /// - public const uint VolumeSlider1Value = 3812; - /// - /// 3822 - /// - public const uint VolumeSlider2Value = 3822; - /// - /// 3832 - /// - public const uint VolumeSlider3Value = 3832; - /// - /// 3842 - /// - public const uint VolumeSlider4Value = 3842; - /// - /// 3852 - /// - public const uint VolumeSlider5Value = 3852; - /// - /// 3862 - /// - public const uint VolumeSlider6Value = 3862; - - /// - /// 3922: 0-4, center->left. 5-8, center -> right. - /// - public const uint PresentationStagingCaretMode = 3922; - - /// - /// 3923: 0-4, center->left. 5-8, center -> right. - /// - public const uint CallStagingCaretMode = 3923; - - /// - /// 15024 - Modes 0: On hook, 1: Phone, 2: Video - /// - public const uint CallHeaderButtonMode = 15024; - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UI/SmartObjectHeaderButtonList.cs b/src/PepperDash.Essentials/UI/SmartObjectHeaderButtonList.cs deleted file mode 100644 index f35bc88c..00000000 --- a/src/PepperDash.Essentials/UI/SmartObjectHeaderButtonList.cs +++ /dev/null @@ -1,58 +0,0 @@ -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using System.Text; -//using Crestron.SimplSharp; -//using Crestron.SimplSharpPro; -//using Crestron.SimplSharpPro.DeviceSupport; - -//using PepperDash.Essentials.Core; -//using PepperDash.Essentials.Core.SmartObjects; - -//namespace PepperDash.Essentials -//{ -// public class SmartObjectHeaderButtonList : SmartObjectHelperBase -// { - -// public SmartObjectHeaderButtonList(SmartObject so) -// : base(so, true) -// { - -// } -// } - -// public class HeaderListButton -// { -// public BoolInputSig SelectedSig { get; private set; } -// public BoolInputSig VisibleSig { get; private set; } -// public BoolOutputSig OutputSig { get; private set; } -// StringInputSig IconSig; - -// public HeaderListButton(SmartObjectHeaderButtonList list, uint index) -// { -// var so = list.SmartObject; -// OutputSig = so.BooleanOutput["Item " + index + " Pressed"]; -// SelectedSig = so.BooleanInput["Item " + index + " Selected"]; -// VisibleSig = so.BooleanInput["Item " + index + " Visible"]; -// IconSig = so.StringInput["Set Item " + index + " Icon Serial"]; -// } - -// public void SetIcon(string i) -// { -// IconSig.StringValue = i; -// } - -// public void ClearIcon() -// { -// IconSig.StringValue = "Blank"; -// } - -// public static string Calendar = "Calendar"; -// public static string Camera = "Camera"; -// public static string Gear = "Gear"; -// public static string Lights = "Lights"; -// public static string Help = "Help"; -// public static string OnHook = "DND"; -// public static string Phone = "Phone"; -// } -//} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UI/SubpageReferenceListActivityItem.cs b/src/PepperDash.Essentials/UI/SubpageReferenceListActivityItem.cs deleted file mode 100644 index 4747a61a..00000000 --- a/src/PepperDash.Essentials/UI/SubpageReferenceListActivityItem.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.UI; - -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials -{ - public class SubpageReferenceListActivityItem : SubpageReferenceListItem - { - /// - /// - /// - /// - /// - /// 0=Share, 1=Phone Call, 2=Video Call, 3=End Meeting - /// - public SubpageReferenceListActivityItem(uint index, SubpageReferenceList owner, - ushort buttonMode, Action pressAction) - : base(index, owner) - { - Owner.GetBoolFeedbackSig(Index, 1).UserObject = pressAction; - Owner.UShortInputSig(Index, 1).UShortValue = buttonMode; - } - - /// - /// Called by SRL to release all referenced objects - /// - public override void Clear() - { - Owner.BoolInputSig(Index, 1).UserObject = null; - Owner.UShortInputSig(Index, 1).UShortValue = 0; - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UI/SubpageReferenceListCallStagingItem.cs b/src/PepperDash.Essentials/UI/SubpageReferenceListCallStagingItem.cs deleted file mode 100644 index 4c64bdd6..00000000 --- a/src/PepperDash.Essentials/UI/SubpageReferenceListCallStagingItem.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.UI; - -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials -{ - public class SubpageReferenceListButtonAndModeItem : SubpageReferenceListItem - { - /// - /// - /// - /// - /// - /// 0=Share, 1=Phone Call, 2=Video Call, 3=End Meeting - /// - public SubpageReferenceListButtonAndModeItem(uint index, SubpageReferenceList owner, - ushort buttonMode, Action pressAction) - : base(index, owner) - { - Owner.GetBoolFeedbackSig(Index, 1).UserObject = pressAction; - Owner.UShortInputSig(Index, 1).UShortValue = buttonMode; - } - - /// - /// Called by SRL to release all referenced objects - /// - public override void Clear() - { - Owner.BoolInputSig(Index, 1).UserObject = null; - Owner.UShortInputSig(Index, 1).UShortValue = 0; - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UI/SubpageReferenceListSourceItem.cs b/src/PepperDash.Essentials/UI/SubpageReferenceListSourceItem.cs deleted file mode 100644 index 27409007..00000000 --- a/src/PepperDash.Essentials/UI/SubpageReferenceListSourceItem.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.UI; - -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials -{ - public class SubpageReferenceListSourceItem : SubpageReferenceListItem - { - public SourceListItem SourceItem { get; private set; } - - private IHasCurrentSourceInfoChange _room; - - public SubpageReferenceListSourceItem(uint index, SubpageReferenceList owner, - SourceListItem sourceItem, Action routeAction) - : base(index, owner) - { - SourceItem = sourceItem; - owner.GetBoolFeedbackSig(index, 1).UserObject = new Action(routeAction); - owner.StringInputSig(index, 1).StringValue = SourceItem.PreferredName; - } - - public void RegisterForSourceChange(IHasCurrentSourceInfoChange room) - { - _room = room; - room.CurrentSourceChange -= room_CurrentSourceInfoChange; - room.CurrentSourceChange += room_CurrentSourceInfoChange; - } - - void room_CurrentSourceInfoChange(SourceListItem info, ChangeType type) - { - if (type == ChangeType.WillChange && info == SourceItem) - ClearFeedback(); - else if (type == ChangeType.DidChange && info == SourceItem) - SetFeedback(); - } - - /// - /// Called by SRL to release all referenced objects - /// - public override void Clear() - { - Owner.BoolInputSig(Index, 1).UserObject = null; - Owner.StringInputSig(Index, 1).StringValue = ""; - - if(_room != null) - _room.CurrentSourceChange -= room_CurrentSourceInfoChange; - } - - /// - /// Sets the selected feedback on the button - /// - public void SetFeedback() - { - Owner.BoolInputSig(Index, 1).BoolValue = true; - } - - /// - /// Clears the selected feedback on the button - /// - public void ClearFeedback() - { - Owner.BoolInputSig(Index, 1).BoolValue = false; - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UIDrivers/DualDisplayRouting.cs b/src/PepperDash.Essentials/UIDrivers/DualDisplayRouting.cs deleted file mode 100644 index 4b29061d..00000000 --- a/src/PepperDash.Essentials/UIDrivers/DualDisplayRouting.cs +++ /dev/null @@ -1,231 +0,0 @@ -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using System.Text; -//using Crestron.SimplSharp; -//using Crestron.SimplSharpPro; -//using Crestron.SimplSharpPro.DeviceSupport; -//using PepperDash.Core; -//using PepperDash.Essentials.Core; -//using PepperDash.Essentials.Core.SmartObjects; -//using PepperDash.Essentials.Core.PageManagers; - -//namespace PepperDash.Essentials -//{ -// public class DualDisplaySimpleOrAdvancedRouting : PanelDriverBase -// { -// EssentialsPresentationPanelAvFunctionsDriver Parent; - -// /// -// /// Smart Object 3200 -// /// -// SubpageReferenceList SourcesSrl; - -// /// -// /// For tracking feedback on last selected -// /// -// BoolInputSig LastSelectedSourceSig; - -// /// -// /// The source that has been selected and is awaiting assignment to a display -// /// -// SourceListItem PendingSource; - -// bool IsSharingModeAdvanced; - -// public DualDisplaySimpleOrAdvancedRouting(EssentialsPresentationPanelAvFunctionsDriver parent) : base(parent.TriList) -// { -// Parent = parent; -// SourcesSrl = new SubpageReferenceList(TriList, 3200, 3, 3, 3); - -// TriList.SetSigFalseAction(UIBoolJoin.ToggleSharingModePress, ToggleSharingModePressed); - -// TriList.SetSigFalseAction(UIBoolJoin.Display1AudioButtonPressAndFb, Display1AudioPress); -// TriList.SetSigFalseAction(UIBoolJoin.Display1ControlButtonPress, Display1ControlPress); -// TriList.SetSigTrueAction(UIBoolJoin.Display1SelectPressAndFb, Display1Press); - -// TriList.SetSigFalseAction(UIBoolJoin.Display2AudioButtonPressAndFb, Display2AudioPress); -// TriList.SetSigFalseAction(UIBoolJoin.Display2ControlButtonPress, Display2ControlPress); -// TriList.SetSigTrueAction(UIBoolJoin.Display2SelectPressAndFb, Display2Press); -// } - -// /// -// /// -// /// -// public override void Show() -// { -// TriList.BooleanInput[UIBoolJoin.ToggleSharingModeVisible].BoolValue = true; -// TriList.BooleanInput[UIBoolJoin.StagingPageVisible].BoolValue = true; -// if(IsSharingModeAdvanced) -// TriList.BooleanInput[UIBoolJoin.DualDisplayPageVisible].BoolValue = true; -// else -// TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = true; -// base.Show(); -// } - -// /// -// /// -// /// -// //public override void Hide() -// //{ -// // TriList.BooleanInput[UIBoolJoin.ToggleSharingModeVisible].BoolValue = false; -// // TriList.BooleanInput[UIBoolJoin.StagingPageVisible].BoolValue = false; -// // if(IsSharingModeAdvanced) -// // TriList.BooleanInput[UIBoolJoin.DualDisplayPageVisible].BoolValue = false; -// // else -// // TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = false; -// // base.Hide(); -// //} - -// public void SetCurrentRoomFromParent() -// { -// if (IsSharingModeAdvanced) -// return; // add stuff here -// else -// SetupSourceListForSimpleRouting(); -// } - -// /// -// /// -// /// -// void SetupSourceListForSimpleRouting() -// { -// // get the source list config and set up the source list -// var config = ConfigReader.ConfigObject.SourceLists; -// if (config.ContainsKey(Parent.CurrentRoom.SourceListKey)) -// { -// var srcList = config[Parent.CurrentRoom.SourceListKey] -// .Values.ToList().OrderBy(s => s.Order); -// // Setup sources list -// uint i = 1; // counter for UI list -// foreach (var srcConfig in srcList) -// { -// if (!srcConfig.IncludeInSourceList) // Skip sources marked this way -// continue; - -// var sourceKey = srcConfig.SourceKey; -// var actualSource = DeviceManager.GetDeviceForKey(sourceKey) as Device; -// if (actualSource == null) -// { -// Debug.Console(0, "Cannot assign missing source '{0}' to source UI list", -// srcConfig.SourceKey); -// continue; -// } -// var localSrcItem = srcConfig; // lambda scope below -// var localIndex = i; -// SourcesSrl.GetBoolFeedbackSig(i, 1).UserObject = new Action(b => -// { -// if (IsSharingModeAdvanced) -// { -// if (LastSelectedSourceSig != null) -// LastSelectedSourceSig.BoolValue = false; -// SourceListButtonPress(localSrcItem); -// LastSelectedSourceSig = SourcesSrl.BoolInputSig(localIndex, 1); -// LastSelectedSourceSig.BoolValue = true; -// } -// else -// Parent.CurrentRoom.DoSourceToAllDestinationsRoute(localSrcItem); -// }); -// SourcesSrl.StringInputSig(i, 1).StringValue = srcConfig.PreferredName; -// i++; - -// //var item = new SubpageReferenceListSourceItem(i++, SourcesSrl, srcConfig, -// // b => { if (!b) UiSelectSource(localSrcConfig); }); -// //SourcesSrl.AddItem(item); // add to the SRL -// //item.RegisterForSourceChange(Parent.CurrentRoom); -// } -// SourcesSrl.Count = (ushort)(i - 1); -// Parent.CurrentRoom.CurrentSingleSourceChange += CurrentRoom_CurrentSourceInfoChange; -// Parent.CurrentRoom.CurrentDisplay1SourceChange += CurrentRoom_CurrentDisplay1SourceChange; -// Parent.CurrentRoom.CurrentDisplay2SourceChange += CurrentRoom_CurrentDisplay2SourceChange; -// } -// } - -// void SetupSourceListForAdvancedRouting() -// { - -// } - -// void CurrentRoom_CurrentSourceInfoChange(IEssentialsRoom room, SourceListItem info, ChangeType type) -// { - -// } - -// void CurrentRoom_CurrentDisplay1SourceChange(IEssentialsRoom room, SourceListItem info, ChangeType type) -// { -// TriList.StringInput[UIStringJoin.Display1SourceLabel].StringValue = PendingSource.PreferredName; - -// } - -// void CurrentRoom_CurrentDisplay2SourceChange(IEssentialsRoom room, SourceListItem info, ChangeType type) -// { -// TriList.StringInput[UIStringJoin.Display2SourceLabel].StringValue = PendingSource.PreferredName; -// } - -// /// -// /// -// /// -// void ToggleSharingModePressed() -// { -// Hide(); -// IsSharingModeAdvanced = !IsSharingModeAdvanced; -// TriList.BooleanInput[UIBoolJoin.ToggleSharingModePress].BoolValue = IsSharingModeAdvanced; -// Show(); -// } - -// public void SourceListButtonPress(SourceListItem item) -// { -// // start the timer -// // show FB on potential source -// TriList.BooleanInput[UIBoolJoin.Display1AudioButtonEnable].BoolValue = false; -// TriList.BooleanInput[UIBoolJoin.Display1ControlButtonEnable].BoolValue = false; -// TriList.BooleanInput[UIBoolJoin.Display2AudioButtonEnable].BoolValue = false; -// TriList.BooleanInput[UIBoolJoin.Display2ControlButtonEnable].BoolValue = false; -// PendingSource = item; -// } - -// void EnableAppropriateDisplayButtons() -// { -// TriList.BooleanInput[UIBoolJoin.Display1AudioButtonEnable].BoolValue = true; -// TriList.BooleanInput[UIBoolJoin.Display1ControlButtonEnable].BoolValue = true; -// TriList.BooleanInput[UIBoolJoin.Display2AudioButtonEnable].BoolValue = true; -// TriList.BooleanInput[UIBoolJoin.Display2ControlButtonEnable].BoolValue = true; -// if (LastSelectedSourceSig != null) -// LastSelectedSourceSig.BoolValue = false; -// } - -// public void Display1Press() -// { -// EnableAppropriateDisplayButtons(); -// Parent.CurrentRoom.SourceToDisplay1(PendingSource); -// // Enable end meeting -// } - -// public void Display1AudioPress() -// { - -// } - - -// public void Display1ControlPress() -// { - -// } - -// public void Display2Press() -// { -// EnableAppropriateDisplayButtons(); -// Parent.CurrentRoom.SourceToDisplay2(PendingSource); -// } - -// public void Display2AudioPress() -// { - -// } - -// public void Display2ControlPress() -// { - -// } -// } -//} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UIDrivers/Environment Drivers/EssentialsEnvironmentDriver.cs b/src/PepperDash.Essentials/UIDrivers/Environment Drivers/EssentialsEnvironmentDriver.cs deleted file mode 100644 index 978206eb..00000000 --- a/src/PepperDash.Essentials/UIDrivers/Environment Drivers/EssentialsEnvironmentDriver.cs +++ /dev/null @@ -1,256 +0,0 @@ -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.Core.Shades; -using PepperDash.Essentials.Core.Lighting; - -namespace PepperDash.Essentials -{ - public class EssentialsEnvironmentDriver : PanelDriverBase - { - /// - /// Do I need this here? - /// - CrestronTouchpanelPropertiesConfig Config; - - /// - /// The list of devices this driver is responsible for controlling - /// - public List Devices { get; private set; } - - /// - /// The parent driver for this - /// - EssentialsPanelMainInterfaceDriver Parent; - - /// - /// The list of sub drivers for the devices - /// - public List DeviceSubDrivers { get; private set; } - - public uint BackgroundSubpageJoin { get; private set; } - - public EssentialsEnvironmentDriver(EssentialsPanelMainInterfaceDriver parent, CrestronTouchpanelPropertiesConfig config) - : base(parent.TriList) - { - Config = config; - Parent = parent; - - Devices = new List(); - DeviceSubDrivers = new List(); - - Parent.AvDriver.PopupInterlock.StatusChanged += new EventHandler(PopupInterlock_CurrentJoinChanged); - - // Calculate the join offests for each device page and assign join actions for each button - } - - void PopupInterlock_CurrentJoinChanged(object sender, StatusChangedEventArgs e) - { - // Hide this driver and all sub drivers if popup interlock is not shown - if (!e.IsShown || e.NewJoin != BackgroundSubpageJoin) - { - foreach (var driver in DeviceSubDrivers) - { - driver.Hide(); - } - - base.Hide(); - } - } - - void IsShownFeedback_OutputChange(object sender, EventArgs e) - { - - } - - /// - /// Shows this driver and all sub drivers - /// - public override void Show() - { - Parent.AvDriver.PopupInterlock.ShowInterlocked(BackgroundSubpageJoin); - - foreach (var driver in DeviceSubDrivers) - { - driver.Show(); - } - - base.Show(); - } - - /// - /// Hides this driver and all sub drivers - /// - public override void Hide() - { - Parent.AvDriver.PopupInterlock.HideAndClear(); - - foreach (var driver in DeviceSubDrivers) - { - driver.Hide(); - } - - base.Hide(); - } - - public override void Toggle() - { - if (IsVisible) - Hide(); - else - Show(); - } - - - /// - /// Reads the device keys from the config and gets the devices by key - /// - public void GetDevicesFromConfig(Room.Config.EssentialsEnvironmentPropertiesConfig EnvironmentPropertiesConfig) - { - if (EnvironmentPropertiesConfig != null) - { - Devices.Clear(); - DeviceSubDrivers.Clear(); - - uint column = 1; - - foreach (var dKey in EnvironmentPropertiesConfig.DeviceKeys) - { - var device = DeviceManager.GetDeviceForKey(dKey); - - if (device != null) - { - // Build the driver - var devicePanelDriver = GetPanelDriverForDevice(device, column); - - // Add new PanelDriverBase SubDriver - if (devicePanelDriver != null) - { - Devices.Add(device); - DeviceSubDrivers.Add(devicePanelDriver); - - Debug.Console(1, "Adding '{0}' to Environment Devices", device.Key); - - column++; - - - // Quit if device count is exceeded - if (column > 4) - break; - } - else - Debug.Console(1, "Unable to build environment driver for device: '{0}'", device.Key); - - } - - } - - SetupEnvironmentUiJoins(); - } - else - { - Debug.Console(1, "Unable to get devices from config. No EnvironmentPropertiesConfig object in room config"); - } - } - - /// - /// Returns the appropriate panel driver for the device - /// - /// - /// - /// - PanelDriverBase GetPanelDriverForDevice(IKeyed device, uint column) - { - PanelDriverBase panelDriver = null; - - uint buttonPressJoinBase = 0; - uint buttonVisibleJoinBase = 0; - uint stringJoinBase = 0; - uint shadeTypeVisibleBase = 0; - uint lightingTypeVisibleBase = 0; - - switch (column) - { - case 1: - { - buttonPressJoinBase = UIBoolJoin.EnvironmentColumnOneButtonPressBase; - buttonVisibleJoinBase = UIBoolJoin.EnvironmentColumnOneButtonVisibleBase; - stringJoinBase = UIStringJoin.EnvironmentColumnOneLabelBase; - shadeTypeVisibleBase = UIBoolJoin.EnvironmentColumnOneShadingTypeVisibleBase; - lightingTypeVisibleBase = UIBoolJoin.EnvironmentColumnOneLightingTypeVisibleBase; - break; - } - case 2: - { - buttonPressJoinBase = UIBoolJoin.EnvironmentColumnTwoButtonPressBase; - buttonVisibleJoinBase = UIBoolJoin.EnvironmentColumnTwoButtonVisibleBase; - stringJoinBase = UIStringJoin.EnvironmentColumnTwoLabelBase; - shadeTypeVisibleBase = UIBoolJoin.EnvironmentColumnTwoShadingTypeVisibleBase; - lightingTypeVisibleBase = UIBoolJoin.EnvironmentColumnTwoLightingTypeVisibleBase; - break; - } - case 3: - { - buttonPressJoinBase = UIBoolJoin.EnvironmentColumnThreeButtonPressBase; - buttonVisibleJoinBase = UIBoolJoin.EnvironmentColumnThreeButtonVisibleBase; - stringJoinBase = UIStringJoin.EnvironmentColumnThreeLabelBase; - shadeTypeVisibleBase = UIBoolJoin.EnvironmentColumnThreeShadingTypeVisibleBase; - lightingTypeVisibleBase = UIBoolJoin.EnvironmentColumnThreeLightingTypeVisibleBase; - break; - } - case 4: - { - buttonPressJoinBase = UIBoolJoin.EnvironmentColumnFourButtonPressBase; - buttonVisibleJoinBase = UIBoolJoin.EnvironmentColumnFourButtonVisibleBase; - stringJoinBase = UIStringJoin.EnvironmentColumnFourLabelBase; - shadeTypeVisibleBase = UIBoolJoin.EnvironmentColumnFourShadingTypeVisibleBase; - lightingTypeVisibleBase = UIBoolJoin.EnvironmentColumnFourLightingTypeVisibleBase; - break; - } - default: - { - Debug.Console(1, "Environment Driver: Invalid column number specified"); - break; - } - } - - // Determine if device is a shade or lighting type and construct the appropriate driver - if (device is ShadeBase) - { - panelDriver = new EssentialsShadeDriver(this, device.Key, buttonPressJoinBase, stringJoinBase, shadeTypeVisibleBase); - } - else if (device is LightingBase) - { - panelDriver = new EssentialsLightingDriver(this, device.Key, buttonPressJoinBase, buttonVisibleJoinBase, stringJoinBase, lightingTypeVisibleBase); - } - - // Return the driver - - return panelDriver; - } - - /// - /// Determines the join values for the generic environment subpages - /// - void SetupEnvironmentUiJoins() - { - // Calculate which background subpage join to use - BackgroundSubpageJoin = UIBoolJoin.EnvironmentBackgroundSubpageVisibleBase + (uint)DeviceSubDrivers.Count; - - - } - - } - - public interface IEnvironmentSubdriver - { - uint SubpageVisibleJoin { get; } - } - -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UIDrivers/Environment Drivers/EssentialsLightingDriver.cs b/src/PepperDash.Essentials/UIDrivers/Environment Drivers/EssentialsLightingDriver.cs deleted file mode 100644 index 5ec46a04..00000000 --- a/src/PepperDash.Essentials/UIDrivers/Environment Drivers/EssentialsLightingDriver.cs +++ /dev/null @@ -1,210 +0,0 @@ -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.Core.Lighting; - -namespace PepperDash.Essentials -{ - /// - /// Supports a lighting device with up to 6 scenes - /// - public class EssentialsLightingDriver : PanelDriverBase, IEnvironmentSubdriver - { - EssentialsEnvironmentDriver Parent; - - public LightingBase LightingDevice { get; private set; } - - public uint SubpageVisibleJoin { get; private set; } - - /// - /// The base join number that all button visibilty joins are offset from - /// - uint ButtonVisibleJoinBase; - - /// - /// The base join number that all button presses are offset from - /// - uint ButtonPressJoinBase; - - /// - /// The base join number that all string lables are offset from - /// - uint StringJoinBase; - - eLightsDeviceType DeviceType; - - const uint DeviceNameJoinOffset = 50; - - public EssentialsLightingDriver(EssentialsEnvironmentDriver parent, string deviceKey, uint buttonPressJoinBase, uint buttonVisibleJoinBase, uint stringJoinBase, uint subpageVisibleBase) - : base(parent.TriList) - { - Parent = parent; - - ButtonPressJoinBase = buttonPressJoinBase; - ButtonVisibleJoinBase = buttonVisibleJoinBase; - StringJoinBase = stringJoinBase; - - LightingDevice = DeviceManager.GetDeviceForKey(deviceKey) as LightingBase; - - //LightingDevice.LightingSceneChange += new EventHandler(LightingDevice_LightingSceneChange); - - SetDeviceType(); - - SetSubpageVisibleJoin(subpageVisibleBase); - - SetUpDeviceName(); - - SetUpButtonActions(); - } - - /// - /// Handles setting feedback for the currently selected scene button - /// - /// - /// - void LightingDevice_LightingSceneChange(object sender, LightingSceneChangeEventArgs e) - { - uint joinOffset = 1; - - foreach (var scene in LightingDevice.LightingScenes) - { - if (scene == e.CurrentLightingScene) - TriList.SetBool(ButtonPressJoinBase + joinOffset, true); - else - TriList.SetBool(ButtonPressJoinBase + joinOffset, false); - } - } - - public override void Show() - { - TriList.SetBool(SubpageVisibleJoin, true); - - base.Show(); - } - - public override void Hide() - { - TriList.SetBool(SubpageVisibleJoin, false); - - base.Hide(); - } - - void SetUpDeviceName() - { - Parent.TriList.SetString(StringJoinBase + DeviceNameJoinOffset, LightingDevice.Name); - } - - void SetDeviceType() - { - if (LightingDevice is ILightingScenes) - DeviceType = eLightsDeviceType.Scenes; - } - - void SetSubpageVisibleJoin(uint subpageVisibleBase) - { - SubpageVisibleJoin = subpageVisibleBase + (uint)DeviceType; - } - - /// - /// Drase - /// - void SetUpButtonActions() - { - if (DeviceType == eLightsDeviceType.Scenes) - { - uint joinOffset = ComputeJoinOffset(); - - // Clear preceding buttons - for (uint i = 1; i < joinOffset; i++) - { - TriList.SetString(StringJoinBase + i, ""); - TriList.SetSigFalseAction(ButtonPressJoinBase + i, () => { }); - TriList.SetBool(ButtonVisibleJoinBase + i, false); - } - - foreach (var scene in LightingDevice.LightingScenes) - { - TriList.SetString(StringJoinBase + joinOffset, scene.Name); - var tempScene = scene; - TriList.SetSigFalseAction(ButtonPressJoinBase + joinOffset, () => LightingDevice.SelectScene(tempScene)); - scene.IsActiveFeedback.LinkInputSig(TriList.BooleanInput[ButtonPressJoinBase + joinOffset]); - TriList.SetBool(ButtonVisibleJoinBase + joinOffset, true); - - joinOffset++; - } - - // Clear following buttons - for (uint i = joinOffset; i <= 6; i++) - { - TriList.SetString(StringJoinBase + i, ""); - TriList.SetSigFalseAction(ButtonPressJoinBase + i, () => { }); - TriList.SetBool(ButtonVisibleJoinBase + i, false); - } - } - - } - - - - /// - /// Computes the desired join offset to try to achieve the most centered appearance when using a subpage with 6 scene buttons - /// - /// - uint ComputeJoinOffset() - { - uint joinOffset = 0; - - switch (LightingDevice.LightingScenes.Count) - { - case 1: - { - joinOffset = 2; - break; - } - case 2: - { - joinOffset = 3; - break; - } - case 3: - { - joinOffset = 2; - break; - } - case 4: - { - joinOffset = 2; - break; - } - case 5: - { - joinOffset = 2; - break; - } - case 6: - { - joinOffset = 1; - break; - } - default: - { - break; - } - } - - return joinOffset; - } - } - - enum eLightsDeviceType : uint - { - None = 0, - Scenes = 1, - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UIDrivers/Environment Drivers/EssentialsShadeDriver.cs b/src/PepperDash.Essentials/UIDrivers/Environment Drivers/EssentialsShadeDriver.cs deleted file mode 100644 index 1d8ad7c2..00000000 --- a/src/PepperDash.Essentials/UIDrivers/Environment Drivers/EssentialsShadeDriver.cs +++ /dev/null @@ -1,116 +0,0 @@ -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.Core.Shades; - -namespace PepperDash.Essentials -{ - public class EssentialsShadeDriver : PanelDriverBase, IEnvironmentSubdriver - { - EssentialsEnvironmentDriver Parent; - - public ShadeBase ShadeDevice { get; private set; } - - public uint SubpageVisibleJoin { get; private set; } - - /// - /// The base join number that all button presses are offset from - /// - uint ButtonPressJoinBase; - - /// - /// The base join number that all string lables are offset from - /// - uint StringJoinBase; - - eShadeDeviceType DeviceType; - - const uint DeviceNameJoinOffset = 50; - - public EssentialsShadeDriver(EssentialsEnvironmentDriver parent, string deviceKey, uint buttonPressJoinBase, uint stringJoinBase, uint subpageVisibleBase) - : base(parent.TriList) - { - Parent = parent; - - ButtonPressJoinBase = buttonPressJoinBase; - StringJoinBase = stringJoinBase; - - ShadeDevice = DeviceManager.GetDeviceForKey(deviceKey) as ShadeBase; - - SetDeviceType(); - - SetSubpageVisibleJoin(subpageVisibleBase); - - SetUpDeviceName(); - - SetUpButtonActions(); - } - - public override void Show() - { - TriList.SetBool(SubpageVisibleJoin, true); - - base.Show(); - } - - public override void Hide() - { - TriList.SetBool(SubpageVisibleJoin, false); - - base.Hide(); - } - - void SetUpDeviceName() - { - Parent.TriList.SetString(StringJoinBase + DeviceNameJoinOffset, ShadeDevice.Name); - } - - void SetDeviceType() - { - if (ShadeDevice is IShadesOpenCloseStop) - DeviceType = eShadeDeviceType.OpenCloseStop; - else if (ShadeDevice is IShadesOpenCloseStop) - DeviceType = eShadeDeviceType.OpenClose; - } - - void SetSubpageVisibleJoin(uint subpageVisibleBase) - { - SubpageVisibleJoin = subpageVisibleBase + (uint)DeviceType; - } - - void SetUpButtonActions() - { - if(DeviceType == eShadeDeviceType.OpenClose) - { - TriList.SetSigTrueAction(ButtonPressJoinBase + 1, ShadeDevice.Open); - - TriList.SetSigFalseAction(ButtonPressJoinBase + 2, ShadeDevice.Close); - } - else if(DeviceType == eShadeDeviceType.OpenCloseStop) - { - TriList.SetSigFalseAction(ButtonPressJoinBase + 1, ShadeDevice.Open); - - TriList.SetSigFalseAction(ButtonPressJoinBase + 2, (ShadeDevice as IShadesOpenCloseStop).Stop); - - if (ShadeDevice is IShadesOpenCloseStop) - TriList.SetString(StringJoinBase + 2, "Stop"); - - TriList.SetSigFalseAction(ButtonPressJoinBase + 3, ShadeDevice.Close); - } - } - } - - enum eShadeDeviceType : uint - { - None = 0, - OpenCloseStop = 1, - OpenClose = 2, - DiscreteLevel = 3 - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UIDrivers/Essentials/EssentialsHeaderDriver.cs b/src/PepperDash.Essentials/UIDrivers/Essentials/EssentialsHeaderDriver.cs deleted file mode 100644 index 4b4ed6b8..00000000 --- a/src/PepperDash.Essentials/UIDrivers/Essentials/EssentialsHeaderDriver.cs +++ /dev/null @@ -1,399 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.UI; -using Crestron.SimplSharpPro.DeviceSupport; - - -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.SmartObjects; -using PepperDash.Essentials.Core.PageManagers; -using PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces; -using PepperDash.Essentials.Room.Config; -using PepperDash.Essentials.Devices.Common.Codec; -using PepperDash.Essentials.Devices.Common.VideoCodec; - - -namespace PepperDash.Essentials -{ - /// - /// - /// - public class EssentialsHeaderDriver : PanelDriverBase - { - uint EnvironmentCaretVisible; - uint CalendarCaretVisible; - uint CallCaretVisible; - - JoinedSigInterlock CaretInterlock; - - CrestronTouchpanelPropertiesConfig Config; - - /// - /// The parent driver for this - /// - EssentialsPanelMainInterfaceDriver Parent; - - /// - /// Indicates that the SetHeaderButtons method has completed successfully - /// - public bool HeaderButtonsAreSetUp { get; private set; } - - StringInputSig HeaderCallButtonIconSig; - - public EssentialsHeaderDriver(EssentialsPanelMainInterfaceDriver parent, CrestronTouchpanelPropertiesConfig config) - : base(parent.TriList) - { - Config = config; - Parent = parent; - CaretInterlock = new JoinedSigInterlock(TriList); - } - - void SetUpGear(IAVDriver avDriver, IEssentialsRoom currentRoom) - { - // Gear - TriList.SetString(UIStringJoin.HeaderButtonIcon5, "Gear"); - TriList.SetSigHeldAction(UIBoolJoin.HeaderIcon5Press, 2000, - avDriver.ShowTech, - null, - () => - { - if (currentRoom.OnFeedback.BoolValue) - { - avDriver.PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPageVisible); - CaretInterlock.ShowInterlocked(UIBoolJoin.HeaderCaret5Visible); - } - else - { - avDriver.PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPagePowerOffVisible); - CaretInterlock.ShowInterlocked(UIBoolJoin.HeaderCaret5Visible); - } - }); - TriList.SetSigFalseAction(UIBoolJoin.TechExitButton, () => - avDriver.PopupInterlock.HideAndClear()); - } - - public void SetUpHelpButton(EssentialsRoomPropertiesConfig roomConf) - { - // Help roomConf and popup - if (roomConf.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, roomConf.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 IEssentialsHuddleSpaceRoom; - if (room != null) - message = room.PropertiesConfig.HelpMessage; - else - message = "Sorry, no help message available. No room connected."; - //TriList.StringInput[UIStringJoin.HelpMessage].StringValue = message; - Parent.AvDriver.PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.HelpPageVisible); - CaretInterlock.ShowInterlocked(UIBoolJoin.HeaderCaret4Visible); - }); - } - - uint SetUpEnvironmentButton(EssentialsEnvironmentDriver environmentDriver, uint nextJoin) - { - if (environmentDriver != null) - { - var tempJoin = nextJoin; - TriList.SetString(tempJoin, "Lights"); - EnvironmentCaretVisible = tempJoin + 10; - TriList.SetSigFalseAction(tempJoin, () => - { - environmentDriver.Toggle(); - CaretInterlock.ShowInterlocked(EnvironmentCaretVisible); - }); - nextJoin--; - return nextJoin; - } - else - return nextJoin; - } - - uint SetUpCalendarButton(EssentialsHuddleVtc1PanelAvFunctionsDriver avDriver, uint nextJoin) - { - // Calendar button - if (avDriver.CurrentRoom.ScheduleSource != null) - { - var tempJoin = nextJoin; - TriList.SetString(tempJoin, "Calendar"); - CalendarCaretVisible = tempJoin + 10; - TriList.SetSigFalseAction(tempJoin, () => - { - avDriver.CalendarPress(); - CaretInterlock.ShowInterlocked(CalendarCaretVisible); - }); - - nextJoin--; - return nextJoin; - } - else - return nextJoin; - } - - uint SetUpCallButton(EssentialsHuddleVtc1PanelAvFunctionsDriver avDriver, uint nextJoin) - { - // Call button - var tempJoin = nextJoin; - TriList.SetString(tempJoin, "DND"); - CallCaretVisible = tempJoin + 10; - TriList.SetSigFalseAction(tempJoin, () => - { - avDriver.ShowActiveCallsListOrMeetingInfo(); - if(avDriver.CurrentRoom.InCallFeedback.BoolValue) - CaretInterlock.ShowInterlocked(CallCaretVisible); - }); - HeaderCallButtonIconSig = TriList.StringInput[tempJoin]; - - nextJoin--; - return nextJoin; - } - - /// - /// 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; - } - - var meetingInfoCodec = codec as IHasMeetingInfo; - - // Set mode of header button - SetHeaderCallIcon(codec); - - // Set the call status text - Debug.Console(1, "Active Call Count: {0}", codec.ActiveCalls.Count); - - if (codec.ActiveCalls.Count > 0) - { - if (codec.ActiveCalls.Count == 1 && meetingInfoCodec == null) - TriList.SetString(UIStringJoin.HeaderCallStatusLabel, "1 Active Call"); - else if (codec.ActiveCalls.Count == 1 && meetingInfoCodec != null) - { - var headerCallStatusLabel = meetingInfoCodec.MeetingInfo.IsSharingMeeting - ? "Sharing-Only Meeting" - : "Active Meeting"; - - headerCallStatusLabel = meetingInfoCodec.MeetingInfo.WaitingForHost - ? "Waiting For Host" - : headerCallStatusLabel; - - TriList.SetString(UIStringJoin.HeaderCallStatusLabel, headerCallStatusLabel); - } - 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"); - } - - private void SetHeaderCallIcon(VideoCodecBase codec) - { - 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); - } - - /// - /// Sets up Header Buttons for the EssentialsHuddleVtc1Room type - /// - public void SetupHeaderButtons(EssentialsHuddleVtc1PanelAvFunctionsDriver avDriver, IEssentialsHuddleVtc1Room currentRoom) - { - HeaderButtonsAreSetUp = false; - - TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true); - - 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; - Parent.AvDriver.PopupInterlock.StatusChanged += PopupInterlock_StatusChanged; - - SetUpGear(avDriver, currentRoom); - - SetUpHelpButton(roomConf); - - uint nextJoin = 3953; - - nextJoin = SetUpEnvironmentButton(Parent.EnvironmentDriver, nextJoin); - - nextJoin = SetUpCalendarButton(avDriver, nextJoin); - - nextJoin = SetUpCallButton(avDriver, nextJoin); - - // blank any that remain - for (var i = nextJoin; i > 3950; i--) - { - TriList.SetString(i, "Blank"); - TriList.SetSigFalseAction(i, () => { }); - } - - TriList.SetSigFalseAction(UIBoolJoin.HeaderCallStatusLabelPress, - () => - { - avDriver.ShowActiveCallsListOrMeetingInfo(); - if (avDriver.CurrentRoom.InCallFeedback.BoolValue) - CaretInterlock.ShowInterlocked(CallCaretVisible); - }); - - // 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); - } - - /// - /// Sets up Header Buttons for the EssentialsHuddleSpaceRoom type - /// - public void SetupHeaderButtons(EssentialsHuddlePanelAvFunctionsDriver avDriver, IEssentialsHuddleSpaceRoom currentRoom) - { - HeaderButtonsAreSetUp = false; - - TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true); - - 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; - Parent.AvDriver.PopupInterlock.StatusChanged += PopupInterlock_StatusChanged; - - SetUpGear(avDriver, currentRoom); - - SetUpHelpButton(roomConf); - - uint nextJoin = 3953; - - nextJoin = SetUpEnvironmentButton(Parent.EnvironmentDriver, nextJoin); - - // blank any that remain - for (var i = nextJoin; i > 3950; i--) - { - TriList.SetString(i, "Blank"); - TriList.SetSigFalseAction(i, () => { }); - } - - HeaderButtonsAreSetUp = true; - } - - ///// - ///// Whenever a popup is shown/hidden, show/hide the header carets subpage and set the visibility of the correct caret - ///// - ///// - ///// - //void IsShownFeedback_OutputChange(object sender, EventArgs e) - //{ - // var popupInterlockIsShown = Parent.AvDriver.PopupInterlock.IsShown; - // // Set the visible state for the HeaderPopupCaretsSubpage to match that of the PopupInterlock state - // TriList.SetBool(UIBoolJoin.HeaderPopupCaretsSubpageVisibile, popupInterlockIsShown); - - // // Clear all caret visibility - // for (uint i = UIBoolJoin.HeaderCaret5Visible; i >= UIBoolJoin.HeaderCaret1Visible; i--) - // { - // TriList.SetBool(i, false); - // } - - // // Set the current caret visible if the popup is still shown - // if (popupInterlockIsShown) - // TriList.SetBool(NextCaretVisible, true); - //} - - /// - /// Whenever a popup is shown/hidden, show/hide the header carets subpage and set the visibility of the correct caret - /// - /// - /// - void PopupInterlock_StatusChanged(object sender, StatusChangedEventArgs e) - { - // Set the visible state for the HeaderPopupCaretsSubpage to match that of the PopupInterlock state - - bool headerPopupShown = false; - - // Check if the popup interlock is shown, and if one of the header popups is current, then show the carets subpage - if (e.IsShown) - { - if (Parent.EnvironmentDriver != null && e.NewJoin == Parent.EnvironmentDriver.BackgroundSubpageJoin) - headerPopupShown = true; - else if (e.NewJoin == UIBoolJoin.HeaderActiveCallsListVisible) - headerPopupShown = true; - else if (e.NewJoin == UIBoolJoin.HeaderMeetingInfoVisible) - headerPopupShown = true; - else if (e.NewJoin == UIBoolJoin.HelpPageVisible) - headerPopupShown = true; - else if (e.NewJoin == UIBoolJoin.MeetingsOrContacMethodsListVisible) - headerPopupShown = true; - else if (e.NewJoin == UIBoolJoin.VolumesPagePowerOffVisible || e.NewJoin == UIBoolJoin.VolumesPageVisible) - headerPopupShown = true; - } - - // Set the carets subpage visibility - TriList.SetBool(UIBoolJoin.HeaderPopupCaretsSubpageVisibile, headerPopupShown); - - if (!e.IsShown) - CaretInterlock.HideAndClear(); - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UIDrivers/Essentials/EssentialsPanelMainInterfaceDriver.cs b/src/PepperDash.Essentials/UIDrivers/Essentials/EssentialsPanelMainInterfaceDriver.cs deleted file mode 100644 index 6b9ae605..00000000 --- a/src/PepperDash.Essentials/UIDrivers/Essentials/EssentialsPanelMainInterfaceDriver.cs +++ /dev/null @@ -1,168 +0,0 @@ -using System; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.UI; -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.SmartObjects; - -namespace PepperDash.Essentials -{ - /// - /// - /// - public class EssentialsPanelMainInterfaceDriver : PanelDriverBase, IHasScreenSaverController, IDisposable - { - CTimer InactivityTimer; - - /// - /// Assign the appropriate A/V driver. - /// Want to keep the AvDriver alive, because it may hold states - /// - public IAVDriver AvDriver { get; set;} - - public EssentialsHeaderDriver HeaderDriver { get; set; } - - public EssentialsEnvironmentDriver EnvironmentDriver { get; set; } - - public PanelDriverBase CurrentChildDriver { get; private set; } - - public ScreenSaverController ScreenSaverController { get; set; } - - private readonly long _timeoutMs; - - CrestronTouchpanelPropertiesConfig Config; - - /// - /// The main interlock for popups - /// - //public JoinedSigInterlock PopupInterlock { get; private set; } - - public EssentialsPanelMainInterfaceDriver(BasicTriListWithSmartObject trilist, - CrestronTouchpanelPropertiesConfig config) - : base(trilist) - { - Config = config; - - _timeoutMs = Config.ScreenSaverTimeoutMin * 60 * 1000; - - var tsx52or60 = trilist as Tswx52ButtonVoiceControl; - - if (tsx52or60 != null) - { - tsx52or60.ExtenderTouchDetectionReservedSigs.Use(); - tsx52or60.ExtenderTouchDetectionReservedSigs.DeviceExtenderSigChange += ExtenderTouchDetectionReservedSigs_DeviceExtenderSigChange; - tsx52or60.ExtenderTouchDetectionReservedSigs.Time.UShortValue = 1; - ManageInactivityTimer(); - - } - else - { - var tswx70 = trilist as TswX70Base; - if (tswx70 != null) - { - tswx70.ExtenderTouchDetectionReservedSigs.Use(); - tswx70.ExtenderTouchDetectionReservedSigs.DeviceExtenderSigChange += ExtenderTouchDetectionReservedSigs_DeviceExtenderSigChange; - tswx70.ExtenderTouchDetectionReservedSigs.Time.UShortValue = 1; - ManageInactivityTimer(); - } - } - } - - #region IDisposable Members - - public void Dispose() - { - var avDriver = AvDriver as PanelDriverBase; - if (avDriver != null) - { - avDriver.Hide(); - } - if (ScreenSaverController != null) - { - ScreenSaverController.Dispose(); - } - if (HeaderDriver != null) - { - HeaderDriver.Hide(); - } - if (EnvironmentDriver != null) - { - EnvironmentDriver.Hide(); - } - if (CurrentChildDriver != null) - { - CurrentChildDriver.Hide(); - } - } - - #endregion - - void ExtenderTouchDetectionReservedSigs_DeviceExtenderSigChange(Crestron.SimplSharpPro.DeviceExtender currentDeviceExtender, Crestron.SimplSharpPro.SigEventArgs args) - { - - if (args.Sig.BoolValue) - { - ManageInactivityTimer(); - } - } - - private void ManageInactivityTimer() - { - if (InactivityTimer != null) - { - InactivityTimer.Reset(_timeoutMs); - } - else - { - InactivityTimer = new CTimer((o) => InactivityTimerExpired(), _timeoutMs); - } - } - - void InactivityTimerExpired() - { - InactivityTimer.Stop(); - InactivityTimer.Dispose(); - InactivityTimer = null; - - ScreenSaverController.Show(); - } - - public override void Show() - { - CurrentChildDriver = null; - ShowSubDriver(AvDriver as PanelDriverBase); - - base.Show(); - } - - public override void Hide() - { - TriList.BooleanInput[AvDriver.StartPageVisibleJoin].BoolValue = false; - base.Hide(); - } - - void ShowSubDriver(PanelDriverBase driver) - { - CurrentChildDriver = driver; - if (driver == null) - return; - this.Hide(); - driver.Show(); - } - - /// - /// - /// - public override void BackButtonPressed() - { - if(CurrentChildDriver != null) - CurrentChildDriver.BackButtonPressed(); - } - } - - public interface IHasScreenSaverController - { - ScreenSaverController ScreenSaverController { get; } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UIDrivers/Essentials/EssentialsPresentationPanelAvFunctionsDriver.cs b/src/PepperDash.Essentials/UIDrivers/Essentials/EssentialsPresentationPanelAvFunctionsDriver.cs deleted file mode 100644 index 9c8514ea..00000000 --- a/src/PepperDash.Essentials/UIDrivers/Essentials/EssentialsPresentationPanelAvFunctionsDriver.cs +++ /dev/null @@ -1,1048 +0,0 @@ -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using Crestron.SimplSharp; -//using Crestron.SimplSharpPro; - -//using PepperDash.Core; -//using PepperDash.Essentials.Core; -//using PepperDash.Essentials.Core.Config; -//using PepperDash.Essentials.Core.SmartObjects; -//using PepperDash.Essentials.Core.PageManagers; - -//namespace PepperDash.Essentials -//{ -// /// -// /// -// /// -// public class EssentialsPresentationPanelAvFunctionsDriver : PanelDriverBase -// { -// /// -// /// Smart Object 3200 -// /// -// SubpageReferenceList SourcesSrl; - -// /// -// /// For tracking feedback on last selected -// /// -// BoolInputSig LastSelectedSourceSig; - -// /// -// /// The source that has been selected and is awaiting assignment to a display -// /// -// SourceListItem PendingSource; - -// bool IsSharingModeAdvanced; - -// CrestronTouchpanelPropertiesConfig Config; - -// public enum UiDisplayMode -// { -// PresentationMode, AudioSetup -// } - -// /// -// /// Whether volume ramping from this panel will show the volume -// /// gauge popup. -// /// -// public bool ShowVolumeGauge { get; set; } - -// /// -// /// The amount of time that the volume buttons stays on screen, in ms -// /// -// public uint VolumeButtonPopupTimeout -// { -// get { return VolumeButtonsPopupFeedback.TimeoutMs; } -// set { VolumeButtonsPopupFeedback.TimeoutMs = value; } -// } - -// /// -// /// The amount of time that the volume gauge stays on screen, in ms -// /// -// public uint VolumeGaugePopupTimeout -// { -// get { return VolumeGaugeFeedback.TimeoutMs; } -// set { VolumeGaugeFeedback.TimeoutMs = value; } -// } - -// /// -// /// -// /// -// public uint PowerOffTimeout { get; set; } - -// /// -// /// -// /// -// public string DefaultRoomKey -// { -// get { return _DefaultRoomKey; } -// set -// { -// _DefaultRoomKey = value; -// CurrentRoom = DeviceManager.GetDeviceForKey(value) as EssentialsPresentationRoom; -// } -// } -// string _DefaultRoomKey; - -// /// -// /// -// /// -// public EssentialsPresentationRoom CurrentRoom -// { -// get { return _CurrentRoom; } -// set -// { -// SetCurrentRoom(value); -// } -// } -// EssentialsPresentationRoom _CurrentRoom; - -// /// -// /// For hitting feedback -// /// -// BoolInputSig ShareButtonSig; -// BoolInputSig EndMeetingButtonSig; - -// /// -// /// Controls the extended period that the volume gauge shows on-screen, -// /// as triggered by Volume up/down operations -// /// -// BoolFeedbackPulseExtender VolumeGaugeFeedback; - -// /// -// /// Controls the period that the volume buttons show on non-hard-button -// /// interfaces -// /// -// BoolFeedbackPulseExtender VolumeButtonsPopupFeedback; - -// /// -// /// The parent driver for this -// /// -// PanelDriverBase Parent; - -// ///// -// ///// Driver that manages advanced sharing features -// ///// -// //DualDisplaySimpleOrAdvancedRouting DualDisplayUiDriver; - -// /// -// /// All children attached to this driver. For hiding and showing as a group. -// /// -// List ChildDrivers = new List(); - -// List CurrentDisplayModeSigsInUse = new List(); - -// /// -// /// Smart Object 15022 -// /// -// SubpageReferenceList ActivityFooterSrl; - -// /// -// /// Tracks which audio page group the UI is in -// /// -// UiDisplayMode CurrentDisplayMode; - -// /// -// /// The AV page mangagers that have been used, to keep them alive for later -// /// -// Dictionary PageManagers = new Dictionary(); - -// /// -// /// Current page manager running for a source -// /// -// PageManager CurrentSourcePageManager; - -// /// -// /// Will auto-timeout a power off -// /// -// CTimer PowerOffTimer; - -// /// -// /// Constructor -// /// -// public EssentialsPresentationPanelAvFunctionsDriver(PanelDriverBase parent, -// CrestronTouchpanelPropertiesConfig config) -// : base(parent.TriList) -// { -// Config = config; -// Parent = parent; - -// ActivityFooterSrl = new SubpageReferenceList(TriList, 15022, 3, 3, 3); -// //SetupActivityFooterWhenRoomOff(); - -// ShowVolumeGauge = true; - -// // One-second pulse extender for volume gauge -// VolumeGaugeFeedback = new BoolFeedbackPulseExtender(1500); -// VolumeGaugeFeedback.Feedback -// .LinkInputSig(TriList.BooleanInput[UIBoolJoin.VolumeGaugePopupVisible]); - -// VolumeButtonsPopupFeedback = new BoolFeedbackPulseExtender(4000); -// VolumeButtonsPopupFeedback.Feedback -// .LinkInputSig(TriList.BooleanInput[UIBoolJoin.VolumeButtonPopupVisible]); - -// PowerOffTimeout = 30000; - -// SourcesSrl = new SubpageReferenceList(TriList, 3200, 3, 3, 3); - -// TriList.StringInput[UIStringJoin.StartActivityText].StringValue = -// "Tap an activity to begin"; - -// // Sharing mode things -// TriList.SetSigFalseAction(UIBoolJoin.ToggleSharingModePress, ToggleSharingModePressed); - -// TriList.SetSigFalseAction(UIBoolJoin.Display1AudioButtonPressAndFb, Display1AudioPress); -// TriList.SetSigFalseAction(UIBoolJoin.Display1ControlButtonPress, Display1ControlPress); -// TriList.SetSigTrueAction(UIBoolJoin.Display1SelectPressAndFb, Display1Press); - -// TriList.SetSigFalseAction(UIBoolJoin.Display2AudioButtonPressAndFb, Display2AudioPress); -// TriList.SetSigFalseAction(UIBoolJoin.Display2ControlButtonPress, Display2ControlPress); -// TriList.SetSigTrueAction(UIBoolJoin.Display2SelectPressAndFb, Display2Press); -// } - -// /// -// /// -// /// -// public override void Show() -// { -// TriList.BooleanInput[UIBoolJoin.TopBarHabaneroVisible].BoolValue = true; -// TriList.BooleanInput[UIBoolJoin.ActivityFooterVisible].BoolValue = true; - -// // Default to showing rooms/sources now. -// ShowMode(UiDisplayMode.PresentationMode); - -// // Attach actions -// TriList.SetSigFalseAction(UIBoolJoin.VolumeButtonPopupPress, VolumeButtonsTogglePress); - -// //Interlocked modals -// TriList.SetSigFalseAction(UIBoolJoin.InterlockedModalClosePress, HideCurrentInterlockedModal); -// TriList.SetSigFalseAction(UIBoolJoin.HelpPress, () => -// { -// string message = null; -// var room = DeviceManager.GetDeviceForKey(Config.DefaultRoomKey) -// as EssentialsPresentationRoom; -// if (room != null) -// message = room.Config.HelpMessage; -// else -// message = "Sorry, no help message available. No room connected."; -// TriList.StringInput[UIStringJoin.HelpMessage].StringValue = message; -// ShowInterlockedModal(UIBoolJoin.HelpPageVisible); -// }); - -// TriList.SetSigFalseAction(UIBoolJoin.HeaderRoomButtonPress, () => -// ShowInterlockedModal(UIBoolJoin.RoomHeaderPageVisible)); - -// TriList.SetSigFalseAction(UIBoolJoin.FIXFIX_HeaderGearButtonPress_FIXFIX, () => -// ShowInterlockedModal(UIBoolJoin.VolumesPageVisible)); - -// // power-related functions -// // Note: some of these are not directly-related to the huddle space UI, but are held over -// // in case -// TriList.SetSigFalseAction(UIBoolJoin.ShowPowerOffPress, PowerButtonPressed); -// TriList.SetSigFalseAction(UIBoolJoin.PowerOffCancelPress, CancelPowerOff); -// TriList.SetSigFalseAction(UIBoolJoin.PowerOffConfirmPress, FinishPowerOff); -// TriList.SetSigFalseAction(UIBoolJoin.PowerOffMorePress, () => -// { -// CancelPowerOffTimer(); -// TriList.BooleanInput[UIBoolJoin.PowerOffStep1Visible].BoolValue = false; -// TriList.BooleanInput[UIBoolJoin.PowerOffStep2Visible].BoolValue = true; -// }); -// TriList.SetSigFalseAction(UIBoolJoin.AllRoomsOffPress, () => -// { -// EssentialsHuddleSpaceRoom.AllRoomsOff(); -// CancelPowerOff(); -// }); - -// SetupActivityFooterWhenRoomOff(); - -// base.Show(); -// } - -// /// -// /// -// /// -// public override void Hide() -// { -// var tl = TriList.BooleanInput; -// HideAndClearCurrentDisplayModeSigsInUse(); -// tl[UIBoolJoin.TopBarHabaneroVisible].BoolValue = false; -// tl[UIBoolJoin.ActivityFooterVisible].BoolValue = false; -// tl[StartPageVisibleJoin].BoolValue = false; -// tl[UIBoolJoin.TapToBeginVisible].BoolValue = false; -// tl[UIBoolJoin.ToggleSharingModeVisible].BoolValue = false; -// tl[UIBoolJoin.SourceStagingBarVisible].BoolValue = false; -// if (IsSharingModeAdvanced) -// tl[UIBoolJoin.DualDisplayPageVisible].BoolValue = false; -// else -// tl[UIBoolJoin.SelectASourceVisible].BoolValue = false; - -// VolumeButtonsPopupFeedback.ClearNow(); -// CancelPowerOff(); - -// base.Hide(); -// } - -// /// -// /// -// /// -// void ShowCurrentSharingMode() -// { -// var tlb = TriList.BooleanInput; -// tlb[UIBoolJoin.ToggleSharingModeVisible].BoolValue = true; -// tlb[UIBoolJoin.SourceStagingBarVisible].BoolValue = true; -// if (IsSharingModeAdvanced) -// { -// tlb[UIBoolJoin.DualDisplayPageVisible].BoolValue = true; -// TriList.StringInput[UIStringJoin.Display1TitleLabel].StringValue = -// (CurrentRoom.Displays[1] as IKeyName).Name; -// TriList.StringInput[UIStringJoin.Display2TitleLabel].StringValue = -// (CurrentRoom.Displays[2] as IKeyName).Name; -// } -// else -// tlb[UIBoolJoin.SelectASourceVisible].BoolValue = true; -// } - -// /// -// /// -// /// -// void HideCurrentSharingMode() -// { -// var tl = TriList.BooleanInput; -// tl[UIBoolJoin.ToggleSharingModeVisible].BoolValue = false; -// tl[UIBoolJoin.SourceStagingBarVisible].BoolValue = false; -// tl[UIBoolJoin.DualDisplayPageVisible].BoolValue = false; -// tl[UIBoolJoin.SelectASourceVisible].BoolValue = false; -// } - -// /// -// /// Shows the various "modes" that this driver controls. Presentation, Setup page -// /// -// /// -// public void ShowMode(UiDisplayMode mode) -// { -// //Clear whatever is showing now. -// HideAndClearCurrentDisplayModeSigsInUse(); -// CurrentDisplayMode = mode; -// switch (mode) -// { -// case UiDisplayMode.PresentationMode: -// // show start page or staging... -// if (CurrentRoom.OnFeedback.BoolValue) -// { -// //TriList.BooleanInput[UIBoolJoin.StagingPageVisible].BoolValue = true; -// TriList.BooleanInput[UIBoolJoin.TapToBeginVisible].BoolValue = false; -// TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = false; -// } -// else -// { -// TriList.BooleanInput[StartPageVisibleJoin].BoolValue = true; -// TriList.BooleanInput[UIBoolJoin.TapToBeginVisible].BoolValue = true; -// TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = false; -// } -// // Date/time -// if (Config.ShowDate && Config.ShowTime) -// { -// TriList.BooleanInput[UIBoolJoin.DateAndTimeVisible].BoolValue = true; -// TriList.BooleanInput[UIBoolJoin.DateOnlyVisible].BoolValue = false; -// TriList.BooleanInput[UIBoolJoin.TimeOnlyVisible].BoolValue = false; -// } -// else -// { -// TriList.BooleanInput[UIBoolJoin.DateAndTimeVisible].BoolValue = false; -// TriList.BooleanInput[UIBoolJoin.DateOnlyVisible].BoolValue = Config.ShowDate; -// TriList.BooleanInput[UIBoolJoin.TimeOnlyVisible].BoolValue = Config.ShowTime; -// } - -// //TriList.SetSigFalseAction(UIBoolJoin.ToggleSharingModePress, ToggleSharingModePressed); - -// ShowCurrentDisplayModeSigsInUse(); -// break; -// } -// } - -// /// -// /// -// /// -// void SetupSourceList() -// { -// // 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] -// .Values.ToList().OrderBy(s => s.Order); -// // Setup sources list -// uint i = 1; // counter for UI list -// foreach (var srcConfig in srcList) -// { -// if (!srcConfig.IncludeInSourceList) // Skip sources marked this way -// continue; - -// var sourceKey = srcConfig.SourceKey; -// var actualSource = DeviceManager.GetDeviceForKey(sourceKey) as Device; -// if (actualSource == null) -// { -// Debug.Console(0, "Cannot assign missing source '{0}' to source UI list", -// srcConfig.SourceKey); -// continue; -// } -// var localSrcItem = srcConfig; // lambda scope below -// var localIndex = i; -// SourcesSrl.GetBoolFeedbackSig(i, 1).UserObject = new Action(b => -// { -// if (b) return; -// if (LastSelectedSourceSig != null) -// LastSelectedSourceSig.BoolValue = false; -// LastSelectedSourceSig = SourcesSrl.BoolInputSig(localIndex, 1); -// LastSelectedSourceSig.BoolValue = true; -// if (IsSharingModeAdvanced) -// { -// PendingSource = localSrcItem; -// } -// else -// { -// CurrentRoom.RouteSourceToAllDestinations(localSrcItem); -// } -// }); -// SourcesSrl.StringInputSig(i, 1).StringValue = srcConfig.PreferredName; -// i++; -// } -// var count = (ushort)(i-1); -// SourcesSrl.Count = count; -// TriList.BooleanInput[UIBoolJoin.StagingPageAdditionalArrowsVisible].BoolValue = -// count >= Config.SourcesOverflowCount; - -// _CurrentRoom.CurrentDisplay1SourceChange += _CurrentRoom_CurrentDisplay1SourceChange; -// _CurrentRoom.CurrentDisplay2SourceChange += _CurrentRoom_CurrentDisplay2SourceChange; -// } -// } - -// /// -// /// -// /// -// void ToggleSharingModePressed() -// { -// if (CurrentSourcePageManager != null) -// CurrentSourcePageManager.Hide(); -// HideCurrentSharingMode(); -// IsSharingModeAdvanced = !IsSharingModeAdvanced; -// TriList.BooleanInput[UIBoolJoin.ToggleSharingModePress].BoolValue = IsSharingModeAdvanced; -// ShowCurrentSharingMode(); -// } - -// ///// -// ///// -// ///// -// //void EnableAppropriateDisplayButtons() -// //{ -// // if (LastSelectedSourceSig != null) -// // LastSelectedSourceSig.BoolValue = false; -// //} - -// public void Display1Press() -// { -// CurrentRoom.SourceToDisplay1(PendingSource); -// } - -// public void Display1AudioPress() -// { - -// } - - -// public void Display1ControlPress() -// { -// var uiDev = CurrentRoom.Display1SourceInfo.SourceDevice as IUiDisplayInfo; -// ShowSource(uiDev); -// } - -// public void Display2Press() -// { -// CurrentRoom.SourceToDisplay2(PendingSource); -// } - -// public void Display2AudioPress() -// { - -// } - -// public void Display2ControlPress() -// { -// var uiDev = CurrentRoom.Display2SourceInfo.SourceDevice as IUiDisplayInfo; -// ShowSource(uiDev); -// } - -// /// -// /// When the room is off, set the footer SRL -// /// -// void SetupActivityFooterWhenRoomOff() -// { -// ActivityFooterSrl.Clear(); -// ActivityFooterSrl.AddItem(new SubpageReferenceListActivityItem(1, ActivityFooterSrl, 0, -// b => { if (!b) ShareButtonPressed(); })); -// // only show phone call when there's a dialer present -// ActivityFooterSrl.AddItem(new SubpageReferenceListActivityItem(2, ActivityFooterSrl, 1, -// b => { })); -// ActivityFooterSrl.Count = (ushort)(CurrentRoom.HasAudioDialer ? 2 : 1); -// TriList.UShortInput[UIUshortJoin.PresentationStagingCaretMode].UShortValue = -// (ushort)(CurrentRoom.HasAudioDialer ? 1 : 0); -// } - -// /// -// /// Sets up the footer SRL for when the room is on -// /// -// void SetupActivityFooterWhenRoomOn() -// { -// ActivityFooterSrl.Clear(); -// ActivityFooterSrl.AddItem(new SubpageReferenceListActivityItem(1, ActivityFooterSrl, -// 0, null)); -// if (CurrentRoom.HasAudioDialer) -// { -// ActivityFooterSrl.AddItem(new SubpageReferenceListActivityItem(2, ActivityFooterSrl, -// 1, b => { })); -// ActivityFooterSrl.AddItem(new SubpageReferenceListActivityItem(3, ActivityFooterSrl, -// 3, b => { if (!b) PowerButtonPressed(); })); -// ActivityFooterSrl.Count = 3; -// TriList.UShortInput[UIUshortJoin.PresentationStagingCaretMode].UShortValue = 2; -// EndMeetingButtonSig = ActivityFooterSrl.BoolInputSig(3, 1); -// } -// else -// { -// ActivityFooterSrl.AddItem(new SubpageReferenceListActivityItem(2, ActivityFooterSrl, -// 3, b => { if (!b) PowerButtonPressed(); })); -// ActivityFooterSrl.Count = 2; -// TriList.UShortInput[UIUshortJoin.PresentationStagingCaretMode].UShortValue = 1; -// EndMeetingButtonSig = ActivityFooterSrl.BoolInputSig(2, 1); -// } -// } - -// /// -// /// Attached to activity list share button -// /// -// void ShareButtonPressed() -// { -// ShareButtonSig = ActivityFooterSrl.BoolInputSig(1, 1); -// if (!_CurrentRoom.OnFeedback.BoolValue) -// { -// ShareButtonSig.BoolValue = true; -// TriList.BooleanInput[StartPageVisibleJoin].BoolValue = false; -// ShowCurrentSharingMode(); -// } -// } - -// uint CurrentInterlockedModalJoin; - -// void ShowInterlockedModal(uint join) -// { -// if (CurrentInterlockedModalJoin == join) -// HideCurrentInterlockedModal(); -// else -// { -// TriList.BooleanInput[UIBoolJoin.HelpPageVisible].BoolValue = join == UIBoolJoin.HelpPageVisible; -// TriList.BooleanInput[UIBoolJoin.RoomHeaderPageVisible].BoolValue = join == UIBoolJoin.RoomHeaderPageVisible; -// TriList.BooleanInput[UIBoolJoin.VolumesPageVisible].BoolValue = join == UIBoolJoin.VolumesPageVisible; -// CurrentInterlockedModalJoin = join; -// } -// } - -// void HideCurrentInterlockedModal() -// { -// TriList.BooleanInput[CurrentInterlockedModalJoin].BoolValue = false; -// CurrentInterlockedModalJoin = 0; -// } - -// /// -// /// Shows all sigs that are in CurrentDisplayModeSigsInUse -// /// -// void ShowCurrentDisplayModeSigsInUse() -// { -// foreach (var sig in CurrentDisplayModeSigsInUse) -// sig.BoolValue = true; -// } - -// /// -// /// Hides all CurrentDisplayModeSigsInUse sigs and clears the array -// /// -// void HideAndClearCurrentDisplayModeSigsInUse() -// { -// foreach (var sig in CurrentDisplayModeSigsInUse) -// sig.BoolValue = false; -// CurrentDisplayModeSigsInUse.Clear(); -// } - -// /// -// /// Send the UI back depending on location, not used in huddle UI -// /// -// public override void BackButtonPressed() -// { -// switch (CurrentDisplayMode) -// { -// case UiDisplayMode.PresentationMode: -// //CancelReturnToSourceTimer(); -// BackToHome(); -// break; -// } -// } - -// /// -// /// -// /// -// void BackToHome() -// { -// Hide(); -// Parent.Show(); -// } - -// /// -// /// Loads the appropriate Sigs into CurrentDisplayModeSigsInUse and shows them -// /// -// void ShowCurrentSource() -// { -// if (CurrentRoom.CurrentSingleSourceInfo == null) -// return; -// var uiDev = CurrentRoom.CurrentSingleSourceInfo.SourceDevice as IUiDisplayInfo; -// ShowSource(uiDev); -// } - -// void ShowSource(IUiDisplayInfo uiDev) -// { -// PageManager pm = null; -// // If we need a page manager, get an appropriate one -// if (uiDev != null) -// { -// TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = false; -// if (IsSharingModeAdvanced) -// { -// TriList.BooleanInput[UIBoolJoin.SourceBackgroundOverlayVisible].BoolValue = true; -// TriList.SetSigFalseAction(UIBoolJoin.SourceBackgroundOverlayClosePress, new Action(() => -// { -// TriList.BooleanInput[UIBoolJoin.SourceBackgroundOverlayVisible].BoolValue = false; -// if (CurrentSourcePageManager != null) -// CurrentSourcePageManager.Hide(); -// })); -// } - - -// // Got an existing page manager, get it -// if (PageManagers.ContainsKey(uiDev)) -// pm = PageManagers[uiDev]; -// // Otherwise make an apporiate one -// else if (uiDev is ISetTopBoxControls) -// pm = new SetTopBoxThreePanelPageManager(uiDev as ISetTopBoxControls, TriList); -// else if (uiDev is IDiscPlayerControls) -// pm = new DiscPlayerMediumPageManager(uiDev as IDiscPlayerControls, TriList); -// else -// pm = new DefaultPageManager(uiDev, TriList); -// PageManagers[uiDev] = pm; -// CurrentSourcePageManager = pm; -// pm.Show(); -// } -// } - -// /// -// /// -// /// -// public void PowerButtonPressed() -// { -// if (!CurrentRoom.OnFeedback.BoolValue) -// return; -// EndMeetingButtonSig.BoolValue = true; -// ShareButtonSig.BoolValue = false; -// // Timeout or button 1 press will shut down -// var modal = new ModalDialog(TriList); -// uint time = 60000; -// uint seconds = time / 1000; -// var message = string.Format("Meeting will end in {0} seconds", seconds); -// modal.PresentModalDialog(2, "End Meeting", "Power", message, -// "End Meeting Now", "Cancel", true, true, -// but => -// { -// EndMeetingButtonSig.BoolValue = false; -// if (but != 2) -// { -// CurrentRoom.RouteSourceToAllDestinations(null); -// } -// else -// ShareButtonSig.BoolValue = true; // restore Share fb -// }); -// } - -// void CancelPowerOffTimer() -// { -// if (PowerOffTimer != null) -// { -// PowerOffTimer.Stop(); -// PowerOffTimer = null; -// } -// } - -// /// -// /// Runs the power off function on the current room -// /// -// public void FinishPowerOff() -// { -// if (CurrentRoom == null) -// return; -// CurrentRoom.RunRouteAction("roomOff"); -// CancelPowerOff(); -// } - -// /// -// /// Hides power off pages and stops timer -// /// -// void CancelPowerOff() -// { -// CancelPowerOffTimer(); -// TriList.BooleanInput[UIBoolJoin.PowerOffStep1Visible].BoolValue = false; -// TriList.BooleanInput[UIBoolJoin.PowerOffStep2Visible].BoolValue = false; -// } - -// /// -// /// -// /// -// void VolumeButtonsTogglePress() -// { -// if (VolumeButtonsPopupFeedback.BoolValue) -// VolumeButtonsPopupFeedback.ClearNow(); -// else -// { -// // Trigger the popup -// VolumeButtonsPopupFeedback.BoolValue = true; -// VolumeButtonsPopupFeedback.BoolValue = false; -// } -// } - -// /// -// /// -// /// -// /// -// public void VolumeUpPress(bool state) -// { -// // extend timeouts -// if (ShowVolumeGauge) -// VolumeGaugeFeedback.BoolValue = state; -// VolumeButtonsPopupFeedback.BoolValue = state; -// if (CurrentRoom.CurrentVolumeControls != null) -// CurrentRoom.CurrentVolumeControls.VolumeUp(state); -// } - -// /// -// /// -// /// -// /// -// public void VolumeDownPress(bool state) -// { -// // extend timeouts -// if (ShowVolumeGauge) -// VolumeGaugeFeedback.BoolValue = state; -// VolumeButtonsPopupFeedback.BoolValue = state; -// if (CurrentRoom.CurrentVolumeControls != null) -// CurrentRoom.CurrentVolumeControls.VolumeDown(state); -// } - -// /// -// /// Helper for property setter. Sets the panel to the given room, latching up all functionality -// /// -// void SetCurrentRoom(EssentialsPresentationRoom room) -// { -// if (_CurrentRoom == room) return; -// if (_CurrentRoom != null) -// { -// // Disconnect current room -// _CurrentRoom.OnFeedback.OutputChange -= _CurrentRoom_OnFeedback_OutputChange; -// _CurrentRoom.CurrentVolumeDeviceChange -= this._CurrentRoom_CurrentAudioDeviceChange; -// ClearAudioDeviceConnections(); -// _CurrentRoom.CurrentSingleSourceChange -= this._CurrentRoom_SourceInfoChange; -// DisconnectSource(_CurrentRoom.CurrentSingleSourceInfo); -// } -// _CurrentRoom = room; - -// if (_CurrentRoom != null) -// { -// if (IsSharingModeAdvanced) -// {} // add stuff here -// else -// SetupSourceList(); -// TriList.StringInput[UIStringJoin.CurrentRoomName].StringValue = _CurrentRoom.Name; - -// // Link up all the change events from the room -// _CurrentRoom.OnFeedback.OutputChange += _CurrentRoom_OnFeedback_OutputChange; -// _CurrentRoom.CurrentVolumeDeviceChange += _CurrentRoom_CurrentAudioDeviceChange; -// RefreshAudioDeviceConnections(); -// _CurrentRoom.CurrentSingleSourceChange += _CurrentRoom_SourceInfoChange; -// RefreshSourceInfo(); -// } -// else -// { -// // Clear sigs that need to be -// TriList.StringInput[UIStringJoin.CurrentRoomName].StringValue = "Select a room"; -// } -// } - -// /// -// /// Hides source for provided source info -// /// -// /// -// void DisconnectSource(SourceListItem previousInfo) -// { -// if (previousInfo == null) return; - -// // Hide whatever is showing -// if (IsVisible) -// { -// if (CurrentSourcePageManager != null) -// { -// CurrentSourcePageManager.Hide(); -// CurrentSourcePageManager = null; -// } -// } - -// if (previousInfo == null) return; -// var previousDev = previousInfo.SourceDevice; - -// // device type interfaces -// if (previousDev is ISetTopBoxControls) -// (previousDev as ISetTopBoxControls).UnlinkButtons(TriList); -// // common interfaces -// if (previousDev is IChannel) -// (previousDev as IChannel).UnlinkButtons(TriList); -// if (previousDev is IColor) -// (previousDev as IColor).UnlinkButtons(TriList); -// if (previousDev is IDPad) -// (previousDev as IDPad).UnlinkButtons(TriList); -// if (previousDev is IDvr) -// (previousDev as IDvr).UnlinkButtons(TriList); -// if (previousDev is INumericKeypad) -// (previousDev as INumericKeypad).UnlinkButtons(TriList); -// if (previousDev is IPower) -// (previousDev as IPower).UnlinkButtons(TriList); -// if (previousDev is ITransport) -// (previousDev as ITransport).UnlinkButtons(TriList); -// //if (previousDev is IRadio) -// // (previousDev as IRadio).UnlinkButtons(this); -// } - -// /// -// /// Refreshes and shows the room's current source -// /// -// void RefreshSourceInfo() -// { -// var routeInfo = CurrentRoom.CurrentSingleSourceInfo; -// // This will show off popup too -// if (this.IsVisible) -// ShowCurrentSource(); - -// if (routeInfo == null)// || !CurrentRoom.OnFeedback.BoolValue) -// { -// // Check for power off and insert "Room is off" -// TriList.StringInput[UIStringJoin.CurrentSourceName].StringValue = "Room is off"; -// TriList.StringInput[UIStringJoin.CurrentSourceIcon].StringValue = "Power"; -// this.Hide(); -// Parent.Show(); -// return; -// } -// else if (CurrentRoom.CurrentSingleSourceInfo != null) -// { -// TriList.StringInput[UIStringJoin.CurrentSourceName].StringValue = routeInfo.PreferredName; -// TriList.StringInput[UIStringJoin.CurrentSourceIcon].StringValue = routeInfo.Icon; // defaults to "blank" -// } -// else -// { -// TriList.StringInput[UIStringJoin.CurrentSourceName].StringValue = "---"; -// TriList.StringInput[UIStringJoin.CurrentSourceIcon].StringValue = "Blank"; -// } - -// // Connect controls -// if (routeInfo.SourceDevice != null) -// ConnectControlDeviceMethods(routeInfo.SourceDevice); -// } - -// /// -// /// Attach the source to the buttons and things -// /// -// void ConnectControlDeviceMethods(Device dev) -// { -// if(dev is ISetTopBoxControls) -// (dev as ISetTopBoxControls).LinkButtons(TriList); -// if (dev is IChannel) -// (dev as IChannel).LinkButtons(TriList); -// if (dev is IColor) -// (dev as IColor).LinkButtons(TriList); -// if (dev is IDPad) -// (dev as IDPad).LinkButtons(TriList); -// if (dev is IDvr) -// (dev as IDvr).LinkButtons(TriList); -// if (dev is INumericKeypad) -// (dev as INumericKeypad).LinkButtons(TriList); -// if (dev is IPower) -// (dev as IPower).LinkButtons(TriList); -// if (dev is ITransport) -// (dev as ITransport).LinkButtons(TriList); -// //if (dev is IRadio) -// // (dev as IRadio).LinkButtons(this); // +++++++++++++ Make part of this into page manager - -// //if (dev is ICustomFunctions) -// //{ -// // var custBridge = (dev as ICustomFunctions).GetCustomBridge(); -// // custBridge.Link(this.Remote); -// } - -// /// -// /// Detaches the buttons and feedback from the room's current audio device -// /// -// void ClearAudioDeviceConnections() -// { -// TriList.ClearBoolSigAction(UIBoolJoin.VolumeUpPress); -// TriList.ClearBoolSigAction(UIBoolJoin.VolumeDownPress); -// TriList.ClearBoolSigAction(UIBoolJoin.Volume1ProgramMutePressAndFB); - -// var fDev = CurrentRoom.CurrentVolumeControls as IBasicVolumeWithFeedback; -// if (fDev != null) -// { -// TriList.ClearUShortSigAction(UIUshortJoin.VolumeSlider1Value); -// fDev.VolumeLevelFeedback.UnlinkInputSig( -// TriList.UShortInput[UIUshortJoin.VolumeSlider1Value]); -// } -// } - -// /// -// /// Attaches the buttons and feedback to the room's current audio device -// /// -// void RefreshAudioDeviceConnections() -// { -// var dev = CurrentRoom.CurrentVolumeControls; -// if (dev != null) // connect buttons -// { -// TriList.SetBoolSigAction(UIBoolJoin.VolumeUpPress, VolumeUpPress); -// TriList.SetBoolSigAction(UIBoolJoin.VolumeDownPress, VolumeDownPress); -// TriList.SetSigFalseAction(UIBoolJoin.Volume1ProgramMutePressAndFB, dev.MuteToggle); -// } - -// var fbDev = dev as IBasicVolumeWithFeedback; -// if (fbDev == null) // this should catch both IBasicVolume and IBasicVolumeWithFeeback -// TriList.UShortInput[UIUshortJoin.VolumeSlider1Value].UShortValue = 0; -// else -// { -// // slider -// TriList.SetUShortSigAction(UIUshortJoin.VolumeSlider1Value, fbDev.SetVolume); -// // feedbacks -// fbDev.MuteFeedback.LinkInputSig(TriList.BooleanInput[UIBoolJoin.Volume1ProgramMutePressAndFB]); -// fbDev.VolumeLevelFeedback.LinkInputSig( -// TriList.UShortInput[UIUshortJoin.VolumeSlider1Value]); -// } -// } - -// /// -// /// Handler for when the room's volume control device changes -// /// -// void _CurrentRoom_CurrentAudioDeviceChange(object sender, VolumeDeviceChangeEventArgs args) -// { -// if (args.Type == ChangeType.WillChange) -// ClearAudioDeviceConnections(); -// else // did change -// RefreshAudioDeviceConnections(); -// } - -// /// -// /// For room on/off changes -// /// -// void _CurrentRoom_OnFeedback_OutputChange(object sender, EventArgs e) -// { -// var value = _CurrentRoom.OnFeedback.BoolValue; -// TriList.BooleanInput[UIBoolJoin.RoomIsOn].BoolValue = value; -// if (value) -// { -// SetupActivityFooterWhenRoomOn(); -// TriList.BooleanInput[StartPageVisibleJoin].BoolValue = false; -// } -// else -// { -// HideCurrentSharingMode(); -// SetupActivityFooterWhenRoomOff(); -// TriList.BooleanInput[StartPageVisibleJoin].BoolValue = true; -// if (LastSelectedSourceSig != null) -// { -// LastSelectedSourceSig.BoolValue = false; -// LastSelectedSourceSig = null; -// } -// PendingSource = null; -// } - -// if (_CurrentRoom.HasAudioDialer) -// { -// TriList.BooleanInput[UIBoolJoin.VolumeDualMute1Visible].BoolValue = value; -// TriList.BooleanInput[UIBoolJoin.VolumeSingleMute1Visible].BoolValue = false; -// } -// else -// { -// TriList.BooleanInput[UIBoolJoin.VolumeDualMute1Visible].BoolValue = false; -// TriList.BooleanInput[UIBoolJoin.VolumeSingleMute1Visible].BoolValue = value; -// } -// } - -// /// -// /// Handles source change -// /// -// void _CurrentRoom_SourceInfoChange(IEssentialsRoom room, -// SourceListItem info, ChangeType change) -// { -// if (change == ChangeType.WillChange) -// DisconnectSource(info); -// else -// RefreshSourceInfo(); -// } - -// /// -// /// -// /// -// void _CurrentRoom_CurrentDisplay1SourceChange(IEssentialsRoom room, SourceListItem info, ChangeType type) -// { -// if (type == ChangeType.DidChange) -// { -// var isSource = info != null; -// TriList.BooleanInput[UIBoolJoin.Display1SelectPressAndFb].BoolValue = isSource; -// TriList.StringInput[UIStringJoin.Display1SourceLabel].StringValue = -// isSource ? info.PreferredName : ""; -// if (!isSource) // return if no source -// { -// TriList.BooleanInput[UIBoolJoin.Display1AudioButtonEnable].BoolValue = false; -// TriList.BooleanInput[UIBoolJoin.Display1ControlButtonEnable].BoolValue = false; -// return; -// } -// // enable audio and control buttons -// var devConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(d => d.Key == info.SourceKey); -// TriList.BooleanInput[UIBoolJoin.Display1AudioButtonEnable].BoolValue = -// ConfigPropertiesHelpers.GetHasAudio(devConfig); -// TriList.BooleanInput[UIBoolJoin.Display1ControlButtonEnable].BoolValue = -// ConfigPropertiesHelpers.GetHasControls(devConfig); -// } -// } - -// /// -// /// -// /// -// void _CurrentRoom_CurrentDisplay2SourceChange(IEssentialsRoom room, SourceListItem info, ChangeType type) -// { -// if (type == ChangeType.DidChange) -// { -// var isSource = info != null; -// TriList.BooleanInput[UIBoolJoin.Display2SelectPressAndFb].BoolValue = isSource; -// TriList.StringInput[UIStringJoin.Display2SourceLabel].StringValue = -// isSource ? info.PreferredName : ""; -// if (!isSource) -// { -// TriList.BooleanInput[UIBoolJoin.Display2AudioButtonEnable].BoolValue = false; -// TriList.BooleanInput[UIBoolJoin.Display2ControlButtonEnable].BoolValue = false; -// return; -// } -// // enable audio and control buttons -// var devConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(d => d.Key == info.SourceKey); -// TriList.BooleanInput[UIBoolJoin.Display2AudioButtonEnable].BoolValue = -// ConfigPropertiesHelpers.GetHasAudio(devConfig); -// TriList.BooleanInput[UIBoolJoin.Display2ControlButtonEnable].BoolValue = -// ConfigPropertiesHelpers.GetHasControls(devConfig); -// } -// } - -// } -//} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs b/src/PepperDash.Essentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs deleted file mode 100644 index e58172de..00000000 --- a/src/PepperDash.Essentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs +++ /dev/null @@ -1,1128 +0,0 @@ -using System; -using System.Collections.Generic; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.UI; - -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Core.SmartObjects; -using PepperDash.Essentials.Core.PageManagers; - -namespace PepperDash.Essentials -{ - /// - /// - /// - public class EssentialsHuddlePanelAvFunctionsDriver : PanelDriverBase, IAVDriver - { - CrestronTouchpanelPropertiesConfig Config; - - public enum UiDisplayMode - { - PresentationMode, AudioSetup - } - - public uint StartPageVisibleJoin { get; private set; } - - - /// - /// Whether volume ramping from this panel will show the volume - /// gauge popup. - /// - public bool ShowVolumeGauge { get; set; } - - /// - /// The amount of time that the volume buttons stays on screen, in ms - /// - public uint VolumeButtonPopupTimeout - { - get { return VolumeButtonsPopupFeedback.TimeoutMs; } - set { VolumeButtonsPopupFeedback.TimeoutMs = value; } - } - - /// - /// The amount of time that the volume gauge stays on screen, in ms - /// - public uint VolumeGaugePopupTimeout - { - get { return VolumeGaugeFeedback.TimeoutMs; } - set { VolumeGaugeFeedback.TimeoutMs = value; } - } - - /// - /// - /// - public uint PowerOffTimeout { get; set; } - - /// - /// - /// - public string DefaultRoomKey - { - get { return _DefaultRoomKey; } - set - { - _DefaultRoomKey = value; - //CurrentRoom = DeviceManager.GetDeviceForKey(value) as EssentialsHuddleSpaceRoom; - } - } - string _DefaultRoomKey; - - /// - /// Indicates that the SetHeaderButtons method has completed successfully - /// - public bool HeaderButtonsAreSetUp { get; private set; } - - /// - /// - /// - public IEssentialsHuddleSpaceRoom CurrentRoom - { - get { return _CurrentRoom; } - set - { - SetCurrentRoom(value); - } - } - IEssentialsHuddleSpaceRoom _CurrentRoom; - - /// - /// - /// - //uint CurrentInterlockedModalJoin; - - /// - /// For hitting feedback - /// - BoolInputSig ShareButtonSig; - BoolInputSig EndMeetingButtonSig; - - /// - /// Controls the extended period that the volume gauge shows on-screen, - /// as triggered by Volume up/down operations - /// - BoolFeedbackPulseExtender VolumeGaugeFeedback; - - /// - /// Controls the period that the volume buttons show on non-hard-button - /// interfaces - /// - BoolFeedbackPulseExtender VolumeButtonsPopupFeedback; - - /// - /// The parent driver for this - /// - public PanelDriverBase Parent { get; private set; } - - /// - /// All children attached to this driver. For hiding and showing as a group. - /// - List ChildDrivers = new List(); - - List CurrentDisplayModeSigsInUse = new List(); - - //// Important smart objects - - /// - /// Smart Object 3200 - /// - SubpageReferenceList SourcesSrl; - - /// - /// Smart Object 15022 - /// - SubpageReferenceList ActivityFooterSrl; - - /// - /// Tracks which audio page group the UI is in - /// - UiDisplayMode CurrentDisplayMode; - - /// - /// The AV page mangagers that have been used, to keep them alive for later - /// - Dictionary PageManagers = new Dictionary(); - - /// - /// Current page manager running for a source - /// - PageManager CurrentSourcePageManager; - - /// - /// Will auto-timeout a power off - /// - CTimer PowerOffTimer; - - ModalDialog PowerDownModal; - - public JoinedSigInterlock PopupInterlock { get; private set; } - - /// - /// The driver for the tech page. Lazy getter for memory usage - /// - PepperDash.Essentials.UIDrivers.EssentialsHuddleTechPageDriver TechDriver - { - get - { - if (_TechDriver == null) - _TechDriver = new PepperDash.Essentials.UIDrivers.EssentialsHuddleTechPageDriver(TriList, CurrentRoom.PropertiesConfig.Tech); - return _TechDriver; - } - } - PepperDash.Essentials.UIDrivers.EssentialsHuddleTechPageDriver _TechDriver; - - - /// - /// Controls timeout of notification ribbon timer - /// - CTimer RibbonTimer; - - /// - /// Constructor - /// - public EssentialsHuddlePanelAvFunctionsDriver(PanelDriverBase parent, CrestronTouchpanelPropertiesConfig config) - : base(parent.TriList) - { - Config = config; - Parent = parent; - PopupInterlock = new JoinedSigInterlock(TriList); - - SourcesSrl = new SubpageReferenceList(TriList, 3200, 3, 3, 3); - ActivityFooterSrl = new SubpageReferenceList(TriList, 15022, 3, 3, 3); - ShareButtonSig = ActivityFooterSrl.BoolInputSig(1, 1); - - SetupActivityFooterWhenRoomOff(); - - ShowVolumeGauge = true; - - // One-second pulse extender for volume gauge - VolumeGaugeFeedback = new BoolFeedbackPulseExtender(1500); - VolumeGaugeFeedback.Feedback - .LinkInputSig(TriList.BooleanInput[UIBoolJoin.VolumeGaugePopupVisible]); - - VolumeButtonsPopupFeedback = new BoolFeedbackPulseExtender(4000); - VolumeButtonsPopupFeedback.Feedback - .LinkInputSig(TriList.BooleanInput[UIBoolJoin.VolumeButtonPopupVisible]); - - PowerOffTimeout = 30000; - - TriList.StringInput[UIStringJoin.StartActivityText].StringValue = - "Tap Share to begin"; - } - - - /// - /// - /// - public override void Show() - { - if (CurrentRoom == null) - { - Debug.Console(1, "ERROR: AVUIFunctionsDriver, Cannot show. No room assigned"); - return; - } - - var roomConf = CurrentRoom.PropertiesConfig; - - if (Config.HeaderStyle.ToLower() == CrestronTouchpanelPropertiesConfig.Habanero) - { - TriList.SetSigFalseAction(UIBoolJoin.HeaderRoomButtonPress, () => - { - if (CurrentRoom.IsMobileControlEnabled) - { - Debug.Console(1, "Showing Mobile Control Header Info"); - PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.RoomHeaderInfoMCPageVisible); - } - else - { - Debug.Console(1, "Showing Non Mobile Control Header Info"); - PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.RoomHeaderInfoPageVisible); - } - }); - } - else if (Config.HeaderStyle.ToLower() == CrestronTouchpanelPropertiesConfig.Verbose) - { - TriList.SetSigFalseAction(UIBoolJoin.HeaderRoomButtonPress, () => - { - if (CurrentRoom.IsMobileControlEnabled) - { - Debug.Console(1, "Showing Mobile Control Header Info"); - PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.RoomHeaderInfoMCPageVisible); - } - else - { - Debug.Console(1, "Showing Non Mobile Control Header Info"); - PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.RoomHeaderInfoPageVisible); - } - }); - } - - TriList.SetBool(UIBoolJoin.DateAndTimeVisible, Config.ShowDate && Config.ShowTime); - TriList.SetBool(UIBoolJoin.DateOnlyVisible, Config.ShowDate && !Config.ShowTime); - TriList.SetBool(UIBoolJoin.TimeOnlyVisible, !Config.ShowDate && Config.ShowTime); - - TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true); - TriList.BooleanInput[UIBoolJoin.ActivityFooterVisible].BoolValue = true; - - // Default to showing rooms/sources now. - if (CurrentRoom.OnFeedback.BoolValue) - { - TriList.SetBool(UIBoolJoin.TapToBeginVisible, false); - SetupActivityFooterWhenRoomOn(); - } - else - { - TriList.SetBool(StartPageVisibleJoin, true); - TriList.SetBool(UIBoolJoin.TapToBeginVisible, true); - SetupActivityFooterWhenRoomOff(); - } - ShowCurrentDisplayModeSigsInUse(); - - // Attach actions - TriList.SetSigFalseAction(UIBoolJoin.VolumeButtonPopupPress, VolumeButtonsTogglePress); - - // Generic "close" button for popup modals - TriList.SetSigFalseAction(UIBoolJoin.InterlockedModalClosePress, PopupInterlock.HideAndClear); - - // Volume related things - TriList.SetSigFalseAction(UIBoolJoin.VolumeDefaultPress, () => CurrentRoom.SetDefaultLevels()); - TriList.SetString(UIStringJoin.AdvancedVolumeSlider1Text, "Room"); - - //TriList.SetSigFalseAction(UIBoolJoin.RoomHeaderButtonPress, () => - // ShowInterlockedModal(UIBoolJoin.RoomHeaderPageVisible)); - - - //if(TriList is CrestronApp) - // TriList.BooleanInput[UIBoolJoin.GearButtonVisible].BoolValue = false; - //else - // TriList.BooleanInput[UIBoolJoin.GearButtonVisible].BoolValue = true; - - // power-related functions - // Note: some of these are not directly-related to the huddle space UI, but are held over - // in case - TriList.SetSigFalseAction(UIBoolJoin.ShowPowerOffPress, EndMeetingPress); - - TriList.SetSigFalseAction(UIBoolJoin.DisplayPowerTogglePress, () => - { - if (CurrentRoom != null && CurrentRoom.DefaultDisplay != null && CurrentRoom.DefaultDisplay is IHasPowerControl) - (CurrentRoom.DefaultDisplay as IHasPowerControl).PowerToggle(); - }); - - base.Show(); - } - - /// - /// - /// - public void EndMeetingPress() - { - if (!CurrentRoom.OnFeedback.BoolValue - || CurrentRoom.ShutdownPromptTimer.IsRunningFeedback.BoolValue) - return; - - CurrentRoom.StartShutdown(eShutdownType.Manual); - } - - /// - /// Reveals the tech page and puts away anything that's in the way. - /// - public void ShowTech() - { - PopupInterlock.HideAndClear(); - TechDriver.Show(); - } - - /// - /// - /// - void ShowLogo() - { - if (CurrentRoom.LogoUrlLightBkgnd == null) - { - TriList.SetBool(UIBoolJoin.LogoDefaultVisible, true); - TriList.SetBool(UIBoolJoin.LogoUrlVisible, false); - } - else - { - TriList.SetBool(UIBoolJoin.LogoDefaultVisible, false); - TriList.SetBool(UIBoolJoin.LogoUrlVisible, true); - TriList.SetString(UIStringJoin.LogoUrlLightBkgnd, _CurrentRoom.LogoUrlLightBkgnd); - TriList.SetString(UIStringJoin.LogoUrlDarkBkgnd, _CurrentRoom.LogoUrlDarkBkgnd); - } - } - - /// - /// - /// - void HideLogo() - { - TriList.SetBool(UIBoolJoin.LogoDefaultVisible, false); - TriList.SetBool(UIBoolJoin.LogoUrlVisible, false); - } - - /// - /// - /// - public override void Hide() - { - HideAndClearCurrentDisplayModeSigsInUse(); - TriList.BooleanInput[UIBoolJoin.TopBarHabaneroDynamicVisible].BoolValue = false; - TriList.BooleanInput[UIBoolJoin.ActivityFooterVisible].BoolValue = false; - TriList.BooleanInput[StartPageVisibleJoin].BoolValue = false; - TriList.BooleanInput[UIBoolJoin.TapToBeginVisible].BoolValue = false; - TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = false; - //TriList.BooleanInput[UIBoolJoin.StagingPageVisible].BoolValue = false; - VolumeButtonsPopupFeedback.ClearNow(); - //CancelPowerOff(); - - base.Hide(); - } - - /// - /// Reveals a message on the notification ribbon until cleared - /// - /// Text to display - /// Time in ms to display. 0 to keep on screen - public void ShowNotificationRibbon(string message, int timeout) - { - TriList.SetString(UIStringJoin.NotificationRibbonText, message); - TriList.SetBool(UIBoolJoin.NotificationRibbonVisible, true); - if (timeout > 0) - { - if (RibbonTimer != null) - RibbonTimer.Stop(); - RibbonTimer = new CTimer(o => - { - TriList.SetBool(UIBoolJoin.NotificationRibbonVisible, false); - RibbonTimer = null; - }, timeout); - } - } - - /// - /// Hides the notification ribbon - /// - public void HideNotificationRibbon() - { - TriList.SetBool(UIBoolJoin.NotificationRibbonVisible, false); - if (RibbonTimer != null) - { - RibbonTimer.Stop(); - RibbonTimer = null; - } - } - - /// - /// Shows the various "modes" that this driver controls. Presentation, Setup page - /// - /// - public void ShowMode(UiDisplayMode mode) - { - //Clear whatever is showing now. - HideAndClearCurrentDisplayModeSigsInUse(); - CurrentDisplayMode = mode; - switch (mode) - { - case UiDisplayMode.PresentationMode: - // show start page or staging... - if (CurrentRoom.OnFeedback.BoolValue) - { - TriList.BooleanInput[UIBoolJoin.SourceStagingBarVisible].BoolValue = true; - TriList.BooleanInput[UIBoolJoin.TapToBeginVisible].BoolValue = false; - TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = false; - } - else - { - TriList.BooleanInput[StartPageVisibleJoin].BoolValue = true; - TriList.BooleanInput[UIBoolJoin.TapToBeginVisible].BoolValue = true; - TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = false; - } - // Date/time - if (Config.ShowDate && Config.ShowTime) - { - TriList.BooleanInput[UIBoolJoin.DateAndTimeVisible].BoolValue = true; - TriList.BooleanInput[UIBoolJoin.DateOnlyVisible].BoolValue = false; - TriList.BooleanInput[UIBoolJoin.TimeOnlyVisible].BoolValue = false; - } - else - { - TriList.BooleanInput[UIBoolJoin.DateAndTimeVisible].BoolValue = false; - TriList.BooleanInput[UIBoolJoin.DateOnlyVisible].BoolValue = Config.ShowDate; - TriList.BooleanInput[UIBoolJoin.TimeOnlyVisible].BoolValue = Config.ShowTime; - } - - ShowCurrentDisplayModeSigsInUse(); - break; - } - } - - /// - /// When the room is off, set the footer SRL - /// - void SetupActivityFooterWhenRoomOff() - { - ActivityFooterSrl.Clear(); - ActivityFooterSrl.AddItem(new SubpageReferenceListActivityItem(1, ActivityFooterSrl, 0, - b => { if (!b) ShareButtonPressed(); })); - ActivityFooterSrl.Count = 1; - TriList.UShortInput[UIUshortJoin.PresentationStagingCaretMode].UShortValue = 0; - ShareButtonSig.BoolValue = false; - } - - /// - /// Sets up the footer SRL for when the room is on - /// - void SetupActivityFooterWhenRoomOn() - { - ActivityFooterSrl.Clear(); - ActivityFooterSrl.AddItem(new SubpageReferenceListActivityItem(1, ActivityFooterSrl, - 0, null)); - ActivityFooterSrl.AddItem(new SubpageReferenceListActivityItem(2, ActivityFooterSrl, - 4, b => { if (!b) PowerButtonPressed(); })); - ActivityFooterSrl.Count = 2; - TriList.UShortInput[UIUshortJoin.PresentationStagingCaretMode].UShortValue = 1; - EndMeetingButtonSig = ActivityFooterSrl.BoolInputSig(2, 1); - ShareButtonSig.BoolValue = CurrentRoom.OnFeedback.BoolValue; - } - - /// - /// Attached to activity list share button - /// - void ShareButtonPressed() - { - ShareButtonSig.BoolValue = true; - TriList.BooleanInput[StartPageVisibleJoin].BoolValue = false; - TriList.BooleanInput[UIBoolJoin.SourceStagingBarVisible].BoolValue = true; - TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = true; - // Run default source when room is off and share is pressed - if (!CurrentRoom.OnFeedback.BoolValue) - (CurrentRoom as IRunDefaultPresentRoute).RunDefaultPresentRoute(); - } - - - /// - /// Shows all sigs that are in CurrentDisplayModeSigsInUse - /// - void ShowCurrentDisplayModeSigsInUse() - { - foreach (var sig in CurrentDisplayModeSigsInUse) - sig.BoolValue = true; - } - - /// - /// Hides all CurrentDisplayModeSigsInUse sigs and clears the array - /// - void HideAndClearCurrentDisplayModeSigsInUse() - { - foreach (var sig in CurrentDisplayModeSigsInUse) - sig.BoolValue = false; - CurrentDisplayModeSigsInUse.Clear(); - } - - /// - /// Send the UI back depending on location, not used in huddle UI - /// - public override void BackButtonPressed() - { - switch (CurrentDisplayMode) - { - case UiDisplayMode.PresentationMode: - //CancelReturnToSourceTimer(); - BackToHome(); - break; - } - } - - /// - /// - /// - void BackToHome() - { - Hide(); - Parent.Show(); - } - - /// - /// Loads the appropriate Sigs into CurrentDisplayModeSigsInUse and shows them - /// - void ShowCurrentSource() - { - if (CurrentRoom.CurrentSourceInfo == null) - return; - - var uiDev = CurrentRoom.CurrentSourceInfo.SourceDevice as IUiDisplayInfo; - PageManager pm = null; - // If we need a page manager, get an appropriate one - if (uiDev != null) - { - TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = false; - // Got an existing page manager, get it - if (PageManagers.ContainsKey(uiDev)) - pm = PageManagers[uiDev]; - // Otherwise make an apporiate one - else if (uiDev is ISetTopBoxControls) - //pm = new SetTopBoxMediumPageManager(uiDev as ISetTopBoxControls, TriList); - pm = new SetTopBoxThreePanelPageManager(uiDev as ISetTopBoxControls, TriList); - else if (uiDev is IDiscPlayerControls) - pm = new DiscPlayerMediumPageManager(uiDev as IDiscPlayerControls, TriList); - else - pm = new DefaultPageManager(uiDev, TriList); - PageManagers[uiDev] = pm; - CurrentSourcePageManager = pm; - pm.Show(); - } - } - - /// - /// Called from button presses on source, where We can assume we want - /// to change to the proper screen. - /// - /// The key name of the route to run - void UiSelectSource(string key) - { - // Run the route and when it calls back, show the source - CurrentRoom.RunRouteAction(key); - } - - /// - /// - /// - public void PowerButtonPressed() - { - if (!CurrentRoom.OnFeedback.BoolValue - || CurrentRoom.ShutdownPromptTimer.IsRunningFeedback.BoolValue) - return; - - CurrentRoom.StartShutdown(eShutdownType.Manual); - } - - /// - /// - /// - /// - /// - void ShutdownPromptTimer_HasStarted(object sender, EventArgs e) - { - // Do we need to check where the UI is? No? - var timer = CurrentRoom.ShutdownPromptTimer; - EndMeetingButtonSig.BoolValue = true; - ShareButtonSig.BoolValue = false; - - if (CurrentRoom.ShutdownType == eShutdownType.Manual || CurrentRoom.ShutdownType == eShutdownType.Vacancy) - { - PowerDownModal = new ModalDialog(TriList); - var message = string.Format("Meeting will end in {0} seconds", CurrentRoom.ShutdownPromptSeconds); - - // Attach timer things to modal - CurrentRoom.ShutdownPromptTimer.TimeRemainingFeedback.OutputChange += ShutdownPromptTimer_TimeRemainingFeedback_OutputChange; - CurrentRoom.ShutdownPromptTimer.PercentFeedback.OutputChange += ShutdownPromptTimer_PercentFeedback_OutputChange; - - // respond to offs by cancelling dialog - var onFb = CurrentRoom.OnFeedback; - EventHandler offHandler = null; - offHandler = (o, a) => - { - if (!onFb.BoolValue) - { - EndMeetingButtonSig.BoolValue = false; - PowerDownModal.HideDialog(); - onFb.OutputChange -= offHandler; - //gauge.OutputChange -= gaugeHandler; - } - }; - onFb.OutputChange += offHandler; - - PowerDownModal.PresentModalDialog(2, "End Meeting", "Power", message, "Cancel", "End Meeting Now", true, true, - but => - { - if (but != 2) // any button except for End cancels - timer.Cancel(); - else - timer.Finish(); - }); - } - } - - /// - /// - /// - /// - /// - void ShutdownPromptTimer_HasFinished(object sender, EventArgs e) - { - EndMeetingButtonSig.BoolValue = false; - CurrentRoom.ShutdownPromptTimer.TimeRemainingFeedback.OutputChange -= ShutdownPromptTimer_TimeRemainingFeedback_OutputChange; - CurrentRoom.ShutdownPromptTimer.PercentFeedback.OutputChange -= ShutdownPromptTimer_PercentFeedback_OutputChange; - } - - /// - /// - /// - /// - /// - void ShutdownPromptTimer_WasCancelled(object sender, EventArgs e) - { - if (PowerDownModal != null) - PowerDownModal.HideDialog(); - EndMeetingButtonSig.BoolValue = false; - ShareButtonSig.BoolValue = CurrentRoom.OnFeedback.BoolValue; - - CurrentRoom.ShutdownPromptTimer.TimeRemainingFeedback.OutputChange += ShutdownPromptTimer_TimeRemainingFeedback_OutputChange; - CurrentRoom.ShutdownPromptTimer.PercentFeedback.OutputChange -= ShutdownPromptTimer_PercentFeedback_OutputChange; - } - - void ShutdownPromptTimer_TimeRemainingFeedback_OutputChange(object sender, EventArgs e) - { - - var message = string.Format("Meeting will end in {0} seconds", (sender as StringFeedback).StringValue); - TriList.StringInput[ModalDialog.MessageTextJoin].StringValue = message; - } - - void ShutdownPromptTimer_PercentFeedback_OutputChange(object sender, EventArgs e) - { - var value = (ushort)((sender as IntFeedback).UShortValue * 65535 / 100); - TriList.UShortInput[ModalDialog.TimerGaugeJoin].UShortValue = value; - } - - /// - /// - /// - void CancelPowerOffTimer() - { - if (PowerOffTimer != null) - { - PowerOffTimer.Stop(); - PowerOffTimer = null; - } - } - - /// - /// - /// - void VolumeButtonsTogglePress() - { - if (VolumeButtonsPopupFeedback.BoolValue) - VolumeButtonsPopupFeedback.ClearNow(); - else - { - // Trigger the popup - VolumeButtonsPopupFeedback.BoolValue = true; - VolumeButtonsPopupFeedback.BoolValue = false; - } - } - - /// - /// - /// - /// - public void VolumeUpPress(bool state) - { - // extend timeouts - if (ShowVolumeGauge) - VolumeGaugeFeedback.BoolValue = state; - VolumeButtonsPopupFeedback.BoolValue = state; - if (CurrentRoom.CurrentVolumeControls != null) - CurrentRoom.CurrentVolumeControls.VolumeUp(state); - } - - /// - /// - /// - /// - public void VolumeDownPress(bool state) - { - // extend timeouts - if (ShowVolumeGauge) - VolumeGaugeFeedback.BoolValue = state; - VolumeButtonsPopupFeedback.BoolValue = state; - if (CurrentRoom.CurrentVolumeControls != null) - CurrentRoom.CurrentVolumeControls.VolumeDown(state); - } - - - /// - /// Helper for property setter. Sets the panel to the given room, latching up all functionality - /// - public void RefreshCurrentRoom(IEssentialsHuddleSpaceRoom room) - { - if (_CurrentRoom != null) - { - // Disconnect current room - _CurrentRoom.CurrentVolumeDeviceChange -= this.CurrentRoom_CurrentAudioDeviceChange; - ClearAudioDeviceConnections(); - _CurrentRoom.CurrentSourceChange -= 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.IsWarmingUpFeedback.OutputChange -= CurrentRoom_IsWarmingFeedback_OutputChange; - _CurrentRoom.IsCoolingDownFeedback.OutputChange -= IsCoolingDownFeedback_OutputChange; - } - - _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; - - 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; - if (_CurrentRoom.LogoUrlLightBkgnd == null) - { - TriList.BooleanInput[UIBoolJoin.LogoDefaultVisible].BoolValue = true; - TriList.BooleanInput[UIBoolJoin.LogoUrlVisible].BoolValue = false; - } - else - { - TriList.BooleanInput[UIBoolJoin.LogoDefaultVisible].BoolValue = false; - TriList.BooleanInput[UIBoolJoin.LogoUrlVisible].BoolValue = true; - TriList.StringInput[UIStringJoin.LogoUrlLightBkgnd].StringValue = _CurrentRoom.LogoUrlLightBkgnd; - TriList.StringInput[UIStringJoin.LogoUrlLightBkgnd].StringValue = _CurrentRoom.LogoUrlDarkBkgnd; - - } - - // Shutdown timer - _CurrentRoom.ShutdownPromptTimer.HasStarted += ShutdownPromptTimer_HasStarted; - _CurrentRoom.ShutdownPromptTimer.HasFinished += ShutdownPromptTimer_HasFinished; - _CurrentRoom.ShutdownPromptTimer.WasCancelled += ShutdownPromptTimer_WasCancelled; - - // Link up all the change events from the room - _CurrentRoom.OnFeedback.OutputChange += CurrentRoom_OnFeedback_OutputChange; - CurrentRoom_SyncOnFeedback(); - _CurrentRoom.IsWarmingUpFeedback.OutputChange += CurrentRoom_IsWarmingFeedback_OutputChange; - _CurrentRoom.IsCoolingDownFeedback.OutputChange += IsCoolingDownFeedback_OutputChange; - - _CurrentRoom.CurrentVolumeDeviceChange += CurrentRoom_CurrentAudioDeviceChange; - RefreshAudioDeviceConnections(); - _CurrentRoom.CurrentSourceChange += 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"; - } - } - - void SetCurrentRoom(IEssentialsHuddleSpaceRoom room) - { - if (_CurrentRoom == room) return; - // Disconnect current (probably never called) - - if (_CurrentRoom != null) - _CurrentRoom.ConfigChanged -= room_ConfigChanged; - - room.ConfigChanged -= room_ConfigChanged; - room.ConfigChanged += room_ConfigChanged; - - if (room.IsMobileControlEnabled) - { - StartPageVisibleJoin = UIBoolJoin.StartMCPageVisible; - UpdateMCJoins(room); - - if (_CurrentRoom != null) - _CurrentRoom.MobileControlRoomBridge.UserCodeChanged -= MobileControlRoomBridge_UserCodeChanged; - - room.MobileControlRoomBridge.UserCodeChanged -= MobileControlRoomBridge_UserCodeChanged; - room.MobileControlRoomBridge.UserCodeChanged += MobileControlRoomBridge_UserCodeChanged; - } - else - { - StartPageVisibleJoin = UIBoolJoin.StartPageVisible; - } - - RefreshCurrentRoom(room); - } - - void MobileControlRoomBridge_UserCodeChanged(object sender, EventArgs e) - { - UpdateMCJoins(_CurrentRoom); - } - - void UpdateMCJoins(IEssentialsHuddleSpaceRoom room) - { - TriList.SetString(UIStringJoin.RoomMcUrl, room.MobileControlRoomBridge.McServerUrl); - TriList.SetString(UIStringJoin.RoomMcQrCodeUrl, room.MobileControlRoomBridge.QrCodeUrl); - TriList.SetString(UIStringJoin.RoomUserCode, room.MobileControlRoomBridge.UserCode); - } - - /// - /// Fires when room config of current room has changed. Meant to refresh room values to propegate any updates to UI - /// - /// - /// - void room_ConfigChanged(object sender, EventArgs e) - { - RefreshCurrentRoom(_CurrentRoom); - } - - /// - /// For room on/off changes - /// - void CurrentRoom_OnFeedback_OutputChange(object sender, EventArgs e) - { - CurrentRoom_SyncOnFeedback(); - } - - void CurrentRoom_SyncOnFeedback() - { - var value = _CurrentRoom.OnFeedback.BoolValue; - //Debug.Console(2, CurrentRoom, "UI: Is on event={0}", value); - TriList.BooleanInput[UIBoolJoin.RoomIsOn].BoolValue = value; - - if (value) //ON - { - SetupActivityFooterWhenRoomOn(); - TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = false; - TriList.BooleanInput[UIBoolJoin.SourceStagingBarVisible].BoolValue = true; - TriList.BooleanInput[StartPageVisibleJoin].BoolValue = false; - TriList.BooleanInput[UIBoolJoin.VolumeSingleMute1Visible].BoolValue = true; - - } - else - { - SetupActivityFooterWhenRoomOff(); - ShowLogo(); - TriList.BooleanInput[StartPageVisibleJoin].BoolValue = true; - TriList.BooleanInput[UIBoolJoin.VolumeSingleMute1Visible].BoolValue = false; - TriList.BooleanInput[UIBoolJoin.SourceStagingBarVisible].BoolValue = false; - TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = false; - } - } - - /// - /// - /// - void CurrentRoom_IsWarmingFeedback_OutputChange(object sender, EventArgs e) - { - if (CurrentRoom.IsWarmingUpFeedback.BoolValue) - { - ShowNotificationRibbon("Room is powering on. Please wait...", 0); - } - else - { - ShowNotificationRibbon("Room is powered on. Welcome.", 2000); - } - } - - - void IsCoolingDownFeedback_OutputChange(object sender, EventArgs e) - { - if (CurrentRoom.IsCoolingDownFeedback.BoolValue) - { - ShowNotificationRibbon("Room is powering off. Please wait.", 0); - } - else - { - HideNotificationRibbon(); - } - } - - /// - /// Hides source for provided source info - /// - /// - void DisconnectSource(SourceListItem previousInfo) - { - if (previousInfo == null) return; - - // Hide whatever is showing - if (IsVisible) - { - if (CurrentSourcePageManager != null) - { - CurrentSourcePageManager.Hide(); - CurrentSourcePageManager = null; - } - } - - if (previousInfo == null) return; - var previousDev = previousInfo.SourceDevice; - - // device type interfaces - if (previousDev is ISetTopBoxControls) - (previousDev as ISetTopBoxControls).UnlinkButtons(TriList); - // common interfaces - if (previousDev is IChannel) - (previousDev as IChannel).UnlinkButtons(TriList); - if (previousDev is IColor) - (previousDev as IColor).UnlinkButtons(TriList); - if (previousDev is IDPad) - (previousDev as IDPad).UnlinkButtons(TriList); - if (previousDev is IDvr) - (previousDev as IDvr).UnlinkButtons(TriList); - if (previousDev is INumericKeypad) - (previousDev as INumericKeypad).UnlinkButtons(TriList); - if (previousDev is IHasPowerControl) - (previousDev as IHasPowerControl).UnlinkButtons(TriList); - if (previousDev is ITransport) - (previousDev as ITransport).UnlinkButtons(TriList); - //if (previousDev is IRadio) - // (previousDev as IRadio).UnlinkButtons(this); - } - - /// - /// Refreshes and shows the room's current source - /// - void RefreshSourceInfo() - { - var routeInfo = CurrentRoom.CurrentSourceInfo; - // This will show off popup too - if (this.IsVisible) - ShowCurrentSource(); - - if (routeInfo == null)// || !CurrentRoom.OnFeedback.BoolValue) - { - // Check for power off and insert "Room is off" - TriList.StringInput[UIStringJoin.CurrentSourceName].StringValue = "Room is off"; - TriList.StringInput[UIStringJoin.CurrentSourceIcon].StringValue = "Power"; - this.Hide(); - Parent.Show(); - return; - } - else if (CurrentRoom.CurrentSourceInfo != null) - { - TriList.StringInput[UIStringJoin.CurrentSourceName].StringValue = routeInfo.PreferredName; - TriList.StringInput[UIStringJoin.CurrentSourceIcon].StringValue = routeInfo.Icon; // defaults to "blank" - } - else - { - TriList.StringInput[UIStringJoin.CurrentSourceName].StringValue = "---"; - TriList.StringInput[UIStringJoin.CurrentSourceIcon].StringValue = "Blank"; - } - - // Connect controls - if (routeInfo.SourceDevice != null) - ConnectControlDeviceMethods(routeInfo.SourceDevice); - } - - /// - /// Attach the source to the buttons and things - /// - void ConnectControlDeviceMethods(Device dev) - { - if(dev is ISetTopBoxControls) - (dev as ISetTopBoxControls).LinkButtons(TriList); - if (dev is IChannel) - (dev as IChannel).LinkButtons(TriList); - if (dev is IColor) - (dev as IColor).LinkButtons(TriList); - if (dev is IDPad) - (dev as IDPad).LinkButtons(TriList); - if (dev is IDvr) - (dev as IDvr).LinkButtons(TriList); - if (dev is INumericKeypad) - (dev as INumericKeypad).LinkButtons(TriList); - if (dev is IHasPowerControl) - (dev as IHasPowerControl).LinkButtons(TriList); - if (dev is ITransport) - (dev as ITransport).LinkButtons(TriList); - //if (dev is IRadio) - // (dev as IRadio).LinkButtons(this); // +++++++++++++ Make part of this into page manager - - //if (dev is ICustomFunctions) - //{ - // var custBridge = (dev as ICustomFunctions).GetCustomBridge(); - // custBridge.Link(this.Remote); - } - - /// - /// Detaches the buttons and feedback from the room's current audio device - /// - void ClearAudioDeviceConnections() - { - TriList.ClearBoolSigAction(UIBoolJoin.VolumeUpPress); - TriList.ClearBoolSigAction(UIBoolJoin.VolumeDownPress); - TriList.ClearBoolSigAction(UIBoolJoin.Volume1ProgramMutePressAndFB); - - var fDev = CurrentRoom.CurrentVolumeControls as IBasicVolumeWithFeedback; - if (fDev != null) - { - TriList.ClearUShortSigAction(UIUshortJoin.VolumeSlider1Value); - fDev.VolumeLevelFeedback.UnlinkInputSig( - TriList.UShortInput[UIUshortJoin.VolumeSlider1Value]); - } - } - - /// - /// Attaches the buttons and feedback to the room's current audio device - /// - void RefreshAudioDeviceConnections() - { - var dev = CurrentRoom.CurrentVolumeControls; - if (dev != null) // connect buttons - { - TriList.SetBoolSigAction(UIBoolJoin.VolumeUpPress, VolumeUpPress); - TriList.SetBoolSigAction(UIBoolJoin.VolumeDownPress, VolumeDownPress); - TriList.SetSigFalseAction(UIBoolJoin.Volume1ProgramMutePressAndFB, dev.MuteToggle); - } - - var fbDev = dev as IBasicVolumeWithFeedback; - if (fbDev == null) // this should catch both IBasicVolume and IBasicVolumeWithFeeback - TriList.UShortInput[UIUshortJoin.VolumeSlider1Value].UShortValue = 0; - else - { - // slider - TriList.SetUShortSigAction(UIUshortJoin.VolumeSlider1Value, fbDev.SetVolume); - // feedbacks - fbDev.MuteFeedback.LinkInputSig(TriList.BooleanInput[UIBoolJoin.Volume1ProgramMutePressAndFB]); - fbDev.VolumeLevelFeedback.LinkInputSig( - TriList.UShortInput[UIUshortJoin.VolumeSlider1Value]); - } - } - - /// - /// Handler for when the room's volume control device changes - /// - void CurrentRoom_CurrentAudioDeviceChange(object sender, VolumeDeviceChangeEventArgs args) - { - if (args.Type == ChangeType.WillChange) - ClearAudioDeviceConnections(); - else // did change - RefreshAudioDeviceConnections(); - } - - /// - /// Handles source change - /// - void CurrentRoom_SourceInfoChange(SourceListItem info, ChangeType change) - { - if (change == ChangeType.WillChange) - DisconnectSource(info); - else - RefreshSourceInfo(); - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UIDrivers/EssentialsHuddle/EssentialsHuddleTechPageDriver.cs b/src/PepperDash.Essentials/UIDrivers/EssentialsHuddle/EssentialsHuddleTechPageDriver.cs deleted file mode 100644 index c07e0b1c..00000000 --- a/src/PepperDash.Essentials/UIDrivers/EssentialsHuddle/EssentialsHuddleTechPageDriver.cs +++ /dev/null @@ -1,329 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DeviceSupport; - -using PepperDash.Core; -using PepperDash.Essentials; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Core.SmartObjects; -using PepperDash.Essentials.Core.Touchpanels.Keyboards; -using PepperDash.Essentials.Devices.Common.Displays; -using PepperDash.Essentials.Devices.Displays; -using PepperDash.Essentials.Room.Config; -using DisplayBase = PepperDash.Essentials.Core.DisplayBase; -using TwoWayDisplayBase = PepperDash.Essentials.Core.TwoWayDisplayBase; - -namespace PepperDash.Essentials.UIDrivers -{ - public class EssentialsHuddleTechPageDriver : PanelDriverBase - { - /// - /// - /// - SmartObjectDynamicList MenuList; - /// - /// - /// - SubpageReferenceList StatusList; - /// - /// The list of display controls - /// - SubpageReferenceList DisplayList; - /// - /// References lines in the list against device instances - /// - Dictionary StatusListDeviceIndexes; - /// - /// - /// - JoinedSigInterlock PagesInterlock; - - /// - /// 1 - /// - public const uint JoinText = 1; - - CTimer PinAuthorizedTimer; - - EssentialsRoomTechConfig Config; - - StringBuilder PinEntryBuilder = new StringBuilder(4); - - bool IsAuthorized; - - SmartObjectNumeric PinKeypad; - - /// - /// - /// - /// - /// - public EssentialsHuddleTechPageDriver(BasicTriListWithSmartObject trilist, EssentialsRoomTechConfig config) - : base(trilist) - { - Config = config; - - PagesInterlock = new JoinedSigInterlock(trilist); - PagesInterlock.SetButDontShow(UIBoolJoin.TechSystemStatusVisible); - - trilist.SetSigFalseAction(UIBoolJoin.TechExitButton, Hide); - - MenuList = new SmartObjectDynamicList(trilist.SmartObjects[UISmartObjectJoin.TechMenuList], - true, 3100); - - MenuList.SetFeedback(1, true); // initial fb - ushort count = 0; - - MenuList.SetItemMainText(1, "System Status"); - MenuList.SetItemButtonAction(1, b => { - if (b) PagesInterlock.ShowInterlocked(UIBoolJoin.TechSystemStatusVisible); - MenuList.SetFeedback(1, true); - }); - - MenuList.SetItemMainText(2, "Display Controls"); - MenuList.SetItemButtonAction(2, b => { - if (b) PagesInterlock.ShowInterlocked(UIBoolJoin.TechDisplayControlsVisible); - MenuList.SetFeedback(2, true); - }); - - count = 2; - - // Don't show panel setup on iPad or xpanel - if (TriList is Crestron.SimplSharpPro.DeviceSupport.TswFt5Button) - { - count++; - MenuList.SetItemMainText(count, "Panel Setup"); - MenuList.SetItemButtonAction(count, b => - { - if (b) PagesInterlock.ShowInterlocked(UIBoolJoin.TechPanelSetupVisible); - MenuList.SetFeedback(count, true); - }); - } - - MenuList.Count = count; - BuildStatusList(); - BuildDisplayList(); - SetupPinModal(); - } - - /// - /// - /// - public override void Show() - { - // divert to PIN if we need auth - if (IsAuthorized) - { - // Cancel the auth timer so we don't deauth after coming back in - if (PinAuthorizedTimer != null) - PinAuthorizedTimer.Stop(); - - TriList.SetBool(UIBoolJoin.TechCommonItemsVisbible, true); - PagesInterlock.Show(); - base.Show(); - } - else - { - TriList.SetBool(UIBoolJoin.PinDialog4DigitVisible, true); - } - } - - /// - /// - /// - public override void Hide() - { - // Leave it authorized for 60 seconds. - if (IsAuthorized) - PinAuthorizedTimer = new CTimer(o => { - IsAuthorized = false; - PinAuthorizedTimer = null; - }, 60000); - TriList.SetBool(UIBoolJoin.TechCommonItemsVisbible, false); - PagesInterlock.Hide(); - base.Hide(); - } - - /// - /// Wire up the keypad and buttons - /// - void SetupPinModal() - { - TriList.SetSigFalseAction(UIBoolJoin.PinDialogCancelPress, CancelPinDialog); - PinKeypad = new SmartObjectNumeric(TriList.SmartObjects[UISmartObjectJoin.TechPinDialogKeypad], true); - PinKeypad.Digit0.UserObject = new Action(b => { if (b)DialPinDigit('0'); }); - PinKeypad.Digit1.UserObject = new Action(b => { if (b)DialPinDigit('1'); }); - PinKeypad.Digit2.UserObject = new Action(b => { if (b)DialPinDigit('2'); }); - PinKeypad.Digit3.UserObject = new Action(b => { if (b)DialPinDigit('3'); }); - PinKeypad.Digit4.UserObject = new Action(b => { if (b)DialPinDigit('4'); }); - PinKeypad.Digit5.UserObject = new Action(b => { if (b)DialPinDigit('5'); }); - PinKeypad.Digit6.UserObject = new Action(b => { if (b)DialPinDigit('6'); }); - PinKeypad.Digit7.UserObject = new Action(b => { if (b)DialPinDigit('7'); }); - PinKeypad.Digit8.UserObject = new Action(b => { if (b)DialPinDigit('8'); }); - PinKeypad.Digit9.UserObject = new Action(b => { if (b)DialPinDigit('9'); }); - } - - /// - /// - /// - /// - void DialPinDigit(char d) - { - PinEntryBuilder.Append(d); - var len = PinEntryBuilder.Length; - SetPinDotsFeedback(len); - - // check it! - if (len == 4) - { - if (Config.Password == PinEntryBuilder.ToString()) - { - IsAuthorized = true; - SetPinDotsFeedback(0); - TriList.SetBool(UIBoolJoin.PinDialog4DigitVisible, false); - Show(); - } - else - { - SetPinDotsFeedback(0); - TriList.SetBool(UIBoolJoin.PinDialogErrorVisible, true); - new CTimer(o => - { - TriList.SetBool(UIBoolJoin.PinDialogErrorVisible, false); - }, 1500); - } - - PinEntryBuilder.Remove(0, len); // clear it either way - } - } - - /// - /// Draws the dots as pin is entered - /// - /// - void SetPinDotsFeedback(int len) - { - TriList.SetBool(UIBoolJoin.PinDialogDot1, len >= 1); - TriList.SetBool(UIBoolJoin.PinDialogDot2, len >= 2); - TriList.SetBool(UIBoolJoin.PinDialogDot3, len >= 3); - TriList.SetBool(UIBoolJoin.PinDialogDot4, len == 4); - - } - - /// - /// Does what it says - /// - void CancelPinDialog() - { - PinEntryBuilder.Remove(0, PinEntryBuilder.Length); - TriList.SetBool(UIBoolJoin.PinDialog4DigitVisible, false); - } - - - /// - /// - /// - void BuildStatusList() - { - StatusList = new SubpageReferenceList(TriList, UISmartObjectJoin.TechStatusList, 3, 3, 3); - StatusListDeviceIndexes = new Dictionary(); - uint i = 0; - foreach (var d in DeviceManager.AllDevices) - { - // make sure it is both ICommunicationMonitor and a Device - var sd = d as ICommunicationMonitor; - if (sd == null) - continue; - var dd = sd as Device; - if(dd == null) - continue; - i++; - StatusList.StringInputSig(i, 1).StringValue = dd.Name; - StatusList.UShortInputSig(i, 1).UShortValue = (ushort)sd.CommunicationMonitor.Status; - StatusListDeviceIndexes.Add(sd, i); - sd.CommunicationMonitor.StatusChange += CommunicationMonitor_StatusChange ; - } - StatusList.Count = (ushort)i; - } - - /// - /// Builds the list of display controls - /// - void BuildDisplayList() - { - DisplayList = new SubpageReferenceList(TriList, UISmartObjectJoin.TechDisplayControlsList, 10, 3, 3); - - var devKeys = ConfigReader.ConfigObject.Devices.Where(d => - d.Group.Equals("display", StringComparison.OrdinalIgnoreCase) - || d.Group.Equals("projector", StringComparison.OrdinalIgnoreCase)) - .Select(dd => dd.Key); - var disps = DeviceManager.AllDevices.Where(d => - devKeys.Contains(d.Key)); - ushort i = 0; - foreach (var disp in disps) - { - var display = disp as DisplayBase; - if (display != null) - { - i++; - DisplayList.StringInputSig(i, 1).StringValue = display.Name; - DisplayList.GetBoolFeedbackSig(i, 1).SetSigFalseAction(display.PowerOn); - DisplayList.GetBoolFeedbackSig(i, 2).SetSigFalseAction(display.PowerOff); - if (display is TwoWayDisplayBase) - { - var powerOnSig = DisplayList.BoolInputSig(i, 1); - (display as TwoWayDisplayBase).PowerIsOnFeedback.LinkInputSig(powerOnSig); - - var powerOffSig = DisplayList.BoolInputSig(1, 2); - (display as TwoWayDisplayBase).PowerIsOnFeedback.LinkComplementInputSig(powerOffSig); - } - DisplayList.GetBoolFeedbackSig(i, 3).SetSigFalseAction(() => - { if (display is IInputHdmi1) (display as IInputHdmi1).InputHdmi1(); }); - DisplayList.GetBoolFeedbackSig(i, 4).SetSigFalseAction(() => - { if (display is IInputHdmi2) (display as IInputHdmi2).InputHdmi2(); }); - DisplayList.GetBoolFeedbackSig(i, 5).SetSigFalseAction(() => - { if (display is IInputHdmi3) (display as IInputHdmi3).InputHdmi3(); }); - //DisplayList.GetBoolFeedbackSig(i, 6).SetSigFalseAction(() => - //{ if (display is IInputHdmi4) (display as IInputHdmi4).InputHdmi4(); }); - DisplayList.GetBoolFeedbackSig(i, 6).SetSigFalseAction(() => - { if (display is IInputDisplayPort1) (display as IInputDisplayPort1).InputDisplayPort1(); }); - - - // Figure out some way to provide current input feedback - if (display is TwoWayDisplayBase) - { - (display as TwoWayDisplayBase).CurrentInputFeedback.OutputChange += CurrentInputFeedback_OutputChange; - } - } - - - } - - DisplayList.Count = i; - } - - - void CurrentInputFeedback_OutputChange(object sender, EventArgs e) - { - - } - - /// - /// - /// - void CommunicationMonitor_StatusChange(object sender, MonitorStatusChangeEventArgs e) - { - var c = sender as ICommunicationMonitor; - if (c != null && StatusListDeviceIndexes.ContainsKey(c)) - { - var i = StatusListDeviceIndexes[c]; - StatusList.UShortInputSig(i, 1).UShortValue = (ushort)e.Status; - } - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddlePresentationUiDriver.cs b/src/PepperDash.Essentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddlePresentationUiDriver.cs deleted file mode 100644 index c573310f..00000000 --- a/src/PepperDash.Essentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddlePresentationUiDriver.cs +++ /dev/null @@ -1,49 +0,0 @@ -//using System; -//using System.Linq; -//using System.Collections.Generic; -//using Crestron.SimplSharp; -//using Crestron.SimplSharpPro; -//using Crestron.SimplSharpPro.DeviceSupport; -//using Crestron.SimplSharpPro.UI; - -//using PepperDash.Core; -//using PepperDash.Essentials.Core; -//using PepperDash.Essentials.Core.SmartObjects; -//using PepperDash.Essentials.Core.PageManagers; -//using PepperDash.Essentials.Room.Config; - -//namespace PepperDash.Essentials -//{ -// public class EssentialsHuddleVtc1PresentationUiDriver : PanelDriverBase -// { -// /// -// /// -// /// -// EssentialsHuddleVtc1Room CurrentRoom; - - -// public EssentialsHuddleVtc1PresentationUiDriver(BasicTriListWithSmartObject triList, -// EssentialsHuddleVtc1Room room) -// : base(triList) -// { -// CurrentRoom = room; -// } - -// /// -// /// Smart Object 3200 -// /// -// SubpageReferenceList SourceStagingSrl; - -// /// -// /// The AV page mangagers that have been used, to keep them alive for later -// /// -// Dictionary PageManagers = new Dictionary(); - -// /// -// /// Current page manager running for a source -// /// -// PageManager CurrentSourcePageManager; - - -// } -//} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs b/src/PepperDash.Essentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs deleted file mode 100644 index 78aeb311..00000000 --- a/src/PepperDash.Essentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs +++ /dev/null @@ -1,1652 +0,0 @@ -using System; -using System.Linq; -using System.Collections.Generic; -using System.Globalization; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.UI; - -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Core.DeviceTypeInterfaces; -using PepperDash.Essentials.Core.SmartObjects; -using PepperDash.Essentials.Core.PageManagers; -using PepperDash.Essentials.Room.Config; -using PepperDash.Essentials.Devices.Common.Codec; -using PepperDash.Essentials.Devices.Common.VideoCodec; -using PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces; - -namespace PepperDash.Essentials -{ - /// - /// - /// - public class EssentialsHuddleVtc1PanelAvFunctionsDriver : PanelDriverBase, IAVWithVCDriver - { - CrestronTouchpanelPropertiesConfig Config; - - public enum UiDisplayMode - { - Presentation, AudioSetup, Call, Start - } - - public uint StartPageVisibleJoin { get; private set; } - - /// - /// Whether volume ramping from this panel will show the volume - /// gauge popup. - /// - public bool ShowVolumeGauge { get; set; } - - /// - /// - /// - public uint PowerOffTimeout { get; set; } - - /// - /// - /// - public string DefaultRoomKey { get; set; } - - - /// - /// - /// - public IEssentialsHuddleVtc1Room CurrentRoom - { - get { return _CurrentRoom; } - set - { - SetCurrentRoom(value); - } - } - IEssentialsHuddleVtc1Room _CurrentRoom; - - /// - /// For hitting feedbacks - /// - BoolInputSig CallButtonSig; - BoolInputSig ShareButtonSig; - BoolInputSig EndMeetingButtonSig; - - BoolFeedback CallSharingInfoVisibleFeedback; - - /// - /// The parent driver for this - /// - public PanelDriverBase Parent { get; private set; } - - /// - /// All children attached to this driver. For hiding and showing as a group. - /// - List ChildDrivers = new List(); - - List CurrentDisplayModeSigsInUse = new List(); - - //// Important smart objects - - /// - /// Smart Object 3200 - /// - SubpageReferenceList SourceStagingSrl; - - /// - /// Smart Object 15022 - /// - SubpageReferenceList ActivityFooterSrl; - - /// - /// - /// - public SubpageReferenceList MeetingOrContactMethodModalSrl { get; set; } - - public uint CallListOrMeetingInfoPopoverVisibilityJoin { get; private set; } - - - /// - /// The list of buttons on the header. Managed with visibility only - /// - //SmartObjectHeaderButtonList HeaderButtonsList; - - /// - /// The AV page mangagers that have been used, to keep them alive for later - /// - Dictionary PageManagers = new Dictionary(); - - /// - /// Current page manager running for a source - /// - PageManager CurrentSourcePageManager; - - /// - /// Will auto-timeout a power off - /// - CTimer PowerOffTimer; - - /// - /// - /// - ModalDialog PowerDownModal; - - /// - /// - /// - //ModalDialog WarmingCoolingModal; - - /// - /// Represents - /// - public JoinedSigInterlock PopupInterlock { get; private set; } - - /// - /// Interlock for various source, camera, call control bars. The bar above the activity footer. This is also - /// used to show start page - /// - JoinedSigInterlock StagingBarInterlock; - - /// - /// Interlocks the various call-related subpages - /// - JoinedSigInterlock CallPagesInterlock; - - /// - /// The Video codec driver - /// - PepperDash.Essentials.UIDrivers.VC.EssentialsVideoCodecUiDriver VCDriver; - - /// - /// The driver for the tech page. Lazy getter for memory usage - /// - PepperDash.Essentials.UIDrivers.EssentialsHuddleTechPageDriver TechDriver - { - get - { - if (_TechDriver == null) - _TechDriver = new PepperDash.Essentials.UIDrivers.EssentialsHuddleTechPageDriver(TriList, CurrentRoom.PropertiesConfig.Tech); - return _TechDriver; - } - } - PepperDash.Essentials.UIDrivers.EssentialsHuddleTechPageDriver _TechDriver; - - /// - /// Controls timeout of notification ribbon timer - /// - CTimer RibbonTimer; - - /// - /// The keyboard - /// - public PepperDash.Essentials.Core.Touchpanels.Keyboards.HabaneroKeyboardController Keyboard { get; private set; } - - - private UiDisplayMode _currentMode; - - private bool _isZoomRoomWithNoExternalSources - { - get - { - return CurrentRoom.VideoCodec is Essentials.Devices.Common.VideoCodec.ZoomRoom.ZoomRoom && _sourceListCount <= 1; - } - } - - private uint _sourceListCount; - - /// - /// The mode showing. Presentation or call. - /// - UiDisplayMode CurrentMode - { - get - { - return _currentMode; - } - set - { - if (value != _currentMode) - { - _currentMode = value; - - SetActivityFooterFeedbacks(); - } - } - } - - CTimer NextMeetingTimer; - - /// - /// Tracks the last meeting that was cancelled - /// - string LastMeetingDismissedId; - - /// - /// Constructor - /// - public EssentialsHuddleVtc1PanelAvFunctionsDriver(PanelDriverBase parent, CrestronTouchpanelPropertiesConfig config) - : base(parent.TriList) - { - Config = config; - Parent = parent; - - PopupInterlock = new JoinedSigInterlock(TriList); - StagingBarInterlock = new JoinedSigInterlock(TriList); - CallPagesInterlock = new JoinedSigInterlock(TriList); - - SourceStagingSrl = new SubpageReferenceList(TriList, UISmartObjectJoin.SourceStagingSRL, 3, 3, 3); - - ActivityFooterSrl = new SubpageReferenceList(TriList, UISmartObjectJoin.ActivityFooterSRL, 3, 3, 3); - CallButtonSig = ActivityFooterSrl.BoolInputSig(2, 1); - ShareButtonSig = ActivityFooterSrl.BoolInputSig(1, 1); - EndMeetingButtonSig = ActivityFooterSrl.BoolInputSig(3, 1); - - MeetingOrContactMethodModalSrl = new SubpageReferenceList(TriList, UISmartObjectJoin.MeetingListSRL, 3, 3, 5); - - CurrentMode = UiDisplayMode.Start; - - // buttons are added in SetCurrentRoom - //HeaderButtonsList = new SmartObjectHeaderButtonList(TriList.SmartObjects[UISmartObjectJoin.HeaderButtonList]); - - SetupActivityFooterWhenRoomOff(); - - ShowVolumeGauge = true; - Keyboard = new PepperDash.Essentials.Core.Touchpanels.Keyboards.HabaneroKeyboardController(TriList); - } - - /// - /// Add a video codec driver to this - /// - /// - public void SetVideoCodecDriver(PepperDash.Essentials.UIDrivers.VC.EssentialsVideoCodecUiDriver vcd) - { - VCDriver = vcd; - } - - /// - /// - /// - public override void Show() - { - if (CurrentRoom == null) - { - Debug.Console(1, "ERROR: AVUIFunctionsDriver, Cannot show. No room assigned"); - return; - } - - var roomConf = CurrentRoom.PropertiesConfig; - - if (Config.HeaderStyle.ToLower() == CrestronTouchpanelPropertiesConfig.Habanero) - { - TriList.SetSigFalseAction(UIBoolJoin.HeaderRoomButtonPress, () => - { - if (CurrentRoom.IsMobileControlEnabled) - { - Debug.Console(1, "Showing Mobile Control Header Info"); - PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.RoomHeaderInfoMCPageVisible); - } - else - { - Debug.Console(1, "Showing Non Mobile Control Header Info"); - PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.RoomHeaderInfoPageVisible); - } - }); - } - else if (Config.HeaderStyle.ToLower() == CrestronTouchpanelPropertiesConfig.Verbose) - { - TriList.SetSigFalseAction(UIBoolJoin.HeaderRoomButtonPress, () => - { - if (CurrentRoom.IsMobileControlEnabled) - { - Debug.Console(1, "Showing Mobile Control Header Info"); - PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.RoomHeaderInfoMCPageVisible); - } - else - { - Debug.Console(1, "Showing Non Mobile Control Header Info"); - PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.RoomHeaderInfoPageVisible); - } - }); - } - - TriList.SetBool(UIBoolJoin.DateAndTimeVisible, Config.ShowDate && Config.ShowTime); - TriList.SetBool(UIBoolJoin.DateOnlyVisible, Config.ShowDate && !Config.ShowTime); - TriList.SetBool(UIBoolJoin.TimeOnlyVisible, !Config.ShowDate && Config.ShowTime); - - TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true); - - TriList.SetBool(UIBoolJoin.ActivityFooterVisible, true); - - // Privacy mute button - TriList.SetSigFalseAction(UIBoolJoin.Volume1SpeechMutePressAndFB, CurrentRoom.PrivacyModeToggle); - CurrentRoom.PrivacyModeIsOnFeedback.LinkInputSig(TriList.BooleanInput[UIBoolJoin.Volume1SpeechMutePressAndFB]); - - // Default to showing rooms/sources now. - if (CurrentRoom.OnFeedback.BoolValue) - { - TriList.SetBool(UIBoolJoin.TapToBeginVisible, false); - SetupActivityFooterWhenRoomOn(); - } - else - { - TriList.SetBool(StartPageVisibleJoin, true); - TriList.SetBool(UIBoolJoin.TapToBeginVisible, true); - SetupActivityFooterWhenRoomOff(); - } - ShowCurrentDisplayModeSigsInUse(); - - // *** Header Buttons *** - - // Generic "close" button for popup modals - TriList.SetSigFalseAction(UIBoolJoin.InterlockedModalClosePress, PopupInterlock.HideAndClear); - - // Volume related things - TriList.SetSigFalseAction(UIBoolJoin.VolumeDefaultPress, () => CurrentRoom.SetDefaultLevels()); - TriList.SetString(UIStringJoin.AdvancedVolumeSlider1Text, "Room"); - - //if (TriList is CrestronApp) - // TriList.BooleanInput[UIBoolJoin.GearButtonVisible].BoolValue = false; - //else - // TriList.BooleanInput[UIBoolJoin.GearButtonVisible].BoolValue = true; - - // power-related functions - // Note: some of these are not directly-related to the huddle space UI, but are held over - // in case - TriList.SetSigFalseAction(UIBoolJoin.ShowPowerOffPress, EndMeetingPress); - - TriList.SetSigFalseAction(UIBoolJoin.DisplayPowerTogglePress, () => - { - if (CurrentRoom != null && CurrentRoom.DefaultDisplay != null && CurrentRoom.DefaultDisplay is IHasPowerControl) - (CurrentRoom.DefaultDisplay as IHasPowerControl).PowerToggle(); - }); - - SetupNextMeetingTimer(); - - base.Show(); - } - - /// - /// Allows PopupInterlock to be toggled if the calls list is already visible, or if the codec is in a call - /// - public void ShowActiveCallsListOrMeetingInfo() - { - TriList.SetBool(UIBoolJoin.CallEndAllConfirmVisible, true); - - - if(PopupInterlock.CurrentJoin == CallListOrMeetingInfoPopoverVisibilityJoin) - PopupInterlock.ShowInterlockedWithToggle(CallListOrMeetingInfoPopoverVisibilityJoin); - else - { - if(CurrentRoom.VideoCodec.IsInCall) - PopupInterlock.ShowInterlockedWithToggle(CallListOrMeetingInfoPopoverVisibilityJoin); - } - } - - /// - /// - /// - void ShowLogo() - { - if (CurrentRoom.LogoUrlLightBkgnd == null) - { - TriList.SetBool(UIBoolJoin.LogoDefaultVisible, true); - TriList.SetBool(UIBoolJoin.LogoUrlVisible, false); - } - else - { - TriList.SetBool(UIBoolJoin.LogoDefaultVisible, false); - TriList.SetBool(UIBoolJoin.LogoUrlVisible, true); - TriList.SetString(UIStringJoin.LogoUrlLightBkgnd, _CurrentRoom.LogoUrlLightBkgnd); - TriList.SetString(UIStringJoin.LogoUrlDarkBkgnd, _CurrentRoom.LogoUrlDarkBkgnd); - } - } - - /// - /// - /// - void HideLogo() - { - TriList.SetBool(UIBoolJoin.LogoDefaultVisible, false); - TriList.SetBool(UIBoolJoin.LogoUrlVisible, false); - } - - /// - /// - /// - public override void Hide() - { - HideAndClearCurrentDisplayModeSigsInUse(); - TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, false); - TriList.BooleanInput[UIBoolJoin.ActivityFooterVisible].BoolValue = false; - TriList.BooleanInput[StartPageVisibleJoin].BoolValue = false; - TriList.BooleanInput[UIBoolJoin.TapToBeginVisible].BoolValue = false; - TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = false; - if (NextMeetingTimer != null) - NextMeetingTimer.Stop(); - HideNextMeetingPopup(); - base.Hide(); - } - - /// - /// Reveals a message on the notification ribbon until cleared - /// - /// Text to display - /// Time in ms to display. 0 to keep on screen - public void ShowNotificationRibbon(string message, int timeout) - { - TriList.SetString(UIStringJoin.NotificationRibbonText, message); - TriList.SetBool(UIBoolJoin.NotificationRibbonVisible, true); - if (timeout > 0) - { - if (RibbonTimer != null) - RibbonTimer.Stop(); - RibbonTimer = new CTimer(o => { - TriList.SetBool(UIBoolJoin.NotificationRibbonVisible, false); - RibbonTimer = null; - }, timeout); - } - } - - /// - /// Hides the notification ribbon - /// - public void HideNotificationRibbon() - { - TriList.SetBool(UIBoolJoin.NotificationRibbonVisible, false); - if (RibbonTimer != null) - { - RibbonTimer.Stop(); - RibbonTimer = null; - } - } - - void SetupNextMeetingTimer() - { - var ss = CurrentRoom.ScheduleSource; - if (ss != null) - { - NextMeetingTimer = new CTimer(o => ShowNextMeetingTimerCallback(), null, 0, 60000); - } - } - - /// - /// - /// - void ShowNextMeetingTimerCallback() - { - //Update calendar for Zoom. Zoom doesn't automatically update when meetings are in the past - if (_isZoomRoomWithNoExternalSources) - { - CurrentRoom.ScheduleSource.GetSchedule(); - } - - // Every 60 seconds, refresh the calendar - RefreshMeetingsList(); - // check meetings list for the closest, joinable meeting - var ss = CurrentRoom.ScheduleSource; - var meetings = ss.CodecSchedule.Meetings; - - if (meetings.Count <= 0) - { - return; - } - // If the room is off pester the user - // If the room is on, and the meeting is joinable - // and the LastMeetingDismissed != this meeting - - var lastMeetingDismissed = meetings.FirstOrDefault(m => m.Id == LastMeetingDismissedId); - //Debug.Console(0, "*#* Room on: {0}, lastMeetingDismissedId: {1} {2} *#*", - // CurrentRoom.OnFeedback.BoolValue, - // LastMeetingDismissedId, - // lastMeetingDismissed != null ? lastMeetingDismissed.StartTime.ToString("t", Global.Culture) : ""); - - var meeting = meetings.LastOrDefault(m => m.Joinable); - if (CurrentRoom.OnFeedback.BoolValue - && lastMeetingDismissed == meeting) - { - // meeting no longer joinable, hide popup - if(meeting == null) - HideNextMeetingPopup(); - - return; - } - - LastMeetingDismissedId = null; - // Clear the popup when we run out of meetings - if (meeting == null) - { - HideNextMeetingPopup(); - } - else - { - - - TriList.SetString(UIStringJoin.MeetingsOrContactMethodListTitleText, "Upcoming meeting"); - TriList.SetString(UIStringJoin.NextMeetingStartTimeText, meeting.StartTime.ToString("t", Global.Culture)); - TriList.SetString(UIStringJoin.NextMeetingEndTimeText, meeting.EndTime.ToString("t", Global.Culture)); - TriList.SetString(UIStringJoin.NextMeetingTitleText, meeting.Title); - TriList.SetString(UIStringJoin.NextMeetingNameText, meeting.Organizer); - TriList.SetString(UIStringJoin.NextMeetingButtonLabel, "Join"); - TriList.SetSigFalseAction(UIBoolJoin.NextMeetingJoinPress, () => - { - HideNextMeetingPopup(); - PopupInterlock.Hide(); - RoomOnAndDialMeeting(meeting); - }); - TriList.SetString(UIStringJoin.NextMeetingSecondaryButtonLabel, "Show Schedule"); - TriList.SetSigFalseAction(UIBoolJoin.CalendarHeaderButtonPress, () => - { - HideNextMeetingPopup(); - //CalendarPress(); - RefreshMeetingsList(); - PopupInterlock.ShowInterlocked(UIBoolJoin.MeetingsOrContacMethodsListVisible); - }); - var indexOfNext = meetings.IndexOf(meeting) + 1; - - // indexOf = 3, 4 meetings : - if (indexOfNext < meetings.Count) - TriList.SetString(UIStringJoin.NextMeetingFollowingMeetingText, - meetings[indexOfNext].StartTime.ToString("t", Global.Culture)); - else - TriList.SetString(UIStringJoin.NextMeetingFollowingMeetingText, "No more meetings today"); - - TriList.SetSigFalseAction(UIBoolJoin.NextMeetingModalClosePress, () => - { - // Mark the meeting to not re-harass the user - if(CurrentRoom.OnFeedback.BoolValue) - LastMeetingDismissedId = meeting.Id; - HideNextMeetingPopup(); - }); - - TriList.SetBool(UIBoolJoin.NextMeetingModalVisible, true); - } - } - - /// - /// - /// - void HideNextMeetingPopup() - { - TriList.SetBool(UIBoolJoin.NextMeetingModalVisible, false); - - } - - /// - /// Calendar should only be visible when it's supposed to - /// - public void CalendarPress() - { - //RefreshMeetingsList(); // List should be up-to-date - PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.MeetingsOrContacMethodsListVisible); - } - - /// - /// Dials a meeting after turning on room (if necessary) - /// - void RoomOnAndDialMeeting(Meeting meeting) - { - Debug.Console(1, "[RoomOnAndDialMeeting] Joining meeting [{0}]", meeting); - Action dialAction = () => - { - var d = CurrentRoom.ScheduleSource as VideoCodecBase; - if (d != null) - { - Debug.Console(1, - "[RoomOnAndDialMeeting] [dialAction] Sending command to codec to join meeting {0}", meeting); - d.Dial(meeting); - LastMeetingDismissedId = meeting.Id; // To prevent prompts for already-joined call - } - }; - if (CurrentRoom.OnFeedback.BoolValue) - { - Debug.Console(1, "[RoomOnAndDialMeeting] Room is on."); - dialAction(); - } - else - { - Debug.Console(1, "RoomOnAndDialMeeting] Room is off or warming. Registering for Warming Feedback"); - // Rig a one-time handler to catch when the room is warmed and then dial call - EventHandler oneTimeHandler = null; - oneTimeHandler = (o, a) => - { - if (!CurrentRoom.IsWarmingUpFeedback.BoolValue) - { - CurrentRoom.IsWarmingUpFeedback.OutputChange -= oneTimeHandler; - dialAction(); - } - }; - CurrentRoom.IsWarmingUpFeedback.OutputChange += oneTimeHandler; - ActivityCallButtonPressed(); - } - } - - /// - /// Reveals the tech page and puts away anything that's in the way. - /// - public void ShowTech() - { - PopupInterlock.HideAndClear(); - TechDriver.Show(); - } - - /// - /// When the room is off, set the footer SRL - /// - void SetupActivityFooterWhenRoomOff() - { - ActivityFooterSrl.Clear(); - ActivityFooterSrl.AddItem(new SubpageReferenceListActivityItem(1, ActivityFooterSrl, 0, - b => { if (!b) ActivityShareButtonPressed(); })); - ActivityFooterSrl.AddItem(new SubpageReferenceListActivityItem(2, ActivityFooterSrl, 3, - b => { if (!b) ActivityCallButtonPressed(); })); - ActivityFooterSrl.Count = 2; - TriList.SetUshort(UIUshortJoin.PresentationStagingCaretMode, 1); // right one slot - TriList.SetUshort(UIUshortJoin.CallStagingCaretMode, 5); // left one slot - } - - /// - /// Sets up the footer SRL for when the room is on - /// - void SetupActivityFooterWhenRoomOn() - { - ActivityFooterSrl.Clear(); - ActivityFooterSrl.AddItem(new SubpageReferenceListActivityItem(1, ActivityFooterSrl, 0, - b => { if (!b) ActivityShareButtonPressed(); })); - ActivityFooterSrl.AddItem(new SubpageReferenceListActivityItem(2, ActivityFooterSrl, 3, - b => { if (!b) ActivityCallButtonPressed(); })); - ActivityFooterSrl.AddItem(new SubpageReferenceListActivityItem(3, ActivityFooterSrl, 4, - b => { if (!b) EndMeetingPress(); })); - ActivityFooterSrl.Count = 3; - TriList.SetUshort(UIUshortJoin.PresentationStagingCaretMode, 2); // center - TriList.SetUshort(UIUshortJoin.CallStagingCaretMode, 0); // left -2 - } - - /// - /// Single point call for setting the feedbacks on the activity buttons - /// - void SetActivityFooterFeedbacks() - { - if (CurrentRoom != null) - { - var startMode = CurrentMode == UiDisplayMode.Start; - var presentationMode = CurrentMode == UiDisplayMode.Presentation; - var callMode = CurrentMode == UiDisplayMode.Call; - - TriList.SetBool(StartPageVisibleJoin, startMode ? true : false); - - if (presentationMode &&_isZoomRoomWithNoExternalSources) - { - // For now, if this is a Zoom Room and there are no shareable sources just display the informational subpage - TriList.SetBool(UIBoolJoin.SourceStagingBarVisible, false); - TriList.SetBool(UIBoolJoin.ZoomRoomContentSharingVisible, true); - } - else - { - // Otherwise, show the staging bar - TriList.SetBool(UIBoolJoin.ZoomRoomContentSharingVisible, false); - TriList.SetBool(UIBoolJoin.SourceStagingBarVisible, presentationMode ? true : false); - - } - if (!presentationMode) - { - TriList.SetBool(UIBoolJoin.ZoomRoomContentSharingVisible, false); - TriList.SetBool(UIBoolJoin.SelectASourceVisible, false); - } - - CallButtonSig.BoolValue = callMode - && CurrentRoom.ShutdownType == eShutdownType.None; - ShareButtonSig.BoolValue = presentationMode - && CurrentRoom.ShutdownType == eShutdownType.None; - EndMeetingButtonSig.BoolValue = CurrentRoom.ShutdownType != eShutdownType.None; - } - } - - /// - /// - /// - public void ActivityCallButtonPressed() - { - if (VCDriver.IsVisible) - return; - HideLogo(); - HideNextMeetingPopup(); - //TriList.SetBool(StartPageVisibleJoin, false); - //TriList.SetBool(UIBoolJoin.SourceStagingBarVisible, false); - //TriList.SetBool(UIBoolJoin.SelectASourceVisible, false); - if (CurrentSourcePageManager != null) - CurrentSourcePageManager.Hide(); - PowerOnFromCall(); - CurrentMode = UiDisplayMode.Call; - VCDriver.Show(); - } - - /// - /// Attached to activity list share button - /// - void ActivityShareButtonPressed() - { - SetupSourceList(); - if (VCDriver.IsVisible) - VCDriver.Hide(); - HideNextMeetingPopup(); - - - if (_isZoomRoomWithNoExternalSources) - { - if (!CurrentRoom.OnFeedback.BoolValue) - { - CurrentRoom.RunDefaultPresentRoute(); - } - // For now, if this is a Zoom Room and there are no shareable sources just display the informational subpage - TriList.SetBool(UIBoolJoin.ZoomRoomContentSharingVisible, true); - - var presentationMeetingCodec = CurrentRoom.VideoCodec as IHasPresentationOnlyMeeting; - var farEndContentStatusCodec = CurrentRoom.VideoCodec as IHasFarEndContentStatus; - var receivingContent = false; - - if (farEndContentStatusCodec != null) - { - receivingContent = farEndContentStatusCodec.ReceivingContent.BoolValue; - } - - if (presentationMeetingCodec != null && !CurrentRoom.VideoCodec.IsInCall) - { - presentationMeetingCodec.StartSharingOnlyMeeting(eSharingMeetingMode.Laptop); - } - else if (CurrentRoom.VideoCodec.IsInCall && !CurrentRoom.VideoCodec.SharingContentIsOnFeedback.BoolValue && - !receivingContent) - { - CurrentRoom.VideoCodec.StartSharing(); - } - - if (CurrentSourcePageManager != null) - CurrentSourcePageManager.Hide(); - } - else - { - // Run default source when room is off and share is pressed - if (!CurrentRoom.OnFeedback.BoolValue) - { - // If there's no default, show UI elements - if (!(CurrentRoom as IRunDefaultPresentRoute).RunDefaultPresentRoute()) - TriList.SetBool(UIBoolJoin.SelectASourceVisible, true); - } - else // room is on show what's active or select a source if nothing is yet active - { - if (CurrentRoom.CurrentSourceInfo == null || - (CurrentRoom.VideoCodec != null && - CurrentRoom.CurrentSourceInfo.SourceDevice.Key == CurrentRoom.VideoCodec.OsdSource.Key)) - TriList.SetBool(UIBoolJoin.SelectASourceVisible, true); - else if (CurrentSourcePageManager != null) - { - TriList.SetBool(UIBoolJoin.SelectASourceVisible, false); - CurrentSourcePageManager.Show(); - } - } - SetupSourceList(); - } - CurrentMode = UiDisplayMode.Presentation; - } - - /// - /// Powers up the system to the codec route, if not already on. - /// - void PowerOnFromCall() - { - if (!CurrentRoom.OnFeedback.BoolValue) - { - CurrentRoom.RunDefaultCallRoute(); - } - } - - /// - /// Shows all sigs that are in CurrentDisplayModeSigsInUse - /// - void ShowCurrentDisplayModeSigsInUse() - { - foreach (var sig in CurrentDisplayModeSigsInUse) - sig.BoolValue = true; - } - - /// - /// Hides all CurrentDisplayModeSigsInUse sigs and clears the array - /// - void HideAndClearCurrentDisplayModeSigsInUse() - { - foreach (var sig in CurrentDisplayModeSigsInUse) - sig.BoolValue = false; - CurrentDisplayModeSigsInUse.Clear(); - } - - - /// - /// Loads the appropriate Sigs into CurrentDisplayModeSigsInUse and shows them - /// - void ShowCurrentSource() - { - if (CurrentRoom.CurrentSourceInfo == null || _isZoomRoomWithNoExternalSources) - return; - - CurrentMode = UiDisplayMode.Presentation; - - if (CurrentRoom.CurrentSourceInfo.SourceDevice == null) - { - TriList.SetBool(UIBoolJoin.SelectASourceVisible, true); - return; - } - - var uiDev = CurrentRoom.CurrentSourceInfo.SourceDevice as IUiDisplayInfo; - PageManager pm = null; - // If we need a page manager, get an appropriate one - if (uiDev != null) - { - TriList.SetBool(UIBoolJoin.SelectASourceVisible, false); - // Got an existing page manager, get it - if (PageManagers.ContainsKey(uiDev)) - pm = PageManagers[uiDev]; - // Otherwise make an apporiate one - else if (uiDev is ISetTopBoxControls) - pm = new SetTopBoxThreePanelPageManager(uiDev as ISetTopBoxControls, TriList); - else if (uiDev is IDiscPlayerControls) - pm = new DiscPlayerMediumPageManager(uiDev as IDiscPlayerControls, TriList); - else - pm = new DefaultPageManager(uiDev, TriList); - PageManagers[uiDev] = pm; - CurrentSourcePageManager = pm; - pm.Show(); - } - } - - /// - /// Called from button presses on source, where We can assume we want - /// to change to the proper screen. - /// - /// The key name of the route to run - void UiSelectSource(string key) - { - // Run the route and when it calls back, show the source - CurrentRoom.RunRouteAction(key); - } - - /// - /// - /// - public void EndMeetingPress() - { - if (!CurrentRoom.OnFeedback.BoolValue - || CurrentRoom.ShutdownPromptTimer.IsRunningFeedback.BoolValue) - return; - - CurrentRoom.StartShutdown(eShutdownType.Manual); - } - - /// - /// Puts away modals and things that might be up when call comes in - /// - public void PrepareForCodecIncomingCall() - { - if (PowerDownModal != null && PowerDownModal.ModalIsVisible) - PowerDownModal.CancelDialog(); - PopupInterlock.Hide(); - } - - /// - /// - /// - /// - /// - void ShutdownPromptTimer_HasStarted(object sender, EventArgs e) - { - // Do we need to check where the UI is? No? - var timer = CurrentRoom.ShutdownPromptTimer; - SetActivityFooterFeedbacks(); - - if (CurrentRoom.ShutdownType == eShutdownType.Manual || CurrentRoom.ShutdownType == eShutdownType.Vacancy) - { - PowerDownModal = new ModalDialog(TriList); - var message = string.Format("Meeting will end in {0} seconds", CurrentRoom.ShutdownPromptSeconds); - - // Attach timer things to modal - CurrentRoom.ShutdownPromptTimer.TimeRemainingFeedback.OutputChange += ShutdownPromptTimer_TimeRemainingFeedback_OutputChange; - CurrentRoom.ShutdownPromptTimer.PercentFeedback.OutputChange += ShutdownPromptTimer_PercentFeedback_OutputChange; - - // respond to offs by cancelling dialog - var onFb = CurrentRoom.OnFeedback; - EventHandler offHandler = null; - offHandler = (o, a) => - { - if (!onFb.BoolValue) - { - PowerDownModal.HideDialog(); - SetActivityFooterFeedbacks(); - onFb.OutputChange -= offHandler; - } - }; - onFb.OutputChange += offHandler; - - PowerDownModal.PresentModalDialog(2, "End Meeting", "Power", message, "Cancel", "End Meeting Now", true, true, - but => - { - if (but != 2) // any button except for End cancels - timer.Cancel(); - else - timer.Finish(); - }); - } - } - - /// - /// - /// - /// - /// - void ShutdownPromptTimer_HasFinished(object sender, EventArgs e) - { - SetActivityFooterFeedbacks(); - CurrentRoom.ShutdownPromptTimer.TimeRemainingFeedback.OutputChange -= ShutdownPromptTimer_TimeRemainingFeedback_OutputChange; - CurrentRoom.ShutdownPromptTimer.PercentFeedback.OutputChange -= ShutdownPromptTimer_PercentFeedback_OutputChange; - } - - /// - /// - /// - /// - /// - void ShutdownPromptTimer_WasCancelled(object sender, EventArgs e) - { - if (PowerDownModal != null) - PowerDownModal.HideDialog(); - SetActivityFooterFeedbacks(); - - CurrentRoom.ShutdownPromptTimer.TimeRemainingFeedback.OutputChange += ShutdownPromptTimer_TimeRemainingFeedback_OutputChange; - CurrentRoom.ShutdownPromptTimer.PercentFeedback.OutputChange -= ShutdownPromptTimer_PercentFeedback_OutputChange; - } - - /// - /// Event handler for countdown timer on power off modal - /// - void ShutdownPromptTimer_TimeRemainingFeedback_OutputChange(object sender, EventArgs e) - { - - var message = string.Format("Meeting will end in {0} seconds", (sender as StringFeedback).StringValue); - TriList.StringInput[ModalDialog.MessageTextJoin].StringValue = message; - } - - /// - /// Event handler for percentage on power off countdown - /// - void ShutdownPromptTimer_PercentFeedback_OutputChange(object sender, EventArgs e) - { - var value = (ushort)((sender as IntFeedback).UShortValue * 65535 / 100); - TriList.UShortInput[ModalDialog.TimerGaugeJoin].UShortValue = value; - } - - /// - /// - /// - void CancelPowerOffTimer() - { - if (PowerOffTimer != null) - { - PowerOffTimer.Stop(); - PowerOffTimer = null; - } - } - - /// - /// - /// - /// - public void VolumeUpPress(bool state) - { - if (CurrentRoom.CurrentVolumeControls != null) - CurrentRoom.CurrentVolumeControls.VolumeUp(state); - } - - /// - /// - /// - /// - public void VolumeDownPress(bool state) - { - if (CurrentRoom.CurrentVolumeControls != null) - CurrentRoom.CurrentVolumeControls.VolumeDown(state); - } - - /// - /// Helper for property setter. Sets the panel to the given room, latching up all functionality - /// - void RefreshCurrentRoom(IEssentialsHuddleVtc1Room room) - { - - if (_CurrentRoom != null) - { - // Disconnect current room - _CurrentRoom.CurrentVolumeDeviceChange -= this.CurrentRoom_CurrentAudioDeviceChange; - ClearAudioDeviceConnections(); - _CurrentRoom.CurrentSourceChange -= 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.IsWarmingUpFeedback.OutputChange -= CurrentRoom_IsWarmingFeedback_OutputChange; - _CurrentRoom.IsCoolingDownFeedback.OutputChange -= CurrentRoom_IsCoolingDownFeedback_OutputChange; - _CurrentRoom.InCallFeedback.OutputChange -= CurrentRoom_InCallFeedback_OutputChange; - - var scheduleAwareCodec = _CurrentRoom.VideoCodec as IHasScheduleAwareness; - if (scheduleAwareCodec != null) - { - scheduleAwareCodec.CodecSchedule.MeetingsListHasChanged -= CodecSchedule_MeetingsListHasChanged; - } - - var meetingInfoCodec = _CurrentRoom.VideoCodec as IHasMeetingInfo; - if (meetingInfoCodec != null) - { - meetingInfoCodec.MeetingInfoChanged -= meetingInfoCodec_MeetingInfoChanged; - } - } - - _CurrentRoom = room; - - if (_CurrentRoom != null) - { - // get the source list config and set up the source list - - SetupSourceList(); - - // Name and logo - TriList.StringInput[UIStringJoin.CurrentRoomName].StringValue = _CurrentRoom.Name; - ShowLogo(); - - // Shutdown timer - _CurrentRoom.ShutdownPromptTimer.HasStarted += ShutdownPromptTimer_HasStarted; - _CurrentRoom.ShutdownPromptTimer.HasFinished += ShutdownPromptTimer_HasFinished; - _CurrentRoom.ShutdownPromptTimer.WasCancelled += ShutdownPromptTimer_WasCancelled; - - // Link up all the change events from the room - _CurrentRoom.OnFeedback.OutputChange += CurrentRoom_OnFeedback_OutputChange; - CurrentRoom_SyncOnFeedback(); - _CurrentRoom.IsWarmingUpFeedback.OutputChange += CurrentRoom_IsWarmingFeedback_OutputChange; - _CurrentRoom.IsCoolingDownFeedback.OutputChange += CurrentRoom_IsCoolingDownFeedback_OutputChange; - _CurrentRoom.InCallFeedback.OutputChange += CurrentRoom_InCallFeedback_OutputChange; - - - _CurrentRoom.CurrentVolumeDeviceChange += CurrentRoom_CurrentAudioDeviceChange; - RefreshAudioDeviceConnections(); - _CurrentRoom.CurrentSourceChange += CurrentRoom_SourceInfoChange; - RefreshSourceInfo(); - - - var scheduleAwareCodec = _CurrentRoom.VideoCodec as IHasScheduleAwareness; - if (scheduleAwareCodec != null) - { - scheduleAwareCodec.CodecSchedule.MeetingsListHasChanged += CodecSchedule_MeetingsListHasChanged; - } - - var meetingInfoCodec = _CurrentRoom.VideoCodec as IHasMeetingInfo; - if (meetingInfoCodec != null) - { - meetingInfoCodec.MeetingInfoChanged += new EventHandler(meetingInfoCodec_MeetingInfoChanged); - - CallListOrMeetingInfoPopoverVisibilityJoin = UIBoolJoin.HeaderMeetingInfoVisible; - } - else - { - CallListOrMeetingInfoPopoverVisibilityJoin = UIBoolJoin.HeaderActiveCallsListVisible; - } - - CallSharingInfoVisibleFeedback = new BoolFeedback(() => _CurrentRoom.VideoCodec.SharingContentIsOnFeedback.BoolValue); - _CurrentRoom.VideoCodec.SharingContentIsOnFeedback.OutputChange += SharingContentIsOnFeedback_OutputChange; - CallSharingInfoVisibleFeedback.LinkInputSig(TriList.BooleanInput[UIBoolJoin.CallSharedSourceInfoVisible]); - - SetActiveCallListSharingContentStatus(); - - if (_CurrentRoom != null) - _CurrentRoom.CurrentSourceChange += new SourceInfoChangeHandler(CurrentRoom_CurrentSingleSourceChange); - - // Moved to EssentialsVideoCodecUiDriver - //TriList.SetSigFalseAction(UIBoolJoin.CallStopSharingPress, () => _CurrentRoom.RunRouteAction("codecOsd", _CurrentRoom.SourceListKey)); - - (Parent as EssentialsPanelMainInterfaceDriver).HeaderDriver.SetupHeaderButtons(this, CurrentRoom); - } - else - { - // Clear sigs that need to be - TriList.StringInput[UIStringJoin.CurrentRoomName].StringValue = "Select a room"; - } - } - - void meetingInfoCodec_MeetingInfoChanged(object sender, MeetingInfoEventArgs e) - { - if (e.Info == null) - { - return; - } - - TriList.SetString(UIStringJoin.MeetingIdText, e.Info.Id); - TriList.SetString(UIStringJoin.MeetingHostText, e.Info.Host); - TriList.SetString(UIStringJoin.MeetingNameText, e.Info.Name); - - TriList.SetString(UIStringJoin.MeetingPasswordText, e.Info.Password); - // Show the password fields if one is present - TriList.SetBool(UIBoolJoin.MeetingPasswordVisible, !string.IsNullOrEmpty(e.Info.Password)); - - TriList.SetString(UIStringJoin.CallSharedSourceNameText, e.Info.ShareStatus); - - TriList.SetString(UIStringJoin.MeetingLeaveText, e.Info.IsHost ? "End Meeting" : "Leave Meeting"); - } - - void SetCurrentRoom(IEssentialsHuddleVtc1Room room) - { - if (_CurrentRoom == room) return; - // Disconnect current (probably never called) - - if(_CurrentRoom != null) - _CurrentRoom.ConfigChanged -= room_ConfigChanged; - - room.ConfigChanged -= room_ConfigChanged; - room.ConfigChanged += room_ConfigChanged; - - if (room.IsMobileControlEnabled) - { - StartPageVisibleJoin = UIBoolJoin.StartMCPageVisible; - UpdateMCJoins(room); - - if (_CurrentRoom != null) - _CurrentRoom.MobileControlRoomBridge.UserCodeChanged -= MobileControlRoomBridge_UserCodeChanged; - - room.MobileControlRoomBridge.UserCodeChanged -= MobileControlRoomBridge_UserCodeChanged; - room.MobileControlRoomBridge.UserCodeChanged += MobileControlRoomBridge_UserCodeChanged; - } - else - { - StartPageVisibleJoin = UIBoolJoin.StartPageVisible; - } - - RefreshCurrentRoom(room); - } - - void MobileControlRoomBridge_UserCodeChanged(object sender, EventArgs e) - { - UpdateMCJoins(_CurrentRoom); - } - - void UpdateMCJoins(IEssentialsHuddleVtc1Room room) - { - TriList.SetString(UIStringJoin.RoomMcUrl, room.MobileControlRoomBridge.McServerUrl); - TriList.SetString(UIStringJoin.RoomMcQrCodeUrl, room.MobileControlRoomBridge.QrCodeUrl); - TriList.SetString(UIStringJoin.RoomUserCode, room.MobileControlRoomBridge.UserCode); - } - - /// - /// Fires when room config of current room has changed. Meant to refresh room values to propegate any updates to UI - /// - /// - /// - void room_ConfigChanged(object sender, EventArgs e) - { - RefreshCurrentRoom(_CurrentRoom); - } - - /// - /// - /// - /// - /// - void CurrentRoom_InCallFeedback_OutputChange(object sender, EventArgs e) - { - var inCall = CurrentRoom.InCallFeedback.BoolValue; - if (inCall) - { - // Check if transitioning to in call - and non-sharable source is in use - if (CurrentRoom.CurrentSourceInfo != null && CurrentRoom.CurrentSourceInfo.DisableCodecSharing) - { - Debug.Console(1, CurrentRoom, "Transitioning to in-call, cancelling non-sharable source"); - CurrentRoom.RunRouteAction("codecOsd"); - } - } - - SetupSourceList(); - } - - /// - /// - /// - void SetupSourceList() - { - - var inCall = CurrentRoom.InCallFeedback.BoolValue; - var config = ConfigReader.ConfigObject.SourceLists; - - - if (config.ContainsKey(_CurrentRoom.SourceListKey)) - { - var srcList = config[_CurrentRoom.SourceListKey].OrderBy(kv => kv.Value.Order); - - - // Setup sources list - SourceStagingSrl.Clear(); - uint i = 1; // counter for UI list - foreach (var kvp in srcList) - { - var srcConfig = kvp.Value; - Debug.Console(1, "**** {0}, {1}, {2}, {3}, {4}", srcConfig.PreferredName, srcConfig.IncludeInSourceList, - srcConfig.DisableCodecSharing, inCall, this.CurrentMode); - // Skip sources marked as not included, and filter list of non-sharable sources when in call - // or on share screen - if (!srcConfig.IncludeInSourceList || (inCall && srcConfig.DisableCodecSharing) - || this.CurrentMode == UiDisplayMode.Call && srcConfig.DisableCodecSharing) - { - Debug.Console(1, "Skipping {0}", srcConfig.PreferredName); - continue; - } - - var routeKey = kvp.Key; - var item = new SubpageReferenceListSourceItem(i++, SourceStagingSrl, srcConfig, - b => { if (!b) UiSelectSource(routeKey); }); - SourceStagingSrl.AddItem(item); // add to the SRL - item.RegisterForSourceChange(_CurrentRoom); - Debug.Console(1, "**** KEY {0}", kvp.Key); - - } - _sourceListCount = (i - 1); - SourceStagingSrl.Count = (ushort)_sourceListCount; - } - - } - - /// - /// If the schedule changes, this event will fire - /// - /// - /// - void CodecSchedule_MeetingsListHasChanged(object sender, EventArgs e) - { - RefreshMeetingsList(); - } - - /// - /// Updates the current shared source label on the call list when the source changes - /// - /// - /// - /// - void CurrentRoom_CurrentSingleSourceChange(SourceListItem info, ChangeType type) - { - Debug.Console(1, "AvFunctionsDriver: CurrentSingleSourceChange"); - - // Show the Select a source subpage - if (TriList.BooleanInput[UIBoolJoin.SourceStagingBarVisible].BoolValue) - { - Debug.Console(1, "AvFunctionsDriver: CurrentSingleSourceChange SourceStagingBarVisisble: true"); - - if (_CurrentRoom.CurrentSourceInfo == null || (_CurrentRoom.VideoCodec != null && _CurrentRoom.CurrentSourceInfo.SourceDevice.Key == _CurrentRoom.VideoCodec.OsdSource.Key)) - { - Debug.Console(1, "AvFunctionsDriver: CurrentSingleSourceChange Showing SelectASourceVisible"); - TriList.SetBool(UIBoolJoin.SelectASourceVisible, true); - } - else - { - TriList.SetBool(UIBoolJoin.SelectASourceVisible, false); - Debug.Console(1, "AvFunctionsDriver: CurrentSingleSourceChange Hiding SelectASourceVisible"); - } - } - else - { - Debug.Console(1, "AvFunctionsDriver: CurrentSingleSourceChange Hiding SelectASourceVisible"); - TriList.SetBool(UIBoolJoin.SelectASourceVisible, false); - } - - if (_CurrentRoom.VideoCodec.SharingContentIsOnFeedback.BoolValue && _CurrentRoom.CurrentSourceInfo != null) - TriList.StringInput[UIStringJoin.CallSharedSourceNameText].StringValue = _CurrentRoom.CurrentSourceInfo.PreferredName; - } - - /// - /// Fires when the sharing source feedback of the codec changes - /// - /// - /// - void SharingContentIsOnFeedback_OutputChange(object sender, EventArgs e) - { - SetActiveCallListSharingContentStatus(); - } - - /// - /// Sets the values for the text and button visibilty for the active call list source sharing info - /// - void SetActiveCallListSharingContentStatus() - { - CallSharingInfoVisibleFeedback.FireUpdate(); - - string callListSharedSourceLabel; - - if (_CurrentRoom.VideoCodec.SharingContentIsOnFeedback.BoolValue && _CurrentRoom.CurrentSourceInfo != null) - { - Debug.Console(0, "*#* CurrentRoom.CurrentSourceInfo = {0}", - _CurrentRoom.CurrentSourceInfo != null ? _CurrentRoom.CurrentSourceInfo.SourceKey : "Nada!"); - callListSharedSourceLabel = _CurrentRoom.CurrentSourceInfo.PreferredName; - } - else - callListSharedSourceLabel = "None"; - - TriList.StringInput[UIStringJoin.CallSharedSourceNameText].StringValue = callListSharedSourceLabel; - } - - /// - /// - /// - void RefreshMeetingsList() - { - // See if this is helpful or if the callback response in the codec class maybe doesn't come it time? - // Let's build list from event - - TriList.SetString(UIStringJoin.MeetingsOrContactMethodListIcon, "Calendar"); - TriList.SetString(UIStringJoin.MeetingsOrContactMethodListTitleText, "Today's Meetings"); - - ushort i = 0; - foreach (var m in CurrentRoom.ScheduleSource.CodecSchedule.Meetings) - { - i++; - MeetingOrContactMethodModalSrl.StringInputSig(i, 1).StringValue = m.StartTime.ToString("t", Global.Culture); - MeetingOrContactMethodModalSrl.StringInputSig(i, 2).StringValue = m.EndTime.ToString("t", Global.Culture); - MeetingOrContactMethodModalSrl.StringInputSig(i, 3).StringValue = m.Title; - MeetingOrContactMethodModalSrl.StringInputSig(i, 4).StringValue = string.Format("
{0}",m.Organizer); - MeetingOrContactMethodModalSrl.StringInputSig(i, 5).StringValue = "Join"; - MeetingOrContactMethodModalSrl.BoolInputSig(i, 2).BoolValue = m.Joinable; - var mm = m; // lambda scope - MeetingOrContactMethodModalSrl.GetBoolFeedbackSig(i, 1).SetSigFalseAction(() => - { - PopupInterlock.Hide(); - ActivityCallButtonPressed(); - var d = CurrentRoom.ScheduleSource as VideoCodecBase; - if (d != null) - RoomOnAndDialMeeting(mm); - }); - } - MeetingOrContactMethodModalSrl.Count = i; - - if (i == 0) // Show item indicating no meetings are booked for rest of day - { - MeetingOrContactMethodModalSrl.Count = 1; - - MeetingOrContactMethodModalSrl.StringInputSig(1, 1).StringValue = string.Empty; - MeetingOrContactMethodModalSrl.StringInputSig(1, 2).StringValue = string.Empty; - MeetingOrContactMethodModalSrl.StringInputSig(1, 3).StringValue = "No Meetings are booked for the remainder of the day."; - MeetingOrContactMethodModalSrl.StringInputSig(1, 4).StringValue = string.Empty; - MeetingOrContactMethodModalSrl.StringInputSig(1, 5).StringValue = string.Empty; - } - } - - /// - /// For room on/off changes - /// - void CurrentRoom_OnFeedback_OutputChange(object sender, EventArgs e) - { - CurrentRoom_SyncOnFeedback(); - } - - /// - /// - /// - void CurrentRoom_SyncOnFeedback() - { - var value = _CurrentRoom.OnFeedback.BoolValue; - TriList.BooleanInput[UIBoolJoin.RoomIsOn].BoolValue = value; - - //TriList.BooleanInput[StartPageVisibleJoin].BoolValue = !value; - - if (value) //ON - { - SetupActivityFooterWhenRoomOn(); - //TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = false; - TriList.BooleanInput[UIBoolJoin.VolumeDualMute1Visible].BoolValue = true; - - } - else - { - CurrentMode = UiDisplayMode.Start; - if (VCDriver.IsVisible) - VCDriver.Hide(); - SetupActivityFooterWhenRoomOff(); - ShowLogo(); - //TriList.BooleanInput[UIBoolJoin.VolumeDualMute1Visible].BoolValue = false; - //TriList.BooleanInput[UIBoolJoin.SourceStagingBarVisible].BoolValue = false; - // Clear this so that the pesky meeting warning can resurface every minute when off - LastMeetingDismissedId = null; - } - } - - /// - /// - /// - void CurrentRoom_IsWarmingFeedback_OutputChange(object sender, EventArgs e) - { - if (CurrentRoom.IsWarmingUpFeedback.BoolValue) - { - ShowNotificationRibbon("Room is powering on. Please wait...", 0); - } - else - { - ShowNotificationRibbon("Room is powered on. Welcome.", 2000); - } - } - - /// - /// - /// - /// - /// - void CurrentRoom_IsCoolingDownFeedback_OutputChange(object sender, EventArgs e) - { - if (CurrentRoom.IsCoolingDownFeedback.BoolValue) - { - ShowNotificationRibbon("Room is powering off. Please wait.", 0); - } - else - { - HideNotificationRibbon(); - } - } - - /// - /// Hides source for provided source info - /// - /// - void DisconnectSource(SourceListItem previousInfo) - { - if (previousInfo == null) return; - - // Hide whatever is showing - if (IsVisible) - { - if (CurrentSourcePageManager != null) - { - CurrentSourcePageManager.Hide(); - CurrentSourcePageManager = null; - } - } - - if (previousInfo == null) return; - var previousDev = previousInfo.SourceDevice; - - // device type interfaces - if (previousDev is ISetTopBoxControls) - (previousDev as ISetTopBoxControls).UnlinkButtons(TriList); - // common interfaces - if (previousDev is IChannel) - (previousDev as IChannel).UnlinkButtons(TriList); - if (previousDev is IColor) - (previousDev as IColor).UnlinkButtons(TriList); - if (previousDev is IDPad) - (previousDev as IDPad).UnlinkButtons(TriList); - if (previousDev is IDvr) - (previousDev as IDvr).UnlinkButtons(TriList); - if (previousDev is INumericKeypad) - (previousDev as INumericKeypad).UnlinkButtons(TriList); - if (previousDev is IHasPowerControl) - (previousDev as IHasPowerControl).UnlinkButtons(TriList); - if (previousDev is ITransport) - (previousDev as ITransport).UnlinkButtons(TriList); - } - - /// - /// Refreshes and shows the room's current source - /// - void RefreshSourceInfo() - { - var routeInfo = CurrentRoom.CurrentSourceInfo; - // This will show off popup too - if (this.IsVisible && !VCDriver.IsVisible) - ShowCurrentSource(); - - if (routeInfo == null)// || !CurrentRoom.OnFeedback.BoolValue) - { - // Check for power off and insert "Room is off" - TriList.StringInput[UIStringJoin.CurrentSourceName].StringValue = "Room is off"; - TriList.StringInput[UIStringJoin.CurrentSourceIcon].StringValue = "Power"; - this.Hide(); - Parent.Show(); - return; - } - else if (routeInfo != null) - { - TriList.StringInput[UIStringJoin.CurrentSourceName].StringValue = routeInfo.PreferredName; - TriList.StringInput[UIStringJoin.CurrentSourceIcon].StringValue = routeInfo.Icon; // defaults to "blank" - } - else // This never gets hit???!!! - { - TriList.StringInput[UIStringJoin.CurrentSourceName].StringValue = "---"; - TriList.StringInput[UIStringJoin.CurrentSourceIcon].StringValue = "Blank"; - } - - // Connect controls - if (routeInfo.SourceDevice != null) - ConnectControlDeviceMethods(routeInfo.SourceDevice); - } - - /// - /// Attach the source to the buttons and things - /// - void ConnectControlDeviceMethods(Device dev) - { - if (dev is ISetTopBoxControls) - (dev as ISetTopBoxControls).LinkButtons(TriList); - if (dev is IChannel) - (dev as IChannel).LinkButtons(TriList); - if (dev is IColor) - (dev as IColor).LinkButtons(TriList); - if (dev is IDPad) - (dev as IDPad).LinkButtons(TriList); - if (dev is IDvr) - (dev as IDvr).LinkButtons(TriList); - if (dev is INumericKeypad) - (dev as INumericKeypad).LinkButtons(TriList); - if (dev is IHasPowerControl) - (dev as IHasPowerControl).LinkButtons(TriList); - if (dev is ITransport) - (dev as ITransport).LinkButtons(TriList); - } - - /// - /// Detaches the buttons and feedback from the room's current audio device - /// - void ClearAudioDeviceConnections() - { - TriList.ClearBoolSigAction(UIBoolJoin.VolumeUpPress); - TriList.ClearBoolSigAction(UIBoolJoin.VolumeDownPress); - TriList.ClearBoolSigAction(UIBoolJoin.Volume1ProgramMutePressAndFB); - - var fDev = CurrentRoom.CurrentVolumeControls as IBasicVolumeWithFeedback; - if (fDev != null) - { - TriList.ClearUShortSigAction(UIUshortJoin.VolumeSlider1Value); - fDev.VolumeLevelFeedback.UnlinkInputSig( - TriList.UShortInput[UIUshortJoin.VolumeSlider1Value]); - } - } - - /// - /// Attaches the buttons and feedback to the room's current audio device - /// - void RefreshAudioDeviceConnections() - { - var dev = CurrentRoom.CurrentVolumeControls; - if (dev != null) // connect buttons - { - TriList.SetBoolSigAction(UIBoolJoin.VolumeUpPress, VolumeUpPress); - TriList.SetBoolSigAction(UIBoolJoin.VolumeDownPress, VolumeDownPress); - TriList.SetSigFalseAction(UIBoolJoin.Volume1ProgramMutePressAndFB, dev.MuteToggle); - } - - var fbDev = dev as IBasicVolumeWithFeedback; - if (fbDev == null) // this should catch both IBasicVolume and IBasicVolumeWithFeeback - TriList.UShortInput[UIUshortJoin.VolumeSlider1Value].UShortValue = 0; - else - { - // slider - TriList.SetUShortSigAction(UIUshortJoin.VolumeSlider1Value, fbDev.SetVolume); - // feedbacks - fbDev.MuteFeedback.LinkInputSig(TriList.BooleanInput[UIBoolJoin.Volume1ProgramMutePressAndFB]); - fbDev.VolumeLevelFeedback.LinkInputSig( - TriList.UShortInput[UIUshortJoin.VolumeSlider1Value]); - } - } - - /// - /// Handler for when the room's volume control device changes - /// - void CurrentRoom_CurrentAudioDeviceChange(object sender, VolumeDeviceChangeEventArgs args) - { - if (args.Type == ChangeType.WillChange) - ClearAudioDeviceConnections(); - else // did change - RefreshAudioDeviceConnections(); - } - - /// - /// Handles source change - /// - void CurrentRoom_SourceInfoChange(SourceListItem info, ChangeType change) - { - if (change == ChangeType.WillChange) - DisconnectSource(info); - else - RefreshSourceInfo(); - } - } - - /// - /// For hanging off various common AV things that child drivers might need from a parent AV driver - /// - public interface IAVDriver - { - PanelDriverBase Parent { get; } - JoinedSigInterlock PopupInterlock { get; } - void ShowNotificationRibbon(string message, int timeout); - void HideNotificationRibbon(); - void ShowTech(); - uint StartPageVisibleJoin { get; } - } - - /// - /// For hanging off various common VC things that child drivers might need from a parent AV driver - /// - public interface IAVWithVCDriver : IAVDriver - { - IEssentialsHuddleVtc1Room CurrentRoom { get; } - - PepperDash.Essentials.Core.Touchpanels.Keyboards.HabaneroKeyboardController Keyboard { get; } - /// - /// Exposes the ability to switch into call mode - /// - void ActivityCallButtonPressed(); - /// - /// Allows the codec to trigger the main UI to clear up if call is coming in. - /// - void PrepareForCodecIncomingCall(); - - uint CallListOrMeetingInfoPopoverVisibilityJoin { get; } - - SubpageReferenceList MeetingOrContactMethodModalSrl { get; } - } -} diff --git a/src/PepperDash.Essentials/UIDrivers/JoinedSigInterlock.cs b/src/PepperDash.Essentials/UIDrivers/JoinedSigInterlock.cs deleted file mode 100644 index bdcaa84e..00000000 --- a/src/PepperDash.Essentials/UIDrivers/JoinedSigInterlock.cs +++ /dev/null @@ -1,175 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DeviceSupport; - -using PepperDash.Core; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials -{ - public class JoinedSigInterlock - { - public uint CurrentJoin { get; private set; } - - BasicTriList TriList; - - public BoolFeedback IsShownFeedback; - - public event EventHandler StatusChanged; - - bool _IsShown; - - public bool IsShown - { - get - { - return _IsShown; - } - private set - { - _IsShown = value; - IsShownFeedback.FireUpdate(); - } - } - - //public BoolFeedback ShownFeedback { get; private set; } - - public JoinedSigInterlock(BasicTriList triList) - { - TriList = triList; - - IsShownFeedback = new BoolFeedback(new Func( () => _IsShown)); - } - - /// - /// Hides CurrentJoin and shows join. Will check and re-set signal if join - /// equals CurrentJoin - /// - public void ShowInterlocked(uint join) - { - var prevJoin = CurrentJoin; - var wasShown = _IsShown; - //Debug.Console(2, "Trilist {0:X2}, interlock swapping {1} for {2}", TriList.ID, CurrentJoin, join); - if (CurrentJoin == join && TriList.BooleanInput[join].BoolValue) - return; - SetButDontShow(join); - TriList.SetBool(CurrentJoin, true); - IsShown = true; - - OnStatusChange(prevJoin, CurrentJoin, wasShown, IsShown); - } - - /// - /// - /// - /// - public void ShowInterlockedWithToggle(uint join) - { - var prevJoin = CurrentJoin; - var wasShown = IsShown; - - //Debug.Console(2, "Trilist {0:X2}, interlock swapping {1} for {2}", TriList.ID, CurrentJoin, join); - if (CurrentJoin == join) - HideAndClear(); - else - { - if (CurrentJoin > 0) - TriList.BooleanInput[CurrentJoin].BoolValue = false; - CurrentJoin = join; - TriList.BooleanInput[CurrentJoin].BoolValue = true; - IsShown = true; - - OnStatusChange(prevJoin, CurrentJoin, wasShown, IsShown); - } - } - /// - /// Hides current join and clears CurrentJoin - /// - public void HideAndClear() - { - var prevJoin = CurrentJoin; - var wasShown = IsShown; - //Debug.Console(2, "Trilist {0:X2}, interlock hiding {1}", TriList.ID, CurrentJoin); - Hide(); - CurrentJoin = 0; - - OnStatusChange(prevJoin, CurrentJoin, wasShown, IsShown); - } - - /// - /// Hides the current join but does not clear the selected join in case - /// it needs to be reshown - /// - public void Hide() - { - var prevJoin = CurrentJoin; - var wasShown = IsShown; - - //Debug.Console(2, "Trilist {0:X2}, interlock hiding {1}", TriList.ID, CurrentJoin); - if (CurrentJoin > 0) - { - TriList.BooleanInput[CurrentJoin].BoolValue = false; - IsShown = false; - OnStatusChange(prevJoin, CurrentJoin, wasShown, IsShown); - } - } - - /// - /// If CurrentJoin is set, it restores that join - /// - public void Show() - { - var prevJoin = CurrentJoin; - var wasShown = IsShown; - - //Debug.Console(2, "Trilist {0:X2}, interlock showing {1}", TriList.ID, CurrentJoin); - if (CurrentJoin > 0) - { - TriList.BooleanInput[CurrentJoin].BoolValue = true; - IsShown = true; - - OnStatusChange(prevJoin, CurrentJoin, wasShown, IsShown); - } - } - - /// - /// Useful for pre-setting the interlock but not enabling it. Sets CurrentJoin - /// - /// - public void SetButDontShow(uint join) - { - if (CurrentJoin > 0) - { - TriList.BooleanInput[CurrentJoin].BoolValue = false; - IsShown = false; - } - CurrentJoin = join; - } - - void OnStatusChange(uint prevJoin, uint newJoin, bool wasShown, bool isShown) - { - var handler = StatusChanged; - if (handler != null) - handler(this, new StatusChangedEventArgs(prevJoin, newJoin, wasShown, isShown)); - } - } - - public class StatusChangedEventArgs : EventArgs - { - public uint PreviousJoin { get; set; } - public uint NewJoin { get; set; } - public bool WasShown { get; set; } - public bool IsShown { get; set; } - - public StatusChangedEventArgs(uint prevJoin, uint newJoin, bool wasShown, bool isShown) - { - PreviousJoin = prevJoin; - NewJoin = newJoin; - WasShown = wasShown; - IsShown = isShown; - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UIDrivers/Page Drivers/SingleSubpageModalAndBackDriver.cs b/src/PepperDash.Essentials/UIDrivers/Page Drivers/SingleSubpageModalAndBackDriver.cs deleted file mode 100644 index f654d04e..00000000 --- a/src/PepperDash.Essentials/UIDrivers/Page Drivers/SingleSubpageModalAndBackDriver.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.UI; - -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.SmartObjects; - - -namespace PepperDash.Essentials -{ - /// - /// Very basic show/hide manager for weather page. Basic functionality is useful on any - /// size of interface - /// - public class SingleSubpageModalAndBackDriver : PanelDriverBase - { - BoolInputSig SubpageSig; - - PanelDriverBase Parent; - - public SingleSubpageModalAndBackDriver(PanelDriverBase parent, uint subpageJoin) : base(parent.TriList) - { - Parent = parent; - SubpageSig = Parent.TriList.BooleanInput[subpageJoin]; - } - - /// - /// This shows the driver. - /// Not sure I like this approach. Hides this and shows it's parent. Not really a navigation-stack type thing. - /// The parent is always the home page driver - /// - public override void Show() - { - SubpageSig.BoolValue = true; - base.Show(); - } - - public override void Hide() - { - SubpageSig.BoolValue = false; - base.Hide(); - } - - public override void BackButtonPressed() - { - Hide(); - Parent.Show(); - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UIDrivers/Page Drivers/SingleSubpageModalDriver.cs b/src/PepperDash.Essentials/UIDrivers/Page Drivers/SingleSubpageModalDriver.cs deleted file mode 100644 index 307436e8..00000000 --- a/src/PepperDash.Essentials/UIDrivers/Page Drivers/SingleSubpageModalDriver.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.UI; - -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.SmartObjects; - - -namespace PepperDash.Essentials -{ - /// - /// Very basic show/hide manager for weather page. Basic functionality is useful on any - /// size of interface - /// - public class SingleSubpageModalDriver : PanelDriverBase - { - BoolInputSig SubpageSig; - - public SingleSubpageModalDriver(PanelDriverBase parent, uint subpageJoin, uint closeJoin) - : base(parent.TriList) - { - SubpageSig = parent.TriList.BooleanInput[subpageJoin]; - parent.TriList.SetSigFalseAction(closeJoin, Hide); - } - - public override void Show() - { - SubpageSig.BoolValue = true; - base.Show(); - } - - public override void Hide() - { - SubpageSig.BoolValue = false; - base.Hide(); - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UIDrivers/ScreenSaverController.cs b/src/PepperDash.Essentials/UIDrivers/ScreenSaverController.cs deleted file mode 100644 index 11ce587a..00000000 --- a/src/PepperDash.Essentials/UIDrivers/ScreenSaverController.cs +++ /dev/null @@ -1,152 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -using PepperDash.Core; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials -{ - /// - /// Driver responsible for controlling the screenshaver showing the client logo, MC connection information and QR Code. Moves the elements around to prevent screen burn in - /// - public class ScreenSaverController : PanelDriverBase, IDisposable - { - - /// - /// The parent driver for this - /// - private readonly EssentialsPanelMainInterfaceDriver _parent; - - - private JoinedSigInterlock PositionInterlock; - - CTimer PositionTimer; - - uint PositionTimeoutMs; - - List PositionJoins; - - int CurrentPositionIndex = 0; - - public ScreenSaverController(EssentialsPanelMainInterfaceDriver parent, CrestronTouchpanelPropertiesConfig config) - : base(parent.TriList) - { - _parent = parent; - - PositionTimeoutMs = config.ScreenSaverMovePositionIntervalMs; - - PositionJoins = new List() { UIBoolJoin.MCScreenSaverPosition1Visible, UIBoolJoin.MCScreenSaverPosition2Visible, UIBoolJoin.MCScreenSaverPosition3Visible, UIBoolJoin.MCScreenSaverPosition4Visible }; - - PositionInterlock = new JoinedSigInterlock(parent.TriList); - - var cmdName = String.Format("shwscrsvr-{0:X2}", parent.TriList.ID); - - CrestronConsole.AddNewConsoleCommand((o) => Show(), cmdName, "Shows Panel Screensaver", ConsoleAccessLevelEnum.AccessOperator); - - TriList.SetSigFalseAction(UIBoolJoin.MCScreenSaverClosePress, Hide); - } - - public override void Show() - { - //Debug.Console(2, "Showing ScreenSaverController: {0:X2}", TriList.ID); - - if (_parent.AvDriver != null) - { - _parent.AvDriver.PopupInterlock.ShowInterlocked(UIBoolJoin.MCScreenSaverVisible); - } - - CurrentPositionIndex = 0; - ShowCurrentPosition(); - StartPositionTimer(); - - base.Show(); - } - - public override void Hide() - { - //Debug.Console(2, "Hiding ScreenSaverController: {0:X2}", TriList.ID); - - if (PositionTimer != null) - { - //Debug.Console(2, "Stopping PositionTimer: {0:X2}", TriList.ID); - PositionTimer.Stop(); - PositionTimer.Dispose(); - PositionTimer = null; - } - - ClearAllPositions(); - - if (_parent.AvDriver != null) - { - _parent.AvDriver.PopupInterlock.HideAndClear(); - } - - base.Hide(); - } - - void StartPositionTimer() - { - //Debug.Console(2, "Starting Position Timer: {0:X2}", TriList.ID); - - if (PositionTimer == null) - { - PositionTimer = new CTimer((o) => PositionTimerExpired(), PositionTimeoutMs); - } - else - { - PositionTimer.Reset(PositionTimeoutMs); - } - - } - - void PositionTimerExpired() - { - IncrementPositionIndex(); - - ShowCurrentPosition(); - - StartPositionTimer(); - } - - void IncrementPositionIndex() - { - if (CurrentPositionIndex < PositionJoins.Count - 1) - { - CurrentPositionIndex++; - } - else - { - CurrentPositionIndex = 0; - } - - //Debug.Console(2, "ScreenSaver Position Timer Expired: Setting new position: {0} ID: {1:X2}", CurrentPositionIndex, TriList.ID); - } - - // - void ShowCurrentPosition() - { - // Set based on current index - PositionInterlock.ShowInterlocked(PositionJoins[CurrentPositionIndex]); - } - - void ClearAllPositions() - { - //Debug.Console(2, "Hiding all screensaver positions: {0:X2}", TriList.ID); - - PositionInterlock.HideAndClear(); - } - - #region IDisposable Members - - public void Dispose() - { - Hide(); - } - - #endregion - } - -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UIDrivers/SigInterlock.cs b/src/PepperDash.Essentials/UIDrivers/SigInterlock.cs deleted file mode 100644 index e62fc7f3..00000000 --- a/src/PepperDash.Essentials/UIDrivers/SigInterlock.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; - -using PepperDash.Core; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials -{ - /// - /// Used for interlocking sigs, using a set-clears-last-set model. - /// - public class SigInterlock - { - /// - /// - /// - public BoolInputSig CurrentSig { get; private set; } - - /// - /// - /// - public SigInterlock() - { - } - - /// - /// Hides CurrentJoin and shows join. Does nothing when resending CurrentJoin - /// - public void ShowInterlocked(BoolInputSig sig) - { - if (CurrentSig == sig) - return; - SetButDontShow(sig); - sig.BoolValue = true; - } - - /// - /// - /// - /// - public void ShowInterlockedWithToggle(BoolInputSig sig) - { - if(CurrentSig == sig) - HideAndClear(); - else - { - if(CurrentSig != null) - CurrentSig.BoolValue = false; - CurrentSig = sig; - CurrentSig.BoolValue = true; - } - - } - - /// - /// Hides current Sig and clears CurrentSig - /// - public void HideAndClear() - { - Hide(); - CurrentSig = null; - } - - /// - /// Hides the current Sig but does not clear the selected Sig in case - /// it needs to be reshown - /// - public void Hide() - { - if(CurrentSig != null) - CurrentSig.BoolValue = false; - } - - /// - /// If CurrentSig is set, it restores that Sig - /// - public void Show() - { - if(CurrentSig != null) - CurrentSig.BoolValue = true; - } - - /// - /// Useful for pre-setting the interlock but not enabling it. Sets CurrentSig - /// - /// - public void SetButDontShow(BoolInputSig sig) - { - if (CurrentSig != null) - CurrentSig.BoolValue = false; - CurrentSig = sig; - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UIDrivers/SmartObjectRoomsList.cs b/src/PepperDash.Essentials/UIDrivers/SmartObjectRoomsList.cs deleted file mode 100644 index 2543e664..00000000 --- a/src/PepperDash.Essentials/UIDrivers/SmartObjectRoomsList.cs +++ /dev/null @@ -1,94 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; - -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.SmartObjects; - -namespace PepperDash.Essentials -{ - public class SmartObjectRoomsList : SmartObjectDynamicList - { - public uint StatusSigOffset { get; private set; } - List Items; - - public SmartObjectRoomsList(SmartObject so, uint nameSigOffset, uint statusSigOffset) - : base(so, true, nameSigOffset) - { - StatusSigOffset = statusSigOffset; - Items = new List(); - } - - public void AddRoomItem(SmartObjectRoomsListItem item) - { - Items.Add(item); - } - - public void SetItemStatusText(uint index, string text) - { - if (index > MaxCount) return; - // The list item template defines CIPS tags that refer to standard joins - (SmartObject.Device as BasicTriList).StringInput[StatusSigOffset + index].StringValue = text; - } - - /// - /// Sets feedback for the given room - /// - public void SetFeedbackForRoom(IEssentialsHuddleSpaceRoom room) - { - var itemToSet = Items.FirstOrDefault(i => i.Room == room); - if (itemToSet != null) - SetFeedback(itemToSet.Index, true); - } - } - - public class SmartObjectRoomsListItem - { - public IEssentialsHuddleSpaceRoom Room { get; private set; } - SmartObjectRoomsList Parent; - public uint Index { get; private set; } - - public SmartObjectRoomsListItem(IEssentialsHuddleSpaceRoom room, uint index, SmartObjectRoomsList parent, - Action buttonAction) - { - Room = room; - Parent = parent; - Index = index; - if (room == null) return; - - // Set "now" states - parent.SetItemMainText(index, room.Name); - UpdateItem(room.CurrentSourceInfo); - // Watch for later changes - room.CurrentSourceChange += new SourceInfoChangeHandler(room_CurrentSourceInfoChange); - parent.SetItemButtonAction(index, buttonAction); - } - - void room_CurrentSourceInfoChange(SourceListItem info, ChangeType type) - { - UpdateItem(info); - } - - /// - /// Helper to handle source events and startup syncing with room's current source - /// - /// - void UpdateItem(SourceListItem info) - { - if (info == null || info.Type == eSourceListItemType.Off) - { - Parent.SetItemStatusText(Index, ""); - Parent.SetItemIcon(Index, "Blank"); - } - else - { - Parent.SetItemStatusText(Index, info.PreferredName); - Parent.SetItemIcon(Index, info.AltIcon); - } - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UIDrivers/SourceChangeArgs.cs b/src/PepperDash.Essentials/UIDrivers/SourceChangeArgs.cs deleted file mode 100644 index 5c034084..00000000 --- a/src/PepperDash.Essentials/UIDrivers/SourceChangeArgs.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -using PepperDash.Core; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials -{ - ///// - ///// The handler type for a Room's SourceInfoChange - ///// - //public delegate void SourceInfoChangeHandler(IEssentialsRoom room, SourceListItem info, ChangeType type); -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs b/src/PepperDash.Essentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs deleted file mode 100644 index 40671238..00000000 --- a/src/PepperDash.Essentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs +++ /dev/null @@ -1,2000 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Globalization; -using System.Text.RegularExpressions; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; - -using PepperDash.Core; -using PepperDash.Essentials; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.SmartObjects; -using PepperDash.Essentials.Core.Touchpanels.Keyboards; -using PepperDash.Essentials.Devices.Common.Codec; -using PepperDash.Essentials.Devices.Common.VideoCodec; -using PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces; -using PepperDash.Essentials.Devices.Common.Cameras; - -namespace PepperDash.Essentials.UIDrivers.VC -{ - /// - /// This fella will likely need to interact with the room's source, although that is routed via the spark... - /// Probably needs event or FB to feed AV driver - to show two-mute volume when appropriate. - /// - /// - public class EssentialsVideoCodecUiDriver : PanelDriverBase - { - IAVWithVCDriver Parent; - - /// - /// - /// - VideoCodecBase Codec; - - /// - /// To drive UI elements outside of this driver that may be dependent on this. - /// - //BoolFeedback InCall; - BoolFeedback LocalPrivacyIsMuted; - - /// - /// For the subpages above the bar - /// - JoinedSigInterlock VCControlsInterlock; - - /// - /// For the camera control mode (auto/manual/off) - /// - JoinedSigInterlock VCCameraControlModeInterlock; - - /// - /// For the different staging bars: Active, inactive - /// - JoinedSigInterlock StagingBarsInterlock; - - /// - /// For the staging button feedbacks - /// - JoinedSigInterlock StagingButtonsFeedbackInterlock; - - SmartObjectNumeric DialKeypad; - - SubpageReferenceList ActiveCallsSRL; - - SmartObjectDynamicList RecentCallsList; - - SmartObjectDynamicList DirectoryList; - - SmartObjectDPad CameraPtzPad; - - SmartObjectDynamicList CameraModeList; - - SmartObjectDynamicList CameraSelectList; - - BoolFeedback DirectoryBackButtonVisibleFeedback; - - // These are likely temp until we get a keyboard built - StringFeedback DialStringFeedback; - StringBuilder DialStringBuilder = new StringBuilder(); - BoolFeedback DialStringBackspaceVisibleFeedback; - - StringFeedback SearchStringFeedback; - StringBuilder SearchStringBuilder = new StringBuilder(); - BoolFeedback SearchStringBackspaceVisibleFeedback; - - StringFeedback PasswordStringFeedback; - StringBuilder PasswordStringBuilder = new StringBuilder(); - - ModalDialog IncomingCallModal; - - eKeypadMode KeypadMode; - - bool CodecHasFavorites; - - bool ShowCameraModeControls; - - CTimer BackspaceTimer; - - - /// - /// The panel header driver - /// - EssentialsHeaderDriver HeaderDriver; - - /// - /// - /// - /// - /// - public EssentialsVideoCodecUiDriver(BasicTriListWithSmartObject triList, IAVWithVCDriver parent, VideoCodecBase codec, EssentialsHeaderDriver headerDriver) - : base(triList) - { - try - { - if (codec == null) - throw new ArgumentNullException("Codec cannot be null"); - Codec = codec; - Parent = parent; - HeaderDriver = headerDriver; - SetupCallStagingPopover(); - SetupDialKeypad(); - ActiveCallsSRL = new SubpageReferenceList(triList, UISmartObjectJoin.CodecActiveCallsHeaderList, 5,5,5); - SetupRecentCallsList(); - SetupFavorites(); - SetupLayoutControls(); - - codec.CallStatusChange += new EventHandler(Codec_CallStatusChange); - - //InCall = new BoolFeedback(() => false); - LocalPrivacyIsMuted = new BoolFeedback(() => false); - - VCControlsInterlock = new JoinedSigInterlock(triList); - VCCameraControlModeInterlock = new JoinedSigInterlock(triList); - - VCControlsInterlock.HideAndClear(); - - /* if (CodecHasFavorites || codec is IHasZoomRoomLayouts) //Checking for Zoom Room...picked a ZoomRoom specific interface to check for - VCControlsInterlock.SetButDontShow(UIBoolJoin.VCKeypadWithFavoritesVisible); - else - VCControlsInterlock.SetButDontShow(UIBoolJoin.VCKeypadVisible); */ - - StagingBarsInterlock = new JoinedSigInterlock(triList); - if(Codec is IHasCallHistory) - StagingBarsInterlock.SetButDontShow(UIBoolJoin.VCStagingInactivePopoverWithRecentsVisible); - else - StagingBarsInterlock.SetButDontShow(UIBoolJoin.VCStagingInactivePopoverWithoutRecentsVisible); - - StagingButtonsFeedbackInterlock = new JoinedSigInterlock(triList); - StagingButtonsFeedbackInterlock.ShowInterlocked(UIBoolJoin.VCStagingKeypadPress); - - // Return formatted when dialing, straight digits when in call - DialStringFeedback = new StringFeedback(() => - { - // Format the number feedback if in dial mode and the codec is not IHasStartMeeting (ZoomRoom) - if (KeypadMode == eKeypadMode.Dial && !(Codec is IHasStartMeeting)) - return GetFormattedDialString(DialStringBuilder.ToString()); - else - return DialStringBuilder.ToString(); - - }); - DialStringFeedback.LinkInputSig(triList.StringInput[UIStringJoin.CodecAddressEntryText]); - - DialStringBackspaceVisibleFeedback = new BoolFeedback(() => DialStringBuilder.Length > 0); - DialStringBackspaceVisibleFeedback - .LinkInputSig(triList.BooleanInput[UIBoolJoin.VCKeypadBackspaceVisible]); - - SearchStringFeedback = new StringFeedback(() => - { - if (SearchStringBuilder.Length > 0) - { - Parent.Keyboard.EnableGoButton(); - return SearchStringBuilder.ToString(); - } - else - { - Parent.Keyboard.DisableGoButton(); - return "Tap for keyboard"; - } - }); - SearchStringFeedback.LinkInputSig(triList.StringInput[UIStringJoin.CodecDirectorySearchEntryText]); - - PasswordStringFeedback = new StringFeedback(() => - { - if (PasswordStringBuilder.Length > 0) - { - Parent.Keyboard.EnableGoButton(); - return PasswordStringBuilder.ToString(); - } - else - { - Parent.Keyboard.DisableGoButton(); - return ""; - } - }); - PasswordStringFeedback.LinkInputSig(triList.StringInput[UIStringJoin.PasswordPromptPasswordText]); - - SetupDirectoryList(); - - SearchStringBackspaceVisibleFeedback = new BoolFeedback(() => SearchStringBuilder.Length > 0); - SearchStringBackspaceVisibleFeedback.LinkInputSig(triList.BooleanInput[UIBoolJoin.VCDirectoryBackspaceVisible]); - - triList.SetSigFalseAction(UIBoolJoin.VCDirectoryBackPress, GetDirectoryParentFolderContents); - - DirectoryBackButtonVisibleFeedback = (codec as IHasDirectory).CurrentDirectoryResultIsNotDirectoryRoot; - DirectoryBackButtonVisibleFeedback - .LinkInputSig(triList.BooleanInput[UIBoolJoin.VCDirectoryBackVisible]); - - triList.SetSigFalseAction(UIBoolJoin.VCKeypadTextPress, RevealKeyboard); - - triList.SetSigFalseAction(UIBoolJoin.VCDirectorySearchTextPress, RevealKeyboard); - - triList.SetSigHeldAction(UIBoolJoin.VCDirectoryBackspacePress, 500, - StartSearchBackspaceRepeat, StopSearchBackspaceRepeat, SearchKeypadBackspacePress); - - - if (Codec is IPasswordPrompt) - { - SetupPasswordPrompt(); - } - - - // If the codec is ready, then get the values we want, otherwise wait - if (Codec.IsReady) - Codec_IsReady(); - else - codec.IsReadyChange += (o, a) => Codec_IsReady(); - } - catch (Exception e) - { - Debug.Console(1, "Exception in VideoCodecUiDriver Constructor: {0}", e); - } - } - - - /// - /// - /// - /// - /// - void Codec_IsReady() - { - SetupAddresses(); - - if(HeaderDriver.HeaderButtonsAreSetUp) - HeaderDriver.ComputeHeaderCallStatus(Codec); - - SetupCameraControls(); - } - - void SetupAddresses() - { - string roomContactNumbers = ""; - string roomPhoneNumber = ""; - string roomVideoAddress = ""; - - - Debug.Console(1, - @" - Codec.CodecInfo.IpAddress: {0} - Codec.CodecInfo.SipUri: {1} - Codec.CodecInfo.SipPhoneNumber: {2} - Codec.CodecInfo.E164Alias: {3} - Codec.CodecInfo.H323Id: {4} - ", Codec.CodecInfo.IpAddress, Codec.CodecInfo.SipUri, Codec.CodecInfo.SipPhoneNumber, Codec.CodecInfo.E164Alias, Codec.CodecInfo.H323Id); - - // Populate phone number - if (!string.IsNullOrEmpty(Codec.CodecInfo.SipUri)) // If both values are present, format the string with a pipe divider - { - roomPhoneNumber = Codec.CodecInfo.SipUri; - } - else if (!string.IsNullOrEmpty(Codec.CodecInfo.SipPhoneNumber)) // If only one value present, just show the phone number - { - roomPhoneNumber = GetFormattedPhoneNumber(Codec.CodecInfo.SipPhoneNumber); - } - - // Populate video number - if (!string.IsNullOrEmpty(Codec.CodecInfo.IpAddress)) - { - roomVideoAddress = Codec.CodecInfo.IpAddress; - } - else if (!string.IsNullOrEmpty(Codec.CodecInfo.E164Alias)) - { - roomVideoAddress = Codec.CodecInfo.E164Alias; - } - else if (!string.IsNullOrEmpty(Codec.CodecInfo.H323Id)) - { - roomVideoAddress = Codec.CodecInfo.H323Id; - } - - Debug.Console(1, - @" Room Contact Numbers: - Phone Number: {0} - Video Number: {1} - ", roomPhoneNumber, roomVideoAddress); - - if (!string.IsNullOrEmpty(roomPhoneNumber) && !string.IsNullOrEmpty(roomVideoAddress)) - { - roomContactNumbers = string.Format("{0} | {1}", roomPhoneNumber, roomVideoAddress); - } - else if (!string.IsNullOrEmpty(roomPhoneNumber)) - { - roomContactNumbers = roomPhoneNumber; - } - else if (!string.IsNullOrEmpty(roomVideoAddress)) - { - roomContactNumbers = roomVideoAddress; - } - - TriList.SetString(UIStringJoin.RoomAddressPipeText, roomContactNumbers); - TriList.SetString(UIStringJoin.RoomPhoneText, roomPhoneNumber); - TriList.SetString(UIStringJoin.RoomVideoAddressText, roomVideoAddress); - } - - /// - /// Handles status changes for calls - /// - /// - /// - void Codec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e) - { - var call = e.CallItem; - var meetingInfoSender = sender as IHasMeetingInfo; - - switch (e.CallItem.Status) - { - case eCodecCallStatus.Connected: - // fire at SRL item - Parent.ShowNotificationRibbon("Connected", 2000); - OnCallConnected(); - //VCControlsInterlock.ShowInterlocked(UIBoolJoin.VCKeypadVisible); - break; - case eCodecCallStatus.Connecting: - // fire at SRL item - Parent.ShowNotificationRibbon("Connecting", 0); - OnCallConnected(); - break; - case eCodecCallStatus.Dialing: - Parent.ShowNotificationRibbon("Connecting", 0); - break; - case eCodecCallStatus.Disconnected: - if (IncomingCallModal != null) - IncomingCallModal.HideDialog(); - if (!Codec.IsInCall) - { - KeypadMode = eKeypadMode.Dial; - // show keypad if we're in call UI mode - ShowKeypad(); - DialStringBuilder.Remove(0, DialStringBuilder.Length); - DialStringFeedback.FireUpdate(); - Parent.ShowNotificationRibbon("Disconnected", 2000); - Debug.Console(0, "Setting Connect Button mode to 0"); - } - - - break; - case eCodecCallStatus.Disconnecting: - break; - case eCodecCallStatus.EarlyMedia: - break; - case eCodecCallStatus.Idle: - break; - case eCodecCallStatus.OnHold: - break; - case eCodecCallStatus.Preserved: - break; - case eCodecCallStatus.RemotePreserved: - break; - case eCodecCallStatus.Ringing: - { - // fire up a modal - if( !Codec.CodecInfo.AutoAnswerEnabled && call.Direction == eCodecCallDirection.Incoming) - ShowIncomingModal(call); - break; - } - } - - if (meetingInfoSender != null && Codec.IsInCall) - { - var meetingInfo = meetingInfoSender.MeetingInfo; - - TriList.UShortInput[UIUshortJoin.VCStagingConnectButtonMode].UShortValue = - (ushort) (meetingInfo.IsSharingMeeting ? 2 : 1); - } - else - { - - TriList.UShortInput[UIUshortJoin.VCStagingConnectButtonMode].UShortValue = - (ushort) (Codec.IsInCall ? 1 : 0); - } - - uint stageJoin; - if (Codec.IsInCall) - stageJoin = UIBoolJoin.VCStagingActivePopoverVisible; - else - { - if (Codec is IHasCallHistory) - stageJoin = UIBoolJoin.VCStagingInactivePopoverWithRecentsVisible; - else - stageJoin = UIBoolJoin.VCStagingInactivePopoverWithoutRecentsVisible; - } - if (IsVisible) - StagingBarsInterlock.ShowInterlocked(stageJoin); - else - StagingBarsInterlock.SetButDontShow(stageJoin); - - HeaderDriver.ComputeHeaderCallStatus(Codec); - - // Update active call list - UpdateHeaderActiveCallList(); - } - - private void OnCallConnected() - { - HidePasswordPrompt(); - KeypadMode = eKeypadMode.DTMF; - DialStringBuilder.Remove(0, DialStringBuilder.Length); - DialStringFeedback.FireUpdate(); - DialStringTextCheckEnables(); - - StagingButtonsFeedbackInterlock.ShowInterlocked(UIBoolJoin.VCStagingKeypadPress); - ShowKeypad(); - - UnmuteRoomOnCallConnect(); - } - - private void UnmuteRoomOnCallConnect() - { - var volControl = Parent.CurrentRoom as IHasCurrentVolumeControls; - - if (volControl == null) - { - return; - } - var currentVolControls = volControl.CurrentVolumeControls as IBasicVolumeWithFeedback; - - if (currentVolControls != null) - { - currentVolControls.MuteOff(); - } - } - - /// - /// Redraws the calls list on the header - /// - void UpdateHeaderActiveCallList() - { - var activeList = Codec.ActiveCalls.Where(c => c.IsActiveCall).ToList(); - ActiveCallsSRL.Clear(); - ushort i = 1; - foreach (var c in activeList) - { - //var item = new SubpageReferenceListItem(1, ActiveCallsSRL); - ActiveCallsSRL.StringInputSig(i, 1).StringValue = c.Name; - ActiveCallsSRL.StringInputSig(i, 2).StringValue = c.Number; - ActiveCallsSRL.StringInputSig(i, 3).StringValue = c.Status.ToString(); - ActiveCallsSRL.StringInputSig(i, 4).StringValue = string.Format("Participant {0}", i); - ActiveCallsSRL.UShortInputSig(i, 1).UShortValue = (ushort)(c.Type == eCodecCallType.Video ? 2 : 1); - var cc = c; // for scope in lambda - ActiveCallsSRL.GetBoolFeedbackSig(i, 1).SetSigFalseAction(() => Codec.EndCall(cc)); - i++; - } - ActiveCallsSRL.Count = (ushort)activeList.Count; - - // If Active Calls list is visible and codec is not in a call, hide the list - if (!Codec.IsInCall && Parent.PopupInterlock.CurrentJoin == Parent.CallListOrMeetingInfoPopoverVisibilityJoin) - Parent.PopupInterlock.ShowInterlockedWithToggle(Parent.CallListOrMeetingInfoPopoverVisibilityJoin); - } - - /// - /// - /// - void ShowIncomingModal(CodecActiveCallItem call) - { - Debug.Console(1, "Showing Incoming Call Modal"); - - (Parent as IAVWithVCDriver).PrepareForCodecIncomingCall(); - IncomingCallModal = new ModalDialog(TriList); - string msg; - string icon; - if (call.Type == eCodecCallType.Audio) - { - icon = "Phone"; - msg = string.Format("Incoming phone call from: {0}", call.Name); - } - else - { - icon = "Camera"; - msg = string.Format("Incoming video call from: {0}", call.Name); - } - - - // Hide screensaver - var screenSaverParent = Parent.Parent as IHasScreenSaverController; - - if (screenSaverParent != null) - { - screenSaverParent.ScreenSaverController.Hide(); - } - else - { - Debug.Console(1, "Parent.Parent is null or does not implement IHasScreenSaverController"); - } - - - IncomingCallModal.PresentModalDialog(2, "Incoming Call", icon, msg, - "Ignore", "Accept", false, false, b => - { - if (b == 1) - Codec.RejectCall(call); - else //2 - AcceptIncomingCall(call); - IncomingCallModal = null; - }); - } - - /// - /// - /// - void AcceptIncomingCall(CodecActiveCallItem call) - { - (Parent as IAVWithVCDriver).PrepareForCodecIncomingCall(); - (Parent as IAVWithVCDriver).ActivityCallButtonPressed(); - Codec.AcceptCall(call); - } - - /// - /// - /// - public override void Show() - { - VCControlsInterlock.Show(); - StagingBarsInterlock.Show(); - DialStringFeedback.FireUpdate(); - base.Show(); - } - - /// - /// - /// - public override void Hide() - { - VCControlsInterlock.Hide(); - StagingBarsInterlock.Hide(); - base.Hide(); - } - - /// - /// Builds the call stage - /// - void SetupCallStagingPopover() - { - TriList.SetSigFalseAction(UIBoolJoin.VCStagingDirectoryPress, ShowDirectory); - TriList.SetSigFalseAction(UIBoolJoin.VCStagingKeypadPress, ShowKeypad); - TriList.SetSigFalseAction(UIBoolJoin.VCStagingRecentsPress, ShowRecents); - TriList.SetSigFalseAction(UIBoolJoin.VCStagingCameraPress, ShowCameraControls); - TriList.SetSigFalseAction(UIBoolJoin.VCStagingConnectPress, ConnectPress); - TriList.SetSigFalseAction(UIBoolJoin.VCStagingMeetNowPress, MeetNowPress); - TriList.SetSigFalseAction(UIBoolJoin.CallStopSharingPress, CallStopSharingPress); - - var meetingInfoCodec = Codec as IHasMeetingInfo; - - TriList.SetSigFalseAction(UIBoolJoin.CallEndPress, () => - { - if (Codec.ActiveCalls.Count > 1) - { - Parent.PopupInterlock.ShowInterlocked(Parent.CallListOrMeetingInfoPopoverVisibilityJoin); - } - else if (meetingInfoCodec != null && Codec.ActiveCalls.Count == 1) - { - var meetingInfo = meetingInfoCodec.MeetingInfo; - - if (meetingInfo != null && meetingInfo.IsSharingMeeting) - { - var presentationMeetingCodec = Codec as IHasPresentationOnlyMeeting; - if (presentationMeetingCodec != null) - { - presentationMeetingCodec.StartNormalMeetingFromSharingOnlyMeeting(); - } - } - else - { - Codec.EndAllCalls(); - } - } - else - { - Codec.EndAllCalls(); - } - }); - - TriList.SetSigFalseAction(UIBoolJoin.CallEndAllConfirmPress, () => - { - Parent.PopupInterlock.HideAndClear(); - Codec.EndAllCalls(); - }); - - - if (meetingInfoCodec != null) - { - TriList.SetSigFalseAction(UIBoolJoin.MeetingLeavePress, () => - { - Parent.PopupInterlock.HideAndClear(); - - if (meetingInfoCodec.MeetingInfo.IsHost) - { - Codec.EndAllCalls(); - } - else - { - var startMeetingCodec = Codec as IHasStartMeeting; - if (startMeetingCodec != null) - { - startMeetingCodec.LeaveMeeting(); - } - } - }); - } - } - - void SetupCameraControls() - { - CameraPtzPad = new SmartObjectDPad(TriList.SmartObjects[UISmartObjectJoin.VCCameraDpad], true); - - // If the codec supports camera auto or off, we need to show the mode selector subpage - ShowCameraModeControls = Codec is IHasCameraAutoMode || Codec is IHasCameraOff; - - if (ShowCameraModeControls) - { - CameraModeList = new SmartObjectDynamicList(TriList.SmartObjects[UISmartObjectJoin.VCCameraMode], true, 0); - - VCControlsInterlock.StatusChanged += new EventHandler(VCControlsInterlock_StatusChanged); - - var codecOffCameras = Codec as IHasCameraOff; - - var supportsCameraOffMode = Codec.SupportsCameraOff; - - var codecAutoCameras = Codec as IHasCameraAutoMode; - - var supportsAutoCameraMode = Codec.SupportsCameraAutoMode; - - if (codecAutoCameras != null && supportsAutoCameraMode) - { - - CameraModeList.SetItemButtonAction(1,(b) => codecAutoCameras.CameraAutoModeOn()); - TriList.SmartObjects[UISmartObjectJoin.VCCameraMode].BooleanInput["Item 1 Visible"].BoolValue = true; - codecAutoCameras.CameraAutoModeIsOnFeedback.LinkInputSig(CameraModeList.SmartObject.BooleanInput["Item 1 Selected"]); - codecAutoCameras.CameraAutoModeIsOnFeedback.LinkInputSig(TriList.BooleanInput[UIBoolJoin.VCCameraAutoModeIsOnFb]); - //TriList.SmartObjects[UISmartObjectJoin.VCCameraMode].BooleanOutput["Item 1 Pressed"].SetSigFalseAction( - //() => codecAutoCameras.CameraAutoModeOn()); - - - codecAutoCameras.CameraAutoModeIsOnFeedback.OutputChange += (o, a) => - { - if (a.BoolValue) - { - SetCameraManualModeButtonFeedback(false); - - if (VCControlsInterlock.CurrentJoin == UIBoolJoin.VCCameraModeBarVisible) - { - VCCameraControlModeInterlock.ShowInterlocked(UIBoolJoin.VCCameraAutoVisible); - } - else - { - VCCameraControlModeInterlock.SetButDontShow(UIBoolJoin.VCCameraAutoVisible); - } - } - else - { - ShowCameraManualMode(); - } - - }; - - } - - // Manual button always visible - CameraModeList.SetItemButtonAction(2, (b) => ShowCameraManualMode()); - - TriList.SmartObjects[UISmartObjectJoin.VCCameraMode].BooleanInput["Item 2 Visible"].BoolValue = true; - //TriList.SmartObjects[UISmartObjectJoin.VCCameraMode].BooleanOutput["Item 2 Pressed"].SetSigFalseAction( - // () => ShowCameraManualMode()); - - if (codecOffCameras != null && supportsCameraOffMode) - { - - TriList.SmartObjects[UISmartObjectJoin.VCCameraMode].BooleanInput["Item 3 Visible"].BoolValue = true; - codecOffCameras.CameraIsOffFeedback.LinkInputSig(CameraModeList.SmartObject.BooleanInput["Item 3 Selected"]); - CameraModeList.SetItemButtonAction(3, (b) => codecOffCameras.CameraOff()); - //TriList.SmartObjects[UISmartObjectJoin.VCCameraMode].BooleanOutput["Item 3 Pressed"].SetSigFalseAction( - // () => codecOffCameras.CameraOff()); - - codecOffCameras.CameraIsOffFeedback.OutputChange += (o, a) => - { - if (a.BoolValue) - { - SetCameraManualModeButtonFeedback(false); - - if (VCControlsInterlock.CurrentJoin == UIBoolJoin.VCCameraModeBarVisible) - { - VCCameraControlModeInterlock.ShowInterlocked(UIBoolJoin.VCCameraOffVisible); - } - else - { - VCCameraControlModeInterlock.SetButDontShow(UIBoolJoin.VCCameraOffVisible); - } - } - else - { - ShowCameraManualMode(); - } - - }; - - } - } - - var camerasCodec = Codec as IHasCameras; - - if(camerasCodec != null) - { - //CameraSelectList = new SmartObjectDynamicList(TriList.SmartObjects[UISmartObjectJoin.VCCameraSelect], true, 0); - - var so = TriList.SmartObjects[UISmartObjectJoin.VCCameraSelect]; - - so.SigChange += SmartObject_SigChange; - - for (uint i = 1; i <= camerasCodec.Cameras.Count; i++) - { - var cameraKey = camerasCodec.Cameras[(int)i - 1].Key; - Debug.Console(1, "Setting up action for Camera {0} with Key: {1} for button Item {0} Pressed", i, cameraKey); - - //TODO: Fix camera selection action. For some reson this action doesn't execute when the buttons are pressed - - var sig = so.BooleanOutput[String.Format("Item {0} Pressed", i)]; - - so.BooleanOutput[string.Format("Item {0} Pressed", i)].SetSigFalseAction( - () => camerasCodec.SelectCamera(cameraKey)); - } - - so.UShortInput["Set Number of Items"].UShortValue = (ushort)camerasCodec.Cameras.Count; - //TriList.SmartObjects[UISmartObjectJoin.VCCameraSelect].UShortOutput["Item Clicked"].SetUShortSigAction( - // (u) => - // { - // var cameraKey = camerasCodec.Cameras[u - 1].Key; - // Debug.Console(1, "Selecting Camera {0} with Key: {1}", u, cameraKey); - // camerasCodec.SelectCamera(cameraKey); - // }); - - - // Set the names for the cameras - for (int i = 1; i <= camerasCodec.Cameras.Count; i++) - { - so.StringInput[string.Format("Set Item {0} Text", i)].StringValue = camerasCodec.Cameras[i - 1].Name; - } - - SetCameraSelectedFeedback(); - camerasCodec.CameraSelected += camerasCodec_CameraSelected; - MapCameraActions(); - } - - SetupPresets(); - - } - - void SmartObject_SigChange(GenericBase currentDevice, SmartObjectEventArgs args) - { - var uo = args.Sig.UserObject; - if (uo is Action) - (uo as Action)(args.Sig.BoolValue); - else if (uo is Action) - (uo as Action)(args.Sig.UShortValue); - else if (uo is Action) - (uo as Action)(args.Sig.StringValue); - } - - void VCControlsInterlock_StatusChanged(object sender, StatusChangedEventArgs e) - { - // Need to hide the camera mode interlock if the mode bar gets hidden - if (e.PreviousJoin == UIBoolJoin.VCCameraModeBarVisible) - VCCameraControlModeInterlock.Hide(); - - // These deal with hiding/showing the camera select bar if no mode controls are visible (tied to manual controls being visible) - if(!ShowCameraModeControls) - { - if(e.PreviousJoin == UIBoolJoin.VCCameraManualVisible) - TriList.SetBool(UIBoolJoin.VCCameraSelectBarWithoutModeVisible, false); - - if (e.NewJoin == UIBoolJoin.VCCameraManualVisible) - TriList.SetBool(UIBoolJoin.VCCameraSelectBarWithoutModeVisible, true); - } - - - } - - - /// - /// Shows the preset saved label for 2 seconds - /// - void ShowPresetStoreFeedback() - { - TriList.BooleanInput[UIBoolJoin.VCCameraPresetSavedLabelVisible].BoolValue = true; - - var timer = new CTimer((o) => TriList.BooleanInput[UIBoolJoin.VCCameraPresetSavedLabelVisible].BoolValue = false, 2000); - } - - void presetsCodec_CodecRoomPresetsListHasChanged(object sender, EventArgs e) - { - SetupPresets(); - } - - - void camerasCodec_CameraSelected(object sender, CameraSelectedEventArgs e) - { - MapCameraActions(); - - SetCameraSelectedFeedback(); - } - - /// - /// Set the feedback for the button of the selected camera - /// - void SetCameraSelectedFeedback() - { - var camerasCodec = Codec as IHasCameras; - - for (int i = 1; i <= camerasCodec.Cameras.Count; i++) - { - var cameraSelected = camerasCodec.SelectedCameraFeedback.StringValue; - var state = false; - if (cameraSelected == camerasCodec.Cameras[i - 1].Key) - { - state = true; - } - - TriList.SmartObjects[UISmartObjectJoin.VCCameraSelect].BooleanInput[string.Format("Item {0} Selected", i)].BoolValue = state; - } - - } - - void SetupPresets() - { - var presetsCodec = Codec as IHasCodecRoomPresets; - if (presetsCodec != null) - { - uint holdTime = 5000; - presetsCodec.CodecRoomPresetsListHasChanged += new EventHandler(presetsCodec_CodecRoomPresetsListHasChanged); - - var preset = 1; - if (presetsCodec.NearEndPresets[preset - 1] != null && presetsCodec.NearEndPresets[preset - 1].Defined) - { - TriList.SetBool(UIBoolJoin.VCCameraPreset1Visible, true); - TriList.BooleanOutput[UIBoolJoin.VCCameraPreset1].SetSigHeldAction( - holdTime, ShowPresetStoreFeedback,() => presetsCodec.CodecRoomPresetStore(preset, presetsCodec.NearEndPresets[preset - 1].Description), - () => presetsCodec.CodecRoomPresetSelect(preset)); - TriList.StringInput[UIStringJoin.VCCameraPresetLabel1].StringValue = presetsCodec.NearEndPresets[preset - 1].Description; - } - else - { - TriList.SetBool(UIBoolJoin.VCCameraPreset1Visible, false); - } - - if (presetsCodec.NearEndPresets[1] != null && presetsCodec.NearEndPresets[1].Defined) - { - TriList.SetBool(UIBoolJoin.VCCameraPreset2Visible, true); - TriList.BooleanOutput[UIBoolJoin.VCCameraPreset2].SetSigHeldAction( - holdTime, ShowPresetStoreFeedback, () => presetsCodec.CodecRoomPresetStore(preset, presetsCodec.NearEndPresets[preset - 1].Description), - () => presetsCodec.CodecRoomPresetSelect(preset)); - TriList.StringInput[UIStringJoin.VCCameraPresetLabel2].StringValue = presetsCodec.NearEndPresets[1].Description; - } - else - { - TriList.SetBool(UIBoolJoin.VCCameraPreset2Visible, false); - } - - if (presetsCodec.NearEndPresets[2] != null && presetsCodec.NearEndPresets[2].Defined) - { - TriList.SetBool(UIBoolJoin.VCCameraPreset3Visible, true); - TriList.BooleanOutput[UIBoolJoin.VCCameraPreset3].SetSigHeldAction( - holdTime, ShowPresetStoreFeedback, () => presetsCodec.CodecRoomPresetStore(preset, presetsCodec.NearEndPresets[preset - 1].Description), - () => presetsCodec.CodecRoomPresetSelect(preset)); - TriList.StringInput[UIStringJoin.VCCameraPresetLabel3].StringValue = presetsCodec.NearEndPresets[2].Description; - } - else - { - TriList.SetBool(UIBoolJoin.VCCameraPreset3Visible, false); - } - } - } - - /// - /// Maps button actions to the selected camera - /// - void MapCameraActions() - { - // Now we setup the button actions for the manual controls - var camerasCodec = Codec as IHasCameras; - - if (camerasCodec != null && camerasCodec.SelectedCamera != null) - { - Debug.Console(2, "Attempting to map camera actions to selected camera: '{0}'", camerasCodec.SelectedCamera.Key); - var dpad = CameraPtzPad; - - var camera = camerasCodec.SelectedCamera as IHasCameraPtzControl; - if (camera != null) - { - - Debug.Console(2, "Selected camera is IHasCameraPtzControl"); - if (camerasCodec.SelectedCamera.CanTilt) - { - dpad.SigUp.SetBoolSigAction((b) => - { - if (b) - camera.TiltUp(); - else - camera.TiltStop(); - }); - dpad.SigDown.SetBoolSigAction((b) => - { - if (b) - camera.TiltDown(); - else - camera.TiltStop(); - }); - } - - if (camerasCodec.SelectedCamera.CanPan) - { - dpad.SigLeft.SetBoolSigAction((b) => - { - if (b) - camera.PanLeft(); - else - camera.PanStop(); - }); - dpad.SigRight.SetBoolSigAction((b) => - { - if (b) - camera.PanRight(); - else - camera.PanStop(); - }); - } - - - //dpad.SigCenter.SetSigFalseAction(() => camera.PositionHome()); - - //var homeButton = dpad.BooleanOutput["Home"]; - //if (homeButton != null) - //{ - // homeButton.SetSigFalseAction(() => camera.PositionHome()); - //} - - if (camerasCodec.SelectedCamera.CanZoom) - { - TriList.BooleanOutput[UIBoolJoin.VCCameraZoomIn].SetBoolSigAction((b) => - { - if (b) - camera.ZoomIn(); - else - camera.ZoomStop(); - }); - TriList.BooleanOutput[UIBoolJoin.VCCameraZoomOut].SetBoolSigAction((b) => - { - if (b) - camera.ZoomOut(); - else - camera.ZoomStop(); - }); - } - - } - else - { - Debug.Console(2, "Selected Camera is not IHasCameraPtzControl. No controls to map"); - } - } - else - { - Debug.Console(2, "Codec does not have cameras of selected camera is null"); - } - } - - // Determines if codec is in manual camera control mode and shows feedback - void ShowCameraManualMode() - { - Debug.Console(2, "ShowCameraManualMode"); - - var inManualMode = true; - - var codecOffCameras = Codec as IHasCameraOff; - - var codecAutoCameras = Codec as IHasCameraAutoMode; - - var supportsAutoCameras = codecAutoCameras != null && Codec.SupportsCameraAutoMode; - - if (codecOffCameras != null && codecOffCameras.CameraIsOffFeedback.BoolValue) - { - inManualMode = false; - - var codecCameraMute = Codec as IHasCameraMute; - - if (codecCameraMute != null) - { - codecCameraMute.CameraMuteOff(); - inManualMode = true; - - } - } - - // Clear auto mode - if (supportsAutoCameras) - { - if (codecAutoCameras.CameraAutoModeIsOnFeedback.BoolValue) - { - codecAutoCameras.CameraAutoModeOff(); - inManualMode = true; - } - } - - if (inManualMode) - { - VCCameraControlModeInterlock.SetButDontShow(UIBoolJoin.VCCameraManualVisible); - - if (VCControlsInterlock.CurrentJoin == UIBoolJoin.VCCameraModeBarVisible) - VCCameraControlModeInterlock.Show(); - } - - SetCameraManualModeButtonFeedback(inManualMode); - - } - - void SetCameraManualModeButtonFeedback(bool state) - { - // Set button feedback for manual mode - TriList.SmartObjects[UISmartObjectJoin.VCCameraMode].BooleanInput["Item 2 Selected"].BoolValue = state; - } - - /// - /// - /// - void SetupDialKeypad() - { - if(TriList.SmartObjects.Contains(UISmartObjectJoin.VCDialKeypad)) - { - DialKeypad = new SmartObjectNumeric(TriList.SmartObjects[UISmartObjectJoin.VCDialKeypad], true); - DialKeypad.Digit0.SetSigFalseAction(() => DialKeypadPress("0")); - DialKeypad.Digit1.SetSigFalseAction(() => DialKeypadPress("1")); - DialKeypad.Digit2.SetSigFalseAction(() => DialKeypadPress("2")); - DialKeypad.Digit3.SetSigFalseAction(() => DialKeypadPress("3")); - DialKeypad.Digit4.SetSigFalseAction(() => DialKeypadPress("4")); - DialKeypad.Digit5.SetSigFalseAction(() => DialKeypadPress("5")); - DialKeypad.Digit6.SetSigFalseAction(() => DialKeypadPress("6")); - DialKeypad.Digit7.SetSigFalseAction(() => DialKeypadPress("7")); - DialKeypad.Digit8.SetSigFalseAction(() => DialKeypadPress("8")); - DialKeypad.Digit9.SetSigFalseAction(() => DialKeypadPress("9")); - DialKeypad.Misc1SigName = "*"; - DialKeypad.Misc1.SetSigFalseAction(() => DialKeypadPress("*")); - DialKeypad.Misc2SigName = "#"; - DialKeypad.Misc2.SetSigFalseAction(() => DialKeypadPress("#")); - //TriList.SetSigFalseAction(UIBoolJoin.VCKeypadBackspacePress, DialKeypadBackspacePress); - TriList.SetSigHeldAction(UIBoolJoin.VCKeypadBackspacePress, 500, - StartBackspaceRepeat, StopBackspaceRepeat, DialKeypadBackspacePress); - } - else - Debug.Console(0, "Trilist {0:x2}, VC dial keypad object {1} not found. Check SGD file or VTP", - TriList.ID, UISmartObjectJoin.VCDialKeypad); - } - - /// - /// - /// - void SetupRecentCallsList() - { - var codec = Codec as IHasCallHistory; - if (codec != null) - { - codec.CallHistory.RecentCallsListHasChanged += (o, a) => RefreshRecentCallsList(); - // EVENT??????????????? Pointed at refresh - RecentCallsList = new SmartObjectDynamicList(TriList.SmartObjects[UISmartObjectJoin.VCRecentsList], true, 1200); - RefreshRecentCallsList(); - } - } - - /// - /// - /// - void RefreshRecentCallsList() - { - var codec = Codec as IHasCallHistory; - uint textOffset = 1200; - uint timeTextOffset = 1230; - if (codec != null) - { - ushort i = 0; - foreach (var c in codec.CallHistory.RecentCalls) - { - i++; - TriList.SetString(textOffset + i, c.Name); - // if it's today, show a simpler string - string timeText = null; - if (c.StartTime.Date == DateTime.Now.Date) - timeText = c.StartTime.ToString("t", Global.Culture); - else if (c.StartTime == DateTime.MinValue) - timeText = ""; - else - timeText = c.StartTime.ToString(); - TriList.SetString(timeTextOffset + i, timeText); - - string iconName = null; - if (c.OccurrenceType == eCodecOccurrenceType.Received) - iconName = "Misc-18_Light"; - else if (c.OccurrenceType == eCodecOccurrenceType.Placed) - iconName = "Misc-17_Light"; - else - iconName = "Delete"; - RecentCallsList.SetItemIcon(i, iconName); - - var call = c; // for lambda scope - RecentCallsList.SetItemButtonAction(i, b => { if(!b) Codec.Dial(call.Number); }); - } - RecentCallsList.Count = i; - } - } - - /// - /// - /// - void SetupFavorites() - { - var c = Codec as IHasCallFavorites; - if (c != null && c.CallFavorites != null) - { - CodecHasFavorites = true; - var favs = c.CallFavorites.Favorites; - for (uint i = 0; i <= 3; i++) - { - if (i < favs.Count) - { - var fav = favs[(int)i]; - TriList.SetString(UIStringJoin.VCFavoritesStart + i, fav.Name); - TriList.SetBool(UIBoolJoin.VCFavoriteVisibleStart + i, true); - TriList.SetSigFalseAction(UIBoolJoin.VCFavoritePressStart + i, () => - { - Codec.Dial(fav.Number); - }); - } - else - TriList.SetBool(UIBoolJoin.VCFavoriteVisibleStart + i, false); - } - } - } - - /// - /// - /// - void SetupDirectoryList() - { - var codec = Codec as IHasDirectory; - if (codec == null) - { - return; - } - - DirectoryList = new SmartObjectDynamicList(TriList.SmartObjects[UISmartObjectJoin.VCDirectoryList], - true, 1300); - codec.DirectoryResultReturned += dir_DirectoryResultReturned; - - if (codec.PhonebookSyncState.InitialSyncComplete) - SetCurrentDirectoryToRoot(); - else - { - codec.PhonebookSyncState.InitialSyncCompleted += PhonebookSyncState_InitialSyncCompleted; - } - } - - /// - /// Sets the current directory results to the DirectoryRoot and updates Back Button visibiltiy - /// - void SetCurrentDirectoryToRoot() - { - var hasDirectory = Codec as IHasDirectory; - - if (hasDirectory == null) - { - return; - } - - hasDirectory.SetCurrentDirectoryToRoot(); - SearchKeypadClear(); - } - - /// - /// Setup the Directory list when notified that the initial phonebook sync is completed - /// - /// - /// - void PhonebookSyncState_InitialSyncCompleted(object sender, EventArgs e) - { - var codec = Codec as IHasDirectory; - - if (codec == null) - { - return; - } - - if (!codec.CurrentDirectoryResultIsNotDirectoryRoot.BoolValue) - { - return; - } - - SetCurrentDirectoryToRoot(); - } - - /// - /// - /// - /// - /// - void dir_DirectoryResultReturned(object sender, DirectoryEventArgs e) - { - RefreshDirectory(e.Directory); - } - - /// - /// Helper method to retrieve directory folder contents and store last requested folder id - /// - /// - void GetDirectoryFolderContents(DirectoryFolder folder) - { - (Codec as IHasDirectory).GetDirectoryFolderContents(folder.FolderId); - - } - - /// - /// Request the parent folder contents or sets back to the root if no parent folder - /// - void GetDirectoryParentFolderContents() - { - var codec = Codec as IHasDirectory; - - if (codec != null) - { - codec.GetDirectoryParentFolderContents(); - - //RefreshDirectory(); - } - - } - - /// - /// - /// - void RefreshDirectory() - { - var codec = Codec as IHasDirectory; - - if (codec == null) - { - return; - } - - RefreshDirectory(codec.CurrentDirectoryResult); - } - - void RefreshDirectory(CodecDirectory directory) - { - if (directory.CurrentDirectoryResults.Count > 0) - { - ushort i = 0; - foreach (var r in directory.CurrentDirectoryResults) - { - if (i == DirectoryList.MaxCount) - { - break; - } - - i++; - - if (r is DirectoryContact) - { - DirectoryList.SetItemMainText(i, r.Name); - - var dc = r as DirectoryContact; - - if (dc.ContactMethods.Count > 1) - { - // If more than one contact method, show contact method modal dialog - DirectoryList.SetItemButtonAction(i, b => - { - if (b) - { - return; - } - // Refresh the contact methods list - RefreshContactMethodsModalList(dc); - Parent.PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.MeetingsOrContacMethodsListVisible); - }); - - } - else if (dc.ContactMethods.Count == 1) - { - var invitableContact = dc as IInvitableContact; - - if (invitableContact != null) - { - DirectoryList.SetItemButtonAction(i, b => { if (!b) Codec.Dial(invitableContact); }); - } - else - { - // If only one contact method, just dial that method - DirectoryList.SetItemButtonAction(i, b => { if (!b) Codec.Dial(dc.ContactMethods[0].Number); }); - } - } - else - { - Debug.Console(1, "Unable to dial contact. No availble ContactMethod(s) specified"); - } - } - else // is DirectoryFolder - { - DirectoryList.SetItemMainText(i, string.Format("[+] {0}", r.Name)); - - var df = r as DirectoryFolder; - - DirectoryList.SetItemButtonAction(i, b => - { - if (!b) - { - GetDirectoryFolderContents(df); - // will later call event handler after folder contents retrieved - } - }); - } - } - DirectoryList.Count = i; - } - else // No results in directory, display message to user - { - DirectoryList.Count = 1; - - DirectoryList.SetItemMainText(1, "No Results Found"); - } - } - - void RefreshContactMethodsModalList(DirectoryContact contact) - { - TriList.SetString(UIStringJoin.MeetingsOrContactMethodListIcon, "Users"); - TriList.SetString(UIStringJoin.MeetingsOrContactMethodListTitleText, "Contact Methods"); - - ushort i = 0; - foreach (var c in contact.ContactMethods) - { - i++; - Parent.MeetingOrContactMethodModalSrl.StringInputSig(i, 1).StringValue = c.Device.ToString(); - Parent.MeetingOrContactMethodModalSrl.StringInputSig(i, 2).StringValue = c.CallType.ToString(); - Parent.MeetingOrContactMethodModalSrl.StringInputSig(i, 3).StringValue = c.Number; - Parent.MeetingOrContactMethodModalSrl.StringInputSig(i, 4).StringValue = ""; - Parent.MeetingOrContactMethodModalSrl.StringInputSig(i, 5).StringValue = "Connect"; - Parent.MeetingOrContactMethodModalSrl.BoolInputSig(i, 2).BoolValue = true; - var cc = c; // to maintian lambda scope - Parent.MeetingOrContactMethodModalSrl.GetBoolFeedbackSig(i, 1).SetSigFalseAction(() => - { - Parent.PopupInterlock.Hide(); - var codec = Codec as VideoCodecBase; - if (codec != null) - codec.Dial(cc.Number); - }); - } - Parent.MeetingOrContactMethodModalSrl.Count = i; - - } - - /// - /// - /// - void SetupLayoutControls() - { - TriList.SetSigFalseAction(UIBoolJoin.VCStagingSelfViewLayoutPress, this.ShowSelfViewLayout); - var svc = Codec as IHasCodecSelfView; - if (svc != null) - { - TriList.SetSigFalseAction(UIBoolJoin.VCSelfViewTogglePress, svc.SelfViewModeToggle); - svc.SelfviewIsOnFeedback.LinkInputSig(TriList.BooleanInput[UIBoolJoin.VCSelfViewTogglePress]); - } - var lc = Codec as IHasCodecLayouts; - if (lc != null) - { - - lc.LocalLayoutFeedback.LinkInputSig(TriList.StringInput[UIStringJoin.VCLayoutModeText]); - lc.LocalLayoutFeedback.OutputChange += (o,a) => - { - TriList.BooleanInput[UIBoolJoin.VCLayoutTogglePress].BoolValue = - lc.LocalLayoutFeedback.StringValue == "Prominent"; - }; - - - // attach to cisco special things to enable buttons - var cisco = Codec as PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.CiscoSparkCodec; - if (cisco != null) - { - TriList.SetSigFalseAction(UIBoolJoin.VCLayoutTogglePress, lc.LocalLayoutToggleSingleProminent); - // Cisco has min/max buttons that need special sauce - cisco.SharingContentIsOnFeedback.OutputChange += CiscoSharingAndPresentation_OutputChanges; - //cisco.PresentationViewMaximizedFeedback.OutputChange += CiscoSharingAndPresentation_OutputChanges; - - TriList.SetSigFalseAction(UIBoolJoin.VCMinMaxPress, cisco.MinMaxLayoutToggle); - } - - var zoomRoom = Codec as PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom.ZoomRoom; - if (zoomRoom != null) - { - TriList.BooleanInput[UIBoolJoin.VCLayoutToggleEnable].BoolValue = true; - TriList.SetSigFalseAction(UIBoolJoin.VCLayoutTogglePress, lc.LocalLayoutToggle); - } - - } - - - } - - /// - /// This should only be linked by cisco classes (spark initially) - /// - /// - /// - void CiscoSharingAndPresentation_OutputChanges(object sender, EventArgs e) - { - var cisco = Codec as PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.CiscoSparkCodec; - if (cisco != null) - { - var sharingNear = cisco.SharingContentIsOnFeedback.BoolValue; - - var sharingFar = cisco.FarEndIsSharingContentFeedback.BoolValue; - //set feedback and enables - TriList.BooleanInput[UIBoolJoin.VCMinMaxEnable].BoolValue = sharingNear; - TriList.BooleanInput[UIBoolJoin.VCLayoutToggleEnable].BoolValue = sharingNear || sharingFar; - TriList.BooleanInput[UIBoolJoin.VCMinMaxPress].BoolValue = sharingNear; - } - } - - /// - /// - /// - void RevealKeyboard() - { - if (_passwordPromptDialogVisible) - { - Debug.Console(2, "Attaching Keyboard to PasswordPromptDialog"); - DetachDialKeyboard(); - DetachSearchKeyboard(); - var kb = Parent.Keyboard; - kb.KeyPress -= Keyboard_PasswordKeyPress; - kb.KeyPress += Keyboard_PasswordKeyPress; - kb.HideAction = this.DetachPasswordKeyboard; - kb.GoButtonText = "Submit"; - kb.GoButtonVisible = true; - PasswordStringCheckEnables(); - kb.Show(); - } - else if (VCControlsInterlock.CurrentJoin == UIBoolJoin.VCKeypadWithFavoritesVisible && KeypadMode == eKeypadMode.Dial) - { - var kb = Parent.Keyboard; - kb.KeyPress -= Keyboard_DialKeyPress; - kb.KeyPress += Keyboard_DialKeyPress; - kb.HideAction = this.DetachDialKeyboard; - kb.GoButtonText = "Connect"; - kb.GoButtonVisible = true; - DialStringTextCheckEnables(); - kb.Show(); - } - else if(VCControlsInterlock.CurrentJoin == UIBoolJoin.VCDirectoryVisible) - { - var kb = Parent.Keyboard; - kb.KeyPress -= Keyboard_SearchKeyPress; - kb.KeyPress += Keyboard_SearchKeyPress; - kb.HideAction = this.DetachSearchKeyboard; - kb.GoButtonText = "Search"; - kb.GoButtonVisible = true; - SearchStringKeypadCheckEnables(); - kb.Show(); - } - - } - - /// - /// Event handler for keyboard dialing - /// - void Keyboard_DialKeyPress(object sender, PepperDash.Essentials.Core.Touchpanels.Keyboards.KeyboardControllerPressEventArgs e) - { - if (VCControlsInterlock.CurrentJoin == UIBoolJoin.VCKeypadWithFavoritesVisible && KeypadMode == eKeypadMode.Dial) - { - if (e.Text != null) - DialStringBuilder.Append(e.Text); - else - { - if (e.SpecialKey == KeyboardSpecialKey.Backspace) - DialKeypadBackspacePress(); - else if (e.SpecialKey == KeyboardSpecialKey.Clear) - DialKeypadClear(); - else if (e.SpecialKey == KeyboardSpecialKey.GoButton) - { - ConnectPress(); - } - } - DialStringFeedback.FireUpdate(); - DialStringTextCheckEnables(); - } - } - - /// - /// Event handler for keyboard directory searches - /// - /// - /// - void Keyboard_SearchKeyPress(object sender, KeyboardControllerPressEventArgs e) - { - if (VCControlsInterlock.CurrentJoin == UIBoolJoin.VCDirectoryVisible) - { - if (e.Text != null) - SearchStringBuilder.Append(e.Text); - else - { - if (e.SpecialKey == KeyboardSpecialKey.Backspace) - SearchKeypadBackspacePress(); - else if (e.SpecialKey == KeyboardSpecialKey.Clear) - SearchKeypadClear(); - else if (e.SpecialKey == KeyboardSpecialKey.GoButton) - { - SearchPress(); - Parent.Keyboard.Hide(); - } - } - SearchStringFeedback.FireUpdate(); - SearchStringKeypadCheckEnables(); - } - } - - /// - /// Event handler for keyboard dialing - /// - void Keyboard_PasswordKeyPress(object sender, PepperDash.Essentials.Core.Touchpanels.Keyboards.KeyboardControllerPressEventArgs e) - { - if (_passwordPromptDialogVisible) - { - if (e.Text != null) - PasswordStringBuilder.Append(e.Text); - else - { - if (e.SpecialKey == KeyboardSpecialKey.Backspace) - PasswordKeypadBackspacePress(); - else if (e.SpecialKey == KeyboardSpecialKey.Clear) - PasswordKeypadClear(); - else if (e.SpecialKey == KeyboardSpecialKey.GoButton) - { - (Codec as IPasswordPrompt).SubmitPassword(PasswordStringBuilder.ToString()); - HidePasswordPrompt(); - } - } - PasswordStringFeedback.FireUpdate(); - PasswordStringCheckEnables(); - } - } - - /// - /// Call - /// - void DetachDialKeyboard() - { - Parent.Keyboard.KeyPress -= Keyboard_DialKeyPress; - } - - void DetachSearchKeyboard() - { - Parent.Keyboard.KeyPress -= Keyboard_SearchKeyPress; - } - - void DetachPasswordKeyboard() - { - Parent.Keyboard.KeyPress -= Keyboard_PasswordKeyPress; - } - - /// - /// Shows the camera controls subpage - /// - void ShowCameraControls() - { - if (ShowCameraModeControls) - { - VCControlsInterlock.ShowInterlocked(UIBoolJoin.VCCameraModeBarVisible); - - if (VCCameraControlModeInterlock.CurrentJoin != 0) - { - VCCameraControlModeInterlock.Show(); - } - else - { - var codecAutoCamera = Codec as IHasCameraAutoMode; - if (codecAutoCamera != null) - { - ShowCameraManualMode(); - VCCameraControlModeInterlock.Show(); - } - } - } - else - { - // Just show the manual camera control page - VCControlsInterlock.ShowInterlocked(UIBoolJoin.VCCameraManualVisible); - } - - - - StagingButtonsFeedbackInterlock.ShowInterlocked(UIBoolJoin.VCStagingCameraPress); - } - - /// - /// shows the directory subpage - /// - void ShowDirectory() - { - // populate directory - VCControlsInterlock.ShowInterlocked(UIBoolJoin.VCDirectoryVisible); - StagingButtonsFeedbackInterlock.ShowInterlocked(UIBoolJoin.VCStagingDirectoryPress); - - } - - /// - /// shows the appropriate keypad depending on mode and whether visible - /// - void ShowKeypad() - { - uint join = Codec.IsInCall ? UIBoolJoin.VCKeypadVisible : UIBoolJoin.VCKeypadWithFavoritesVisible; - if (IsVisible) - VCControlsInterlock.ShowInterlocked(join); - else - VCControlsInterlock.SetButDontShow(join); - StagingButtonsFeedbackInterlock.ShowInterlocked(UIBoolJoin.VCStagingKeypadPress); - } - - /// - /// Shows the self-view layout controls subpage - /// - void ShowSelfViewLayout() - { - VCControlsInterlock.ShowInterlocked(UIBoolJoin.VCCameraAutoVisible); - StagingButtonsFeedbackInterlock.ShowInterlocked(UIBoolJoin.VCStagingSelfViewLayoutPress); - } - - /// - /// Shows the recents subpage - /// - void ShowRecents() - { - //populate recents - VCControlsInterlock.ShowInterlocked(UIBoolJoin.VCRecentsVisible); - StagingButtonsFeedbackInterlock.ShowInterlocked(UIBoolJoin.VCStagingRecentsPress); - } - - /// - /// Meet Now button - /// - void MeetNowPress() - { - var startMeetingCodec = Codec as IHasStartMeeting; - if (startMeetingCodec != null) - { - startMeetingCodec.StartMeeting(startMeetingCodec.DefaultMeetingDurationMin); - } - else - { - Debug.Console(2, "Codce does not implment IHasStartMeeting. Cannot meet now"); - } - } - - /// - /// Connect call button - /// - void ConnectPress() - { - if (Parent.Keyboard != null) - Parent.Keyboard.Hide(); - Codec.Dial(DialStringBuilder.ToString()); - } - - /// - /// Stop Sharing button - /// - void CallStopSharingPress() - { - Codec.StopSharing(); - Parent.CurrentRoom.RunRouteAction("codecOsd", Parent.CurrentRoom.SourceListKey); - } - - - /// - /// - /// - /// - void DialKeypadPress(string i) - { - if (KeypadMode == eKeypadMode.Dial) - { - DialStringBuilder.Append(i); - DialStringFeedback.FireUpdate(); - DialStringTextCheckEnables(); - } - else - { - Codec.SendDtmf(i); - DialStringBuilder.Append(i); - DialStringFeedback.FireUpdate(); - // no delete key in this mode! - } - DialStringTextCheckEnables(); - } - - /// - /// Does what it says - /// - void StartBackspaceRepeat() - { - if (BackspaceTimer == null) - { - BackspaceTimer = new CTimer(o => DialKeypadBackspacePress(), null, 0, 175); - } - } - - /// - /// Does what it says - /// - void StopBackspaceRepeat() - { - if (BackspaceTimer != null) - { - BackspaceTimer.Stop(); - BackspaceTimer = null; - } - } - - /// - /// - /// - void DialKeypadBackspacePress() - { - if (KeypadMode == eKeypadMode.Dial) - { - DialStringBuilder.Remove(DialStringBuilder.Length - 1, 1); - DialStringFeedback.FireUpdate(); - DialStringTextCheckEnables(); - } - else - DialKeypadClear(); - } - - /// - /// Clears the dial keypad - /// - void DialKeypadClear() - { - DialStringBuilder.Remove(0, DialStringBuilder.Length); - DialStringFeedback.FireUpdate(); - DialStringTextCheckEnables(); - } - - /// - /// Checks the enabled states of various elements around the keypad - /// - void DialStringTextCheckEnables() - { - var textIsEntered = DialStringBuilder.Length > 0; - TriList.SetBool(UIBoolJoin.VCKeypadBackspaceVisible, textIsEntered); - TriList.SetBool(UIBoolJoin.VCStagingConnectEnable, textIsEntered); - if (textIsEntered) - Parent.Keyboard.EnableGoButton(); - else - Parent.Keyboard.DisableGoButton(); - } - - /// - /// - /// - void SearchPress() - { - (Codec as IHasDirectory).SearchDirectory(SearchStringBuilder.ToString()); - } - - /// - /// - /// - /// - void SearchKeyboardPress(string i) - { - SearchStringBuilder.Append(i); - SearchStringFeedback.FireUpdate(); - SearchStringKeypadCheckEnables(); - } - - /// - /// Does what it says - /// - void StartSearchBackspaceRepeat() - { - if (BackspaceTimer == null) - { - BackspaceTimer = new CTimer(o => SearchKeypadBackspacePress(), null, 0, 175); - } - } - - /// - /// Does what it says - /// - void StopSearchBackspaceRepeat() - { - if (BackspaceTimer != null) - { - BackspaceTimer.Stop(); - BackspaceTimer = null; - } - } - - /// - /// - /// - void SearchKeypadBackspacePress() - { - SearchStringBuilder.Remove(SearchStringBuilder.Length - 1, 1); - - if (SearchStringBuilder.Length == 0) - SetCurrentDirectoryToRoot(); - - SearchStringFeedback.FireUpdate(); - SearchStringKeypadCheckEnables(); - } - - /// - /// Clears the Search keypad - /// - void SearchKeypadClear() - { - SearchStringBuilder.Remove(0, SearchStringBuilder.Length); - SearchStringFeedback.FireUpdate(); - SearchStringKeypadCheckEnables(); - - if ((Codec as IHasDirectory).CurrentDirectoryResultIsNotDirectoryRoot.BoolValue) - SetCurrentDirectoryToRoot(); - } - - /// - /// Checks the enabled states of various elements around the keypad - /// - void SearchStringKeypadCheckEnables() - { - var textIsEntered = SearchStringBuilder.Length > 0; - TriList.SetBool(UIBoolJoin.VCDirectoryBackspaceVisible, textIsEntered); - if (textIsEntered) - Parent.Keyboard.EnableGoButton(); - else - Parent.Keyboard.DisableGoButton(); - } - - /// - /// Clears the Password keypad - /// - void PasswordKeypadClear() - { - PasswordStringBuilder.Remove(0, PasswordStringBuilder.Length); - PasswordStringFeedback.FireUpdate(); - PasswordStringCheckEnables(); - - } - - /// - /// - /// - void PasswordKeypadBackspacePress() - { - PasswordStringBuilder.Remove(PasswordStringBuilder.Length - 1, 1); - - PasswordStringFeedback.FireUpdate(); - PasswordStringCheckEnables(); - } - - /// - /// Checks the enabled states of various elements around the keypad - /// - void PasswordStringCheckEnables() - { - var textIsEntered = PasswordStringBuilder.Length > 0; - if (textIsEntered) - Parent.Keyboard.EnableGoButton(); - else - Parent.Keyboard.DisableGoButton(); - } - - - /// - /// Returns the text value for the keypad dial entry field - /// - /// - string GetFormattedDialString(string ds) - { - if (DialStringBuilder.Length == 0 && !Codec.IsInCall) - { - return "Tap for keyboard"; - } - - return GetFormattedPhoneNumber(ds); - - } - - /// - /// Formats a string of numbers as a North American phone number - /// - /// - /// - string GetFormattedPhoneNumber(string s) - { - if (Regex.Match(s, @"^\d{4,7}$").Success) // 456-7890 - return string.Format("{0}-{1}", s.Substring(0, 3), s.Substring(3)); - if (Regex.Match(s, @"^9\d{4,7}$").Success) // 456-7890 - return string.Format("9 {0}-{1}", s.Substring(1, 3), s.Substring(4)); - if (Regex.Match(s, @"^\d{8,10}$").Success) // 123-456-78 - return string.Format("({0}) {1}-{2}", s.Substring(0, 3), s.Substring(3, 3), s.Substring(6)); - if (Regex.Match(s, @"^\d{10}$").Success) // 123-456-7890 full - return string.Format("({0}) {1}-{2}", s.Substring(0, 3), s.Substring(3, 3), s.Substring(6)); - if (Regex.Match(s, @"^1\d{10}$").Success) - return string.Format("+1 ({0}) {1}-{2}", s.Substring(1, 3), s.Substring(4, 3), s.Substring(7)); - if (Regex.Match(s, @"^9\d{10}$").Success) - return string.Format("9 ({0}) {1}-{2}", s.Substring(1, 3), s.Substring(4, 3), s.Substring(7)); - if (Regex.Match(s, @"^91\d{10}$").Success) - return string.Format("9 +1 ({0}) {1}-{2}", s.Substring(2, 3), s.Substring(5, 3), s.Substring(8)); - return s; - } - - enum eKeypadMode - { - Dial = 0, - DTMF - } - - void SetupPasswordPrompt() - { - var passwordPromptCodec = Codec as IPasswordPrompt; - - passwordPromptCodec.PasswordRequired += new EventHandler(passwordPromptCodec_PasswordRequired); - - TriList.SetSigFalseAction(UIBoolJoin.PasswordPromptCancelPress, HidePasswordPrompt); - TriList.SetSigFalseAction(UIBoolJoin.PasswordPromptTextPress, RevealKeyboard); - } - - void passwordPromptCodec_PasswordRequired(object sender, PasswordPromptEventArgs e) - { - if (e.LoginAttemptCancelled) - { - HidePasswordPrompt(); - return; - } - - if (!string.IsNullOrEmpty(e.Message)) - { - TriList.SetString(UIStringJoin.PasswordPromptMessageText, e.Message); - } - - if (e.LoginAttemptFailed) - { - // TODO: Show a message modal to indicate the login attempt failed - return; - } - - TriList.SetBool(UIBoolJoin.PasswordPromptErrorVisible, e.LastAttemptWasIncorrect); - - ShowPasswordPrompt(); - } - - private bool _passwordPromptDialogVisible; - - void ShowPasswordPrompt() - { - // Clear out any previous data - PasswordKeypadClear(); - - _passwordPromptDialogVisible = true; - TriList.SetBool(UIBoolJoin.PasswordPromptDialogVisible, _passwordPromptDialogVisible); - RevealKeyboard(); - } - - void HidePasswordPrompt() - { - if (_passwordPromptDialogVisible) - { - _passwordPromptDialogVisible = false; - Parent.Keyboard.Hide(); - TriList.SetBool(UIBoolJoin.PasswordPromptDialogVisible, _passwordPromptDialogVisible); - PasswordKeypadClear(); - } - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials/UIDrivers/enums and base.cs b/src/PepperDash.Essentials/UIDrivers/enums and base.cs deleted file mode 100644 index dbb1a681..00000000 --- a/src/PepperDash.Essentials/UIDrivers/enums and base.cs +++ /dev/null @@ -1,158 +0,0 @@ -using System; -using System.Collections.Generic; -using Crestron.SimplSharpPro.DeviceSupport; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials -{ - public enum eAvSubpageType - { - NoControls, - PowerOff, - SetupFullDistributed, - SourceWaitOverlay, - TopBar, - VolumePopup, - ZoneSource - } - - public enum eAvSourceSubpageType - { - AppleTv, - Radio, - Roku - } - - public enum eCommonSubpageType - { - GenericModal, - Home, - PanelSetup, - Weather - } - - public enum eAvSmartObjects - { - RoomList, - SourceList - } - - public enum eCommonSmartObjects - { - HomePageList - } - - /// - /// - /// - public abstract class PanelDriverBase - { - /// - /// - /// - public bool IsVisible { get; private set; } - - public bool WasVisibleWhenHidden { get; private set; } - - /// - /// Makes sure you call this. - /// Sets IsVisible and attaches back/home buttons to BackButtonPressed - /// - public virtual void Show() - { - IsVisible = true; - TriList.SetSigFalseAction(15002, BackButtonPressed); - } - - /// - /// Will show if this was visible when Hide was called (for group hiding/showing) - /// - public void Restore() - { - if (WasVisibleWhenHidden) - Show(); - } - - /// - /// Only sets IsVisible - /// - public virtual void Hide() - { - WasVisibleWhenHidden = IsVisible; - IsVisible = false; - } - - /// - /// Toggles visibility of this driver - /// - public virtual void Toggle() - { - if (IsVisible) - Hide(); - else - Show(); - } - - /// - /// Override with specific back button behavior. Default is empty - /// - public virtual void BackButtonPressed() - { - } - - public PanelDriverBase(BasicTriListWithSmartObject triList) - { - TriList = triList; - } - - #region IBasicTriListWithSmartObject Members - - /// - /// - /// - public void AddSmartObjectHelper(uint id, object controller) - { - SmartObjectControllers.Add(id, controller); - } - - /// - /// - /// - public void RemoveSmartObjectHelper(uint id) - { - SmartObjectControllers.Remove(id); - } - - Dictionary SmartObjectControllers = new Dictionary(); - - /// - /// The trilist object for the Crestron TP device - /// - public BasicTriListWithSmartObject TriList { get; private set; } - - /// - /// - /// - /// - /// - public bool ContainsSmartObjectHelper(uint id) - { - return SmartObjectControllers.ContainsKey(id); - } - - /// - /// - /// - /// - /// - public object GetSmartObjectHelper(uint id) - { - if (SmartObjectControllers.ContainsKey(id)) - return SmartObjectControllers[id]; - else - return null; - } - - #endregion - } -} \ No newline at end of file From 690499c86495e09eebc5455c1235c501c406346f Mon Sep 17 00:00:00 2001 From: Nick Genovese Date: Wed, 8 Nov 2023 15:10:16 -0500 Subject: [PATCH 12/21] feat: removed zoom room --- .../VideoCodec/Interfaces/IHasCodecLayouts.cs | 40 - .../IZoomWirelessShareInstructions.cs | 28 - .../VideoCodec/ZoomRoom/ResponseObjects.cs | 1822 -------- .../VideoCodec/ZoomRoom/ZoomRoom.cs | 3943 ----------------- .../VideoCodec/ZoomRoom/ZoomRoomCamera.cs | 231 - .../VideoCodec/ZoomRoom/ZoomRoomJoinMap.cs | 706 --- .../ZoomRoom/ZoomRoomPropertiesConfig.cs | 46 - 7 files changed, 6816 deletions(-) delete mode 100644 src/PepperDash.Essentials.Devices.Common/VideoCodec/ZoomRoom/IZoomWirelessShareInstructions.cs delete mode 100644 src/PepperDash.Essentials.Devices.Common/VideoCodec/ZoomRoom/ResponseObjects.cs delete mode 100644 src/PepperDash.Essentials.Devices.Common/VideoCodec/ZoomRoom/ZoomRoom.cs delete mode 100644 src/PepperDash.Essentials.Devices.Common/VideoCodec/ZoomRoom/ZoomRoomCamera.cs delete mode 100644 src/PepperDash.Essentials.Devices.Common/VideoCodec/ZoomRoom/ZoomRoomJoinMap.cs delete mode 100644 src/PepperDash.Essentials.Devices.Common/VideoCodec/ZoomRoom/ZoomRoomPropertiesConfig.cs diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/Interfaces/IHasCodecLayouts.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/Interfaces/IHasCodecLayouts.cs index d2393692..02280fdb 100644 --- a/src/PepperDash.Essentials.Devices.Common/VideoCodec/Interfaces/IHasCodecLayouts.cs +++ b/src/PepperDash.Essentials.Devices.Common/VideoCodec/Interfaces/IHasCodecLayouts.cs @@ -23,44 +23,4 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec void LocalLayoutToggleSingleProminent(); void MinMaxLayoutToggle(); } - - - /// - /// Defines the requirements for Zoom Room layout control - /// - public interface IHasZoomRoomLayouts : IHasCodecLayouts - { - event EventHandler LayoutInfoChanged; - - BoolFeedback LayoutViewIsOnFirstPageFeedback { get; } // TODO: #697 [*] Consider modifying to report button visibility in func - BoolFeedback LayoutViewIsOnLastPageFeedback { get; } // TODO: #697 [*] Consider modifying to report button visibility in func - BoolFeedback CanSwapContentWithThumbnailFeedback { get; } - BoolFeedback ContentSwappedWithThumbnailFeedback { get; } - - ZoomRoom.zConfiguration.eLayoutStyle LastSelectedLayout { get; } - ZoomRoom.zConfiguration.eLayoutStyle AvailableLayouts { get; } - - void GetAvailableLayouts(); // Mot sure this is necessary if we're already subscribed to zStatus Call Layout - void SetLayout(ZoomRoom.zConfiguration.eLayoutStyle layoutStyle); - void SwapContentWithThumbnail(); - - void LayoutTurnNextPage(); - void LayoutTurnPreviousPage(); - } - - public class LayoutInfoChangedEventArgs : EventArgs - { - [JsonProperty("availableLayouts", NullValueHandling = NullValueHandling.Ignore)] - public ZoomRoom.zConfiguration.eLayoutStyle AvailableLayouts { get; set; } - [JsonProperty("currentSelectedLayout", NullValueHandling = NullValueHandling.Ignore)] - public ZoomRoom.zConfiguration.eLayoutStyle CurrentSelectedLayout { get; set; } - [JsonProperty("canSwapContentWithThumbnail", NullValueHandling = NullValueHandling.Ignore)] - public bool CanSwapContentWithThumbnail { get; set; } - [JsonProperty("contentSwappedWithThumbnail", NullValueHandling = NullValueHandling.Ignore)] - public bool ContentSwappedWithThumbnail { get; set; } - [JsonProperty("layoutViewIsOnFirstPage", NullValueHandling = NullValueHandling.Ignore)] - public bool LayoutViewIsOnFirstPage { get; set; } - [JsonProperty("layoutViewIsOnLastPage", NullValueHandling = NullValueHandling.Ignore)] - public bool LayoutViewIsOnLastPage { get; set; } - } } \ No newline at end of file diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/ZoomRoom/IZoomWirelessShareInstructions.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/ZoomRoom/IZoomWirelessShareInstructions.cs deleted file mode 100644 index 465e2d2b..00000000 --- a/src/PepperDash.Essentials.Devices.Common/VideoCodec/ZoomRoom/IZoomWirelessShareInstructions.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using PepperDash.Essentials.Core; - -using PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom; - -namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom -{ - public class ShareInfoEventArgs : EventArgs - { - public zStatus.Sharing SharingStatus { get; private set; } - - public ShareInfoEventArgs(zStatus.Sharing status) - { - SharingStatus = status; - } - } - - public interface IZoomWirelessShareInstructions - { - event EventHandler ShareInfoChanged; - - zStatus.Sharing SharingState { get; } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/ZoomRoom/ResponseObjects.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/ZoomRoom/ResponseObjects.cs deleted file mode 100644 index 0ba684a8..00000000 --- a/src/PepperDash.Essentials.Devices.Common/VideoCodec/ZoomRoom/ResponseObjects.cs +++ /dev/null @@ -1,1822 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.ComponentModel; -using System.Runtime.CompilerServices; -using Crestron.SimplSharp; - -using PepperDash.Core; -using PepperDash.Essentials.Devices.Common.Codec; - -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; -using PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces; - -namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom -{ - public enum eZoomRoomResponseType - { - zEvent, - zStatus, - zConfiguration, - zCommand - } - - public abstract class NotifiableObject : INotifyPropertyChanged - { - #region INotifyPropertyChanged Members - - public event PropertyChangedEventHandler PropertyChanged; - - protected void NotifyPropertyChanged(string propertyName) - { - var handler = PropertyChanged; - if (handler != null) - { - handler(this, new PropertyChangedEventArgs(propertyName)); - } - else - { - Debug.Console(2, "PropertyChanged event is NULL"); - } - } - - #endregion - } - - /// - /// Used to track the current status of a ZoomRoom - /// - public class ZoomRoomStatus - { - public zStatus.Login Login { get; set; } - public zStatus.SystemUnit SystemUnit { get; set; } - public zStatus.Phonebook Phonebook { get; set; } - public zStatus.Call Call { get; set; } - public zStatus.Capabilities Capabilities { get; set; } - public zStatus.Sharing Sharing { get; set; } - public zStatus.NumberOfScreens NumberOfScreens { get; set; } - public zStatus.Layout Layout { get; set; } - public zStatus.Video Video { get; set; } - public zStatus.CameraShare CameraShare { get; set; } - public List AudioInputs { get; set; } - public List AudioOuputs { get; set; } - public List Cameras { get; set; } - public zEvent.PhoneCallStatus PhoneCall { get; set; } - public zEvent.NeedWaitForHost NeedWaitForHost { get; set; } - - public ZoomRoomStatus() - { - Login = new zStatus.Login(); - SystemUnit = new zStatus.SystemUnit(); - Phonebook = new zStatus.Phonebook(); - Call = new zStatus.Call(); - Capabilities = new zStatus.Capabilities(); - Sharing = new zStatus.Sharing(); - NumberOfScreens = new zStatus.NumberOfScreens(); - Layout = new zStatus.Layout(); - Video = new zStatus.Video(); - CameraShare = new zStatus.CameraShare(); - AudioInputs = new List(); - AudioOuputs = new List(); - Cameras = new List(); - PhoneCall = new zEvent.PhoneCallStatus(); - NeedWaitForHost = new zEvent.NeedWaitForHost(); - } - } - - /// - /// Used to track the current configuration of a ZoomRoom - /// - public class ZoomRoomConfiguration - { - public zConfiguration.Call Call { get; set; } - public zConfiguration.Audio Audio { get; set; } - public zConfiguration.Video Video { get; set; } - public zConfiguration.Client Client { get; set; } - public zConfiguration.Camera Camera { get; set; } - - public ZoomRoomConfiguration() - { - Call = new zConfiguration.Call(); - Audio = new zConfiguration.Audio(); - Video = new zConfiguration.Video(); - Client = new zConfiguration.Client(); - Camera = new zConfiguration.Camera(); - } - } - - /// - /// Represents a response from a ZoomRoom system - /// - public class Response - { - public Status Status { get; set; } - public bool Sync { get; set; } - [JsonProperty("topKey")] - public string TopKey { get; set; } - [JsonProperty("type")] - public string Type { get; set; } - - public Response() - { - Status = new Status(); - } - } - - public class Status - { - [JsonProperty("message")] - public string Message { get; set; } - [JsonProperty("state")] - public string State { get; set; } - } - - - /// - /// zStatus class stucture - /// - public class zStatus - { - public class Login - { - [JsonProperty("ZAAPI Release")] - public string ZAAPIRelease { get; set; } - [JsonProperty("Zoom Room Release")] - public string ZoomRoomRelease { get; set; } - } - - public class SystemUnit - { - [JsonProperty("email")] - public string Email { get; set; } - [JsonProperty("login_type")] - public string LoginType { get; set; } - [JsonProperty("meeting_number")] - public string MeetingNumber { get; set; } - [JsonProperty("platform")] - public string Platform { get; set; } - [JsonProperty("room_info")] - public RoomInfo RoomInfo { get; set; } - [JsonProperty("room_version")] - public string RoomVersion { get; set; } - - public SystemUnit() - { - RoomInfo = new RoomInfo(); - } - } - - public class RoomInfo - { - [JsonProperty("account_email")] - public string AccountEmail { get; set; } - [JsonProperty("display_version")] - public string DisplayVersion { get; set; } - [JsonProperty("is_auto_answer_enabled")] - public bool AutoAnswerIsEnabled { get; set; } - [JsonProperty("is_auto_answer_selected")] - public bool AutoAnswerIsSelected { get; set; } - [JsonProperty("room_name")] - public string RoomName { get; set; } - } - - public class CloudPbxInfo - { - [JsonProperty("company_number")] - public string CompanyNumber { get; set; } - [JsonProperty("extension")] - public string Extension { get; set; } - [JsonProperty("isValid")] - public bool IsValid { get; set; } - } - - public enum ePresence - { - PRESENCE_OFFLINE, - PRESENCE_ONLINE, - PRESENCE_AWAY, - PRESENCE_BUSY, - PRESENCE_DND - } - - public class Contact - { - [JsonProperty("avatarURL")] - public string AvatarURL { get; set; } - [JsonProperty("cloud_pbx_info")] - public CloudPbxInfo CloudPbxInfo { get; set; } - [JsonProperty("email")] - public string Email { get; set; } - [JsonProperty("firstName")] - public string FirstName { get; set; } - [JsonProperty("index")] - public int Index { get; set; } - [JsonProperty("isLegacy")] - public bool IsLegacy { get; set; } - [JsonProperty("isZoomRoom")] - public bool IsZoomRoom { get; set; } - [JsonProperty("jid")] - public string Jid { get; set; } - [JsonProperty("lastName")] - public string LastName { get; set; } - [JsonProperty("onDesktop")] - public bool OnDesktop { get; set; } - [JsonProperty("onMobile")] - public bool OnMobile { get; set; } - [JsonProperty("phoneNumber")] - public string PhoneNumber { get; set; } - [JsonProperty("presence")] - public ePresence Presence { get; set; } - [JsonProperty("presence_status")] - public int PresenceStatus { get; set; } - [JsonProperty("screenName")] - public string ScreenName { get; set; } - [JsonProperty("sip_phone_number")] - public string SipPhoneNumber { get; set; } - - - public Contact() - { - CloudPbxInfo = new CloudPbxInfo(); - } - } - - public class Phonebook - { - [JsonProperty("Contacts")] - public List Contacts { get; set; } - - public Phonebook() - { - Contacts = new List(); - } - - /// - /// Converts from zStatus.Contact types to generic directory items - /// - /// - public static CodecDirectory ConvertZoomContactsToGeneric(List zoomContacts) - { - var directory = new CodecDirectory(); - - var folders = new List(); - - var roomFolder = new DirectoryFolder(); - - var contactFolder = new DirectoryFolder(); - - var contacts = new List(); - - // Check if there are any zoom rooms - var zoomRooms = zoomContacts.FindAll(c => c.IsZoomRoom); - - if (zoomRooms.Count > 0) - { - // If so, setup a rooms and contacts folder and add them. - - directory.ResultsFolderId = "root"; - - roomFolder.Name = "Rooms"; - roomFolder.ParentFolderId = "root"; - roomFolder.FolderId = "rooms"; - - contactFolder.Name = "Contacts"; - contactFolder.ParentFolderId = "root"; - contactFolder.FolderId = "contacts"; - - folders.Add(roomFolder); - folders.Add(contactFolder); - - directory.AddFoldersToDirectory(folders); - } - - try - { - if (zoomContacts.Count == 0) - { - return directory; - } - - foreach (Contact c in zoomContacts) - { - var contact = new InvitableDirectoryContact { Name = c.ScreenName, ContactId = c.Jid }; - - contact.ContactMethods.Add(new ContactMethod() - { - Number = c.Jid, - Device = eContactMethodDevice.Video, - CallType = eContactMethodCallType.Video, - ContactMethodId = c.Jid - }); - - if (folders.Count > 0) - { - contact.ParentFolderId = c.IsZoomRoom - ? roomFolder.FolderId // "rooms" - : contactFolder.FolderId; // "contacts" - } - - contacts.Add(contact); - } - - directory.AddContactsToDirectory(contacts); - } - catch (Exception e) - { - Debug.Console(1, "Error converting Zoom Phonebook results to generic: {0}", e); - } - - return directory; - } - } - - public enum eCallStatus - { - UNKNOWN, - NOT_IN_MEETING, - CONNECTING_MEETING, - IN_MEETING, - LOGGED_OUT - } - - public class ClosedCaption - { - public bool Available { get; set; } - } - - public class Call : NotifiableObject - { - private eCallStatus _status; - private List _participants; - - public bool IsInCall; - - public eCallStatus Status - { - get - { - return _status; - } - set - { - if (value != _status) - { - _status = value; - IsInCall = _status == eCallStatus.IN_MEETING || _status == eCallStatus.CONNECTING_MEETING; - NotifyPropertyChanged("Status"); - } - } - } - public ClosedCaption ClosedCaption { get; set; } - public List Participants - { - get - { - return _participants; - } - set - { - _participants = value; - NotifyPropertyChanged("Participants"); - } - } - public zEvent.SharingState Sharing { get; set; } - - public CallRecordInfo CallRecordInfo { get; set; } - - private zCommand.InfoResult _info; - - public zCommand.InfoResult Info - { - get - { - return _info; - } - set - { - _info = value; - NotifyPropertyChanged("Info"); - } - } - - public Call() - { - ClosedCaption = new ClosedCaption(); - Participants = new List(); - Sharing = new zEvent.SharingState(); - CallRecordInfo = new CallRecordInfo(); - Info = new zCommand.InfoResult(); - } - } - - public class Capabilities - { - public bool aec_Setting_Stored_In_ZR { get; set; } - public bool can_Dtmf_For_Invite_By_Phone { get; set; } - public bool can_Mute_On_Entry { get; set; } - public bool can_Ringing_In_Pstn_Call { get; set; } - public bool can_Switch_To_Specific_Camera { get; set; } - public bool is_Airhost_Disabled { get; set; } - public bool pstn_Call_In_Local_resentation { get; set; } - public bool support_Claim_Host { get; set; } - public bool support_Out_Room_Display { get; set; } - public bool support_Pin_And_Spotlight { get; set; } - public bool supports_Audio_Checkup { get; set; } - public bool supports_CheckIn { get; set; } - public bool supports_Cloud_PBX { get; set; } - public bool supports_Encrypted_Connection { get; set; } - public bool supports_Expel_User_Permanently { get; set; } - public bool supports_H323_DTMF { get; set; } - public bool supports_Hdmi_Cec_Control { get; set; } - public bool supports_Highly_Reverberant_Room { get; set; } - public bool supports_Loading_Contacts_Dynamically { get; set; } - public bool supports_Loading_Participants_Dynamically { get; set; } - public bool supports_Mic_Record_Test { get; set; } - public bool supports_Multi_Share { get; set; } - public bool supports_ShareCamera { get; set; } - public bool supports_Share_For_Floating_And_Content_Only { get; set; } - public bool supports_Sip_Call_out { get; set; } - public bool supports_Software_Audio_Processing { get; set; } - public bool supports_Web_Settings_Push { get; set; } - } - - public enum eDisplayState - { - None, - Laptop, - IOS, - } - - public class Sharing : NotifiableObject - { - private eDisplayState _dispState; - private string _password; - private bool _isAirHostClientConnected; - private bool _isSharingBlackMagic; - private bool _isDirectPresentationConnected; - private bool _isBlackMagicConnected; - - - public string directPresentationPairingCode { get; set; } - /// - /// Laptop client sharing key - /// - public string directPresentationSharingKey { get; set; } - public eDisplayState dispState - { - get - { - return _dispState; - } - set - { - if (value != _dispState) - { - _dispState = value; - NotifyPropertyChanged("dispState"); - } - } - } - - public bool isAirHostClientConnected - { - get { return _isAirHostClientConnected; } - set - { - if (value != _isAirHostClientConnected) - { - _isAirHostClientConnected = value; - NotifyPropertyChanged("isAirHostClientConnected"); - } - } - } - - public bool isBlackMagicConnected - { - get { return _isBlackMagicConnected; } - set - { - if (value != _isBlackMagicConnected) - { - _isBlackMagicConnected = value; - NotifyPropertyChanged("isBlackMagicConnected"); - } - } - } - public bool isBlackMagicDataAvailable { get; set; } - - public bool isDirectPresentationConnected - { - get { return _isDirectPresentationConnected; } - set - { - if (value != _isDirectPresentationConnected) - { - _isDirectPresentationConnected = value; - NotifyPropertyChanged("isDirectPresentationConnected"); - } - } - } - - public bool isSharingBlackMagic - { - get { return _isSharingBlackMagic; } - set - { - if (value != _isSharingBlackMagic) - { - _isSharingBlackMagic = value; - NotifyPropertyChanged("isSharingBlackMagic"); - } - } - } - - /// - /// IOS Airplay code - /// - public string password - { - get - { - return _password; - } - set - { - if (value != _password) - { - _password = value; - NotifyPropertyChanged("password"); - } - } - } - public string serverName { get; set; } - public string wifiName { get; set; } - } - - public class NumberOfScreens : NotifiableObject - { - private int _numOfScreens; - - [JsonProperty("NumberOfCECScreens")] - public int NumOfCECScreens { get; set; } - [JsonProperty("NumberOfScreens")] - public int NumOfScreens - { - get - { - return _numOfScreens; - } - set - { - if (value != _numOfScreens) - { - _numOfScreens = value; - NotifyPropertyChanged("NumberOfScreens"); - } - } - } - } - - /// - /// AudioInputLine/AudioOutputLine/VideoCameraLine list item - /// - public class AudioVideoInputOutputLineItem - { - public string Alias { get; set; } - public string Name { get; set; } - public bool Selected { get; set; } - public bool combinedDevice { get; set; } - public string id { get; set; } - public bool manuallySelected { get; set; } - public int numberOfCombinedDevices { get; set; } - public int ptzComId { get; set; } - } - - public class Video - { - public bool Optimizable { get; set; } - } - - public class CameraShare : NotifiableObject - { - private bool _canControlCamera; - private bool _isSharing; - - [JsonProperty("can_Control_Camera")] - public bool CanControlCamera - { - get - { - return _canControlCamera; - } - set - { - if (value != _canControlCamera) - { - _canControlCamera = value; - NotifyPropertyChanged("CanControlCamera"); - } - } - } - public string id { get; set; } - public bool is_Mirrored { get; set; } - [JsonProperty("is_Sharing")] - public bool IsSharing - { - get - { - return _isSharing; - } - set - { - if (value != _isSharing) - { - _isSharing = value; - NotifyPropertyChanged("IsSharing"); - } - } - } - public int pan_Tilt_Speed { get; set; } - - } - - public class Layout : NotifiableObject - { - // backer variables - private bool _can_Switch_Speaker_View; - private bool _can_Switch_Wall_View; - private bool _can_Switch_Strip_View; - private bool _can_Switch_Share_On_All_Screens; - private bool _can_Switch_Floating_Share_Content; - private bool _is_In_First_Page; - private bool _is_In_Last_Page; - private string _video_type; - - - public bool can_Adjust_Floating_Video { get; set; } - - - public bool can_Switch_Floating_Share_Content - { - get - { - return _can_Switch_Floating_Share_Content; - } - set - { - if (value != _can_Switch_Floating_Share_Content) - { - _can_Switch_Floating_Share_Content = value; - NotifyPropertyChanged("can_Switch_Floating_Share_Content"); - } - } - } - - - /// - /// [on/off] // Set to On if it is possible to invoke zConfiguration Call Layout Style: ShareAll, to switch to the ShareAll mode, where the content sharing is shown full screen on all monitors. - /// - [JsonProperty("can_Switch_Share_On_All_Screens")] - public bool can_Switch_Share_On_All_Screens - { - get - { - return _can_Switch_Share_On_All_Screens; - } - set - { - if (value != _can_Switch_Share_On_All_Screens) - { - _can_Switch_Share_On_All_Screens = value; - NotifyPropertyChanged("can_Switch_Share_On_All_Screens"); - } - } - } - - /// - /// [on/off] // Set to On if it is possible to switch to Speaker view by invoking zConfiguration Call Layout Style: Speaker. The active speaker is shown full screen, and other video streams, like self-view, are shown in thumbnails. - /// - [JsonProperty("can_Switch_Speaker_View")] - public bool can_Switch_Speaker_View - { - get - { - return _can_Switch_Speaker_View; - } - set - { - if (value != _can_Switch_Speaker_View) - { - _can_Switch_Speaker_View = value; - NotifyPropertyChanged("can_Switch_Speaker_View"); - } - } - } - - /// - /// [on/off] On if it is possible to invoke zConfiguration Call Layout Style: Gallery, to switch to the Gallery mode, showing video participants in tiled windows: The Zoom Room shows up to a 5x5 array of tiled windows per page. - /// - [JsonProperty("can_Switch_Wall_View")] - public bool can_Switch_Wall_View - { - get - { - return _can_Switch_Wall_View; - } - set - { - if (value != _can_Switch_Wall_View) - { - _can_Switch_Wall_View = value; - NotifyPropertyChanged("can_Switch_Wall_View"); - } - } - } - - [JsonProperty("can_Switch_Strip_View")] - public bool can_Switch_Strip_View - { - get - { - return _can_Switch_Strip_View; - } - set - { - if (value != _can_Switch_Strip_View) - { - _can_Switch_Strip_View = value; - NotifyPropertyChanged("can_Switch_Strip_View"); - } - } - } - - [JsonProperty("is_In_First_Page")] - public bool is_In_First_Page - { - get - { - return _is_In_First_Page; - } - set - { - if (value != _is_In_First_Page) - { - _is_In_First_Page = value; - NotifyPropertyChanged("is_In_First_Page"); - } - } - } - - [JsonProperty("is_In_Last_Page")] - public bool is_In_Last_Page - { - get - { - return _is_In_Last_Page; - } - set - { - if (value != _is_In_Last_Page) - { - _is_In_Last_Page = value; - NotifyPropertyChanged("is_In_Last_Page"); - } - } - } - - public bool is_supported { get; set; } - public int video_Count_In_Current_Page { get; set; } - - /// - /// [Gallery | Strip] Indicates which mode applies: Strip or Gallery. - /// - [JsonProperty("video_type")] - public string video_type - { - get - { - return _video_type; - } - set - { - if (value != _video_type) - { - _video_type = value; - NotifyPropertyChanged("video_type"); - } - } - } - } - - public class CallRecordInfo : NotifiableObject - { - private bool _meetingIsBeingRecorded; - private bool _canRecord; - private bool _emailRequired; - - public bool amIRecording { get; set; } - - public bool canRecord - { - get - { - return _canRecord; - } - set - { - if (value != _canRecord) - { - _canRecord = value; - NotifyPropertyChanged("canRecord"); - } - } - } - - public bool emailRequired - { - get - { - return _emailRequired; - } - set - { - if (value != _emailRequired) - { - _emailRequired = value; - NotifyPropertyChanged("emailRequired"); - } - } - } - - public bool meetingIsBeingRecorded - { - get - { - return _meetingIsBeingRecorded; - } - set - { - //Debug.Console(2, "************************************setting value of meetingIsBeingRecorded to: {0}", value); - if (value != _meetingIsBeingRecorded) - { - _meetingIsBeingRecorded = value; - //Debug.Console(2, "********************************set value of meetingIsBeingRecorded to: {0}", _meetingIsBeingRecorded); - NotifyPropertyChanged("meetingIsBeingRecorded"); - } - } - } - - /// - /// Indicates if recording is allowed (when meeting capable and and email is not required to be entered by the user) - /// - public bool AllowRecord - { - get - { - return canRecord && !emailRequired; - } - } - - public CallRecordInfo() - { - Debug.Console(2, Debug.ErrorLogLevel.Notice, "********************************************* CallRecordInfo() ******************************************"); - } - } - } - - /// - /// zEvent Class Structure - /// - public class zEvent - { - public class StartLocalPresentMeeting - { - public bool Success { get; set; } - } - public class NeedWaitForHost - { - public bool Wait { get; set; } - } - - public class IncomingCallIndication - { - public string callerJID { get; set; } - public string calleeJID { get; set; } - public string meetingID { get; set; } - public string password { get; set; } - public string meetingOption { get; set; } - public long MeetingNumber { get; set; } - public string callerName { get; set; } - public string avatarURL { get; set; } - public int lifeTime { get; set; } - public bool accepted { get; set; } - } - - public class CallConnectError - { - public int error_code { get; set; } - public string error_message { get; set; } - } - - public class CallDisconnect - { - public bool Successful - { - get - { - return success == "on"; - } - } - - public string success { get; set; } - } - - public class Layout - { - public bool Sharethumb { get; set; } - } - - public class Call - { - public Layout Layout { get; set; } - } - - public class Client - { - public Call Call { get; set; } - } - - public enum eSharingState - { - None, - Connecting, - Sending, - Receiving, - Send_Receiving - } - - public class SharingState : NotifiableObject - { - private bool _paused; - private eSharingState _state; - - public bool IsSharing { get; private set; } - - [JsonProperty("paused")] - public bool Paused - { - get - { - return _paused; - } - set - { - if (value != _paused) - { - _paused = value; - NotifyPropertyChanged("Paused"); - } - } - } - [JsonProperty("state")] - public eSharingState State - { - get - { - return _state; - } - set - { - if (value != _state) - { - _state = value; - IsSharing = _state == eSharingState.Sending; - NotifyPropertyChanged("State"); - } - } - } - } - - public class PinStatusOfScreenNotification - { - - - [JsonProperty("can_be_pinned")] - public bool CanBePinned { get; set; } - [JsonProperty("can_pin_share")] - public bool CanPinShare { get; set; } - [JsonProperty("pinned_share_source_id")] - public int PinnedShareSourceId { get; set; } - [JsonProperty("pinned_user_id")] - public int PinnedUserId { get; set; } - [JsonProperty("screen_index")] - public int ScreenIndex { get; set; } - [JsonProperty("screen_layout")] - public int ScreenLayout { get; set; } - [JsonProperty("share_source_type")] - public int ShareSourceType { get; set; } - [JsonProperty("why_cannot_pin_share")] - public string WhyCannotPinShare { get; set; } - } - - public class PhoneCallStatus : NotifiableObject - { - private bool _isIncomingCall; - private string _peerDisplayName; - private string _peerNumber; - - private bool _offHook; - - public string CallId { get; set; } - public bool IsIncomingCall - { - get { return _isIncomingCall; } - set - { - if (value == _isIncomingCall) return; - - _isIncomingCall = value; - NotifyPropertyChanged("IsIncomingCall"); - } - } - - public string PeerDisplayName - { - get { return _peerDisplayName; } - set - { - if (value == _peerDisplayName) return; - _peerDisplayName = value; - NotifyPropertyChanged("PeerDisplayName"); - } - } - - public string PeerNumber - { - get { return _peerNumber; } - set - { - if (value == _peerNumber) return; - - _peerNumber = value; - NotifyPropertyChanged("PeerNumber"); - } - } - - public string PeerUri { get; set; } - - private ePhoneCallStatus _status; - public ePhoneCallStatus Status - { - get { return _status; } - set - { - _status = value; - OffHook = _status == ePhoneCallStatus.PhoneCallStatus_Accepted || - _status == ePhoneCallStatus.PhoneCallStatus_InCall || - _status == ePhoneCallStatus.PhoneCallStatus_Init || - _status == ePhoneCallStatus.PhoneCallStatus_Ringing; - } - } - - public bool OffHook - { - get { return _offHook; } - set - { - if (value == _offHook) return; - - _offHook = value; - NotifyPropertyChanged("OffHook"); - } - } - } - - public enum ePhoneCallStatus - { - PhoneCallStatus_Ringing, - PhoneCallStatus_Terminated, - PhoneCallStatus_Accepted, - PhoneCallStatus_InCall, - PhoneCallStatus_Init, - } - - public class MeetingNeedsPassword - { - [JsonProperty("needsPassword")] - public bool NeedsPassword { get; set; } - - [JsonProperty("wrongAndRetry")] - public bool WrongAndRetry { get; set; } - } - } - - /// - /// zConfiguration class structure - /// - public class zConfiguration - { - public class Sharing - { - [JsonProperty("optimize_video_sharing")] - public bool OptimizeVideoSharing { get; set; } - } - - public class Camera : NotifiableObject - { - private bool _mute; - - public bool Mute - { - get { return _mute; } - set - { - Debug.Console(1, "Camera Mute response received: {0}", value); - - if (value == _mute) return; - - _mute = value; - NotifyPropertyChanged("Mute"); - } - } - } - - public class Microphone : NotifiableObject - { - private bool _mute; - - public bool Mute - { - get - { - return _mute; - } - set - { - if (value != _mute) - { - _mute = value; - NotifyPropertyChanged("Mute"); - } - } - } - } - - [Flags] - public enum eLayoutStyle - { - None = 0, - Gallery = 1, - Speaker = 2, - Strip = 4, - ShareAll = 8, - } - - public enum eLayoutSize - { - Off, - Size1, - Size2, - Size3, - Strip - } - - public enum eLayoutPosition - { - Center, - Up, - Right, - UpRight, - Down, - DownRight, - Left, - UpLeft, - DownLeft - } - - public class Layout : NotifiableObject - { - private bool _shareThumb; - private eLayoutStyle _style; - private eLayoutSize _size; - private eLayoutPosition _position; - - public bool ShareThumb - { - get { return _shareThumb; } - set - { - if (value != _shareThumb) - { - _shareThumb = value; - NotifyPropertyChanged("ShareThumb"); - } - } - } - - public eLayoutStyle Style - { - get { return _style; } - set - { - if (value != _style) - { - _style = value; - NotifyPropertyChanged("Style"); - } - } - } - - public eLayoutSize Size - { - get { return _size; } - set - { - if (value != _size) - { - _size = value; - NotifyPropertyChanged("Size"); - } - } - } - - public eLayoutPosition Position - { - get { return _position; } - set - { - if (value != _position) - { - _position = value; - NotifyPropertyChanged("Position"); - } - } - } - } - - public class Lock : NotifiableObject - { - private bool _enable; - - public bool Enable - { - get - { - return _enable; - } - set - { - if (value != _enable) - { - _enable = value; - NotifyPropertyChanged("Enable"); - } - } - } - } - - public class ClosedCaption - { - public bool Visible { get; set; } - public int FontSize { get; set; } - } - - public class MuteUserOnEntry - { - public bool Enable { get; set; } - } - - public class Call - { - public Sharing Sharing { get; set; } - public Camera Camera { get; set; } - public Microphone Microphone { get; set; } - public Layout Layout { get; set; } - public Lock Lock { get; set; } - public MuteUserOnEntry MuteUserOnEntry { get; set; } - public ClosedCaption ClosedCaption { get; set; } - - - public Call() - { - Sharing = new Sharing(); - Camera = new Camera(); - Microphone = new Microphone(); - Layout = new Layout(); - Lock = new Lock(); - MuteUserOnEntry = new MuteUserOnEntry(); - ClosedCaption = new ClosedCaption(); - } - } - - public class Audio - { - public Input Input { get; set; } - public Output Output { get; set; } - - public Audio() - { - Input = new Input(); - Output = new Output(); - } - } - - public class Input : Output - { - [JsonProperty("reduce_reverb")] - public bool ReduceReverb { get; set; } - } - - public class Output : NotifiableObject - { - private int _volume; - - [JsonProperty("volume")] - public int Volume - { - get - { - return _volume; - } - set - { - if (value != _volume) - { - _volume = value; - NotifyPropertyChanged("Volume"); - } - } - } - [JsonProperty("selectedId")] - public string SelectedId { get; set; } - [JsonProperty("is_sap_disabled")] - public bool IsSapDisabled { get; set; } - } - - public class Video : NotifiableObject - { - private bool _hideConfSelfVideo; - - [JsonProperty("hide_conf_self_video")] - public bool HideConfSelfVideo - { - get - { - return _hideConfSelfVideo; - } - set - { - //if (value != _hideConfSelfVideo) - //{ - _hideConfSelfVideo = value; - NotifyPropertyChanged("HideConfSelfVideo"); - //} - } - } - - public VideoCamera Camera { get; set; } - - public Video() - { - Camera = new VideoCamera(); - } - } - - public class VideoCamera : NotifiableObject - { - private string _selectedId; - - [JsonProperty("selectedId")] - public string SelectedId - { - get - { - return _selectedId; - } - set - { - if (value != _selectedId) - { - _selectedId = value; - NotifyPropertyChanged("SelectedId"); - } - } - - } - public bool Mirror { get; set; } - } - - public class Client - { - public string appVersion { get; set; } - public string deviceSystem { get; set; } - - // This doesn't belong here, but there's a bug in the object structure of Zoom Room 5.6.3 that puts it here - public zConfiguration.Call Call { get; set; } - - public Client() - { - Call = new zConfiguration.Call(); - } - } - - } - - /// - /// zCommand class structure - /// - public class zCommand - { - public class BookingsListResult - { - [JsonProperty("accessRole")] - public string AccessRole { get; set; } - [JsonProperty("calendarChangeKey")] - public string CalendarChangeKey { get; set; } - [JsonProperty("calendarID")] - public string CalendarId { get; set; } - [JsonProperty("checkIn")] - public bool CheckIn { get; set; } - [JsonProperty("creatorEmail")] - public string CreatorEmail { get; set; } - [JsonProperty("creatorName")] - public string CreatorName { get; set; } - [JsonProperty("endTime")] - public DateTime EndTime { get; set; } - [JsonProperty("hostName")] - public string HostName { get; set; } - [JsonProperty("isInstantMeeting")] - public bool IsInstantMeeting { get; set; } - [JsonProperty("isPrivate")] - public bool IsPrivate { get; set; } - [JsonProperty("location")] - public string Location { get; set; } - [JsonProperty("meetingName")] - public string MeetingName { get; set; } - [JsonProperty("meetingNumber")] - public string MeetingNumber { get; set; } - [JsonProperty("scheduledFrom")] - public string ScheduledFrom { get; set; } - [JsonProperty("startTime")] - public DateTime StartTime { get; set; } - [JsonProperty("third_party")] - public ThirdParty ThirdParty { get; set; } - } - - public static List GetGenericMeetingsFromBookingResult(List bookings, - int minutesBeforeMeetingStart) - { - var rv = GetGenericMeetingsFromBookingResult(bookings); - - foreach (var meeting in rv) - { - meeting.MinutesBeforeMeeting = minutesBeforeMeetingStart; - } - - return rv; - } - /// - /// Extracts the necessary meeting values from the Zoom bookings response and converts them to the generic class - /// - /// - /// - public static List GetGenericMeetingsFromBookingResult(List bookings) - { - var meetings = new List(); - - if (Debug.Level > 0) - { - Debug.Console(1, "Meetings List:\n"); - } - - foreach (var b in bookings) - { - var meeting = new Meeting(); - - if (b.MeetingNumber != null) - meeting.Id = b.MeetingNumber; - if (b.CreatorName != null) - meeting.Organizer = b.CreatorName; - if (b.MeetingName != null) - meeting.Title = b.MeetingName; - //if (b.Agenda != null) - // meeting.Agenda = b.Agenda.Value; - if (b.StartTime != null) - meeting.StartTime = b.StartTime; - if (b.EndTime != null) - meeting.EndTime = b.EndTime; - - meeting.Privacy = b.IsPrivate ? eMeetingPrivacy.Private : eMeetingPrivacy.Public; - - meeting.Dialable = meeting.Id != "0"; - - // No meeting.Calls data exists for Zoom Rooms. Leaving out for now. - var now = DateTime.Now; - if (meeting.StartTime < now && meeting.EndTime < now) - { - Debug.Console(1, "Skipping meeting {0}. Meeting is in the past.", meeting.Title); - continue; - } - - meetings.Add(meeting); - - if (Debug.Level > 0) - { - Debug.Console(1, "Title: {0}, ID: {1}, Organizer: {2}", meeting.Title, meeting.Id, meeting.Organizer); - Debug.Console(1, " Start Time: {0}, End Time: {1}, Duration: {2}", meeting.StartTime, meeting.EndTime, meeting.Duration); - Debug.Console(1, " Joinable: {0}\n", meeting.Joinable); - } - } - - meetings.OrderBy(m => m.StartTime); - - return meetings; - } - - public class HandStatus - { - // example return of the "hand_status" object - // !!!! Note the properties contain ': ' within the property name !!! - //"hand_status": { - // "is_raise_hand: ": false, - // "is_valid: ": "on", - // "time_stamp: ": "11825083" - //}, - [JsonProperty("is_raise_hand: ")] - public bool IsRaiseHand { get; set; } - [JsonProperty("is_valid: ")] - public string IsValid { get; set; } - [JsonProperty("time_stamp: ")] - public string TimeStamp { get; set; } - /// - /// Retuns a boolean value if the participant hand state is raised and is valid (both need to be true) - /// - public bool HandIsRaisedAndValid - { - get { return IsValid != null && IsValid == "on" && IsRaiseHand; } - } - } - public class ListParticipant - { - [JsonProperty("audio_status state")] - public string AudioStatusState { get; set; } - [JsonProperty("audio_status type")] - public string AudioStatusType { get; set; } - [JsonProperty("avatar_url")] - public string AvatarUrl { get; set; } - [JsonProperty("camera_status am_i_controlling")] - public bool CameraStatusAmIControlling { get; set; } - [JsonProperty("camera_status can_i_request_control")] - public bool CameraStatusCanIRequestConrol { get; set; } - [JsonProperty("camera_status can_move_camera")] - public bool CameraStatusCanMoveCamera { get; set; } - [JsonProperty("camera_status can_switch_camera")] - public bool CameraStatusCanSwitchCamera { get; set; } - [JsonProperty("camera_status can_zoom_camera")] - public bool CameraStatusCanZoomCamera { get; set; } - [JsonProperty("can_edit_closed_caption")] - public bool CanEditClosedCaption { get; set; } - [JsonProperty("can_record")] - public bool CanRecord { get; set; } - [JsonProperty("event")] - public string Event { get; set; } - [JsonProperty("hand_status")] - public HandStatus HandStatus { get; set; } - [JsonProperty("isCohost")] - public bool IsCohost { get; set; } - [JsonProperty("is_client_support_closed_caption")] - public bool IsClientSupportClosedCaption { get; set; } - [JsonProperty("is_client_support_coHost")] - public bool IsClientSupportCoHost { get; set; } - [JsonProperty("is_host")] - public bool IsHost { get; set; } - [JsonProperty("is_myself")] - public bool IsMyself { get; set; } - [JsonProperty("is_recording")] - public bool IsRecording { get; set; } - [JsonProperty("is_video_can_mute_byHost")] - public bool IsVideoCanMuteByHost { get; set; } - [JsonProperty("is_video_can_unmute_byHost")] - public bool IsVideoCanUnmuteByHost { get; set; } - [JsonProperty("local_recording_disabled")] - public bool LocalRecordingDisabled { get; set; } - [JsonProperty("user_id")] - public int UserId { get; set; } - [JsonProperty("user_name")] - public string UserName { get; set; } - [JsonProperty("user_type")] - public string UserType { get; set; } - [JsonProperty("video_status has_source")] - public bool VideoStatusHasSource { get; set; } - [JsonProperty("video_status is_receiving")] - public bool VideoStatusIsReceiving { get; set; } - [JsonProperty("video_status is_sending")] - public bool VideoStatusIsSending { get; set; } - - public ListParticipant() - { - HandStatus = new HandStatus(); - } - - /// - /// Converts ZoomRoom pariticpant list response to an Essentials participant list - /// - /// - /// - public static List GetGenericParticipantListFromParticipantsResult( - List participants) - { - if (participants.Count == 0) - { - return new List(); - } - //return participants.Select(p => new Participant - // { - // UserId = p.UserId, - // Name = p.UserName, - // IsHost = p.IsHost, - // CanMuteVideo = p.IsVideoCanMuteByHost, - // CanUnmuteVideo = p.IsVideoCanUnmuteByHost, - // AudioMuteFb = p.AudioStatusState == "AUDIO_MUTED", - // VideoMuteFb = p.VideoStatusIsSending, - // HandIsRaisedFb = p.HandStatus.HandIsRaisedAndValid, - // }).ToList(); - - var sortedParticipants = SortParticipantListByHandStatus(participants); - return sortedParticipants.Select(p => new Participant - { - UserId = p.UserId, - Name = p.UserName, - IsHost = p.IsHost, - IsMyself = p.IsMyself, - CanMuteVideo = p.IsVideoCanMuteByHost, - CanUnmuteVideo = p.IsVideoCanUnmuteByHost, - AudioMuteFb = p.AudioStatusState == "AUDIO_MUTED", - VideoMuteFb = !p.VideoStatusIsSending, - HandIsRaisedFb = p.HandStatus.HandIsRaisedAndValid, - }).ToList(); - } - - /// - /// Will sort by hand-raise status and then alphabetically - /// - /// Zoom Room response list of participants - /// List - public static List SortParticipantListByHandStatus(List participants) - { - if (participants == null) - { - //Debug.Console(1, "SortParticiapntListByHandStatu(participants == null)"); - return null; - } - - // debug testing - //foreach (ListParticipant participant in participants) - //{ - // Debug.Console(1, "{0} | IsValid: {1} | IsRaiseHand: {2} | HandIsRaisedAndValid: {3}", - // participant.UserName, participant.HandStatus.IsValid, participant.HandStatus.IsRaiseHand.ToString(), participant.HandStatus.HandIsRaisedAndValid.ToString()); - //} - - List handRaisedParticipantsList = participants.Where(p => p.HandStatus.HandIsRaisedAndValid).ToList(); - - if (handRaisedParticipantsList != null) - { - IOrderedEnumerable orderByDescending = handRaisedParticipantsList.OrderByDescending(p => p.HandStatus.TimeStamp); - - //foreach (var participant in handRaisedParticipantsList) - // Debug.Console(1, "handRaisedParticipantList: {0} | {1}", participant.UserName, participant.UserId); - } - - List allOtherParticipantsList = participants.Where(p => !p.HandStatus.HandIsRaisedAndValid).ToList(); - - if (allOtherParticipantsList != null) - { - allOtherParticipantsList.OrderBy(p => p.UserName); - - //foreach (var participant in allOtherParticipantsList) - // Debug.Console(1, "allOtherParticipantsList: {0} | {1}", participant.UserName, participant.UserId); - } - - // merge the lists - List sortedList = handRaisedParticipantsList.Union(allOtherParticipantsList).ToList(); - - // return the sorted list - return sortedList; - } - - } - - public class CallinCountryList - { - public int code { get; set; } - public string display_number { get; set; } - public string id { get; set; } - public string name { get; set; } - public string number { get; set; } - } - - public class CalloutCountryList - { - public int code { get; set; } - public string display_number { get; set; } - public string id { get; set; } - public string name { get; set; } - public string number { get; set; } - } - - public class TollFreeCallinList - { - public int code { get; set; } - public string display_number { get; set; } - public string id { get; set; } - public string name { get; set; } - public string number { get; set; } - } - - public class Info - { - public List callin_country_list { get; set; } - public List callout_country_list { get; set; } - public List toll_free_callin_list { get; set; } - } - - public class ThirdParty - { - public string h323_address { get; set; } - public string meeting_number { get; set; } - public string service_provider { get; set; } - public string sip_address { get; set; } - } - - public class MeetingListItem - { - public string accessRole { get; set; } - public string calendarChangeKey { get; set; } - public string calendarID { get; set; } - public bool checkIn { get; set; } - public string creatorEmail { get; set; } - public string creatorName { get; set; } - public string endTime { get; set; } - public string hostName { get; set; } - public bool isInstantMeeting { get; set; } - public bool isPrivate { get; set; } - public string location { get; set; } - public string meetingName { get; set; } - public string meetingNumber { get; set; } - public string scheduledFrom { get; set; } - public string startTime { get; set; } - public ThirdParty third_party { get; set; } - - public MeetingListItem() - { - third_party = new ThirdParty(); - } - } - - public class InfoResult - { - public Info Info { get; set; } - public bool am_i_original_host { get; set; } - public string default_callin_country { get; set; } - public string dialIn { get; set; } - public string international_url { get; set; } - public string invite_email_content { get; set; } - public string invite_email_subject { get; set; } - public bool is_callin_country_list_available { get; set; } - public bool is_calling_room_system_enabled { get; set; } - public bool is_toll_free_callin_list_available { get; set; } - public bool is_view_only { get; set; } - public bool is_waiting_room { get; set; } - public bool is_webinar { get; set; } - public string meeting_id { get; set; } - public MeetingListItem meeting_list_item { get; set; } - public string meeting_password { get; set; } - public string meeting_type { get; set; } - public int my_userid { get; set; } - public int participant_id { get; set; } - public string real_meeting_id { get; set; } - public string schedule_option { get; set; } - public string schedule_option2 { get; set; } - public string support_callout_type { get; set; } - public string toll_free_number { get; set; } - public string user_type { get; set; } - - public InfoResult() - { - Info = new Info(); - meeting_list_item = new MeetingListItem(); - } - } - - public class Phonebook - { - public List Contacts { get; set; } - public int Limit { get; set; } - public int Offset { get; set; } - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/ZoomRoom/ZoomRoom.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/ZoomRoom/ZoomRoom.cs deleted file mode 100644 index a9c6c0f2..00000000 --- a/src/PepperDash.Essentials.Devices.Common/VideoCodec/ZoomRoom/ZoomRoom.cs +++ /dev/null @@ -1,3943 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.CrestronThread; -using Crestron.SimplSharpPro.DeviceSupport; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Core.DeviceTypeInterfaces; -using PepperDash.Essentials.Core.Routing; -using PepperDash.Essentials.Core.Queues; -using PepperDash.Essentials.Devices.Common.Cameras; -using PepperDash.Essentials.Devices.Common.Codec; -using PepperDash.Essentials.Devices.Common.VideoCodec.Cisco; -using PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces; - -namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom -{ - public class ZoomRoom : VideoCodecBase, IHasCodecSelfView, IHasDirectoryHistoryStack, ICommunicationMonitor, - IRouting, - IHasScheduleAwareness, IHasCodecCameras, IHasParticipants, IHasCameraOff, IHasCameraMuteWithUnmuteReqeust, IHasCameraAutoMode, - IHasFarEndContentStatus, IHasSelfviewPosition, IHasPhoneDialing, IHasZoomRoomLayouts, IHasParticipantPinUnpin, - IHasParticipantAudioMute, IHasSelfviewSize, IPasswordPrompt, IHasStartMeeting, IHasMeetingInfo, IHasPresentationOnlyMeeting, - IHasMeetingLock, IHasMeetingRecordingWithPrompt, IZoomWirelessShareInstructions - { - public event EventHandler VideoUnmuteRequested; - - private const long MeetingRefreshTimer = 60000; - public uint DefaultMeetingDurationMin { get; private set; } - - /// - /// CR LF CR LF Delimits an echoed response to a command - /// - private const string EchoDelimiter = "\x0D\x0A\x0D\x0A"; - - private const string SendDelimiter = "\x0D"; - - /// - /// CR LF } CR LF Delimits a JSON response - /// - private const string JsonDelimiter = "\x0D\x0A\x7D\x0D\x0A"; - - private string[] Delimiters = new string[] { EchoDelimiter, JsonDelimiter, "OK\x0D\x0A", "end\x0D\x0A" }; - private readonly GenericQueue _receiveQueue; - - private readonly ZoomRoomSyncState _syncState; - public bool CommDebuggingIsOn; - private CodecDirectory _currentDirectoryResult; - private uint _jsonCurlyBraceCounter; - private bool _jsonFeedbackMessageIsIncoming; - private StringBuilder _jsonMessage; - private int _previousVolumeLevel; - private CameraBase _selectedCamera; - private string _lastDialedMeetingNumber; - - private CTimer contactsDebounceTimer; - - - private readonly ZoomRoomPropertiesConfig _props; - - private bool _meetingPasswordRequired; - - private bool _waitingForUserToAcceptOrRejectIncomingCall; - - public void Poll(string pollString) - { - if(_meetingPasswordRequired || _waitingForUserToAcceptOrRejectIncomingCall) return; - - SendText(string.Format("{0}{1}", pollString, SendDelimiter)); - } - - public ZoomRoom(DeviceConfig config, IBasicCommunication comm) - : base(config) - { - DefaultMeetingDurationMin = 30; - - _props = JsonConvert.DeserializeObject(config.Properties.ToString()); - - _receiveQueue = new GenericQueue(Key + "-rxQueue", Thread.eThreadPriority.MediumPriority, 2048); - - Communication = comm; - - if (_props.CommunicationMonitorProperties != null) - { - CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, _props.CommunicationMonitorProperties.PollInterval, _props.CommunicationMonitorProperties.TimeToWarning, _props.CommunicationMonitorProperties.TimeToError, - () => Poll(_props.CommunicationMonitorProperties.PollString)); - } - else - { - CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, 30000, 120000, 300000, () => Poll("zStatus SystemUnit")); - } - - DeviceManager.AddDevice(CommunicationMonitor); - - Status = new ZoomRoomStatus(); - - Configuration = new ZoomRoomConfiguration(); - - CodecInfo = new ZoomRoomInfo(Status, Configuration); - - _syncState = new ZoomRoomSyncState(Key + "--Sync", this); - - _syncState.InitialSyncCompleted += SyncState_InitialSyncCompleted; - - _syncState.FirstJsonResponseReceived += (o, a) => SetUpSyncQueries(); - - PhonebookSyncState = new CodecPhonebookSyncState(Key + "--PhonebookSync"); - - PhonebookSyncState.InitialSyncCompleted += (o, a) => ResubscribeForAddedContacts(); - - PortGather = new CommunicationGather(Communication, Delimiters) {IncludeDelimiter = true}; - PortGather.LineReceived += Port_LineReceived; - - CodecOsdIn = new RoutingInputPort(RoutingPortNames.CodecOsd, - eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, new Action(StopSharing), this); - - Output1 = new RoutingOutputPort(RoutingPortNames.HdmiOut1, - eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, null, this); - - Output2 = new RoutingOutputPort(RoutingPortNames.HdmiOut2, - eRoutingSignalType.Video, - eRoutingPortConnectionType.DisplayPort, null, this); - - Output3 = new RoutingOutputPort(RoutingPortNames.HdmiOut3, - eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, null, this); - - SelfviewIsOnFeedback = new BoolFeedback(SelfViewIsOnFeedbackFunc); - - CameraIsOffFeedback = new BoolFeedback(CameraIsOffFeedbackFunc); - - CameraIsMutedFeedback = CameraIsOffFeedback; - - CameraAutoModeIsOnFeedback = new BoolFeedback(CameraAutoModeIsOnFeedbackFunc); - - CodecSchedule = new CodecScheduleAwareness(MeetingRefreshTimer); - - if (_props.MinutesBeforeMeetingStart > 0) - { - CodecSchedule.MeetingWarningMinutes = _props.MinutesBeforeMeetingStart; - } - - ReceivingContent = new BoolFeedback(FarEndIsSharingContentFeedbackFunc); - - SelfviewPipPositionFeedback = new StringFeedback(SelfviewPipPositionFeedbackFunc); - - // TODO: #714 [ ] SelfviewPipSizeFeedback - SelfviewPipSizeFeedback = new StringFeedback(SelfviewPipSizeFeedbackFunc); - - SetUpFeedbackActions(); - - Cameras = new List(); - - SetUpDirectory(); - - Participants = new CodecParticipants(); - - SupportsCameraOff = true; // Always allow turning off the camera for zoom calls? - SupportsCameraAutoMode = _props.SupportsCameraAutoMode; - - PhoneOffHookFeedback = new BoolFeedback(PhoneOffHookFeedbackFunc); - CallerIdNameFeedback = new StringFeedback(CallerIdNameFeedbackFunc); - CallerIdNumberFeedback = new StringFeedback(CallerIdNumberFeedbackFunc); - - LocalLayoutFeedback = new StringFeedback(LocalLayoutFeedbackFunc); - - LayoutViewIsOnFirstPageFeedback = new BoolFeedback(LayoutViewIsOnFirstPageFeedbackFunc); - LayoutViewIsOnLastPageFeedback = new BoolFeedback(LayoutViewIsOnLastPageFeedbackFunc); - CanSwapContentWithThumbnailFeedback = new BoolFeedback(CanSwapContentWithThumbnailFeedbackFunc); - ContentSwappedWithThumbnailFeedback = new BoolFeedback(ContentSwappedWithThumbnailFeedbackFunc); - - NumberOfScreensFeedback = new IntFeedback(NumberOfScreensFeedbackFunc); - - MeetingIsLockedFeedback = new BoolFeedback(() => Configuration.Call.Lock.Enable ); - - MeetingIsRecordingFeedback = new BoolFeedback(() => Status.Call.CallRecordInfo.meetingIsBeingRecorded ); - - RecordConsentPromptIsVisible = new BoolFeedback(() => _recordConsentPromptIsVisible); - - SetUpRouting(); - } - - public CommunicationGather PortGather { get; private set; } - - public ZoomRoomStatus Status { get; private set; } - - public ZoomRoomConfiguration Configuration { get; private set; } - - //CTimer LoginMessageReceivedTimer; - //CTimer RetryConnectionTimer; - - /// - /// Gets and returns the scaled volume of the codec - /// - protected override Func VolumeLevelFeedbackFunc - { - get - { - return () => - { - var scaledVol = CrestronEnvironment.ScaleWithLimits(Configuration.Audio.Output.Volume, 100, 0, 65535, 0); - - if (Configuration.Audio.Output.Volume != 0) - { - Debug.Console(2, this, "Storing previous volume level as: {0}, scaled: {1}", Configuration.Audio.Output.Volume, - scaledVol); - _previousVolumeLevel = scaledVol; // Store the previous level for recall - } - - return scaledVol; - }; - } - } - - protected override Func PrivacyModeIsOnFeedbackFunc - { - get - { - return () => - { - //Debug.Console(2, this, "PrivacyModeIsOnFeedbackFunc. IsInCall: {0} muteState: {1}", IsInCall, Configuration.Call.Microphone.Mute); - if (IsInCall) - { - //Debug.Console(2, this, "reporting muteState: ", Configuration.Call.Microphone.Mute); - return Configuration.Call.Microphone.Mute; - } - else - { - //Debug.Console(2, this, "muteState: true", IsInCall); - return false; - } - }; - } - } - - protected override Func StandbyIsOnFeedbackFunc - { - get { return () => false; } - } - - protected override Func SharingSourceFeedbackFunc - { - get - { - return () => - { - if (Status.Sharing.isAirHostClientConnected) - return "Airplay"; - else if (Status.Sharing.isDirectPresentationConnected || Status.Sharing.isBlackMagicConnected) - return "Laptop"; - else return "None"; - - }; - } - } - - protected override Func SharingContentIsOnFeedbackFunc - { - get { return () => Status.Sharing.isAirHostClientConnected || Status.Sharing.isDirectPresentationConnected || Status.Sharing.isSharingBlackMagic; } - } - - protected Func FarEndIsSharingContentFeedbackFunc - { - get { return () => Status.Call.Sharing.State == zEvent.eSharingState.Receiving; } - } - - protected override Func MuteFeedbackFunc - { - get { return () => Configuration.Audio.Output.Volume == 0; } - } - - //protected Func RoomIsOccupiedFeedbackFunc - //{ - // get - // { - // return () => false; - // } - //} - - //protected Func PeopleCountFeedbackFunc - //{ - // get - // { - // return () => 0; - // } - //} - - protected Func SelfViewIsOnFeedbackFunc - { - get { return () => !Configuration.Video.HideConfSelfVideo; } - } - - protected Func CameraIsOffFeedbackFunc - { - get { return () => Configuration.Call.Camera.Mute; } - } - - protected Func CameraAutoModeIsOnFeedbackFunc - { - get { return () => false; } - } - - protected Func SelfviewPipPositionFeedbackFunc - { - get - { - return - () => - _currentSelfviewPipPosition != null - ? _currentSelfviewPipPosition.Command ?? "Unknown" - : "Unknown"; - } - } - - // TODO: #714 [ ] SelfviewPipSizeFeedbackFunc - protected Func SelfviewPipSizeFeedbackFunc - { - get - { - return - () => - _currentSelfviewPipSize != null - ? _currentSelfviewPipSize.Command ?? "Unknown" - : "Unknown"; - } - } - - protected Func LocalLayoutIsProminentFeedbackFunc - { - get { return () => false; } - } - - - public RoutingInputPort CodecOsdIn { get; private set; } - public RoutingOutputPort Output1 { get; private set; } - public RoutingOutputPort Output2 { get; private set; } - public RoutingOutputPort Output3 { get; private set; } - - #region ICommunicationMonitor Members - - public StatusMonitorBase CommunicationMonitor { get; private set; } - - #endregion - - #region IHasCodecCameras Members - - public event EventHandler CameraSelected; - - public List Cameras { get; private set; } - - public CameraBase SelectedCamera - { - get { return _selectedCamera; } - private set - { - _selectedCamera = value; - SelectedCameraFeedback.FireUpdate(); - ControllingFarEndCameraFeedback.FireUpdate(); - - var handler = CameraSelected; - if (handler != null) - { - handler(this, new CameraSelectedEventArgs(_selectedCamera)); - } - } - } - - - public StringFeedback SelectedCameraFeedback { get; private set; } - - public void SelectCamera(string key) - { - if (CameraIsMutedFeedback.BoolValue) - { - CameraMuteOff(); - } - - SendText(string.Format("zConfiguration Video Camera selectedId: {0}", key)); - } - - public CameraBase FarEndCamera { get; private set; } - - public BoolFeedback ControllingFarEndCameraFeedback { get; private set; } - - #endregion - - #region IHasCodecSelfView Members - - public BoolFeedback SelfviewIsOnFeedback { get; private set; } - - public void GetSelfViewMode() - { - SendText("zConfiguration Video hide_conf_self_video"); - } - - public void SelfViewModeOn() - { - SendText("zConfiguration Video hide_conf_self_video: off"); - } - - public void SelfViewModeOff() - { - SendText("zConfiguration Video hide_conf_self_video: on"); - } - - public void SelfViewModeToggle() - { - if (SelfviewIsOnFeedback.BoolValue) - { - SelfViewModeOff(); - } - else - { - SelfViewModeOn(); - } - } - - #endregion - - #region IHasDirectoryHistoryStack Members - - public event EventHandler DirectoryResultReturned; - public CodecDirectory DirectoryRoot { get; private set; } - - public CodecDirectory CurrentDirectoryResult - { - get { return _currentDirectoryResult; } - private set - { - _currentDirectoryResult = value; - - Debug.Console(2, this, "CurrentDirectoryResult Updated. ResultsFolderId: {0} Contact Count: {1}", - _currentDirectoryResult.ResultsFolderId, _currentDirectoryResult.CurrentDirectoryResults.Count); - - OnDirectoryResultReturned(_currentDirectoryResult); - } - } - - public CodecPhonebookSyncState PhonebookSyncState { get; private set; } - - public void SearchDirectory(string searchString) - { - var directoryResults = new CodecDirectory(); - - directoryResults.AddContactsToDirectory( - DirectoryRoot.CurrentDirectoryResults.FindAll( - c => c.Name.IndexOf(searchString, 0, StringComparison.OrdinalIgnoreCase) > -1)); - - DirectoryBrowseHistoryStack.Clear(); - CurrentDirectoryResult = directoryResults; - } - - public void GetDirectoryFolderContents(string folderId) - { - var directoryResults = new CodecDirectory {ResultsFolderId = folderId}; - - directoryResults.AddContactsToDirectory( - DirectoryRoot.CurrentDirectoryResults.FindAll(c => c.ParentFolderId.Equals(folderId))); - - DirectoryBrowseHistoryStack.Push(_currentDirectoryResult); - - CurrentDirectoryResult = directoryResults; - } - - public void SetCurrentDirectoryToRoot() - { - DirectoryBrowseHistoryStack.Clear(); - - CurrentDirectoryResult = DirectoryRoot; - } - - public void GetDirectoryParentFolderContents() - { - if (DirectoryBrowseHistoryStack.Count == 0) - { - return; - } - - var currentDirectory = DirectoryBrowseHistoryStack.Pop(); - - CurrentDirectoryResult = currentDirectory; - } - - public BoolFeedback CurrentDirectoryResultIsNotDirectoryRoot { get; private set; } - - public List DirectoryBrowseHistory { get; private set; } - - public Stack DirectoryBrowseHistoryStack { get; private set; } - - #endregion - - #region IHasScheduleAwareness Members - - public CodecScheduleAwareness CodecSchedule { get; private set; } - - public void GetSchedule() - { - GetBookings(); - } - - #endregion - - #region IRouting Members - - public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType) - { - ExecuteSwitch(inputSelector); - } - - #endregion - - private void SyncState_InitialSyncCompleted(object sender, EventArgs e) - { - SetIsReady(); - } - - /// - /// Handles subscriptions to Status.Call and sub objects. Needs to be called whenever Status.Call is constructed - /// - private void SetUpCallFeedbackActions() - { - Status.Sharing.PropertyChanged -= HandleSharingStateUpdate; - Status.Sharing.PropertyChanged += HandleSharingStateUpdate; - - Status.Call.Sharing.PropertyChanged -= HandleSharingStateUpdate; - Status.Call.Sharing.PropertyChanged += HandleSharingStateUpdate; - - Status.Call.PropertyChanged -= HandleCallStateUpdate; - Status.Call.PropertyChanged += HandleCallStateUpdate; - - Status.Call.CallRecordInfo.PropertyChanged -= HandleCallRecordInfoStateUpdate; - Status.Call.CallRecordInfo.PropertyChanged += HandleCallRecordInfoStateUpdate; - } - - private void HandleCallRecordInfoStateUpdate(object sender, PropertyChangedEventArgs a) - { - if (a.PropertyName == "meetingIsBeingRecorded" || a.PropertyName == "emailRequired" || a.PropertyName == "canRecord") - { - MeetingIsRecordingFeedback.FireUpdate(); - - var meetingInfo = new MeetingInfo(MeetingInfo.Id, - MeetingInfo.Name, - MeetingInfo.Host, - MeetingInfo.Password, - GetSharingStatus(), - GetIsHostMyself(), - MeetingInfo.IsSharingMeeting, - MeetingInfo.WaitingForHost, - MeetingIsLockedFeedback.BoolValue, - MeetingIsRecordingFeedback.BoolValue, Status.Call.CallRecordInfo.AllowRecord); - MeetingInfo = meetingInfo; - } - } - - private void HandleCallStateUpdate(object sender, PropertyChangedEventArgs a) - { - switch (a.PropertyName) - { - case "Info": - { - Debug.Console(1, this, "Updating Call Status"); - UpdateCallStatus(); - break; - } - - case "Status": - { - UpdateCallStatus(); - break; - } - } - } - - private void HandleSharingStateUpdate(object sender, PropertyChangedEventArgs a) - { - //if (a.PropertyName != "State") - //{ - // return; - //} - - SharingContentIsOnFeedback.FireUpdate(); - ReceivingContent.FireUpdate(); - try - { - - // Update the share status of the meeting info - if (MeetingInfo == null) - { - MeetingInfo = new MeetingInfo("", "", "", "", GetSharingStatus(), GetIsHostMyself(), true, false, MeetingIsLockedFeedback.BoolValue, MeetingIsRecordingFeedback.BoolValue, Status.Call.CallRecordInfo.AllowRecord); - return; - } - - var meetingInfo = new MeetingInfo(MeetingInfo.Id, MeetingInfo.Name, Participants.Host != null ? Participants.Host.Name : "None", - MeetingInfo.Password, GetSharingStatus(), GetIsHostMyself(), MeetingInfo.IsSharingMeeting, MeetingInfo.WaitingForHost, MeetingIsLockedFeedback.BoolValue, MeetingIsRecordingFeedback.BoolValue, Status.Call.CallRecordInfo.AllowRecord); - MeetingInfo = meetingInfo; - } - catch (Exception e) - { - Debug.Console(1, this, "Error processing state property update. {0}", e.Message); - Debug.Console(2, this, e.StackTrace); - MeetingInfo = new MeetingInfo("", "", "", "", "None", false, false, false, MeetingIsLockedFeedback.BoolValue, MeetingIsRecordingFeedback.BoolValue, false); - } - } - - /// - /// Subscribes to the PropertyChanged events on the state objects and fires the corresponding feedbacks. - /// - private void SetUpFeedbackActions() - { - // Set these up initially. - SetUpCallFeedbackActions(); - - Configuration.Audio.Output.PropertyChanged += (o, a) => - { - if (a.PropertyName == "Volume") - { - VolumeLevelFeedback.FireUpdate(); - MuteFeedback.FireUpdate(); - } - }; - - Configuration.Call.Microphone.PropertyChanged += (o, a) => - { - if (a.PropertyName == "Mute") - { - PrivacyModeIsOnFeedback.FireUpdate(); - } - }; - - Configuration.Video.PropertyChanged += (o, a) => - { - if (a.PropertyName == "HideConfSelfVideo") - { - SelfviewIsOnFeedback.FireUpdate(); - } - }; - Configuration.Video.Camera.PropertyChanged += (o, a) => - { - if (a.PropertyName == "SelectedId") - { - if (Cameras == null) - { - return; - } - - var camera = Cameras.FirstOrDefault(c => c.Key.IndexOf(Configuration.Video.Camera.SelectedId, StringComparison.OrdinalIgnoreCase) > -1); - if (camera != null) - { - Debug.Console(1, this, "Camera selected with key: '{0}'", camera.Key); - - SelectedCamera = camera; - - if (CameraIsMutedFeedback.BoolValue) - { - CameraMuteOff(); - } - } - else - { - Debug.Console(1, this, "No camera found with key: '{0}'", Configuration.Video.Camera.SelectedId); - } - } - }; - - Configuration.Call.Camera.PropertyChanged += (o, a) => - { - Debug.Console(1, this, "Configuration.Call.Camera.PropertyChanged: {0}", a.PropertyName); - - if (a.PropertyName != "Mute") return; - - CameraIsOffFeedback.FireUpdate(); - CameraAutoModeIsOnFeedback.FireUpdate(); - }; - - Configuration.Call.Layout.PropertyChanged += (o, a) => - { - switch (a.PropertyName) - { - case "Position": - { - ComputeSelfviewPipPositionStatus(); - - SelfviewPipPositionFeedback.FireUpdate(); - - break; - } - case "ShareThumb": - { - ContentSwappedWithThumbnailFeedback.FireUpdate(); - OnLayoutInfoChanged(); - break; - } - case "Style": - { - LocalLayoutFeedback.FireUpdate(); - OnLayoutInfoChanged(); - break; - } - case "Size": - { - // TODO: #714 [ ] SetupFeedbackActions >> Size - ComputeSelfviewPipSizeStatus(); - - SelfviewPipSizeFeedback.FireUpdate(); - - break; - } - } - }; - - Configuration.Call.Lock.PropertyChanged += (o, a) => - { - if (a.PropertyName == "Enable") - { - MeetingIsLockedFeedback.FireUpdate(); - MeetingInfo = new MeetingInfo - ( - MeetingInfo.Id, - MeetingInfo.Name, - MeetingInfo.Host, - MeetingInfo.Password, - GetSharingStatus(), - MeetingInfo.IsHost, - MeetingInfo.IsSharingMeeting, - MeetingInfo.WaitingForHost, - MeetingIsLockedFeedback.BoolValue, - MeetingIsRecordingFeedback.BoolValue, Status.Call.CallRecordInfo.AllowRecord - ); - } - }; - - // This is to deal with incorrect object structure coming back from the Zoom Room on v 5.6.3 - Configuration.Client.Call.Layout.PropertyChanged += (o, a) => - { - switch (a.PropertyName) - { - case "Position": - { - ComputeSelfviewPipPositionStatus(); - - SelfviewPipPositionFeedback.FireUpdate(); - - break; - } - case "ShareThumb": - { - ContentSwappedWithThumbnailFeedback.FireUpdate(); - OnLayoutInfoChanged(); - break; - } - case "Style": - { - LocalLayoutFeedback.FireUpdate(); - OnLayoutInfoChanged(); - break; - } - } - }; - - - Status.Sharing.PropertyChanged += (o, a) => - { - OnShareInfoChanged(Status.Sharing); - SharingSourceFeedback.FireUpdate(); - switch (a.PropertyName) - { - case "password": - break; - case "isSharingBlackMagic": - { - Debug.Console(2, this, "Updating sharing status: {0}", a.PropertyName); - - SharingContentIsOnFeedback.FireUpdate(); - if (MeetingInfo == null) - { - //Ignoring for now, as the CallInfo return will create the appropriate value - return; - } - // Update the share status of the meeting info - var meetingInfo = new MeetingInfo(MeetingInfo.Id, - MeetingInfo.Name, - MeetingInfo.Host, - MeetingInfo.Password, - GetSharingStatus(), - GetIsHostMyself(), - MeetingInfo.IsSharingMeeting, - MeetingInfo.WaitingForHost, - MeetingIsLockedFeedback.BoolValue, - MeetingIsRecordingFeedback.BoolValue, Status.Call.CallRecordInfo.AllowRecord); - MeetingInfo = meetingInfo; - break; - } - } - }; - - Status.PhoneCall.PropertyChanged += (o, a) => - { - switch (a.PropertyName) - { - case "IsIncomingCall": - Debug.Console(1, this, "Incoming Phone Call: {0}", Status.PhoneCall.IsIncomingCall); - break; - case "PeerDisplayName": - Debug.Console(1, this, "Peer Display Name: {0}", Status.PhoneCall.PeerDisplayName); - CallerIdNameFeedback.FireUpdate(); - break; - case "PeerNumber": - Debug.Console(1, this, "Peer Number: {0}", Status.PhoneCall.PeerNumber); - CallerIdNumberFeedback.FireUpdate(); - break; - case "OffHook": - Debug.Console(1, this, "Phone is OffHook: {0}", Status.PhoneCall.OffHook); - PhoneOffHookFeedback.FireUpdate(); - break; - } - }; - - Status.Layout.PropertyChanged += (o, a) => - { - Debug.Console(1, this, "Status.Layout.PropertyChanged a.PropertyName: {0}", a.PropertyName); - switch (a.PropertyName.ToLower()) - { - case "can_Switch_speaker_view": - case "can_switch_wall_view": - case "can_switch_strip_view": - case "video_type": - case "can_switch_share_on_all_screens": - { - ComputeAvailableLayouts(); - break; - } - case "is_in_first_page": - { - LayoutViewIsOnFirstPageFeedback.FireUpdate(); - break; - } - case "is_in_last_page": - { - LayoutViewIsOnLastPageFeedback.FireUpdate(); - break; - } - case "can_switch_floating_share_content": - { - CanSwapContentWithThumbnailFeedback.FireUpdate(); - break; - } - } - OnLayoutInfoChanged(); - }; - - Status.NumberOfScreens.PropertyChanged += (o, a) => - { - switch (a.PropertyName) - { - case "NumberOfScreens": - { - NumberOfScreensFeedback.FireUpdate(); - break; - } - } - }; - } - - private void SetUpDirectory() - { - DirectoryRoot = new CodecDirectory() {ResultsFolderId = "root"}; - - CurrentDirectoryResultIsNotDirectoryRoot = new BoolFeedback(() => CurrentDirectoryResult.ResultsFolderId != "root"); - - CurrentDirectoryResult = DirectoryRoot; - - DirectoryBrowseHistory = new List(); - DirectoryBrowseHistoryStack = new Stack(); - } - - private void SetUpRouting() - { - // Set up input ports - CreateOsdSource(); - InputPorts.Add(CodecOsdIn); - - // Set up output ports - OutputPorts.Add(Output1); - OutputPorts.Add(Output2); - } - - /// - /// Creates the fake OSD source, and connects it's AudioVideo output to the CodecOsdIn input - /// to enable routing - /// - private void CreateOsdSource() - { - OsdSource = new DummyRoutingInputsDevice(Key + "[osd]"); - DeviceManager.AddDevice(OsdSource); - var tl = new TieLine(OsdSource.AudioVideoOutputPort, CodecOsdIn); - TieLineCollection.Default.Add(tl); - - //foreach(var input in Status.Video. - } - - /// - /// Starts the HTTP feedback server and syncronizes state of codec - /// - /// - public override bool CustomActivate() - { - CrestronConsole.AddNewConsoleCommand(SetCommDebug, "SetCodecCommDebug", "0 for Off, 1 for on", - ConsoleAccessLevelEnum.AccessOperator); - if (!_props.DisablePhonebookAutoDownload) - { - CrestronConsole.AddNewConsoleCommand(s => SendText("zCommand Phonebook List Offset: 0 Limit: 10000"), - "GetZoomRoomContacts", "Triggers a refresh of the codec phonebook", - ConsoleAccessLevelEnum.AccessOperator); - } - - CrestronConsole.AddNewConsoleCommand(s => GetBookings(), "GetZoomRoomBookings", - "Triggers a refresh of the booking data for today", ConsoleAccessLevelEnum.AccessOperator); - - - - return base.CustomActivate(); - } - - #region Overrides of Device - - public override void Initialize() - { - var socket = Communication as ISocketStatus; - if (socket != null) - { - socket.ConnectionChange += socket_ConnectionChange; - } - - CommDebuggingIsOn = false; - - Communication.Connect(); - - CommunicationMonitor.Start(); - } - - #endregion - - public void SetCommDebug(string s) - { - if (s == "1") - { - CommDebuggingIsOn = true; - Debug.Console(1, this, "Comm Debug Enabled."); - } - else - { - CommDebuggingIsOn = false; - Debug.Console(1, this, "Comm Debug Disabled."); - } - } - - private void socket_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e) - { - Debug.Console(1, this, "Socket status change {0}", e.Client.ClientStatus); - if (e.Client.IsConnected) - { - } - else - { - _syncState.CodecDisconnected(); - PhonebookSyncState.CodecDisconnected(); - } - } - - public void SendText(string command) - { - if (_meetingPasswordRequired) - { - Debug.Console(2, this, "Blocking commands to ZoomRoom while waiting for user to enter meeting password"); - return; - } - - if (_waitingForUserToAcceptOrRejectIncomingCall) - { - Debug.Console(2, this, "Blocking commands to ZoomRoom while waiting for user to accept or reject incoming call"); - return; - } - - if (CommDebuggingIsOn) - { - Debug.Console(1, this, "Sending: '{0}'", command); - } - - Communication.SendText(command + SendDelimiter); - } - - /// - /// Gathers responses and enqueues them. - /// - /// - /// - private void Port_LineReceived(object dev, GenericCommMethodReceiveTextArgs args) - { - //Debug.Console(0, this, "Port_LineReceived"); - - if (args.Delimiter != JsonDelimiter) - { -// Debug.Console(0, this, -//@"Non JSON response: -//Delimiter: {0} -//{1}", ComTextHelper.GetDebugText(args.Delimiter), args.Text); - ProcessNonJsonResponse(args.Text); - return; - } - else - { -// Debug.Console(0, this, -//@"JSON response: -//Delimiter: {0} -//{1}", ComTextHelper.GetDebugText(args.Delimiter), args.Text); - _receiveQueue.Enqueue(new ProcessStringMessage(args.Text, DeserializeResponse)); - //_receiveQueue.Enqueue(new ProcessStringMessage(args.Text, ProcessMessage)); - } - } - - /// - /// Queues the initial queries to be sent upon connection - /// - private void SetUpSyncQueries() - { - // zStatus - _syncState.AddQueryToQueue("zStatus Call Status"); - _syncState.AddQueryToQueue("zStatus Audio Input Line"); - _syncState.AddQueryToQueue("zStatus Audio Output Line"); - _syncState.AddQueryToQueue("zStatus Video Camera Line"); - _syncState.AddQueryToQueue("zStatus Video Optimizable"); - _syncState.AddQueryToQueue("zStatus Capabilities"); - _syncState.AddQueryToQueue("zStatus Sharing"); - _syncState.AddQueryToQueue("zStatus CameraShare"); - _syncState.AddQueryToQueue("zStatus Call Layout"); - _syncState.AddQueryToQueue("zStatus Call ClosedCaption Available"); - _syncState.AddQueryToQueue("zStatus NumberOfScreens"); - - // zConfiguration - - _syncState.AddQueryToQueue("zConfiguration Call Sharing optimize_video_sharing"); - _syncState.AddQueryToQueue("zConfiguration Call Microphone Mute"); - _syncState.AddQueryToQueue("zConfiguration Call Camera Mute"); - _syncState.AddQueryToQueue("zConfiguration Audio Input SelectedId"); - _syncState.AddQueryToQueue("zConfiguration Audio Input is_sap_disabled"); - _syncState.AddQueryToQueue("zConfiguration Audio Input reduce_reverb"); - _syncState.AddQueryToQueue("zConfiguration Audio Input volume"); - _syncState.AddQueryToQueue("zConfiguration Audio Output selectedId"); - _syncState.AddQueryToQueue("zConfiguration Audio Output volume"); - _syncState.AddQueryToQueue("zConfiguration Video hide_conf_self_video"); - _syncState.AddQueryToQueue("zConfiguration Video Camera selectedId"); - _syncState.AddQueryToQueue("zConfiguration Video Camera Mirror"); - _syncState.AddQueryToQueue("zConfiguration Client appVersion"); - _syncState.AddQueryToQueue("zConfiguration Client deviceSystem"); - _syncState.AddQueryToQueue("zConfiguration Call Layout ShareThumb"); - _syncState.AddQueryToQueue("zConfiguration Call Layout Style"); - _syncState.AddQueryToQueue("zConfiguration Call Layout Size"); - _syncState.AddQueryToQueue("zConfiguration Call Layout Position"); - _syncState.AddQueryToQueue("zConfiguration Call Lock Enable"); - _syncState.AddQueryToQueue("zConfiguration Call MuteUserOnEntry Enable"); - _syncState.AddQueryToQueue("zConfiguration Call ClosedCaption FontSize "); - _syncState.AddQueryToQueue("zConfiguration Call ClosedCaption Visible"); - - // zCommand - - if (!_props.DisablePhonebookAutoDownload) - { - _syncState.AddQueryToQueue("zCommand Phonebook List Offset: 0 Limit: 10000"); - } - - _syncState.AddQueryToQueue("zCommand Bookings List"); - _syncState.AddQueryToQueue("zCommand Call ListParticipants"); - _syncState.AddQueryToQueue("zCommand Call Info"); - - - _syncState.StartSync(); - } - - private void SetupSession() - { - // disable echo of commands - SendText("echo off"); - // switch to json format - // set feedback exclusions - // Currently the feedback exclusions don't work when using the API in JSON response mode - // But leave these here in case the API gets updated in the future - // These may work as of 5.9.4 - - // In 5.9.4 we're getting sent an AddedContact message for every contact in the phonebook on connect, which is redunant and way too much data - // We want to exclude these messages right away until after we've retrieved the entire phonebook and then we can re-enable them - SendText("zFeedback Register Op: ex Path: /Event/Phonebook/AddedContact"); - - SendText("zFeedback Register Op: ex Path: /Event/InfoResult/Info/callin_country_list"); - SendText("zFeedback Register Op: ex Path: /Event/InfoResult/Info/callout_country_list"); - SendText("zFeedback Register Op: ex Path: /Event/InfoResult/Info/toll_free_callinLlist"); - - SendText("zStatus SystemUnit"); - } - - /// - /// Removes the feedback exclusion for added contacts - /// - private void ResubscribeForAddedContacts() - { - SendText("zFeedback Register Op: in Path: /Event/Phonebook/AddedContact"); - } - - /// - /// Processes non-JSON responses as their are received - /// - /// - private void ProcessNonJsonResponse(string response) - { - if (response.Contains("client_loop: send disconnect: Broken pipe")) - { - Debug.Console(1, this, Debug.ErrorLogLevel.Error, - "Zoom Room Controller or App connected. Essentials will NOT control the Zoom Room until it is disconnected."); - - return; - } - - if (!_syncState.InitialSyncComplete) - { - if(response.ToLower().Contains("*r login successful")) - { - _syncState.LoginResponseReceived(); - - SendText("format json"); - - SetupSession(); - } - - //switch (response.Trim().ToLower()) // remove the whitespace - //{ - // case "*r login successful": - // { - // _syncState.LoginMessageReceived(); - - // //// Fire up a thread to send the intial commands. - // //CrestronInvoke.BeginInvoke(o => - // //{ - // // disable echo of commands - // SendText("echo off"); - // // switch to json format - // SendText("format json"); - // // set feedback exclusions - // // Currently the feedback exclusions don't work when using the API in JSON response mode - // // But leave these here in case the API gets updated in the future - // // These may work as of 5.9.4 - // if (_props.DisablePhonebookAutoDownload) - // { - // SendText("zFeedback Register Op: ex Path: /Event/Phonebook/AddedContact"); - // } - // SendText("zFeedback Register Op: ex Path: /Event/InfoResult/Info/callin_country_list"); - // SendText("zFeedback Register Op: ex Path: /Event/InfoResult/Info/callout_country_list"); - // SendText("zFeedback Register Op: ex Path: /Event/InfoResult/Info/toll_free_callinLlist"); - - // //}); - - // break; - // } - //} - } - } - - /// - /// Processes messages as they are dequeued - /// - /// - private void ProcessMessage(string message) - { - // Counts the curly braces - if (message.Contains("client_loop: send disconnect: Broken pipe")) - { - Debug.Console(1, this, Debug.ErrorLogLevel.Error, - "Zoom Room Controller or App connected. Essentials will NOT control the Zoom Room until it is disconnected."); - - return; - } - - if (message.Contains('{')) - { - _jsonCurlyBraceCounter++; - } - - if (message.Contains('}')) - { - _jsonCurlyBraceCounter--; - } - - //Debug.Console(2, this, "JSON Curly Brace Count: {0}", _jsonCurlyBraceCounter); - - if (!_jsonFeedbackMessageIsIncoming && message.Trim('\x20') == "{" + EchoDelimiter) - // Check for the beginning of a new JSON message - { - _jsonFeedbackMessageIsIncoming = true; - _jsonCurlyBraceCounter = 1; // reset the counter for each new message - - _jsonMessage = new StringBuilder(); - - _jsonMessage.Append(message); - - if (CommDebuggingIsOn) - { - Debug.Console(2, this, "Incoming JSON message..."); - } - - return; - } - if (_jsonFeedbackMessageIsIncoming && message.Trim('\x20') == "}" + EchoDelimiter) - // Check for the end of a JSON message - { - _jsonMessage.Append(message); - - if (_jsonCurlyBraceCounter == 0) - { - _jsonFeedbackMessageIsIncoming = false; - - if (CommDebuggingIsOn) - { - Debug.Console(2, this, "Complete JSON Received:\n{0}", _jsonMessage.ToString()); - } - - // Forward the complete message to be deserialized - DeserializeResponse(_jsonMessage.ToString()); - } - - //JsonMessage = new StringBuilder(); - return; - } - - // NOTE: This must happen after the above conditions have been checked - // Append subsequent partial JSON fragments to the string builder - if (_jsonFeedbackMessageIsIncoming) - { - _jsonMessage.Append(message); - - //Debug.Console(1, this, "Building JSON:\n{0}", JsonMessage.ToString()); - return; - } - - if (CommDebuggingIsOn) - { - Debug.Console(1, this, "Non-JSON response: '{0}'", message); - } - - _jsonCurlyBraceCounter = 0; // reset on non-JSON response - - if (!_syncState.InitialSyncComplete) - { - switch (message.Trim().ToLower()) // remove the whitespace - { - case "*r login successful": - { - _syncState.LoginResponseReceived(); - - - // Fire up a thread to send the intial commands. - CrestronInvoke.BeginInvoke(o => - { - // Currently the feedback exclusions don't work when using the API in JSON response mode - // But leave these here in case the API gets updated in the future - - - Thread.Sleep(100); - // disable echo of commands - SendText("echo off"); - Thread.Sleep(100); - // set feedback exclusions - SendText("zFeedback Register Op: ex Path: /Event/InfoResult/Info/callin_country_list"); - Thread.Sleep(100); - SendText("zFeedback Register Op: ex Path: /Event/InfoResult/Info/callout_country_list"); - Thread.Sleep(100); - SendText("zFeedback Register Op: ex Path: /Event/InfoResult/Info/toll_free_callinLlist"); - Thread.Sleep(100); - - if (_props.DisablePhonebookAutoDownload) - { - SendText("zFeedback Register Op: ex Path: /Event/Phonebook/AddedContact"); - } - // switch to json format - SendText("format json"); - }); - - break; - } - } - } - } - - /// - /// Deserializes a JSON formatted response - /// - /// - private void DeserializeResponse(string response) - { - try - { - var trimmedResponse = response.Trim(); - - if (trimmedResponse.Length <= 0) - { - return; - } - - var message = JObject.Parse(trimmedResponse); - - if (!_syncState.FirstJsonResponseWasReceived) - { - _syncState.ReceivedFirstJsonResponse(); - } - - var eType = - (eZoomRoomResponseType) - Enum.Parse(typeof (eZoomRoomResponseType), message["type"].Value(), true); - - var topKey = message["topKey"].Value(); - - var responseObj = message[topKey]; - - Debug.Console(1, this, "{0} Response Received. topKey: '{1}'\n{2}", eType, topKey, responseObj.ToString().Replace("\n", CrestronEnvironment.NewLine)); - - switch (eType) - { - case eZoomRoomResponseType.zConfiguration: - { - switch (topKey.ToLower()) - { - case "call": - { - JsonConvert.PopulateObject(responseObj.ToString(), Configuration.Call); - - break; - } - case "audio": - { - JsonConvert.PopulateObject(responseObj.ToString(), Configuration.Audio); - - break; - } - case "video": - { - JsonConvert.PopulateObject(responseObj.ToString(), Configuration.Video); - - break; - } - case "client": - { - JsonConvert.PopulateObject(responseObj.ToString(), Configuration.Client); - - break; - } - default: - { - break; - } - } - break; - } - case eZoomRoomResponseType.zCommand: - { - switch (topKey.ToLower()) - { - case "inforesult": - { - JsonConvert.PopulateObject(responseObj.ToString(), Status.Call.Info); - break; - } - case "phonebooklistresult": - { - // This result will always be the complete contents of the directory and never - // A subset of the results via a search - - // Clear out any existing data - Status.Phonebook = new zStatus.Phonebook(); - - JsonConvert.PopulateObject(responseObj.ToString(), Status.Phonebook); - - UpdateDirectory(); - - break; - } - case "listparticipantsresult": - { - Debug.Console(1, this, "JTokenType: {0}", responseObj.Type); - - switch (responseObj.Type) - { - case JTokenType.Array: - Status.Call.Participants = - JsonConvert.DeserializeObject>( - responseObj.ToString()); - break; - case JTokenType.Object: - { - // this is a single participant event notification - - var participant = - JsonConvert.DeserializeObject( - responseObj.ToString()); - - if (participant != null) - { - Debug.Console(1, this, - "[DeserializeResponse] zCommands.listparticipantresult - participant.event: {0} **********************************", - participant.Event); - Debug.Console(1, this, - "[DeserializeResponse] zCommands.listparticipantresult - participant.event: {0} - UserId: {1} Name: {2} IsHost: {3}", - participant.Event, participant.UserId, participant.UserName, participant.IsHost); - - switch (participant.Event) - { - case "ZRCUserChangedEventUserInfoUpdated": - case "ZRCUserChangedEventLeftMeeting": - { - var existingParticipant = - Status.Call.Participants.FirstOrDefault( - p => p.UserId.Equals(participant.UserId)); - - if (existingParticipant != null) - { - switch (participant.Event) - { - case "ZRCUserChangedEventLeftMeeting": - Status.Call.Participants.Remove(existingParticipant); - break; - case "ZRCUserChangedEventUserInfoUpdated": - JsonConvert.PopulateObject(responseObj.ToString(), - existingParticipant); - break; - } - } - } - break; - case "ZRCUserChangedEventJoinedMeeting": - { - var existingParticipant = - Status.Call.Participants.FirstOrDefault(p => p.UserId.Equals(participant.UserId)); - - if (existingParticipant != null) - { - Debug.Console(1, this, - "[DeserializeResponse] zCommands.listparticipantresult - participant.event: {0} ...updating matching UserId participant with UserId: {1} UserName: {2}", - participant.Event, participant.UserId, participant.UserName); - - JsonConvert.PopulateObject(responseObj.ToString(), existingParticipant); - } - else - { - Debug.Console(1, this, - "[DeserializeResponse] zCommands.listparticipantresult - participant.event: {0} ...adding participant with UserId: {1} UserName: {2}", - participant.Event, participant.UserId, participant.UserName); - - Status.Call.Participants.Add(participant); - } - - break; - } - } - - Debug.Console(1, this, - "[DeserializeResponse] zCommands.listparticipantresult - participant.event: {0} ***********************************", - participant.Event); - } - } - break; - } - - var participants = - zCommand.ListParticipant.GetGenericParticipantListFromParticipantsResult( - Status.Call.Participants); - - Participants.CurrentParticipants = participants; - - // Update the share status of the meeting info - var meetingInfo = new MeetingInfo( - MeetingInfo.Id, - MeetingInfo.Name, - Participants.Host.Name, - MeetingInfo.Password, - GetSharingStatus(), - GetIsHostMyself(), - MeetingInfo.IsSharingMeeting, - MeetingInfo.WaitingForHost, - MeetingIsLockedFeedback.BoolValue, - MeetingIsRecordingFeedback.BoolValue, - Status.Call.CallRecordInfo.AllowRecord - ); - MeetingInfo = meetingInfo; - - PrintCurrentCallParticipants(); - - break; - } - default: - { - break; - } - } - break; - } - case eZoomRoomResponseType.zEvent: - { - switch (topKey.ToLower()) - { - case "phonebook": - { - zStatus.Contact contact = new zStatus.Contact(); - - if (responseObj["Updated Contact"] != null) - { - contact = responseObj["Updated Contact"].ToObject(); - } - else if (responseObj["Added Contact"] != null) - { - contact = responseObj["Added Contact"].ToObject(); - } - - var existingContactIndex = Status.Phonebook.Contacts.FindIndex(c => c.Jid.Equals(contact.Jid)); - - if (existingContactIndex > 0) - { - Status.Phonebook.Contacts[existingContactIndex] = contact; - } - else - { - Status.Phonebook.Contacts.Add(contact); - } - - if(contactsDebounceTimer == null) - { - contactsDebounceTimer = new CTimer(o => UpdateDirectory(), 2000); - } - else - { - contactsDebounceTimer.Reset(); - } - - break; - } - case "bookingslistresult": - { - if (!_syncState.InitialSyncComplete) - { - _syncState.LastQueryResponseReceived(); - } - - var codecBookings = JsonConvert.DeserializeObject>( - responseObj.ToString()); - - if (codecBookings != null && codecBookings.Count > 0) - { - CodecSchedule.Meetings = zCommand.GetGenericMeetingsFromBookingResult( - codecBookings, CodecSchedule.MeetingWarningMinutes); - } - else - { - //need to clear the list if it's empty - CodecSchedule.Meetings = new List(); - } - - break; - } - case "bookings updated": - { - GetBookings(); - - break; - } - case "sharingstate": - { - JsonConvert.PopulateObject(responseObj.ToString(), Status.Call.Sharing); - - SetDefaultLayout(); - - break; - } - case "incomingcallindication": - { - var incomingCall = - JsonConvert.DeserializeObject(responseObj.ToString()); - - if (incomingCall != null) - { - var newCall = new CodecActiveCallItem - { - Direction = eCodecCallDirection.Incoming, - Status = eCodecCallStatus.Ringing, - Type = eCodecCallType.Video, - Name = incomingCall.callerName, - Id = incomingCall.callerJID - }; - - _waitingForUserToAcceptOrRejectIncomingCall = true; - - ActiveCalls.Add(newCall); - - OnCallStatusChange(newCall); - } - - break; - } - case "treatedincomingcallindication": - { - var incomingCall = - JsonConvert.DeserializeObject(responseObj.ToString()); - - if (incomingCall != null) - { - var existingCall = - ActiveCalls.FirstOrDefault(c => c.Id.Equals(incomingCall.callerJID)); - - if (existingCall != null) - { - existingCall.Status = !incomingCall.accepted - ? eCodecCallStatus.Disconnected - : eCodecCallStatus.Connecting; - - OnCallStatusChange(existingCall); - } - - _waitingForUserToAcceptOrRejectIncomingCall = false; - - UpdateCallStatus(); - } - - break; - } - case "calldisconnect": - { - var disconnectEvent = - JsonConvert.DeserializeObject(responseObj.ToString()); - - Debug.Console(1, this, - "[DeserializeResponse] zEvent.calldisconnect ********************************************"); - Debug.Console(1, this, "[DeserializeResponse] zEvent.calldisconnect - disconnectEvent.Successful: {0}", - disconnectEvent.Successful); - - if (disconnectEvent.Successful) - { - if (ActiveCalls.Count > 0) - { - var activeCall = ActiveCalls.FirstOrDefault(c => c.IsActiveCall); - - if (activeCall != null) - { - Debug.Console(1, this, - "[DeserializeResponse] zEvent.calldisconnect - ActiveCalls.Count: {0} activeCall.Id: {1}, activeCall.Number: {2} activeCall.Name: {3}, activeCall.IsActive: {4}", - ActiveCalls.Count, activeCall.Id, activeCall.Number, activeCall.Name, activeCall.IsActiveCall); - activeCall.Status = eCodecCallStatus.Disconnected; - - OnCallStatusChange(activeCall); - } - } - } - - Debug.Console(1, this, - "[DeserializeResponse] zEvent.calldisconnect ********************************************"); - - UpdateCallStatus(); - break; - } - case "callconnecterror": - { - UpdateCallStatus(); - break; - } - case "videounmuterequest": - { - var handler = VideoUnmuteRequested; - - if (handler != null) - { - handler(this, null); - } - - break; - } - case "meetingneedspassword": - { - var meetingNeedsPassword = - responseObj.ToObject(); - - if (meetingNeedsPassword.NeedsPassword) - { - var prompt = "Password required to join this meeting. Please enter the meeting password."; - - OnPasswordRequired(meetingNeedsPassword.WrongAndRetry, false, false, prompt); - } - else - { - OnPasswordRequired(false, false, true, ""); - } - - break; - } - case "needwaitforhost": - { - Status.NeedWaitForHost = JsonConvert.DeserializeObject(responseObj.ToString()); - - Debug.Console(1, this, "WaitingForHost: {0}", Status.NeedWaitForHost.Wait); - - if (Status.NeedWaitForHost.Wait) - { - if (MeetingInfo == null) - { - MeetingInfo = new MeetingInfo("Waiting For Host", "Waiting For Host", "Waiting For Host", "", - GetSharingStatus(), false, false, true, MeetingIsLockedFeedback.BoolValue, MeetingIsRecordingFeedback.BoolValue, Status.Call.CallRecordInfo.AllowRecord); - - UpdateCallStatus(); - break; - } - - MeetingInfo = new MeetingInfo("Waiting For Host", "Waiting For Host", "Waiting For Host", "", - GetSharingStatus(), false, false, true, MeetingIsLockedFeedback.BoolValue, MeetingIsRecordingFeedback.BoolValue, Status.Call.CallRecordInfo.AllowRecord); - - UpdateCallStatus(); - - break; - } - - if (MeetingInfo == null) - { - MeetingInfo = new MeetingInfo("Waiting For Host", "Waiting For Host", "Waiting For Host", "", - GetSharingStatus(), false, false, false, MeetingIsLockedFeedback.BoolValue, MeetingIsRecordingFeedback.BoolValue, Status.Call.CallRecordInfo.AllowRecord); - break; - } - - MeetingInfo = new MeetingInfo(MeetingInfo.Id, MeetingInfo.Name, MeetingInfo.Host, MeetingInfo.Password, - GetSharingStatus(), GetIsHostMyself(), false, false, MeetingIsLockedFeedback.BoolValue, MeetingIsRecordingFeedback.BoolValue, Status.Call.CallRecordInfo.AllowRecord); - - break; - } - case "openvideofailforhoststop": - { - // TODO: notify user that host has disabled unmuting video - break; - } - case "updatecallrecordinfo": - { - JsonConvert.PopulateObject(responseObj.ToString(), Status.Call.CallRecordInfo); - - break; - } - case "recordingconsent": - { - _recordConsentPromptIsVisible = responseObj["isShow"].Value(); - RecordConsentPromptIsVisible.FireUpdate(); - break; - } - case "phonecallstatus": - { - JsonConvert.PopulateObject(responseObj.ToString(), Status.PhoneCall); - break; - } - case "pinstatusofscreennotification": - { - var status = responseObj.ToObject(); - - Debug.Console(1, this, "Pin Status notification for UserId: {0}, ScreenIndex: {1}", status.PinnedUserId, - status.ScreenIndex); - - Participant alreadyPinnedParticipant = null; - - // Check for a participant already pinned to the same screen index. - if (status.PinnedUserId > 0) - { - alreadyPinnedParticipant = - Participants.CurrentParticipants.FirstOrDefault(p => p.ScreenIndexIsPinnedToFb.Equals(status.ScreenIndex)); - - // Make sure that the already pinned participant isn't the same ID as for this message. If true, clear the pinned fb. - if (alreadyPinnedParticipant != null && alreadyPinnedParticipant.UserId != status.PinnedUserId) - { - Debug.Console(1, this, "Participant: {0} with id: {1} already pinned to screenIndex {2}. Clearing pinned fb.", - alreadyPinnedParticipant.Name, alreadyPinnedParticipant.UserId, - alreadyPinnedParticipant.ScreenIndexIsPinnedToFb); - alreadyPinnedParticipant.IsPinnedFb = false; - alreadyPinnedParticipant.ScreenIndexIsPinnedToFb = -1; - } - } - - var participant = Participants.CurrentParticipants.FirstOrDefault(p => p.UserId.Equals(status.PinnedUserId)); - - if (participant != null) - { - participant.IsPinnedFb = true; - participant.ScreenIndexIsPinnedToFb = status.ScreenIndex; - } - else - { - participant = - Participants.CurrentParticipants.FirstOrDefault(p => p.ScreenIndexIsPinnedToFb.Equals(status.ScreenIndex)); - - if (participant == null && alreadyPinnedParticipant == null) - { - Debug.Console(1, this, "no matching participant found by pinned_user_id: {0} or screen_index: {1}", - status.PinnedUserId, status.ScreenIndex); - return; - } - else if (participant != null) - { - Debug.Console(2, this, "Unpinning {0} with id: {1} from screen index: {2}", participant.Name, - participant.UserId, status.ScreenIndex); - participant.IsPinnedFb = false; - participant.ScreenIndexIsPinnedToFb = -1; - } - } - - // fire the event as we've modified the participants list - Participants.OnParticipantsChanged(); - - break; - } - case "startlocalpresentmeeting": - { - var result = JsonConvert.DeserializeObject(responseObj.ToString()); - - if (result.Success) - { - MeetingInfo = new MeetingInfo("", "", "", "", GetSharingStatus(), true, true, MeetingInfo.WaitingForHost, MeetingIsLockedFeedback.BoolValue, MeetingIsRecordingFeedback.BoolValue, Status.Call.CallRecordInfo.AllowRecord); - break; - } - - break; - } - default: - { - break; - } - } - break; - } - case eZoomRoomResponseType.zStatus: - { - switch (topKey.ToLower()) - { - case "login": - { - _syncState.LoginResponseReceived(); - - SetupSession(); - - JsonConvert.PopulateObject(responseObj.ToString(), Status.Login); - - break; - } - case "systemunit": - { - - JsonConvert.PopulateObject(responseObj.ToString(), Status.SystemUnit); - - break; - } - case "call": - { - JsonConvert.PopulateObject(responseObj.ToString(), Status.Call); - - Debug.Console(1, this, - "[DeserializeResponse] zStatus.call - Status.Call.Info.meeting_id: {0} Status.Call.Info.meeting_list_item.meetingName: {1}", - Status.Call.Info.meeting_id, Status.Call.Info.meeting_list_item.meetingName); - foreach (var participant in Status.Call.Participants) - { - Debug.Console(1, this, - "[DeserializeResponse] zStatus.call - Status.Call.Participants participant.UserId: {0} participant.UserName: {1}", - participant.UserId, participant.UserName); - } - - UpdateCallStatus(); - - break; - } - case "capabilities": - { - JsonConvert.PopulateObject(responseObj.ToString(), Status.Capabilities); - break; - } - case "sharing": - { - JsonConvert.PopulateObject(responseObj.ToString(), Status.Sharing); - - break; - } - case "numberofscreens": - { - JsonConvert.PopulateObject(responseObj.ToString(), Status.NumberOfScreens); - break; - } - case "video": - { - JsonConvert.PopulateObject(responseObj.ToString(), Status.Video); - break; - } - case "camerashare": - { - JsonConvert.PopulateObject(responseObj.ToString(), Status.CameraShare); - break; - } - case "layout": - { - JsonConvert.PopulateObject(responseObj.ToString(), Status.Layout); - break; - } - case "audio input line": - { - JsonConvert.PopulateObject(responseObj.ToString(), Status.AudioInputs); - break; - } - case "audio output line": - { - JsonConvert.PopulateObject(responseObj.ToString(), Status.AudioOuputs); - break; - } - case "video camera line": - { - Status.Cameras.Clear(); - - JsonConvert.PopulateObject(responseObj.ToString(), Status.Cameras); - - if (!_syncState.CamerasHaveBeenSetUp) - { - SetUpCameras(); - } - - break; - } - default: - { - break; - } - } - - break; - } - default: - { - Debug.Console(1, "Unknown Response Type:"); - break; - } - } - } - catch (Exception ex) - { - Debug.Console(1, this, "Error Deserializing feedback: {0}", ex.Message); - Debug.Console(2, this, "{0}", ex); - - if (ex.InnerException != null) - { - Debug.Console(1, this,"Error Deserializing feedback inner exception: {0}", ex.InnerException.Message); - Debug.Console(2, this, "{0}", ex.InnerException.StackTrace); - } - } - } - - private void SetDefaultLayout() - { - if (!_props.AutoDefaultLayouts) return; - - if ( - (Status.Call.Sharing.State == zEvent.eSharingState.Receiving || - Status.Call.Sharing.State == zEvent.eSharingState.Sending)) - { - SendText(String.Format("zconfiguration call layout style: {0}", - _props.DefaultSharingLayout)); - } - else - { - if (_props.DefaultCallLayout == (_props.DefaultCallLayout & AvailableLayouts)) - { - SendText(String.Format("zconfiguration call layout style: {0}", - _props.DefaultCallLayout)); - } - else - Debug.Console(0, this, "Unable to set default Layout. {0} not currently an available layout based on meeting state", _props.DefaultCallLayout); - } - } - - /// - /// Retrieves the current call participants list - /// - public void GetCurrentCallParticipants() - { - SendText("zCommand Call ListParticipants"); - } - - /// - /// Prints the current call particiapnts list - /// - public void PrintCurrentCallParticipants() - { - if (Debug.Level <= 0) return; - - Debug.Console(1, this, "*************************** Call Participants **************************"); - foreach (var participant in Participants.CurrentParticipants) - { - Debug.Console(1, this, "UserId: {3} Name: {0} Audio: {1} IsHost: {2}", - participant.Name, participant.AudioMuteFb, participant.IsHost, participant.UserId); - } - Debug.Console(1, this, "************************************************************************"); - } - - /// - /// Retrieves bookings list - /// - private void GetBookings() - { - if (_meetingPasswordRequired || _waitingForUserToAcceptOrRejectIncomingCall) return; - - SendText("zCommand Bookings List"); - } - - - /// - /// Updates the current call status - /// - private void UpdateCallStatus() - { - Debug.Console(1, this, - "[UpdateCallStatus] Current Call Status: {0} Active Call Count: {1} Need Wait For Host: {2}", - Status.Call != null ? Status.Call.Status.ToString() : "no call", ActiveCalls.Count, Status.NeedWaitForHost.Wait); - - if (Status.Call != null) - { - var callStatus = Status.Call.Status; - - // If not crrently in a meeting, intialize the call object - if (callStatus != zStatus.eCallStatus.IN_MEETING && callStatus != zStatus.eCallStatus.CONNECTING_MEETING) - { - Status.Call = new zStatus.Call {Status = callStatus}; - // Resubscribe to all property change events after Status.Call is reconstructed - SetUpCallFeedbackActions(); - - OnCallStatusChange(new CodecActiveCallItem() {Status = eCodecCallStatus.Disconnected}); - } - - if (ActiveCalls.Count == 0) - { - if (callStatus == zStatus.eCallStatus.CONNECTING_MEETING || - callStatus == zStatus.eCallStatus.IN_MEETING) - { - var newStatus = eCodecCallStatus.Unknown; - - switch (callStatus) - { - case zStatus.eCallStatus.CONNECTING_MEETING: - newStatus = eCodecCallStatus.Connecting; - break; - case zStatus.eCallStatus.IN_MEETING: - newStatus = eCodecCallStatus.Connected; - break; - } - - if (!string.IsNullOrEmpty(Status.Call.Info.meeting_id)) - { - var newCall = new CodecActiveCallItem - { - Name = Status.Call.Info.meeting_list_item.meetingName, - Number = Status.Call.Info.meeting_list_item.meetingNumber, - Id = Status.Call.Info.meeting_id, - Status = newStatus, - Type = eCodecCallType.Video, - }; - - if (!String.IsNullOrEmpty(_lastDialedMeetingNumber)) - { - _lastDialedMeetingNumber = String.Empty; - } - ActiveCalls.Add(newCall); - - OnCallStatusChange(newCall); - } else if (String.IsNullOrEmpty(Status.Call.Info.meeting_id) && Status.NeedWaitForHost.Wait) - { - var newCall = new CodecActiveCallItem - { - Name = "Waiting For Host", - Number = "Waiting For Host", - Id = "Waiting For Host", - Status = newStatus, - Type = eCodecCallType.Video, - }; - - if (!String.IsNullOrEmpty(_lastDialedMeetingNumber)) - { - _lastDialedMeetingNumber = String.Empty; - } - - ActiveCalls.Add(newCall); - - OnCallStatusChange(newCall); - } - } - } - else - { - var existingCall = ActiveCalls.FirstOrDefault(c => !c.Status.Equals(eCodecCallStatus.Ringing)); - - switch (callStatus) - { - case zStatus.eCallStatus.IN_MEETING: - if (Status.NeedWaitForHost.Wait) - { - Status.NeedWaitForHost.Wait = false; - } - existingCall.Status = eCodecCallStatus.Connected; - break; - case zStatus.eCallStatus.NOT_IN_MEETING: - if (Status.NeedWaitForHost.Wait) - { - Status.NeedWaitForHost.Wait = false; - } - existingCall.Status = eCodecCallStatus.Disconnected; - break; - } - - Debug.Console(1, this, "[UpdateCallStatus] ELSE ActiveCalls.Count == {1} - Current Call Status: {0}", - Status.Call != null ? Status.Call.Status.ToString() : "no call", ActiveCalls.Count); - - - OnCallStatusChange(existingCall); - } - } - - Debug.Console(1, this, "[UpdateCallStatus] Active Calls ------------------------------"); - - // Clean up any disconnected calls left in the list - for (int i = 0; i < ActiveCalls.Count; i++) - { - var call = ActiveCalls[i]; - - Debug.Console(1, this, - @"ID: {1} - Number: {5} - Name: {0} - IsActive: {2} - Status: {3} - Direction: {4} - IsActiveCall: {6}", call.Name, call.Id, call.IsActiveCall, call.Status, call.Direction, call.Number, - call.IsActiveCall); - - if (!call.IsActiveCall) - { - Debug.Console(1, this, "[UpdateCallStatus] Removing Inactive call.Id: {1} call.Name: {0}", call.Name, call.Id); - ActiveCalls.Remove(call); - } - } - Debug.Console(1, this, "[UpdateCallStatus] Active Calls ------------------------------"); - - //clear participants list after call cleanup - var emptyList = new List(); - Participants.CurrentParticipants = emptyList; - if (ActiveCalls.Count > 0) GetCurrentCallParticipants(); - } - - protected override void OnCallStatusChange(CodecActiveCallItem item) - { - if (item.Status == eCodecCallStatus.Connected) - { - - var host = ""; - - if (Participants.Host != null) - host = Participants.Host.Name; - - MeetingInfo = new MeetingInfo( - Status.Call.Info.meeting_id, - Status.Call.Info.meeting_list_item.meetingName, - host, - Status.Call.Info.meeting_password, - GetSharingStatus(), - GetIsHostMyself(), - !String.Equals(Status.Call.Info.meeting_type,"NORMAL"), - false, - MeetingIsLockedFeedback.BoolValue, - MeetingIsRecordingFeedback.BoolValue, Status.Call.CallRecordInfo.AllowRecord - ); - - SetDefaultLayout(); - } - - else if (item.Status == eCodecCallStatus.Disconnected) - { - MeetingInfo = new MeetingInfo( - string.Empty, - string.Empty, - string.Empty, - string.Empty, - string.Empty, - false, - false, - false, - false, - false, Status.Call.CallRecordInfo.AllowRecord - ); - } - - _meetingPasswordRequired = false; - base.OnCallStatusChange(item); - - Debug.Console(1, this, "[OnCallStatusChange] Current Call Status: {0}", - Status.Call != null ? Status.Call.Status.ToString() : "no call"); - } - - private string GetSharingStatus() - { - string sharingState = "None"; - - try - { - if (Status.Call.Sharing.State == zEvent.eSharingState.Receiving) - { - sharingState = "Receiving Content"; - } - if (Status.Sharing.isAirHostClientConnected) - { - sharingState = "Sharing AirPlay"; - } - if (Status.Sharing.isDirectPresentationConnected) - { - sharingState = "Sharing Laptop"; - } - if (Status.Sharing.isSharingBlackMagic) - { - sharingState = "Sharing HDMI Source"; - } - - return sharingState; - } - catch (Exception e) - { - Debug.Console(1, this, "Exception getting sharing status: {0}", e.Message); - Debug.Console(2, this, "{0}", e.StackTrace); - return sharingState; - } - } - - private void UpdateDirectory() - { - Debug.Console(2, this, "Updating directory"); - var directoryResults = zStatus.Phonebook.ConvertZoomContactsToGeneric(Status.Phonebook.Contacts); - - if (!PhonebookSyncState.InitialSyncComplete) - { - PhonebookSyncState.InitialPhonebookFoldersReceived(); - PhonebookSyncState.PhonebookRootEntriesReceived(); - PhonebookSyncState.SetPhonebookHasFolders(true); - PhonebookSyncState.SetNumberOfContacts(Status.Phonebook.Contacts.Count); - } - - directoryResults.ResultsFolderId = "root"; - - DirectoryRoot = directoryResults; - - CurrentDirectoryResult = directoryResults; - - // - if (contactsDebounceTimer != null) - { - ClearContactDebounceTimer(); - } - } - - private void ClearContactDebounceTimer() - { - Debug.Console(2, this, "Clearing Timer"); - if (!contactsDebounceTimer.Disposed && contactsDebounceTimer != null) - { - contactsDebounceTimer.Dispose(); - contactsDebounceTimer = null; - } - } - - /// - /// Will return true if the host is myself (this zoom room) - /// - /// - private bool GetIsHostMyself() - { - try - { - if (Participants.CurrentParticipants.Count == 0) - { - Debug.Console(2, this, "No current participants"); - return false; - } - - var host = Participants.Host; - - if(host == null) - { - Debug.Console(2, this, "Host is currently null"); - return false; - } - Debug.Console(2, this, "Host is: '{0}' IsMyself?: {1}", host.Name, host.IsMyself); - return host.IsMyself; - } - catch (Exception e) - { - Debug.Console(1, "Exception getting isHost: {0}", e.Message); - Debug.Console(2, "{0}", e.StackTrace); - return false; - } - } - - /// - /// Starts sharing HDMI source - /// - public override void StartSharing() - { - SendText("zCommand Call Sharing HDMI Start"); - } - - /// - /// Stops sharing the current presentation - /// - public override void StopSharing() - { - if (Status.Sharing.isSharingBlackMagic) - { - SendText("zCommand Call Sharing HDMI Stop"); - } - else - { - SendText("zCommand Call Sharing Disconnect"); - } - } - - public override void PrivacyModeOn() - { - SendText("zConfiguration Call Microphone Mute: on"); - } - - public override void PrivacyModeOff() - { - SendText("zConfiguration Call Microphone Mute: off"); - } - - public override void PrivacyModeToggle() - { - if (PrivacyModeIsOnFeedback.BoolValue) - { - PrivacyModeOff(); - } - else - { - PrivacyModeOn(); - } - } - - public override void MuteOff() - { - Debug.Console(2, this, "Unmuting to previous level: {0}", _previousVolumeLevel); - SetVolume((ushort) _previousVolumeLevel); - } - - public override void MuteOn() - { - SetVolume(0); - } - - public override void MuteToggle() - { - if (MuteFeedback.BoolValue) - { - MuteOff(); - } - else - { - MuteOn(); - } - } - - - /// - /// Increments the voluem - /// - /// - public override void VolumeUp(bool pressRelease) - { - // TODO: Implment volume decrement that calls SetVolume() - } - - /// - /// Decrements the volume - /// - /// - public override void VolumeDown(bool pressRelease) - { - // TODO: Implment volume decrement that calls SetVolume() - } - - /// - /// Scales the level and sets the codec to the specified level within its range - /// - /// level from slider (0-65535 range) - public override void SetVolume(ushort level) - { - var scaledLevel = CrestronEnvironment.ScaleWithLimits(level, 65535, 0, 100, 0); - SendText(string.Format("zConfiguration Audio Output volume: {0}", scaledLevel)); - } - - /// - /// Recalls the default volume on the codec - /// - public void VolumeSetToDefault() - { - } - - /// - /// - /// - public override void StandbyActivate() - { - // No corresponding function on device - } - - /// - /// - /// - public override void StandbyDeactivate() - { - // No corresponding function on device - } - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new ZoomRoomJoinMap(joinStart); - - var customJoins = JoinMapHelper.TryGetJoinMapAdvancedForDevice(joinMapKey); - - if (customJoins != null) - { - joinMap.SetCustomJoinData(customJoins); - } - - if (bridge != null) - { - bridge.AddJoinMap(Key, joinMap); - } - - LinkVideoCodecToApi(this, trilist, joinMap); - - LinkZoomRoomToApi(trilist, joinMap); - } - - /// - /// Links all the specific Zoom functionality to the API bridge - /// - /// - /// - public void LinkZoomRoomToApi(BasicTriList trilist, ZoomRoomJoinMap joinMap) - { - var meetingInfoCodec = this as IHasMeetingInfo; - if (meetingInfoCodec != null) - { - if (meetingInfoCodec.MeetingInfo != null) - { - trilist.SetBool(joinMap.MeetingCanRecord.JoinNumber, meetingInfoCodec.MeetingInfo.CanRecord); - } - - meetingInfoCodec.MeetingInfoChanged += (o, a) => - { - trilist.SetBool(joinMap.MeetingCanRecord.JoinNumber, a.Info.CanRecord); - }; - } - - var recordingCodec = this as IHasMeetingRecordingWithPrompt; - if (recordingCodec != null) - { - trilist.SetSigFalseAction(joinMap.StartRecording.JoinNumber, () => recordingCodec.StartRecording()); - trilist.SetSigFalseAction(joinMap.StopRecording.JoinNumber, () => recordingCodec.StopRecording()); - - recordingCodec.MeetingIsRecordingFeedback.LinkInputSig(trilist.BooleanInput[joinMap.StartRecording.JoinNumber]); - recordingCodec.MeetingIsRecordingFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.StopRecording.JoinNumber]); - - trilist.SetSigFalseAction(joinMap.RecordingPromptAgree.JoinNumber, () => recordingCodec.RecordingPromptAcknowledgement(true)); - trilist.SetSigFalseAction(joinMap.RecordingPromptDisagree.JoinNumber, () => recordingCodec.RecordingPromptAcknowledgement(false)); - - recordingCodec.RecordConsentPromptIsVisible.LinkInputSig(trilist.BooleanInput[joinMap.RecordConsentPromptIsVisible.JoinNumber]); - } - - var layoutsCodec = this as IHasZoomRoomLayouts; - if (layoutsCodec != null) - { - layoutsCodec.LayoutInfoChanged += (o, a) => - { - trilist.SetBool(joinMap.LayoutGalleryIsAvailable.JoinNumber, - zConfiguration.eLayoutStyle.Gallery == (a.AvailableLayouts & zConfiguration.eLayoutStyle.Gallery)); - - trilist.SetBool(joinMap.LayoutSpeakerIsAvailable.JoinNumber, - zConfiguration.eLayoutStyle.Speaker == (a.AvailableLayouts & zConfiguration.eLayoutStyle.Speaker)); - - - - trilist.SetBool(joinMap.LayoutStripIsAvailable.JoinNumber, zConfiguration.eLayoutStyle.Strip - == - (a.AvailableLayouts & zConfiguration.eLayoutStyle.Strip)); - trilist.SetBool(joinMap.LayoutShareAllIsAvailable.JoinNumber, zConfiguration.eLayoutStyle.ShareAll - == - (a.AvailableLayouts & - zConfiguration.eLayoutStyle.ShareAll)); - - // pass the names used to set the layout through the bridge - trilist.SetString(joinMap.LayoutGalleryIsAvailable.JoinNumber, zConfiguration.eLayoutStyle.Gallery.ToString()); - trilist.SetString(joinMap.LayoutSpeakerIsAvailable.JoinNumber, zConfiguration.eLayoutStyle.Speaker.ToString()); - trilist.SetString(joinMap.LayoutStripIsAvailable.JoinNumber, zConfiguration.eLayoutStyle.Strip.ToString()); - trilist.SetString(joinMap.LayoutShareAllIsAvailable.JoinNumber, zConfiguration.eLayoutStyle.ShareAll.ToString()); - }; - - trilist.SetSigFalseAction(joinMap.SwapContentWithThumbnail.JoinNumber, () => layoutsCodec.SwapContentWithThumbnail()); - - layoutsCodec.CanSwapContentWithThumbnailFeedback.LinkInputSig( - trilist.BooleanInput[joinMap.CanSwapContentWithThumbnail.JoinNumber]); - layoutsCodec.ContentSwappedWithThumbnailFeedback.LinkInputSig( - trilist.BooleanInput[joinMap.SwapContentWithThumbnail.JoinNumber]); - - layoutsCodec.LayoutViewIsOnFirstPageFeedback.LinkInputSig( - trilist.BooleanInput[joinMap.LayoutIsOnFirstPage.JoinNumber]); - layoutsCodec.LayoutViewIsOnLastPageFeedback.LinkInputSig(trilist.BooleanInput[joinMap.LayoutIsOnLastPage.JoinNumber]); - trilist.SetSigFalseAction(joinMap.LayoutTurnToNextPage.JoinNumber, () => layoutsCodec.LayoutTurnNextPage()); - trilist.SetSigFalseAction(joinMap.LayoutTurnToPreviousPage.JoinNumber, () => layoutsCodec.LayoutTurnPreviousPage()); - trilist.SetSigFalseAction(joinMap.GetAvailableLayouts.JoinNumber, () => layoutsCodec.GetAvailableLayouts()); - - trilist.SetStringSigAction(joinMap.GetSetCurrentLayout.JoinNumber, (s) => - { - try - { - var style = (zConfiguration.eLayoutStyle) Enum.Parse(typeof (zConfiguration.eLayoutStyle), s, true); - SetLayout(style); - } - catch (Exception e) - { - Debug.Console(1, this, "Unable to parse '{0}' to zConfiguration.eLayoutStyle: {1}", s, e); - } - }); - - layoutsCodec.LocalLayoutFeedback.LinkInputSig(trilist.StringInput[joinMap.GetSetCurrentLayout.JoinNumber]); - } - - var pinCodec = this as IHasParticipantPinUnpin; - if (pinCodec != null) - { - pinCodec.NumberOfScreensFeedback.LinkInputSig(trilist.UShortInput[joinMap.NumberOfScreens.JoinNumber]); - - // Set the value of the local property to be used when pinning a participant - trilist.SetUShortSigAction(joinMap.ScreenIndexToPinUserTo.JoinNumber, (u) => ScreenIndexToPinUserTo = u); - } - - var layoutSizeCodec = this as IHasSelfviewSize; - if (layoutSizeCodec != null) - { - trilist.SetSigFalseAction(joinMap.GetSetSelfviewPipSize.JoinNumber, layoutSizeCodec.SelfviewPipSizeToggle); - trilist.SetStringSigAction(joinMap.GetSetSelfviewPipSize.JoinNumber, (s) => - { - try - { - var size = (zConfiguration.eLayoutSize) Enum.Parse(typeof (zConfiguration.eLayoutSize), s, true); - var cmd = SelfviewPipSizes.FirstOrDefault(c => c.Command.Equals(size.ToString())); - SelfviewPipSizeSet(cmd); - } - catch (Exception e) - { - Debug.Console(1, this, "Unable to parse '{0}' to zConfiguration.eLayoutSize: {1}", s, e); - } - }); - - layoutSizeCodec.SelfviewPipSizeFeedback.LinkInputSig(trilist.StringInput[joinMap.GetSetSelfviewPipSize.JoinNumber]); - } - - MeetingInfoChanged += (device, args) => - { - trilist.SetString(joinMap.MeetingInfoId.JoinNumber, args.Info.Id); - trilist.SetString(joinMap.MeetingInfoHost.JoinNumber, args.Info.Host); - trilist.SetString(joinMap.MeetingInfoPassword.JoinNumber, args.Info.Password); - trilist.SetBool(joinMap.IsHost.JoinNumber, args.Info.IsHost); - trilist.SetBool(joinMap.ShareOnlyMeeting.JoinNumber, args.Info.IsSharingMeeting); - trilist.SetBool(joinMap.WaitingForHost.JoinNumber, args.Info.WaitingForHost); - //trilist.SetString(joinMap.CurrentSource.JoinNumber, args.Info.ShareStatus); - }; - - trilist.SetSigFalseAction(joinMap.StartMeetingNow.JoinNumber, () => StartMeeting(0)); - trilist.SetSigFalseAction(joinMap.ShareOnlyMeeting.JoinNumber, StartSharingOnlyMeeting); - trilist.SetSigFalseAction(joinMap.StartNormalMeetingFromSharingOnlyMeeting.JoinNumber, StartNormalMeetingFromSharingOnlyMeeting); - - trilist.SetStringSigAction(joinMap.SubmitPassword.JoinNumber, SubmitPassword); - - // Subscribe to call status to clear ShowPasswordPrompt when in meeting - this.CallStatusChange += (o, a) => - { - if (a.CallItem.Status == eCodecCallStatus.Connected || a.CallItem.Status == eCodecCallStatus.Disconnected) - { - trilist.SetBool(joinMap.MeetingPasswordRequired.JoinNumber, false); - } - - }; - - trilist.SetSigFalseAction(joinMap.CancelJoinAttempt.JoinNumber, () => { - trilist.SetBool(joinMap.MeetingPasswordRequired.JoinNumber, false); - EndAllCalls(); - }); - - PasswordRequired += (devices, args) => - { - Debug.Console(2, this, "***********************************PaswordRequired. Message: {0} Cancelled: {1} Last Incorrect: {2} Failed: {3}", args.Message, args.LoginAttemptCancelled, args.LastAttemptWasIncorrect, args.LoginAttemptFailed); - - if (args.LoginAttemptCancelled) - { - trilist.SetBool(joinMap.MeetingPasswordRequired.JoinNumber, false); - return; - } - - if (!string.IsNullOrEmpty(args.Message)) - { - trilist.SetString(joinMap.PasswordPromptMessage.JoinNumber, args.Message); - } - - if (args.LoginAttemptFailed) - { - // login attempt failed - return; - } - - trilist.SetBool(joinMap.PasswordIncorrect.JoinNumber, args.LastAttemptWasIncorrect); - trilist.SetBool(joinMap.MeetingPasswordRequired.JoinNumber, true); - }; - - trilist.OnlineStatusChange += (device, args) => - { - if (!args.DeviceOnLine) return; - - ComputeAvailableLayouts(); - layoutsCodec.LocalLayoutFeedback.FireUpdate(); - layoutsCodec.CanSwapContentWithThumbnailFeedback.FireUpdate(); - layoutsCodec.ContentSwappedWithThumbnailFeedback.FireUpdate(); - layoutsCodec.LayoutViewIsOnFirstPageFeedback.FireUpdate(); - layoutsCodec.LayoutViewIsOnLastPageFeedback.FireUpdate(); - pinCodec.NumberOfScreensFeedback.FireUpdate(); - layoutSizeCodec.SelfviewPipSizeFeedback.FireUpdate(); - }; - - var wirelessInfoCodec = this as IZoomWirelessShareInstructions; - if (wirelessInfoCodec != null) - { - if (Status != null && Status.Sharing != null) - { - SetSharingStateJoins(Status.Sharing, trilist, joinMap); - } - - wirelessInfoCodec.ShareInfoChanged += (o, a) => - { - SetSharingStateJoins(a.SharingStatus, trilist, joinMap); - }; - } - } - - void SetSharingStateJoins(zStatus.Sharing state, BasicTriList trilist, ZoomRoomJoinMap joinMap) - { - trilist.SetBool(joinMap.IsSharingAirplay.JoinNumber, state.isAirHostClientConnected); - trilist.SetBool(joinMap.IsSharingHdmi.JoinNumber, state.isBlackMagicConnected || state.isDirectPresentationConnected); - - trilist.SetString(joinMap.DisplayState.JoinNumber, state.dispState.ToString()); - trilist.SetString(joinMap.AirplayShareCode.JoinNumber, state.password); - trilist.SetString(joinMap.LaptopShareKey.JoinNumber, state.directPresentationSharingKey); - trilist.SetString(joinMap.WifiName.JoinNumber, state.wifiName); - trilist.SetString(joinMap.ServerName.JoinNumber, state.serverName); - } - - public override void ExecuteSwitch(object selector) - { - var action = selector as Action; - if (action == null) - { - return; - } - - action(); - } - - public void AcceptCall() - { - _waitingForUserToAcceptOrRejectIncomingCall = false; - - var incomingCall = - ActiveCalls.FirstOrDefault( - c => c.Status.Equals(eCodecCallStatus.Ringing) && c.Direction.Equals(eCodecCallDirection.Incoming)); - - AcceptCall(incomingCall); - } - - public override void AcceptCall(CodecActiveCallItem call) - { - _waitingForUserToAcceptOrRejectIncomingCall = false; - - SendText(string.Format("zCommand Call Accept callerJID: {0}", call.Id)); - - call.Status = eCodecCallStatus.Connected; - - OnCallStatusChange(call); - - UpdateCallStatus(); - } - - public void RejectCall() - { - _waitingForUserToAcceptOrRejectIncomingCall = false; - - var incomingCall = - ActiveCalls.FirstOrDefault( - c => c.Status.Equals(eCodecCallStatus.Ringing) && c.Direction.Equals(eCodecCallDirection.Incoming)); - - RejectCall(incomingCall); - } - - public override void RejectCall(CodecActiveCallItem call) - { - _waitingForUserToAcceptOrRejectIncomingCall = false; - - SendText(string.Format("zCommand Call Reject callerJID: {0}", call.Id)); - - call.Status = eCodecCallStatus.Disconnected; - - OnCallStatusChange(call); - - UpdateCallStatus(); - } - - public override void Dial(Meeting meeting) - { - Debug.Console(1, this, "Dialing meeting.Id: {0} Title: {1}", meeting.Id, meeting.Title); - _lastDialedMeetingNumber = meeting.Id; - SendText(string.Format("zCommand Dial Start meetingNumber: {0}", meeting.Id)); - } - - public override void Dial(string number) - { - Debug.Console(2, this, "Dialing number: {0}", number); - _lastDialedMeetingNumber = number; - SendText(string.Format("zCommand Dial Join meetingNumber: {0}", number)); - } - - /// - /// Dials a meeting with a password - /// - /// - /// - public void Dial(string number, string password) - { - Debug.Console(2, this, "Dialing meeting number: {0} with password: {1}", number, password); - SendText(string.Format("zCommand Dial Join meetingNumber: {0} password: {1}", number, password)); - } - - /// - /// Invites a contact to either a new meeting (if not already in a meeting) or the current meeting. - /// Currently only invites a single user - /// - /// - public override void Dial(IInvitableContact contact) - { - var ic = contact as InvitableDirectoryContact; - - if (ic != null) - { - Debug.Console(1, this, "Attempting to Dial (Invite): {0}", ic.Name); - - if (!IsInCall) - { - SendText(string.Format("zCommand Invite Duration: {0} user: {1}", DefaultMeetingDurationMin, - ic.ContactId)); - } - else - { - SendText(string.Format("zCommand Call invite user: {0}", ic.ContactId)); - } - } - } - - /// - /// Invites contacts to a new meeting for a specified duration - /// - /// - /// - public void InviteContactsToNewMeeting(List contacts, uint duration) - { - if(duration == 0) - { - duration = DefaultMeetingDurationMin; - } - - StringBuilder message = new StringBuilder(); - - // Add the prefix - message.Append(string.Format("zCommand Invite Duration: {0}", duration)); - - // Add each invitee - foreach (var contact in contacts) - { - var invitee = string.Format(" user: {0}", contact.ContactId); - - message.Append(invitee); - } - - SendText(message.ToString()); - } - - /// - /// Invites contacts to an existing meeting - /// - /// - public void InviteContactsToExistingMeeting(List contacts) - { - StringBuilder message = new StringBuilder(); - - // Add the prefix - message.Append(string.Format("zCommand Call Invite")); - - // Add each invitee - foreach (var contact in contacts) - { - var invitee = string.Format(" user: {0}", contact.ContactId); - - message.Append(invitee); - } - - SendText(message.ToString()); - } - - - /// - /// Starts a PMI Meeting for the specified duration (or default meeting duration if 0 is specified) - /// - /// duration of meeting - public void StartMeeting(uint duration) - { - uint dur = DefaultMeetingDurationMin; - - if (duration > 0) - dur = duration; - - SendText(string.Format("zCommand Dial StartPmi Duration: {0}", dur)); - } - - public void LeaveMeeting() - { - _meetingPasswordRequired = false; - _waitingForUserToAcceptOrRejectIncomingCall = false; - - SendText("zCommand Call Leave"); - } - - public override void EndCall(CodecActiveCallItem call) - { - _meetingPasswordRequired = false; - _waitingForUserToAcceptOrRejectIncomingCall = false; - - SendText("zCommand Call Disconnect"); - } - - public override void EndAllCalls() - { - _meetingPasswordRequired = false; - _waitingForUserToAcceptOrRejectIncomingCall = false; - - SendText("zCommand Call Disconnect"); - } - - public override void SendDtmf(string s) - { - SendDtmfToPhone(s); - } - - /// - /// Call when directory results are updated - /// - /// - private void OnDirectoryResultReturned(CodecDirectory result) - { - try - { - Debug.Console(2, this, "OnDirectoryResultReturned. Result has {0} contacts", result.Contacts.Count); - - CurrentDirectoryResultIsNotDirectoryRoot.FireUpdate(); - - var directoryResult = result; - var directoryIsRoot = CurrentDirectoryResultIsNotDirectoryRoot.BoolValue == false; - - // If result is Root, create a copy and filter out contacts whose parent folder is not root - //if (!CurrentDirectoryResultIsNotDirectoryRoot.BoolValue) - //{ - // Debug.Console(2, this, "Filtering DirectoryRoot to remove contacts for display"); - - // directoryResult.ResultsFolderId = result.ResultsFolderId; - // directoryResult.AddFoldersToDirectory(result.Folders); - // directoryResult.AddContactsToDirectory( - // result.Contacts.Where((c) => c.ParentFolderId == result.ResultsFolderId).ToList()); - //} - //else - //{ - // directoryResult = result; - //} - - Debug.Console(2, this, "Updating directoryResult. IsOnRoot: {0} Contact Count: {1}", - directoryIsRoot, directoryResult.Contacts.Count); - - // This will return the latest results to all UIs. Multiple indendent UI Directory browsing will require a different methodology - var handler = DirectoryResultReturned; - if (handler != null) - { - handler(this, new DirectoryEventArgs - { - Directory = directoryResult, - DirectoryIsOnRoot = directoryIsRoot - }); - } - - - } - catch (Exception e) - { - Debug.Console(2, this, "Error: {0}", e); - } - - //PrintDirectory(result); - } - - /// - /// Builds the cameras List by using the Zoom Room zStatus.Cameras data. Could later be modified to build from config data - /// - private void SetUpCameras() - { - SelectedCameraFeedback = new StringFeedback(() => Configuration.Video.Camera.SelectedId); - - ControllingFarEndCameraFeedback = new BoolFeedback(() => SelectedCamera is IAmFarEndCamera); - - foreach (var cam in Status.Cameras) - { - // Known Issue: - // Crestron UC engine systems seem to report an item in the cameras list that represnts the USB bridge device. - // If we know the name and it's reliably consistent, we could ignore it here... - - if (cam.Name.IndexOf("HD-CONV-USB") > -1) - { - // Skip this as it's the Crestron USB box, not a real camera - continue; - } - - var existingCam = Cameras.FirstOrDefault((c) => c.Key.Equals(cam.id)); - - if (existingCam == null) - { - var camera = new ZoomRoomCamera(cam.id, cam.Name, this); - - Cameras.Add(camera); - - if (cam.Selected) - { - SelectedCamera = camera; - } - } - } - - if (IsInCall) - { - UpdateFarEndCameras(); - } - - _syncState.CamerasSetUp(); - } - - /// - /// Dynamically creates far end cameras for call participants who have far end control enabled. - /// - private void UpdateFarEndCameras() - { - // TODO: set up far end cameras for the current call - } - - #region Implementation of IHasParticipants - - public CodecParticipants Participants { get; private set; } - - public void RemoveParticipant(int userId) - { - SendText(string.Format("zCommand Call Expel Id: {0}", userId)); - } - - public void SetParticipantAsHost(int userId) - { - SendText(string.Format("zCommand Call HostChange Id: {0}", userId)); - } - - public void AdmitParticipantFromWaitingRoom(int userId) - { - SendText(string.Format("zCommand Call Admit Participant Id: {0}", userId)); - } - - #endregion - - #region IHasParticipantAudioMute Members - - public void MuteAudioForAllParticipants() - { - SendText(string.Format("zCommand Call MuteAll Mute: on")); - } - - public void MuteAudioForParticipant(int userId) - { - SendText(string.Format("zCommand Call MuteParticipant Mute: on Id: {0}", userId)); - } - - public void UnmuteAudioForParticipant(int userId) - { - SendText(string.Format("zCommand Call MuteParticipant Mute: off Id: {0}", userId)); - } - - public void ToggleAudioForParticipant(int userId) - { - var user = Participants.CurrentParticipants.FirstOrDefault(p => p.UserId.Equals(userId)); - - if (user == null) - { - Debug.Console(2, this, "Unable to find user with id: {0}", userId); - return; - } - - if (user.AudioMuteFb) - { - UnmuteAudioForParticipant(userId); - } - else - { - MuteAudioForParticipant(userId); - } - } - - #endregion - - #region IHasParticipantVideoMute Members - - public void MuteVideoForParticipant(int userId) - { - SendText(string.Format("zCommand Call MuteParticipantVideo Mute: on Id: {0}", userId)); - } - - public void UnmuteVideoForParticipant(int userId) - { - SendText(string.Format("zCommand Call MuteParticipantVideo Mute: off Id: {0}", userId)); - } - - public void ToggleVideoForParticipant(int userId) - { - var user = Participants.CurrentParticipants.FirstOrDefault(p => p.UserId.Equals(userId)); - - if (user == null) - { - Debug.Console(2, this, "Unable to find user with id: {0}", userId); - return; - } - - if (user.VideoMuteFb) - { - UnmuteVideoForParticipant(userId); - } - else - { - MuteVideoForParticipant(userId); - } - } - - #endregion - - #region IHasParticipantPinUnpin Members - - private Func NumberOfScreensFeedbackFunc - { - get { return () => Status.NumberOfScreens.NumOfScreens; } - } - - public IntFeedback NumberOfScreensFeedback { get; private set; } - - public int ScreenIndexToPinUserTo { get; private set; } - - public void PinParticipant(int userId, int screenIndex) - { - SendText(string.Format("zCommand Call Pin Id: {0} Enable: on Screen: {1}", userId, screenIndex)); - } - - public void UnPinParticipant(int userId) - { - SendText(string.Format("zCommand Call Pin Id: {0} Enable: off", userId)); - } - - public void ToggleParticipantPinState(int userId, int screenIndex) - { - var user = Participants.CurrentParticipants.FirstOrDefault(p => p.UserId.Equals(userId)); - - if (user == null) - { - Debug.Console(2, this, "Unable to find user with id: {0}", userId); - return; - } - - if (user.IsPinnedFb) - { - UnPinParticipant(userId); - } - else - { - PinParticipant(userId, screenIndex); - } - } - - #endregion - - #region Implementation of IHasCameraOff - - public BoolFeedback CameraIsOffFeedback { get; private set; } - - public void CameraOff() - { - CameraMuteOn(); - } - - #endregion - - public BoolFeedback CameraIsMutedFeedback { get; private set; } - - public void CameraMuteOn() - { - SendText("zConfiguration Call Camera Mute: On"); - } - - public void CameraMuteOff() - { - SendText("zConfiguration Call Camera Mute: Off"); - } - - public void CameraMuteToggle() - { - if (CameraIsMutedFeedback.BoolValue) - CameraMuteOff(); - else - CameraMuteOn(); - } - - #region Implementation of IHasCameraAutoMode - - //Zoom doesn't support camera auto modes. Setting this to just unmute video - public void CameraAutoModeOn() - { - CameraMuteOff(); - throw new NotImplementedException("Zoom Room Doesn't support camera auto mode"); - } - - //Zoom doesn't support camera auto modes. Setting this to just unmute video - public void CameraAutoModeOff() - { - SendText("zConfiguration Call Camera Mute: Off"); - } - - public void CameraAutoModeToggle() - { - throw new NotImplementedException("Zoom Room doesn't support camera auto mode"); - } - - public BoolFeedback CameraAutoModeIsOnFeedback { get; private set; } - - #endregion - - #region Implementation of IHasFarEndContentStatus - - public BoolFeedback ReceivingContent { get; private set; } - - #endregion - - #region Implementation of IHasSelfviewPosition - - private CodecCommandWithLabel _currentSelfviewPipPosition; - - public StringFeedback SelfviewPipPositionFeedback { get; private set; } - - public void SelfviewPipPositionSet(CodecCommandWithLabel position) - { - SendText(String.Format("zConfiguration Call Layout Position: {0}", position.Command)); - } - - public void SelfviewPipPositionToggle() - { - if (_currentSelfviewPipPosition != null) - { - var nextPipPositionIndex = SelfviewPipPositions.IndexOf(_currentSelfviewPipPosition) + 1; - - if (nextPipPositionIndex >= SelfviewPipPositions.Count) - // Check if we need to loop back to the first item in the list - nextPipPositionIndex = 0; - - SelfviewPipPositionSet(SelfviewPipPositions[nextPipPositionIndex]); - } - } - - public List SelfviewPipPositions = new List() - { - new CodecCommandWithLabel("UpLeft", "Center Left"), - new CodecCommandWithLabel("UpRight", "Center Right"), - new CodecCommandWithLabel("DownRight", "Lower Right"), - new CodecCommandWithLabel("DownLeft", "Lower Left") - }; - - private void ComputeSelfviewPipPositionStatus() - { - _currentSelfviewPipPosition = - SelfviewPipPositions.FirstOrDefault( - p => p.Command.ToLower().Equals(Configuration.Call.Layout.Position.ToString().ToLower())); - } - - #endregion - - // TODO: #714 [ ] Implementation of IHasSelfviewPipSize - - #region Implementation of IHasSelfviewPipSize - - private CodecCommandWithLabel _currentSelfviewPipSize; - - public StringFeedback SelfviewPipSizeFeedback { get; private set; } - - public void SelfviewPipSizeSet(CodecCommandWithLabel size) - { - SendText(String.Format("zConfiguration Call Layout Size: {0}", size.Command)); - } - - public void SelfviewPipSizeToggle() - { - if (_currentSelfviewPipSize != null) - { - var nextPipSizeIndex = SelfviewPipSizes.IndexOf(_currentSelfviewPipSize) + 1; - - if (nextPipSizeIndex >= SelfviewPipSizes.Count) - // Check if we need to loop back to the first item in the list - nextPipSizeIndex = 0; - - SelfviewPipSizeSet(SelfviewPipSizes[nextPipSizeIndex]); - } - } - - public List SelfviewPipSizes = new List() - { - new CodecCommandWithLabel("Off", "Off"), - new CodecCommandWithLabel("Size1", "Size 1"), - new CodecCommandWithLabel("Size2", "Size 2"), - new CodecCommandWithLabel("Size3", "Size 3"), - new CodecCommandWithLabel("Strip", "Strip") - }; - - private void ComputeSelfviewPipSizeStatus() - { - _currentSelfviewPipSize = - SelfviewPipSizes.FirstOrDefault( - p => p.Command.ToLower().Equals(Configuration.Call.Layout.Size.ToString().ToLower())); - } - - #endregion - - #region Implementation of IHasPhoneDialing - - private Func PhoneOffHookFeedbackFunc - { - get { return () => Status.PhoneCall.OffHook; } - } - - private Func CallerIdNameFeedbackFunc - { - get { return () => Status.PhoneCall.PeerDisplayName; } - } - - private Func CallerIdNumberFeedbackFunc - { - get { return () => Status.PhoneCall.PeerNumber; } - } - - public BoolFeedback PhoneOffHookFeedback { get; private set; } - public StringFeedback CallerIdNameFeedback { get; private set; } - public StringFeedback CallerIdNumberFeedback { get; private set; } - - public void DialPhoneCall(string number) - { - SendText(String.Format("zCommand Dial PhoneCallOut Number: {0}", number)); - } - - public void EndPhoneCall() - { - SendText(String.Format("zCommand Dial PhoneHangUp CallId: {0}", Status.PhoneCall.CallId)); - } - - public void SendDtmfToPhone(string digit) - { - SendText(String.Format("zCommand SendSipDTMF CallId: {0} Key: {1}", Status.PhoneCall.CallId, digit)); - } - - #endregion - - #region IHasZoomRoomLayouts Members - - public event EventHandler LayoutInfoChanged; - - private Func LayoutViewIsOnFirstPageFeedbackFunc - { - get { return () => Status.Layout.is_In_First_Page; } - } - - private Func LayoutViewIsOnLastPageFeedbackFunc - { - get { return () => Status.Layout.is_In_Last_Page; } - } - - private Func CanSwapContentWithThumbnailFeedbackFunc - { - get { return () => Status.Layout.can_Switch_Floating_Share_Content; } - } - - private Func ContentSwappedWithThumbnailFeedbackFunc - { - get { return () => Configuration.Call.Layout.ShareThumb; } - } - - public BoolFeedback LayoutViewIsOnFirstPageFeedback { get; private set; } - - public BoolFeedback LayoutViewIsOnLastPageFeedback { get; private set; } - - public BoolFeedback CanSwapContentWithThumbnailFeedback { get; private set; } - - public BoolFeedback ContentSwappedWithThumbnailFeedback { get; private set; } - - - public zConfiguration.eLayoutStyle LastSelectedLayout { get; private set; } - - public zConfiguration.eLayoutStyle AvailableLayouts { get; private set; } - - /// - /// Reads individual properties to determine if which layouts are avalailable - /// - private void ComputeAvailableLayouts() - { - Debug.Console(1, this, "Computing available layouts..."); - zConfiguration.eLayoutStyle availableLayouts = zConfiguration.eLayoutStyle.None; - if (Status.Layout.can_Switch_Wall_View) - { - availableLayouts |= zConfiguration.eLayoutStyle.Gallery; - } - - if (Status.Layout.can_Switch_Speaker_View) - { - availableLayouts |= zConfiguration.eLayoutStyle.Speaker; - } - - if (Status.Layout.can_Switch_Share_On_All_Screens) - { - availableLayouts |= zConfiguration.eLayoutStyle.ShareAll; - } - - // There is no property that directly reports if strip mode is valid, but API stipulates - // that strip mode is available if the number of screens is 1 - if (Status.NumberOfScreens.NumOfScreens == 1 || Status.Layout.can_Switch_Strip_View || Status.Layout.video_type.ToLower() == "strip") - { - availableLayouts |= zConfiguration.eLayoutStyle.Strip; - } - - Debug.Console(1, this, "availablelayouts: {0}", availableLayouts); - - AvailableLayouts = availableLayouts; - } - - private void OnLayoutInfoChanged() - { - var handler = LayoutInfoChanged; - if (handler != null) - { - - var currentLayout = zConfiguration.eLayoutStyle.None; - - currentLayout = (zConfiguration.eLayoutStyle)Enum.Parse(typeof(zConfiguration.eLayoutStyle), string.IsNullOrEmpty(LocalLayoutFeedback.StringValue) ? "None" : LocalLayoutFeedback.StringValue, true); - - handler(this, new LayoutInfoChangedEventArgs() - { - AvailableLayouts = AvailableLayouts, - CurrentSelectedLayout = currentLayout, - LayoutViewIsOnFirstPage = LayoutViewIsOnFirstPageFeedback.BoolValue, - LayoutViewIsOnLastPage = LayoutViewIsOnLastPageFeedback.BoolValue, - CanSwapContentWithThumbnail = CanSwapContentWithThumbnailFeedback.BoolValue, - ContentSwappedWithThumbnail = ContentSwappedWithThumbnailFeedback.BoolValue, - }); - } - } - - public void GetAvailableLayouts() - { - SendText("zStatus Call Layout"); - } - - public void SetLayout(zConfiguration.eLayoutStyle layoutStyle) - { - LastSelectedLayout = layoutStyle; - SendText(String.Format("zConfiguration Call Layout Style: {0}", layoutStyle.ToString())); - } - - public void SwapContentWithThumbnail() - { - if (CanSwapContentWithThumbnailFeedback.BoolValue) - { - var oppositeValue = ContentSwappedWithThumbnailFeedback.BoolValue ? "on" : "off"; - // Get the value based on the opposite of the current state - // TODO: #697 [*] Need to verify the ternary above and make sure that the correct on/off value is being send based on the true/false value of the feedback - // to toggle the state - SendText(String.Format("zConfiguration Call Layout ShareThumb: {0}", oppositeValue)); - } - } - - public void LayoutTurnNextPage() - { - SendText("zCommand Call Layout TurnPage Forward: On"); - } - - public void LayoutTurnPreviousPage() - { - SendText("zCommand Call Layout TurnPage Forward: Off"); - } - - #endregion - - #region IHasCodecLayouts Members - - private Func LocalLayoutFeedbackFunc - { - get - { - return () => - { - if (Configuration.Call.Layout.Style != zConfiguration.eLayoutStyle.None) - return Configuration.Call.Layout.Style.ToString(); - else - return Configuration.Client.Call.Layout.Style.ToString(); - }; - } - } - - public StringFeedback LocalLayoutFeedback { get; private set; } - - public void LocalLayoutToggle() - { - var currentLayout = LocalLayoutFeedback.StringValue; - - var eCurrentLayout = (int) Enum.Parse(typeof (zConfiguration.eLayoutStyle), currentLayout, true); - - var nextLayout = GetNextLayout(eCurrentLayout); - - if (nextLayout != zConfiguration.eLayoutStyle.None) - { - SetLayout(nextLayout); - } - } - - /// - /// Tries to get the next available layout - /// - /// - /// - private zConfiguration.eLayoutStyle GetNextLayout(int currentLayout) - { - if (AvailableLayouts == zConfiguration.eLayoutStyle.None) - { - return zConfiguration.eLayoutStyle.None; - } - - zConfiguration.eLayoutStyle nextLayout; - - if (((zConfiguration.eLayoutStyle) currentLayout & zConfiguration.eLayoutStyle.ShareAll) == - zConfiguration.eLayoutStyle.ShareAll) - { - nextLayout = zConfiguration.eLayoutStyle.Gallery; - } - else - { - nextLayout = (zConfiguration.eLayoutStyle) (currentLayout << 1); - } - - if ((AvailableLayouts & nextLayout) == nextLayout) - { - return nextLayout; - } - else - { - return GetNextLayout((int) nextLayout); - } - } - - public void LocalLayoutToggleSingleProminent() - { - throw new NotImplementedException(); - } - - public void MinMaxLayoutToggle() - { - throw new NotImplementedException(); - } - - #endregion - - #region IPasswordPrompt Members - - public event EventHandler PasswordRequired; - - public void SubmitPassword(string password) - { - _meetingPasswordRequired = false; - Debug.Console(2, this, "Password Submitted: {0}", password); - Dial(_lastDialedMeetingNumber, password); - } - - void OnPasswordRequired(bool lastAttemptIncorrect, bool loginFailed, bool loginCancelled, string message) - { - _meetingPasswordRequired = !loginFailed || !loginCancelled; - - var handler = PasswordRequired; - if (handler != null) - { - Debug.Console(2, this, "Meeting Password Required: {0}", _meetingPasswordRequired); - - handler(this, new PasswordPromptEventArgs(lastAttemptIncorrect, loginFailed, loginCancelled, message)); - } - } - - #endregion - - #region IHasMeetingInfo Members - - public event EventHandler MeetingInfoChanged; - - private MeetingInfo _meetingInfo; - - public MeetingInfo MeetingInfo - { - get { return _meetingInfo; } - private set - { - if (value != _meetingInfo) - { - _meetingInfo = value; - - var handler = MeetingInfoChanged; - if (handler != null) - { - handler(this, new MeetingInfoEventArgs(_meetingInfo)); - } - } - } - } - - #endregion - - #region Implementation of IHasPresentationOnlyMeeting - - public void StartSharingOnlyMeeting() - { - StartSharingOnlyMeeting(eSharingMeetingMode.None, 30, String.Empty); - } - - public void StartSharingOnlyMeeting(eSharingMeetingMode displayMode) - { - StartSharingOnlyMeeting(displayMode, DefaultMeetingDurationMin, String.Empty); - } - - public void StartSharingOnlyMeeting(eSharingMeetingMode displayMode, uint duration) - { - StartSharingOnlyMeeting(displayMode, duration, String.Empty); - } - - public void StartSharingOnlyMeeting(eSharingMeetingMode displayMode, uint duration, string password) - { - SendText(String.Format("zCommand Dial Sharing Duration: {0} DisplayState: {1} Password: {2}", duration, displayMode, password)); - } - - public void StartNormalMeetingFromSharingOnlyMeeting() - { - Debug.Console(2, this, "Converting Sharing Meeting to Normal Meeting"); - SendText("zCommand call sharing ToNormal"); - } - - #endregion - - #region IHasMeetingLock Members - - public BoolFeedback MeetingIsLockedFeedback { get; private set; } - - public void LockMeeting() - { - SendText(string.Format("zConfiguration Call Lock Enable: on")); - } - - public void UnLockMeeting() - { - SendText(string.Format("zConfiguration Call Lock Enable: off")); - } - - public void ToggleMeetingLock() - { - if (MeetingIsLockedFeedback.BoolValue) - { - UnLockMeeting(); - } - else - { - LockMeeting(); - } - } - - #endregion - - #region IHasMeetingRecordingWithPrompt Members - - public BoolFeedback MeetingIsRecordingFeedback { get; private set; } - - bool _recordConsentPromptIsVisible; - - public BoolFeedback RecordConsentPromptIsVisible { get; private set; } - - public void RecordingPromptAcknowledgement(bool agree) - { - var command = string.Format("zCommand Agree Recording: {0}", agree ? "on" : "off"); - //Debug.Console(2, this, "Sending agree: {0} {1}", agree, command); - SendText(command); - } - - public void StartRecording() - { - SendText(string.Format("zCommand Call Record Enable: on")); - } - - public void StopRecording() - { - SendText(string.Format("zCommand Call Record Enable: off")); - } - - public void ToggleRecording() - { - if (MeetingIsRecordingFeedback.BoolValue) - { - StopRecording(); - } - else - { - StartRecording(); - } - } - - #endregion - - #region IZoomWirelessShareInstructions Members - - public event EventHandler ShareInfoChanged; - - public zStatus.Sharing SharingState - { - get - { - return Status.Sharing; - } - } - - void OnShareInfoChanged(zStatus.Sharing status) - { - Debug.Console(2, this, -@"ShareInfoChanged: -isSharingHDMI: {0} -isSharingAirplay: {1} -AirplayPassword: {2} -OSD Display State: {3} -", -status.isSharingBlackMagic, -status.isAirHostClientConnected, -status.password, -status.dispState); - - var handler = ShareInfoChanged; - if (handler != null) - { - handler(this, new ShareInfoEventArgs(status)); - } - } - - #endregion - } - - /// - /// Zoom Room specific info object - /// - public class ZoomRoomInfo : VideoCodecInfo - { - public ZoomRoomInfo(ZoomRoomStatus status, ZoomRoomConfiguration configuration) - { - Status = status; - Configuration = configuration; - } - - [JsonIgnore] - public ZoomRoomStatus Status { get; private set; } - [JsonIgnore] - public ZoomRoomConfiguration Configuration { get; private set; } - - public override bool AutoAnswerEnabled - { - get { return Status.SystemUnit.RoomInfo.AutoAnswerIsEnabled; } - } - - public override string E164Alias - { - get - { - if (!string.IsNullOrEmpty(Status.SystemUnit.MeetingNumber)) - { - return Status.SystemUnit.MeetingNumber; - } - return string.Empty; - } - } - - public override string H323Id - { - get - { - if (!string.IsNullOrEmpty(Status.Call.Info.meeting_list_item.third_party.h323_address)) - { - return Status.Call.Info.meeting_list_item.third_party.h323_address; - } - return string.Empty; - } - } - - public override string IpAddress - { - get - { - if (!string.IsNullOrEmpty(Status.SystemUnit.RoomInfo.AccountEmail)) - { - return Status.SystemUnit.RoomInfo.AccountEmail; - } - return string.Empty; - } - } - - public override bool MultiSiteOptionIsEnabled - { - get { return true; } - } - - public override string SipPhoneNumber - { - get - { - if (!string.IsNullOrEmpty(Status.Call.Info.dialIn)) - { - return Status.Call.Info.dialIn; - } - return string.Empty; - } - } - - public override string SipUri - { - get - { - if (!string.IsNullOrEmpty(Status.Call.Info.meeting_list_item.third_party.sip_address)) - { - return Status.Call.Info.meeting_list_item.third_party.sip_address; - } - return string.Empty; - } - } - } - - /// - /// Tracks the initial sycnronization state when establishing a new connection - /// - public class ZoomRoomSyncState : IKeyed - { - private readonly ZoomRoom _parent; - private readonly CrestronQueue _syncQueries; - private bool _initialSyncComplete; - - public ZoomRoomSyncState(string key, ZoomRoom parent) - { - _parent = parent; - Key = key; - _syncQueries = new CrestronQueue(50); - CodecDisconnected(); - } - - public bool InitialSyncComplete - { - get { return _initialSyncComplete; } - private set - { - if (value) - { - var handler = InitialSyncCompleted; - if (handler != null) - { - handler(this, new EventArgs()); - } - } - _initialSyncComplete = value; - } - } - - public bool LoginResponseWasReceived { get; private set; } - - public bool FirstJsonResponseWasReceived { get; private set; } - - public bool InitialQueryMessagesWereSent { get; private set; } - - public bool LastQueryResponseWasReceived { get; private set; } - - public bool CamerasHaveBeenSetUp { get; private set; } - - #region IKeyed Members - - public string Key { get; private set; } - - #endregion - - public event EventHandler InitialSyncCompleted; - - public event EventHandler FirstJsonResponseReceived; - - public void StartSync() - { - DequeueQueries(); - } - - private void DequeueQueries() - { - while (!_syncQueries.IsEmpty) - { - var query = _syncQueries.Dequeue(); - - _parent.SendText(query); - } - - InitialQueryMessagesSent(); - } - - public void AddQueryToQueue(string query) - { - _syncQueries.Enqueue(query); - } - - public void LoginResponseReceived() - { - LoginResponseWasReceived = true; - Debug.Console(1, this, "Login Rsponse Received."); - CheckSyncStatus(); - } - - public void ReceivedFirstJsonResponse() - { - FirstJsonResponseWasReceived = true; - Debug.Console(1, this, "First JSON Response Received."); - - var handler = FirstJsonResponseReceived; - if (handler != null) - { - handler(this, null); - } - CheckSyncStatus(); - } - - public void InitialQueryMessagesSent() - { - InitialQueryMessagesWereSent = true; - Debug.Console(1, this, "Query Messages Sent."); - CheckSyncStatus(); - } - - public void LastQueryResponseReceived() - { - LastQueryResponseWasReceived = true; - Debug.Console(1, this, "Last Query Response Received."); - CheckSyncStatus(); - } - - public void CamerasSetUp() - { - CamerasHaveBeenSetUp = true; - Debug.Console(1, this, "Cameras Set Up."); - CheckSyncStatus(); - } - - public void CodecDisconnected() - { - _syncQueries.Clear(); - LoginResponseWasReceived = false; - FirstJsonResponseWasReceived = false; - InitialQueryMessagesWereSent = false; - LastQueryResponseWasReceived = false; - CamerasHaveBeenSetUp = false; - InitialSyncComplete = false; - } - - private void CheckSyncStatus() - { - if (LoginResponseWasReceived && FirstJsonResponseWasReceived && InitialQueryMessagesWereSent && LastQueryResponseWasReceived && - CamerasHaveBeenSetUp) - { - InitialSyncComplete = true; - Debug.Console(1, this, "Initial Codec Sync Complete!"); - } - else - { - InitialSyncComplete = false; - } - } - } - - public class ZoomRoomFactory : EssentialsDeviceFactory - { - public ZoomRoomFactory() - { - TypeNames = new List {"zoomroom"}; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new ZoomRoom Device"); - var comm = CommFactory.CreateCommForDevice(dc); - return new ZoomRoom(dc, comm); - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/ZoomRoom/ZoomRoomCamera.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/ZoomRoom/ZoomRoomCamera.cs deleted file mode 100644 index bb0abeea..00000000 --- a/src/PepperDash.Essentials.Devices.Common/VideoCodec/ZoomRoom/ZoomRoomCamera.cs +++ /dev/null @@ -1,231 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DeviceSupport; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.Devices.Common.Cameras; - -using Full.Newtonsoft.Json; - -namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom -{ - public enum eZoomRoomCameraState - { - Start, - Continue, - Stop, - RequestRemote, - GiveupRemote, - RequestedByFarEnd - } - - public enum eZoomRoomCameraAction - { - Left, - Right, - Up, - Down, - In, - Out - } - - - public class ZoomRoomCamera : CameraBase, IHasCameraPtzControl, IBridgeAdvanced - { - protected ZoomRoom ParentCodec { get; private set; } - - [JsonProperty("id", NullValueHandling = NullValueHandling.Ignore)] - public int? Id = 0; // ID of near end selected camara is always 0 - - private int ContinueTime = 10; // number of milliseconds between issuing continue commands - - private CTimer ContinueTimer; - - eZoomRoomCameraAction LastAction; - - private bool isPanning; - - private bool isTilting; - - private bool isZooming; - - //private bool isFocusing; - - private bool isMoving - { - get - { - return isPanning || isTilting || isZooming; - - } - } - - public ZoomRoomCamera(string key, string name, ZoomRoom codec) - : base(key, name) - { - ParentCodec = codec; - - Capabilities = eCameraCapabilities.Pan | eCameraCapabilities.Tilt | eCameraCapabilities.Zoom; - } - - /// - /// Builds the command and triggers the parent ZoomRoom to send it - /// - /// - /// - void SendCommand(eZoomRoomCameraState state, eZoomRoomCameraAction action) - { - LastAction = action; - ParentCodec.SendText(string.Format("zCommand Call CameraControl Id: {0} State: {1} Action: {2}", Id, state, action)); - } - - void StartContinueTimer() - { - if (ContinueTimer == null) - ContinueTimer = new CTimer((o) => SendContinueAction(LastAction), null, ContinueTime, ContinueTime); - } - - void SendContinueAction(eZoomRoomCameraAction action) - { - SendCommand(eZoomRoomCameraState.Continue, action); - } - - void StopContinueTimer() - { - if (ContinueTimer == null) - { - return; - } - - ContinueTimer.Stop(); - ContinueTimer.Dispose(); - ContinueTimer = null; - } - - #region IHasCameraPtzControl Members - - public void PositionHome() - { - throw new NotImplementedException(); - } - - #endregion - - #region IHasCameraPanControl Members - - public void PanLeft() - { - if (isMoving) - { - return; - } - - SendCommand(eZoomRoomCameraState.Start, eZoomRoomCameraAction.Left); - StartContinueTimer(); - isPanning = true; - } - - public void PanRight() - { - if (isMoving) - { - return; - } - - SendCommand(eZoomRoomCameraState.Start, eZoomRoomCameraAction.Right); - StartContinueTimer(); - isPanning = true; - } - - public void PanStop() - { - StopContinueTimer(); - SendCommand(eZoomRoomCameraState.Stop, LastAction); - isPanning = false; - } - - #endregion - - #region IHasCameraTiltControl Members - - public void TiltDown() - { - if (!isMoving) - { - SendCommand(eZoomRoomCameraState.Start, eZoomRoomCameraAction.Down); - StartContinueTimer(); - isTilting = true; - } - } - - public void TiltUp() - { - if (!isMoving) - { - SendCommand(eZoomRoomCameraState.Start, eZoomRoomCameraAction.Up); - StartContinueTimer(); - isTilting = true; - } - } - - public void TiltStop() - { - StopContinueTimer(); - SendCommand(eZoomRoomCameraState.Stop, LastAction); - isTilting = false; - } - - #endregion - - #region IHasCameraZoomControl Members - - public void ZoomIn() - { - if (!isMoving) - { - SendCommand(eZoomRoomCameraState.Start, eZoomRoomCameraAction.In); - StartContinueTimer(); - isZooming = true; - } - } - - public void ZoomOut() - { - if (!isMoving) - { - SendCommand(eZoomRoomCameraState.Start, eZoomRoomCameraAction.Out); - StartContinueTimer(); - isZooming = true; - } - } - - public void ZoomStop() - { - StopContinueTimer(); - SendCommand(eZoomRoomCameraState.Stop, LastAction); - isZooming = false; - } - - #endregion - - public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - LinkCameraToApi(this, trilist, joinStart, joinMapKey, bridge); - } - } - - public class ZoomRoomFarEndCamera : ZoomRoomCamera, IAmFarEndCamera - { - - public ZoomRoomFarEndCamera(string key, string name, ZoomRoom codec, int id) - : base(key, name, codec) - { - Id = id; - } - - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/ZoomRoom/ZoomRoomJoinMap.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/ZoomRoom/ZoomRoomJoinMap.cs deleted file mode 100644 index bb6bf90f..00000000 --- a/src/PepperDash.Essentials.Devices.Common/VideoCodec/ZoomRoom/ZoomRoomJoinMap.cs +++ /dev/null @@ -1,706 +0,0 @@ -using System; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Bridges.JoinMaps; - -namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom -{ - public class ZoomRoomJoinMap : VideoCodecControllerJoinMap - { - #region Digital - - [JoinName("CancelJoinAttempt")] - public JoinDataComplete CancelJoinAttempt = new JoinDataComplete( - new JoinData - { - JoinNumber = 5, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Pulse to hide the password prompt", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("MeetingPasswordRequired")] - public JoinDataComplete MeetingPasswordRequired = new JoinDataComplete( - new JoinData - { - JoinNumber = 6, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "FB Indicates to show the password prompt", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("PasswordIncorrect")] - public JoinDataComplete PasswordIncorrect = new JoinDataComplete( - new JoinData - { - JoinNumber = 7, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "FB Indicates the password entered is incorrect", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("PasswordLoginFailed")] - public JoinDataComplete PasswordLoginFailed = new JoinDataComplete( - new JoinData - { - JoinNumber = 8, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "FB Indicates the password entered is incorrect", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("WaitingForHost")] - public JoinDataComplete WaitingForHost = new JoinDataComplete( - new JoinData - { - JoinNumber = 9, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "FB Indicates system is waiting for host", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("IsHost")] - public JoinDataComplete IsHost = new JoinDataComplete( - new JoinData - { - JoinNumber = 10, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "FB Indicates system is the host", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("StartMeetingNow")] - public JoinDataComplete StartMeetingNow = new JoinDataComplete( - new JoinData - { - JoinNumber = 25, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Pulse to start an ad-hoc meeting with the default duration", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("ShareOnlyMeeting")] - public JoinDataComplete ShareOnlyMeeting = new JoinDataComplete( - new JoinData - { - JoinNumber = 26, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Triggers a share only meeting, feedback indicates the current meeting is share only", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("StartNormalMeetingFromSharingOnlyMeeting")] - public JoinDataComplete StartNormalMeetingFromSharingOnlyMeeting = new JoinDataComplete( - new JoinData - { - JoinNumber = 27, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Starts a normal meeting from a share only meeting", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("CanSwapContentWithThumbnail")] - public JoinDataComplete CanSwapContentWithThumbnail = new JoinDataComplete( - new JoinData - { - JoinNumber = 206, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "FB Indicates if content can be swapped with thumbnail", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("SwapContentWithThumbnail")] - public JoinDataComplete SwapContentWithThumbnail = new JoinDataComplete( - new JoinData - { - JoinNumber = 206, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Pulse to swap content with thumbnail. FB reports current state", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("GetAvailableLayouts")] - public JoinDataComplete GetAvailableLayouts = new JoinDataComplete( - new JoinData - { - JoinNumber = 215, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Gets the available layouts. Will update the LayoutXXXXXIsAvailbale signals.", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("LayoutIsOnFirstPage")] - public JoinDataComplete LayoutIsOnFirstPage = new JoinDataComplete( - new JoinData - { - JoinNumber = 216, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Indicates if layout is on first page", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("LayoutIsOnLastPage")] - public JoinDataComplete LayoutIsOnLastPage = new JoinDataComplete( - new JoinData - { - JoinNumber = 217, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Indicates if layout is on first page", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("LayoutTurnToNextPage")] - public JoinDataComplete LayoutTurnToNextPage = new JoinDataComplete( - new JoinData - { - JoinNumber = 216, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Turns layout view to next page", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("LayoutTurnToPreviousPage")] - public JoinDataComplete LayoutTurnToPreviousPage = new JoinDataComplete( - new JoinData - { - JoinNumber = 217, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Turns layout view to previous page", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("LayoutGalleryIsAvailable")] - public JoinDataComplete LayoutGalleryIsAvailable = new JoinDataComplete( - new JoinData - { - JoinNumber = 221, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "FB Indicates if layout 'Gallery' is available", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.DigitalSerial - }); - - [JoinName("LayoutSpeakerIsAvailable")] - public JoinDataComplete LayoutSpeakerIsAvailable = new JoinDataComplete( - new JoinData - { - JoinNumber = 222, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "FB Indicates if layout 'Speaker' is available", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.DigitalSerial - }); - - [JoinName("LayoutStripIsAvailable")] - public JoinDataComplete LayoutStripIsAvailable = new JoinDataComplete( - new JoinData - { - JoinNumber = 223, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "FB Indicates if layout 'Strip' is available", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.DigitalSerial - }); - - [JoinName("LayoutShareAllIsAvailable")] - public JoinDataComplete LayoutShareAllIsAvailable = new JoinDataComplete( - new JoinData - { - JoinNumber = 224, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "FB Indicates if layout 'ShareAll' is available", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.DigitalSerial - }); - - // TODO: #714 [ ] JoinMap >> SelfivewPipSizeToggle - [JoinName("SelfviewPipSizeToggle")] - public JoinDataComplete SelfviewPipSizeToggle = new JoinDataComplete( - new JoinData - { - JoinNumber = 231, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Toggles the selfview pip size, (aka layout size)", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("StartRecording")] - public JoinDataComplete StartRecording = new JoinDataComplete( - new JoinData - { - JoinNumber = 241, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Pulse to start the Meeting Recording. FB high if meeting is currently recording", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("StopRecording")] - public JoinDataComplete StopRecording = new JoinDataComplete( - new JoinData - { - JoinNumber = 242, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Pulse to stop the Meeting Recording. FB high if meeting is currently NOT recording", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("RecordConsentPromptIsVisible")] - public JoinDataComplete RecordConsentPromptIsVisible = new JoinDataComplete( - new JoinData - { - JoinNumber = 243, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "When high, indicates that the recording consent prompt is visible on the ZoomRoom UI", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("RecordingPromptAgree")] - public JoinDataComplete RecordingPromptAgree = new JoinDataComplete( - new JoinData - { - JoinNumber = 244, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Pulse to agree to consent for meeting recording", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("RecordingPromptDisagree")] - public JoinDataComplete RecordingPromptDisagree = new JoinDataComplete( - new JoinData - { - JoinNumber = 245, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Pulse to disagree to consent for meeting recording", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("MeetingCanRecord")] - public JoinDataComplete MeetingCanRecord = new JoinDataComplete( - new JoinData - { - JoinNumber = 246, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "When high, indicated that the current meeting can be recorded", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - - #region Sharing Status - - [JoinName("IsSharingAirplay")] - public JoinDataComplete IsSharingAirplay = new JoinDataComplete( - new JoinData - { - JoinNumber = 250, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Indicates an Airplay source is sharing", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("IsSharingHdmi")] - public JoinDataComplete IsSharingHdmi = new JoinDataComplete( - new JoinData - { - JoinNumber = 251, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Indicates an HDMI source is sharing", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - - - #endregion - //[JoinName("ParticipantAudioMuteToggleStart")] - //public JoinDataComplete ParticipantAudioMuteToggleStart = new JoinDataComplete( - // new JoinData - // { - // JoinNumber = 500, - // JoinSpan = 100 - // }, - // new JoinMetadata - // { - // Description = "Toggles the participant's audio mute status", - // JoinCapabilities = eJoinCapabilities.ToSIMPL, - // JoinType = eJoinType.Digital - // }); - - //[JoinName("ParticipantVideoMuteToggleStart")] - //public JoinDataComplete ParticipantVideoMuteToggleStart = new JoinDataComplete( - // new JoinData - // { - // JoinNumber = 800, - // JoinSpan = 100 - // }, - // new JoinMetadata - // { - // Description = "Toggles the participant's video mute status", - // JoinCapabilities = eJoinCapabilities.ToSIMPL, - // JoinType = eJoinType.Digital - // }); - - //[JoinName("ParticipantPinToggleStart")] - //public JoinDataComplete ParticipantPinToggleStart = new JoinDataComplete( - // new JoinData - // { - // JoinNumber = 1100, - // JoinSpan = 100 - // }, - // new JoinMetadata - // { - // Description = "Toggles the participant's pin status", - // JoinCapabilities = eJoinCapabilities.ToSIMPL, - // JoinType = eJoinType.Digital - // }); - - #endregion - - - #region Analog - - [JoinName("NumberOfScreens")] - public JoinDataComplete NumberOfScreens = new JoinDataComplete( - new JoinData - { - JoinNumber = 11, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Reports the number of screens connected", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Analog - }); - - [JoinName("ScreenIndexToPinUserTo")] - public JoinDataComplete ScreenIndexToPinUserTo = new JoinDataComplete( - new JoinData - { - JoinNumber = 11, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Specifies the screen index a participant should be pinned to", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Analog - }); - - #endregion - - - #region Serials - - // TODO [ ] Issue #868 - [JoinName("SubmitPassword")] - public JoinDataComplete SubmitPassword = new JoinDataComplete( - new JoinData - { - JoinNumber = 6, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Submit password text", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Serial - }); - - // TODO [ ] Issue #868 - [JoinName("PasswordPromptMessage")] - public JoinDataComplete PasswordPromptMessage = new JoinDataComplete( - new JoinData - { - JoinNumber = 6, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Password prompt message", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - // TODO [ ] Issue #868 - [JoinName("MeetingInfoId")] - public JoinDataComplete MeetingInfoId = new JoinDataComplete( - new JoinData - { - JoinNumber = 11, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Meeting info ID text feedback", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - // TODO [ ] Issue #868 - [JoinName("MeetingInfoHostt")] - public JoinDataComplete MeetingInfoHost = new JoinDataComplete( - new JoinData - { - JoinNumber = 12, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Meeting info Host text feedback", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - // TODO [ ] Issue #868 - [JoinName("MeetingInfoPassword")] - public JoinDataComplete MeetingInfoPassword = new JoinDataComplete( - new JoinData - { - JoinNumber = 13, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Meeting info Password text feedback", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("GetSetCurrentLayout")] - public JoinDataComplete GetSetCurrentLayout = new JoinDataComplete( - new JoinData - { - JoinNumber = 215, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Sets and reports the current layout. Use the LayoutXXXXIsAvailable signals to determine valid layouts", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Serial - }); - - // TODO: #714 [ ] JoinMap >> GetSetSelfviewPipSize - [JoinName("GetSetSelfviewPipSize")] - public JoinDataComplete GetSetSelfviewPipSize = new JoinDataComplete( - new JoinData - { - JoinNumber = 230, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Sets and reports the selfview pip size, (aka layout size).", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.DigitalSerial - }); - - [JoinName("DisplayState")] - public JoinDataComplete DisplayState = new JoinDataComplete( - new JoinData - { - JoinNumber = 250, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Reports the instructions the ZoomRoom is displaying on the monitor. ", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("AirplayShareCode")] - public JoinDataComplete AirplayShareCode = new JoinDataComplete( - new JoinData - { - JoinNumber = 251, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Reports the current code for Airplay Sharing.", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("LaptopShareKey")] - public JoinDataComplete LaptopShareKey = new JoinDataComplete( - new JoinData - { - JoinNumber = 252, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "The alpha-only sharing key that users type into a laptop client to share with the Zoom Room.", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("LaptopSharePairingCode")] - public JoinDataComplete LaptopSharePairingCode = new JoinDataComplete( - new JoinData - { - JoinNumber = 253, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "This is the paring code that is broadcast via an ultrasonic signal from the ZRC. It is different than the user-supplied paring code. The ZRC uses a Zoom-proprietary method of advertizing the ultrasonic pairing code, so it\'s not possible to advertize it using commonly available libraries.", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("WifiName")] - public JoinDataComplete WifiName = new JoinDataComplete( - new JoinData - { - JoinNumber = 254, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Reports the Wifi SSID used by the ZoomRoom.", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("ServerName")] - public JoinDataComplete ServerName = new JoinDataComplete( - new JoinData - { - JoinNumber = 255, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Reports the namne of the the ZoomRoom.", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - - - #endregion - - public ZoomRoomJoinMap(uint joinStart) - : base(joinStart, typeof(ZoomRoomJoinMap)) - { - } - - public ZoomRoomJoinMap(uint joinStart, Type type) - : base(joinStart, type) - { - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/ZoomRoom/ZoomRoomPropertiesConfig.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/ZoomRoom/ZoomRoomPropertiesConfig.cs deleted file mode 100644 index e0d10f75..00000000 --- a/src/PepperDash.Essentials.Devices.Common/VideoCodec/ZoomRoom/ZoomRoomPropertiesConfig.cs +++ /dev/null @@ -1,46 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Converters; -using PepperDash.Core; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom -{ - public class ZoomRoomPropertiesConfig - { - [JsonProperty("communicationMonitorProperties")] - public CommunicationMonitorConfig CommunicationMonitorProperties { get; set; } - - [JsonProperty("disablePhonebookAutoDownload")] - public bool DisablePhonebookAutoDownload { get; set; } - - [JsonProperty("supportsCameraAutoMode")] - public bool SupportsCameraAutoMode { get; set; } - - [JsonProperty("supportsCameraOff")] - public bool SupportsCameraOff { get; set; } - - //if true, the layouts will be set automatically when sharing starts/ends or a call is joined - [JsonProperty("autoDefaultLayouts")] - public bool AutoDefaultLayouts { get; set; } - - /* This layout will be selected when Sharing starts (either from Far end or locally)*/ - [JsonProperty("defaultSharingLayout")] - [JsonConverter(typeof(StringEnumConverter))] - public zConfiguration.eLayoutStyle DefaultSharingLayout { get; set; } - - //This layout will be selected when a call is connected and no content is being shared - [JsonProperty("defaultCallLayout")] - [JsonConverter(typeof(StringEnumConverter))] - public zConfiguration.eLayoutStyle DefaultCallLayout { get; set; } - - [JsonProperty("minutesBeforeMeetingStart")] - public int MinutesBeforeMeetingStart { get; set; } - } -} \ No newline at end of file From 476eaba519f0ef1e90db724bd3093dd2d01c3a05 Mon Sep 17 00:00:00 2001 From: Nick Genovese Date: Wed, 8 Nov 2023 16:15:27 -0500 Subject: [PATCH 13/21] fix: added method to resolve old plugin assesmbly names & get version info --- src/PepperDash.Essentials/ControlSystem.cs | 31 ++++++++++++++++++---- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/src/PepperDash.Essentials/ControlSystem.cs b/src/PepperDash.Essentials/ControlSystem.cs index 812c15bb..a317b9fa 100644 --- a/src/PepperDash.Essentials/ControlSystem.cs +++ b/src/PepperDash.Essentials/ControlSystem.cs @@ -31,6 +31,29 @@ namespace PepperDash.Essentials DeviceManager.Initialize(this); SecretsManager.Initialize(); SystemMonitor.ProgramInitialization.ProgramInitializationUnderUserControl = true; + + AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainOnAssemblyResolve; + } + + private System.Reflection.Assembly CurrentDomainOnAssemblyResolve(object sender, ResolveEventArgs args) + { + var assemblyName = new System.Reflection.AssemblyName(args.Name).Name; + if (assemblyName == "PepperDash_Core") + { + return System.Reflection.Assembly.LoadFrom("PepperDashCore.dll"); + } + + if (assemblyName == "PepperDash_Essentials_Core") + { + return System.Reflection.Assembly.LoadFrom("PepperDash.Essentials.Core.dll"); + } + + if (assemblyName == "Essentials Devices Common") + { + return System.Reflection.Assembly.LoadFrom("PepperDash.Essentials.Devices.Common.dll"); + } + + return null; } /// @@ -141,13 +164,11 @@ namespace PepperDash.Essentials string directoryPrefix; - directoryPrefix = Crestron.SimplSharp.CrestronIO.Directory.GetApplicationRootDirectory(); + directoryPrefix = Directory.GetApplicationRootDirectory(); - var fullVersion = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false); + var fullVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(); - AssemblyInformationalVersionAttribute fullVersionAtt = fullVersion[0] as AssemblyInformationalVersionAttribute; - - Global.SetAssemblyVersion(fullVersionAtt.InformationalVersion); + Global.SetAssemblyVersion(fullVersion); if (CrestronEnvironment.DevicePlatform != eDevicePlatform.Server) // Handles 3-series running Windows CE OS { From 332d56cf70216741f8ec371d0eb636cd20c5800f Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 28 Dec 2023 15:41:16 -0600 Subject: [PATCH 14/21] build: add multi-targeting to Essentials Essentials will now build for both .NET Framework 4.7.2 and .NET 6. CPZ's and CPLZs are named appropriately, as .NET 6 assemblies won't work on VC-4. --- PepperDash.Essentials.sln | 7 ++++++ src/Directory.Build.targets | 25 +++++++++++-------- .../PepperDash.Essentials.Core.csproj | 16 ++++++------ ...epperDash.Essentials.Devices.Common.csproj | 17 ++++++------- .../PepperDash.Essentials.csproj | 17 ++++++------- 5 files changed, 46 insertions(+), 36 deletions(-) diff --git a/PepperDash.Essentials.sln b/PepperDash.Essentials.sln index 40da3b9b..e2db852a 100644 --- a/PepperDash.Essentials.sln +++ b/PepperDash.Essentials.sln @@ -11,18 +11,25 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PepperDash.Essentials.Core" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug 4.7.2|Any CPU = Debug 4.7.2|Any CPU Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {53E204B7-97DD-441D-A96C-721DF014DF82}.Debug 4.7.2|Any CPU.ActiveCfg = Debug 4.7.2|Any CPU + {53E204B7-97DD-441D-A96C-721DF014DF82}.Debug 4.7.2|Any CPU.Build.0 = Debug 4.7.2|Any CPU {53E204B7-97DD-441D-A96C-721DF014DF82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {53E204B7-97DD-441D-A96C-721DF014DF82}.Debug|Any CPU.Build.0 = Debug|Any CPU {53E204B7-97DD-441D-A96C-721DF014DF82}.Release|Any CPU.ActiveCfg = Release|Any CPU {53E204B7-97DD-441D-A96C-721DF014DF82}.Release|Any CPU.Build.0 = Release|Any CPU + {CB3B11BA-625C-4D35-B663-FDC5BE9A230E}.Debug 4.7.2|Any CPU.ActiveCfg = Debug 4.7.2|Any CPU + {CB3B11BA-625C-4D35-B663-FDC5BE9A230E}.Debug 4.7.2|Any CPU.Build.0 = Debug 4.7.2|Any CPU {CB3B11BA-625C-4D35-B663-FDC5BE9A230E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CB3B11BA-625C-4D35-B663-FDC5BE9A230E}.Debug|Any CPU.Build.0 = Debug|Any CPU {CB3B11BA-625C-4D35-B663-FDC5BE9A230E}.Release|Any CPU.ActiveCfg = Release|Any CPU {CB3B11BA-625C-4D35-B663-FDC5BE9A230E}.Release|Any CPU.Build.0 = Release|Any CPU + {3D192FED-8FFC-4CB5-B5F7-BA307ABA254B}.Debug 4.7.2|Any CPU.ActiveCfg = Debug 4.7.2|Any CPU + {3D192FED-8FFC-4CB5-B5F7-BA307ABA254B}.Debug 4.7.2|Any CPU.Build.0 = Debug 4.7.2|Any CPU {3D192FED-8FFC-4CB5-B5F7-BA307ABA254B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3D192FED-8FFC-4CB5-B5F7-BA307ABA254B}.Debug|Any CPU.Build.0 = Debug|Any CPU {3D192FED-8FFC-4CB5-B5F7-BA307ABA254B}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index 807679e4..6c49ddc7 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -1,28 +1,33 @@ - + true content; - + true content; - + - + - + - + - - - + + + + + + + + - + diff --git a/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj b/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj index 8ea0cf86..a5360467 100644 --- a/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj +++ b/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj @@ -1,9 +1,11 @@  ProgramLibrary + Debug;Release;Debug 4.7.2 - net472 + net472;net6 + true bin\$(Configuration)\ PepperDash.Essentials.Core PepperDash.Essentials.Core @@ -13,6 +15,9 @@ full + + full + pdbonly @@ -22,16 +27,11 @@ - - - - - - + Full - + diff --git a/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj b/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj index 96ef4e5d..6b0b5972 100644 --- a/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj +++ b/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj @@ -1,10 +1,11 @@  ProgramLibrary + Debug;Release;Debug 4.7.2 - net472 - false + net472;net6 + true bin\$(Configuration)\ PepperDash.Essentials.Devices.Common PepperDash.Essentials.Devices.Common @@ -15,22 +16,20 @@ full + + full + pdbonly - - - - - - + Full - + \ No newline at end of file diff --git a/src/PepperDash.Essentials/PepperDash.Essentials.csproj b/src/PepperDash.Essentials/PepperDash.Essentials.csproj index bcc0e152..3b6c5d83 100644 --- a/src/PepperDash.Essentials/PepperDash.Essentials.csproj +++ b/src/PepperDash.Essentials/PepperDash.Essentials.csproj @@ -1,12 +1,13 @@  Program + Debug;Release;Debug 4.7.2 PepperDash.Essentials PepperDash.Essentials - net472 - false + net472;net6 + true bin\$(Configuration)\ PepperDash Essentials PepperDashEssentials @@ -14,14 +15,12 @@ full + + full + pdbonly - - - - - Always @@ -46,11 +45,11 @@ - + Full - + From 0548d3b3ea24eaacc85b44e953b0709006ccd392 Mon Sep 17 00:00:00 2001 From: Nick Genovese Date: Thu, 1 Feb 2024 13:16:15 -0500 Subject: [PATCH 15/21] chore: added some additional documentation --- src/PepperDash.Essentials.Core/Devices/PC/InRoomPc.cs | 4 ++-- src/PepperDash.Essentials.Core/Devices/PC/Laptop.cs | 4 ++-- src/PepperDash.Essentials.Core/Display/BasicIrDisplay.cs | 4 ++-- src/PepperDash.Essentials.Core/Display/DisplayBase.cs | 4 ++-- src/PepperDash.Essentials.Core/Display/MockDisplay.cs | 4 ++-- src/PepperDash.Essentials.Core/Lighting/LightingBase.cs | 2 +- src/PepperDash.Essentials.Core/Shades/ShadeBase.cs | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/PepperDash.Essentials.Core/Devices/PC/InRoomPc.cs b/src/PepperDash.Essentials.Core/Devices/PC/InRoomPc.cs index b02024da..12b3f0c8 100644 --- a/src/PepperDash.Essentials.Core/Devices/PC/InRoomPc.cs +++ b/src/PepperDash.Essentials.Core/Devices/PC/InRoomPc.cs @@ -10,7 +10,7 @@ using PepperDash.Core; namespace PepperDash.Essentials.Core.Devices { - [Obsolete("Please use PepperDash.Essentials.Devices.Common")] + [Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")] public class InRoomPc : EssentialsDevice, IHasFeedback, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo, IUsageTracking { public uint DisplayUiType { get { return DisplayUiConstants.TypeLaptop; } } @@ -63,7 +63,7 @@ namespace PepperDash.Essentials.Core.Devices #endregion } - [Obsolete("Please use PepperDash.Essentials.Devices.Common")] + [Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")] public class InRoomPcFactory : EssentialsDeviceFactory { public InRoomPcFactory() diff --git a/src/PepperDash.Essentials.Core/Devices/PC/Laptop.cs b/src/PepperDash.Essentials.Core/Devices/PC/Laptop.cs index d392edac..28069c76 100644 --- a/src/PepperDash.Essentials.Core/Devices/PC/Laptop.cs +++ b/src/PepperDash.Essentials.Core/Devices/PC/Laptop.cs @@ -11,7 +11,7 @@ using PepperDash.Core; namespace PepperDash.Essentials.Core.Devices { - [Obsolete("Please use PepperDash.Essentials.Devices.Common")] + [Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")] public class Laptop : EssentialsDevice, IHasFeedback, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo, IUsageTracking { public uint DisplayUiType { get { return DisplayUiConstants.TypeLaptop; } } @@ -64,7 +64,7 @@ namespace PepperDash.Essentials.Core.Devices #endregion } - [Obsolete("Please use PepperDash.Essentials.Devices.Common")] + [Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")] public class LaptopFactory : EssentialsDeviceFactory { public LaptopFactory() diff --git a/src/PepperDash.Essentials.Core/Display/BasicIrDisplay.cs b/src/PepperDash.Essentials.Core/Display/BasicIrDisplay.cs index 8d0afdcc..121a1874 100644 --- a/src/PepperDash.Essentials.Core/Display/BasicIrDisplay.cs +++ b/src/PepperDash.Essentials.Core/Display/BasicIrDisplay.cs @@ -14,7 +14,7 @@ using PepperDash.Essentials.Core.Routing; namespace PepperDash.Essentials.Core { - [Obsolete("Please use PepperDash.Essentials.Device.Common")] + [Obsolete("Please use PepperDash.Essentials.Device.Common, this will be removed in 2.1")] public class BasicIrDisplay : DisplayBase, IBasicVolumeControls, IBridgeAdvanced { public IrOutputPortController IrPort { get; private set; } @@ -203,7 +203,7 @@ namespace PepperDash.Essentials.Core } } - [Obsolete("Please use PepperDash.Essentials.Device.Common")] + [Obsolete("Please use PepperDash.Essentials.Device.Common, this will be removed in 2.1")] public class BasicIrDisplayFactory : EssentialsDeviceFactory { public BasicIrDisplayFactory() diff --git a/src/PepperDash.Essentials.Core/Display/DisplayBase.cs b/src/PepperDash.Essentials.Core/Display/DisplayBase.cs index 0bb172ca..aa94f4f4 100644 --- a/src/PepperDash.Essentials.Core/Display/DisplayBase.cs +++ b/src/PepperDash.Essentials.Core/Display/DisplayBase.cs @@ -12,7 +12,7 @@ using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.Core { - [Obsolete("Please use PepperDash.Essentials.Devices.Common")] + [Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")] public abstract class DisplayBase : EssentialsDevice, IHasFeedback, IRoutingSinkWithSwitching, IHasPowerControl, IWarmingCooling, IUsageTracking { public event SourceInfoChangeHandler CurrentSourceChange; @@ -250,7 +250,7 @@ namespace PepperDash.Essentials.Core } - [Obsolete("Please use PepperDash.Essentials.Devices.Common")] + [Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")] public abstract class TwoWayDisplayBase : DisplayBase, IRoutingFeedback, IHasPowerControlWithFeedback { public StringFeedback CurrentInputFeedback { get; private set; } diff --git a/src/PepperDash.Essentials.Core/Display/MockDisplay.cs b/src/PepperDash.Essentials.Core/Display/MockDisplay.cs index 4b60882b..db568519 100644 --- a/src/PepperDash.Essentials.Core/Display/MockDisplay.cs +++ b/src/PepperDash.Essentials.Core/Display/MockDisplay.cs @@ -16,7 +16,7 @@ using PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.Core { - [Obsolete("Please use PepperDash.Essentials.Devices.Common")] + [Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")] public class MockDisplay : TwoWayDisplayBase, IBasicVolumeWithFeedback, IBridgeAdvanced { @@ -219,7 +219,7 @@ namespace PepperDash.Essentials.Core } - [Obsolete("Please use PepperDash.Essentials.Devices.Common")] + [Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")] public class MockDisplayFactory : EssentialsDeviceFactory { public MockDisplayFactory() diff --git a/src/PepperDash.Essentials.Core/Lighting/LightingBase.cs b/src/PepperDash.Essentials.Core/Lighting/LightingBase.cs index 996b01ad..38a74d37 100644 --- a/src/PepperDash.Essentials.Core/Lighting/LightingBase.cs +++ b/src/PepperDash.Essentials.Core/Lighting/LightingBase.cs @@ -13,7 +13,7 @@ using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.Core.Lighting { - [Obsolete("Please use PepperDash.Essentials.Devices.Common")] + [Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")] public abstract class LightingBase : EssentialsBridgeableDevice, ILightingScenes { #region ILightingScenes Members diff --git a/src/PepperDash.Essentials.Core/Shades/ShadeBase.cs b/src/PepperDash.Essentials.Core/Shades/ShadeBase.cs index d35c46ca..c44abac6 100644 --- a/src/PepperDash.Essentials.Core/Shades/ShadeBase.cs +++ b/src/PepperDash.Essentials.Core/Shades/ShadeBase.cs @@ -10,7 +10,7 @@ using PepperDash.Essentials.Core.CrestronIO; namespace PepperDash.Essentials.Core.Shades { - [Obsolete("Please use PepperDash.Essentials.Devices.Common")] + [Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")] public abstract class ShadeBase : EssentialsDevice, IShadesOpenCloseStop { public ShadeBase(string key, string name) From 0a9ba77bb7297cc6972cfc444230fc23918f4de1 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 1 Feb 2024 16:46:46 -0600 Subject: [PATCH 16/21] feat: add event for when AppUrlChanges --- .../DeviceTypeInterfaces/IMobileControl.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IMobileControl.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IMobileControl.cs index bb800b44..eff9e70f 100644 --- a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IMobileControl.cs +++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IMobileControl.cs @@ -32,6 +32,8 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces event EventHandler ClientJoined; + event EventHandler AppUrlChanged; + string UserCode { get; } string QrCodeUrl { get; } @@ -41,5 +43,7 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces string McServerUrl { get; } string RoomName { get; } + + string AppUrl { get; } } } \ No newline at end of file From b74755c825105a630aaa33acc60f042b66ba0f0d Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 1 Feb 2024 16:47:10 -0600 Subject: [PATCH 17/21] chore: remove references to full Newtonsoft package --- src/PepperDash.Essentials.Core/Bridges/BridgeBase.cs | 4 ++-- .../Comm and IR/ComSpecJsonConverter.cs | 6 +++--- .../Comm and IR/CommFactory.cs | 6 +++--- .../Comm and IR/CommunicationExtras.cs | 6 +++--- .../Comm and IR/GenericComm.cs | 4 ++-- .../Comm and IR/IRPortHelper.cs | 6 +++--- src/PepperDash.Essentials.Core/Config/BasicConfig.cs | 6 +++--- .../Config/ConfigPropertiesHelpers.cs | 4 ++-- .../Config/DeviceConfig.cs | 6 +++--- .../Config/Essentials/ConfigReader.cs | 6 +++--- .../Config/Essentials/ConfigUpdater.cs | 6 +++--- .../Config/Essentials/ConfigWriter.cs | 6 +++--- .../Config/Essentials/EssentialsConfig.cs | 4 ++-- src/PepperDash.Essentials.Core/Config/InfoConfig.cs | 4 ++-- .../CrestronIO/GenericDigitalInputDevice.cs | 4 ++-- .../CrestronIO/GenericRelayDevice.cs | 4 ++-- .../CrestronIO/GenericVersiportAnalogInputDevice.cs | 4 ++-- .../CrestronIO/GenericVersiportInputDevice.cs | 4 ++-- .../CrestronIO/GenericVersiportOutputDevice.cs | 4 ++-- .../CrestronIO/IOPortConfig.cs | 4 ++-- .../Devices/DestinationListItem.cs | 4 ++-- .../Devices/DeviceJsonApi.cs | 4 ++-- .../Devices/GenericIRController.cs | 4 ++-- .../Devices/IrOutputPortController.cs | 4 ++-- .../Devices/ReconfigurableDevice.cs | 6 +++--- .../Devices/SourceListItem.cs | 8 ++++---- .../Display/DisplayBase.cs | 7 +++++-- .../Extensions/JsonExtensions.cs | 6 +++--- .../Factory/DeviceFactory.cs | 4 ++-- .../Factory/ProcessorExtensionDeviceFactory.cs | 12 ++++++------ ...ssentialsHuddleSpaceFusionSystemControllerBase.cs | 6 +++--- .../Fusion/FusionCustomPropertiesBridge.cs | 6 +++--- src/PepperDash.Essentials.Core/Global/Global.cs | 8 ++++---- .../JoinMaps/JoinMapBase.cs | 4 ++-- .../Lighting/LightingBase.cs | 4 ++-- .../Monitoring/SystemMonitorController.cs | 6 +++--- .../PepperDash.Essentials.Core.csproj | 12 +++++++----- .../Presets/DevicePresets.cs | 4 ++-- src/PepperDash.Essentials.Core/Presets/PresetBase.cs | 4 ++-- .../Presets/PresetChannel.cs | 4 ++-- .../Behaviours/RoomOnToDefaultSourceWhenOccupied.cs | 6 +++--- .../EssentialsRoomCombinerPropertiesConfig.cs | 4 ++-- .../Room/Combining/RoomCombinationScenario.cs | 4 ++-- .../Config/EssentialsRoomScheduledEventsConfig.cs | 6 +++--- .../Routing/TieLineConfig.cs | 6 +++--- .../Secrets/SecretsPropertiesConfig.cs | 4 ++-- .../Timers/RetriggerableTimer.cs | 4 ++-- .../Utilities/ActionSequence.cs | 4 ++-- .../AudioCodec/MockAC/MockAcPropertiesConfig.cs | 4 ++-- .../Cameras/CameraBase.cs | 4 ++-- .../Cameras/CameraVisca.cs | 4 ++-- .../Codec/CodecActiveCallItem.cs | 6 +++--- .../Codec/iHasCallHistory.cs | 6 +++--- .../Codec/iHasDirectory.cs | 6 +++--- .../Codec/iHasScheduleAwareness.cs | 4 ++-- .../DeviceFactory.cs | 2 +- .../PepperDash.Essentials.Devices.Common.csproj | 7 ++----- .../SetTopBox/IRSetTopBoxBase.cs | 4 ++-- .../Streaming/AppleTV.cs | 4 ++-- .../VideoCodec/Interfaces/IHasCodecLayouts.cs | 4 ++-- .../VideoCodec/Interfaces/IHasMeetingInfo.cs | 4 ++-- .../VideoCodec/Interfaces/iVideoCodecInfo.cs | 4 ++-- .../VideoCodec/MockVC/MockVC.cs | 6 +++--- .../VideoCodec/MockVC/MockVcPropertiesConfig.cs | 4 ++-- src/PepperDash.Essentials/ControlSystem.cs | 2 +- src/PepperDash.Essentials/Factory/DeviceFactory.cs | 6 +++--- .../PepperDash.Essentials.csproj | 7 ++----- 67 files changed, 170 insertions(+), 171 deletions(-) diff --git a/src/PepperDash.Essentials.Core/Bridges/BridgeBase.cs b/src/PepperDash.Essentials.Core/Bridges/BridgeBase.cs index 58917199..545733a7 100644 --- a/src/PepperDash.Essentials.Core/Bridges/BridgeBase.cs +++ b/src/PepperDash.Essentials.Core/Bridges/BridgeBase.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -8,7 +8,7 @@ using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.EthernetCommunication; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Config; diff --git a/src/PepperDash.Essentials.Core/Comm and IR/ComSpecJsonConverter.cs b/src/PepperDash.Essentials.Core/Comm and IR/ComSpecJsonConverter.cs index 2f6050b6..f13e6375 100644 --- a/src/PepperDash.Essentials.Core/Comm and IR/ComSpecJsonConverter.cs +++ b/src/PepperDash.Essentials.Core/Comm and IR/ComSpecJsonConverter.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -7,8 +7,8 @@ using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using PepperDash.Core; diff --git a/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs b/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs index 8c132a1b..f7b743cc 100644 --- a/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs +++ b/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs @@ -1,11 +1,11 @@ -extern alias Full; + using System; using Crestron.SimplSharp; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DM; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using PepperDash.Core; using PepperDash.Essentials.Core.Config; diff --git a/src/PepperDash.Essentials.Core/Comm and IR/CommunicationExtras.cs b/src/PepperDash.Essentials.Core/Comm and IR/CommunicationExtras.cs index bc4e4302..995004b9 100644 --- a/src/PepperDash.Essentials.Core/Comm and IR/CommunicationExtras.cs +++ b/src/PepperDash.Essentials.Core/Comm and IR/CommunicationExtras.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -7,8 +7,8 @@ using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using PepperDash.Core; diff --git a/src/PepperDash.Essentials.Core/Comm and IR/GenericComm.cs b/src/PepperDash.Essentials.Core/Comm and IR/GenericComm.cs index 8ce6a8c5..8e00e5c1 100644 --- a/src/PepperDash.Essentials.Core/Comm and IR/GenericComm.cs +++ b/src/PepperDash.Essentials.Core/Comm and IR/GenericComm.cs @@ -1,10 +1,10 @@ -extern alias Full; + using System; using System.Collections.Generic; using Crestron.SimplSharp.CrestronSockets; using Crestron.SimplSharpPro.DeviceSupport; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Bridges; diff --git a/src/PepperDash.Essentials.Core/Comm and IR/IRPortHelper.cs b/src/PepperDash.Essentials.Core/Comm and IR/IRPortHelper.cs index 4d99edc0..7141613b 100644 --- a/src/PepperDash.Essentials.Core/Comm and IR/IRPortHelper.cs +++ b/src/PepperDash.Essentials.Core/Comm and IR/IRPortHelper.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -6,8 +6,8 @@ using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; using Crestron.SimplSharpPro; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using PepperDash.Core; using PepperDash.Essentials.Core.Config; diff --git a/src/PepperDash.Essentials.Core/Config/BasicConfig.cs b/src/PepperDash.Essentials.Core/Config/BasicConfig.cs index 728e8dff..6e876de8 100644 --- a/src/PepperDash.Essentials.Core/Config/BasicConfig.cs +++ b/src/PepperDash.Essentials.Core/Config/BasicConfig.cs @@ -1,10 +1,10 @@ -extern alias Full; + using System.Collections.Generic; using System.Linq; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json.Linq; namespace PepperDash.Essentials.Core.Config { diff --git a/src/PepperDash.Essentials.Core/Config/ConfigPropertiesHelpers.cs b/src/PepperDash.Essentials.Core/Config/ConfigPropertiesHelpers.cs index 0d832bfa..0950d62e 100644 --- a/src/PepperDash.Essentials.Core/Config/ConfigPropertiesHelpers.cs +++ b/src/PepperDash.Essentials.Core/Config/ConfigPropertiesHelpers.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -7,7 +7,7 @@ using System.Text; using Crestron.SimplSharp; using PepperDash.Essentials.Core; using PepperDash.Core; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json.Linq; namespace PepperDash.Essentials.Core.Config { diff --git a/src/PepperDash.Essentials.Core/Config/DeviceConfig.cs b/src/PepperDash.Essentials.Core/Config/DeviceConfig.cs index ba21ae38..3eac80d9 100644 --- a/src/PepperDash.Essentials.Core/Config/DeviceConfig.cs +++ b/src/PepperDash.Essentials.Core/Config/DeviceConfig.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -6,8 +6,8 @@ using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; using Crestron.SimplSharpPro; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using PepperDash.Core; using PepperDash.Essentials.Core; diff --git a/src/PepperDash.Essentials.Core/Config/Essentials/ConfigReader.cs b/src/PepperDash.Essentials.Core/Config/Essentials/ConfigReader.cs index ae90a1b1..9cdd3e98 100644 --- a/src/PepperDash.Essentials.Core/Config/Essentials/ConfigReader.cs +++ b/src/PepperDash.Essentials.Core/Config/Essentials/ConfigReader.cs @@ -1,12 +1,12 @@ -extern alias Full; + using System; using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using PepperDash.Core; using PepperDash.Core.Config; diff --git a/src/PepperDash.Essentials.Core/Config/Essentials/ConfigUpdater.cs b/src/PepperDash.Essentials.Core/Config/Essentials/ConfigUpdater.cs index 71783373..13641a80 100644 --- a/src/PepperDash.Essentials.Core/Config/Essentials/ConfigUpdater.cs +++ b/src/PepperDash.Essentials.Core/Config/Essentials/ConfigUpdater.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -6,8 +6,8 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using Crestron.SimplSharp.Net.Http; using Crestron.SimplSharpPro.Diagnostics; diff --git a/src/PepperDash.Essentials.Core/Config/Essentials/ConfigWriter.cs b/src/PepperDash.Essentials.Core/Config/Essentials/ConfigWriter.cs index efb17b51..8c1e8f10 100644 --- a/src/PepperDash.Essentials.Core/Config/Essentials/ConfigWriter.cs +++ b/src/PepperDash.Essentials.Core/Config/Essentials/ConfigWriter.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -6,8 +6,8 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using PepperDash.Core; namespace PepperDash.Essentials.Core.Config diff --git a/src/PepperDash.Essentials.Core/Config/Essentials/EssentialsConfig.cs b/src/PepperDash.Essentials.Core/Config/Essentials/EssentialsConfig.cs index 16b1886b..dac5a35c 100644 --- a/src/PepperDash.Essentials.Core/Config/Essentials/EssentialsConfig.cs +++ b/src/PepperDash.Essentials.Core/Config/Essentials/EssentialsConfig.cs @@ -1,11 +1,11 @@ -extern alias Full; + using System; using System.Collections.Generic; using System.Text.RegularExpressions; using Crestron.SimplSharp.CrestronIO; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; using PepperDash.Core; diff --git a/src/PepperDash.Essentials.Core/Config/InfoConfig.cs b/src/PepperDash.Essentials.Core/Config/InfoConfig.cs index 820abde5..32a6f71e 100644 --- a/src/PepperDash.Essentials.Core/Config/InfoConfig.cs +++ b/src/PepperDash.Essentials.Core/Config/InfoConfig.cs @@ -1,11 +1,11 @@ -extern alias Full; + using System; using System.Collections.Generic; using Crestron.SimplSharp; using Crestron.SimplSharp.Reflection; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; namespace PepperDash.Essentials.Core.Config { diff --git a/src/PepperDash.Essentials.Core/CrestronIO/GenericDigitalInputDevice.cs b/src/PepperDash.Essentials.Core/CrestronIO/GenericDigitalInputDevice.cs index 589e4fe5..4078c331 100644 --- a/src/PepperDash.Essentials.Core/CrestronIO/GenericDigitalInputDevice.cs +++ b/src/PepperDash.Essentials.Core/CrestronIO/GenericDigitalInputDevice.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -7,7 +7,7 @@ using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Config; diff --git a/src/PepperDash.Essentials.Core/CrestronIO/GenericRelayDevice.cs b/src/PepperDash.Essentials.Core/CrestronIO/GenericRelayDevice.cs index 44ddef63..b8c580df 100644 --- a/src/PepperDash.Essentials.Core/CrestronIO/GenericRelayDevice.cs +++ b/src/PepperDash.Essentials.Core/CrestronIO/GenericRelayDevice.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -7,7 +7,7 @@ using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Config; diff --git a/src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportAnalogInputDevice.cs b/src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportAnalogInputDevice.cs index 5da79bbf..a0fbd03d 100644 --- a/src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportAnalogInputDevice.cs +++ b/src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportAnalogInputDevice.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -13,7 +13,7 @@ using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Bridges; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; namespace PepperDash.Essentials.Core.CrestronIO { diff --git a/src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportInputDevice.cs b/src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportInputDevice.cs index fd215545..aa25e6b4 100644 --- a/src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportInputDevice.cs +++ b/src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportInputDevice.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -13,7 +13,7 @@ using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Bridges; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; namespace PepperDash.Essentials.Core.CrestronIO { diff --git a/src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportOutputDevice.cs b/src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportOutputDevice.cs index 2b3d0fab..8dda5bfb 100644 --- a/src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportOutputDevice.cs +++ b/src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportOutputDevice.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -13,7 +13,7 @@ using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Bridges; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; namespace PepperDash.Essentials.Core.CrestronIO { diff --git a/src/PepperDash.Essentials.Core/CrestronIO/IOPortConfig.cs b/src/PepperDash.Essentials.Core/CrestronIO/IOPortConfig.cs index 13d35fb5..ab269f08 100644 --- a/src/PepperDash.Essentials.Core/CrestronIO/IOPortConfig.cs +++ b/src/PepperDash.Essentials.Core/CrestronIO/IOPortConfig.cs @@ -1,11 +1,11 @@ -extern alias Full; + using System; using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; namespace PepperDash.Essentials.Core.CrestronIO { diff --git a/src/PepperDash.Essentials.Core/Devices/DestinationListItem.cs b/src/PepperDash.Essentials.Core/Devices/DestinationListItem.cs index a3314e9c..946ece3b 100644 --- a/src/PepperDash.Essentials.Core/Devices/DestinationListItem.cs +++ b/src/PepperDash.Essentials.Core/Devices/DestinationListItem.cs @@ -1,6 +1,6 @@ -extern alias Full; + -using Full.Newtonsoft.Json; +using Newtonsoft.Json; using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Core diff --git a/src/PepperDash.Essentials.Core/Devices/DeviceJsonApi.cs b/src/PepperDash.Essentials.Core/Devices/DeviceJsonApi.cs index dafda2a9..d4c3313d 100644 --- a/src/PepperDash.Essentials.Core/Devices/DeviceJsonApi.cs +++ b/src/PepperDash.Essentials.Core/Devices/DeviceJsonApi.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections; @@ -7,7 +7,7 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharp.Reflection; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; using PepperDash.Core; diff --git a/src/PepperDash.Essentials.Core/Devices/GenericIRController.cs b/src/PepperDash.Essentials.Core/Devices/GenericIRController.cs index 178e0c30..b7c15fce 100644 --- a/src/PepperDash.Essentials.Core/Devices/GenericIRController.cs +++ b/src/PepperDash.Essentials.Core/Devices/GenericIRController.cs @@ -1,10 +1,10 @@ -extern alias Full; + using System; using System.Collections.Generic; using System.Linq; using Crestron.SimplSharpPro.DeviceSupport; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Config; diff --git a/src/PepperDash.Essentials.Core/Devices/IrOutputPortController.cs b/src/PepperDash.Essentials.Core/Devices/IrOutputPortController.cs index 6ffee074..d65d1f7b 100644 --- a/src/PepperDash.Essentials.Core/Devices/IrOutputPortController.cs +++ b/src/PepperDash.Essentials.Core/Devices/IrOutputPortController.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -6,7 +6,7 @@ using System.Linq; using Crestron.SimplSharp; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json.Linq; using PepperDash.Essentials.Core.Config; diff --git a/src/PepperDash.Essentials.Core/Devices/ReconfigurableDevice.cs b/src/PepperDash.Essentials.Core/Devices/ReconfigurableDevice.cs index 50bf90bd..1da908a9 100644 --- a/src/PepperDash.Essentials.Core/Devices/ReconfigurableDevice.cs +++ b/src/PepperDash.Essentials.Core/Devices/ReconfigurableDevice.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -9,8 +9,8 @@ using Crestron.SimplSharpPro.DeviceSupport; using PepperDash.Core; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Config; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; namespace PepperDash.Essentials.Core.Devices { diff --git a/src/PepperDash.Essentials.Core/Devices/SourceListItem.cs b/src/PepperDash.Essentials.Core/Devices/SourceListItem.cs index 87c66e75..491f76a9 100644 --- a/src/PepperDash.Essentials.Core/Devices/SourceListItem.cs +++ b/src/PepperDash.Essentials.Core/Devices/SourceListItem.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -6,9 +6,9 @@ using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; using Crestron.SimplSharpPro; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Converters; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; using PepperDash.Core; namespace PepperDash.Essentials.Core diff --git a/src/PepperDash.Essentials.Core/Display/DisplayBase.cs b/src/PepperDash.Essentials.Core/Display/DisplayBase.cs index aa94f4f4..9ba42cab 100644 --- a/src/PepperDash.Essentials.Core/Display/DisplayBase.cs +++ b/src/PepperDash.Essentials.Core/Display/DisplayBase.cs @@ -1,11 +1,14 @@ -extern alias Full; + using System; using System.Collections.Generic; using System.Linq; using Crestron.SimplSharp; using Crestron.SimplSharpPro.DeviceSupport; -using Full.Newtonsoft.Json; +using Crestron.SimplSharpPro.DM; +using Crestron.SimplSharpPro.DM.Endpoints; +using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; +using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Bridges; diff --git a/src/PepperDash.Essentials.Core/Extensions/JsonExtensions.cs b/src/PepperDash.Essentials.Core/Extensions/JsonExtensions.cs index f001c985..2d71c6bc 100644 --- a/src/PepperDash.Essentials.Core/Extensions/JsonExtensions.cs +++ b/src/PepperDash.Essentials.Core/Extensions/JsonExtensions.cs @@ -1,12 +1,12 @@ -extern alias Full; + using System; using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; namespace PepperDash.Essentials.Core { diff --git a/src/PepperDash.Essentials.Core/Factory/DeviceFactory.cs b/src/PepperDash.Essentials.Core/Factory/DeviceFactory.cs index bfc32661..8b506141 100644 --- a/src/PepperDash.Essentials.Core/Factory/DeviceFactory.cs +++ b/src/PepperDash.Essentials.Core/Factory/DeviceFactory.cs @@ -1,8 +1,8 @@ -extern alias Full; + using Crestron.SimplSharp; using Crestron.SimplSharp.Reflection; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json.Linq; using PepperDash.Core; using PepperDash.Essentials.Core.Config; using System; diff --git a/src/PepperDash.Essentials.Core/Factory/ProcessorExtensionDeviceFactory.cs b/src/PepperDash.Essentials.Core/Factory/ProcessorExtensionDeviceFactory.cs index a5b57ad3..4f78892a 100644 --- a/src/PepperDash.Essentials.Core/Factory/ProcessorExtensionDeviceFactory.cs +++ b/src/PepperDash.Essentials.Core/Factory/ProcessorExtensionDeviceFactory.cs @@ -1,6 +1,6 @@ -extern alias Full; + using Crestron.SimplSharp.Reflection; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq; using PepperDash.Core; using PepperDash.Essentials.Core.Config; @@ -70,9 +70,9 @@ namespace PepperDash.Essentials.Core ProcessorExtensionDeviceFactory.ProcessorExtensionFactoryMethods.Add(extensionName, wrapper); } - private static void CheckForSecrets(IEnumerable obj) + private static void CheckForSecrets(IEnumerable obj) { - foreach (var prop in obj.Where(prop => prop.Value as Full.Newtonsoft.Json.Linq.JObject != null)) + foreach (var prop in obj.Where(prop => prop.Value as Newtonsoft.Json.Linq.JObject != null)) { if (prop.Name.ToLower() == "secret") { @@ -80,7 +80,7 @@ namespace PepperDash.Essentials.Core //var secret = GetSecret(JsonConvert.DeserializeObject(prop.Children().First().ToString())); prop.Parent.Replace(secret); } - var recurseProp = prop.Value as Full.Newtonsoft.Json.Linq.JObject; + var recurseProp = prop.Value as Newtonsoft.Json.Linq.JObject; if (recurseProp == null) return; CheckForSecrets(recurseProp.Properties()); } @@ -120,7 +120,7 @@ namespace PepperDash.Essentials.Core var typeName = localDc.Type.ToLower(); - var jObject = properties as Full.Newtonsoft.Json.Linq.JObject; + var jObject = properties as Newtonsoft.Json.Linq.JObject; if (jObject != null) { var jProp = jObject.Properties(); diff --git a/src/PepperDash.Essentials.Core/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs b/src/PepperDash.Essentials.Core/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs index 597a31fd..b15fe095 100644 --- a/src/PepperDash.Essentials.Core/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs +++ b/src/PepperDash.Essentials.Core/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -10,7 +10,7 @@ using Crestron.SimplSharp.CrestronXml; using Crestron.SimplSharp.CrestronXml.Serialization; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.Fusion; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Config; @@ -252,7 +252,7 @@ namespace PepperDash.Essentials.Core.Fusion ? new FusionRoomGuids(Room.Name, _ipId, RoomGuid, FusionStaticAssets) : new FusionRoomGuids(Room.Name, _ipId, RoomGuid, FusionStaticAssets, FusionOccSensor); - var json = JsonConvert.SerializeObject(_guiDs, Full.Newtonsoft.Json.Formatting.Indented); + var json = JsonConvert.SerializeObject(_guiDs, Newtonsoft.Json.Formatting.Indented); using (var sw = new StreamWriter(filePath)) { diff --git a/src/PepperDash.Essentials.Core/Fusion/FusionCustomPropertiesBridge.cs b/src/PepperDash.Essentials.Core/Fusion/FusionCustomPropertiesBridge.cs index 82f3b972..86eeffc3 100644 --- a/src/PepperDash.Essentials.Core/Fusion/FusionCustomPropertiesBridge.cs +++ b/src/PepperDash.Essentials.Core/Fusion/FusionCustomPropertiesBridge.cs @@ -1,12 +1,12 @@ -extern alias Full; + using System; using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using PepperDash.Core; using PepperDash.Essentials.Core; diff --git a/src/PepperDash.Essentials.Core/Global/Global.cs b/src/PepperDash.Essentials.Core/Global/Global.cs index d9e56673..59d37b56 100644 --- a/src/PepperDash.Essentials.Core/Global/Global.cs +++ b/src/PepperDash.Essentials.Core/Global/Global.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Linq; @@ -14,9 +14,9 @@ using Crestron.SimplSharpPro.DM; using PepperDash.Core; using PepperDash.Essentials.License; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; -using Full.Newtonsoft.Json.Schema; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using Newtonsoft.Json.Schema; namespace PepperDash.Essentials.Core diff --git a/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBase.cs b/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBase.cs index 0f5519eb..6138c003 100644 --- a/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBase.cs +++ b/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBase.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -12,7 +12,7 @@ using Crestron.SimplSharp; using PepperDash.Core; using PepperDash.Essentials.Core.Config; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; namespace PepperDash.Essentials.Core { diff --git a/src/PepperDash.Essentials.Core/Lighting/LightingBase.cs b/src/PepperDash.Essentials.Core/Lighting/LightingBase.cs index 38a74d37..e144ea62 100644 --- a/src/PepperDash.Essentials.Core/Lighting/LightingBase.cs +++ b/src/PepperDash.Essentials.Core/Lighting/LightingBase.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -7,7 +7,7 @@ using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Bridges; diff --git a/src/PepperDash.Essentials.Core/Monitoring/SystemMonitorController.cs b/src/PepperDash.Essentials.Core/Monitoring/SystemMonitorController.cs index 1066637c..2b5b6ea2 100644 --- a/src/PepperDash.Essentials.Core/Monitoring/SystemMonitorController.cs +++ b/src/PepperDash.Essentials.Core/Monitoring/SystemMonitorController.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -7,8 +7,8 @@ using Crestron.SimplSharp; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.Diagnostics; using PepperDash.Core; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Converters; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.Core.Monitoring diff --git a/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj b/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj index a5360467..bea39ded 100644 --- a/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj +++ b/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj @@ -27,11 +27,13 @@ - - - Full - - + + + + + + + diff --git a/src/PepperDash.Essentials.Core/Presets/DevicePresets.cs b/src/PepperDash.Essentials.Core/Presets/DevicePresets.cs index ab59914d..78e7f7e1 100644 --- a/src/PepperDash.Essentials.Core/Presets/DevicePresets.cs +++ b/src/PepperDash.Essentials.Core/Presets/DevicePresets.cs @@ -1,11 +1,11 @@ -extern alias Full; + using System; using System.Collections.Generic; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; using PepperDash.Core; //using SSMono.IO; diff --git a/src/PepperDash.Essentials.Core/Presets/PresetBase.cs b/src/PepperDash.Essentials.Core/Presets/PresetBase.cs index 1263d231..1eaf7739 100644 --- a/src/PepperDash.Essentials.Core/Presets/PresetBase.cs +++ b/src/PepperDash.Essentials.Core/Presets/PresetBase.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -6,7 +6,7 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; namespace PepperDash.Essentials.Core.Presets { diff --git a/src/PepperDash.Essentials.Core/Presets/PresetChannel.cs b/src/PepperDash.Essentials.Core/Presets/PresetChannel.cs index 203722f3..c10ba75d 100644 --- a/src/PepperDash.Essentials.Core/Presets/PresetChannel.cs +++ b/src/PepperDash.Essentials.Core/Presets/PresetChannel.cs @@ -1,11 +1,11 @@ -extern alias Full; + using System; using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; namespace PepperDash.Essentials.Core.Presets { diff --git a/src/PepperDash.Essentials.Core/Room/Behaviours/RoomOnToDefaultSourceWhenOccupied.cs b/src/PepperDash.Essentials.Core/Room/Behaviours/RoomOnToDefaultSourceWhenOccupied.cs index c3bc0ca2..ba84f949 100644 --- a/src/PepperDash.Essentials.Core/Room/Behaviours/RoomOnToDefaultSourceWhenOccupied.cs +++ b/src/PepperDash.Essentials.Core/Room/Behaviours/RoomOnToDefaultSourceWhenOccupied.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -7,8 +7,8 @@ using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharp.Scheduler; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using PepperDash.Core; using PepperDash.Essentials.Core; diff --git a/src/PepperDash.Essentials.Core/Room/Combining/EssentialsRoomCombinerPropertiesConfig.cs b/src/PepperDash.Essentials.Core/Room/Combining/EssentialsRoomCombinerPropertiesConfig.cs index d926a4a8..745f303f 100644 --- a/src/PepperDash.Essentials.Core/Room/Combining/EssentialsRoomCombinerPropertiesConfig.cs +++ b/src/PepperDash.Essentials.Core/Room/Combining/EssentialsRoomCombinerPropertiesConfig.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -8,7 +8,7 @@ using Crestron.SimplSharp; using PepperDash.Core; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; namespace PepperDash.Essentials.Core { diff --git a/src/PepperDash.Essentials.Core/Room/Combining/RoomCombinationScenario.cs b/src/PepperDash.Essentials.Core/Room/Combining/RoomCombinationScenario.cs index d9142495..a4525999 100644 --- a/src/PepperDash.Essentials.Core/Room/Combining/RoomCombinationScenario.cs +++ b/src/PepperDash.Essentials.Core/Room/Combining/RoomCombinationScenario.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -8,7 +8,7 @@ using Crestron.SimplSharp; using PepperDash.Core; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; namespace PepperDash.Essentials.Core { diff --git a/src/PepperDash.Essentials.Core/Room/Config/EssentialsRoomScheduledEventsConfig.cs b/src/PepperDash.Essentials.Core/Room/Config/EssentialsRoomScheduledEventsConfig.cs index a4239ec2..617b7c9f 100644 --- a/src/PepperDash.Essentials.Core/Room/Config/EssentialsRoomScheduledEventsConfig.cs +++ b/src/PepperDash.Essentials.Core/Room/Config/EssentialsRoomScheduledEventsConfig.cs @@ -1,9 +1,9 @@ -extern alias Full; + using System.Collections.Generic; using Crestron.SimplSharp.Scheduler; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Converters; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Room.Config diff --git a/src/PepperDash.Essentials.Core/Routing/TieLineConfig.cs b/src/PepperDash.Essentials.Core/Routing/TieLineConfig.cs index ba340302..edb34e7f 100644 --- a/src/PepperDash.Essentials.Core/Routing/TieLineConfig.cs +++ b/src/PepperDash.Essentials.Core/Routing/TieLineConfig.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -6,8 +6,8 @@ using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; using Crestron.SimplSharpPro; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using PepperDash.Core; using PepperDash.Essentials.Core; diff --git a/src/PepperDash.Essentials.Core/Secrets/SecretsPropertiesConfig.cs b/src/PepperDash.Essentials.Core/Secrets/SecretsPropertiesConfig.cs index f1f7b995..f092d5d3 100644 --- a/src/PepperDash.Essentials.Core/Secrets/SecretsPropertiesConfig.cs +++ b/src/PepperDash.Essentials.Core/Secrets/SecretsPropertiesConfig.cs @@ -1,11 +1,11 @@ -extern alias Full; + using System; using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; namespace PepperDash.Essentials.Core { diff --git a/src/PepperDash.Essentials.Core/Timers/RetriggerableTimer.cs b/src/PepperDash.Essentials.Core/Timers/RetriggerableTimer.cs index 0064fd7a..fe72247d 100644 --- a/src/PepperDash.Essentials.Core/Timers/RetriggerableTimer.cs +++ b/src/PepperDash.Essentials.Core/Timers/RetriggerableTimer.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -10,7 +10,7 @@ using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; namespace PepperDash.Essentials.Core.Timers diff --git a/src/PepperDash.Essentials.Core/Utilities/ActionSequence.cs b/src/PepperDash.Essentials.Core/Utilities/ActionSequence.cs index 8b657fd5..f0c2bfc2 100644 --- a/src/PepperDash.Essentials.Core/Utilities/ActionSequence.cs +++ b/src/PepperDash.Essentials.Core/Utilities/ActionSequence.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -11,7 +11,7 @@ using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; namespace PepperDash.Essentials.Core.Utilities { diff --git a/src/PepperDash.Essentials.Devices.Common/AudioCodec/MockAC/MockAcPropertiesConfig.cs b/src/PepperDash.Essentials.Devices.Common/AudioCodec/MockAC/MockAcPropertiesConfig.cs index 084c111f..c9d041eb 100644 --- a/src/PepperDash.Essentials.Devices.Common/AudioCodec/MockAC/MockAcPropertiesConfig.cs +++ b/src/PepperDash.Essentials.Devices.Common/AudioCodec/MockAC/MockAcPropertiesConfig.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -6,7 +6,7 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; namespace PepperDash.Essentials.Devices.Common.AudioCodec { diff --git a/src/PepperDash.Essentials.Devices.Common/Cameras/CameraBase.cs b/src/PepperDash.Essentials.Devices.Common/Cameras/CameraBase.cs index 294e9066..bc7d371d 100644 --- a/src/PepperDash.Essentials.Devices.Common/Cameras/CameraBase.cs +++ b/src/PepperDash.Essentials.Devices.Common/Cameras/CameraBase.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -16,7 +16,7 @@ using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Presets; using PepperDash.Essentials.Devices.Common.Codec; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; namespace PepperDash.Essentials.Devices.Common.Cameras { diff --git a/src/PepperDash.Essentials.Devices.Common/Cameras/CameraVisca.cs b/src/PepperDash.Essentials.Devices.Common/Cameras/CameraVisca.cs index 5f609c46..59c0d418 100644 --- a/src/PepperDash.Essentials.Devices.Common/Cameras/CameraVisca.cs +++ b/src/PepperDash.Essentials.Devices.Common/Cameras/CameraVisca.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -14,7 +14,7 @@ using PepperDash.Essentials.Devices.Common.Codec; using System.Text.RegularExpressions; using Crestron.SimplSharp.Reflection; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; namespace PepperDash.Essentials.Devices.Common.Cameras { diff --git a/src/PepperDash.Essentials.Devices.Common/Codec/CodecActiveCallItem.cs b/src/PepperDash.Essentials.Devices.Common/Codec/CodecActiveCallItem.cs index f9624991..a8b8d563 100644 --- a/src/PepperDash.Essentials.Devices.Common/Codec/CodecActiveCallItem.cs +++ b/src/PepperDash.Essentials.Devices.Common/Codec/CodecActiveCallItem.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -6,8 +6,8 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Converters; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; namespace PepperDash.Essentials.Devices.Common.Codec diff --git a/src/PepperDash.Essentials.Devices.Common/Codec/iHasCallHistory.cs b/src/PepperDash.Essentials.Devices.Common/Codec/iHasCallHistory.cs index 07e53b3d..e5d060ec 100644 --- a/src/PepperDash.Essentials.Devices.Common/Codec/iHasCallHistory.cs +++ b/src/PepperDash.Essentials.Devices.Common/Codec/iHasCallHistory.cs @@ -1,11 +1,11 @@ -extern alias Full; + using System; using System.Collections.Generic; using PepperDash.Essentials.Devices.Common.VideoCodec; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Converters; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; namespace PepperDash.Essentials.Devices.Common.Codec { diff --git a/src/PepperDash.Essentials.Devices.Common/Codec/iHasDirectory.cs b/src/PepperDash.Essentials.Devices.Common/Codec/iHasDirectory.cs index 360d111e..6a4e62fe 100644 --- a/src/PepperDash.Essentials.Devices.Common/Codec/iHasDirectory.cs +++ b/src/PepperDash.Essentials.Devices.Common/Codec/iHasDirectory.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -6,8 +6,8 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Converters; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; using PepperDash.Core; diff --git a/src/PepperDash.Essentials.Devices.Common/Codec/iHasScheduleAwareness.cs b/src/PepperDash.Essentials.Devices.Common/Codec/iHasScheduleAwareness.cs index 6ddf10c2..42ef5b76 100644 --- a/src/PepperDash.Essentials.Devices.Common/Codec/iHasScheduleAwareness.cs +++ b/src/PepperDash.Essentials.Devices.Common/Codec/iHasScheduleAwareness.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -8,7 +8,7 @@ using Crestron.SimplSharp; using PepperDash.Core; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; namespace PepperDash.Essentials.Devices.Common.Codec { diff --git a/src/PepperDash.Essentials.Devices.Common/DeviceFactory.cs b/src/PepperDash.Essentials.Devices.Common/DeviceFactory.cs index b5ee9a89..00678803 100644 --- a/src/PepperDash.Essentials.Devices.Common/DeviceFactory.cs +++ b/src/PepperDash.Essentials.Devices.Common/DeviceFactory.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Linq; diff --git a/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj b/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj index 6b0b5972..bb182ae7 100644 --- a/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj +++ b/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj @@ -26,10 +26,7 @@ - - - Full - - + + \ No newline at end of file diff --git a/src/PepperDash.Essentials.Devices.Common/SetTopBox/IRSetTopBoxBase.cs b/src/PepperDash.Essentials.Devices.Common/SetTopBox/IRSetTopBoxBase.cs index b7c7e349..8cc29f0f 100644 --- a/src/PepperDash.Essentials.Devices.Common/SetTopBox/IRSetTopBoxBase.cs +++ b/src/PepperDash.Essentials.Devices.Common/SetTopBox/IRSetTopBoxBase.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -7,7 +7,7 @@ using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; diff --git a/src/PepperDash.Essentials.Devices.Common/Streaming/AppleTV.cs b/src/PepperDash.Essentials.Devices.Common/Streaming/AppleTV.cs index 33719295..addc0211 100644 --- a/src/PepperDash.Essentials.Devices.Common/Streaming/AppleTV.cs +++ b/src/PepperDash.Essentials.Devices.Common/Streaming/AppleTV.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -8,7 +8,7 @@ using Crestron.SimplSharp; using Crestron.SimplSharp.Reflection; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/Interfaces/IHasCodecLayouts.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/Interfaces/IHasCodecLayouts.cs index 02280fdb..98a8e4f4 100644 --- a/src/PepperDash.Essentials.Devices.Common/VideoCodec/Interfaces/IHasCodecLayouts.cs +++ b/src/PepperDash.Essentials.Devices.Common/VideoCodec/Interfaces/IHasCodecLayouts.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -8,7 +8,7 @@ using Crestron.SimplSharp; using PepperDash.Essentials.Core; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; namespace PepperDash.Essentials.Devices.Common.VideoCodec { diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/Interfaces/IHasMeetingInfo.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/Interfaces/IHasMeetingInfo.cs index 304400fc..bde88b61 100644 --- a/src/PepperDash.Essentials.Devices.Common/VideoCodec/Interfaces/IHasMeetingInfo.cs +++ b/src/PepperDash.Essentials.Devices.Common/VideoCodec/Interfaces/IHasMeetingInfo.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -6,7 +6,7 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; namespace PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces { diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/Interfaces/iVideoCodecInfo.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/Interfaces/iVideoCodecInfo.cs index 23c39325..8f004086 100644 --- a/src/PepperDash.Essentials.Devices.Common/VideoCodec/Interfaces/iVideoCodecInfo.cs +++ b/src/PepperDash.Essentials.Devices.Common/VideoCodec/Interfaces/iVideoCodecInfo.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -6,7 +6,7 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; namespace PepperDash.Essentials.Devices.Common.Codec { diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/MockVC/MockVC.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/MockVC/MockVC.cs index 66dc6180..87f0fe55 100644 --- a/src/PepperDash.Essentials.Devices.Common/VideoCodec/MockVC/MockVC.cs +++ b/src/PepperDash.Essentials.Devices.Common/VideoCodec/MockVC/MockVC.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -14,8 +14,8 @@ using PepperDash.Essentials.Core.Routing; using PepperDash.Essentials.Devices.Common.Codec; using PepperDash.Essentials.Devices.Common.Cameras; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; namespace PepperDash.Essentials.Devices.Common.VideoCodec { diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/MockVC/MockVcPropertiesConfig.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/MockVC/MockVcPropertiesConfig.cs index 1f1b823e..c1940c3a 100644 --- a/src/PepperDash.Essentials.Devices.Common/VideoCodec/MockVC/MockVcPropertiesConfig.cs +++ b/src/PepperDash.Essentials.Devices.Common/VideoCodec/MockVC/MockVcPropertiesConfig.cs @@ -1,11 +1,11 @@ -extern alias Full; + using System; using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core; diff --git a/src/PepperDash.Essentials/ControlSystem.cs b/src/PepperDash.Essentials/ControlSystem.cs index a317b9fa..a98e25b2 100644 --- a/src/PepperDash.Essentials/ControlSystem.cs +++ b/src/PepperDash.Essentials/ControlSystem.cs @@ -1,4 +1,4 @@ -extern alias Full; + using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; using Crestron.SimplSharp.Reflection; diff --git a/src/PepperDash.Essentials/Factory/DeviceFactory.cs b/src/PepperDash.Essentials/Factory/DeviceFactory.cs index 418fb603..1f7cae95 100644 --- a/src/PepperDash.Essentials/Factory/DeviceFactory.cs +++ b/src/PepperDash.Essentials/Factory/DeviceFactory.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -8,8 +8,8 @@ using Crestron.SimplSharp.CrestronIO; using Crestron.SimplSharpPro; using Crestron.SimplSharp.Reflection; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; diff --git a/src/PepperDash.Essentials/PepperDash.Essentials.csproj b/src/PepperDash.Essentials/PepperDash.Essentials.csproj index 3b6c5d83..2c6b6ebb 100644 --- a/src/PepperDash.Essentials/PepperDash.Essentials.csproj +++ b/src/PepperDash.Essentials/PepperDash.Essentials.csproj @@ -45,11 +45,8 @@ - - - Full - - + + From 1d74136e9e301f08680be8659ab32e8aa1fe85f9 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Fri, 2 Feb 2024 09:14:21 -0600 Subject: [PATCH 18/21] build: correct more issues with targets and such --- src/Directory.Build.targets | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index 6c49ddc7..a50b8161 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -1,6 +1,6 @@ - + true content; @@ -9,25 +9,21 @@ content; - + - + - + - - - - - - + + From 7a66fdd49062e318f01ad48f4c1774e9d42a9cdf Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Fri, 2 Feb 2024 09:53:53 -0600 Subject: [PATCH 19/21] fi: more newtonsoft fixes --- .../Displays/DisplayBase.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/PepperDash.Essentials.Devices.Common/Displays/DisplayBase.cs b/src/PepperDash.Essentials.Devices.Common/Displays/DisplayBase.cs index d93d57ff..76e04405 100644 --- a/src/PepperDash.Essentials.Devices.Common/Displays/DisplayBase.cs +++ b/src/PepperDash.Essentials.Devices.Common/Displays/DisplayBase.cs @@ -1,5 +1,4 @@ -extern alias Full; -using System; +using System; using System.Collections.Generic; using System.Linq; using Crestron.SimplSharp; @@ -8,8 +7,7 @@ using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; using Feedback = PepperDash.Essentials.Core.Feedback; -using JsonConvert = Full::Newtonsoft.Json.JsonConvert; - +using Newtonsoft.Json; namespace PepperDash.Essentials.Devices.Common.Displays { From 9dfc99259fe8a2db123349835305de067efdc0d4 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Fri, 2 Feb 2024 11:53:00 -0600 Subject: [PATCH 20/21] build: got packages building correctly --- src/Directory.Build.targets | 31 +++++++++---------- .../PepperDash.Essentials.Core.csproj | 9 ++---- ...epperDash.Essentials.Devices.Common.csproj | 4 +-- .../PepperDash.Essentials.csproj | 4 +-- 4 files changed, 20 insertions(+), 28 deletions(-) diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index a50b8161..83bbc930 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -1,29 +1,26 @@ - + true - content; + build; - + true - content; + build; - - - - + + + + + - - - - + - - + - - - + + + diff --git a/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj b/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj index bea39ded..13af0017 100644 --- a/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj +++ b/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj @@ -27,13 +27,8 @@ - - - - - - - + + diff --git a/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj b/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj index bb182ae7..1378b836 100644 --- a/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj +++ b/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj @@ -26,7 +26,7 @@ - - + + \ No newline at end of file diff --git a/src/PepperDash.Essentials/PepperDash.Essentials.csproj b/src/PepperDash.Essentials/PepperDash.Essentials.csproj index 2c6b6ebb..663a5f84 100644 --- a/src/PepperDash.Essentials/PepperDash.Essentials.csproj +++ b/src/PepperDash.Essentials/PepperDash.Essentials.csproj @@ -45,8 +45,8 @@ - - + + From dc52ec4c0c84e846c27998946bc0be42d87a0229 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Fri, 2 Feb 2024 11:54:43 -0600 Subject: [PATCH 21/21] ci: adjust for new paths for things --- .github/workflows/docker.yml | 2 +- .github/workflows/main.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 23b077a4..7fe106d3 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -79,7 +79,7 @@ jobs: # contains(steps.setVersion.outputs.version, '-beta-') uses: ncipollo/release-action@v1 with: - artifacts: 'output\*.*(cpz|cplz)' + artifacts: 'output\**\*.*(cpz|cplz)' generateReleaseNotes: true prerelease: ${{contains('debug', env.BUILD_TYPE)}} tag: ${{ steps.setVersion.outputs.version }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 608fc7b5..babd2651 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -42,7 +42,7 @@ jobs: uses: ncipollo/release-action@v1 with: updateRelease: true - artifacts: 'output\*.*(cpz|cplz)' + artifacts: 'output\**\*.*(cpz|cplz)' tag: ${{ steps.setVersion.outputs.version }} - name: Setup Nuget run: |