Update to support Cisco Codec External Sources using Essentials Room logic.

Adds new interface for Codecs IHasExternalSourceSwitching
Adds ability to set and clear External Sources in Cisco Spark device class
Adds ability to send sources from the source list to the Cisco Spark in the "EssentialsHuddleVtc1Room" room
[ ] still needs parsing when source is selected on the Cisco touch 10
This commit is contained in:
Jason Alborough
2020-08-14 15:51:37 -04:00
parent 22ff61d7f3
commit aea6942a1f
8 changed files with 533 additions and 388 deletions

View File

@@ -50,6 +50,24 @@ namespace PepperDash.Essentials
//************************ //************************
public override string SourceListKey
{
get
{
return _SourceListKey;
}
set
{
_SourceListKey = value;
if(VideoCodec is IHasExternalSourceSwitching)
{
if((VideoCodec as IHasExternalSourceSwitching).ExternalSourceListEnabled)
{
SetCodecExternalSources();
}
}
}
}
protected override Func<bool> OnFeedbackFunc protected override Func<bool> OnFeedbackFunc
{ {
@@ -206,9 +224,14 @@ namespace PepperDash.Essentials
VideoCodec = DeviceManager.GetDeviceForKey(PropertiesConfig.VideoCodecKey) as VideoCodec = DeviceManager.GetDeviceForKey(PropertiesConfig.VideoCodecKey) as
PepperDash.Essentials.Devices.Common.VideoCodec.VideoCodecBase; PepperDash.Essentials.Devices.Common.VideoCodec.VideoCodecBase;
if (VideoCodec == null) if (VideoCodec == null)
throw new ArgumentNullException("codec cannot be null"); throw new ArgumentNullException("codec cannot be null");
//todo Do the thing here JTA
AudioCodec = DeviceManager.GetDeviceForKey(PropertiesConfig.AudioCodecKey) as AudioCodec = DeviceManager.GetDeviceForKey(PropertiesConfig.AudioCodecKey) as
PepperDash.Essentials.Devices.Common.AudioCodec.AudioCodecBase; PepperDash.Essentials.Devices.Common.AudioCodec.AudioCodecBase;
if (AudioCodec == null) if (AudioCodec == null)
@@ -298,6 +321,7 @@ namespace PepperDash.Essentials
VideoCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate(); VideoCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate();
VideoCodec.IsReadyChange += (o, a) => this.SetCodecExternalSources();
if (AudioCodec != null) if (AudioCodec != null)
AudioCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate(); AudioCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate();
@@ -350,7 +374,6 @@ namespace PepperDash.Essentials
return base.CustomActivate(); return base.CustomActivate();
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@@ -672,6 +695,30 @@ namespace PepperDash.Essentials
(room as EssentialsHuddleSpaceRoom).RunRouteAction("roomOff"); (room as EssentialsHuddleSpaceRoom).RunRouteAction("roomOff");
} }
private void SetCodecExternalSources()
{
string codecTieLine = "";
codecTieLine = ConfigReader.ConfigObject.TieLines.SingleOrDefault(x => x.DestinationKey == VideoCodec.Key).DestinationPort;
(VideoCodec as IHasExternalSourceSwitching).ClearExternalSources();
(VideoCodec as IHasExternalSourceSwitching).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;
Debug.Console(1, "**** KEY {0}", kvp.Key);
if (kvp.Key != "codecOsd" && kvp.Key != "roomOff")
{
(VideoCodec as IHasExternalSourceSwitching).AddExternalSource(codecTieLine, srcConfig.PreferredName);
}
}
}
#region IPrivacy Members #region IPrivacy Members

View File

