Compare commits

...

28 Commits

Author SHA1 Message Date
Andrew Welker
4d0e3b1943 fix: create sfot codec Routing collections 2024-03-20 10:50:23 -05:00
Andrew Welker
69e83735b8 feat: update PD Core 2024-03-20 10:35:03 -05:00
Andrew Welker
e12f9f0afd feat: add generic soft codec device 2024-03-19 16:11:58 -05:00
Andrew Welker
f6cd2b57c1 feat: add GenericSink 2024-03-19 15:53:04 -05:00
Andrew Welker
e319280f43 Merge branch 'feature-2.0.0/interface-updates' of https://github.com/PepperDash/Essentials into feature-2.0.0/interface-updates 2024-03-19 11:08:42 -05:00
Andrew Welker
f43b0df65f refactor: remove args definition for event 2024-03-19 11:08:25 -05:00
Neil Dorin
62f182c634 debug: removes annoying console statements at startup 2024-03-14 22:28:26 -06:00
Neil Dorin
8ae8a3ef41 fix: adds missing JsonProperty decorator 2024-03-14 16:13:02 -06:00
Neil Dorin
0f57799382 feat: Adds TSelector generic type to IHasSurroundSoundModes 2024-03-14 12:26:05 -06:00
Neil Dorin
a2e4c2fad6 feat: Adds ISelectableItems/Item and IHasSurroundSoundModes, modfies IHasInputs, Updates MockDisplay to implement IHasInputs 2024-03-14 11:55:46 -06:00
Neil Dorin
ed5bd360b4 feat: adds more generic ISelectableItems and ISelectableItem interfaces and implements on new IHasInputs and IHasSurroundSoundModes 2024-03-14 10:46:48 -06:00
Andrew Welker
4eeb2145ae chore: update PD Core 2024-03-13 08:34:03 -05:00
Andrew Welker
a5460f16cd feat: add IVideoSync interface & implement on IRoutingInputSlot 2024-03-12 10:51:52 -05:00
Andrew Welker
3b55d6af93 fix: implement DestinationListKey on EssentialsRoomBase 2024-03-08 23:06:26 -06:00
Andrew Welker
285d87d8ac feat: add DestinationListKey to IEssentialsRoom 2024-03-08 22:59:17 -06:00
Andrew Welker
c6690c7765 build: update package names
Updated package names for Core and Devices Common to be valid names and match existing 2.0.0 packages
2024-03-08 21:17:59 -06:00
Andrew Welker
2609006024 feat: implement ILevelControls on DspBase
Also added DspLevelControlPoint class
2024-03-08 21:12:27 -06:00
Andrew Welker
9e61dcd554 refactor: RKST-93 rename interface & properties 2024-03-08 20:41:54 -06:00
Andrew Welker
693d4f8723 feat: RKST-161 add IHasInputs & IInputs interfaces 2024-03-08 20:26:13 -06:00
Andrew Welker
882f41d8bd feat: RKST-160 add IAdvancedVolume interface 2024-03-08 20:11:19 -06:00
Andrew Welker
6669b6125b build: change assembly names to match 1.0.0
This allow 3-series plugins to be loaded correctly
2024-03-08 20:10:44 -06:00
Andrew Welker
9ad151bd7e feat: RKST-131 add IMatrixRouting interfaces 2024-03-08 11:16:48 -06:00
Andrew Welker
b0e9ecf29e build: update PD Core version 2024-03-08 11:16:27 -06:00
Andrew Welker
d4df36b863 feat: add type param for direct route method 2024-03-06 15:39:39 -06:00
Andrew Welker
1146d89abf refactor: Make AddAction generic 2024-02-29 13:40:52 -06:00
Andrew Welker
0ee3e1d52b refactor: modify AddAction method to take the messenger 2024-02-29 13:27:02 -06:00
Andrew Welker
5084861067 feat: add IMobileControlAction interface 2024-02-29 12:36:50 -06:00
Andrew Welker
d6f896c4b2 feat: modify IMobileControl interface 2024-02-28 21:51:03 -06:00
27 changed files with 562 additions and 53 deletions

