From 8023ef6c1b0ed5beb84bf82d8ff247612f21fa6f Mon Sep 17 00:00:00 2001 From: Nick Genovese Date: Wed, 8 Nov 2023 14:26:58 -0500 Subject: [PATCH] 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