@@ -1050,10 +1050,13 @@ namespace PepperDash.Essentials
var inCall = CurrentRoom.InCallFeedback.BoolValue; var inCall = CurrentRoom.InCallFeedback.BoolValue;
var config = ConfigReader.ConfigObject.SourceLists; var config = ConfigReader.ConfigObject.SourceLists;
if (config.ContainsKey(_CurrentRoom.SourceListKey)) if (config.ContainsKey(_CurrentRoom.SourceListKey))
{ {
var srcList = config[_CurrentRoom.SourceListKey].OrderBy(kv => kv.Value.Order); var srcList = config[_CurrentRoom.SourceListKey].OrderBy(kv => kv.Value.Order);
// Setup sources list // Setup sources list
SourceStagingSrl.Clear(); SourceStagingSrl.Clear();
uint i = 1; // counter for UI list uint i = 1; // counter for UI list
@@ -1076,6 +1079,8 @@ namespace PepperDash.Essentials
b => { if (!b) UiSelectSource(routeKey); }); b => { if (!b) UiSelectSource(routeKey); });
SourceStagingSrl.AddItem(item); // add to the SRL SourceStagingSrl.AddItem(item); // add to the SRL
item.RegisterForSourceChange(_CurrentRoom); item.RegisterForSourceChange(_CurrentRoom);
Debug.Console(1, "**** KEY {0}", kvp.Key);
} }
SourceStagingSrl.Count = (ushort)(i - 1); SourceStagingSrl.Count = (ushort)(i - 1);
} }

View File

@@ -51,7 +51,19 @@ namespace PepperDash.Essentials.Core
/// <summary> /// <summary>
/// The config name of the source list /// The config name of the source list
/// </summary> /// </summary>
public string SourceListKey { get; set; } ///
protected string _SourceListKey;
public virtual string SourceListKey {
get
{
return _SourceListKey;
}
set
{
_SourceListKey = value;
}
}
/// <summary> /// <summary>
/// Timer used for informing the UIs of a shutdown /// Timer used for informing the UIs of a shutdown

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Devices.Common.Codec
{
public interface IHasExternalSourceSwitching
{
bool ExternalSourceListEnabled { get; }
void AddExternalSource(string connectorId, string name);
void ClearExternalSources();
Action<string, string> RunRouteAction { set;}
}
}

View File

@@ -112,6 +112,7 @@
<Compile Include="Codec\eCodecCallStatus.cs" /> <Compile Include="Codec\eCodecCallStatus.cs" />
<Compile Include="Codec\eMeetingPrivacy.cs" /> <Compile Include="Codec\eMeetingPrivacy.cs" />
<Compile Include="Codec\iCodecAudio.cs" /> <Compile Include="Codec\iCodecAudio.cs" />
<Compile Include="Codec\IHasExternalSourceSwitching.cs" />
<Compile Include="ImageProcessors\TVOneCorio.cs" /> <Compile Include="ImageProcessors\TVOneCorio.cs" />
<Compile Include="ImageProcessors\TVOneCorioPropertiesConfig.cs" /> <Compile Include="ImageProcessors\TVOneCorioPropertiesConfig.cs" />
<Compile Include="Power Controllers\Digitallogger.cs" /> <Compile Include="Power Controllers\Digitallogger.cs" />

View File

