From 68ea7bba8416c3f94474ee0ee9c3fdec455cc543 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Fri, 26 Jun 2020 22:57:39 -0600 Subject: [PATCH] moving interfaces and base classes into Core from Devices Common maybe too far down the rabbit hole? --- .../Messengers/AudioCodecBaseMessenger.cs | 2 +- .../AppServer/Messengers/MessengerBase.cs | 2 +- .../AppServer/Messengers/SIMPLAtcMessenger.cs | 2 +- .../AppServer/Messengers/SIMPLVtcMessenger.cs | 2 +- .../Messengers/VideoCodecBaseMessenger.cs | 2 +- ...eControlEssentialsHuddleSpaceRoomBridge.cs | 2 +- .../MobileControlSIMPLRoomBridge.cs | 8 +- .../EssentialsHuddleVtc1FusionController.cs | 4 +- .../PepperDashEssentials.csproj | 1 - .../Essentials/EssentialsHeaderDriver.cs | 2 +- ...entialsHuddleVtc1PanelAvFunctionsDriver.cs | 2 +- .../VC/EssentialsVideoCodecUiDriver.cs | 2 +- .../Codec/CodecActiveCallItem.cs | 67 ++++ .../Codec/eCodecCallDirection.cs | 41 +++ .../Codec/eCodecCallStatus.cs | 89 +++++ .../Codec/eCodecCallType.cs | 54 +++ .../Codec/eMeetingPrivacy.cs | 42 +++ .../DeviceTypeInterfaces/Codec/iCodecAudio.cs | 10 + .../Codec/iHasCallFavorites.cs | 22 ++ .../Codec/iHasCallHistory.cs | 83 +++++ .../Codec/iHasContentSharing.cs | 24 ++ .../DeviceTypeInterfaces/Codec/iHasDialer.cs | 24 ++ .../Codec/iHasDirectory.cs | 223 ++++++++++++ .../Codec/iHasScheduleAwareness.cs | 165 +++++++++ .../DeviceTypeInterfaces/IAudioCodecInfo.cs | 18 + .../DeviceTypeInterfaces/IHasAudioCodec.cs | 18 + .../DeviceTypeInterfaces/IHasCodecLayouts.cs | 22 ++ .../DeviceTypeInterfaces/IHasCodecSelfview.cs | 26 ++ .../DeviceTypeInterfaces/IHasVideoCodec.cs | 32 ++ .../DeviceTypeInterfaces/iVideoCodecInfo.cs | 30 ++ .../Devices/VideoCodecBase.cs | 323 ++++++++++++++++++ .../PepperDash_Essentials_Core.csproj | 20 ++ .../EssentialsHuddleVtc1PropertiesConfig.cs | 10 +- .../Room/Config/EssentialsRoomConfig.cs | 119 +++---- .../Config/EssentialsVolumeLevelConfig.cs | 64 ++++ .../Room/Interfaces.cs | 2 +- .../Room/Types/EssentialsDualDisplayRoom.cs | 2 +- .../Room/Types/EssentialsHuddleVtc1Room.cs | 48 +-- .../AudioCodec/MockAC/MockAC.cs | 2 +- .../Cameras/CameraBase.cs | 2 +- .../Cameras/CameraVisca.cs | 2 +- .../Codec/CodecActiveCallItem.cs | 2 +- .../Codec/eCodecCallDirection.cs | 2 +- .../Codec/eCodecCallStatus.cs | 2 +- .../Codec/eCodecCallType.cs | 2 +- .../Codec/eMeetingPrivacy.cs | 2 +- .../Codec/iHasDialer.cs | 9 +- .../Essentials Devices Common/DSP/DspBase.cs | 2 +- .../Essentials Devices Common.csproj | 15 - .../CiscoCodec/BookingsDataClasses.cs | 4 +- .../VideoCodec/CiscoCodec/CiscoSparkCodec.cs | 64 +++- .../CiscoSparkCodecPropertiesConfig.cs | 2 +- .../CiscoCodec/PhonebookDataClasses.cs | 12 +- .../VideoCodec/MockVC/MockCodecDirectory.cs | 2 +- .../VideoCodec/MockVC/MockVC.cs | 2 +- .../MockVC/MockVcPropertiesConfig.cs | 2 +- .../VideoCodec/ZoomRoom/ResponseObjects.cs | 6 +- .../VideoCodec/ZoomRoom/ZoomRoom.cs | 3 +- 58 files changed, 1565 insertions(+), 183 deletions(-) create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/CodecActiveCallItem.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/eCodecCallDirection.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/eCodecCallStatus.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/eCodecCallType.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/eMeetingPrivacy.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/iCodecAudio.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/iHasCallFavorites.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/iHasCallHistory.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/iHasContentSharing.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/iHasDialer.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/iHasDirectory.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/iHasScheduleAwareness.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IAudioCodecInfo.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IHasAudioCodec.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IHasCodecLayouts.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IHasCodecSelfview.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IHasVideoCodec.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/iVideoCodecInfo.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/VideoCodecBase.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Config/EssentialsVolumeLevelConfig.cs diff --git a/PepperDashEssentials/AppServer/Messengers/AudioCodecBaseMessenger.cs b/PepperDashEssentials/AppServer/Messengers/AudioCodecBaseMessenger.cs index 3d74b132..b606396a 100644 --- a/PepperDashEssentials/AppServer/Messengers/AudioCodecBaseMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/AudioCodecBaseMessenger.cs @@ -7,7 +7,7 @@ using Crestron.SimplSharp; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using PepperDash.Essentials.Devices.Common.Codec; +using PepperDash.Essentials.Core.Devices.Codec; using PepperDash.Essentials.Devices.Common.AudioCodec; namespace PepperDash.Essentials.AppServer.Messengers diff --git a/PepperDashEssentials/AppServer/Messengers/MessengerBase.cs b/PepperDashEssentials/AppServer/Messengers/MessengerBase.cs index d4967eee..981ef4b7 100644 --- a/PepperDashEssentials/AppServer/Messengers/MessengerBase.cs +++ b/PepperDashEssentials/AppServer/Messengers/MessengerBase.cs @@ -9,7 +9,7 @@ using Newtonsoft.Json.Linq; using PepperDash.Core; -using PepperDash.Essentials.Devices.Common.Codec; +using PepperDash.Essentials.Core.Devices.Codec; using PepperDash.Essentials.Devices.Common.VideoCodec; namespace PepperDash.Essentials.AppServer.Messengers diff --git a/PepperDashEssentials/AppServer/Messengers/SIMPLAtcMessenger.cs b/PepperDashEssentials/AppServer/Messengers/SIMPLAtcMessenger.cs index 5bf042b9..e7fb05ef 100644 --- a/PepperDashEssentials/AppServer/Messengers/SIMPLAtcMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/SIMPLAtcMessenger.cs @@ -8,7 +8,7 @@ using Crestron.SimplSharpPro.EthernetCommunication; using PepperDash.Core; using PepperDash.Essentials.Core; -using PepperDash.Essentials.Devices.Common.Codec; +using PepperDash.Essentials.Core.Devices.Codec; namespace PepperDash.Essentials.AppServer.Messengers { diff --git a/PepperDashEssentials/AppServer/Messengers/SIMPLVtcMessenger.cs b/PepperDashEssentials/AppServer/Messengers/SIMPLVtcMessenger.cs index c67e335e..391360fb 100644 --- a/PepperDashEssentials/AppServer/Messengers/SIMPLVtcMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/SIMPLVtcMessenger.cs @@ -8,7 +8,7 @@ using Crestron.SimplSharpPro.EthernetCommunication; using PepperDash.Core; using PepperDash.Essentials.Core; -using PepperDash.Essentials.Devices.Common.Codec; +using PepperDash.Essentials.Core.Devices.Codec; using PepperDash.Essentials.Devices.Common.Cameras; namespace PepperDash.Essentials.AppServer.Messengers diff --git a/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs b/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs index 0ee943c9..f5c6f3d5 100644 --- a/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs @@ -9,7 +9,7 @@ using Newtonsoft.Json.Linq; using PepperDash.Core; -using PepperDash.Essentials.Devices.Common.Codec; +using PepperDash.Essentials.Core.Devices.Codec; using PepperDash.Essentials.Devices.Common.Cameras; using PepperDash.Essentials.Devices.Common.VideoCodec; diff --git a/PepperDashEssentials/AppServer/RoomBridges/MobileControlEssentialsHuddleSpaceRoomBridge.cs b/PepperDashEssentials/AppServer/RoomBridges/MobileControlEssentialsHuddleSpaceRoomBridge.cs index 8a67ba14..5e9ef55a 100644 --- a/PepperDashEssentials/AppServer/RoomBridges/MobileControlEssentialsHuddleSpaceRoomBridge.cs +++ b/PepperDashEssentials/AppServer/RoomBridges/MobileControlEssentialsHuddleSpaceRoomBridge.cs @@ -10,7 +10,7 @@ using PepperDash.Core; using PepperDash.Essentials.AppServer.Messengers; using PepperDash.Essentials.Core; using PepperDash.Essentials.Room.MobileControl; -using PepperDash.Essentials.Devices.Common.Codec; +using PepperDash.Essentials.Core.Devices.Codec; using PepperDash.Essentials.Devices.Common.VideoCodec; using PepperDash.Essentials.Devices.Common.AudioCodec; diff --git a/PepperDashEssentials/AppServer/RoomBridges/MobileControlSIMPLRoomBridge.cs b/PepperDashEssentials/AppServer/RoomBridges/MobileControlSIMPLRoomBridge.cs index 25eebf42..a09a48d1 100644 --- a/PepperDashEssentials/AppServer/RoomBridges/MobileControlSIMPLRoomBridge.cs +++ b/PepperDashEssentials/AppServer/RoomBridges/MobileControlSIMPLRoomBridge.cs @@ -522,18 +522,18 @@ namespace PepperDash.Essentials.Room.MobileControl // Build "audioCodec" config if we need if (!string.IsNullOrEmpty(rmProps.AudioCodecKey)) { - var acFavs = new List(); + var acFavs = new List(); for (uint i = 0; i < 4; i++) { if (!EISC.GetBool(JoinMap.SpeedDialVisibleStartJoin.JoinNumber + i)) { break; } - acFavs.Add(new PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem() + acFavs.Add(new Core.Devices.Codec.CodecActiveCallItem() { Name = EISC.GetString(JoinMap.SpeedDialNameStartJoin.JoinNumber + i), Number = EISC.GetString(JoinMap.SpeedDialNumberStartJoin.JoinNumber + i), - Type = PepperDash.Essentials.Devices.Common.Codec.eCodecCallType.Audio + Type = Core.Devices.Codec.eCodecCallType.Audio }); } @@ -558,7 +558,7 @@ namespace PepperDash.Essentials.Room.MobileControl if (!string.IsNullOrEmpty(rmProps.VideoCodecKey)) { // No favorites, for now? - var favs = new List(); + var favs = new List(); // cameras var camsProps = new List(); diff --git a/PepperDashEssentials/Fusion/EssentialsHuddleVtc1FusionController.cs b/PepperDashEssentials/Fusion/EssentialsHuddleVtc1FusionController.cs index c6c85d1a..e8ac34df 100644 --- a/PepperDashEssentials/Fusion/EssentialsHuddleVtc1FusionController.cs +++ b/PepperDashEssentials/Fusion/EssentialsHuddleVtc1FusionController.cs @@ -69,7 +69,7 @@ namespace PepperDash.Essentials.Fusion // In Call Status CodecIsInCall = FusionRoom.CreateOffsetBoolSig(69, "Conf - VC 1 In Call", eSigIoMask.InputSigOnly); - codec.CallStatusChange += new EventHandler(codec_CallStatusChange); + codec.CallStatusChange += new EventHandler(codec_CallStatusChange); // Online status if (codec is ICommunicationMonitor) @@ -147,7 +147,7 @@ namespace PepperDash.Essentials.Fusion } } - void codec_CallStatusChange(object sender, PepperDash.Essentials.Devices.Common.Codec.CodecCallStatusItemChangeEventArgs e) + void codec_CallStatusChange(object sender, Core.Devices.Codec.CodecCallStatusItemChangeEventArgs e) { var codec = (Room as EssentialsHuddleVtc1Room).VideoCodec; diff --git a/PepperDashEssentials/PepperDashEssentials.csproj b/PepperDashEssentials/PepperDashEssentials.csproj index f5dbefdd..d215f64e 100644 --- a/PepperDashEssentials/PepperDashEssentials.csproj +++ b/PepperDashEssentials/PepperDashEssentials.csproj @@ -123,7 +123,6 @@ - diff --git a/PepperDashEssentials/UIDrivers/Essentials/EssentialsHeaderDriver.cs b/PepperDashEssentials/UIDrivers/Essentials/EssentialsHeaderDriver.cs index 68d4cbcb..e72c45b4 100644 --- a/PepperDashEssentials/UIDrivers/Essentials/EssentialsHeaderDriver.cs +++ b/PepperDashEssentials/UIDrivers/Essentials/EssentialsHeaderDriver.cs @@ -13,7 +13,7 @@ using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.SmartObjects; using PepperDash.Essentials.Core.PageManagers; using PepperDash.Essentials.Room.Config; -using PepperDash.Essentials.Devices.Common.Codec; +using PepperDash.Essentials.Core.Devices.Codec; using PepperDash.Essentials.Devices.Common.VideoCodec; diff --git a/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs b/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs index 9248e50a..f8b2b4cb 100644 --- a/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs +++ b/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs @@ -11,7 +11,7 @@ using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.SmartObjects; using PepperDash.Essentials.Core.PageManagers; using PepperDash.Essentials.Room.Config; -using PepperDash.Essentials.Devices.Common.Codec; +using PepperDash.Essentials.Core.Devices.Codec; using PepperDash.Essentials.Devices.Common.VideoCodec; namespace PepperDash.Essentials diff --git a/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs b/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs index f966c4cb..a0685d45 100644 --- a/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs +++ b/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs @@ -11,7 +11,7 @@ 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.Core.Devices.Codec; using PepperDash.Essentials.Devices.Common.VideoCodec; namespace PepperDash.Essentials.UIDrivers.VC diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/CodecActiveCallItem.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/CodecActiveCallItem.cs new file mode 100644 index 00000000..f873b4cd --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/CodecActiveCallItem.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace PepperDash.Essentials.Core.Devices.Codec + +{ + public class CodecActiveCallItem + { + [JsonProperty("name")] + public string Name { get; set; } + + [JsonProperty("number")] + public string Number { get; set; } + + [JsonProperty("type")] + [JsonConverter(typeof(StringEnumConverter))] + public eCodecCallType Type { get; set; } + + [JsonProperty("status")] + [JsonConverter(typeof(StringEnumConverter))] + public eCodecCallStatus Status { get; set; } + + [JsonProperty("direction")] + [JsonConverter(typeof(StringEnumConverter))] + public eCodecCallDirection Direction { get; set; } + + [JsonProperty("id")] + public string Id { get; set; } + + //public object CallMetaData { get; set; } + + /// + /// Returns true when this call is any status other than + /// Unknown, Disconnected, Disconnecting + /// + [JsonProperty("isActiveCall")] + public bool IsActiveCall + { + get + { + return !(Status == eCodecCallStatus.Disconnected + || Status == eCodecCallStatus.Disconnecting + || Status == eCodecCallStatus.Idle + || Status == eCodecCallStatus.Unknown); + } + } + } + + /// + /// + /// + public class CodecCallStatusItemChangeEventArgs : EventArgs + { + public CodecActiveCallItem CallItem { get; private set; } + + public CodecCallStatusItemChangeEventArgs(CodecActiveCallItem item) + { + CallItem = item; + } + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/eCodecCallDirection.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/eCodecCallDirection.cs new file mode 100644 index 00000000..54d763d3 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/eCodecCallDirection.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +namespace PepperDash.Essentials.Core.Devices.Codec + +{ + public enum eCodecCallDirection + { + Unknown = 0, Incoming, Outgoing + } + + public class CodecCallDirection + { + /// + /// Takes the Cisco call type and converts to the matching enum + /// + /// + /// + public static eCodecCallDirection ConvertToDirectionEnum(string s) + { + switch (s.ToLower()) + { + case "incoming": + { + return eCodecCallDirection.Incoming; + } + case "outgoing": + { + return eCodecCallDirection.Outgoing; + } + default: + return eCodecCallDirection.Unknown; + } + + } + + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/eCodecCallStatus.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/eCodecCallStatus.cs new file mode 100644 index 00000000..99481814 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/eCodecCallStatus.cs @@ -0,0 +1,89 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +namespace PepperDash.Essentials.Core.Devices.Codec +{ + public enum eCodecCallStatus + { + Unknown = 0, + Connected, + Connecting, + Dialing, + Disconnected, + Disconnecting, + EarlyMedia, + Idle, + OnHold, + Ringing, + Preserved, + RemotePreserved, + } + + + public class CodecCallStatus + { + + /// + /// Takes the Cisco call type and converts to the matching enum + /// + /// + /// + public static eCodecCallStatus ConvertToStatusEnum(string s) + { + switch (s) + { + case "Connected": + { + return eCodecCallStatus.Connected; + } + case "Connecting": + { + return eCodecCallStatus.Connecting; + } + case "Dialling": + { + return eCodecCallStatus.Dialing; + } + case "Disconnected": + { + return eCodecCallStatus.Disconnected; + } + case "Disconnecting": + { + return eCodecCallStatus.Disconnecting; + } + case "EarlyMedia": + { + return eCodecCallStatus.EarlyMedia; + } + case "Idle": + { + return eCodecCallStatus.Idle; + } + case "OnHold": + { + return eCodecCallStatus.OnHold; + } + case "Ringing": + { + return eCodecCallStatus.Ringing; + } + case "Preserved": + { + return eCodecCallStatus.Preserved; + } + case "RemotePreserved": + { + return eCodecCallStatus.RemotePreserved; + } + default: + return eCodecCallStatus.Unknown; + } + + } + + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/eCodecCallType.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/eCodecCallType.cs new file mode 100644 index 00000000..829595bb --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/eCodecCallType.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +namespace PepperDash.Essentials.Core.Devices.Codec + +{ + public enum eCodecCallType + { + Unknown = 0, + Audio, + Video, + AudioCanEscalate, + ForwardAllCall + } + + public class CodecCallType + { + + /// + /// Takes the Cisco call type and converts to the matching enum + /// + /// + /// + public static eCodecCallType ConvertToTypeEnum(string s) + { + switch (s) + { + case "Audio": + { + return eCodecCallType.Audio; + } + case "Video": + { + return eCodecCallType.Video; + } + case "AudioCanEscalate": + { + return eCodecCallType.AudioCanEscalate; + } + case "ForwardAllCall": + { + return eCodecCallType.ForwardAllCall; + } + default: + return eCodecCallType.Unknown; + } + + } + + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/eMeetingPrivacy.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/eMeetingPrivacy.cs new file mode 100644 index 00000000..e687f7da --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/eMeetingPrivacy.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +namespace PepperDash.Essentials.Core.Devices.Codec +{ + public enum eMeetingPrivacy + { + Unknown = 0, + Public, + Private + } + + public class CodecCallPrivacy + { + /// + /// Takes the Cisco privacy type and converts to the matching enum + /// + /// + /// + public static eMeetingPrivacy ConvertToDirectionEnum(string s) + { + switch (s.ToLower()) + { + case "public": + { + return eMeetingPrivacy.Public; + } + case "private": + { + return eMeetingPrivacy.Private; + } + default: + return eMeetingPrivacy.Unknown; + } + + } + + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/iCodecAudio.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/iCodecAudio.cs new file mode 100644 index 00000000..4f4928bc --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/iCodecAudio.cs @@ -0,0 +1,10 @@ +namespace PepperDash.Essentials.Core.Devices.Codec +{ + /// + /// Defines minimum volume controls for a codec device with dialing capabilities + /// + public interface ICodecAudio : IBasicVolumeWithFeedback, IPrivacy + { + + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/iHasCallFavorites.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/iHasCallFavorites.cs new file mode 100644 index 00000000..6bf396c5 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/iHasCallFavorites.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; + +namespace PepperDash.Essentials.Core.Devices.Codec +{ + public interface IHasCallFavorites + { + CodecCallFavorites CallFavorites { get; } + } + + /// + /// Represents favorites entries for a codec device + /// + public class CodecCallFavorites + { + public List Favorites { get; set; } + + public CodecCallFavorites() + { + Favorites = new List(); + } + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/iHasCallHistory.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/iHasCallHistory.cs new file mode 100644 index 00000000..1a146d1a --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/iHasCallHistory.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace PepperDash.Essentials.Core.Devices.Codec +{ + public interface IHasCallHistory + { + CodecCallHistory CallHistory { get; } + + void RemoveCallHistoryEntry(CodecCallHistory.CallHistoryEntry entry); + } + + public enum eCodecOccurrenceType + { + Unknown = 0, + Placed, + Received, + NoAnswer + } + + /// + /// Represents the recent call history for a codec device + /// + public class CodecCallHistory + { + public event EventHandler RecentCallsListHasChanged; + + public List RecentCalls { get; private set; } + + /// + /// Item that gets added to the list when there are no recent calls in history + /// + readonly CallHistoryEntry _listEmptyEntry; + + public CallHistoryEntry ListEmptyEntry + { + get { return _listEmptyEntry; } + } + + public CodecCallHistory() + { + _listEmptyEntry = new CallHistoryEntry() { Name = "No Recent Calls" }; + + RecentCalls = new List {_listEmptyEntry}; + } + + private void OnRecentCallsListChange() + { + var handler = RecentCallsListHasChanged; + if (handler != null) + { + handler(this, new EventArgs()); + } + } + + public void RemoveEntry(CallHistoryEntry entry) + { + RecentCalls.Remove(entry); + OnRecentCallsListChange(); + } + + + + /// + /// Generic call history entry, not device specific + /// + public class CallHistoryEntry : CodecActiveCallItem + { + [JsonConverter(typeof (IsoDateTimeConverter))] + [JsonProperty("startTime")] + public DateTime StartTime { get; set; } + + [JsonConverter(typeof (StringEnumConverter))] + [JsonProperty("occurrenceType")] + public eCodecOccurrenceType OccurrenceType { get; set; } + + [JsonProperty("occurrenceHistoryId")] + public string OccurrenceHistoryId { get; set; } + } + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/iHasContentSharing.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/iHasContentSharing.cs new file mode 100644 index 00000000..4474a235 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/iHasContentSharing.cs @@ -0,0 +1,24 @@ +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.Core.Devices.Codec +{ + public interface IHasContentSharing + { + BoolFeedback SharingContentIsOnFeedback { get; } + StringFeedback SharingSourceFeedback { get; } + + bool AutoShareContentWhileInCall { get; } + + void StartSharing(); + void StopSharing(); + } + +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/iHasDialer.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/iHasDialer.cs new file mode 100644 index 00000000..8cff865d --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/iHasDialer.cs @@ -0,0 +1,24 @@ +using System; + +namespace PepperDash.Essentials.Core.Devices.Codec +{ + /// + /// Requirements for a device that has dialing capabilities + /// + public interface IHasDialer + { + // Add requirements for Dialer functionality + + event EventHandler CallStatusChange; + + void Dial(string number); + void EndCall(CodecActiveCallItem activeCall); + void EndAllCalls(); + void AcceptCall(CodecActiveCallItem item); + void RejectCall(CodecActiveCallItem item); + void SendDtmf(string digit); + + bool IsInCall { get; } + } + +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/iHasDirectory.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/iHasDirectory.cs new file mode 100644 index 00000000..5d322c19 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/iHasDirectory.cs @@ -0,0 +1,223 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using PepperDash.Essentials.Core.Devices.VideoCodec; + +namespace PepperDash.Essentials.Core.Devices.Codec +{ + /// + /// Defines the API for codecs with a directory + /// + public interface IHasDirectory + { + event EventHandler DirectoryResultReturned; + + CodecDirectory DirectoryRoot { get; } + + CodecDirectory CurrentDirectoryResult { get; } + + CodecPhonebookSyncState PhonebookSyncState { get; } + + void SearchDirectory(string searchString); + + void GetDirectoryFolderContents(string folderId); + + void SetCurrentDirectoryToRoot(); + + void GetDirectoryParentFolderContents(); + + BoolFeedback CurrentDirectoryResultIsNotDirectoryRoot { get; } + + /// + /// Tracks the directory browse history when browsing beyond the root directory + /// + List DirectoryBrowseHistory { get; } + } + + /// + /// + /// + public class DirectoryEventArgs : EventArgs + { + public CodecDirectory Directory { get; set; } + public bool DirectoryIsOnRoot { get; set; } + } + + /// + /// Represents a codec directory + /// + public class CodecDirectory + { + /// + /// Represents the contents of the directory + /// + [JsonProperty("directoryResults")] + public List CurrentDirectoryResults { get; private set; } + + /// + /// Used to store the ID of the current folder for CurrentDirectoryResults + /// + [JsonProperty("resultsFolderId")] + public string ResultsFolderId { get; set; } + + public CodecDirectory() + { + CurrentDirectoryResults = new List(); + } + + /// + /// Adds folders to the directory + /// + /// + public void AddFoldersToDirectory(List folders) + { + if(folders != null) + CurrentDirectoryResults.AddRange(folders); + + SortDirectory(); + } + + /// + /// Adds contacts to the directory + /// + /// + public void AddContactsToDirectory(List contacts) + { + if(contacts != null) + CurrentDirectoryResults.AddRange(contacts); + + SortDirectory(); + } + + /// + /// Sorts the DirectoryResults list to display all folders alphabetically, then all contacts alphabetically + /// + private void SortDirectory() + { + var sortedFolders = new List(); + + sortedFolders.AddRange(CurrentDirectoryResults.Where(f => f is DirectoryFolder)); + + sortedFolders.OrderBy(f => f.Name); + + var sortedContacts = new List(); + + sortedContacts.AddRange(CurrentDirectoryResults.Where(c => c is DirectoryContact)); + + sortedFolders.OrderBy(c => c.Name); + + CurrentDirectoryResults.Clear(); + + CurrentDirectoryResults.AddRange(sortedFolders); + + CurrentDirectoryResults.AddRange(sortedContacts); + } + + } + + /// + /// Used to decorate a contact to indicate it can be invided to a meeting + /// + public interface IInvitableContact + { + + } + + /// + /// Represents an item in the directory + /// + public class DirectoryItem : ICloneable + { + public object Clone() + { + return this.MemberwiseClone(); + } + + [JsonProperty("folderId")] + public string FolderId { get; set; } + + [JsonProperty("name")] + public string Name { get; set; } + } + + /// + /// Represents a folder type DirectoryItem + /// + public class DirectoryFolder : DirectoryItem + { + [JsonProperty("contacts")] + public List Contacts { get; set; } + + [JsonProperty("parentFolderId")] + public string ParentFolderId { get; set; } + + public DirectoryFolder() + { + Contacts = new List(); + } + } + + /// + /// Represents a contact type DirectoryItem + /// + public class DirectoryContact : DirectoryItem + { + [JsonProperty("contactId")] + public string ContactId { get; set; } + + [JsonProperty("title")] + public string Title { get; set; } + + [JsonProperty("contactMethods")] + public List ContactMethods { get; set; } + + public DirectoryContact() + { + ContactMethods = new List(); + } + } + + /// + /// Represents a method of contact for a contact + /// + public class ContactMethod + { + [JsonProperty("contactMethodId")] + public string ContactMethodId { get; set; } + + [JsonProperty("number")] + public string Number { get; set; } + + [JsonProperty("device")] + [JsonConverter(typeof(StringEnumConverter))] + public eContactMethodDevice Device { get; set; } + + [JsonProperty("callType")] + [JsonConverter(typeof(StringEnumConverter))] + public eContactMethodCallType CallType { get; set; } + } + + /// + /// + /// + public enum eContactMethodDevice + { + Unknown = 0, + Mobile, + Other, + Telephone, + Video + } + + /// + /// + /// + public enum eContactMethodCallType + { + Unknown = 0, + Audio, + Video + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/iHasScheduleAwareness.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/iHasScheduleAwareness.cs new file mode 100644 index 00000000..c1e5a01e --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/Codec/iHasScheduleAwareness.cs @@ -0,0 +1,165 @@ +using System; +using System.Collections.Generic; +using Crestron.SimplSharp; + +namespace PepperDash.Essentials.Core.Devices.Codec +{ + public enum eMeetingEventChangeType + { + Unkown = 0, + MeetingStartWarning, + MeetingStart, + MeetingEndWarning, + MeetingEnd + } + + public interface IHasScheduleAwareness + { + CodecScheduleAwareness CodecSchedule { get; } + + void GetSchedule(); + } + + public class CodecScheduleAwareness + { + List _Meetings; + + public event EventHandler MeetingEventChange; + + public event EventHandler MeetingsListHasChanged; + + /// + /// Setter triggers MeetingsListHasChanged event + /// + public List Meetings + { + get + { + return _Meetings; + } + set + { + _Meetings = value; + + var handler = MeetingsListHasChanged; + if (handler != null) + { + handler(this, new EventArgs()); + } + } + } + + private CTimer ScheduleChecker; + + public CodecScheduleAwareness() + { + Meetings = new List(); + + ScheduleChecker = new CTimer(CheckSchedule, null, 1000, 1000); + } + + private void OnMeetingChange(eMeetingEventChangeType changeType, Meeting meeting) + { + var handler = MeetingEventChange; + if (handler != null) + { + handler(this, new MeetingEventArgs() { ChangeType = changeType, Meeting = meeting }); + } + } + + private void CheckSchedule(object o) + { + // Iterate the meeting list and check if any meeting need to do anythingk + + const double meetingTimeEpsilon = 0.0001; + foreach (Meeting m in Meetings) + { + eMeetingEventChangeType changeType = eMeetingEventChangeType.Unkown; + + if (m.TimeToMeetingStart.TotalMinutes <= m.MeetingWarningMinutes.TotalMinutes) // Meeting is about to start + changeType = eMeetingEventChangeType.MeetingStartWarning; + else if (Math.Abs(m.TimeToMeetingStart.TotalMinutes) < meetingTimeEpsilon) // Meeting Start + changeType = eMeetingEventChangeType.MeetingStart; + else if (m.TimeToMeetingEnd.TotalMinutes <= m.MeetingWarningMinutes.TotalMinutes) // Meeting is about to end + changeType = eMeetingEventChangeType.MeetingEndWarning; + else if (Math.Abs(m.TimeToMeetingEnd.TotalMinutes) < meetingTimeEpsilon) // Meeting has ended + changeType = eMeetingEventChangeType.MeetingEnd; + + if (changeType != eMeetingEventChangeType.Unkown) + OnMeetingChange(changeType, m); + } + + + } + } + + /// + /// Generic class to represent a meeting (Cisco or Polycom OBTP or Fusion) + /// + public class Meeting + { + public TimeSpan MeetingWarningMinutes = TimeSpan.FromMinutes(5); + + public string Id { get; set; } + public string Organizer { get; set; } + public string Title { get; set; } + public string Agenda { get; set; } + public TimeSpan TimeToMeetingStart + { + get + { + return StartTime - DateTime.Now; + } + } + public TimeSpan TimeToMeetingEnd + { + get + { + return EndTime - DateTime.Now; + } + } + public DateTime StartTime { get; set; } + public DateTime EndTime { get; set; } + public TimeSpan Duration + { + get + { + return EndTime - StartTime; + } + } + public eMeetingPrivacy Privacy { get; set; } + public bool Joinable + { + get + { + return StartTime.AddMinutes(-5) <= DateTime.Now + && DateTime.Now <= EndTime; //.AddMinutes(-5); + } + } + //public string ConferenceNumberToDial { get; set; } + public string ConferencePassword { get; set; } + public bool IsOneButtonToPushMeeting { get; set; } + + public List Calls { get; private set; } + + public Meeting() + { + Calls = new List(); + } + } + + public class Call + { + public string Number { get; set; } + public string Protocol { get; set; } + public string CallRate { get; set; } + public string CallType { get; set; } + } + + public class MeetingEventArgs : EventArgs + { + public eMeetingEventChangeType ChangeType { get; set; } + public Meeting Meeting { get; set; } + } + +} diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IAudioCodecInfo.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IAudioCodecInfo.cs new file mode 100644 index 00000000..58c61999 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IAudioCodecInfo.cs @@ -0,0 +1,18 @@ +namespace PepperDash.Essentials.Core.Devices.AudioCodec +{ + /// + /// Implements a common set of data about a codec + /// + public interface IAudioCodecInfo + { + AudioCodecInfo CodecInfo { get; } + } + + /// + /// Stores general information about a codec + /// + public abstract class AudioCodecInfo + { + public abstract string PhoneNumber { get; set; } + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IHasAudioCodec.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IHasAudioCodec.cs new file mode 100644 index 00000000..98f5844e --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IHasAudioCodec.cs @@ -0,0 +1,18 @@ +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Devices.Core.AudioCodec +{ + /// + /// For rooms that have audio codec + /// + public interface IHasAudioCodec + { + AudioCodecBase AudioCodec { get; } + BoolFeedback InCallFeedback { get; } + + ///// + ///// Make this more specific + ///// + //List ActiveCalls { get; } + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IHasCodecLayouts.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IHasCodecLayouts.cs new file mode 100644 index 00000000..7ee32d87 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IHasCodecLayouts.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Devices.Core.VideoCodec +{ + /// + /// Defines the required elements for layout control + /// + public interface IHasCodecLayouts + { + StringFeedback LocalLayoutFeedback { get; } + + void LocalLayoutToggle(); + void LocalLayoutToggleSingleProminent(); + void MinMaxLayoutToggle(); + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IHasCodecSelfview.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IHasCodecSelfview.cs new file mode 100644 index 00000000..abb19368 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IHasCodecSelfview.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Devices.Core.VideoCodec +{ + /// + /// Defines the requred elements for selfview control + /// + public interface IHasCodecSelfView + { + BoolFeedback SelfviewIsOnFeedback { get; } + + bool ShowSelfViewByDefault { get; } + + void SelfViewModeOn(); + + void SelfViewModeOff(); + + void SelfViewModeToggle(); + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IHasVideoCodec.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IHasVideoCodec.cs new file mode 100644 index 00000000..3895b9eb --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IHasVideoCodec.cs @@ -0,0 +1,32 @@ +namespace PepperDash.Essentials.Core.Devices.VideoCodec +{ + /// + /// For rooms that have video codec + /// + public interface IHasVideoCodec + { + VideoCodecBase VideoCodec { get; } + BoolFeedback InCallFeedback { get; } + + ///// + ///// Make this more specific + ///// + //List ActiveCalls { get; } + + /// + /// States: 0 for on hook, 1 for video, 2 for audio, 3 for telekenesis + /// + IntFeedback CallTypeFeedback { get; } + + /// + /// + /// + BoolFeedback PrivacyModeIsOnFeedback { get; } + + /// + /// When something in the room is sharing with the far end or through other means + /// + BoolFeedback IsSharingFeedback { get; } + + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/iVideoCodecInfo.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/iVideoCodecInfo.cs new file mode 100644 index 00000000..d7090212 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/iVideoCodecInfo.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +namespace PepperDash.Essentials.Core.Devices.Codec +{ + /// + /// Implements a common set of data about a codec + /// + public interface iVideoCodecInfo + { + VideoCodecInfo CodecInfo { get; } + } + + /// + /// Stores general information about a codec + /// + public abstract class VideoCodecInfo + { + public abstract bool MultiSiteOptionIsEnabled { get; } + public abstract string IpAddress { get; } + public abstract string SipPhoneNumber { get; } + public abstract string E164Alias { get; } + public abstract string H323Id { get; } + public abstract string SipUri { get; } + public abstract bool AutoAnswerEnabled { get; } + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/VideoCodecBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/VideoCodecBase.cs new file mode 100644 index 00000000..e7053320 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/VideoCodecBase.cs @@ -0,0 +1,323 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using PepperDash.Core; +using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Core.Routing; +using PepperDash.Essentials.Core.Devices.Codec; + +namespace PepperDash.Essentials.Core.Devices.VideoCodec +{ + public abstract class VideoCodecBase : ReconfigurableDevice, IRoutingInputsOutputs, + IUsageTracking, IHasDialer, IHasContentSharing, ICodecAudio, iVideoCodecInfo + { + /// + /// Fires when the status of any active, dialing, or incoming call changes or is new + /// + public event EventHandler CallStatusChange; + + public event EventHandler IsReadyChange; + + public IBasicCommunication Communication { get; protected set; } + + #region IUsageTracking Members + + /// + /// This object can be added by outside users of this class to provide usage tracking + /// for various services + /// + public UsageTracking UsageTracker { get; set; } + + #endregion + + /// + /// An internal pseudo-source that is routable and connected to the osd input + /// + public DummyRoutingInputsDevice OsdSource { get; protected set; } + + public RoutingPortCollection InputPorts { get; private set; } + + public RoutingPortCollection OutputPorts { get; private set; } + + /// + /// Returns true when any call is not in state Unknown, Disconnecting, Disconnected + /// + public bool IsInCall + { + get + { + bool value; + + if (ActiveCalls != null) + value = ActiveCalls.Any(c => c.IsActiveCall); + else + value = false; + return value; + } + } + + public BoolFeedback StandbyIsOnFeedback { get; private set; } + + abstract protected Func PrivacyModeIsOnFeedbackFunc { get; } + abstract protected Func VolumeLevelFeedbackFunc { get; } + abstract protected Func MuteFeedbackFunc { get; } + abstract protected Func StandbyIsOnFeedbackFunc { get; } + + public List ActiveCalls { get; set; } + + public VideoCodecInfo CodecInfo { get; protected set; } + + public bool ShowSelfViewByDefault { get; protected set; } + + + public bool IsReady { get; protected set; } + + public VideoCodecBase(DeviceConfig config) + : base(config) + { + StandbyIsOnFeedback = new BoolFeedback(StandbyIsOnFeedbackFunc); + PrivacyModeIsOnFeedback = new BoolFeedback(PrivacyModeIsOnFeedbackFunc); + VolumeLevelFeedback = new IntFeedback(VolumeLevelFeedbackFunc); + MuteFeedback = new BoolFeedback(MuteFeedbackFunc); + SharingSourceFeedback = new StringFeedback(SharingSourceFeedbackFunc); + SharingContentIsOnFeedback = new BoolFeedback(SharingContentIsOnFeedbackFunc); + + InputPorts = new RoutingPortCollection(); + OutputPorts = new RoutingPortCollection(); + + ActiveCalls = new List(); + } + + #region IHasDialer Members + + public abstract void Dial(string number); + public abstract void Dial(Meeting meeting); + public virtual void Dial(IInvitableContact contact) + { + + } + public abstract void EndCall(CodecActiveCallItem call); + public abstract void EndAllCalls(); + public abstract void AcceptCall(CodecActiveCallItem call); + public abstract void RejectCall(CodecActiveCallItem call); + public abstract void SendDtmf(string s); + + #endregion + + public virtual List Feedbacks + { + get + { + return new List + { + PrivacyModeIsOnFeedback, + SharingSourceFeedback + }; + } + } + + public abstract void ExecuteSwitch(object selector); + + /// + /// Helper method to fire CallStatusChange event with old and new status + /// + protected void SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus newStatus, CodecActiveCallItem call) + { + call.Status = newStatus; + + OnCallStatusChange(call); + + } + + /// + /// + /// + /// + /// + /// + protected void OnCallStatusChange(CodecActiveCallItem item) + { + var handler = CallStatusChange; + if (handler != null) + handler(this, new CodecCallStatusItemChangeEventArgs(item)); + + if (AutoShareContentWhileInCall) + StartSharing(); + + if (UsageTracker != null) + { + if (IsInCall && !UsageTracker.UsageTrackingStarted) + UsageTracker.StartDeviceUsage(); + else if (UsageTracker.UsageTrackingStarted && !IsInCall) + UsageTracker.EndDeviceUsage(); + } + } + + /// + /// Sets IsReady property and fires the event. Used for dependent classes to sync up their data. + /// + protected void SetIsReady() + { + IsReady = true; + var h = IsReadyChange; + if(h != null) + h(this, new EventArgs()); + } + + #region ICodecAudio Members + + public abstract void PrivacyModeOn(); + public abstract void PrivacyModeOff(); + public abstract void PrivacyModeToggle(); + public BoolFeedback PrivacyModeIsOnFeedback { get; private set; } + + + public BoolFeedback MuteFeedback { get; private set; } + + public abstract void MuteOff(); + + public abstract void MuteOn(); + + public abstract void SetVolume(ushort level); + + public IntFeedback VolumeLevelFeedback { get; private set; } + + public abstract void MuteToggle(); + + public abstract void VolumeDown(bool pressRelease); + + + public abstract void VolumeUp(bool pressRelease); + + #endregion + + #region IHasSharing Members + + public abstract void StartSharing(); + public abstract void StopSharing(); + + public bool AutoShareContentWhileInCall { get; protected set; } + + public StringFeedback SharingSourceFeedback { get; private set; } + public BoolFeedback SharingContentIsOnFeedback { get; private set; } + + abstract protected Func SharingSourceFeedbackFunc { get; } + abstract protected Func SharingContentIsOnFeedbackFunc { get; } + + + #endregion + + // **** DEBUGGING THINGS **** + /// + /// + /// + public virtual void ListCalls() + { + var sb = new StringBuilder(); + foreach (var c in ActiveCalls) + sb.AppendFormat("{0} {1} -- {2} {3}\n", c.Id, c.Number, c.Name, c.Status); + Debug.Console(1, this, "\n{0}\n", sb.ToString()); + } + + public abstract void StandbyActivate(); + + public abstract void StandbyDeactivate(); + + } + + + /// + /// Used to track the status of syncronizing the phonebook values when connecting to a codec or refreshing the phonebook info + /// + public class CodecPhonebookSyncState : IKeyed + { + bool _InitialSyncComplete; + + public event EventHandler InitialSyncCompleted; + + 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 InitialPhonebookFoldersWasReceived { get; private set; } + + public bool NumberOfContactsWasReceived { get; private set; } + + public bool PhonebookRootEntriesWasRecieved { get; private set; } + + public bool PhonebookHasFolders { get; private set; } + + public int NumberOfContacts { get; private set; } + + public CodecPhonebookSyncState(string key) + { + Key = key; + + CodecDisconnected(); + } + + public void InitialPhonebookFoldersReceived() + { + InitialPhonebookFoldersWasReceived = true; + + CheckSyncStatus(); + } + + public void PhonebookRootEntriesReceived() + { + PhonebookRootEntriesWasRecieved = true; + + CheckSyncStatus(); + } + + public void SetPhonebookHasFolders(bool value) + { + PhonebookHasFolders = value; + + Debug.Console(1, this, "Phonebook has folders: {0}", PhonebookHasFolders); + } + + public void SetNumberOfContacts(int contacts) + { + NumberOfContacts = contacts; + NumberOfContactsWasReceived = true; + + Debug.Console(1, this, "Phonebook contains {0} contacts.", NumberOfContacts); + + CheckSyncStatus(); + } + + public void CodecDisconnected() + { + InitialPhonebookFoldersWasReceived = false; + PhonebookHasFolders = false; + NumberOfContacts = 0; + NumberOfContactsWasReceived = false; + } + + void CheckSyncStatus() + { + if (InitialPhonebookFoldersWasReceived && NumberOfContactsWasReceived && PhonebookRootEntriesWasRecieved) + { + InitialSyncComplete = true; + Debug.Console(1, this, "Initial Phonebook Sync Complete!"); + } + else + InitialSyncComplete = false; + } + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj index bd5e23e8..e2497f64 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -190,7 +190,26 @@ + + + + + + + + + + + + + + + + + + + @@ -256,6 +275,7 @@ + diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Config/EssentialsHuddleVtc1PropertiesConfig.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Config/EssentialsHuddleVtc1PropertiesConfig.cs index 7d9bfa5b..f51fc2e1 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Config/EssentialsHuddleVtc1PropertiesConfig.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Config/EssentialsHuddleVtc1PropertiesConfig.cs @@ -1,12 +1,12 @@ using Newtonsoft.Json; -using PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.Core.Rooms.Config { - - public class EssentialsHuddleVtc1PropertiesConfig : EssentialsConferenceRoomPropertiesConfig + public class EssentialsHuddleVtc1PropertiesConfig : EssentialsHuddleRoomPropertiesConfig { - [JsonProperty("defaultDisplayKey")] - public string DefaultDisplayKey { get; set; } + [JsonProperty("videoCodecKey")] + public string VideoCodecKey { get; set; } + [JsonProperty("audioCodecKey")] + public string AudioCodecKey { get; set; } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Config/EssentialsRoomConfig.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Config/EssentialsRoomConfig.cs index 4fb046fb..d2d011d3 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Config/EssentialsRoomConfig.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Config/EssentialsRoomConfig.cs @@ -4,6 +4,7 @@ using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Core.Privacy; namespace PepperDash.Essentials.Core.Rooms.Config { @@ -16,30 +17,32 @@ namespace PepperDash.Essentials.Core.Rooms.Config public static Device GetRoomObject(DeviceConfig roomConfig) { var typeName = roomConfig.Type.ToLower(); + + EssentialsRoomBase rm; if (typeName == "huddle") { var huddle = new EssentialsHuddleSpaceRoom(roomConfig); return huddle; } - else if (typeName == "huddlevtc1") - { - var rm = new EssentialsHuddleVtc1Room(roomConfig); + if (typeName == "huddlevtc1") + { + rm = new EssentialsHuddleVtc1Room(roomConfig); - return rm; - } - else if (typeName == "ddvc01Bridge") - { - return new Device(roomConfig.Key, roomConfig.Name); // placeholder device that does nothing. - } - else if (typeName == "dualdisplay") - { - var rm = new EssentialsDualDisplayRoom(roomConfig); + return rm; + } + if (typeName == "ddvc01Bridge") + { + return new Device(roomConfig.Key, roomConfig.Name); // placeholder device that does nothing. + } + if (typeName != "dualdisplay") + { + return null; + } - return rm; - } + rm = new EssentialsDualDisplayRoom(roomConfig); - return null; + return rm; } /// @@ -50,12 +53,14 @@ namespace PepperDash.Essentials.Core.Rooms.Config { // This emergency var emergency = props.Emergency; - if (emergency != null) + + 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; } + //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; } @@ -65,7 +70,7 @@ namespace PepperDash.Essentials.Core.Rooms.Config /// /// /// - public static Core.Privacy.MicrophonePrivacyController GetMicrophonePrivacy( + public static MicrophonePrivacyController GetMicrophonePrivacy( EssentialsRoomPropertiesConfig props, IPrivacy room) { var microphonePrivacy = props.MicrophonePrivacy; @@ -76,7 +81,7 @@ namespace PepperDash.Essentials.Core.Rooms.Config } // Get the MicrophonePrivacy device from the device manager var mP = (DeviceManager.GetDeviceForKey(props.MicrophonePrivacy.DeviceKey) as - Core.Privacy.MicrophonePrivacyController); + MicrophonePrivacyController); // Set this room as the IPrivacy device if (mP == null) { @@ -92,33 +97,38 @@ namespace PepperDash.Essentials.Core.Rooms.Config Debug.Console(0, "WARNING: No behaviour defined for MicrophonePrivacyController"); return null; } - if (behaviour == "trackroomstate") + switch (behaviour) { - // Tie LED enable to room power state - var essRoom = room as EssentialsRoomBase; - essRoom.OnFeedback.OutputChange += (o, a) => - { - if (essRoom.OnFeedback.BoolValue) - mP.EnableLeds = true; - else - mP.EnableLeds = false; - }; + case "trackroomstate": + { + // Tie LED enable to room power state + var essRoom = room as EssentialsRoomBase; + if (essRoom != null) + { + essRoom.OnFeedback.OutputChange += (o, a) => + { + mP.EnableLeds = essRoom.OnFeedback.BoolValue; + }; - 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 = essRoom.OnFeedback.BoolValue; + } + } + break; + case "trackcallstate": + { + // Tie LED enable to room power state + var inCallRoom = room as IHasInCallFeedback; + if (inCallRoom != null) + { + inCallRoom.InCallFeedback.OutputChange += (o, a) => + { + mP.EnableLeds = inCallRoom.InCallFeedback.BoolValue; + }; - mP.EnableLeds = inCallRoom.InCallFeedback.BoolValue; + mP.EnableLeds = inCallRoom.InCallFeedback.BoolValue; + } + } + break; } return mP; @@ -177,25 +187,6 @@ namespace PepperDash.Essentials.Core.Rooms.Config public bool ZeroVolumeWhenSwtichingVolumeDevices { get; set; } } - public class EssentialsAvRoomPropertiesConfig : EssentialsRoomPropertiesConfig - { - [JsonProperty("defaultAudioKey")] - public string DefaultAudioKey { get; set; } - [JsonProperty("sourceListKey")] - public string SourceListKey { get; set; } - [JsonProperty("defaultSourceItem")] - public string DefaultSourceItem { 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; } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Config/EssentialsVolumeLevelConfig.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Config/EssentialsVolumeLevelConfig.cs new file mode 100644 index 00000000..fa2ebc5b --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Config/EssentialsVolumeLevelConfig.cs @@ -0,0 +1,64 @@ +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; } + + /* + /// + /// Helper to get the device associated with key - one timer. + /// + public IBasicVolumeWithFeedback GetDevice() + { + // DM output card format: deviceKey--output~number, dm8x8-1--output~4 + var match = Regex.Match(DeviceKey, @"([-_\w]+)--(\w+)~(\d+)"); + if (match.Success) + { + var devKey = match.Groups[1].Value; + var chassis = DeviceManager.GetDeviceForKey(devKey) as DmChassisController; + if (chassis != null) + { + var outputNum = Convert.ToUInt32(match.Groups[3].Value); + if (chassis.VolumeControls.ContainsKey(outputNum)) // should always... + return chassis.VolumeControls[outputNum]; + } + // No volume for some reason. We have failed as developers + return null; + } + + // DSP format: deviceKey--levelName, biampTesira-1--master + match = Regex.Match(DeviceKey, @"([-_\w]+)--(.+)"); + if (match.Success) + { + var devKey = match.Groups[1].Value; + var dsp = DeviceManager.GetDeviceForKey(devKey) as BiampTesiraForteDsp; + if (dsp != null) + { + var levelTag = match.Groups[2].Value; + if (dsp.LevelControlPoints.ContainsKey(levelTag)) // should always... + return dsp.LevelControlPoints[levelTag]; + } + // No volume for some reason. We have failed as developers + return null; + } + + return null; + }*/ + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Interfaces.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Interfaces.cs index 1743bdaa..d24be4e7 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Interfaces.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Interfaces.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; -namespace PepperDash.Essentials.Core +namespace PepperDash.Essentials.Core.Rooms { /// /// For rooms with in call feedback diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Types/EssentialsDualDisplayRoom.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Types/EssentialsDualDisplayRoom.cs index a267c30a..92422f22 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Types/EssentialsDualDisplayRoom.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Types/EssentialsDualDisplayRoom.cs @@ -8,7 +8,7 @@ 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.Core.Devices.Codec; using PepperDash.Essentials.Devices.Common.VideoCodec; using PepperDash.Essentials.Devices.Common.AudioCodec; diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Types/EssentialsHuddleVtc1Room.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Types/EssentialsHuddleVtc1Room.cs index 6f91053b..7fbe8c2a 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Types/EssentialsHuddleVtc1Room.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Types/EssentialsHuddleVtc1Room.cs @@ -7,10 +7,8 @@ using 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.Rooms; +using PepperDash.Essentials.Core.Rooms.Config; namespace PepperDash.Essentials { @@ -50,56 +48,16 @@ namespace PepperDash.Essentials 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; } + private string _lastSourceKey; - /// - /// 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); - } - } - private SourceListItem _currentSourceInfo; - - public string CurrentSourceInfoKey { get; set; } /// /// "codecOsd" diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/AudioCodec/MockAC/MockAC.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/AudioCodec/MockAC/MockAC.cs index 84880654..a610b729 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/AudioCodec/MockAC/MockAC.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/AudioCodec/MockAC/MockAC.cs @@ -7,7 +7,7 @@ using Crestron.SimplSharp; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Devices.Common.Codec; +using PepperDash.Essentials.Core.Devices.Codec; namespace PepperDash.Essentials.Devices.Common.AudioCodec { diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraBase.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraBase.cs index 35d696c7..f8c06556 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraBase.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraBase.cs @@ -10,7 +10,7 @@ using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Presets; -using PepperDash.Essentials.Devices.Common.Codec; +using PepperDash.Essentials.Core.Devices.Codec; using Newtonsoft.Json; diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraVisca.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraVisca.cs index 4393229c..3b8c2f80 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraVisca.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraVisca.cs @@ -8,7 +8,7 @@ using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Devices.Common.Codec; +using PepperDash.Essentials.Core.Devices.Codec; using System.Text.RegularExpressions; using Crestron.SimplSharp.Reflection; diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs index 75c4fc1a..f873b4cd 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs @@ -7,7 +7,7 @@ using Crestron.SimplSharp; using Newtonsoft.Json; using Newtonsoft.Json.Converters; -namespace PepperDash.Essentials.Devices.Common.Codec +namespace PepperDash.Essentials.Core.Devices.Codec { public class CodecActiveCallItem diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallDirection.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallDirection.cs index a5e118df..54d763d3 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallDirection.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallDirection.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; -namespace PepperDash.Essentials.Devices.Common.Codec +namespace PepperDash.Essentials.Core.Devices.Codec { public enum eCodecCallDirection diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallStatus.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallStatus.cs index 610d928b..99481814 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallStatus.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallStatus.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; -namespace PepperDash.Essentials.Devices.Common.Codec +namespace PepperDash.Essentials.Core.Devices.Codec { public enum eCodecCallStatus { diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallType.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallType.cs index dbab015b..829595bb 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallType.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallType.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; -namespace PepperDash.Essentials.Devices.Common.Codec +namespace PepperDash.Essentials.Core.Devices.Codec { public enum eCodecCallType diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/eMeetingPrivacy.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/eMeetingPrivacy.cs index f163a864..e687f7da 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/eMeetingPrivacy.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/eMeetingPrivacy.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; -namespace PepperDash.Essentials.Devices.Common.Codec +namespace PepperDash.Essentials.Core.Devices.Codec { public enum eMeetingPrivacy { diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/iHasDialer.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/iHasDialer.cs index bce2dee3..8ece4915 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/iHasDialer.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/iHasDialer.cs @@ -1,12 +1,7 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; +using PepperDash.Essentials.Devices.Common.Codec; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Devices.Common.Codec +namespace PepperDash.Essentials.Devices.Core.Codec { /// /// Requirements for a device that has dialing capabilities diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/DSP/DspBase.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/DSP/DspBase.cs index cad57761..b9ae6619 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/DSP/DspBase.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/DSP/DspBase.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; -using PepperDash.Essentials.Devices.Common.Codec; +using PepperDash.Essentials.Core.Devices.Codec; using PepperDash.Core; using PepperDash.Essentials.Core; diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj index ba12a129..c54635fc 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj @@ -99,9 +99,6 @@ - - - @@ -111,7 +108,6 @@ - @@ -125,13 +121,6 @@ - - - - - - - @@ -164,7 +153,6 @@ - @@ -173,11 +161,8 @@ - - - diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/BookingsDataClasses.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/BookingsDataClasses.cs index cf4d8530..b0c7ceb5 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/BookingsDataClasses.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/BookingsDataClasses.cs @@ -5,7 +5,7 @@ using System.Text; using Crestron.SimplSharp; using PepperDash.Core; -using PepperDash.Essentials.Devices.Common.Codec; +using PepperDash.Essentials.Core.Devices.Codec; namespace PepperDash.Essentials.Devices.Common.VideoCodec { @@ -352,7 +352,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec { foreach (Call c in b.DialInfo.Calls.Call) { - meeting.Calls.Add(new PepperDash.Essentials.Devices.Common.Codec.Call() + meeting.Calls.Add(new Essentials.Core.Devices.Codec.Call() { Number = c.Number.Value, Protocol = c.Protocol.Value, diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs index cad7a18c..696d594a 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs @@ -10,11 +10,11 @@ using Newtonsoft.Json.Linq; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Core.Devices.VideoCodec; using PepperDash.Essentials.Core.Routing; using PepperDash.Essentials.Devices.Common.Cameras; -using PepperDash.Essentials.Devices.Common.Codec; -using PepperDash.Essentials.Devices.Common.Occupancy; -using PepperDash.Essentials.Devices.Common.VideoCodec; +using PepperDash.Essentials.Core.Devices.Codec; +using PepperDash.Essentials.Devices.Core.VideoCodec; namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco { @@ -283,7 +283,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco { - var props = JsonConvert.DeserializeObject(config.Properties.ToString()); + var props = JsonConvert.DeserializeObject(config.Properties.ToString()); RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc); PeopleCountFeedback = new IntFeedback(PeopleCountFeedbackFunc); @@ -395,6 +395,35 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco TieLineCollection.Default.Add(tl); } + /// + /// Converts a list of call history entries returned by a Cisco codec to the generic list type + /// + /// + /// + public List ConvertCiscoCallHistoryToGeneric(List entries) + { + var genericEntries = new List(); + + foreach (CiscoCallHistory.Entry entry in entries) + { + + genericEntries.Add(new CodecCallHistory.CallHistoryEntry() + { + Name = entry.DisplayName.Value, + Number = entry.CallbackNumber.Value, + StartTime = entry.LastOccurrenceStartTime.Value, + OccurrenceHistoryId = entry.LastOccurrenceHistoryId.Value, + OccurrenceType = ConvertToOccurenceTypeEnum(entry.OccurrenceType.Value) + }); + } + + // Check if list is empty and if so, add an item to display No Recent Calls + if (genericEntries.Count == 0) + genericEntries.Add(CallHistory.ListEmptyEntry); + + return genericEntries; + } + /// /// Starts the HTTP feedback server and syncronizes state of codec /// @@ -436,6 +465,31 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco return base.CustomActivate(); } + /// + /// Takes the Cisco occurence type and converts it to the matching enum + /// + /// + public eCodecOccurrenceType ConvertToOccurenceTypeEnum(string s) + { + switch (s) + { + case "Placed": + { + return eCodecOccurrenceType.Placed; + } + case "Received": + { + return eCodecOccurrenceType.Received; + } + case "NoAnswer": + { + return eCodecOccurrenceType.NoAnswer; + } + default: + return eCodecOccurrenceType.Unknown; + } + } + /// /// Fires when initial codec sync is completed. Used to then send commands to get call history, phonebook, bookings, etc. /// @@ -1841,6 +1895,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco else InitialSyncComplete = false; } + + } public class CiscoSparkCodecFactory : EssentialsDeviceFactory diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodecPropertiesConfig.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodecPropertiesConfig.cs index 33cda37c..18bce91e 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodecPropertiesConfig.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodecPropertiesConfig.cs @@ -7,7 +7,7 @@ using Crestron.SimplSharp; using PepperDash.Core; using PepperDash.Essentials.Core; -namespace PepperDash.Essentials.Devices.Common.Codec +namespace PepperDash.Essentials.Core.Devices.Codec { public class CiscoSparkCodecPropertiesConfig { diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/PhonebookDataClasses.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/PhonebookDataClasses.cs index c88261f5..7327a650 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/PhonebookDataClasses.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/PhonebookDataClasses.cs @@ -5,7 +5,7 @@ using System.Text; using Crestron.SimplSharp; using PepperDash.Core; -using PepperDash.Essentials.Devices.Common.Codec; +using PepperDash.Essentials.Core.Devices.Codec; namespace PepperDash.Essentials.Devices.Common.VideoCodec { @@ -240,7 +240,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec foreach (ContactMethod m in c.ContactMethod) { - var tempContactMethod = new PepperDash.Essentials.Devices.Common.Codec.ContactMethod(); + var tempContactMethod = new Essentials.Core.Devices.Codec.ContactMethod(); eContactMethodCallType callType = eContactMethodCallType.Unknown; if (!string.IsNullOrEmpty(m.CallType.Value)) @@ -299,11 +299,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec /// public static CodecDirectory ConvertCiscoPhonebookToGeneric(PhonebookSearchResult result) { - var directory = new Codec.CodecDirectory(); + var directory = new Essentials.Core.Devices.Codec.CodecDirectory(); - var folders = new List(); + var folders = new List(); - var contacts = new List(); + var contacts = new List(); try { @@ -370,7 +370,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec device = eContactMethodDevice.Other; } - contact.ContactMethods.Add(new PepperDash.Essentials.Devices.Common.Codec.ContactMethod() + contact.ContactMethods.Add(new Essentials.Core.Devices.Codec.ContactMethod() { Number = m.Number.Value, ContactMethodId = m.ContactMethodId.Value, diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockCodecDirectory.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockCodecDirectory.cs index 41b70661..6d24c8f3 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockCodecDirectory.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockCodecDirectory.cs @@ -6,7 +6,7 @@ using Crestron.SimplSharp; using PepperDash.Core; using PepperDash.Essentials.Core; -using PepperDash.Essentials.Devices.Common.Codec; +using PepperDash.Essentials.Core.Devices.Codec; namespace PepperDash.Essentials.Devices.Common.VideoCodec diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVC.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVC.cs index dc32ecd8..9b718c96 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVC.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVC.cs @@ -8,7 +8,7 @@ using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Routing; -using PepperDash.Essentials.Devices.Common.Codec; +using PepperDash.Essentials.Core.Devices.Codec; using PepperDash.Essentials.Devices.Common.Cameras; using Newtonsoft.Json; diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVcPropertiesConfig.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVcPropertiesConfig.cs index 6a790af6..7f2e0dc6 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVcPropertiesConfig.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVcPropertiesConfig.cs @@ -7,7 +7,7 @@ using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core; -using PepperDash.Essentials.Devices.Common.Codec; +using PepperDash.Essentials.Core.Devices.Codec; namespace PepperDash.Essentials.Devices.Common.VideoCodec { diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ResponseObjects.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ResponseObjects.cs index c603ca08..83a12cc5 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ResponseObjects.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ResponseObjects.cs @@ -7,7 +7,7 @@ using System.Runtime.CompilerServices; using Crestron.SimplSharp; using PepperDash.Core; -using PepperDash.Essentials.Devices.Common.Codec; +using PepperDash.Essentials.Core.Devices.Codec; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -255,9 +255,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom /// public static CodecDirectory ConvertZoomContactsToGeneric(List zoomContacts) { - var directory = new Codec.CodecDirectory(); + var directory = new Essentials.Core.Devices.Codec.CodecDirectory(); - var folders = new List(); + var folders = new List(); var roomFolder = new DirectoryFolder(); diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoom.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoom.cs index 13fa895d..d2d6acb7 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoom.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoom.cs @@ -10,9 +10,10 @@ using Newtonsoft.Json.Linq; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Core.Devices.VideoCodec; using PepperDash.Essentials.Core.Routing; using PepperDash.Essentials.Devices.Common.Cameras; -using PepperDash.Essentials.Devices.Common.Codec; +using PepperDash.Essentials.Core.Devices.Codec; using PepperDash.Essentials.Devices.Common.Occupancy; using PepperDash.Essentials.Devices.Common.VideoCodec;