View File

@@ -0,0 +1,24 @@
using PepperDash.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
{
/// <summary>
/// Describes a device that has selectable inputs
/// </summary>
/// <typeparam name="TKey">the type to use as the key for each input item. Most likely an enum or string</typeparam>\
/// <example>
/// See MockDisplay for example implemntation
/// </example>
public interface IHasInputs<TKey, TSelector>: IKeyName
{
ISelectableItems<TKey> Inputs { get; }
void SetInput(TSelector selector);
}
}

View File

@@ -0,0 +1,20 @@
using PepperDash.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
{
/// <summary>
/// Describes a device that has selectable surround sound modes
/// </summary>
/// <typeparam name="TKey">the type to use as the key for each input item. Most likely an enum or string</typeparam>
public interface IHasSurroundSoundModes<TKey, TSelector>: IKeyName
{
ISelectableItems<TKey> SurroundSoundModes { get; }
void SetSurroundSoundMode(TSelector selector);
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
{
public interface ILevelControls
{
Dictionary<string, IBasicVolumeWithFeedback> LevelControlPoints { get; }
}
}

View File

@@ -12,20 +12,20 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
{
}
/// <summary>
/*/// <summary>
/// Describes a MobileControlSystemController
/// </summary>
public interface IMobileControl : IKeyed
{
/*void CreateMobileControlRoomBridge(IEssentialsRoom room, IMobileControl parent);*/
void CreateMobileControlRoomBridge(IEssentialsRoom room, IMobileControl parent);
void LinkSystemMonitorToAppServer();
}
}*/
/// <summary>
/// Describes a MobileSystemController that accepts IEssentialsRoom
/// </summary>
public interface IMobileControl3 : IMobileControl
public interface IMobileControl : IKeyed
{
string Host { get; }
@@ -37,7 +37,7 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
void SendMessageObject(IMobileControlMessage o);
void AddAction(string key, Action<string, JToken> action);
void AddAction<T>(T messenger, Action<string, string, JToken> action) where T:IMobileControlMessenger;
void RemoveAction(string key);
@@ -51,9 +51,11 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
/// </summary>
public interface IMobileControlMessenger: IKeyed
{
IMobileControl3 AppServerController { get; }
IMobileControl AppServerController { get; }
string MessagePath { get; }
void RegisterWithAppServer(IMobileControl3 appServerController);
string DeviceKey { get; }
void RegisterWithAppServer(IMobileControl appServerController);
}
public interface IMobileControlMessage
@@ -96,4 +98,12 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
void UpdateAppUrl(string url);
}
public interface IMobileControlAction
{
IMobileControlMessenger Messenger { get; }
Action<string,string, JToken> Action { get; }
}
}

View File

@@ -0,0 +1,19 @@
using System;
using Newtonsoft.Json;
using PepperDash.Core;
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
{
/// <summary>
/// Describes an item that can be selected
/// </summary>
public interface ISelectableItem : IKeyName
{
event EventHandler ItemUpdated;
[JsonProperty("isSelected")]
bool IsSelected { get; set; }
void Select();
}
}

View File

@@ -0,0 +1,22 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
{
/// <summary>
/// Describes a collection of items that can be selected
/// </summary>
/// <typeparam name="TKey">type for the keys in the collection. Probably a string or enum</typeparam>
public interface ISelectableItems<TKey>
{
event EventHandler ItemsUpdated;
event EventHandler CurrentItemChanged;
[JsonProperty("items")]
Dictionary<TKey, ISelectableItem> Items { get; set; }
[JsonProperty("currentItem")]
string CurrentItem { get; set; }
}
}

View File

