diff --git a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs index 20c8ae3d..97c1775e 100644 --- a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs +++ b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs @@ -13,6 +13,7 @@ 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 { @@ -313,7 +314,7 @@ namespace PepperDash.Essentials VideoCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate(); - VideoCodec.IsReadyChange += (o, a) => this.SetCodecExternalSources(); + VideoCodec.IsReadyChange += (o, a) => { this.SetCodecExternalSources(); SetCodecBranding(); }; if (AudioCodec != null) AudioCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate(); @@ -703,29 +704,36 @@ namespace PepperDash.Essentials { return; } - else - { - string codecTieLine = ""; - codecTieLine = ConfigReader.ConfigObject.TieLines.SingleOrDefault(x => x.DestinationKey == VideoCodec.Key).DestinationPort; - videoCodecWithExternalSwitching.ClearExternalSources(); - videoCodecWithExternalSwitching.RunRouteAction = RunRouteAction; - 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; + string codecTieLine = ConfigReader.ConfigObject.TieLines.SingleOrDefault(x => x.DestinationKey == VideoCodec.Key).DestinationPort; + videoCodecWithExternalSwitching.ClearExternalSources(); + videoCodecWithExternalSwitching.RunRouteAction = RunRouteAction; + var srcList = ConfigReader.ConfigObject.SourceLists.SingleOrDefault(x => x.Key == SourceListKey).Value.OrderBy(kv => kv.Value.Order); ; - if (kvp.Key != DefaultCodecRouteString && kvp.Key != "roomOff") - { + foreach (var kvp in srcList) + { + var srcConfig = kvp.Value; - videoCodecWithExternalSwitching.AddExternalSource(codecTieLine, kvp.Key, srcConfig.PreferredName, PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.eExternalSourceType.desktop); - videoCodecWithExternalSwitching.SetExternalSourceState(kvp.Key, PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.eExternalSourceMode.Ready); + if (kvp.Key != DefaultCodecRouteString && kvp.Key != "roomOff") + { + + videoCodecWithExternalSwitching.AddExternalSource(codecTieLine, kvp.Key, srcConfig.PreferredName, PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.eExternalSourceType.desktop); + videoCodecWithExternalSwitching.SetExternalSourceState(kvp.Key, PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.eExternalSourceMode.Ready); - } - } - } + } + } } + + 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 diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IHasBranding.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IHasBranding.cs new file mode 100644 index 00000000..d5c95c47 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IHasBranding.cs @@ -0,0 +1,8 @@ +namespace PepperDash_Essentials_Core.DeviceTypeInterfaces +{ + public interface IHasBranding + { + bool BrandingEnabled { get; } + void InitializeBranding(string roomKey); + } +} \ 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 ae420105..e0cf8dcb 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -98,12 +98,12 @@ False - ..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll False False - ..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll False @@ -113,7 +113,7 @@ False - ..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe False @@ -206,6 +206,7 @@ + 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 9759cfdd..814ce903 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 @@ -12,10 +12,12 @@ using Newtonsoft.Json.Linq; using PepperDash.Core; using PepperDash.Essentials.Core; 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.DeviceTypeInterfaces; namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco { @@ -25,10 +27,12 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco public class CiscoSparkCodec : VideoCodecBase, IHasCallHistory, IHasCallFavorites, IHasDirectory, IHasScheduleAwareness, IOccupancyStatusProvider, IHasCodecLayouts, IHasCodecSelfView, - ICommunicationMonitor, IRouting, IHasCodecCameras, IHasCameraAutoMode, IHasCodecRoomPresets, IHasExternalSourceSwitching + ICommunicationMonitor, IRouting, IHasCodecCameras, IHasCameraAutoMode, IHasCodecRoomPresets, IHasExternalSourceSwitching, IHasBranding { public event EventHandler DirectoryResultReturned; + private CTimer _brandingTimer; + public CommunicationGather PortGather { get; private set; } public StatusMonitorBase CommunicationMonitor { get; private set; } @@ -401,13 +405,19 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco CreateOsdSource(); - if (props.ExternalSourceListEnabled != null) - { - ExternalSourceListEnabled = props.ExternalSourceListEnabled; - } + ExternalSourceListEnabled = props.ExternalSourceListEnabled; + + 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; } - /// /// Runs in it's own thread to dequeue messages in the order they were received to be processed /// /// @@ -443,6 +453,83 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco 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); + + SendMcBrandingUrl(mcBridge); + } + } + + private void SendMcBrandingUrl(IMobileControlRoomBridge mcBridge) + { + if (mcBridge == null) + { + return; + } + + Debug.Console(1, this, "Sending url: {0}", mcBridge.QrCodeUrl); + + SendText("xconfiguration userinterface custommessage: \"Scan the QR code with a mobile phone to get started\""); + SendText("xconfiguration userinterface osd halfwakemessage: \"Tap the touch panel or scan the QR code with a mobile phone to get started\""); + + SendText(String.Format( + "xcommand userinterface branding fetch type: branding url: {0}", + mcBridge.QrCodeUrl)); + SendText(String.Format( + "xcommand userinterface branding fetch type: halfwakebranding url: {0}", + mcBridge.QrCodeUrl)); + } + + private void SendBrandingUrl() + { + Debug.Console(1, this, "Sending url: {0}", _brandingUrl); + + SendText(String.Format("xcommand userinterface branding fetch type: branding url: {0}", + _brandingUrl)); + SendText(String.Format("xcommand userinterface branding fetch type: halfwakebranding url: {0}", + _brandingUrl)); + } /// /// Starts the HTTP feedback server and syncronizes state of codec /// @@ -1835,6 +1922,10 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco private set; } + public bool BrandingEnabled { get; private set; } + private string _brandingUrl; + private bool _sendMcUrl; + /// /// Adds an external source to the Cisco /// 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 2f335780..cd280b29 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 @@ -40,6 +40,9 @@ namespace PepperDash.Essentials.Devices.Common.Codec [JsonProperty("phonebookResultsLimit")] public uint PhonebookResultsLimit { get; set; } + [JsonProperty("UiBranding")] + public BrandingLogoProperties UiBranding { get; set; } + } public class SharingProperties @@ -47,4 +50,13 @@ namespace PepperDash.Essentials.Devices.Common.Codec [JsonProperty("autoShareContentWhileInCall")] public bool AutoShareContentWhileInCall { get; set; } } + + public class BrandingLogoProperties + { + [JsonProperty("enable")] + public bool Enable { get; set; } + + [JsonProperty("brandingUrl")] + public string BrandingUrl { get; set; } + } } \ No newline at end of file