@@ -15,16 +15,16 @@ using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Routing; using PepperDash.Essentials.Core.Routing;
using PepperDash.Essentials.Devices.Common.Cameras; using PepperDash.Essentials.Devices.Common.Cameras;
using PepperDash.Essentials.Devices.Common.Codec; using PepperDash.Essentials.Devices.Common.Codec;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Devices.Common.VideoCodec; using PepperDash.Essentials.Devices.Common.VideoCodec;
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{ {
enum eCommandType { SessionStart, SessionEnd, Command, GetStatus, GetConfiguration }; enum eCommandType { SessionStart, SessionEnd, Command, GetStatus, GetConfiguration };
public enum eExternalSourceType {camera, desktop, document_camera, mediaplayer, PC, whiteboard, other}
public class CiscoSparkCodec : VideoCodecBase, IHasCallHistory, IHasCallFavorites, IHasDirectory, public class CiscoSparkCodec : VideoCodecBase, IHasCallHistory, IHasCallFavorites, IHasDirectory,
IHasScheduleAwareness, IOccupancyStatusProvider, IHasCodecLayouts, IHasCodecSelfView, IHasScheduleAwareness, IOccupancyStatusProvider, IHasCodecLayouts, IHasCodecSelfView,
ICommunicationMonitor, IRouting, IHasCodecCameras, IHasCameraAutoMode, IHasCodecRoomPresets ICommunicationMonitor, IRouting, IHasCodecCameras, IHasCameraAutoMode, IHasCodecRoomPresets, IHasExternalSourceSwitching
{ {
public event EventHandler<DirectoryEventArgs> DirectoryResultReturned; public event EventHandler<DirectoryEventArgs> DirectoryResultReturned;
@@ -348,6 +348,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
CallHistory = new CodecCallHistory(); CallHistory = new CodecCallHistory();
if (props.Favorites != null) if (props.Favorites != null)
{ {
CallFavorites = new CodecCallFavorites(); CallFavorites = new CodecCallFavorites();
@@ -398,6 +399,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
SetUpCameras(); SetUpCameras();
CreateOsdSource(); CreateOsdSource();
if (props.ExternalSourceListEnabled != null)
{
ExternalSourceListEnabled = props.ExternalSourceListEnabled;
}
} }
/// <summary> /// <summary>
@@ -472,7 +478,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
prefix + "/Bookings" + Delimiter + prefix + "/Bookings" + Delimiter +
prefix + "/Event/CallDisconnect" + Delimiter + prefix + "/Event/CallDisconnect" + Delimiter +
prefix + "/Event/Bookings" + Delimiter + prefix + "/Event/Bookings" + Delimiter +
prefix + "/Event/CameraPresetListUpdated" + Delimiter; prefix + "/Event/CameraPresetListUpdated" + Delimiter +
prefix + "/Event/UserInterface/Presentation/ExternalSource/Selected/SourceIdentifier" + Delimiter;
return base.CustomActivate(); return base.CustomActivate();
} }
@@ -629,6 +636,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
} }
} }
} }
//TODO JTA FInish Parsing for External Sources
if (args.Text == "ExternalSource")
{
RunRouteAction("", "");
}
} }
@@ -1802,8 +1814,56 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
SendText(string.Format("xCommand Call FarEndControl RoomPreset Activate CallId: {0} PresetId: {1}", GetCallId(), preset)); SendText(string.Format("xCommand Call FarEndControl RoomPreset Activate CallId: {0} PresetId: {1}", GetCallId(), preset));
} }
#region IHasExternalSourceSwitching Members
/// <summary>
///
/// </summary>
public bool ExternalSourceListEnabled
{
get;
private set;
} }
public void AddExternalSource(string connectorId, string name)
{
int id = 2;
if (connectorId.ToLower() == "hdmiin3")
{
id = 3;
}
SendText(string.Format("xCommand UserInterface Presentation ExternalSource Add ConnectorId: {0} SourceIdentifier: \"{1}\" Name: \"{2}\" Type: desktop", id, name, name));
Debug.Console(2, this, "Adding ExternalSource {0} {1}", connectorId, name);
}
/// <summary>
///
/// </summary>
public void ClearExternalSources()
{
SendText("xCommand UserInterface Presentation ExternalSource RemoveAll");
}
public Action<string, string> RunRouteAction { private get; set; }
#endregion
#region ExternalDevices
#endregion
}
/// <summary> /// <summary>
/// Represents a codec command that might need to have a friendly label applied for UI feedback purposes /// Represents a codec command that might need to have a friendly label applied for UI feedback purposes
/// </summary> /// </summary>

View File

@@ -31,6 +31,9 @@ namespace PepperDash.Essentials.Devices.Common.Codec
[JsonProperty("sharing")] [JsonProperty("sharing")]
public SharingProperties Sharing { get; set; } public SharingProperties Sharing { get; set; }
[JsonProperty("externalSourceListEnabled")]
public bool ExternalSourceListEnabled { get; set; }
/// <summary> /// <summary>
/// Optionsal property to set the limit of any phonebook queries for directory or searching /// Optionsal property to set the limit of any phonebook queries for directory or searching
/// </summary> /// </summary>