mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-27 11:24:55 +00:00
Merge pull request #427 from PepperDash/feature/add-qr-code-cisco-touch10
Add MC QR Code display to Touch10 and OSD
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
|
||||
{
|
||||
public interface IHasBranding
|
||||
{
|
||||
bool BrandingEnabled { get; }
|
||||
void InitializeBranding(string roomKey);
|
||||
}
|
||||
}
|
||||
@@ -98,12 +98,12 @@
|
||||
</Reference>
|
||||
<Reference Include="SimplSharpCustomAttributesInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll</HintPath>
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="SimplSharpHelperInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll</HintPath>
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="SimplSharpNewtonsoft, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
@@ -113,7 +113,7 @@
|
||||
</Reference>
|
||||
<Reference Include="SimplSharpPro, Version=1.5.3.17, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe</HintPath>
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="SimplSharpReflectionInterface, Version=1.0.5583.25238, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
@@ -206,6 +206,7 @@
|
||||
<Compile Include="Devices\PC\Laptop.cs" />
|
||||
<Compile Include="Devices\ReconfigurableDevice.cs" />
|
||||
<Compile Include="Devices\VolumeDeviceChangeEventArgs.cs" />
|
||||
<Compile Include="DeviceTypeInterfaces\IHasBranding.cs" />
|
||||
<Compile Include="DeviceTypeInterfaces\IMobileControl.cs" />
|
||||
<Compile Include="Factory\DeviceFactory.cs" />
|
||||
<Compile Include="Factory\IDeviceFactory.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<DirectoryEventArgs> 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs in it's own thread to dequeue messages in the order they were received to be processed
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
@@ -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));
|
||||
}
|
||||
/// <summary>
|
||||
/// Starts the HTTP feedback server and syncronizes state of codec
|
||||
/// </summary>
|
||||
@@ -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;
|
||||
|
||||
/// <summary>
|
||||
/// Adds an external source to the Cisco
|
||||
/// </summary>
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user