@@ -7,10 +7,10 @@
<TargetFrameworks>net472;net6</TargetFrameworks>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<OutputPath>bin\$(Configuration)\</OutputPath>
<AssemblyName>PepperDash.Essentials.Core</AssemblyName>
<AssemblyName>PepperDash_Essentials_Core</AssemblyName>
<RootNamespace>PepperDash.Essentials.Core</RootNamespace>
<Title>PepperDash Essentials Core</Title>
<PackageId>$(AssemblyName)</PackageId>
<PackageId>PepperDash.Essentials.Core</PackageId>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>full</DebugType>
@@ -23,7 +23,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Crestron.SimplSharp.SDK.ProgramLibrary" Version="2.20.42" />
<PackageReference Include="PepperDashCore" Version="2.0.0-beta-389" />
<PackageReference Include="PepperDashCore" Version="2.0.0-alpha-393" />
</ItemGroup>
<ItemGroup>
<None Include="Crestron\CrestronGenericBaseDevice.cs.orig" />

View File

@@ -357,6 +357,7 @@ namespace PepperDash.Essentials
try
{
types = assy.GetTypes();
Debug.Console(1, $"Got types for assembly {assy.GetName().Name}");
}
catch (TypeLoadException e)
{
@@ -370,6 +371,10 @@ namespace PepperDash.Essentials
{
try
{
//Debug.Console(0, $"Checking if type {type.Name} is IPluginDeviceFactory");
//Debug.Console(0, $"{type.Name} is plugin factory: {typeof(IPluginDeviceFactory).IsAssignableFrom(type) && !type.IsAbstract}");
if (typeof (IPluginDeviceFactory).IsAssignableFrom(type) && !type.IsAbstract)
{
var plugin =

View File

@@ -18,8 +18,6 @@ namespace PepperDash.Essentials.Core
/// </summary>
public abstract class EssentialsRoomBase : ReconfigurableDevice, IEssentialsRoom
{
/// <summary>
///
/// </summary>
@@ -79,6 +77,8 @@ namespace PepperDash.Essentials.Core
}
}
public string DestinationListKey { get; private set; }
protected const string _defaultSourceListKey = "default";
/// <summary>
@@ -194,6 +194,14 @@ namespace PepperDash.Essentials.Core
}
}
protected void SetDestinationListKey(string destinationListKey)
{
if (!string.IsNullOrEmpty(destinationListKey))
{
DestinationListKey = destinationListKey;
}
}
/// <summary>
/// If mobile control is enabled, sets the appropriate properties
/// </summary>

View File

@@ -27,6 +27,8 @@ namespace PepperDash.Essentials.Core
string SourceListKey { get; }
string DestinationListKey { get; }
SecondsCountdownTimer ShutdownPromptTimer { get; }
int ShutdownPromptSeconds { get; }
int ShutdownVacancySeconds { get; }

View File

@@ -48,7 +48,7 @@ namespace PepperDash.Essentials.Core
/// </summary>
public interface IRunDirectRouteAction
{
void RunDirectRoute(string sourceKey, string destinationKey);
void RunDirectRoute(string sourceKey, string destinationKey, eRoutingSignalType type = eRoutingSignalType.AudioVideo);
}
/// <summary>

View File

@@ -0,0 +1,16 @@
using PepperDash.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PepperDash.Essentials.Core.Routing
{
public interface IVideoSync: IKeyed
{
bool VideoSyncDetected { get; }
event EventHandler VideoSyncChanged;
}
}

View File

@@ -0,0 +1,12 @@
using System.Collections.Generic;
namespace PepperDash.Essentials.Core.Routing
{
public interface IMatrixRouting
{
Dictionary<string, IRoutingInputSlot> InputSlots { get; }
Dictionary<string, IRoutingOutputSlot> OutputSlots { get; }
void Route(string inputSlotKey, string outputSlotKey, eRoutingSignalType type);
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PepperDash.Essentials.Core.Routing
{
public interface IRoutingInputSlot: IRoutingSlot, IOnline, IVideoSync
{
string TxDeviceKey { get; }
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
namespace PepperDash.Essentials.Core.Routing
{
public interface IRoutingOutputSlot:IRoutingSlot
{
event EventHandler OutputSlotChanged;
string RxDeviceKey { get; }
Dictionary<eRoutingSignalType, IRoutingInputSlot> CurrentRoutes { get; }
}
}

View File

@@ -0,0 +1,16 @@
using PepperDash.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PepperDash.Essentials.Core.Routing
{
public interface IRoutingSlot:IKeyName
{
int SlotNumber { get; }
eRoutingSignalType SupportedSignalTypes { get; }
}
}

View File

@@ -36,7 +36,8 @@ namespace PepperDash.Essentials.Core
Video = 2,
AudioVideo = Audio | Video,
UsbOutput = 8,
UsbInput = 16
UsbInput = 16,
SecondaryAudio = 32
}
public enum eRoutingPortConnectionType

View File

@@ -6,12 +6,13 @@ using Crestron.SimplSharp;
using PepperDash.Essentials.Devices.Common.Codec;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
namespace PepperDash.Essentials.Devices.Common.DSP
{
public abstract class DspBase : EssentialsDevice
public abstract class DspBase : EssentialsDevice, ILevelControls
{
public Dictionary<string, DspControlPoint> LevelControlPoints { get; private set; }
public Dictionary<string,IBasicVolumeWithFeedback> LevelControlPoints { get; private set; }
public Dictionary<string, DspControlPoint> DialerControlPoints { get; private set; }
@@ -40,15 +41,36 @@ namespace PepperDash.Essentials.Devices.Common.DSP
// Typical presets:
// call default preset to restore levels and mutes
public abstract class DspControlPoint
public abstract class DspControlPoint :IKeyed
{
string Key { get; set; }
public string Key { get; }
protected DspControlPoint(string key) => Key = key;
}
public abstract class DspLevelControlPoint :DspControlPoint, IBasicVolumeWithFeedback
{
public BoolFeedback MuteFeedback { get; }
public IntFeedback VolumeLevelFeedback { get; }
public class DspDialerBase
protected DspLevelControlPoint(string key, Func<bool> muteFeedbackFunc, Func<int> volumeLevelFeedbackFunc) : base(key)
{
MuteFeedback = new BoolFeedback(muteFeedbackFunc);
VolumeLevelFeedback = new IntFeedback(volumeLevelFeedbackFunc);
}
public abstract void MuteOff();
public abstract void MuteOn();
public abstract void MuteToggle();
public abstract void SetVolume(ushort level);
public abstract void VolumeDown(bool pressRelease);
public abstract void VolumeUp(bool pressRelease);
}
public abstract class DspDialerBase:DspControlPoint
{
protected DspDialerBase(string key) : base(key) { }
}

View File

@@ -8,10 +8,16 @@ using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
using Feedback = PepperDash.Essentials.Core.Feedback;
using Newtonsoft.Json;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
namespace PepperDash.Essentials.Devices.Common.Displays
{
public abstract class DisplayBase : EssentialsDevice, IHasFeedback, IRoutingSinkWithSwitching, IHasPowerControl, IWarmingCooling, IUsageTracking
public abstract class DisplayBase : EssentialsDevice
, IHasFeedback
, IRoutingSinkWithSwitching
, IHasPowerControl
, IWarmingCooling
, IUsageTracking
{
public event SourceInfoChangeHandler CurrentSourceChange;

View File

@@ -1,21 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
using PepperDash.Essentials.Core.Routing;
namespace PepperDash.Essentials.Devices.Common.Displays
{
public class MockDisplay : TwoWayDisplayBase, IBasicVolumeWithFeedback, IBridgeAdvanced
public class MockDisplay : TwoWayDisplayBase, IBasicVolumeWithFeedback, IBridgeAdvanced, IHasInputs<string, string>
{
public RoutingInputPort HdmiIn1 { get; private set; }
public RoutingInputPort HdmiIn2 { get; private set; }
public RoutingInputPort HdmiIn3 { get; private set; }
public RoutingInputPort ComponentIn1 { get; private set; }
public RoutingInputPort VgaIn1 { get; private set; }
public ISelectableItems<string> Inputs { get; private set; }
bool _PowerIsOn;
bool _IsWarmingUp;
@@ -53,7 +51,7 @@ namespace PepperDash.Essentials.Devices.Common.Displays
};
}
}
protected override Func<string> CurrentInputFeedbackFunc { get { return () => "Not Implemented"; } }
protected override Func<string> CurrentInputFeedbackFunc { get { return () => Inputs.CurrentItem; } }
int VolumeHeldRepeatInterval = 200;
ushort VolumeInterval = 655;
@@ -63,17 +61,31 @@ namespace PepperDash.Essentials.Devices.Common.Displays
public MockDisplay(string key, string name)
: base(key, name)
{
HdmiIn1 = new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, null, this);
HdmiIn2 = new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, null, this);
HdmiIn3 = new RoutingInputPort(RoutingPortNames.HdmiIn3, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, null, this);
ComponentIn1 = new RoutingInputPort(RoutingPortNames.ComponentIn, eRoutingSignalType.Video,
eRoutingPortConnectionType.Component, null, this);
VgaIn1 = new RoutingInputPort(RoutingPortNames.VgaIn, eRoutingSignalType.Video,
eRoutingPortConnectionType.Composite, null, this);
InputPorts.AddRange(new[] { HdmiIn1, HdmiIn2, HdmiIn3, ComponentIn1, VgaIn1 });
Inputs = new MockDisplayInputs
{
Items = new Dictionary<string, ISelectableItem>
{
{ "HDMI1", new MockDisplayInput ( "HDMI1", "HDMI 1",this ) },
{ "HDMI2", new MockDisplayInput ("HDMI2", "HDMI 2",this ) },
{ "HDMI3", new MockDisplayInput ("HDMI3", "HDMI 3",this ) },
{ "HDMI4", new MockDisplayInput ("HDMI4", "HDMI 4",this )},
{ "DP", new MockDisplayInput ("DP", "DisplayPort", this ) }
}
};
Inputs.CurrentItemChanged += (o, a) => CurrentInputFeedback.FireUpdate();
var hdmiIn1 = new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.Hdmi, "HDMI1", this);
var hdmiIn2 = new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.Hdmi, "HDMI2", this);
var hdmiIn3 = new RoutingInputPort(RoutingPortNames.HdmiIn3, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.Hdmi, "HDMI3", this);
var hdmiIn4 = new RoutingInputPort(RoutingPortNames.ComponentIn, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.Hdmi, "HDMI4", this);
var dpIn = new RoutingInputPort(RoutingPortNames.DisplayPortIn, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.DisplayPort, "DP", this);
InputPorts.AddRange(new[] { hdmiIn1, hdmiIn2, hdmiIn3, hdmiIn4, dpIn });
VolumeLevelFeedback = new IntFeedback(() => { return _FakeVolumeLevel; });
MuteFeedback = new BoolFeedback("MuteOn", () => _IsMuted);
@@ -135,13 +147,43 @@ namespace PepperDash.Essentials.Devices.Common.Displays
{
PowerOn();
}
if (!Inputs.Items.TryGetValue(selector.ToString(), out var input))
return;
input.Select();
}
public void SetInput(string selector)
{
ISelectableItem currentInput = null;
try
{
currentInput = Inputs.Items.SingleOrDefault(Inputs => Inputs.Value.IsSelected).Value;
}
catch { }
if (currentInput != null)
{
Debug.Console(2, this, "SetInput: {0}", selector);
currentInput.IsSelected = false;
}
if (!Inputs.Items.TryGetValue(selector, out var input))
return;
input.IsSelected = true;
Inputs.CurrentItem = selector;
}
#region IBasicVolumeWithFeedback Members
public IntFeedback VolumeLevelFeedback { get; private set; }
#region IBasicVolumeWithFeedback Members
public IntFeedback VolumeLevelFeedback { get; private set; }
public void SetVolume(ushort level)
{
@@ -163,11 +205,12 @@ namespace PepperDash.Essentials.Devices.Common.Displays
public BoolFeedback MuteFeedback { get; private set; }
#endregion
#region IBasicVolumeControls Members
#endregion
public void VolumeUp(bool pressRelease)
#region IBasicVolumeControls Members
public void VolumeUp(bool pressRelease)
{
//while (pressRelease)
//{
@@ -207,5 +250,7 @@ namespace PepperDash.Essentials.Devices.Common.Displays
{
LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge);
}
}
}
}

View File

@@ -0,0 +1,97 @@
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PepperDash.Essentials.Devices.Common.Displays
{
public class MockDisplayInputs : ISelectableItems<string>
{
private Dictionary<string, ISelectableItem> _items;
public Dictionary<string, ISelectableItem> Items
{
get
{
return _items;
}
set
{
if (_items == value)
return;
_items = value;
ItemsUpdated?.Invoke(this, null);
}
}
private string _currentItem;
public string CurrentItem
{
get
{
return _currentItem;
}
set
{
if (_currentItem == value)
return;
_currentItem = value;
CurrentItemChanged?.Invoke(this, null);
}
}
public event EventHandler ItemsUpdated;
public event EventHandler CurrentItemChanged;
}
public class MockDisplayInput : ISelectableItem
{
private IHasInputs<string, string> _parent;
private bool _isSelected;
public bool IsSelected
{
get
{
return _isSelected;
}
set
{
if (_isSelected == value)
return;
_isSelected = value;
ItemUpdated?.Invoke(this, null);
}
}
public string Name { get; set; }
public string Key { get; set; }
public event EventHandler ItemUpdated;
public MockDisplayInput(string key, string name, MockDisplay parent)
{
Key = key;
Name = name;
_parent = parent;
}
public void Select()
{
_parent.SetInput(Key);
}
}
}

View File

@@ -0,0 +1,62 @@
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Routing;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PepperDash.Essentials.Devices.Common.Generic
{
public class GenericSink : EssentialsDevice, IRoutingSink
{
public GenericSink(string key, string name) : base(key, name)
{
InputPorts = new RoutingPortCollection<RoutingInputPort>();
var inputPort = new RoutingInputPort($"{Key}-{RoutingPortNames.AnyVideoIn}", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, null, this);
InputPorts.Add(inputPort);
}
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
public string CurrentSourceInfoKey { get; set; }
private SourceListItem _currentSource;
public SourceListItem CurrentSourceInfo {
get => _currentSource;
set {
if(value == _currentSource)
{
return;
}
CurrentSourceChange?.Invoke(_currentSource, ChangeType.WillChange);
_currentSource = value;
CurrentSourceChange?.Invoke(_currentSource, ChangeType.DidChange);
}
}
public event SourceInfoChangeHandler CurrentSourceChange;
}
public class GenericSinkFactory : EssentialsDeviceFactory<GenericSink>
{
public GenericSinkFactory()
{
TypeNames = new List<string>() { "genericsink", "genericdestination" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new Generic Source Device");
return new GenericSource(dc.Key, dc.Name);
}
}
}

View File

@@ -54,5 +54,4 @@ namespace PepperDash.Essentials.Devices.Common
return new GenericSource(dc.Key, dc.Name);
}
}
}

View File

@@ -7,11 +7,11 @@
<TargetFrameworks>net472;net6</TargetFrameworks>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<OutputPath>bin\$(Configuration)\</OutputPath>
<AssemblyName>PepperDash.Essentials.Devices.Common</AssemblyName>
<AssemblyName>Essentials Devices Common</AssemblyName>
<RootNamespace>PepperDash.Essentials.Devices.Common</RootNamespace>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Title>PepperDash Essentials Devices Common</Title>
<PackageId>$(AssemblyName)</PackageId>
<PackageId>PepperDash.Essentials.Devices.Common</PackageId>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>full</DebugType>
@@ -27,6 +27,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Crestron.SimplSharp.SDK.ProgramLibrary" Version="2.20.42" />
<PackageReference Include="PepperDashCore" Version="2.0.0-beta-389" />
<PackageReference Include="PepperDashCore" Version="2.0.0-alpha-393" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,83 @@
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PepperDash.Essentials.Devices.Common.SoftCodec
{
public class GenericSoftCodec : EssentialsDevice, IRoutingInputsOutputs
{
public GenericSoftCodec(string key, string name, GenericSoftCodecProperties props) : base(key, name)
{
InputPorts = new RoutingPortCollection<RoutingInputPort>();
OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
for(var i = 1; i <= props.OutputCount; i++)
{
var outputPort = new RoutingOutputPort($"{Key}-output{i}", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, null, this);
OutputPorts.Add(outputPort);
}
for(var i = 1; i<= props.ContentInputCount; i++)
{
var inputPort = new RoutingInputPort($"{Key}-contentInput{i}", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, null, this);
InputPorts.Add(inputPort);
}
if (!props.HasCameraInputs)
{
return;
}
for(var i = 1; i <=props.CameraInputCount; i++)
{
var cameraPort = new RoutingInputPort($"{Key}-cameraInput{i}", eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, null, this);
InputPorts.Add(cameraPort);
}
}
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
}
public class GenericSoftCodecProperties
{
[JsonProperty("hasCameraInputs")]
public bool HasCameraInputs { get; set; }
[JsonProperty("cameraInputCount")]
public int CameraInputCount { get; set; }
[JsonProperty("contentInputCount")]
public int ContentInputCount { get; set; }
[JsonProperty("contentOutputCount")]
public int OutputCount { get; set; }
}
public class GenericSoftCodecFactory: EssentialsDeviceFactory<GenericSoftCodec>
{
public GenericSoftCodecFactory()
{
TypeNames = new List<string> { "genericsoftcodec" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Attempting to create new Generic SoftCodec Device");
var props = dc.Properties.ToObject<GenericSoftCodecProperties>();
return new GenericSoftCodec(dc.Key, dc.Name, props);
}
}
}

View File

@@ -35,7 +35,7 @@ namespace PepperDash.Essentials
SecretsManager.Initialize();
SystemMonitor.ProgramInitialization.ProgramInitializationUnderUserControl = true;
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainOnAssemblyResolve;
// AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainOnAssemblyResolve;
}
private System.Reflection.Assembly CurrentDomainOnAssemblyResolve(object sender, ResolveEventArgs args)

View File

@@ -5,7 +5,7 @@
</PropertyGroup>
<PropertyGroup>
<RootNamespace>PepperDash.Essentials</RootNamespace>
<AssemblyName>PepperDash.Essentials</AssemblyName>
<AssemblyName>PepperDashEssentials</AssemblyName>
<TargetFrameworks>net472;net6</TargetFrameworks>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<OutputPath>bin\$(Configuration)\</OutputPath>
@@ -47,7 +47,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Crestron.SimplSharp.SDK.Program" Version="2.20.42" />
<PackageReference Include="PepperDashCore" Version="2.0.0-beta-389" />
<PackageReference Include="PepperDashCore" Version="2.0.0-alpha-393" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PepperDash.Essentials.Core\PepperDash.Essentials.Core.csproj" />