mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-15 05:27:16 +00:00
chore: move all files to file-scoped namespace
This commit is contained in:
parent
aaa5b0532b
commit
3ece4f0b7b
522 changed files with 39628 additions and 45678 deletions
|
|
@ -6,152 +6,128 @@ using PepperDash.Essentials.Core.Config;
|
|||
|
||||
using Serilog.Events;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common
|
||||
namespace PepperDash.Essentials.Devices.Common;
|
||||
|
||||
/// <summary>
|
||||
/// Represents and audio endpoint
|
||||
/// </summary>
|
||||
public class GenericAudioOut : EssentialsDevice, IRoutingSink
|
||||
{
|
||||
public RoutingInputPort CurrentInputPort => AnyAudioIn;
|
||||
|
||||
public event SourceInfoChangeHandler CurrentSourceChange;
|
||||
|
||||
public string CurrentSourceInfoKey { get; set; }
|
||||
public SourceListItem CurrentSourceInfo
|
||||
{
|
||||
get
|
||||
{
|
||||
return _CurrentSourceInfo;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == _CurrentSourceInfo) return;
|
||||
|
||||
var handler = CurrentSourceChange;
|
||||
|
||||
if (handler != null)
|
||||
handler(_CurrentSourceInfo, ChangeType.WillChange);
|
||||
|
||||
_CurrentSourceInfo = value;
|
||||
|
||||
if (handler != null)
|
||||
handler(_CurrentSourceInfo, ChangeType.DidChange);
|
||||
}
|
||||
}
|
||||
SourceListItem _CurrentSourceInfo;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the AnyAudioIn
|
||||
/// </summary>
|
||||
public RoutingInputPort AnyAudioIn { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for GenericAudioOut
|
||||
/// </summary>
|
||||
/// <param name="key">Device key</param>
|
||||
/// <param name="name">Device name</param>
|
||||
public GenericAudioOut(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
AnyAudioIn = new RoutingInputPort(RoutingPortNames.AnyAudioIn, eRoutingSignalType.Audio,
|
||||
eRoutingPortConnectionType.LineAudio, null, this);
|
||||
}
|
||||
|
||||
#region IRoutingInputs Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of input ports
|
||||
/// </summary>
|
||||
public RoutingPortCollection<RoutingInputPort> InputPorts
|
||||
{
|
||||
get { return new RoutingPortCollection<RoutingInputPort> { AnyAudioIn }; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Represents a GenericAudioOutWithVolume
|
||||
/// </summary>
|
||||
public class GenericAudioOutWithVolume : GenericAudioOut, IHasVolumeDevice
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents and audio endpoint
|
||||
/// Gets the volume device key
|
||||
/// </summary>
|
||||
public class GenericAudioOut : EssentialsDevice, IRoutingSink
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the current input port
|
||||
/// </summary>
|
||||
public RoutingInputPort CurrentInputPort => AnyAudioIn;
|
||||
|
||||
/// <summary>
|
||||
/// Event fired when the current source changes
|
||||
/// </summary>
|
||||
public event SourceInfoChangeHandler CurrentSourceChange;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current source info key
|
||||
/// </summary>
|
||||
public string CurrentSourceInfoKey { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the current source info
|
||||
/// </summary>
|
||||
public SourceListItem CurrentSourceInfo
|
||||
{
|
||||
get
|
||||
{
|
||||
return _CurrentSourceInfo;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == _CurrentSourceInfo) return;
|
||||
|
||||
var handler = CurrentSourceChange;
|
||||
|
||||
if (handler != null)
|
||||
handler(_CurrentSourceInfo, ChangeType.WillChange);
|
||||
|
||||
_CurrentSourceInfo = value;
|
||||
|
||||
if (handler != null)
|
||||
handler(_CurrentSourceInfo, ChangeType.DidChange);
|
||||
}
|
||||
}
|
||||
SourceListItem _CurrentSourceInfo;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the AnyAudioIn
|
||||
/// </summary>
|
||||
public RoutingInputPort AnyAudioIn { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for GenericAudioOut
|
||||
/// </summary>
|
||||
/// <param name="key">Device key</param>
|
||||
/// <param name="name">Device name</param>
|
||||
public GenericAudioOut(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
AnyAudioIn = new RoutingInputPort(RoutingPortNames.AnyAudioIn, eRoutingSignalType.Audio,
|
||||
eRoutingPortConnectionType.LineAudio, null, this);
|
||||
}
|
||||
|
||||
#region IRoutingInputs Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of input ports
|
||||
/// </summary>
|
||||
public RoutingPortCollection<RoutingInputPort> InputPorts
|
||||
{
|
||||
get { return new RoutingPortCollection<RoutingInputPort> { AnyAudioIn }; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public string VolumeDeviceKey { get; private set; }
|
||||
/// <summary>
|
||||
/// Gets the volume zone
|
||||
/// </summary>
|
||||
public uint VolumeZone { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Represents a GenericAudioOutWithVolume
|
||||
/// Gets the volume device
|
||||
/// </summary>
|
||||
public class GenericAudioOutWithVolume : GenericAudioOut, IHasVolumeDevice
|
||||
public IBasicVolumeControls VolumeDevice
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the volume device key
|
||||
/// </summary>
|
||||
public string VolumeDeviceKey { get; private set; }
|
||||
/// <summary>
|
||||
/// Gets the volume zone
|
||||
/// </summary>
|
||||
public uint VolumeZone { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the volume device
|
||||
/// </summary>
|
||||
public IBasicVolumeControls VolumeDevice
|
||||
get
|
||||
{
|
||||
get
|
||||
{
|
||||
var dev = DeviceManager.GetDeviceForKey(VolumeDeviceKey);
|
||||
if (dev is IAudioZones)
|
||||
return (dev as IAudioZones).Zone[VolumeZone];
|
||||
else return dev as IBasicVolumeControls;
|
||||
}
|
||||
var dev = DeviceManager.GetDeviceForKey(VolumeDeviceKey);
|
||||
if (dev is IAudioZones)
|
||||
return (dev as IAudioZones).Zone[VolumeZone];
|
||||
else return dev as IBasicVolumeControls;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor - adds the name to the attached audio device, if appropriate.
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="audioDevice"></param>
|
||||
/// <param name="zone"></param>
|
||||
public GenericAudioOutWithVolume(string key, string name, string audioDevice, uint zone)
|
||||
: base(key, name)
|
||||
{
|
||||
VolumeDeviceKey = audioDevice;
|
||||
VolumeZone = zone;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Factory for creating GenericAudioOutWithVolume devices
|
||||
/// Constructor - adds the name to the attached audio device, if appropriate.
|
||||
/// </summary>
|
||||
public class GenericAudioOutWithVolumeFactory : EssentialsDeviceFactory<GenericAudioOutWithVolume>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="audioDevice"></param>
|
||||
/// <param name="zone"></param>
|
||||
public GenericAudioOutWithVolume(string key, string name, string audioDevice, uint zone)
|
||||
: base(key, name)
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor for GenericAudioOutWithVolumeFactory
|
||||
/// </summary>
|
||||
public GenericAudioOutWithVolumeFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "genericaudiooutwithvolume" };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// BuildDevice method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new GenericAudioOutWithVolumeFactory Device");
|
||||
var zone = dc.Properties.Value<uint>("zone");
|
||||
return new GenericAudioOutWithVolume(dc.Key, dc.Name,
|
||||
dc.Properties.Value<string>("volumeDeviceKey"), zone);
|
||||
}
|
||||
VolumeDeviceKey = audioDevice;
|
||||
VolumeZone = zone;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class GenericAudioOutWithVolumeFactory : EssentialsDeviceFactory<GenericAudioOutWithVolume>
|
||||
{
|
||||
public GenericAudioOutWithVolumeFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "genericaudiooutwithvolume" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new GenericAudioOutWithVolumeFactory Device");
|
||||
var zone = dc.Properties.Value<uint>("zone");
|
||||
return new GenericAudioOutWithVolume(dc.Key, dc.Name,
|
||||
dc.Properties.Value<string>("volumeDeviceKey"), zone);
|
||||
}
|
||||
}
|
||||
|
|
@ -4,117 +4,96 @@ using System.Linq;
|
|||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.AudioCodec
|
||||
namespace PepperDash.Essentials.Devices.Common.AudioCodec;
|
||||
|
||||
public abstract class AudioCodecBase : EssentialsDevice, IHasDialer, IUsageTracking, IAudioCodecInfo
|
||||
{
|
||||
|
||||
public event EventHandler<CodecCallStatusItemChangeEventArgs> CallStatusChange;
|
||||
|
||||
public AudioCodecInfo CodecInfo { get; protected set; }
|
||||
|
||||
#region IUsageTracking Members
|
||||
|
||||
/// <summary>
|
||||
/// Abstract base class for audio codec devices
|
||||
/// This object can be added by outside users of this class to provide usage tracking
|
||||
/// for various services
|
||||
/// </summary>
|
||||
public abstract class AudioCodecBase : EssentialsDevice, IHasDialer, IUsageTracking, IAudioCodecInfo
|
||||
public UsageTracking UsageTracker { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Returns true when any call is not in state Unknown, Disconnecting, Disconnected
|
||||
/// </summary>
|
||||
public bool IsInCall
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Event fired when call status changes
|
||||
/// </summary>
|
||||
public event EventHandler<CodecCallStatusItemChangeEventArgs> CallStatusChange;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CodecInfo
|
||||
/// </summary>
|
||||
public AudioCodecInfo CodecInfo { get; protected set; }
|
||||
|
||||
#region IUsageTracking Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the UsageTracker
|
||||
/// </summary>
|
||||
public UsageTracking UsageTracker { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Returns true when any call is not in state Unknown, Disconnecting, Disconnected
|
||||
/// </summary>
|
||||
public bool IsInCall
|
||||
get
|
||||
{
|
||||
get
|
||||
{
|
||||
bool value;
|
||||
bool value;
|
||||
|
||||
if (ActiveCalls != null)
|
||||
value = ActiveCalls.Any(c => c.IsActiveCall);
|
||||
else
|
||||
value = false;
|
||||
return value;
|
||||
}
|
||||
if (ActiveCalls != null)
|
||||
value = ActiveCalls.Any(c => c.IsActiveCall);
|
||||
else
|
||||
value = false;
|
||||
return value;
|
||||
}
|
||||
|
||||
// In most cases only a single call can be active
|
||||
/// <summary>
|
||||
/// Gets or sets the ActiveCalls
|
||||
/// </summary>
|
||||
public List<CodecActiveCallItem> ActiveCalls { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for AudioCodecBase
|
||||
/// </summary>
|
||||
/// <param name="key">Device key</param>
|
||||
/// <param name="name">Device name</param>
|
||||
public AudioCodecBase(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
ActiveCalls = new List<CodecActiveCallItem>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper method to fire CallStatusChange event with old and new status
|
||||
/// </summary>
|
||||
protected void SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus newStatus, CodecActiveCallItem call)
|
||||
{
|
||||
call.Status = newStatus;
|
||||
|
||||
OnCallStatusChange(call);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles call status change events
|
||||
/// </summary>
|
||||
/// <param name="item">The call item that changed status</param>
|
||||
protected void OnCallStatusChange(CodecActiveCallItem item)
|
||||
{
|
||||
var handler = CallStatusChange;
|
||||
if (handler != null)
|
||||
handler(this, new CodecCallStatusItemChangeEventArgs(item));
|
||||
|
||||
if (UsageTracker != null)
|
||||
{
|
||||
if (IsInCall && !UsageTracker.UsageTrackingStarted)
|
||||
UsageTracker.StartDeviceUsage();
|
||||
else if (UsageTracker.UsageTrackingStarted && !IsInCall)
|
||||
UsageTracker.EndDeviceUsage();
|
||||
}
|
||||
}
|
||||
|
||||
#region IHasDialer Members
|
||||
|
||||
/// <inheritdoc />
|
||||
public abstract void Dial(string number);
|
||||
|
||||
/// <inheritdoc />
|
||||
public abstract void EndCall(CodecActiveCallItem activeCall);
|
||||
|
||||
/// <inheritdoc />
|
||||
public abstract void EndAllCalls();
|
||||
|
||||
/// <inheritdoc />
|
||||
public abstract void AcceptCall(CodecActiveCallItem item);
|
||||
|
||||
/// <inheritdoc />
|
||||
public abstract void RejectCall(CodecActiveCallItem item);
|
||||
|
||||
/// <inheritdoc />
|
||||
public abstract void SendDtmf(string digit);
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
// In most cases only a single call can be active
|
||||
public List<CodecActiveCallItem> ActiveCalls { get; set; }
|
||||
|
||||
public AudioCodecBase(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
ActiveCalls = new List<CodecActiveCallItem>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper method to fire CallStatusChange event with old and new status
|
||||
/// </summary>
|
||||
protected void SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus newStatus, CodecActiveCallItem call)
|
||||
{
|
||||
call.Status = newStatus;
|
||||
|
||||
OnCallStatusChange(call);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="previousStatus"></param>
|
||||
/// <param name="newStatus"></param>
|
||||
/// <param name="item"></param>
|
||||
protected void OnCallStatusChange(CodecActiveCallItem item)
|
||||
{
|
||||
var handler = CallStatusChange;
|
||||
if (handler != null)
|
||||
handler(this, new CodecCallStatusItemChangeEventArgs(item));
|
||||
|
||||
if (UsageTracker != null)
|
||||
{
|
||||
if (IsInCall && !UsageTracker.UsageTrackingStarted)
|
||||
UsageTracker.StartDeviceUsage();
|
||||
else if (UsageTracker.UsageTrackingStarted && !IsInCall)
|
||||
UsageTracker.EndDeviceUsage();
|
||||
}
|
||||
}
|
||||
|
||||
#region IHasDialer Members
|
||||
|
||||
public abstract void Dial(string number);
|
||||
|
||||
public abstract void EndCall(CodecActiveCallItem activeCall);
|
||||
|
||||
public abstract void EndAllCalls();
|
||||
|
||||
public abstract void AcceptCall(CodecActiveCallItem item);
|
||||
|
||||
public abstract void RejectCall(CodecActiveCallItem item);
|
||||
|
||||
public abstract void SendDtmf(string digit);
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
@ -1,24 +1,18 @@
|
|||
namespace PepperDash.Essentials.Devices.Common.AudioCodec
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements a common set of data about a codec
|
||||
/// </summary>
|
||||
public interface IAudioCodecInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the codec information
|
||||
/// </summary>
|
||||
AudioCodecInfo CodecInfo { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stores general information about a codec
|
||||
/// </summary>
|
||||
public abstract class AudioCodecInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the phone number
|
||||
/// </summary>
|
||||
public abstract string PhoneNumber { get; set; }
|
||||
}
|
||||
namespace PepperDash.Essentials.Devices.Common.AudioCodec;
|
||||
|
||||
/// <summary>
|
||||
/// Implements a common set of data about a codec
|
||||
/// </summary>
|
||||
public interface IAudioCodecInfo
|
||||
{
|
||||
AudioCodecInfo CodecInfo { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stores general information about a codec
|
||||
/// </summary>
|
||||
public abstract class AudioCodecInfo
|
||||
{
|
||||
public abstract string PhoneNumber { get; set; }
|
||||
}
|
||||
|
|
@ -1,17 +1,14 @@
|
|||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.AudioCodec
|
||||
namespace PepperDash.Essentials.Devices.Common.AudioCodec;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for devices that have an audio codec.
|
||||
/// </summary>
|
||||
public interface IHasAudioCodec:IHasInCallFeedback
|
||||
{
|
||||
/// <summary>
|
||||
/// For rooms that have audio codec
|
||||
/// Gets the audio codec device
|
||||
/// </summary>
|
||||
public interface IHasAudioCodec : IHasInCallFeedback
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the audio codec device
|
||||
/// </summary>
|
||||
AudioCodecBase AudioCodec { get; }
|
||||
|
||||
//List<PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem> ActiveCalls { get; }
|
||||
}
|
||||
AudioCodecBase AudioCodec { get; }
|
||||
}
|
||||
|
|
@ -6,169 +6,121 @@ using PepperDash.Essentials.Core.Config;
|
|||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using Serilog.Events;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.AudioCodec
|
||||
namespace PepperDash.Essentials.Devices.Common.AudioCodec;
|
||||
|
||||
public class MockAC : AudioCodecBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a MockAC
|
||||
/// </summary>
|
||||
public class MockAC : AudioCodecBase
|
||||
public MockAC(string key, string name, MockAcPropertiesConfig props)
|
||||
: base(key, name)
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor for MockAC
|
||||
/// </summary>
|
||||
/// <param name="key">Device key</param>
|
||||
/// <param name="name">Device name</param>
|
||||
/// <param name="props">MockAC properties configuration</param>
|
||||
public MockAC(string key, string name, MockAcPropertiesConfig props)
|
||||
: base(key, name)
|
||||
{
|
||||
CodecInfo = new MockAudioCodecInfo();
|
||||
CodecInfo = new MockAudioCodecInfo();
|
||||
|
||||
CodecInfo.PhoneNumber = props.PhoneNumber;
|
||||
}
|
||||
CodecInfo.PhoneNumber = props.PhoneNumber;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dial method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override void Dial(string number)
|
||||
public override void Dial(string number)
|
||||
{
|
||||
if (!IsInCall)
|
||||
{
|
||||
if (!IsInCall)
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Dial: {0}", number);
|
||||
var call = new CodecActiveCallItem()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Dial: {0}", number);
|
||||
var call = new CodecActiveCallItem()
|
||||
{
|
||||
Name = "Mock Outgoing Call",
|
||||
Number = number,
|
||||
Type = eCodecCallType.Audio,
|
||||
Status = eCodecCallStatus.Connected,
|
||||
Direction = eCodecCallDirection.Outgoing,
|
||||
Id = "mockAudioCall-1"
|
||||
};
|
||||
Name = "Mock Outgoing Call",
|
||||
Number = number,
|
||||
Type = eCodecCallType.Audio,
|
||||
Status = eCodecCallStatus.Connected,
|
||||
Direction = eCodecCallDirection.Outgoing,
|
||||
Id = "mockAudioCall-1"
|
||||
};
|
||||
|
||||
ActiveCalls.Add(call);
|
||||
|
||||
OnCallStatusChange(call);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Already in call. Cannot dial new call.");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// EndCall method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override void EndCall(CodecActiveCallItem call)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "EndCall");
|
||||
ActiveCalls.Remove(call);
|
||||
SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Disconnected, call);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// EndAllCalls method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override void EndAllCalls()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "EndAllCalls");
|
||||
for (int i = ActiveCalls.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var call = ActiveCalls[i];
|
||||
ActiveCalls.Remove(call);
|
||||
SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Disconnected, call);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// AcceptCall method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override void AcceptCall(CodecActiveCallItem call)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "AcceptCall");
|
||||
SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Connecting, call);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// RejectCall method
|
||||
/// </summary>
|
||||
public override void RejectCall(CodecActiveCallItem call)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "RejectCall");
|
||||
ActiveCalls.Remove(call);
|
||||
SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Disconnected, call);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SendDtmf method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override void SendDtmf(string s)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "BEEP BOOP SendDTMF: {0}", s);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TestIncomingAudioCall method
|
||||
/// </summary>
|
||||
/// <param name="number">Phone number to call from</param>
|
||||
public void TestIncomingAudioCall(string number)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "TestIncomingAudioCall from {0}", number);
|
||||
var call = new CodecActiveCallItem() { Name = number, Id = number, Number = number, Type = eCodecCallType.Audio, Direction = eCodecCallDirection.Incoming };
|
||||
ActiveCalls.Add(call);
|
||||
SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Ringing, call);
|
||||
}
|
||||
|
||||
OnCallStatusChange(call);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Already in call. Cannot dial new call.");
|
||||
}
|
||||
}
|
||||
|
||||
public override void EndCall(CodecActiveCallItem call)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "EndCall");
|
||||
ActiveCalls.Remove(call);
|
||||
SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Disconnected, call);
|
||||
}
|
||||
|
||||
public override void EndAllCalls()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "EndAllCalls");
|
||||
for (int i = ActiveCalls.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var call = ActiveCalls[i];
|
||||
ActiveCalls.Remove(call);
|
||||
SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Disconnected, call);
|
||||
}
|
||||
}
|
||||
|
||||
public override void AcceptCall(CodecActiveCallItem call)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "AcceptCall");
|
||||
SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Connecting, call);
|
||||
}
|
||||
|
||||
public override void RejectCall(CodecActiveCallItem call)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "RejectCall");
|
||||
ActiveCalls.Remove(call);
|
||||
SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Disconnected, call);
|
||||
}
|
||||
|
||||
public override void SendDtmf(string s)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "BEEP BOOP SendDTMF: {0}", s);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a MockAudioCodecInfo
|
||||
///
|
||||
/// </summary>
|
||||
public class MockAudioCodecInfo : AudioCodecInfo
|
||||
/// <param name="url"></param>
|
||||
public void TestIncomingAudioCall(string number)
|
||||
{
|
||||
string _phoneNumber;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string PhoneNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return _phoneNumber;
|
||||
}
|
||||
set
|
||||
{
|
||||
_phoneNumber = value;
|
||||
}
|
||||
}
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "TestIncomingAudioCall from {0}", number);
|
||||
var call = new CodecActiveCallItem() { Name = number, Id = number, Number = number, Type = eCodecCallType.Audio, Direction = eCodecCallDirection.Incoming };
|
||||
ActiveCalls.Add(call);
|
||||
SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Ringing, call);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a MockACFactory
|
||||
/// </summary>
|
||||
public class MockACFactory : EssentialsDeviceFactory<MockAC>
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor for MockACFactory
|
||||
/// </summary>
|
||||
public MockACFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "mockac" };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// BuildDevice method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
public class MockAudioCodecInfo : AudioCodecInfo
|
||||
{
|
||||
string _phoneNumber;
|
||||
|
||||
public override string PhoneNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new MockAc Device");
|
||||
var props = Newtonsoft.Json.JsonConvert.DeserializeObject<AudioCodec.MockAcPropertiesConfig>(dc.Properties.ToString());
|
||||
return new AudioCodec.MockAC(dc.Key, dc.Name, props);
|
||||
return _phoneNumber;
|
||||
}
|
||||
set
|
||||
{
|
||||
_phoneNumber = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class MockACFactory : EssentialsDeviceFactory<MockAC>
|
||||
{
|
||||
public MockACFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "mockac" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new MockAc Device");
|
||||
var props = Newtonsoft.Json.JsonConvert.DeserializeObject<AudioCodec.MockAcPropertiesConfig>(dc.Properties.ToString());
|
||||
return new AudioCodec.MockAC(dc.Key, dc.Name, props);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +1,9 @@
|
|||
using Newtonsoft.Json;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.AudioCodec
|
||||
namespace PepperDash.Essentials.Devices.Common.AudioCodec;
|
||||
|
||||
public class MockAcPropertiesConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a MockAcPropertiesConfig
|
||||
/// </summary>
|
||||
public class MockAcPropertiesConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the PhoneNumber
|
||||
/// </summary>
|
||||
[JsonProperty("phoneNumber")]
|
||||
public string PhoneNumber { get; set; }
|
||||
}
|
||||
[JsonProperty("phoneNumber")]
|
||||
public string PhoneNumber { get; set; }
|
||||
}
|
||||
|
|
@ -13,337 +13,266 @@ using PepperDash.Essentials.Core.Devices;
|
|||
using PepperDash.Essentials.Core.Presets;
|
||||
using Serilog.Events;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Cameras
|
||||
namespace PepperDash.Essentials.Devices.Common.Cameras;
|
||||
|
||||
public enum eCameraCapabilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Enumeration of eCameraCapabilities values
|
||||
/// </summary>
|
||||
public enum eCameraCapabilities
|
||||
None = 0,
|
||||
Pan = 1,
|
||||
Tilt = 2,
|
||||
Zoom = 4,
|
||||
Focus = 8
|
||||
}
|
||||
|
||||
public abstract class CameraBase : ReconfigurableDevice, IRoutingOutputs
|
||||
{
|
||||
[JsonProperty("controlMode", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public eCameraControlMode ControlMode { get; protected set; }
|
||||
|
||||
#region IRoutingOutputs Members
|
||||
|
||||
[JsonIgnore]
|
||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
[JsonProperty("canPan", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool CanPan
|
||||
{
|
||||
/// <summary>
|
||||
/// No camera capabilities
|
||||
/// </summary>
|
||||
None = 0,
|
||||
/// <summary>
|
||||
/// Camera supports pan movement
|
||||
/// </summary>
|
||||
Pan = 1,
|
||||
/// <summary>
|
||||
/// Camera supports tilt movement
|
||||
/// </summary>
|
||||
Tilt = 2,
|
||||
/// <summary>
|
||||
/// Camera supports zoom functionality
|
||||
/// </summary>
|
||||
Zoom = 4,
|
||||
/// <summary>
|
||||
/// Camera supports focus adjustment
|
||||
/// </summary>
|
||||
Focus = 8
|
||||
get
|
||||
{
|
||||
return (Capabilities & eCameraCapabilities.Pan) == eCameraCapabilities.Pan;
|
||||
}
|
||||
}
|
||||
[JsonProperty("canTilt", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool CanTilt
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Capabilities & eCameraCapabilities.Tilt) == eCameraCapabilities.Tilt;
|
||||
}
|
||||
}
|
||||
[JsonProperty("canZoom", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool CanZoom
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Capabilities & eCameraCapabilities.Zoom) == eCameraCapabilities.Zoom;
|
||||
}
|
||||
}
|
||||
[JsonProperty("canFocus", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool CanFocus
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Capabilities & eCameraCapabilities.Focus) == eCameraCapabilities.Focus;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Abstract base class for camera devices that provides common camera functionality and capabilities
|
||||
/// </summary>
|
||||
public abstract class CameraBase : ReconfigurableDevice, IRoutingOutputs
|
||||
// A bitmasked value to indicate the movement capabilites of this camera
|
||||
protected eCameraCapabilities Capabilities { get; set; }
|
||||
|
||||
protected CameraBase(DeviceConfig config) : base(config)
|
||||
{
|
||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
|
||||
|
||||
ControlMode = eCameraControlMode.Manual;
|
||||
|
||||
}
|
||||
|
||||
protected CameraBase(string key, string name) :
|
||||
this (new DeviceConfig{Name = name, Key = key})
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the ControlMode
|
||||
/// </summary>
|
||||
[JsonProperty("controlMode", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public eCameraControlMode ControlMode { get; protected set; }
|
||||
|
||||
}
|
||||
|
||||
#region IRoutingOutputs Members
|
||||
protected void LinkCameraToApi(CameraBase cameraDevice, BasicTriList trilist, uint joinStart, string joinMapKey,
|
||||
EiscApiAdvanced bridge)
|
||||
{
|
||||
CameraControllerJoinMap joinMap = new CameraControllerJoinMap(joinStart);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the OutputPorts
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this camera supports pan movement
|
||||
/// </summary>
|
||||
[JsonProperty("canPan", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool CanPan
|
||||
if (bridge != null)
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Capabilities & eCameraCapabilities.Pan) == eCameraCapabilities.Pan;
|
||||
}
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Information, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this camera supports tilt movement
|
||||
/// </summary>
|
||||
[JsonProperty("canTilt", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool CanTilt
|
||||
var customJoins = JoinMapHelper.TryGetJoinMapAdvancedForDevice(joinMapKey);
|
||||
|
||||
if (customJoins != null)
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Capabilities & eCameraCapabilities.Tilt) == eCameraCapabilities.Tilt;
|
||||
}
|
||||
joinMap.SetCustomJoinData(customJoins);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this camera supports zoom functionality
|
||||
/// </summary>
|
||||
[JsonProperty("canZoom", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool CanZoom
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
Debug.LogMessage(LogEventLevel.Information, "Linking to Bridge Type {0}", cameraDevice.GetType().Name.ToString());
|
||||
|
||||
var commMonitor = cameraDevice as ICommunicationMonitor;
|
||||
commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(
|
||||
trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
|
||||
|
||||
var ptzCamera = cameraDevice as IHasCameraPtzControl;
|
||||
|
||||
if (ptzCamera != null)
|
||||
{
|
||||
get
|
||||
trilist.SetBoolSigAction(joinMap.PanLeft.JoinNumber, (b) =>
|
||||
{
|
||||
return (Capabilities & eCameraCapabilities.Zoom) == eCameraCapabilities.Zoom;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this camera supports focus adjustment
|
||||
/// </summary>
|
||||
[JsonProperty("canFocus", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool CanFocus
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Capabilities & eCameraCapabilities.Focus) == eCameraCapabilities.Focus;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a bitmasked value to indicate the movement capabilities of this camera
|
||||
/// </summary>
|
||||
protected eCameraCapabilities Capabilities { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CameraBase class with the specified device configuration
|
||||
/// </summary>
|
||||
/// <param name="config">The device configuration</param>
|
||||
protected CameraBase(DeviceConfig config) : base(config)
|
||||
{
|
||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
|
||||
|
||||
ControlMode = eCameraControlMode.Manual;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CameraBase class with the specified key and name
|
||||
/// </summary>
|
||||
/// <param name="key">The unique key for this camera device</param>
|
||||
/// <param name="name">The friendly name for this camera device</param>
|
||||
protected CameraBase(string key, string name) :
|
||||
this(new DeviceConfig { Name = name, Key = key })
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Links the camera device to the API bridge for control and feedback
|
||||
/// </summary>
|
||||
/// <param name="cameraDevice">The camera device to link</param>
|
||||
/// <param name="trilist">The trilist for communication</param>
|
||||
/// <param name="joinStart">The starting join number for the camera controls</param>
|
||||
/// <param name="joinMapKey">The join map key for custom join mappings</param>
|
||||
/// <param name="bridge">The EiscApiAdvanced bridge for advanced join mapping</param>
|
||||
protected void LinkCameraToApi(CameraBase cameraDevice, BasicTriList trilist, uint joinStart, string joinMapKey,
|
||||
EiscApiAdvanced bridge)
|
||||
{
|
||||
CameraControllerJoinMap joinMap = new CameraControllerJoinMap(joinStart);
|
||||
|
||||
if (bridge != null)
|
||||
{
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Information, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
|
||||
}
|
||||
|
||||
var customJoins = JoinMapHelper.TryGetJoinMapAdvancedForDevice(joinMapKey);
|
||||
|
||||
if (customJoins != null)
|
||||
{
|
||||
joinMap.SetCustomJoinData(customJoins);
|
||||
}
|
||||
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
Debug.LogMessage(LogEventLevel.Information, "Linking to Bridge Type {0}", cameraDevice.GetType().Name.ToString());
|
||||
|
||||
var commMonitor = cameraDevice as ICommunicationMonitor;
|
||||
commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(
|
||||
trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
|
||||
|
||||
var ptzCamera = cameraDevice as IHasCameraPtzControl;
|
||||
|
||||
if (ptzCamera != null)
|
||||
{
|
||||
trilist.SetBoolSigAction(joinMap.PanLeft.JoinNumber, (b) =>
|
||||
if (b)
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
ptzCamera.PanLeft();
|
||||
}
|
||||
else
|
||||
{
|
||||
ptzCamera.PanStop();
|
||||
}
|
||||
});
|
||||
trilist.SetBoolSigAction(joinMap.PanRight.JoinNumber, (b) =>
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
ptzCamera.PanRight();
|
||||
}
|
||||
else
|
||||
{
|
||||
ptzCamera.PanStop();
|
||||
}
|
||||
});
|
||||
|
||||
trilist.SetBoolSigAction(joinMap.TiltUp.JoinNumber, (b) =>
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
ptzCamera.TiltUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
ptzCamera.TiltStop();
|
||||
}
|
||||
});
|
||||
trilist.SetBoolSigAction(joinMap.TiltDown.JoinNumber, (b) =>
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
ptzCamera.TiltDown();
|
||||
}
|
||||
else
|
||||
{
|
||||
ptzCamera.TiltStop();
|
||||
}
|
||||
});
|
||||
|
||||
trilist.SetBoolSigAction(joinMap.ZoomIn.JoinNumber, (b) =>
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
ptzCamera.ZoomIn();
|
||||
}
|
||||
else
|
||||
{
|
||||
ptzCamera.ZoomStop();
|
||||
}
|
||||
});
|
||||
|
||||
trilist.SetBoolSigAction(joinMap.ZoomOut.JoinNumber, (b) =>
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
ptzCamera.ZoomOut();
|
||||
}
|
||||
else
|
||||
{
|
||||
ptzCamera.ZoomStop();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var powerCamera = cameraDevice as IHasPowerControl;
|
||||
if (powerCamera != null)
|
||||
{
|
||||
trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, () => powerCamera.PowerOn());
|
||||
trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, () => powerCamera.PowerOff());
|
||||
|
||||
var powerFbCamera = powerCamera as IHasPowerControlWithFeedback;
|
||||
if (powerFbCamera != null)
|
||||
{
|
||||
powerFbCamera.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn.JoinNumber]);
|
||||
powerFbCamera.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff.JoinNumber]);
|
||||
ptzCamera.PanLeft();
|
||||
}
|
||||
}
|
||||
|
||||
if (cameraDevice is ICommunicationMonitor)
|
||||
{
|
||||
var monitoredCamera = cameraDevice as ICommunicationMonitor;
|
||||
monitoredCamera.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(
|
||||
trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
|
||||
}
|
||||
|
||||
if (cameraDevice is IHasCameraPresets)
|
||||
{
|
||||
// Set the preset lables when they change
|
||||
var presetsCamera = cameraDevice as IHasCameraPresets;
|
||||
presetsCamera.PresetsListHasChanged += new EventHandler<EventArgs>((o, a) =>
|
||||
else
|
||||
{
|
||||
SendCameraPresetNamesToApi(presetsCamera, joinMap, trilist);
|
||||
ptzCamera.PanStop();
|
||||
}
|
||||
});
|
||||
trilist.SetBoolSigAction(joinMap.PanRight.JoinNumber, (b) =>
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
ptzCamera.PanRight();
|
||||
}
|
||||
else
|
||||
{
|
||||
ptzCamera.PanStop();
|
||||
}
|
||||
});
|
||||
|
||||
trilist.SetBoolSigAction(joinMap.TiltUp.JoinNumber, (b) =>
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
ptzCamera.TiltUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
ptzCamera.TiltStop();
|
||||
}
|
||||
});
|
||||
trilist.SetBoolSigAction(joinMap.TiltDown.JoinNumber, (b) =>
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
ptzCamera.TiltDown();
|
||||
}
|
||||
else
|
||||
{
|
||||
ptzCamera.TiltStop();
|
||||
}
|
||||
});
|
||||
|
||||
trilist.SetBoolSigAction(joinMap.ZoomIn.JoinNumber, (b) =>
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
ptzCamera.ZoomIn();
|
||||
}
|
||||
else
|
||||
{
|
||||
ptzCamera.ZoomStop();
|
||||
}
|
||||
});
|
||||
|
||||
trilist.SetBoolSigAction(joinMap.ZoomOut.JoinNumber, (b) =>
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
ptzCamera.ZoomOut();
|
||||
}
|
||||
else
|
||||
{
|
||||
ptzCamera.ZoomStop();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var powerCamera = cameraDevice as IHasPowerControl;
|
||||
if (powerCamera != null)
|
||||
{
|
||||
trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, () => powerCamera.PowerOn());
|
||||
trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, () => powerCamera.PowerOff());
|
||||
|
||||
var powerFbCamera = powerCamera as IHasPowerControlWithFeedback;
|
||||
if (powerFbCamera != null)
|
||||
{
|
||||
powerFbCamera.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn.JoinNumber]);
|
||||
powerFbCamera.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff.JoinNumber]);
|
||||
}
|
||||
}
|
||||
|
||||
if (cameraDevice is ICommunicationMonitor)
|
||||
{
|
||||
var monitoredCamera = cameraDevice as ICommunicationMonitor;
|
||||
monitoredCamera.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(
|
||||
trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
|
||||
}
|
||||
|
||||
if (cameraDevice is IHasCameraPresets)
|
||||
{
|
||||
// Set the preset lables when they change
|
||||
var presetsCamera = cameraDevice as IHasCameraPresets;
|
||||
presetsCamera.PresetsListHasChanged += new EventHandler<EventArgs>((o, a) =>
|
||||
{
|
||||
SendCameraPresetNamesToApi(presetsCamera, joinMap, trilist);
|
||||
});
|
||||
|
||||
SendCameraPresetNamesToApi(presetsCamera, joinMap, trilist);
|
||||
|
||||
for (int i = 0; i < joinMap.PresetRecallStart.JoinSpan; i++)
|
||||
{
|
||||
int tempNum = i;
|
||||
|
||||
trilist.SetSigTrueAction((ushort) (joinMap.PresetRecallStart.JoinNumber + tempNum), () =>
|
||||
{
|
||||
presetsCamera.PresetSelect(tempNum);
|
||||
});
|
||||
trilist.SetSigTrueAction((ushort) (joinMap.PresetSaveStart.JoinNumber + tempNum), () =>
|
||||
{
|
||||
var label = trilist.GetString((ushort) (joinMap.PresetLabelStart.JoinNumber + tempNum));
|
||||
|
||||
presetsCamera.PresetStore(tempNum, label);
|
||||
});
|
||||
}
|
||||
trilist.OnlineStatusChange += (sender, args) =>
|
||||
{
|
||||
if (!args.DeviceOnLine)
|
||||
{ return; }
|
||||
|
||||
SendCameraPresetNamesToApi(presetsCamera, joinMap, trilist);
|
||||
};
|
||||
|
||||
for (int i = 0; i < joinMap.PresetRecallStart.JoinSpan; i++)
|
||||
{
|
||||
int tempNum = i;
|
||||
|
||||
trilist.SetSigTrueAction((ushort)(joinMap.PresetRecallStart.JoinNumber + tempNum), () =>
|
||||
{
|
||||
presetsCamera.PresetSelect(tempNum);
|
||||
});
|
||||
trilist.SetSigTrueAction((ushort)(joinMap.PresetSaveStart.JoinNumber + tempNum), () =>
|
||||
{
|
||||
var label = trilist.GetString((ushort)(joinMap.PresetLabelStart.JoinNumber + tempNum));
|
||||
|
||||
presetsCamera.PresetStore(tempNum, label);
|
||||
});
|
||||
}
|
||||
trilist.OnlineStatusChange += (sender, args) =>
|
||||
{
|
||||
if (!args.DeviceOnLine)
|
||||
{ return; }
|
||||
|
||||
SendCameraPresetNamesToApi(presetsCamera, joinMap, trilist);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
private void SendCameraPresetNamesToApi(IHasCameraPresets presetsCamera, CameraControllerJoinMap joinMap, BasicTriList trilist)
|
||||
{
|
||||
for (int i = 1; i <= joinMap.NumberOfPresets.JoinNumber; i++)
|
||||
{
|
||||
int tempNum = i - 1;
|
||||
|
||||
string label = "";
|
||||
|
||||
var preset = presetsCamera.Presets.FirstOrDefault(p => p.ID.Equals(i));
|
||||
|
||||
if (preset != null)
|
||||
label = preset.Description;
|
||||
|
||||
trilist.SetString((ushort)(joinMap.PresetLabelStart.JoinNumber + tempNum), label);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Represents a CameraPreset
|
||||
/// </summary>
|
||||
public class CameraPreset : PresetBase
|
||||
private void SendCameraPresetNamesToApi(IHasCameraPresets presetsCamera, CameraControllerJoinMap joinMap, BasicTriList trilist)
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CameraPreset class
|
||||
/// </summary>
|
||||
/// <param name="id">The preset ID</param>
|
||||
/// <param name="description">The preset description</param>
|
||||
/// <param name="isDefined">Whether the preset is defined</param>
|
||||
/// <param name="isDefinable">Whether the preset can be defined</param>
|
||||
public CameraPreset(int id, string description, bool isDefined, bool isDefinable)
|
||||
: base(id, description, isDefined, isDefinable)
|
||||
for (int i = 1; i <= joinMap.NumberOfPresets.JoinNumber; i++)
|
||||
{
|
||||
int tempNum = i - 1;
|
||||
|
||||
string label = "";
|
||||
|
||||
var preset = presetsCamera.Presets.FirstOrDefault(p => p.ID.Equals(i));
|
||||
|
||||
if (preset != null)
|
||||
label = preset.Description;
|
||||
|
||||
trilist.SetString((ushort)(joinMap.PresetLabelStart.JoinNumber + tempNum), label);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class CameraPreset : PresetBase
|
||||
{
|
||||
public CameraPreset(int id, string description, bool isDefined, bool isDefinable)
|
||||
: base(id, description, isDefined, isDefinable)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -361,22 +290,12 @@ namespace PepperDash.Essentials.Devices.Common.Cameras
|
|||
/// </summary>
|
||||
public ControlPropertiesConfig Control { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the SupportsAutoMode
|
||||
/// </summary>
|
||||
[JsonProperty("supportsAutoMode")]
|
||||
public bool SupportsAutoMode { get; set; }
|
||||
[JsonProperty("supportsAutoMode")]
|
||||
public bool SupportsAutoMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the SupportsOffMode
|
||||
/// </summary>
|
||||
[JsonProperty("supportsOffMode")]
|
||||
public bool SupportsOffMode { get; set; }
|
||||
[JsonProperty("supportsOffMode")]
|
||||
public bool SupportsOffMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Presets
|
||||
/// </summary>
|
||||
[JsonProperty("presets")]
|
||||
public List<CameraPreset> Presets { get; set; }
|
||||
}
|
||||
}
|
||||
[JsonProperty("presets")]
|
||||
public List<CameraPreset> Presets { get; set; }
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,34 +1,34 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Cameras
|
||||
namespace PepperDash.Essentials.Devices.Common.Cameras;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Describes a camera with preset functionality
|
||||
/// </summary>
|
||||
public interface IHasCameraPresets
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes a camera with preset functionality
|
||||
/// Event that is raised when the presets list has changed
|
||||
/// </summary>
|
||||
public interface IHasCameraPresets
|
||||
{
|
||||
/// <summary>
|
||||
/// Event that is raised when the presets list has changed
|
||||
/// </summary>
|
||||
event EventHandler<EventArgs> PresetsListHasChanged;
|
||||
event EventHandler<EventArgs> PresetsListHasChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of camera presets
|
||||
/// </summary>
|
||||
List<CameraPreset> Presets { get; }
|
||||
/// <summary>
|
||||
/// Gets the list of camera presets
|
||||
/// </summary>
|
||||
List<CameraPreset> Presets { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Selects the specified preset
|
||||
/// </summary>
|
||||
/// <param name="preset">The preset number to select</param>
|
||||
void PresetSelect(int preset);
|
||||
/// <summary>
|
||||
/// Selects the specified preset
|
||||
/// </summary>
|
||||
/// <param name="preset">The preset number to select</param>
|
||||
void PresetSelect(int preset);
|
||||
|
||||
/// <summary>
|
||||
/// Stores a preset at the specified location with the given description
|
||||
/// </summary>
|
||||
/// <param name="preset">The preset number to store</param>
|
||||
/// <param name="description">The description for the preset</param>
|
||||
void PresetStore(int preset, string description);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Stores a preset at the specified location with the given description
|
||||
/// </summary>
|
||||
/// <param name="preset">The preset number to store</param>
|
||||
/// <param name="description">The description for the preset</param>
|
||||
void PresetStore(int preset, string description);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,90 +1,89 @@
|
|||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec.Cisco
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec.Cisco;
|
||||
|
||||
/// <summary>
|
||||
/// Describes the available tracking modes for a Cisco codec's Presenter Track feature.
|
||||
/// </summary>
|
||||
public enum ePresenterTrackMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes the available tracking modes for a Cisco codec's Presenter Track feature.
|
||||
/// Presenter Track is turned off.
|
||||
/// </summary>
|
||||
public enum ePresenterTrackMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Presenter Track is turned off.
|
||||
/// </summary>
|
||||
Off,
|
||||
/// <summary>
|
||||
/// Presenter Track follows the speaker's movements.
|
||||
/// </summary>
|
||||
Follow,
|
||||
/// <summary>
|
||||
/// Presenter Track is set to background mode, where it tracks the speaker but does not actively follow.
|
||||
/// </summary>
|
||||
Background,
|
||||
/// <summary>
|
||||
/// Presenter Track is set to persistent mode, where it maintains a fixed position or focus on the speaker.
|
||||
/// </summary>
|
||||
Persistent
|
||||
}
|
||||
Off,
|
||||
/// <summary>
|
||||
/// Presenter Track follows the speaker's movements.
|
||||
/// </summary>
|
||||
Follow,
|
||||
/// <summary>
|
||||
/// Presenter Track is set to background mode, where it tracks the speaker but does not actively follow.
|
||||
/// </summary>
|
||||
Background,
|
||||
/// <summary>
|
||||
/// Presenter Track is set to persistent mode, where it maintains a fixed position or focus on the speaker.
|
||||
/// </summary>
|
||||
Persistent
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Describes the Presenter Track controls for a Cisco codec.
|
||||
/// </summary>
|
||||
public interface IPresenterTrack : IKeyed
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool PresenterTrackAvailability { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Describes the Presenter Track controls for a Cisco codec.
|
||||
/// Feedback indicating whether Presenter Track is available.
|
||||
/// </summary>
|
||||
public interface IPresenterTrack : IKeyed
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool PresenterTrackAvailability { get; }
|
||||
BoolFeedback PresenterTrackAvailableFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Feedback indicating whether Presenter Track is available.
|
||||
/// </summary>
|
||||
BoolFeedback PresenterTrackAvailableFeedback { get; }
|
||||
/// <summary>
|
||||
/// Feedback indicating the current status of Presenter Track is off
|
||||
/// </summary>
|
||||
BoolFeedback PresenterTrackStatusOffFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Feedback indicating the current status of Presenter Track is off
|
||||
/// </summary>
|
||||
BoolFeedback PresenterTrackStatusOffFeedback { get; }
|
||||
/// <summary>
|
||||
/// Feedback indicating the current status of Presenter Track is follow
|
||||
/// </summary>
|
||||
BoolFeedback PresenterTrackStatusFollowFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Feedback indicating the current status of Presenter Track is follow
|
||||
/// </summary>
|
||||
BoolFeedback PresenterTrackStatusFollowFeedback { get; }
|
||||
/// <summary>
|
||||
/// Feedback indicating the current status of Presenter Track is background
|
||||
/// </summary>
|
||||
BoolFeedback PresenterTrackStatusBackgroundFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Feedback indicating the current status of Presenter Track is background
|
||||
/// </summary>
|
||||
BoolFeedback PresenterTrackStatusBackgroundFeedback { get; }
|
||||
/// <summary>
|
||||
/// Feedback indicating the current status of Presenter Track is persistent
|
||||
/// </summary>
|
||||
BoolFeedback PresenterTrackStatusPersistentFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Feedback indicating the current status of Presenter Track is persistent
|
||||
/// </summary>
|
||||
BoolFeedback PresenterTrackStatusPersistentFeedback { get; }
|
||||
/// <summary>
|
||||
/// Indicates the current status of Presenter Track.
|
||||
/// </summary>
|
||||
bool PresenterTrackStatus { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates the current status of Presenter Track.
|
||||
/// </summary>
|
||||
bool PresenterTrackStatus { get; }
|
||||
/// <summary>
|
||||
/// Turns off Presenter Track.
|
||||
/// </summary>
|
||||
void PresenterTrackOff();
|
||||
|
||||
/// <summary>
|
||||
/// Turns off Presenter Track.
|
||||
/// </summary>
|
||||
void PresenterTrackOff();
|
||||
/// <summary>
|
||||
/// Turns on Presenter Track in follow mode.
|
||||
/// </summary>
|
||||
void PresenterTrackFollow();
|
||||
|
||||
/// <summary>
|
||||
/// Turns on Presenter Track in follow mode.
|
||||
/// </summary>
|
||||
void PresenterTrackFollow();
|
||||
/// <summary>
|
||||
/// Turns on Presenter Track in background mode.
|
||||
/// </summary>
|
||||
void PresenterTrackBackground();
|
||||
|
||||
/// <summary>
|
||||
/// Turns on Presenter Track in background mode.
|
||||
/// </summary>
|
||||
void PresenterTrackBackground();
|
||||
|
||||
/// <summary>
|
||||
/// Turns on Presenter Track in persistent mode.
|
||||
/// </summary>
|
||||
void PresenterTrackPersistent();
|
||||
}
|
||||
/// <summary>
|
||||
/// Turns on Presenter Track in persistent mode.
|
||||
/// </summary>
|
||||
void PresenterTrackPersistent();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,35 +1,34 @@
|
|||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec.Cisco
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec.Cisco;
|
||||
|
||||
/// <summary>
|
||||
/// Describes the available tracking modes for a Cisco codec
|
||||
/// </summary>
|
||||
public interface ISpeakerTrack : IKeyed
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes the available tracking modes for a Cisco codec
|
||||
/// Indicates whether Speaker Track is available on the codec.
|
||||
/// </summary>
|
||||
public interface ISpeakerTrack : IKeyed
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates whether Speaker Track is available on the codec.
|
||||
/// </summary>
|
||||
bool SpeakerTrackAvailability { get; }
|
||||
bool SpeakerTrackAvailability { get; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
BoolFeedback SpeakerTrackAvailableFeedback { get; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
BoolFeedback SpeakerTrackAvailableFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Feedback indicating the current status of Speaker Track is off
|
||||
/// </summary>
|
||||
bool SpeakerTrackStatus { get; }
|
||||
/// <summary>
|
||||
/// Feedback indicating the current status of Speaker Track is off
|
||||
/// </summary>
|
||||
bool SpeakerTrackStatus { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Turns Speaker Track off
|
||||
/// </summary>
|
||||
void SpeakerTrackOff();
|
||||
/// <summary>
|
||||
/// Turns Speaker Track on
|
||||
/// </summary>
|
||||
void SpeakerTrackOn();
|
||||
}
|
||||
/// <summary>
|
||||
/// Turns Speaker Track off
|
||||
/// </summary>
|
||||
void SpeakerTrackOff();
|
||||
/// <summary>
|
||||
/// Turns Speaker Track on
|
||||
/// </summary>
|
||||
void SpeakerTrackOn();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,105 +1,100 @@
|
|||
|
||||
|
||||
using System;
|
||||
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec;
|
||||
|
||||
/// <summary>
|
||||
/// Represents an active call item for a codec, including details such as name, number, type, status, direction, and duration.
|
||||
/// </summary>
|
||||
public class CodecActiveCallItem
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a CodecActiveCallItem
|
||||
/// The name associated with the call, if available.
|
||||
/// </summary>
|
||||
public class CodecActiveCallItem
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Name
|
||||
/// </summary>
|
||||
[JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Number
|
||||
/// </summary>
|
||||
[JsonProperty("number", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Number { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Type
|
||||
/// </summary>
|
||||
[JsonProperty("type", NullValueHandling = NullValueHandling.Ignore)]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public eCodecCallType Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Status
|
||||
/// </summary>
|
||||
[JsonProperty("status", NullValueHandling = NullValueHandling.Ignore)]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public eCodecCallStatus Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Direction
|
||||
/// </summary>
|
||||
[JsonProperty("direction", NullValueHandling = NullValueHandling.Ignore)]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public eCodecCallDirection Direction { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Id
|
||||
/// </summary>
|
||||
[JsonProperty("id", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the IsOnHold
|
||||
/// </summary>
|
||||
[JsonProperty("isOnHold", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool IsOnHold { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Duration
|
||||
/// </summary>
|
||||
[JsonProperty("duration", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public TimeSpan Duration { get; set; }
|
||||
|
||||
//public object CallMetaData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true when this call is any status other than
|
||||
/// Unknown, Disconnected, Disconnecting
|
||||
/// </summary>
|
||||
[JsonProperty("isActiveCall", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool IsActiveCall
|
||||
{
|
||||
get
|
||||
{
|
||||
return !(Status == eCodecCallStatus.Disconnected
|
||||
|| Status == eCodecCallStatus.Disconnecting
|
||||
|| Status == eCodecCallStatus.Idle
|
||||
|| Status == eCodecCallStatus.Unknown);
|
||||
}
|
||||
}
|
||||
}
|
||||
[JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Represents a CodecCallStatusItemChangeEventArgs
|
||||
/// The phone number associated with the call, if available.
|
||||
/// </summary>
|
||||
public class CodecCallStatusItemChangeEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the CallItem
|
||||
/// </summary>
|
||||
public CodecActiveCallItem CallItem { get; private set; }
|
||||
[JsonProperty("number", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Number { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CodecCallStatusItemChangeEventArgs class
|
||||
/// </summary>
|
||||
/// <param name="item">The call item that changed</param>
|
||||
public CodecCallStatusItemChangeEventArgs(CodecActiveCallItem item)
|
||||
/// <summary>
|
||||
/// The type of the call, such as audio or video. This is an optional property and may be null if the type is unknown or not applicable.
|
||||
/// </summary>
|
||||
[JsonProperty("type", NullValueHandling = NullValueHandling.Ignore)]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public eCodecCallType Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The current status of the call, such as active, on hold, or disconnected. This is an optional property and may be null if the status is unknown or not applicable.
|
||||
/// </summary>
|
||||
[JsonProperty("status", NullValueHandling = NullValueHandling.Ignore)]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public eCodecCallStatus Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The direction of the call, such as incoming or outgoing. This is an optional property and may be null if the direction is unknown or not applicable.
|
||||
/// </summary>
|
||||
[JsonProperty("direction", NullValueHandling = NullValueHandling.Ignore)]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public eCodecCallDirection Direction { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A unique identifier for the call, if available. This can be used to track the call across different events and status changes. This is an optional property and may be null if an identifier is not available or applicable.
|
||||
/// </summary>
|
||||
[JsonProperty("id", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the call is currently on hold. This is an optional property and may be null if the hold status is unknown or not applicable.
|
||||
/// </summary>
|
||||
[JsonProperty("isOnHold", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool IsOnHold { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The duration of the call, if available. This can be used to track how long the call has been active. This is an optional property and may be null if the duration is not available or applicable.
|
||||
/// </summary>
|
||||
[JsonProperty("duration", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public TimeSpan Duration { get; set; }
|
||||
|
||||
//public object CallMetaData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true when this call is any status other than
|
||||
/// Unknown, Disconnected, Disconnecting
|
||||
/// </summary>
|
||||
[JsonProperty("isActiveCall", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool IsActiveCall
|
||||
{
|
||||
get
|
||||
{
|
||||
CallItem = item;
|
||||
return !(Status == eCodecCallStatus.Disconnected
|
||||
|| Status == eCodecCallStatus.Disconnecting
|
||||
|| Status == eCodecCallStatus.Idle
|
||||
|| Status == eCodecCallStatus.Unknown);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event args for when a call status changes, includes the call item with updated status and details.
|
||||
/// </summary>
|
||||
public class CodecCallStatusItemChangeEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// The call item that has changed status, including its updated status and details. This property is read-only and is set through the constructor when the event args are created.
|
||||
/// </summary>
|
||||
public CodecActiveCallItem CallItem { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for CodecCallStatusItemChangeEventArgs
|
||||
/// </summary>
|
||||
/// <param name="item">The call item that has changed status.</param>
|
||||
public CodecCallStatusItemChangeEventArgs(CodecActiveCallItem item)
|
||||
{
|
||||
CallItem = item;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +1,20 @@
|
|||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for devices that have call hold functionality
|
||||
/// </summary>
|
||||
public interface IHasCallHold
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the contract for IHasCallHold
|
||||
/// Put the specified call on hold
|
||||
/// </summary>
|
||||
public interface IHasCallHold
|
||||
{
|
||||
/// <summary>
|
||||
/// Put the specified call on hold
|
||||
/// </summary>
|
||||
/// <param name="activeCall"></param>
|
||||
void HoldCall(CodecActiveCallItem activeCall);
|
||||
/// <param name="activeCall">The call to put on hold</param>
|
||||
void HoldCall(CodecActiveCallItem activeCall);
|
||||
|
||||
/// <summary>
|
||||
/// Resume the specified call
|
||||
/// </summary>
|
||||
/// <param name="activeCall"></param>
|
||||
void ResumeCall(CodecActiveCallItem activeCall);
|
||||
}
|
||||
/// <summary>
|
||||
/// Resume the specified call
|
||||
/// </summary>
|
||||
/// <param name="activeCall">The call to resume</param>
|
||||
void ResumeCall(CodecActiveCallItem activeCall);
|
||||
}
|
||||
|
|
@ -1,42 +1,41 @@
|
|||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec;
|
||||
|
||||
/// <summary>
|
||||
/// Describes a device that has Do Not Disturb mode capability
|
||||
/// </summary>
|
||||
public interface IHasDoNotDisturbMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes a device that has Do Not Disturb mode capability
|
||||
/// Indictes whether Do Not Disturb mode is on (Activated)
|
||||
/// </summary>
|
||||
public interface IHasDoNotDisturbMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Indictes whether Do Not Disturb mode is on (Activated)
|
||||
/// </summary>
|
||||
BoolFeedback DoNotDisturbModeIsOnFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Activates Do Not Disturb mode
|
||||
/// </summary>
|
||||
void ActivateDoNotDisturbMode();
|
||||
|
||||
/// <summary>
|
||||
/// Deactivates Do Not Disturb mode
|
||||
/// </summary>
|
||||
void DeactivateDoNotDisturbMode();
|
||||
|
||||
/// <summary>
|
||||
/// Toggles Do Not Disturb mode
|
||||
/// </summary>
|
||||
void ToggleDoNotDisturbMode();
|
||||
}
|
||||
BoolFeedback DoNotDisturbModeIsOnFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for devices that support Do Not Disturb mode with timeout functionality
|
||||
/// Activates Do Not Disturb mode
|
||||
/// </summary>
|
||||
public interface IHasDoNotDisturbModeWithTimeout : IHasDoNotDisturbMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Activates Do Not Disturb mode with a timeout
|
||||
/// </summary>
|
||||
/// <param name="timeout"></param>
|
||||
void ActivateDoNotDisturbMode(int timeout);
|
||||
}
|
||||
}
|
||||
void ActivateDoNotDisturbMode();
|
||||
|
||||
/// <summary>
|
||||
/// Deactivates Do Not Disturb mode
|
||||
/// </summary>
|
||||
void DeactivateDoNotDisturbMode();
|
||||
|
||||
/// <summary>
|
||||
/// Toggles Do Not Disturb mode
|
||||
/// </summary>
|
||||
void ToggleDoNotDisturbMode();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for devices that support Do Not Disturb mode with timeout functionality
|
||||
/// </summary>
|
||||
public interface IHasDoNotDisturbModeWithTimeout : IHasDoNotDisturbMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Activates Do Not Disturb mode with a timeout
|
||||
/// </summary>
|
||||
/// <param name="timeout"></param>
|
||||
void ActivateDoNotDisturbMode(int timeout);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,54 +1,54 @@
|
|||
using System;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec.Cisco;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for devices that support external source switching functionality
|
||||
/// </summary>
|
||||
public interface IHasExternalSourceSwitching
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the contract for IHasExternalSourceSwitching
|
||||
/// Gets a value indicating whether the external source list is enabled
|
||||
/// </summary>
|
||||
public interface IHasExternalSourceSwitching
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the external source list is enabled
|
||||
/// </summary>
|
||||
bool ExternalSourceListEnabled { get; }
|
||||
bool ExternalSourceListEnabled { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the external source input port identifier
|
||||
/// </summary>
|
||||
string ExternalSourceInputPort { get; }
|
||||
/// <summary>
|
||||
/// Gets the port name for external source input switching
|
||||
/// </summary>
|
||||
string ExternalSourceInputPort { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Adds an external source to the available sources
|
||||
/// </summary>
|
||||
/// <param name="connectorId">The connector identifier</param>
|
||||
/// <param name="key">The unique key for the source</param>
|
||||
/// <param name="name">The display name for the source</param>
|
||||
/// <param name="type">The type of external source</param>
|
||||
void AddExternalSource(string connectorId, string key, string name, eExternalSourceType type);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the state of the specified external source
|
||||
/// </summary>
|
||||
/// <param name="key">The unique key of the external source</param>
|
||||
/// <param name="mode">The mode to set for the source</param>
|
||||
void SetExternalSourceState(string key, eExternalSourceMode mode);
|
||||
/// <summary>
|
||||
/// Adds an external source to the list of available sources for switching
|
||||
/// </summary>
|
||||
/// <param name="connectorId"></param>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="type"></param>
|
||||
void AddExternalSource(string connectorId, string key, string name, eExternalSourceType type);
|
||||
|
||||
/// <summary>
|
||||
/// Clears all external sources from the list
|
||||
/// </summary>
|
||||
void ClearExternalSources();
|
||||
/// <summary>
|
||||
/// Sets the state of the specified external source
|
||||
/// </summary>
|
||||
/// <param name="key">The unique key of the external source</param>
|
||||
/// <param name="mode">The mode to set for the source</param>
|
||||
void SetExternalSourceState(string key, eExternalSourceMode mode);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the selected source by its key
|
||||
/// </summary>
|
||||
/// <param name="key">The unique key of the source to select</param>
|
||||
void SetSelectedSource(string key);
|
||||
/// <summary>
|
||||
/// Clears all external sources from the list
|
||||
/// </summary>
|
||||
void ClearExternalSources();
|
||||
|
||||
/// <summary>
|
||||
/// Sets the action to run when routing between sources
|
||||
/// </summary>
|
||||
Action<string, string> RunRouteAction { set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Sets the selected external source for switching
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
void SetSelectedSource(string key);
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Defines an action to run when an external source is selected for switching.
|
||||
/// The action takes the key and name of the selected source as parameters.
|
||||
/// </summary>
|
||||
Action<string, string> RunRouteAction { set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,57 +1,57 @@
|
|||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration of eCodecCallDirection values
|
||||
/// </summary>
|
||||
public enum eCodecCallDirection
|
||||
{
|
||||
/// <summary>
|
||||
/// Enumeration of eCodecCallDirection values
|
||||
/// Unknown call direction
|
||||
/// </summary>
|
||||
public enum eCodecCallDirection
|
||||
{
|
||||
/// <summary>
|
||||
/// Unknown call direction
|
||||
/// </summary>
|
||||
Unknown = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Incoming call direction
|
||||
/// </summary>
|
||||
Incoming,
|
||||
|
||||
/// <summary>
|
||||
/// Outgoing call direction
|
||||
/// </summary>
|
||||
Outgoing
|
||||
}
|
||||
Unknown = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Represents a CodecCallDirection
|
||||
/// Incoming call direction
|
||||
/// </summary>
|
||||
public class CodecCallDirection
|
||||
{
|
||||
/// <summary>
|
||||
/// Takes the Cisco call type and converts to the matching enum
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
/// <returns></returns>
|
||||
/// <summary>
|
||||
/// ConvertToDirectionEnum method
|
||||
/// </summary>
|
||||
public static eCodecCallDirection ConvertToDirectionEnum(string s)
|
||||
{
|
||||
switch (s.ToLower())
|
||||
{
|
||||
case "incoming":
|
||||
{
|
||||
return eCodecCallDirection.Incoming;
|
||||
}
|
||||
case "outgoing":
|
||||
{
|
||||
return eCodecCallDirection.Outgoing;
|
||||
}
|
||||
default:
|
||||
return eCodecCallDirection.Unknown;
|
||||
}
|
||||
Incoming,
|
||||
|
||||
/// <summary>
|
||||
/// Outgoing call direction
|
||||
/// </summary>
|
||||
Outgoing
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a CodecCallDirection
|
||||
/// </summary>
|
||||
public class CodecCallDirection
|
||||
{
|
||||
/// <summary>
|
||||
/// Takes the Cisco call type and converts to the matching enum
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
/// <returns></returns>
|
||||
/// <summary>
|
||||
/// ConvertToDirectionEnum method
|
||||
/// </summary>
|
||||
public static eCodecCallDirection ConvertToDirectionEnum(string s)
|
||||
{
|
||||
switch (s.ToLower())
|
||||
{
|
||||
case "incoming":
|
||||
{
|
||||
return eCodecCallDirection.Incoming;
|
||||
}
|
||||
case "outgoing":
|
||||
{
|
||||
return eCodecCallDirection.Outgoing;
|
||||
}
|
||||
default:
|
||||
return eCodecCallDirection.Unknown;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,139 +1,138 @@
|
|||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec;
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration of eCodecCallStatus values
|
||||
/// </summary>
|
||||
public enum eCodecCallStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// Enumeration of eCodecCallStatus values
|
||||
/// Unknown call status
|
||||
/// </summary>
|
||||
public enum eCodecCallStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// Unknown call status
|
||||
/// </summary>
|
||||
Unknown = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Call is connected
|
||||
/// </summary>
|
||||
Connected,
|
||||
|
||||
/// <summary>
|
||||
/// Call is connecting
|
||||
/// </summary>
|
||||
Connecting,
|
||||
|
||||
/// <summary>
|
||||
/// Call is dialing
|
||||
/// </summary>
|
||||
Dialing,
|
||||
|
||||
/// <summary>
|
||||
/// Call is disconnected
|
||||
/// </summary>
|
||||
Disconnected,
|
||||
|
||||
/// <summary>
|
||||
/// Call is disconnecting
|
||||
/// </summary>
|
||||
Disconnecting,
|
||||
|
||||
/// <summary>
|
||||
/// Early media is being sent/received
|
||||
/// </summary>
|
||||
EarlyMedia,
|
||||
|
||||
/// <summary>
|
||||
/// Call is idle
|
||||
/// </summary>
|
||||
Idle,
|
||||
|
||||
/// <summary>
|
||||
/// Call is on hold
|
||||
/// </summary>
|
||||
OnHold,
|
||||
|
||||
/// <summary>
|
||||
/// Call is ringing
|
||||
/// </summary>
|
||||
Ringing,
|
||||
|
||||
/// <summary>
|
||||
/// Call is preserved
|
||||
/// </summary>
|
||||
Preserved,
|
||||
|
||||
/// <summary>
|
||||
/// Call is remote preserved
|
||||
/// </summary>
|
||||
RemotePreserved,
|
||||
}
|
||||
|
||||
Unknown = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Represents a CodecCallStatus
|
||||
/// Call is connected
|
||||
/// </summary>
|
||||
public class CodecCallStatus
|
||||
Connected,
|
||||
|
||||
/// <summary>
|
||||
/// Call is connecting
|
||||
/// </summary>
|
||||
Connecting,
|
||||
|
||||
/// <summary>
|
||||
/// Call is dialing
|
||||
/// </summary>
|
||||
Dialing,
|
||||
|
||||
/// <summary>
|
||||
/// Call is disconnected
|
||||
/// </summary>
|
||||
Disconnected,
|
||||
|
||||
/// <summary>
|
||||
/// Call is disconnecting
|
||||
/// </summary>
|
||||
Disconnecting,
|
||||
|
||||
/// <summary>
|
||||
/// Early media is being sent/received
|
||||
/// </summary>
|
||||
EarlyMedia,
|
||||
|
||||
/// <summary>
|
||||
/// Call is idle
|
||||
/// </summary>
|
||||
Idle,
|
||||
|
||||
/// <summary>
|
||||
/// Call is on hold
|
||||
/// </summary>
|
||||
OnHold,
|
||||
|
||||
/// <summary>
|
||||
/// Call is ringing
|
||||
/// </summary>
|
||||
Ringing,
|
||||
|
||||
/// <summary>
|
||||
/// Call is preserved
|
||||
/// </summary>
|
||||
Preserved,
|
||||
|
||||
/// <summary>
|
||||
/// Call is remote preserved
|
||||
/// </summary>
|
||||
RemotePreserved,
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Represents a CodecCallStatus
|
||||
/// </summary>
|
||||
public class CodecCallStatus
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Takes the Cisco call type and converts to the matching enum
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
/// <returns></returns>
|
||||
/// <summary>
|
||||
/// ConvertToStatusEnum method
|
||||
/// </summary>
|
||||
public static eCodecCallStatus ConvertToStatusEnum(string s)
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Takes the Cisco call type and converts to the matching enum
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
/// <returns></returns>
|
||||
/// <summary>
|
||||
/// ConvertToStatusEnum method
|
||||
/// </summary>
|
||||
public static eCodecCallStatus ConvertToStatusEnum(string s)
|
||||
switch (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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,76 +1,75 @@
|
|||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration of eCodecCallType values
|
||||
/// </summary>
|
||||
public enum eCodecCallType
|
||||
{
|
||||
/// <summary>
|
||||
/// Enumeration of eCodecCallType values
|
||||
/// Unknown call type
|
||||
/// </summary>
|
||||
public enum eCodecCallType
|
||||
{
|
||||
/// <summary>
|
||||
/// Unknown call type
|
||||
/// </summary>
|
||||
Unknown = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Audio-only call type
|
||||
/// </summary>
|
||||
Audio,
|
||||
|
||||
/// <summary>
|
||||
/// Video call type
|
||||
/// </summary>
|
||||
Video,
|
||||
|
||||
/// <summary>
|
||||
/// Audio call that can be escalated to video
|
||||
/// </summary>
|
||||
AudioCanEscalate,
|
||||
|
||||
/// <summary>
|
||||
/// Forward all call type
|
||||
/// </summary>
|
||||
ForwardAllCall
|
||||
}
|
||||
Unknown = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Represents a CodecCallType
|
||||
/// Audio-only call type
|
||||
/// </summary>
|
||||
public class CodecCallType
|
||||
Audio,
|
||||
|
||||
/// <summary>
|
||||
/// Video call type
|
||||
/// </summary>
|
||||
Video,
|
||||
|
||||
/// <summary>
|
||||
/// Audio call that can be escalated to video
|
||||
/// </summary>
|
||||
AudioCanEscalate,
|
||||
|
||||
/// <summary>
|
||||
/// Forward all call type
|
||||
/// </summary>
|
||||
ForwardAllCall
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a CodecCallType
|
||||
/// </summary>
|
||||
public class CodecCallType
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Takes the Cisco call type and converts to the matching enum
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
/// <returns></returns>
|
||||
/// <summary>
|
||||
/// ConvertToTypeEnum method
|
||||
/// </summary>
|
||||
public static eCodecCallType ConvertToTypeEnum(string s)
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Takes the Cisco call type and converts to the matching enum
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
/// <returns></returns>
|
||||
/// <summary>
|
||||
/// ConvertToTypeEnum method
|
||||
/// </summary>
|
||||
public static eCodecCallType ConvertToTypeEnum(string s)
|
||||
switch (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;
|
||||
}
|
||||
|
||||
case "Audio":
|
||||
{
|
||||
return eCodecCallType.Audio;
|
||||
}
|
||||
case "Video":
|
||||
{
|
||||
return eCodecCallType.Video;
|
||||
}
|
||||
case "AudioCanEscalate":
|
||||
{
|
||||
return eCodecCallType.AudioCanEscalate;
|
||||
}
|
||||
case "ForwardAllCall":
|
||||
{
|
||||
return eCodecCallType.ForwardAllCall;
|
||||
}
|
||||
default:
|
||||
return eCodecCallType.Unknown;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,56 +1,55 @@
|
|||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec;
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration of eMeetingPrivacy values
|
||||
/// </summary>
|
||||
public enum eMeetingPrivacy
|
||||
{
|
||||
/// <summary>
|
||||
/// Enumeration of eMeetingPrivacy values
|
||||
/// Unknown meeting privacy level
|
||||
/// </summary>
|
||||
public enum eMeetingPrivacy
|
||||
{
|
||||
/// <summary>
|
||||
/// Unknown meeting privacy level
|
||||
/// </summary>
|
||||
Unknown = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Public meeting
|
||||
/// </summary>
|
||||
Public,
|
||||
|
||||
/// <summary>
|
||||
/// Private meeting
|
||||
/// </summary>
|
||||
Private
|
||||
}
|
||||
Unknown = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Represents a CodecCallPrivacy
|
||||
/// Public meeting
|
||||
/// </summary>
|
||||
public class CodecCallPrivacy
|
||||
{
|
||||
/// <summary>
|
||||
/// Takes the Cisco privacy type and converts to the matching enum
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
/// <returns></returns>
|
||||
/// <summary>
|
||||
/// ConvertToDirectionEnum method
|
||||
/// </summary>
|
||||
public static eMeetingPrivacy ConvertToDirectionEnum(string s)
|
||||
{
|
||||
switch (s.ToLower())
|
||||
{
|
||||
case "public":
|
||||
{
|
||||
return eMeetingPrivacy.Public;
|
||||
}
|
||||
case "private":
|
||||
{
|
||||
return eMeetingPrivacy.Private;
|
||||
}
|
||||
default:
|
||||
return eMeetingPrivacy.Unknown;
|
||||
}
|
||||
Public,
|
||||
|
||||
/// <summary>
|
||||
/// Private meeting
|
||||
/// </summary>
|
||||
Private
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a CodecCallPrivacy
|
||||
/// </summary>
|
||||
public class CodecCallPrivacy
|
||||
{
|
||||
/// <summary>
|
||||
/// Takes the Cisco privacy type and converts to the matching enum
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
/// <returns></returns>
|
||||
/// <summary>
|
||||
/// ConvertToDirectionEnum method
|
||||
/// </summary>
|
||||
public static eMeetingPrivacy ConvertToDirectionEnum(string s)
|
||||
{
|
||||
switch (s)
|
||||
{
|
||||
case "public":
|
||||
{
|
||||
return eMeetingPrivacy.Public;
|
||||
}
|
||||
case "private":
|
||||
{
|
||||
return eMeetingPrivacy.Private;
|
||||
}
|
||||
default:
|
||||
return eMeetingPrivacy.Unknown;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,12 +1,11 @@
|
|||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines minimum volume controls for a codec device with dialing capabilities
|
||||
/// </summary>
|
||||
public interface ICodecAudio : IBasicVolumeWithFeedback, IPrivacy
|
||||
{
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec;
|
||||
|
||||
/// <summary>
|
||||
/// Defines minimum volume controls for a codec device with dialing capabilities
|
||||
/// </summary>
|
||||
public interface ICodecAudio : IBasicVolumeWithFeedback, IPrivacy
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,34 +1,34 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IHasCallFavorites
|
||||
/// </summary>
|
||||
public interface IHasCallFavorites
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the contract for IHasCallFavorites
|
||||
/// Gets the call favorites for this device
|
||||
/// </summary>
|
||||
public interface IHasCallFavorites
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the call favorites for this device
|
||||
/// </summary>
|
||||
CodecCallFavorites CallFavorites { get; }
|
||||
}
|
||||
CodecCallFavorites CallFavorites { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a CodecCallFavorites
|
||||
/// </summary>
|
||||
public class CodecCallFavorites
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Favorites
|
||||
/// </summary>
|
||||
public List<CodecActiveCallItem> Favorites { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Represents a CodecCallFavorites
|
||||
/// Initializes a new instance of the CodecCallFavorites class
|
||||
/// </summary>
|
||||
public class CodecCallFavorites
|
||||
public CodecCallFavorites()
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Favorites
|
||||
/// </summary>
|
||||
public List<CodecActiveCallItem> Favorites { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CodecCallFavorites class
|
||||
/// </summary>
|
||||
public CodecCallFavorites()
|
||||
{
|
||||
Favorites = new List<CodecActiveCallItem>();
|
||||
}
|
||||
Favorites = new List<CodecActiveCallItem>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,188 +6,131 @@ using Newtonsoft.Json;
|
|||
using Newtonsoft.Json.Converters;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec;
|
||||
|
||||
|
||||
public interface IHasCallHistory
|
||||
{
|
||||
CodecCallHistory CallHistory { get; }
|
||||
|
||||
void RemoveCallHistoryEntry(CodecCallHistory.CallHistoryEntry entry);
|
||||
}
|
||||
|
||||
public enum eCodecOccurrenceType
|
||||
{
|
||||
Unknown = 0,
|
||||
Placed = 1,
|
||||
Received = 2,
|
||||
NoAnswer = 3,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the recent call history for a codec device
|
||||
/// </summary>
|
||||
public class CodecCallHistory
|
||||
{
|
||||
public event EventHandler<EventArgs> RecentCallsListHasChanged;
|
||||
|
||||
public List<CallHistoryEntry> RecentCalls { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IHasCallHistory
|
||||
/// Item that gets added to the list when there are no recent calls in history
|
||||
/// </summary>
|
||||
public interface IHasCallHistory
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the call history for this device
|
||||
/// </summary>
|
||||
CodecCallHistory CallHistory { get; }
|
||||
CallHistoryEntry ListEmptyEntry;
|
||||
|
||||
/// <summary>
|
||||
/// Removes the specified call history entry
|
||||
/// </summary>
|
||||
/// <param name="entry">The call history entry to remove</param>
|
||||
void RemoveCallHistoryEntry(CodecCallHistory.CallHistoryEntry entry);
|
||||
public CodecCallHistory()
|
||||
{
|
||||
ListEmptyEntry = new CallHistoryEntry() { Name = "No Recent Calls" };
|
||||
|
||||
RecentCalls = new List<CallHistoryEntry>();
|
||||
|
||||
RecentCalls.Add(ListEmptyEntry);
|
||||
}
|
||||
|
||||
void OnRecentCallsListChange()
|
||||
{
|
||||
var handler = RecentCallsListHasChanged;
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveEntry(CallHistoryEntry entry)
|
||||
{
|
||||
RecentCalls.Remove(entry);
|
||||
OnRecentCallsListChange();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration of eCodecOccurrenceType values
|
||||
/// Generic call history entry, not device specific
|
||||
/// </summary>
|
||||
public enum eCodecOccurrenceType
|
||||
public class CallHistoryEntry : CodecActiveCallItem
|
||||
{
|
||||
/// <summary>
|
||||
/// Unknown occurrence type
|
||||
/// </summary>
|
||||
Unknown = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Call was placed (outgoing)
|
||||
/// </summary>
|
||||
Placed = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Call was received (incoming)
|
||||
/// </summary>
|
||||
Received = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Call received no answer
|
||||
/// </summary>
|
||||
NoAnswer = 3,
|
||||
[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; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a CodecCallHistory
|
||||
/// Converts a list of call history entries returned by a Cisco codec to the generic list type
|
||||
/// </summary>
|
||||
public class CodecCallHistory
|
||||
/// <param name="entries"></param>
|
||||
/// <returns></returns>
|
||||
public void ConvertCiscoCallHistoryToGeneric(List<CiscoCallHistory.Entry> entries)
|
||||
{
|
||||
/// <summary>
|
||||
/// Event that is raised when the recent calls list has changed
|
||||
/// </summary>
|
||||
public event EventHandler<EventArgs> RecentCallsListHasChanged;
|
||||
var genericEntries = new List<CallHistoryEntry>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the RecentCalls
|
||||
/// </summary>
|
||||
public List<CallHistoryEntry> RecentCalls { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Item that gets added to the list when there are no recent calls in history
|
||||
/// </summary>
|
||||
CallHistoryEntry ListEmptyEntry;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CodecCallHistory class
|
||||
/// </summary>
|
||||
public CodecCallHistory()
|
||||
foreach (CiscoCallHistory.Entry entry in entries)
|
||||
{
|
||||
ListEmptyEntry = new CallHistoryEntry() { Name = "No Recent Calls" };
|
||||
|
||||
RecentCalls = new List<CallHistoryEntry>();
|
||||
|
||||
RecentCalls.Add(ListEmptyEntry);
|
||||
}
|
||||
|
||||
void OnRecentCallsListChange()
|
||||
{
|
||||
var handler = RecentCallsListHasChanged;
|
||||
if (handler != null)
|
||||
genericEntries.Add(new CallHistoryEntry()
|
||||
{
|
||||
handler(this, new EventArgs());
|
||||
}
|
||||
Name = entry.DisplayName.Value,
|
||||
Number = entry.CallbackNumber.Value,
|
||||
StartTime = entry.LastOccurrenceStartTime.Value,
|
||||
OccurrenceHistoryId = entry.LastOccurrenceHistoryId.Value,
|
||||
OccurrenceType = ConvertToOccurenceTypeEnum(entry.OccurrenceType.Value)
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// RemoveEntry method
|
||||
/// </summary>
|
||||
public void RemoveEntry(CallHistoryEntry entry)
|
||||
// Check if list is empty and if so, add an item to display No Recent Calls
|
||||
if(genericEntries.Count == 0)
|
||||
genericEntries.Add(ListEmptyEntry);
|
||||
|
||||
RecentCalls = genericEntries;
|
||||
OnRecentCallsListChange();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes the Cisco occurence type and converts it to the matching enum
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
public eCodecOccurrenceType ConvertToOccurenceTypeEnum(string s)
|
||||
{
|
||||
switch (s)
|
||||
{
|
||||
RecentCalls.Remove(entry);
|
||||
OnRecentCallsListChange();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a CallHistoryEntry
|
||||
/// </summary>
|
||||
public class CallHistoryEntry : CodecActiveCallItem
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the StartTime
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(IsoDateTimeConverter))]
|
||||
[JsonProperty("startTime")]
|
||||
public DateTime StartTime { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the occurrence type for this call history entry
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
[JsonProperty("occurrenceType")]
|
||||
public eCodecOccurrenceType OccurrenceType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the occurrence history identifier
|
||||
/// </summary>
|
||||
[JsonProperty("occurrenceHistoryId")]
|
||||
public string OccurrenceHistoryId { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a list of call history entries returned by a Cisco codec to the generic list type
|
||||
/// </summary>
|
||||
/// <param name="entries"></param>
|
||||
/// <returns></returns>
|
||||
/// <summary>
|
||||
/// ConvertCiscoCallHistoryToGeneric method
|
||||
/// </summary>
|
||||
public void ConvertCiscoCallHistoryToGeneric(List<CiscoCallHistory.Entry> entries)
|
||||
{
|
||||
var genericEntries = new List<CallHistoryEntry>();
|
||||
|
||||
foreach (CiscoCallHistory.Entry entry in entries)
|
||||
{
|
||||
|
||||
genericEntries.Add(new CallHistoryEntry()
|
||||
case "Placed":
|
||||
{
|
||||
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(ListEmptyEntry);
|
||||
|
||||
RecentCalls = genericEntries;
|
||||
OnRecentCallsListChange();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes the Cisco occurence type and converts it to the matching enum
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
/// <summary>
|
||||
/// ConvertToOccurenceTypeEnum method
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
|
||||
return eCodecOccurrenceType.Placed;
|
||||
}
|
||||
case "Received":
|
||||
{
|
||||
return eCodecOccurrenceType.Received;
|
||||
}
|
||||
case "NoAnswer":
|
||||
{
|
||||
return eCodecOccurrenceType.NoAnswer;
|
||||
}
|
||||
default:
|
||||
return eCodecOccurrenceType.Unknown;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,37 +1,35 @@
|
|||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IHasContentSharing
|
||||
/// </summary>
|
||||
public interface IHasContentSharing
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the contract for IHasContentSharing
|
||||
/// Gets feedback indicating whether content sharing is currently active
|
||||
/// </summary>
|
||||
public interface IHasContentSharing
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets feedback indicating whether content sharing is currently active
|
||||
/// </summary>
|
||||
BoolFeedback SharingContentIsOnFeedback { get; }
|
||||
BoolFeedback SharingContentIsOnFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets feedback about the current sharing source
|
||||
/// </summary>
|
||||
StringFeedback SharingSourceFeedback { get; }
|
||||
/// <summary>
|
||||
/// Gets feedback about the current sharing source
|
||||
/// </summary>
|
||||
StringFeedback SharingSourceFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether content should be automatically shared while in a call
|
||||
/// </summary>
|
||||
bool AutoShareContentWhileInCall { get; }
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether content should be automatically shared while in a call
|
||||
/// </summary>
|
||||
bool AutoShareContentWhileInCall { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Starts content sharing
|
||||
/// </summary>
|
||||
void StartSharing();
|
||||
/// <summary>
|
||||
/// Starts content sharing
|
||||
/// </summary>
|
||||
void StartSharing();
|
||||
|
||||
/// <summary>
|
||||
/// Stops content sharing
|
||||
/// </summary>
|
||||
void StopSharing();
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Stops content sharing
|
||||
/// </summary>
|
||||
void StopSharing();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,58 +1,57 @@
|
|||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec;
|
||||
|
||||
/// <summary>
|
||||
/// Requirements for a device that has dialing capabilities
|
||||
/// </summary>
|
||||
public interface IHasDialer
|
||||
{
|
||||
// Add requirements for Dialer functionality
|
||||
|
||||
/// <summary>
|
||||
/// Requirements for a device that has dialing capabilities
|
||||
/// Event that is raised when call status changes
|
||||
/// </summary>
|
||||
public interface IHasDialer
|
||||
{
|
||||
// Add requirements for Dialer functionality
|
||||
event EventHandler<CodecCallStatusItemChangeEventArgs> CallStatusChange;
|
||||
|
||||
/// <summary>
|
||||
/// Event that is raised when call status changes
|
||||
/// </summary>
|
||||
event EventHandler<CodecCallStatusItemChangeEventArgs> CallStatusChange;
|
||||
/// <summary>
|
||||
/// Dials the specified number
|
||||
/// </summary>
|
||||
/// <param name="number">The number to dial</param>
|
||||
void Dial(string number);
|
||||
|
||||
/// <summary>
|
||||
/// Dials the specified number
|
||||
/// </summary>
|
||||
/// <param name="number">The number to dial</param>
|
||||
void Dial(string number);
|
||||
/// <summary>
|
||||
/// Ends the specified active call
|
||||
/// </summary>
|
||||
/// <param name="activeCall">The active call to end</param>
|
||||
void EndCall(CodecActiveCallItem activeCall);
|
||||
|
||||
/// <summary>
|
||||
/// Ends the specified active call
|
||||
/// </summary>
|
||||
/// <param name="activeCall">The active call to end</param>
|
||||
void EndCall(CodecActiveCallItem activeCall);
|
||||
/// <summary>
|
||||
/// Ends all active calls
|
||||
/// </summary>
|
||||
void EndAllCalls();
|
||||
|
||||
/// <summary>
|
||||
/// Ends all active calls
|
||||
/// </summary>
|
||||
void EndAllCalls();
|
||||
/// <summary>
|
||||
/// Accepts the specified incoming call
|
||||
/// </summary>
|
||||
/// <param name="item">The call item to accept</param>
|
||||
void AcceptCall(CodecActiveCallItem item);
|
||||
|
||||
/// <summary>
|
||||
/// Accepts the specified incoming call
|
||||
/// </summary>
|
||||
/// <param name="item">The call item to accept</param>
|
||||
void AcceptCall(CodecActiveCallItem item);
|
||||
/// <summary>
|
||||
/// Rejects the specified incoming call
|
||||
/// </summary>
|
||||
/// <param name="item">The call item to reject</param>
|
||||
void RejectCall(CodecActiveCallItem item);
|
||||
|
||||
/// <summary>
|
||||
/// Rejects the specified incoming call
|
||||
/// </summary>
|
||||
/// <param name="item">The call item to reject</param>
|
||||
void RejectCall(CodecActiveCallItem item);
|
||||
/// <summary>
|
||||
/// Sends DTMF digits during a call
|
||||
/// </summary>
|
||||
/// <param name="digit">The DTMF digit(s) to send</param>
|
||||
void SendDtmf(string digit);
|
||||
|
||||
/// <summary>
|
||||
/// Sends DTMF digits during a call
|
||||
/// </summary>
|
||||
/// <param name="digit">The DTMF digit(s) to send</param>
|
||||
void SendDtmf(string digit);
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the device is currently in a call
|
||||
/// </summary>
|
||||
bool IsInCall { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the device is currently in a call
|
||||
/// </summary>
|
||||
bool IsInCall { get; }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -4,153 +4,147 @@ using PepperDash.Core;
|
|||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.DSP
|
||||
namespace PepperDash.Essentials.Devices.Common.DSP;
|
||||
|
||||
/// <summary>
|
||||
/// Base class for DSP devices
|
||||
/// </summary>
|
||||
public abstract class DspBase : EssentialsDevice, ILevelControls
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for DSP devices
|
||||
/// Gets the collection of level control points
|
||||
/// </summary>
|
||||
public abstract class DspBase : EssentialsDevice, ILevelControls
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the collection of level control points
|
||||
/// </summary>
|
||||
public Dictionary<string, IBasicVolumeWithFeedback> LevelControlPoints { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of dialer control points
|
||||
/// </summary>
|
||||
public Dictionary<string, DspControlPoint> DialerControlPoints { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of switcher control points
|
||||
/// </summary>
|
||||
public Dictionary<string, DspControlPoint> SwitcherControlPoints { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the DspBase class
|
||||
/// </summary>
|
||||
/// <param name="key">The device key</param>
|
||||
/// <param name="name">The device name</param>
|
||||
public DspBase(string key, string name) :
|
||||
base(key, name)
|
||||
{
|
||||
|
||||
LevelControlPoints = new Dictionary<string, IBasicVolumeWithFeedback>();
|
||||
DialerControlPoints = new Dictionary<string, DspControlPoint>();
|
||||
SwitcherControlPoints = new Dictionary<string, DspControlPoint>();
|
||||
}
|
||||
|
||||
|
||||
// in audio call feedback
|
||||
|
||||
// VOIP
|
||||
// Phone dialer
|
||||
|
||||
}
|
||||
|
||||
// Fusion
|
||||
// Privacy state
|
||||
// Online state
|
||||
// level/mutes ?
|
||||
|
||||
// AC Log call stats
|
||||
|
||||
// Typical presets:
|
||||
// call default preset to restore levels and mutes
|
||||
public Dictionary<string, IBasicVolumeWithFeedback> LevelControlPoints { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Base class for DSP control points
|
||||
/// Gets the collection of dialer control points
|
||||
/// </summary>
|
||||
public abstract class DspControlPoint : IKeyName
|
||||
public Dictionary<string, DspControlPoint> DialerControlPoints { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of switcher control points
|
||||
/// </summary>
|
||||
public Dictionary<string, DspControlPoint> SwitcherControlPoints { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the DspBase class
|
||||
/// </summary>
|
||||
/// <param name="key">The device key</param>
|
||||
/// <param name="name">The device name</param>
|
||||
public DspBase(string key, string name) :
|
||||
base(key, name)
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Key
|
||||
/// </summary>
|
||||
public string Key { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Name
|
||||
/// </summary>
|
||||
public string Name { get; private set; }
|
||||
LevelControlPoints = new Dictionary<string, IBasicVolumeWithFeedback>();
|
||||
DialerControlPoints = new Dictionary<string, DspControlPoint>();
|
||||
SwitcherControlPoints = new Dictionary<string, DspControlPoint>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the DspControlPoint class
|
||||
/// </summary>
|
||||
/// <param name="key">The control point key</param>
|
||||
protected DspControlPoint(string key) => Key = key;
|
||||
|
||||
// in audio call feedback
|
||||
|
||||
// VOIP
|
||||
// Phone dialer
|
||||
|
||||
}
|
||||
|
||||
// Fusion
|
||||
// Privacy state
|
||||
// Online state
|
||||
// level/mutes ?
|
||||
|
||||
// AC Log call stats
|
||||
|
||||
// Typical presets:
|
||||
// call default preset to restore levels and mutes
|
||||
|
||||
/// <summary>
|
||||
/// Base class for DSP control points
|
||||
/// </summary>
|
||||
public abstract class DspControlPoint : IKeyName
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Key
|
||||
/// </summary>
|
||||
public string Key { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Name
|
||||
/// </summary>
|
||||
public string Name { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the DspControlPoint class
|
||||
/// </summary>
|
||||
/// <param name="key">The control point key</param>
|
||||
protected DspControlPoint(string key) => Key = key;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Base class for DSP level control points with volume and mute functionality
|
||||
/// </summary>
|
||||
public abstract class DspLevelControlPoint : DspControlPoint, IBasicVolumeWithFeedback
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the MuteFeedback
|
||||
/// </summary>
|
||||
public BoolFeedback MuteFeedback { get; }
|
||||
/// <summary>
|
||||
/// Gets or sets the VolumeLevelFeedback
|
||||
/// </summary>
|
||||
public IntFeedback VolumeLevelFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the DspLevelControlPoint class
|
||||
/// </summary>
|
||||
/// <param name="key">The control point key</param>
|
||||
/// <param name="muteFeedbackFunc">Function to get mute status</param>
|
||||
/// <param name="volumeLevelFeedbackFunc">Function to get volume level</param>
|
||||
protected DspLevelControlPoint(string key, Func<bool> muteFeedbackFunc, Func<int> volumeLevelFeedbackFunc) : base(key)
|
||||
{
|
||||
MuteFeedback = new BoolFeedback("mute", muteFeedbackFunc);
|
||||
VolumeLevelFeedback = new IntFeedback("volume", volumeLevelFeedbackFunc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Base class for DSP level control points with volume and mute functionality
|
||||
/// Turns mute off
|
||||
/// </summary>
|
||||
public abstract class DspLevelControlPoint : DspControlPoint, IBasicVolumeWithFeedback
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the MuteFeedback
|
||||
/// </summary>
|
||||
public BoolFeedback MuteFeedback { get; }
|
||||
/// <summary>
|
||||
/// Gets or sets the VolumeLevelFeedback
|
||||
/// </summary>
|
||||
public IntFeedback VolumeLevelFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the DspLevelControlPoint class
|
||||
/// </summary>
|
||||
/// <param name="key">The control point key</param>
|
||||
/// <param name="muteFeedbackFunc">Function to get mute status</param>
|
||||
/// <param name="volumeLevelFeedbackFunc">Function to get volume level</param>
|
||||
protected DspLevelControlPoint(string key, Func<bool> muteFeedbackFunc, Func<int> volumeLevelFeedbackFunc) : base(key)
|
||||
{
|
||||
MuteFeedback = new BoolFeedback("mute", muteFeedbackFunc);
|
||||
VolumeLevelFeedback = new IntFeedback("volume", volumeLevelFeedbackFunc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Turns mute off
|
||||
/// </summary>
|
||||
public abstract void MuteOff();
|
||||
/// <summary>
|
||||
/// Turns mute on
|
||||
/// </summary>
|
||||
public abstract void MuteOn();
|
||||
/// <summary>
|
||||
/// Toggles mute state
|
||||
/// </summary>
|
||||
public abstract void MuteToggle();
|
||||
/// <summary>
|
||||
/// Sets the volume level
|
||||
/// </summary>
|
||||
/// <param name="level">The volume level to set</param>
|
||||
public abstract void SetVolume(ushort level);
|
||||
/// <summary>
|
||||
/// Decreases volume
|
||||
/// </summary>
|
||||
/// <param name="pressRelease">True when pressed, false when released</param>
|
||||
public abstract void VolumeDown(bool pressRelease);
|
||||
/// <summary>
|
||||
/// Increases volume
|
||||
/// </summary>
|
||||
/// <param name="pressRelease">True when pressed, false when released</param>
|
||||
public abstract void VolumeUp(bool pressRelease);
|
||||
}
|
||||
|
||||
public abstract void MuteOff();
|
||||
/// <summary>
|
||||
/// Base class for DSP dialer control points
|
||||
/// Turns mute on
|
||||
/// </summary>
|
||||
public abstract class DspDialerBase : DspControlPoint
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the DspDialerBase class
|
||||
/// </summary>
|
||||
/// <param name="key">The dialer control point key</param>
|
||||
protected DspDialerBase(string key) : base(key) { }
|
||||
}
|
||||
public abstract void MuteOn();
|
||||
/// <summary>
|
||||
/// Toggles mute state
|
||||
/// </summary>
|
||||
public abstract void MuteToggle();
|
||||
/// <summary>
|
||||
/// Sets the volume level
|
||||
/// </summary>
|
||||
/// <param name="level">The volume level to set</param>
|
||||
public abstract void SetVolume(ushort level);
|
||||
/// <summary>
|
||||
/// Decreases volume
|
||||
/// </summary>
|
||||
/// <param name="pressRelease">True when pressed, false when released</param>
|
||||
public abstract void VolumeDown(bool pressRelease);
|
||||
/// <summary>
|
||||
/// Increases volume
|
||||
/// </summary>
|
||||
/// <param name="pressRelease">True when pressed, false when released</param>
|
||||
public abstract void VolumeUp(bool pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Base class for DSP dialer control points
|
||||
/// </summary>
|
||||
public abstract class DspDialerBase : DspControlPoint
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the DspDialerBase class
|
||||
/// </summary>
|
||||
/// <param name="key">The dialer control point key</param>
|
||||
protected DspDialerBase(string key) : base(key) { }
|
||||
}
|
||||
|
||||
|
||||
// Main program
|
||||
// VTC
|
||||
// ATC
|
||||
// Mics, unusual
|
||||
|
||||
}
|
||||
|
|
@ -9,65 +9,66 @@ using PepperDash.Essentials.Core.Bridges;
|
|||
using PepperDash.Essentials.Core.Config;
|
||||
using Serilog.Events;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Displays
|
||||
namespace PepperDash.Essentials.Devices.Common.Displays;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a basic IR controlled display device. This class is intended to be used for simple displays that are controlled via IR and do not have a more robust API. It provides basic power and volume controls, as well as input switching via IR commands.
|
||||
/// </summary>
|
||||
public class BasicIrDisplay : DisplayBase, IBasicVolumeControls, IBridgeAdvanced
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a BasicIrDisplay
|
||||
/// Gets or sets the IrPort
|
||||
/// </summary>
|
||||
public class BasicIrDisplay : DisplayBase, IBasicVolumeControls, IBridgeAdvanced
|
||||
public IrOutputPortController IrPort { get; private set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the IrPulseTime
|
||||
/// </summary>
|
||||
public ushort IrPulseTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the power is on feedback function
|
||||
/// </summary>
|
||||
protected Func<bool> PowerIsOnFeedbackFunc
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the IrPort
|
||||
/// </summary>
|
||||
public IrOutputPortController IrPort { get; private set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the IrPulseTime
|
||||
/// </summary>
|
||||
public ushort IrPulseTime { get; set; }
|
||||
get { return () => _PowerIsOn; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the power is on feedback function
|
||||
/// </summary>
|
||||
protected Func<bool> PowerIsOnFeedbackFunc
|
||||
{
|
||||
get { return () => _PowerIsOn; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the is cooling down feedback function
|
||||
/// </summary>
|
||||
protected override Func<bool> IsCoolingDownFeedbackFunc
|
||||
{
|
||||
get { return () => _IsCoolingDown; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the is warming up feedback function
|
||||
/// </summary>
|
||||
protected override Func<bool> IsWarmingUpFeedbackFunc
|
||||
{
|
||||
get { return () => _IsWarmingUp; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the is cooling down feedback function
|
||||
/// </summary>
|
||||
protected override Func<bool> IsCoolingDownFeedbackFunc
|
||||
{
|
||||
get { return () => _IsCoolingDown; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the is warming up feedback function
|
||||
/// </summary>
|
||||
protected override Func<bool> IsWarmingUpFeedbackFunc
|
||||
{
|
||||
get { return () => _IsWarmingUp; }
|
||||
}
|
||||
|
||||
bool _PowerIsOn;
|
||||
bool _IsWarmingUp;
|
||||
bool _IsCoolingDown;
|
||||
bool _PowerIsOn;
|
||||
bool _IsWarmingUp;
|
||||
bool _IsCoolingDown;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the BasicIrDisplay class
|
||||
/// </summary>
|
||||
/// <param name="key">The device key</param>
|
||||
/// <param name="name">The device name</param>
|
||||
/// <param name="port">The IR output port</param>
|
||||
/// <param name="irDriverFilepath">The path to the IR driver file</param>
|
||||
public BasicIrDisplay(string key, string name, IROutputPort port, string irDriverFilepath)
|
||||
: base(key, name)
|
||||
{
|
||||
IrPort = new IrOutputPortController(key + "-ir", port, irDriverFilepath);
|
||||
DeviceManager.AddDevice(IrPort);
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the BasicIrDisplay class
|
||||
/// </summary>
|
||||
/// <param name="key">The device key</param>
|
||||
/// <param name="name">The device name</param>
|
||||
/// <param name="port">The IR output port</param>
|
||||
/// <param name="irDriverFilepath">The path to the IR driver file</param>
|
||||
public BasicIrDisplay(string key, string name, IROutputPort port, string irDriverFilepath)
|
||||
: base(key, name)
|
||||
{
|
||||
IrPort = new IrOutputPortController(key + "-ir", port, irDriverFilepath);
|
||||
DeviceManager.AddDevice(IrPort);
|
||||
|
||||
IsWarmingUpFeedback.OutputChange += (o, a) => Debug.LogMessage(LogEventLevel.Verbose, this, "Warming up={0}", _IsWarmingUp);
|
||||
IsCoolingDownFeedback.OutputChange += (o, a) => Debug.LogMessage(LogEventLevel.Verbose, this, "Cooling down={0}", _IsCoolingDown);
|
||||
IsWarmingUpFeedback.OutputChange += (o, a) => Debug.LogMessage(LogEventLevel.Verbose, this, "Warming up={0}", _IsWarmingUp);
|
||||
IsCoolingDownFeedback.OutputChange += (o, a) => Debug.LogMessage(LogEventLevel.Verbose, this, "Cooling down={0}", _IsCoolingDown);
|
||||
|
||||
InputPorts.AddRange(new RoutingPortCollection<RoutingInputPort>
|
||||
InputPorts.AddRange(new RoutingPortCollection<RoutingInputPort>
|
||||
{
|
||||
new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Hdmi, new Action(Hdmi1), this, false),
|
||||
|
|
@ -84,224 +85,223 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
|||
new RoutingInputPort(RoutingPortNames.AntennaIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Hdmi, new Action(Antenna), this, false),
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hdmi1 method
|
||||
/// </summary>
|
||||
public void Hdmi1()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_1, IrPulseTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hdmi2 method
|
||||
/// </summary>
|
||||
public void Hdmi2()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_2, IrPulseTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hdmi3 method
|
||||
/// </summary>
|
||||
public void Hdmi3()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_3, IrPulseTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hdmi4 method
|
||||
/// </summary>
|
||||
public void Hdmi4()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_4, IrPulseTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Component1 method
|
||||
/// </summary>
|
||||
public void Component1()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_COMPONENT_1, IrPulseTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Video1 method
|
||||
/// </summary>
|
||||
public void Video1()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_VIDEO_1, IrPulseTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Antenna method
|
||||
/// </summary>
|
||||
public void Antenna()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_ANTENNA, IrPulseTime);
|
||||
}
|
||||
|
||||
#region IPower Members
|
||||
|
||||
/// <summary>
|
||||
/// PowerOn method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override void PowerOn()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_ON, IrPulseTime);
|
||||
_PowerIsOn = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PowerOff method
|
||||
/// </summary>
|
||||
public override void PowerOff()
|
||||
{
|
||||
_PowerIsOn = false;
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_OFF, IrPulseTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PowerToggle method
|
||||
/// </summary>
|
||||
public override void PowerToggle()
|
||||
{
|
||||
_PowerIsOn = false;
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER, IrPulseTime);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IBasicVolumeControls Members
|
||||
|
||||
/// <summary>
|
||||
/// VolumeUp method
|
||||
/// </summary>
|
||||
public void VolumeUp(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_VOL_PLUS, pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// VolumeDown method
|
||||
/// </summary>
|
||||
public void VolumeDown(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_VOL_MINUS, pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MuteToggle method
|
||||
/// </summary>
|
||||
public void MuteToggle()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_MUTE, 200);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
void StartWarmingTimer()
|
||||
{
|
||||
_IsWarmingUp = true;
|
||||
IsWarmingUpFeedback.FireUpdate();
|
||||
new CTimer(o =>
|
||||
{
|
||||
_IsWarmingUp = false;
|
||||
IsWarmingUpFeedback.FireUpdate();
|
||||
}, 10000);
|
||||
}
|
||||
|
||||
void StartCoolingTimer()
|
||||
{
|
||||
_IsCoolingDown = true;
|
||||
IsCoolingDownFeedback.FireUpdate();
|
||||
new CTimer(o =>
|
||||
{
|
||||
_IsCoolingDown = false;
|
||||
IsCoolingDownFeedback.FireUpdate();
|
||||
}, 7000);
|
||||
}
|
||||
|
||||
#region IRoutingSink Members
|
||||
|
||||
/// <summary>
|
||||
/// Typically called by the discovery routing algorithm.
|
||||
/// </summary>
|
||||
/// <param name="inputSelector">A delegate containing the input selector method to call</param>
|
||||
/// <summary>
|
||||
/// ExecuteSwitch method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override void ExecuteSwitch(object inputSelector)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Verbose, this, "Switching to input '{0}'", (inputSelector as Action).ToString());
|
||||
|
||||
Action finishSwitch = () =>
|
||||
{
|
||||
var action = inputSelector as Action;
|
||||
if (action != null)
|
||||
action();
|
||||
};
|
||||
|
||||
if (!_PowerIsOn)
|
||||
{
|
||||
PowerOn();
|
||||
EventHandler<FeedbackEventArgs> oneTimer = null;
|
||||
oneTimer = (o, a) =>
|
||||
{
|
||||
if (IsWarmingUpFeedback.BoolValue) return; // Only catch done warming
|
||||
IsWarmingUpFeedback.OutputChange -= oneTimer;
|
||||
finishSwitch();
|
||||
};
|
||||
IsWarmingUpFeedback.OutputChange += oneTimer;
|
||||
}
|
||||
else // Do it!
|
||||
finishSwitch();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// LinkToApi method
|
||||
/// </summary>
|
||||
public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a BasicIrDisplayFactory
|
||||
/// Hdmi1 method
|
||||
/// </summary>
|
||||
public class BasicIrDisplayFactory : EssentialsDeviceFactory<BasicIrDisplay>
|
||||
public void Hdmi1()
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the BasicIrDisplayFactory class
|
||||
/// </summary>
|
||||
public BasicIrDisplayFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "basicirdisplay" };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// BuildDevice method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new BasicIrDisplay Device");
|
||||
var ir = IRPortHelper.GetIrPort(dc.Properties);
|
||||
if (ir != null)
|
||||
{
|
||||
var display = new BasicIrDisplay(dc.Key, dc.Name, ir.Port, ir.FileName);
|
||||
display.IrPulseTime = 200; // Set default pulse time for IR commands.
|
||||
return display;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_1, IrPulseTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hdmi2 method
|
||||
/// </summary>
|
||||
public void Hdmi2()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_2, IrPulseTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hdmi3 method
|
||||
/// </summary>
|
||||
public void Hdmi3()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_3, IrPulseTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hdmi4 method
|
||||
/// </summary>
|
||||
public void Hdmi4()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_4, IrPulseTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Component1 method
|
||||
/// </summary>
|
||||
public void Component1()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_COMPONENT_1, IrPulseTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Video1 method
|
||||
/// </summary>
|
||||
public void Video1()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_VIDEO_1, IrPulseTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Antenna method
|
||||
/// </summary>
|
||||
public void Antenna()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_ANTENNA, IrPulseTime);
|
||||
}
|
||||
|
||||
#region IPower Members
|
||||
|
||||
/// <summary>
|
||||
/// PowerOn method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override void PowerOn()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_ON, IrPulseTime);
|
||||
_PowerIsOn = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PowerOff method
|
||||
/// </summary>
|
||||
public override void PowerOff()
|
||||
{
|
||||
_PowerIsOn = false;
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_OFF, IrPulseTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PowerToggle method
|
||||
/// </summary>
|
||||
public override void PowerToggle()
|
||||
{
|
||||
_PowerIsOn = false;
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER, IrPulseTime);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IBasicVolumeControls Members
|
||||
|
||||
/// <summary>
|
||||
/// VolumeUp method
|
||||
/// </summary>
|
||||
public void VolumeUp(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_VOL_PLUS, pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// VolumeDown method
|
||||
/// </summary>
|
||||
public void VolumeDown(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_VOL_MINUS, pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MuteToggle method
|
||||
/// </summary>
|
||||
public void MuteToggle()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_MUTE, 200);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
void StartWarmingTimer()
|
||||
{
|
||||
_IsWarmingUp = true;
|
||||
IsWarmingUpFeedback.FireUpdate();
|
||||
new CTimer(o =>
|
||||
{
|
||||
_IsWarmingUp = false;
|
||||
IsWarmingUpFeedback.FireUpdate();
|
||||
}, 10000);
|
||||
}
|
||||
|
||||
void StartCoolingTimer()
|
||||
{
|
||||
_IsCoolingDown = true;
|
||||
IsCoolingDownFeedback.FireUpdate();
|
||||
new CTimer(o =>
|
||||
{
|
||||
_IsCoolingDown = false;
|
||||
IsCoolingDownFeedback.FireUpdate();
|
||||
}, 7000);
|
||||
}
|
||||
|
||||
#region IRoutingSink Members
|
||||
|
||||
/// <summary>
|
||||
/// Typically called by the discovery routing algorithm.
|
||||
/// </summary>
|
||||
/// <param name="inputSelector">A delegate containing the input selector method to call</param>
|
||||
/// <summary>
|
||||
/// ExecuteSwitch method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override void ExecuteSwitch(object inputSelector)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Verbose, this, "Switching to input '{0}'", (inputSelector as Action).ToString());
|
||||
|
||||
Action finishSwitch = () =>
|
||||
{
|
||||
var action = inputSelector as Action;
|
||||
if (action != null)
|
||||
action();
|
||||
};
|
||||
|
||||
if (!_PowerIsOn)
|
||||
{
|
||||
PowerOn();
|
||||
EventHandler<FeedbackEventArgs> oneTimer = null;
|
||||
oneTimer = (o, a) =>
|
||||
{
|
||||
if (IsWarmingUpFeedback.BoolValue) return; // Only catch done warming
|
||||
IsWarmingUpFeedback.OutputChange -= oneTimer;
|
||||
finishSwitch();
|
||||
};
|
||||
IsWarmingUpFeedback.OutputChange += oneTimer;
|
||||
}
|
||||
else // Do it!
|
||||
finishSwitch();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// LinkToApi method
|
||||
/// </summary>
|
||||
public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Factory for creating BasicIrDisplay devices
|
||||
/// </summary>
|
||||
public class BasicIrDisplayFactory : EssentialsDeviceFactory<BasicIrDisplay>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the BasicIrDisplayFactory class
|
||||
/// </summary>
|
||||
public BasicIrDisplayFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "basicirdisplay" };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// BuildDevice method
|
||||
/// </summary>
|
||||
/// <param name="dc"></param>
|
||||
/// <returns></returns>
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new BasicIrDisplay Device");
|
||||
var ir = IRPortHelper.GetIrPort(dc.Properties);
|
||||
if (ir != null)
|
||||
{
|
||||
var display = new BasicIrDisplay(dc.Key, dc.Name, ir.Port, ir.FileName);
|
||||
display.IrPulseTime = 200; // Set default pulse time for IR commands.
|
||||
return display;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -13,426 +13,425 @@ using PepperDash.Essentials.Core.Routing;
|
|||
using Serilog.Events;
|
||||
using Feedback = PepperDash.Essentials.Core.Feedback;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Displays
|
||||
namespace PepperDash.Essentials.Devices.Common.Displays;
|
||||
|
||||
/// <summary>
|
||||
/// Abstract base class for display devices that provides common display functionality
|
||||
/// including power control, input switching, and routing capabilities.
|
||||
/// </summary>
|
||||
public abstract class DisplayBase : EssentialsDevice, IDisplay, ICurrentSources, IHasFeedback
|
||||
{
|
||||
private RoutingInputPort _currentInputPort;
|
||||
|
||||
/// <summary>
|
||||
/// Abstract base class for display devices that provides common display functionality
|
||||
/// including power control, input switching, and routing capabilities.
|
||||
/// Gets or sets the current input port that is selected on the display.
|
||||
/// </summary>
|
||||
public abstract class DisplayBase : EssentialsDevice, IDisplay, ICurrentSources, IHasFeedback
|
||||
public RoutingInputPort CurrentInputPort
|
||||
{
|
||||
private RoutingInputPort _currentInputPort;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current input port that is selected on the display.
|
||||
/// </summary>
|
||||
public RoutingInputPort CurrentInputPort
|
||||
get
|
||||
{
|
||||
get
|
||||
{
|
||||
return _currentInputPort;
|
||||
}
|
||||
|
||||
protected set
|
||||
{
|
||||
if (_currentInputPort == value) return;
|
||||
|
||||
_currentInputPort = value;
|
||||
|
||||
InputChanged?.Invoke(this, _currentInputPort);
|
||||
}
|
||||
return _currentInputPort;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event that is raised when the input changes on the display.
|
||||
/// </summary>
|
||||
public event InputChangedEventHandler InputChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Event that is raised when the current source information changes.
|
||||
/// </summary>
|
||||
public event SourceInfoChangeHandler CurrentSourceChange;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CurrentSourceInfoKey
|
||||
/// </summary>
|
||||
public string CurrentSourceInfoKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current source information for the display.
|
||||
/// </summary>
|
||||
public SourceListItem CurrentSourceInfo
|
||||
protected set
|
||||
{
|
||||
get
|
||||
{
|
||||
return _CurrentSourceInfo;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == _CurrentSourceInfo) return;
|
||||
if (_currentInputPort == value) return;
|
||||
|
||||
var handler = CurrentSourceChange;
|
||||
_currentInputPort = value;
|
||||
|
||||
handler?.Invoke(_CurrentSourceInfo, ChangeType.WillChange);
|
||||
|
||||
_CurrentSourceInfo = value;
|
||||
|
||||
handler?.Invoke(_CurrentSourceInfo, ChangeType.DidChange);
|
||||
}
|
||||
InputChanged?.Invoke(this, _currentInputPort);
|
||||
}
|
||||
SourceListItem _CurrentSourceInfo;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Dictionary<eRoutingSignalType, SourceListItem> CurrentSources { get; private set; }
|
||||
/// <summary>
|
||||
/// Event that is raised when the input changes on the display.
|
||||
/// </summary>
|
||||
public event InputChangedEventHandler InputChanged;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Dictionary<eRoutingSignalType, string> CurrentSourceKeys { get; private set; }
|
||||
/// <summary>
|
||||
/// Event that is raised when the current source information changes.
|
||||
/// </summary>
|
||||
public event SourceInfoChangeHandler CurrentSourceChange;
|
||||
|
||||
/// <inheritdoc />
|
||||
public event EventHandler CurrentSourcesChanged;
|
||||
/// <summary>
|
||||
/// Gets or sets the CurrentSourceInfoKey
|
||||
/// </summary>
|
||||
public string CurrentSourceInfoKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets feedback indicating whether the display is currently cooling down after being powered off.
|
||||
/// </summary>
|
||||
public BoolFeedback IsCoolingDownFeedback { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the IsWarmingUpFeedback
|
||||
/// </summary>
|
||||
public BoolFeedback IsWarmingUpFeedback { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the UsageTracker
|
||||
/// </summary>
|
||||
public UsageTracking UsageTracker { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the WarmupTime
|
||||
/// </summary>
|
||||
public uint WarmupTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CooldownTime
|
||||
/// </summary>
|
||||
public uint CooldownTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Abstract function that must be implemented by derived classes to provide the cooling down feedback value.
|
||||
/// Must be implemented by concrete sub-classes.
|
||||
/// </summary>
|
||||
abstract protected Func<bool> IsCoolingDownFeedbackFunc { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Abstract function that must be implemented by derived classes to provide the warming up feedback value.
|
||||
/// Must be implemented by concrete sub-classes.
|
||||
/// </summary>
|
||||
abstract protected Func<bool> IsWarmingUpFeedbackFunc { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Timer used for managing display warmup timing.
|
||||
/// </summary>
|
||||
protected CTimer WarmupTimer;
|
||||
|
||||
/// <summary>
|
||||
/// Timer used for managing display cooldown timing.
|
||||
/// </summary>
|
||||
protected CTimer CooldownTimer;
|
||||
|
||||
#region IRoutingInputs Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of input ports available on this display device.
|
||||
/// </summary>
|
||||
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the DisplayBase class.
|
||||
/// </summary>
|
||||
/// <param name="key">The unique key identifier for this display device.</param>
|
||||
/// <param name="name">The friendly name for this display device.</param>
|
||||
protected DisplayBase(string key, string name)
|
||||
: base(key, name)
|
||||
/// <summary>
|
||||
/// Gets or sets the current source information for the display.
|
||||
/// </summary>
|
||||
public SourceListItem CurrentSourceInfo
|
||||
{
|
||||
get
|
||||
{
|
||||
IsCoolingDownFeedback = new BoolFeedback("IsCoolingDown", IsCoolingDownFeedbackFunc);
|
||||
IsWarmingUpFeedback = new BoolFeedback("IsWarmingUp", IsWarmingUpFeedbackFunc);
|
||||
return _CurrentSourceInfo;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == _CurrentSourceInfo) return;
|
||||
|
||||
Feedbacks.Add(IsCoolingDownFeedback);
|
||||
Feedbacks.Add(IsWarmingUpFeedback);
|
||||
var handler = CurrentSourceChange;
|
||||
|
||||
InputPorts = new RoutingPortCollection<RoutingInputPort>();
|
||||
handler?.Invoke(_CurrentSourceInfo, ChangeType.WillChange);
|
||||
|
||||
CurrentSources = new Dictionary<eRoutingSignalType, SourceListItem>
|
||||
_CurrentSourceInfo = value;
|
||||
|
||||
handler?.Invoke(_CurrentSourceInfo, ChangeType.DidChange);
|
||||
}
|
||||
}
|
||||
SourceListItem _CurrentSourceInfo;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Dictionary<eRoutingSignalType, SourceListItem> CurrentSources { get; private set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Dictionary<eRoutingSignalType, string> CurrentSourceKeys { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public event EventHandler CurrentSourcesChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Gets feedback indicating whether the display is currently cooling down after being powered off.
|
||||
/// </summary>
|
||||
public BoolFeedback IsCoolingDownFeedback { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the IsWarmingUpFeedback
|
||||
/// </summary>
|
||||
public BoolFeedback IsWarmingUpFeedback { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the UsageTracker
|
||||
/// </summary>
|
||||
public UsageTracking UsageTracker { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the WarmupTime
|
||||
/// </summary>
|
||||
public uint WarmupTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CooldownTime
|
||||
/// </summary>
|
||||
public uint CooldownTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Abstract function that must be implemented by derived classes to provide the cooling down feedback value.
|
||||
/// Must be implemented by concrete sub-classes.
|
||||
/// </summary>
|
||||
abstract protected Func<bool> IsCoolingDownFeedbackFunc { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Abstract function that must be implemented by derived classes to provide the warming up feedback value.
|
||||
/// Must be implemented by concrete sub-classes.
|
||||
/// </summary>
|
||||
abstract protected Func<bool> IsWarmingUpFeedbackFunc { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Timer used for managing display warmup timing.
|
||||
/// </summary>
|
||||
protected CTimer WarmupTimer;
|
||||
|
||||
/// <summary>
|
||||
/// Timer used for managing display cooldown timing.
|
||||
/// </summary>
|
||||
protected CTimer CooldownTimer;
|
||||
|
||||
#region IRoutingInputs Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of input ports available on this display device.
|
||||
/// </summary>
|
||||
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the DisplayBase class.
|
||||
/// </summary>
|
||||
/// <param name="key">The unique key identifier for this display device.</param>
|
||||
/// <param name="name">The friendly name for this display device.</param>
|
||||
protected DisplayBase(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
IsCoolingDownFeedback = new BoolFeedback("IsCoolingDown", IsCoolingDownFeedbackFunc);
|
||||
IsWarmingUpFeedback = new BoolFeedback("IsWarmingUp", IsWarmingUpFeedbackFunc);
|
||||
|
||||
Feedbacks.Add(IsCoolingDownFeedback);
|
||||
Feedbacks.Add(IsWarmingUpFeedback);
|
||||
|
||||
InputPorts = new RoutingPortCollection<RoutingInputPort>();
|
||||
|
||||
CurrentSources = new Dictionary<eRoutingSignalType, SourceListItem>
|
||||
{
|
||||
{ eRoutingSignalType.Audio, null },
|
||||
{ eRoutingSignalType.Video, null },
|
||||
};
|
||||
|
||||
CurrentSourceKeys = new Dictionary<eRoutingSignalType, string>
|
||||
CurrentSourceKeys = new Dictionary<eRoutingSignalType, string>
|
||||
{
|
||||
{ eRoutingSignalType.Audio, string.Empty },
|
||||
{ eRoutingSignalType.Video, string.Empty },
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Powers on the display device. Must be implemented by derived classes.
|
||||
/// </summary>
|
||||
public abstract void PowerOn();
|
||||
|
||||
/// <summary>
|
||||
/// Powers off the display device. Must be implemented by derived classes.
|
||||
/// </summary>
|
||||
public abstract void PowerOff();
|
||||
|
||||
/// <summary>
|
||||
/// Toggles the power state of the display device. Must be implemented by derived classes.
|
||||
/// </summary>
|
||||
public abstract void PowerToggle();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of feedback objects for this display device.
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public virtual FeedbackCollection<Feedback> Feedbacks { get; private set; } = new FeedbackCollection<Feedback>();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Executes a switch to the specified input on the display device. Must be implemented by derived classes.
|
||||
/// </summary>
|
||||
/// <param name="selector">The selector object that identifies which input to switch to.</param>
|
||||
public abstract void ExecuteSwitch(object selector);
|
||||
|
||||
/// <summary>
|
||||
/// Links the display device to an API using a trilist, join start, join map key, and bridge.
|
||||
/// This overload uses serialized join map configuration.
|
||||
/// </summary>
|
||||
/// <param name="displayDevice">The display device to link.</param>
|
||||
/// <param name="trilist">The BasicTriList for communication.</param>
|
||||
/// <param name="joinStart">The starting join number for the device.</param>
|
||||
/// <param name="joinMapKey">The key for the join map configuration.</param>
|
||||
/// <param name="bridge">The EISC API bridge instance.</param>
|
||||
protected void LinkDisplayToApi(DisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey,
|
||||
EiscApiAdvanced bridge)
|
||||
{
|
||||
var joinMap = new DisplayControllerJoinMap(joinStart);
|
||||
|
||||
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||
joinMap = JsonConvert.DeserializeObject<DisplayControllerJoinMap>(joinMapSerialized);
|
||||
|
||||
if (bridge != null)
|
||||
{
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Information, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Powers on the display device. Must be implemented by derived classes.
|
||||
/// </summary>
|
||||
public abstract void PowerOn();
|
||||
LinkDisplayToApi(displayDevice, trilist, joinMap);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Powers off the display device. Must be implemented by derived classes.
|
||||
/// </summary>
|
||||
public abstract void PowerOff();
|
||||
/// <summary>
|
||||
/// Links the display device to an API using a trilist and join map.
|
||||
/// This overload uses a pre-configured join map instance.
|
||||
/// </summary>
|
||||
/// <param name="displayDevice">The display device to link.</param>
|
||||
/// <param name="trilist">The BasicTriList for communication.</param>
|
||||
/// <param name="joinMap">The join map configuration for the device.</param>
|
||||
protected void LinkDisplayToApi(DisplayBase displayDevice, BasicTriList trilist, DisplayControllerJoinMap joinMap)
|
||||
{
|
||||
this.LogDebug("Linking to Trilist {ipId}", trilist.ID.ToString("X"));
|
||||
this.LogDebug("Linking to Display: {displayName}", displayDevice.Name);
|
||||
|
||||
/// <summary>
|
||||
/// Toggles the power state of the display device. Must be implemented by derived classes.
|
||||
/// </summary>
|
||||
public abstract void PowerToggle();
|
||||
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = displayDevice.Name;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of feedback objects for this display device.
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public virtual FeedbackCollection<Feedback> Feedbacks { get; private set; } = new FeedbackCollection<Feedback>();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Executes a switch to the specified input on the display device. Must be implemented by derived classes.
|
||||
/// </summary>
|
||||
/// <param name="selector">The selector object that identifies which input to switch to.</param>
|
||||
public abstract void ExecuteSwitch(object selector);
|
||||
|
||||
/// <summary>
|
||||
/// Links the display device to an API using a trilist, join start, join map key, and bridge.
|
||||
/// This overload uses serialized join map configuration.
|
||||
/// </summary>
|
||||
/// <param name="displayDevice">The display device to link.</param>
|
||||
/// <param name="trilist">The BasicTriList for communication.</param>
|
||||
/// <param name="joinStart">The starting join number for the device.</param>
|
||||
/// <param name="joinMapKey">The key for the join map configuration.</param>
|
||||
/// <param name="bridge">The EISC API bridge instance.</param>
|
||||
protected void LinkDisplayToApi(DisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey,
|
||||
EiscApiAdvanced bridge)
|
||||
if (displayDevice is ICommunicationMonitor commMonitor)
|
||||
{
|
||||
var joinMap = new DisplayControllerJoinMap(joinStart);
|
||||
|
||||
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||
joinMap = JsonConvert.DeserializeObject<DisplayControllerJoinMap>(joinMapSerialized);
|
||||
|
||||
if (bridge != null)
|
||||
{
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Information, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
|
||||
}
|
||||
|
||||
LinkDisplayToApi(displayDevice, trilist, joinMap);
|
||||
commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Links the display device to an API using a trilist and join map.
|
||||
/// This overload uses a pre-configured join map instance.
|
||||
/// </summary>
|
||||
/// <param name="displayDevice">The display device to link.</param>
|
||||
/// <param name="trilist">The BasicTriList for communication.</param>
|
||||
/// <param name="joinMap">The join map configuration for the device.</param>
|
||||
protected void LinkDisplayToApi(DisplayBase displayDevice, BasicTriList trilist, DisplayControllerJoinMap joinMap)
|
||||
// TODO: revisit this as there could be issues with this approach
|
||||
var inputNumber = 0;
|
||||
var inputKeys = new List<string>();
|
||||
|
||||
var inputNumberFeedback = new IntFeedback("inputNumber", () => inputNumber);
|
||||
|
||||
// Add input number feedback to the device feedback collection to keep it around...
|
||||
Feedbacks.Add(inputNumberFeedback);
|
||||
|
||||
// Two way feedbacks
|
||||
if (displayDevice is TwoWayDisplayBase twoWayDisplay)
|
||||
{
|
||||
this.LogDebug("Linking to Trilist {ipId}", trilist.ID.ToString("X"));
|
||||
this.LogDebug("Linking to Display: {displayName}", displayDevice.Name);
|
||||
trilist.SetBool(joinMap.IsTwoWayDisplay.JoinNumber, true);
|
||||
|
||||
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = displayDevice.Name;
|
||||
twoWayDisplay.CurrentInputFeedback.OutputChange += (o, a) => this.LogDebug("CurrentInputFeedback_OutputChange {input}", a.StringValue);
|
||||
|
||||
if (displayDevice is ICommunicationMonitor commMonitor)
|
||||
inputNumberFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputSelect.JoinNumber]);
|
||||
|
||||
twoWayDisplay.PowerIsOnFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
|
||||
}
|
||||
|
||||
// TODO: revisit this as there could be issues with this approach
|
||||
var inputNumber = 0;
|
||||
var inputKeys = new List<string>();
|
||||
|
||||
var inputNumberFeedback = new IntFeedback("inputNumber", () => inputNumber);
|
||||
|
||||
// Add input number feedback to the device feedback collection to keep it around...
|
||||
Feedbacks.Add(inputNumberFeedback);
|
||||
|
||||
// Two way feedbacks
|
||||
if (displayDevice is TwoWayDisplayBase twoWayDisplay)
|
||||
{
|
||||
trilist.SetBool(joinMap.IsTwoWayDisplay.JoinNumber, true);
|
||||
|
||||
twoWayDisplay.CurrentInputFeedback.OutputChange += (o, a) => this.LogDebug("CurrentInputFeedback_OutputChange {input}", a.StringValue);
|
||||
|
||||
inputNumberFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputSelect.JoinNumber]);
|
||||
|
||||
twoWayDisplay.PowerIsOnFeedback.OutputChange += (o, a) =>
|
||||
if (!a.BoolValue)
|
||||
{
|
||||
if (!a.BoolValue)
|
||||
{
|
||||
inputNumber = 102;
|
||||
inputNumberFeedback.FireUpdate();
|
||||
inputNumber = 102;
|
||||
inputNumberFeedback.FireUpdate();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
inputNumber = 0;
|
||||
inputNumberFeedback.FireUpdate();
|
||||
}
|
||||
};
|
||||
|
||||
twoWayDisplay.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff.JoinNumber]);
|
||||
twoWayDisplay.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn.JoinNumber]);
|
||||
}
|
||||
|
||||
// Power Off
|
||||
trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, () =>
|
||||
{
|
||||
inputNumber = 102;
|
||||
inputNumberFeedback.FireUpdate();
|
||||
displayDevice.PowerOff();
|
||||
});
|
||||
|
||||
// PowerOn
|
||||
trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, () =>
|
||||
{
|
||||
inputNumber = 0;
|
||||
inputNumberFeedback.FireUpdate();
|
||||
displayDevice.PowerOn();
|
||||
});
|
||||
|
||||
|
||||
for (int i = 0; i < displayDevice.InputPorts.Count; i++)
|
||||
{
|
||||
var localindex = i;
|
||||
if (localindex >= joinMap.InputNamesOffset.JoinSpan)
|
||||
{
|
||||
this.LogWarning("Device has {inputCount} inputs. The Join Map allows up to {joinSpan} inputs. Discarding inputs {discardStart} - {discardEnd} from bridge.",
|
||||
displayDevice.InputPorts.Count, joinMap.InputNamesOffset.JoinSpan, localindex + 1, displayDevice.InputPorts.Count);
|
||||
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
inputKeys.Add(displayDevice.InputPorts[localindex].Key);
|
||||
|
||||
var tempKey = inputKeys.ElementAt(localindex);
|
||||
|
||||
trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset.JoinNumber + localindex), () => displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector));
|
||||
|
||||
this.LogDebug("Setting Input Select Action on Digital Join {joinNumber} to Input: {input}", joinMap.InputSelectOffset.JoinNumber + localindex, displayDevice.InputPorts[tempKey].Key);
|
||||
|
||||
trilist.SetString((uint)(joinMap.InputNamesOffset.JoinNumber + localindex), displayDevice.InputPorts[localindex].Key);
|
||||
}
|
||||
}
|
||||
|
||||
this.LogDebug("Setting Input Select Action on Analog Join {inputSelectJoin}", joinMap.InputSelect);
|
||||
|
||||
trilist.SetUShortSigAction(joinMap.InputSelect.JoinNumber, (requestedInput) =>
|
||||
{
|
||||
if (requestedInput == 0)
|
||||
{
|
||||
displayDevice.PowerOff();
|
||||
inputNumber = 0;
|
||||
return;
|
||||
inputNumberFeedback.FireUpdate();
|
||||
}
|
||||
};
|
||||
|
||||
// using 1-based indexing for inputs coming from SIMPL, so need to check if the input is <= the count, not <
|
||||
if (requestedInput > 0 && requestedInput <= displayDevice.InputPorts.Count && requestedInput != inputNumber)
|
||||
{
|
||||
displayDevice.ExecuteSwitch(displayDevice.InputPorts.ElementAt(requestedInput - 1).Selector);
|
||||
|
||||
inputNumber = requestedInput;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (requestedInput == 102)
|
||||
{
|
||||
displayDevice.PowerToggle();
|
||||
return;
|
||||
}
|
||||
|
||||
if (displayDevice is TwoWayDisplayBase)
|
||||
{
|
||||
inputNumberFeedback?.FireUpdate();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var volumeDisplay = displayDevice as IBasicVolumeControls;
|
||||
if (volumeDisplay == null) return;
|
||||
|
||||
trilist.SetBoolSigAction(joinMap.VolumeUp.JoinNumber, volumeDisplay.VolumeUp);
|
||||
trilist.SetBoolSigAction(joinMap.VolumeDown.JoinNumber, volumeDisplay.VolumeDown);
|
||||
trilist.SetSigTrueAction(joinMap.VolumeMute.JoinNumber, volumeDisplay.MuteToggle);
|
||||
|
||||
var volumeDisplayWithFeedback = volumeDisplay as IBasicVolumeWithFeedback;
|
||||
|
||||
if (volumeDisplayWithFeedback == null) return;
|
||||
trilist.SetSigTrueAction(joinMap.VolumeMuteOn.JoinNumber, volumeDisplayWithFeedback.MuteOn);
|
||||
trilist.SetSigTrueAction(joinMap.VolumeMuteOff.JoinNumber, volumeDisplayWithFeedback.MuteOff);
|
||||
|
||||
|
||||
trilist.SetUShortSigAction(joinMap.VolumeLevel.JoinNumber, volumeDisplayWithFeedback.SetVolume);
|
||||
volumeDisplayWithFeedback.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.VolumeLevel.JoinNumber]);
|
||||
volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMute.JoinNumber]);
|
||||
volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMuteOn.JoinNumber]);
|
||||
volumeDisplayWithFeedback.MuteFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.VolumeMuteOff.JoinNumber]);
|
||||
twoWayDisplay.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff.JoinNumber]);
|
||||
twoWayDisplay.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn.JoinNumber]);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual void SetCurrentSource(eRoutingSignalType signalType, string sourceListKey, SourceListItem sourceListItem)
|
||||
// Power Off
|
||||
trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, () =>
|
||||
{
|
||||
foreach (eRoutingSignalType type in Enum.GetValues(typeof(eRoutingSignalType)))
|
||||
{
|
||||
var flagValue = Convert.ToInt32(type);
|
||||
// Skip if flagValue is 0 or not a power of two (i.e., not a single-bit flag).
|
||||
// (flagValue & (flagValue - 1)) != 0 checks if more than one bit is set.
|
||||
if (flagValue == 0 || (flagValue & (flagValue - 1)) != 0)
|
||||
{
|
||||
this.LogDebug("Skipping {type}", type);
|
||||
continue;
|
||||
}
|
||||
inputNumber = 102;
|
||||
inputNumberFeedback.FireUpdate();
|
||||
displayDevice.PowerOff();
|
||||
});
|
||||
|
||||
this.LogDebug("setting {type}", type);
|
||||
|
||||
if (signalType.HasFlag(type))
|
||||
{
|
||||
UpdateCurrentSources(type, sourceListKey, sourceListItem);
|
||||
}
|
||||
}
|
||||
// Raise the CurrentSourcesChanged event
|
||||
CurrentSourcesChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void UpdateCurrentSources(eRoutingSignalType signalType, string sourceListKey, SourceListItem sourceListItem)
|
||||
// PowerOn
|
||||
trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, () =>
|
||||
{
|
||||
if (CurrentSources.ContainsKey(signalType))
|
||||
inputNumber = 0;
|
||||
inputNumberFeedback.FireUpdate();
|
||||
displayDevice.PowerOn();
|
||||
});
|
||||
|
||||
|
||||
for (int i = 0; i < displayDevice.InputPorts.Count; i++)
|
||||
{
|
||||
var localindex = i;
|
||||
if (localindex >= joinMap.InputNamesOffset.JoinSpan)
|
||||
{
|
||||
CurrentSources[signalType] = sourceListItem;
|
||||
this.LogWarning("Device has {inputCount} inputs. The Join Map allows up to {joinSpan} inputs. Discarding inputs {discardStart} - {discardEnd} from bridge.",
|
||||
displayDevice.InputPorts.Count, joinMap.InputNamesOffset.JoinSpan, localindex + 1, displayDevice.InputPorts.Count);
|
||||
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentSources.Add(signalType, sourceListItem);
|
||||
}
|
||||
inputKeys.Add(displayDevice.InputPorts[localindex].Key);
|
||||
|
||||
// Update the current source key for the specified signal type
|
||||
if (CurrentSourceKeys.ContainsKey(signalType))
|
||||
{
|
||||
CurrentSourceKeys[signalType] = sourceListKey;
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentSourceKeys.Add(signalType, sourceListKey);
|
||||
var tempKey = inputKeys.ElementAt(localindex);
|
||||
|
||||
trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset.JoinNumber + localindex), () => displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector));
|
||||
|
||||
this.LogDebug("Setting Input Select Action on Digital Join {joinNumber} to Input: {input}", joinMap.InputSelectOffset.JoinNumber + localindex, displayDevice.InputPorts[tempKey].Key);
|
||||
|
||||
trilist.SetString((uint)(joinMap.InputNamesOffset.JoinNumber + localindex), displayDevice.InputPorts[localindex].Key);
|
||||
}
|
||||
}
|
||||
|
||||
this.LogDebug("Setting Input Select Action on Analog Join {inputSelectJoin}", joinMap.InputSelect);
|
||||
|
||||
trilist.SetUShortSigAction(joinMap.InputSelect.JoinNumber, (requestedInput) =>
|
||||
{
|
||||
if (requestedInput == 0)
|
||||
{
|
||||
displayDevice.PowerOff();
|
||||
inputNumber = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// using 1-based indexing for inputs coming from SIMPL, so need to check if the input is <= the count, not <
|
||||
if (requestedInput > 0 && requestedInput <= displayDevice.InputPorts.Count && requestedInput != inputNumber)
|
||||
{
|
||||
displayDevice.ExecuteSwitch(displayDevice.InputPorts.ElementAt(requestedInput - 1).Selector);
|
||||
|
||||
inputNumber = requestedInput;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (requestedInput == 102)
|
||||
{
|
||||
displayDevice.PowerToggle();
|
||||
return;
|
||||
}
|
||||
|
||||
if (displayDevice is TwoWayDisplayBase)
|
||||
{
|
||||
inputNumberFeedback?.FireUpdate();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var volumeDisplay = displayDevice as IBasicVolumeControls;
|
||||
if (volumeDisplay == null) return;
|
||||
|
||||
trilist.SetBoolSigAction(joinMap.VolumeUp.JoinNumber, volumeDisplay.VolumeUp);
|
||||
trilist.SetBoolSigAction(joinMap.VolumeDown.JoinNumber, volumeDisplay.VolumeDown);
|
||||
trilist.SetSigTrueAction(joinMap.VolumeMute.JoinNumber, volumeDisplay.MuteToggle);
|
||||
|
||||
var volumeDisplayWithFeedback = volumeDisplay as IBasicVolumeWithFeedback;
|
||||
|
||||
if (volumeDisplayWithFeedback == null) return;
|
||||
trilist.SetSigTrueAction(joinMap.VolumeMuteOn.JoinNumber, volumeDisplayWithFeedback.MuteOn);
|
||||
trilist.SetSigTrueAction(joinMap.VolumeMuteOff.JoinNumber, volumeDisplayWithFeedback.MuteOff);
|
||||
|
||||
|
||||
trilist.SetUShortSigAction(joinMap.VolumeLevel.JoinNumber, volumeDisplayWithFeedback.SetVolume);
|
||||
volumeDisplayWithFeedback.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.VolumeLevel.JoinNumber]);
|
||||
volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMute.JoinNumber]);
|
||||
volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMuteOn.JoinNumber]);
|
||||
volumeDisplayWithFeedback.MuteFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.VolumeMuteOff.JoinNumber]);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual void SetCurrentSource(eRoutingSignalType signalType, string sourceListKey, SourceListItem sourceListItem)
|
||||
{
|
||||
foreach (eRoutingSignalType type in Enum.GetValues(typeof(eRoutingSignalType)))
|
||||
{
|
||||
var flagValue = Convert.ToInt32(type);
|
||||
// Skip if flagValue is 0 or not a power of two (i.e., not a single-bit flag).
|
||||
// (flagValue & (flagValue - 1)) != 0 checks if more than one bit is set.
|
||||
if (flagValue == 0 || (flagValue & (flagValue - 1)) != 0)
|
||||
{
|
||||
this.LogDebug("Skipping {type}", type);
|
||||
continue;
|
||||
}
|
||||
|
||||
this.LogDebug("setting {type}", type);
|
||||
|
||||
if (signalType.HasFlag(type))
|
||||
{
|
||||
UpdateCurrentSources(type, sourceListKey, sourceListItem);
|
||||
}
|
||||
}
|
||||
// Raise the CurrentSourcesChanged event
|
||||
CurrentSourcesChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void UpdateCurrentSources(eRoutingSignalType signalType, string sourceListKey, SourceListItem sourceListItem)
|
||||
{
|
||||
if (CurrentSources.ContainsKey(signalType))
|
||||
{
|
||||
CurrentSources[signalType] = sourceListItem;
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentSources.Add(signalType, sourceListItem);
|
||||
}
|
||||
|
||||
// Update the current source key for the specified signal type
|
||||
if (CurrentSourceKeys.ContainsKey(signalType))
|
||||
{
|
||||
CurrentSourceKeys[signalType] = sourceListKey;
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentSourceKeys.Add(signalType, sourceListKey);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,89 +1,87 @@
|
|||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Displays
|
||||
namespace PepperDash.Essentials.Devices.Displays;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IInputHdmi1
|
||||
/// </summary>
|
||||
[Obsolete()]
|
||||
public interface IInputHdmi1
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the contract for IInputHdmi1
|
||||
/// Switches to HDMI 1 input
|
||||
/// </summary>
|
||||
[Obsolete()]
|
||||
public interface IInputHdmi1
|
||||
{
|
||||
/// <summary>
|
||||
/// Switches to HDMI 1 input
|
||||
/// </summary>
|
||||
void InputHdmi1();
|
||||
}
|
||||
void InputHdmi1();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IInputHdmi2
|
||||
/// </summary>
|
||||
[Obsolete()]
|
||||
public interface IInputHdmi2
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the contract for IInputHdmi2
|
||||
/// Switches to HDMI 2 input
|
||||
/// </summary>
|
||||
[Obsolete()]
|
||||
public interface IInputHdmi2
|
||||
{
|
||||
/// <summary>
|
||||
/// Switches to HDMI 2 input
|
||||
/// </summary>
|
||||
void InputHdmi2();
|
||||
}
|
||||
void InputHdmi2();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IInputHdmi3
|
||||
/// </summary>
|
||||
[Obsolete()]
|
||||
public interface IInputHdmi3
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the contract for IInputHdmi3
|
||||
/// Switches to HDMI 3 input
|
||||
/// </summary>
|
||||
[Obsolete()]
|
||||
public interface IInputHdmi3
|
||||
{
|
||||
/// <summary>
|
||||
/// Switches to HDMI 3 input
|
||||
/// </summary>
|
||||
void InputHdmi3();
|
||||
}
|
||||
void InputHdmi3();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IInputHdmi4
|
||||
/// </summary>
|
||||
[Obsolete()]
|
||||
public interface IInputHdmi4
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the contract for IInputHdmi4
|
||||
/// Switches to HDMI 4 input
|
||||
/// </summary>
|
||||
[Obsolete()]
|
||||
public interface IInputHdmi4
|
||||
{
|
||||
/// <summary>
|
||||
/// Switches to HDMI 4 input
|
||||
/// </summary>
|
||||
void InputHdmi4();
|
||||
}
|
||||
void InputHdmi4();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IInputDisplayPort1
|
||||
/// </summary>
|
||||
[Obsolete()]
|
||||
public interface IInputDisplayPort1
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the contract for IInputDisplayPort1
|
||||
/// Switches to DisplayPort 1 input
|
||||
/// </summary>
|
||||
[Obsolete()]
|
||||
public interface IInputDisplayPort1
|
||||
{
|
||||
/// <summary>
|
||||
/// Switches to DisplayPort 1 input
|
||||
/// </summary>
|
||||
void InputDisplayPort1();
|
||||
}
|
||||
void InputDisplayPort1();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IInputDisplayPort2
|
||||
/// </summary>
|
||||
[Obsolete()]
|
||||
public interface IInputDisplayPort2
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the contract for IInputDisplayPort2
|
||||
/// Switches to DisplayPort 2 input
|
||||
/// </summary>
|
||||
[Obsolete()]
|
||||
public interface IInputDisplayPort2
|
||||
{
|
||||
/// <summary>
|
||||
/// Switches to DisplayPort 2 input
|
||||
/// </summary>
|
||||
void InputDisplayPort2();
|
||||
}
|
||||
void InputDisplayPort2();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IInputVga1
|
||||
/// </summary>
|
||||
[Obsolete()]
|
||||
public interface IInputVga1
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the contract for IInputVga1
|
||||
/// Switches to VGA 1 input
|
||||
/// </summary>
|
||||
[Obsolete()]
|
||||
public interface IInputVga1
|
||||
{
|
||||
/// <summary>
|
||||
/// Switches to VGA 1 input
|
||||
/// </summary>
|
||||
void InputVga1();
|
||||
}
|
||||
|
||||
}
|
||||
void InputVga1();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,82 +10,62 @@ using PepperDash.Essentials.Core.Config;
|
|||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using Serilog.Events;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Displays
|
||||
namespace PepperDash.Essentials.Devices.Common.Displays;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a mock display device for testing and simulation purposes.
|
||||
/// </summary>
|
||||
public class MockDisplay : TwoWayDisplayBase, IBasicVolumeWithFeedback, IBridgeAdvanced, IHasInputs<string>, IRoutingSinkWithSwitchingWithInputPort, IHasPowerControlWithFeedback
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a MockDisplay
|
||||
/// </summary>
|
||||
public class MockDisplay : TwoWayDisplayBase, IBasicVolumeWithFeedback, IBridgeAdvanced, IHasInputs<string>, IRoutingSinkWithSwitchingWithInputPort, IHasPowerControlWithFeedback
|
||||
public ISelectableItems<string> Inputs { get; private set; }
|
||||
|
||||
bool _PowerIsOn;
|
||||
bool _IsWarmingUp;
|
||||
bool _IsCoolingDown;
|
||||
|
||||
protected override Func<bool> PowerIsOnFeedbackFunc
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Inputs
|
||||
/// </summary>
|
||||
public ISelectableItems<string> Inputs { get; private set; }
|
||||
|
||||
bool _PowerIsOn;
|
||||
bool _IsWarmingUp;
|
||||
bool _IsCoolingDown;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the power is on feedback function
|
||||
/// </summary>
|
||||
protected override Func<bool> PowerIsOnFeedbackFunc
|
||||
get
|
||||
{
|
||||
get
|
||||
{
|
||||
return () =>
|
||||
{
|
||||
return _PowerIsOn;
|
||||
};
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the is cooling down feedback function
|
||||
/// </summary>
|
||||
protected override Func<bool> IsCoolingDownFeedbackFunc
|
||||
{
|
||||
get
|
||||
{
|
||||
return () =>
|
||||
return () =>
|
||||
{
|
||||
return _IsCoolingDown;
|
||||
return _PowerIsOn;
|
||||
};
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the is warming up feedback function
|
||||
/// </summary>
|
||||
protected override Func<bool> IsWarmingUpFeedbackFunc
|
||||
}
|
||||
protected override Func<bool> IsCoolingDownFeedbackFunc
|
||||
{
|
||||
get
|
||||
{
|
||||
get
|
||||
return () =>
|
||||
{
|
||||
return () =>
|
||||
{
|
||||
return _IsWarmingUp;
|
||||
};
|
||||
}
|
||||
return _IsCoolingDown;
|
||||
};
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the current input feedback function
|
||||
/// </summary>
|
||||
protected override Func<string> CurrentInputFeedbackFunc { get { return () => Inputs.CurrentItem; } }
|
||||
|
||||
int VolumeHeldRepeatInterval = 200;
|
||||
ushort VolumeInterval = 655;
|
||||
ushort _FakeVolumeLevel = 31768;
|
||||
bool _IsMuted;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the MockDisplay class
|
||||
/// </summary>
|
||||
/// <param name="key">The device key</param>
|
||||
/// <param name="name">The device name</param>
|
||||
public MockDisplay(string key, string name)
|
||||
: base(key, name)
|
||||
}
|
||||
protected override Func<bool> IsWarmingUpFeedbackFunc
|
||||
{
|
||||
get
|
||||
{
|
||||
Inputs = new MockDisplayInputs
|
||||
return () =>
|
||||
{
|
||||
Items = new Dictionary<string, ISelectableItem>
|
||||
return _IsWarmingUp;
|
||||
};
|
||||
}
|
||||
}
|
||||
protected override Func<string> CurrentInputFeedbackFunc { get { return () => Inputs.CurrentItem; } }
|
||||
|
||||
int VolumeHeldRepeatInterval = 200;
|
||||
ushort VolumeInterval = 655;
|
||||
ushort _FakeVolumeLevel = 31768;
|
||||
bool _IsMuted;
|
||||
|
||||
public MockDisplay(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
Inputs = new MockDisplayInputs
|
||||
{
|
||||
Items = new Dictionary<string, ISelectableItem>
|
||||
{
|
||||
{ "HDMI1", new MockDisplayInput ( "HDMI1", "HDMI 1",this ) },
|
||||
{ "HDMI2", new MockDisplayInput ("HDMI2", "HDMI 2",this ) },
|
||||
|
|
@ -93,276 +73,239 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
|||
{ "HDMI4", new MockDisplayInput ("HDMI4", "HDMI 4",this )},
|
||||
{ "DP", new MockDisplayInput ("DP", "DisplayPort", this ) }
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Inputs.CurrentItemChanged += (o, a) => CurrentInputFeedback.FireUpdate();
|
||||
Inputs.CurrentItemChanged += (o, a) => CurrentInputFeedback.FireUpdate();
|
||||
|
||||
var hdmiIn1 = new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.AudioVideo,
|
||||
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.HdmiIn4, 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("volume", () => { return _FakeVolumeLevel; });
|
||||
MuteFeedback = new BoolFeedback("muteOn", () => _IsMuted);
|
||||
|
||||
WarmupTime = 10000;
|
||||
CooldownTime = 10000;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PowerOn method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override void PowerOn()
|
||||
{
|
||||
if (!PowerIsOnFeedback.BoolValue && !_IsWarmingUp && !_IsCoolingDown)
|
||||
{
|
||||
_IsWarmingUp = true;
|
||||
IsWarmingUpFeedback.InvokeFireUpdate();
|
||||
// Fake power-up cycle
|
||||
WarmupTimer = new CTimer(o =>
|
||||
{
|
||||
_IsWarmingUp = false;
|
||||
_PowerIsOn = true;
|
||||
IsWarmingUpFeedback.InvokeFireUpdate();
|
||||
PowerIsOnFeedback.InvokeFireUpdate();
|
||||
}, WarmupTime);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PowerOff method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override void PowerOff()
|
||||
{
|
||||
// If a display has unreliable-power off feedback, just override this and
|
||||
// remove this check.
|
||||
if (PowerIsOnFeedback.BoolValue && !_IsWarmingUp && !_IsCoolingDown)
|
||||
{
|
||||
_IsCoolingDown = true;
|
||||
IsCoolingDownFeedback.InvokeFireUpdate();
|
||||
// Fake cool-down cycle
|
||||
CooldownTimer = new CTimer(o =>
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Verbose, "Cooldown timer ending", this);
|
||||
_IsCoolingDown = false;
|
||||
IsCoolingDownFeedback.InvokeFireUpdate();
|
||||
_PowerIsOn = false;
|
||||
PowerIsOnFeedback.InvokeFireUpdate();
|
||||
}, CooldownTime);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PowerToggle method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override void PowerToggle()
|
||||
{
|
||||
if (PowerIsOnFeedback.BoolValue && !IsWarmingUpFeedback.BoolValue)
|
||||
PowerOff();
|
||||
else if (!PowerIsOnFeedback.BoolValue && !IsCoolingDownFeedback.BoolValue)
|
||||
PowerOn();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ExecuteSwitch method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override void ExecuteSwitch(object selector)
|
||||
{
|
||||
try
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Verbose, "ExecuteSwitch: {0}", this, selector);
|
||||
|
||||
if (!_PowerIsOn)
|
||||
{
|
||||
PowerOn();
|
||||
}
|
||||
|
||||
if (!Inputs.Items.TryGetValue(selector.ToString(), out var input))
|
||||
return;
|
||||
|
||||
Debug.LogMessage(LogEventLevel.Verbose, "Selected input: {input}", this, input.Key);
|
||||
input.Select();
|
||||
|
||||
var inputPort = InputPorts.FirstOrDefault(port =>
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Verbose, "Checking input port {inputPort} with selector {portSelector} against {selector}", this, port, port.Selector, selector);
|
||||
return port.Selector.ToString() == selector.ToString();
|
||||
});
|
||||
|
||||
if (inputPort == null)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Verbose, "Unable to find input port for selector {selector}", this, selector);
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.LogMessage(LogEventLevel.Verbose, "Setting current input port to {inputPort}", this, inputPort);
|
||||
CurrentInputPort = inputPort;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogMessage(ex, "Error making switch: {Exception}", this, ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SetInput method
|
||||
/// </summary>
|
||||
public void SetInput(string selector)
|
||||
{
|
||||
ISelectableItem currentInput = null;
|
||||
|
||||
try
|
||||
{
|
||||
currentInput = Inputs.Items.SingleOrDefault(Inputs => Inputs.Value.IsSelected).Value;
|
||||
}
|
||||
catch { }
|
||||
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.HdmiIn4, 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 });
|
||||
|
||||
|
||||
if (currentInput != null)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Verbose, this, "SetInput: {0}", selector);
|
||||
currentInput.IsSelected = false;
|
||||
}
|
||||
VolumeLevelFeedback = new IntFeedback("volume", () => { return _FakeVolumeLevel; });
|
||||
MuteFeedback = new BoolFeedback("muteOn", () => _IsMuted);
|
||||
|
||||
if (!Inputs.Items.TryGetValue(selector, out var input))
|
||||
return;
|
||||
|
||||
input.IsSelected = true;
|
||||
|
||||
Inputs.CurrentItem = selector;
|
||||
}
|
||||
|
||||
|
||||
#region IBasicVolumeWithFeedback Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the VolumeLevelFeedback
|
||||
/// </summary>
|
||||
public IntFeedback VolumeLevelFeedback { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// SetVolume method
|
||||
/// </summary>
|
||||
public void SetVolume(ushort level)
|
||||
{
|
||||
_FakeVolumeLevel = level;
|
||||
VolumeLevelFeedback.InvokeFireUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MuteOn method
|
||||
/// </summary>
|
||||
public void MuteOn()
|
||||
{
|
||||
_IsMuted = true;
|
||||
MuteFeedback.InvokeFireUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MuteOff method
|
||||
/// </summary>
|
||||
public void MuteOff()
|
||||
{
|
||||
_IsMuted = false;
|
||||
MuteFeedback.InvokeFireUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the MuteFeedback
|
||||
/// </summary>
|
||||
public BoolFeedback MuteFeedback { get; private set; }
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region IBasicVolumeControls Members
|
||||
|
||||
/// <summary>
|
||||
/// VolumeUp method
|
||||
/// </summary>
|
||||
public void VolumeUp(bool pressRelease)
|
||||
{
|
||||
//while (pressRelease)
|
||||
//{
|
||||
Debug.LogMessage(LogEventLevel.Verbose, this, "Volume Down {0}", pressRelease);
|
||||
if (pressRelease)
|
||||
{
|
||||
var newLevel = _FakeVolumeLevel + VolumeInterval;
|
||||
SetVolume((ushort)newLevel);
|
||||
CrestronEnvironment.Sleep(VolumeHeldRepeatInterval);
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// VolumeDown method
|
||||
/// </summary>
|
||||
public void VolumeDown(bool pressRelease)
|
||||
{
|
||||
//while (pressRelease)
|
||||
//{
|
||||
Debug.LogMessage(LogEventLevel.Verbose, this, "Volume Up {0}", pressRelease);
|
||||
if (pressRelease)
|
||||
{
|
||||
var newLevel = _FakeVolumeLevel - VolumeInterval;
|
||||
SetVolume((ushort)newLevel);
|
||||
CrestronEnvironment.Sleep(VolumeHeldRepeatInterval);
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MuteToggle method
|
||||
/// </summary>
|
||||
public void MuteToggle()
|
||||
{
|
||||
_IsMuted = !_IsMuted;
|
||||
MuteFeedback.InvokeFireUpdate();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// LinkToApi method
|
||||
/// </summary>
|
||||
public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge);
|
||||
}
|
||||
WarmupTime = 10000;
|
||||
CooldownTime = 10000;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a MockDisplayFactory
|
||||
/// PowerOn method
|
||||
/// </summary>
|
||||
public class MockDisplayFactory : EssentialsDeviceFactory<MockDisplay>
|
||||
/// <inheritdoc />
|
||||
public override void PowerOn()
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the MockDisplayFactory class
|
||||
/// </summary>
|
||||
public MockDisplayFactory()
|
||||
if (!PowerIsOnFeedback.BoolValue && !_IsWarmingUp && !_IsCoolingDown)
|
||||
{
|
||||
TypeNames = new List<string>() { "mockdisplay", "mockdisplay2" };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// BuildDevice method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Mock Display Device");
|
||||
return new MockDisplay(dc.Key, dc.Name);
|
||||
_IsWarmingUp = true;
|
||||
IsWarmingUpFeedback.InvokeFireUpdate();
|
||||
// Fake power-up cycle
|
||||
WarmupTimer = new CTimer(o =>
|
||||
{
|
||||
_IsWarmingUp = false;
|
||||
_PowerIsOn = true;
|
||||
IsWarmingUpFeedback.InvokeFireUpdate();
|
||||
PowerIsOnFeedback.InvokeFireUpdate();
|
||||
}, WarmupTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void PowerOff()
|
||||
{
|
||||
// If a display has unreliable-power off feedback, just override this and
|
||||
// remove this check.
|
||||
if (PowerIsOnFeedback.BoolValue && !_IsWarmingUp && !_IsCoolingDown)
|
||||
{
|
||||
_IsCoolingDown = true;
|
||||
IsCoolingDownFeedback.InvokeFireUpdate();
|
||||
// Fake cool-down cycle
|
||||
CooldownTimer = new CTimer(o =>
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Verbose, "Cooldown timer ending", this);
|
||||
_IsCoolingDown = false;
|
||||
IsCoolingDownFeedback.InvokeFireUpdate();
|
||||
_PowerIsOn = false;
|
||||
PowerIsOnFeedback.InvokeFireUpdate();
|
||||
}, CooldownTime);
|
||||
}
|
||||
}
|
||||
|
||||
public override void PowerToggle()
|
||||
{
|
||||
if (PowerIsOnFeedback.BoolValue && !IsWarmingUpFeedback.BoolValue)
|
||||
PowerOff();
|
||||
else if (!PowerIsOnFeedback.BoolValue && !IsCoolingDownFeedback.BoolValue)
|
||||
PowerOn();
|
||||
}
|
||||
|
||||
public override void ExecuteSwitch(object selector)
|
||||
{
|
||||
try
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Verbose, "ExecuteSwitch: {0}", this, selector);
|
||||
|
||||
if (!_PowerIsOn)
|
||||
{
|
||||
PowerOn();
|
||||
}
|
||||
|
||||
if (!Inputs.Items.TryGetValue(selector.ToString(), out var input))
|
||||
return;
|
||||
|
||||
Debug.LogMessage(LogEventLevel.Verbose, "Selected input: {input}", this, input.Key);
|
||||
input.Select();
|
||||
|
||||
var inputPort = InputPorts.FirstOrDefault(port =>
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Verbose, "Checking input port {inputPort} with selector {portSelector} against {selector}", this, port, port.Selector, selector);
|
||||
return port.Selector.ToString() == selector.ToString();
|
||||
});
|
||||
|
||||
if (inputPort == null)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Verbose, "Unable to find input port for selector {selector}", this, selector);
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.LogMessage(LogEventLevel.Verbose, "Setting current input port to {inputPort}", this, inputPort);
|
||||
CurrentInputPort = inputPort;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogMessage(ex, "Error making switch: {Exception}", this, ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetInput(string selector)
|
||||
{
|
||||
ISelectableItem currentInput = null;
|
||||
|
||||
|
||||
if (currentInput != null)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Verbose, 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; }
|
||||
|
||||
/// <summary>
|
||||
/// SetVolume method
|
||||
/// </summary>
|
||||
public void SetVolume(ushort level)
|
||||
{
|
||||
_FakeVolumeLevel = level;
|
||||
VolumeLevelFeedback.InvokeFireUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MuteOn method
|
||||
/// </summary>
|
||||
public void MuteOn()
|
||||
{
|
||||
_IsMuted = true;
|
||||
MuteFeedback.InvokeFireUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MuteOff method
|
||||
/// </summary>
|
||||
public void MuteOff()
|
||||
{
|
||||
_IsMuted = false;
|
||||
MuteFeedback.InvokeFireUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the MuteFeedback
|
||||
/// </summary>
|
||||
public BoolFeedback MuteFeedback { get; private set; }
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region IBasicVolumeControls Members
|
||||
|
||||
public void VolumeUp(bool pressRelease)
|
||||
{
|
||||
//while (pressRelease)
|
||||
//{
|
||||
Debug.LogMessage(LogEventLevel.Verbose, this, "Volume Down {0}", pressRelease);
|
||||
if (pressRelease)
|
||||
{
|
||||
var newLevel = _FakeVolumeLevel + VolumeInterval;
|
||||
SetVolume((ushort)newLevel);
|
||||
CrestronEnvironment.Sleep(VolumeHeldRepeatInterval);
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
public void VolumeDown(bool pressRelease)
|
||||
{
|
||||
//while (pressRelease)
|
||||
//{
|
||||
Debug.LogMessage(LogEventLevel.Verbose, this, "Volume Up {0}", pressRelease);
|
||||
if (pressRelease)
|
||||
{
|
||||
var newLevel = _FakeVolumeLevel - VolumeInterval;
|
||||
SetVolume((ushort)newLevel);
|
||||
CrestronEnvironment.Sleep(VolumeHeldRepeatInterval);
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MuteToggle method
|
||||
/// </summary>
|
||||
public void MuteToggle()
|
||||
{
|
||||
_IsMuted = !_IsMuted;
|
||||
MuteFeedback.InvokeFireUpdate();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a MockDisplayFactory
|
||||
/// </summary>
|
||||
public class MockDisplayFactory : EssentialsDeviceFactory<MockDisplay>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the MockDisplayFactory class
|
||||
/// </summary>
|
||||
public MockDisplayFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "mockdisplay", "mockdisplay2" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Mock Display Device");
|
||||
return new MockDisplay(dc.Key, dc.Name);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,135 +2,95 @@
|
|||
using System.Collections.Generic;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Displays
|
||||
namespace PepperDash.Essentials.Devices.Common.Displays;
|
||||
|
||||
public class MockDisplayInputs : ISelectableItems<string>
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a MockDisplayInputs
|
||||
/// </summary>
|
||||
public class MockDisplayInputs : ISelectableItems<string>
|
||||
private Dictionary<string, ISelectableItem> _items;
|
||||
|
||||
public Dictionary<string, ISelectableItem> Items
|
||||
{
|
||||
private Dictionary<string, ISelectableItem> _items;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the collection of selectable items
|
||||
/// </summary>
|
||||
public Dictionary<string, ISelectableItem> Items
|
||||
get
|
||||
{
|
||||
get
|
||||
{
|
||||
return _items;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_items == value)
|
||||
return;
|
||||
|
||||
_items = value;
|
||||
|
||||
ItemsUpdated?.Invoke(this, null);
|
||||
}
|
||||
return _items;
|
||||
}
|
||||
|
||||
private string _currentItem;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the currently selected item
|
||||
/// </summary>
|
||||
public string CurrentItem
|
||||
set
|
||||
{
|
||||
get
|
||||
{
|
||||
return _currentItem;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_currentItem == value)
|
||||
return;
|
||||
if (_items == value)
|
||||
return;
|
||||
|
||||
_currentItem = value;
|
||||
_items = value;
|
||||
|
||||
CurrentItemChanged?.Invoke(this, null);
|
||||
}
|
||||
ItemsUpdated?.Invoke(this, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the items collection is updated
|
||||
/// </summary>
|
||||
public event EventHandler ItemsUpdated;
|
||||
/// <summary>
|
||||
/// Occurs when the current item changes
|
||||
/// </summary>
|
||||
public event EventHandler CurrentItemChanged;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a MockDisplayInput
|
||||
/// </summary>
|
||||
public class MockDisplayInput : ISelectableItem
|
||||
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 MockDisplay _parent;
|
||||
|
||||
private bool _isSelected;
|
||||
|
||||
public bool IsSelected
|
||||
{
|
||||
private MockDisplay _parent;
|
||||
|
||||
private bool _isSelected;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this input is selected
|
||||
/// </summary>
|
||||
public bool IsSelected
|
||||
get
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isSelected;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_isSelected == value)
|
||||
return;
|
||||
|
||||
_isSelected = value;
|
||||
|
||||
ItemUpdated?.Invoke(this, null);
|
||||
}
|
||||
return _isSelected;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Name
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Key
|
||||
/// </summary>
|
||||
public string Key { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when this item is updated
|
||||
/// </summary>
|
||||
public event EventHandler ItemUpdated;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the MockDisplayInput class
|
||||
/// </summary>
|
||||
/// <param name="key">The input key</param>
|
||||
/// <param name="name">The input name</param>
|
||||
/// <param name="parent">The parent mock display</param>
|
||||
public MockDisplayInput(string key, string name, MockDisplay parent)
|
||||
set
|
||||
{
|
||||
Key = key;
|
||||
Name = name;
|
||||
_parent = parent;
|
||||
if (_isSelected == value)
|
||||
return;
|
||||
|
||||
_isSelected = value;
|
||||
|
||||
ItemUpdated?.Invoke(this, null);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Select method
|
||||
/// </summary>
|
||||
public void Select()
|
||||
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()
|
||||
{
|
||||
if (!_parent.PowerIsOnFeedback.BoolValue) _parent.PowerOn();
|
||||
|
||||
foreach(var input in _parent.Inputs.Items)
|
||||
{
|
||||
if (!_parent.PowerIsOnFeedback.BoolValue) _parent.PowerOn();
|
||||
|
||||
foreach (var input in _parent.Inputs.Items)
|
||||
{
|
||||
input.Value.IsSelected = input.Key == this.Key;
|
||||
}
|
||||
input.Value.IsSelected = input.Key == this.Key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -434,7 +434,7 @@ namespace PepperDash.Essentials.Devices.Common.Shades
|
|||
/// <summary>
|
||||
/// Factory for ScreenLiftController devices
|
||||
/// </summary>
|
||||
public class ScreenLiftControllerFactory : EssentialsDeviceFactory<RelayControlledShade>
|
||||
public class ScreenLiftControllerFactory : EssentialsDeviceFactory<ScreenLiftController>
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor for ScreenLiftControllerFactory
|
||||
|
|
@ -453,4 +453,4 @@ namespace PepperDash.Essentials.Devices.Common.Shades
|
|||
return new ScreenLiftController(dc.Key, dc.Name, props);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -7,152 +7,154 @@ using PepperDash.Essentials.Core.Config;
|
|||
using PepperDash.Essentials.Core.Routing;
|
||||
using Serilog.Events;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Generic
|
||||
namespace PepperDash.Essentials.Devices.Common.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a GenericSink
|
||||
/// </summary>
|
||||
public class GenericSink : EssentialsDevice, IRoutingSinkWithSwitchingWithInputPort, ICurrentSources
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public Dictionary<eRoutingSignalType, SourceListItem> CurrentSources { get; private set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Dictionary<eRoutingSignalType, string> CurrentSourceKeys { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public event EventHandler CurrentSourcesChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a GenericSink
|
||||
/// Initializes a new instance of the GenericSink class
|
||||
/// </summary>
|
||||
public class GenericSink : EssentialsDevice, IRoutingSinkWithSwitchingWithInputPort, ICurrentSources
|
||||
/// <param name="key">The device key</param>
|
||||
/// <param name="name">The device name</param>
|
||||
public GenericSink(string key, string name) : base(key, name)
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public Dictionary<eRoutingSignalType, SourceListItem> CurrentSources { get; private set; }
|
||||
InputPorts = new RoutingPortCollection<RoutingInputPort>();
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Dictionary<eRoutingSignalType, string> CurrentSourceKeys { get; private set; }
|
||||
var inputPort = new RoutingInputPort(RoutingPortNames.AnyVideoIn, eRoutingSignalType.AudioVideo | eRoutingSignalType.SecondaryAudio, eRoutingPortConnectionType.Hdmi, null, this);
|
||||
|
||||
/// <inheritdoc />
|
||||
public event EventHandler CurrentSourcesChanged;
|
||||
InputPorts.Add(inputPort);
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the GenericSink class
|
||||
/// </summary>
|
||||
/// <param name="key">The device key</param>
|
||||
/// <param name="name">The device name</param>
|
||||
public GenericSink(string key, string name) : base(key, name)
|
||||
{
|
||||
InputPorts = new RoutingPortCollection<RoutingInputPort>();
|
||||
|
||||
var inputPort = new RoutingInputPort(RoutingPortNames.AnyVideoIn, eRoutingSignalType.AudioVideo | eRoutingSignalType.SecondaryAudio, eRoutingPortConnectionType.Hdmi, null, this);
|
||||
|
||||
InputPorts.Add(inputPort);
|
||||
|
||||
CurrentSources = new Dictionary<eRoutingSignalType, SourceListItem>
|
||||
CurrentSources = new Dictionary<eRoutingSignalType, SourceListItem>
|
||||
{
|
||||
{ eRoutingSignalType.Audio, null },
|
||||
{ eRoutingSignalType.Video, null },
|
||||
};
|
||||
|
||||
CurrentSourceKeys = new Dictionary<eRoutingSignalType, string>
|
||||
CurrentSourceKeys = new Dictionary<eRoutingSignalType, string>
|
||||
{
|
||||
{ eRoutingSignalType.Audio, string.Empty },
|
||||
{ eRoutingSignalType.Video, string.Empty },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void SetCurrentSource(eRoutingSignalType signalType, string sourceListKey, SourceListItem sourceListItem)
|
||||
/// <inheritdoc />
|
||||
public void SetCurrentSource(eRoutingSignalType signalType, string sourceListKey, SourceListItem sourceListItem)
|
||||
{
|
||||
foreach (eRoutingSignalType type in Enum.GetValues(typeof(eRoutingSignalType)))
|
||||
{
|
||||
foreach (eRoutingSignalType type in Enum.GetValues(typeof(eRoutingSignalType)))
|
||||
var flagValue = Convert.ToInt32(type);
|
||||
// Skip if flagValue is 0 or not a power of two (i.e., not a single-bit flag).
|
||||
// (flagValue & (flagValue - 1)) != 0 checks if more than one bit is set.
|
||||
if (flagValue == 0 || (flagValue & (flagValue - 1)) != 0)
|
||||
{
|
||||
var flagValue = Convert.ToInt32(type);
|
||||
// Skip if flagValue is 0 or not a power of two (i.e., not a single-bit flag).
|
||||
// (flagValue & (flagValue - 1)) != 0 checks if more than one bit is set.
|
||||
if (flagValue == 0 || (flagValue & (flagValue - 1)) != 0)
|
||||
{
|
||||
this.LogDebug("Skipping {type}", type);
|
||||
continue;
|
||||
}
|
||||
|
||||
this.LogDebug("setting {type}", type);
|
||||
|
||||
if (signalType.HasFlag(type))
|
||||
{
|
||||
UpdateCurrentSources(type, sourceListKey, sourceListItem);
|
||||
}
|
||||
this.LogDebug("Skipping {type}", type);
|
||||
continue;
|
||||
}
|
||||
// Raise the CurrentSourcesChanged event
|
||||
CurrentSourcesChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void UpdateCurrentSources(eRoutingSignalType signalType, string sourceListKey, SourceListItem sourceListItem)
|
||||
{
|
||||
CurrentSources[signalType] = sourceListItem;
|
||||
CurrentSourceKeys[signalType] = sourceListKey;
|
||||
}
|
||||
this.LogDebug("setting {type}", type);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the InputPorts
|
||||
/// </summary>
|
||||
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CurrentSourceInfoKey
|
||||
/// </summary>
|
||||
public string CurrentSourceInfoKey { get; set; }
|
||||
|
||||
private SourceListItem _currentSource;
|
||||
/// <summary>
|
||||
/// Gets or sets the CurrentSourceInfo
|
||||
/// </summary>
|
||||
public SourceListItem CurrentSourceInfo
|
||||
{
|
||||
get => _currentSource;
|
||||
set
|
||||
if (signalType.HasFlag(type))
|
||||
{
|
||||
if (value == _currentSource)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CurrentSourceChange?.Invoke(_currentSource, ChangeType.WillChange);
|
||||
|
||||
_currentSource = value;
|
||||
|
||||
CurrentSourceChange?.Invoke(_currentSource, ChangeType.DidChange);
|
||||
UpdateCurrentSources(type, sourceListKey, sourceListItem);
|
||||
}
|
||||
}
|
||||
// Raise the CurrentSourcesChanged event
|
||||
CurrentSourcesChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current input port
|
||||
/// </summary>
|
||||
public RoutingInputPort CurrentInputPort => InputPorts[0];
|
||||
private void UpdateCurrentSources(eRoutingSignalType signalType, string sourceListKey, SourceListItem sourceListItem)
|
||||
{
|
||||
CurrentSources[signalType] = sourceListItem;
|
||||
CurrentSourceKeys[signalType] = sourceListKey;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event fired when the current source changes
|
||||
/// </summary>
|
||||
public event SourceInfoChangeHandler CurrentSourceChange;
|
||||
/// <summary>
|
||||
/// Gets or sets the InputPorts
|
||||
/// </summary>
|
||||
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public event InputChangedEventHandler InputChanged;
|
||||
/// <summary>
|
||||
/// Gets or sets the CurrentSourceInfoKey
|
||||
/// </summary>
|
||||
public string CurrentSourceInfoKey { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void ExecuteSwitch(object inputSelector)
|
||||
private SourceListItem _currentSource;
|
||||
/// <summary>
|
||||
/// Gets or sets the CurrentSourceInfo
|
||||
/// </summary>
|
||||
public SourceListItem CurrentSourceInfo
|
||||
{
|
||||
get => _currentSource;
|
||||
set
|
||||
{
|
||||
this.LogDebug("GenericSink Executing Switch to: {inputSelector}", inputSelector);
|
||||
if (value == _currentSource)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CurrentSourceChange?.Invoke(_currentSource, ChangeType.WillChange);
|
||||
|
||||
_currentSource = value;
|
||||
|
||||
CurrentSourceChange?.Invoke(_currentSource, ChangeType.DidChange);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a GenericSinkFactory
|
||||
/// Gets the current input port
|
||||
/// </summary>
|
||||
public class GenericSinkFactory : EssentialsDeviceFactory<GenericSink>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the GenericSinkFactory class
|
||||
/// </summary>
|
||||
public GenericSinkFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "genericsink", "genericdestination" };
|
||||
}
|
||||
public RoutingInputPort CurrentInputPort => InputPorts[0];
|
||||
|
||||
/// <summary>
|
||||
/// BuildDevice method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Generic Sink Device");
|
||||
return new GenericSink(dc.Key, dc.Name);
|
||||
}
|
||||
/// <summary>
|
||||
/// Event fired when the current source changes
|
||||
/// </summary>
|
||||
public event SourceInfoChangeHandler CurrentSourceChange;
|
||||
|
||||
/// <inheritdoc />
|
||||
public event InputChangedEventHandler InputChanged;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void ExecuteSwitch(object inputSelector)
|
||||
{
|
||||
this.LogDebug("GenericSink Executing Switch to: {inputSelector}", inputSelector);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a GenericSinkFactory
|
||||
/// </summary>
|
||||
public class GenericSinkFactory : EssentialsDeviceFactory<GenericSink>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the GenericSinkFactory class
|
||||
/// </summary>
|
||||
public GenericSinkFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "genericsink", "genericdestination" };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// BuildDevice method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Generic Sink Device");
|
||||
return new GenericSink(dc.Key, dc.Name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,77 +5,76 @@ using PepperDash.Essentials.Core;
|
|||
using PepperDash.Essentials.Core.Config;
|
||||
using Serilog.Events;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common
|
||||
namespace PepperDash.Essentials.Devices.Common;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a GenericSource
|
||||
/// </summary>
|
||||
public class GenericSource : EssentialsDevice, IUiDisplayInfo, IRoutingSource, IUsageTracking
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the DisplayUiType
|
||||
/// </summary>
|
||||
public uint DisplayUiType { get { return DisplayUiConstants.TypeNoControls; } }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the GenericSource class
|
||||
/// </summary>
|
||||
/// <param name="key">The device key</param>
|
||||
/// <param name="name">The device name</param>
|
||||
public GenericSource(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
|
||||
AnyOut = new RoutingOutputPort(RoutingPortNames.AnyOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Hdmi, null, this);
|
||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort> { AnyOut };
|
||||
}
|
||||
|
||||
#region IRoutingOutputs Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the AnyOut
|
||||
/// </summary>
|
||||
public RoutingOutputPort AnyOut { get; private set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the OutputPorts
|
||||
/// </summary>
|
||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region IUsageTracking Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the UsageTracker
|
||||
/// </summary>
|
||||
public UsageTracking UsageTracker { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a GenericSourceFactory
|
||||
/// </summary>
|
||||
public class GenericSourceFactory : EssentialsDeviceFactory<GenericSource>
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a GenericSource
|
||||
/// Initializes a new instance of the GenericSourceFactory class
|
||||
/// </summary>
|
||||
public class GenericSource : EssentialsDevice, IUiDisplayInfo, IRoutingSource, IUsageTracking
|
||||
public GenericSourceFactory()
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the DisplayUiType
|
||||
/// </summary>
|
||||
public uint DisplayUiType { get { return DisplayUiConstants.TypeNoControls; } }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the GenericSource class
|
||||
/// </summary>
|
||||
/// <param name="key">The device key</param>
|
||||
/// <param name="name">The device name</param>
|
||||
public GenericSource(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
|
||||
AnyOut = new RoutingOutputPort(RoutingPortNames.AnyOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Hdmi, null, this);
|
||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort> { AnyOut };
|
||||
}
|
||||
|
||||
#region IRoutingOutputs Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the AnyOut
|
||||
/// </summary>
|
||||
public RoutingOutputPort AnyOut { get; private set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the OutputPorts
|
||||
/// </summary>
|
||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region IUsageTracking Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the UsageTracker
|
||||
/// </summary>
|
||||
public UsageTracking UsageTracker { get; set; }
|
||||
|
||||
#endregion
|
||||
TypeNames = new List<string>() { "genericsource" };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a GenericSourceFactory
|
||||
/// BuildDevice method
|
||||
/// </summary>
|
||||
public class GenericSourceFactory : EssentialsDeviceFactory<GenericSource>
|
||||
/// <inheritdoc />
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the GenericSourceFactory class
|
||||
/// </summary>
|
||||
public GenericSourceFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "genericsource" };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// BuildDevice method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Generic Source Device");
|
||||
return new GenericSource(dc.Key, dc.Name);
|
||||
}
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Generic Source Device");
|
||||
return new GenericSource(dc.Key, dc.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
|
||||
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
|
@ -11,167 +9,167 @@ using PepperDash.Essentials.Core.Bridges;
|
|||
using PepperDash.Essentials.Core.Lighting;
|
||||
using Serilog.Events;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Lighting
|
||||
namespace PepperDash.Essentials.Devices.Common.Lighting;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Base class for lighting devices that support scenes
|
||||
/// </summary>
|
||||
public abstract class LightingBase : EssentialsBridgeableDevice, ILightingScenes
|
||||
{
|
||||
#region ILightingScenes Members
|
||||
|
||||
/// <summary>
|
||||
/// Base class for lighting devices that support scenes
|
||||
/// Event fired when lighting scene changes
|
||||
/// </summary>
|
||||
public abstract class LightingBase : EssentialsBridgeableDevice, ILightingScenes
|
||||
public event EventHandler<LightingSceneChangeEventArgs> LightingSceneChange;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the LightingScenes
|
||||
/// </summary>
|
||||
public List<LightingScene> LightingScenes { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CurrentLightingScene
|
||||
/// </summary>
|
||||
public LightingScene CurrentLightingScene { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CurrentLightingSceneFeedback
|
||||
/// </summary>
|
||||
public IntFeedback CurrentLightingSceneFeedback { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the LightingBase class
|
||||
/// </summary>
|
||||
/// <param name="key">The device key</param>
|
||||
/// <param name="name">The device name</param>
|
||||
protected LightingBase(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
#region ILightingScenes Members
|
||||
LightingScenes = new List<LightingScene>();
|
||||
|
||||
/// <summary>
|
||||
/// Event fired when lighting scene changes
|
||||
/// </summary>
|
||||
public event EventHandler<LightingSceneChangeEventArgs> LightingSceneChange;
|
||||
CurrentLightingScene = new LightingScene();
|
||||
//CurrentLightingSceneFeedback = new IntFeedback(() => { return int.Parse(this.CurrentLightingScene.ID); });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the LightingScenes
|
||||
/// </summary>
|
||||
public List<LightingScene> LightingScenes { get; protected set; }
|
||||
/// <summary>
|
||||
/// Selects the specified lighting scene
|
||||
/// </summary>
|
||||
/// <param name="scene">The lighting scene to select</param>
|
||||
public abstract void SelectScene(LightingScene scene);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CurrentLightingScene
|
||||
/// </summary>
|
||||
public LightingScene CurrentLightingScene { get; protected set; }
|
||||
/// <summary>
|
||||
/// SimulateSceneSelect method
|
||||
/// </summary>
|
||||
public void SimulateSceneSelect(string sceneName)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Simulating selection of scene '{0}'", sceneName);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CurrentLightingSceneFeedback
|
||||
/// </summary>
|
||||
public IntFeedback CurrentLightingSceneFeedback { get; protected set; }
|
||||
var scene = LightingScenes.FirstOrDefault(s => s.Name.Equals(sceneName));
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the LightingBase class
|
||||
/// </summary>
|
||||
/// <param name="key">The device key</param>
|
||||
/// <param name="name">The device name</param>
|
||||
protected LightingBase(string key, string name)
|
||||
: base(key, name)
|
||||
if (scene != null)
|
||||
{
|
||||
LightingScenes = new List<LightingScene>();
|
||||
|
||||
CurrentLightingScene = new LightingScene();
|
||||
//CurrentLightingSceneFeedback = new IntFeedback(() => { return int.Parse(this.CurrentLightingScene.ID); });
|
||||
CurrentLightingScene = scene;
|
||||
OnLightingSceneChange();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selects the specified lighting scene
|
||||
/// </summary>
|
||||
/// <param name="scene">The lighting scene to select</param>
|
||||
public abstract void SelectScene(LightingScene scene);
|
||||
|
||||
/// <summary>
|
||||
/// SimulateSceneSelect method
|
||||
/// </summary>
|
||||
public void SimulateSceneSelect(string sceneName)
|
||||
/// <summary>
|
||||
/// Sets the IsActive property on each scene and fires the LightingSceneChange event
|
||||
/// </summary>
|
||||
protected void OnLightingSceneChange()
|
||||
{
|
||||
foreach (var scene in LightingScenes)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Simulating selection of scene '{0}'", sceneName);
|
||||
if (scene == CurrentLightingScene)
|
||||
scene.IsActive = true;
|
||||
|
||||
var scene = LightingScenes.FirstOrDefault(s => s.Name.Equals(sceneName));
|
||||
|
||||
if (scene != null)
|
||||
{
|
||||
CurrentLightingScene = scene;
|
||||
OnLightingSceneChange();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the IsActive property on each scene and fires the LightingSceneChange event
|
||||
/// </summary>
|
||||
protected void OnLightingSceneChange()
|
||||
{
|
||||
foreach (var scene in LightingScenes)
|
||||
{
|
||||
if (scene == CurrentLightingScene)
|
||||
scene.IsActive = true;
|
||||
|
||||
else
|
||||
scene.IsActive = false;
|
||||
}
|
||||
LightingSceneChange?.Invoke(this, new LightingSceneChangeEventArgs(CurrentLightingScene));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Links the lighting device to API with join map configuration
|
||||
/// </summary>
|
||||
/// <param name="lightingDevice">The lighting device to link</param>
|
||||
/// <param name="trilist">The trilist to link to</param>
|
||||
/// <param name="joinStart">The starting join number</param>
|
||||
/// <param name="joinMapKey">The join map key</param>
|
||||
/// <param name="bridge">The EISC API bridge</param>
|
||||
/// <returns>The configured join map</returns>
|
||||
protected GenericLightingJoinMap LinkLightingToApi(LightingBase lightingDevice, BasicTriList trilist, uint joinStart,
|
||||
string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
var joinMap = new GenericLightingJoinMap(joinStart);
|
||||
|
||||
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||
joinMap = JsonConvert.DeserializeObject<GenericLightingJoinMap>(joinMapSerialized);
|
||||
|
||||
if (bridge != null)
|
||||
{
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Information, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
|
||||
}
|
||||
scene.IsActive = false;
|
||||
}
|
||||
LightingSceneChange?.Invoke(this, new LightingSceneChangeEventArgs(CurrentLightingScene));
|
||||
}
|
||||
|
||||
return LinkLightingToApi(lightingDevice, trilist, joinMap);
|
||||
/// <summary>
|
||||
/// Links the lighting device to API with join map configuration
|
||||
/// </summary>
|
||||
/// <param name="lightingDevice">The lighting device to link</param>
|
||||
/// <param name="trilist">The trilist to link to</param>
|
||||
/// <param name="joinStart">The starting join number</param>
|
||||
/// <param name="joinMapKey">The join map key</param>
|
||||
/// <param name="bridge">The EISC API bridge</param>
|
||||
/// <returns>The configured join map</returns>
|
||||
protected GenericLightingJoinMap LinkLightingToApi(LightingBase lightingDevice, BasicTriList trilist, uint joinStart,
|
||||
string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
var joinMap = new GenericLightingJoinMap(joinStart);
|
||||
|
||||
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||
joinMap = JsonConvert.DeserializeObject<GenericLightingJoinMap>(joinMapSerialized);
|
||||
|
||||
if (bridge != null)
|
||||
{
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Information, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Links the lighting device to API using an existing join map
|
||||
/// </summary>
|
||||
/// <param name="lightingDevice">The lighting device to link</param>
|
||||
/// <param name="trilist">The trilist to link to</param>
|
||||
/// <param name="joinMap">The join map to use</param>
|
||||
/// <returns>The join map used for linking</returns>
|
||||
protected GenericLightingJoinMap LinkLightingToApi(LightingBase lightingDevice, BasicTriList trilist, GenericLightingJoinMap joinMap)
|
||||
return LinkLightingToApi(lightingDevice, trilist, joinMap);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Links the lighting device to API using an existing join map
|
||||
/// </summary>
|
||||
/// <param name="lightingDevice">The lighting device to link</param>
|
||||
/// <param name="trilist">The trilist to link to</param>
|
||||
/// <param name="joinMap">The join map to use</param>
|
||||
/// <returns>The join map used for linking</returns>
|
||||
protected GenericLightingJoinMap LinkLightingToApi(LightingBase lightingDevice, BasicTriList trilist, GenericLightingJoinMap joinMap)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
|
||||
Debug.LogMessage(LogEventLevel.Information, "Linking to Lighting Type {0}", lightingDevice.GetType().Name.ToString());
|
||||
|
||||
// GenericLighitng Actions & FeedBack
|
||||
trilist.SetUShortSigAction(joinMap.SelectScene.JoinNumber, u => lightingDevice.SelectScene(lightingDevice.LightingScenes[u]));
|
||||
|
||||
var sceneIndex = 0;
|
||||
foreach (var scene in lightingDevice.LightingScenes)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
var index = sceneIndex;
|
||||
|
||||
Debug.LogMessage(LogEventLevel.Information, "Linking to Lighting Type {0}", lightingDevice.GetType().Name.ToString());
|
||||
trilist.SetSigTrueAction((uint)(joinMap.SelectSceneDirect.JoinNumber + index), () => lightingDevice.SelectScene(lightingDevice.LightingScenes[index]));
|
||||
scene.IsActiveFeedback.LinkInputSig(trilist.BooleanInput[(uint)(joinMap.SelectSceneDirect.JoinNumber + index)]);
|
||||
trilist.StringInput[(uint)(joinMap.SelectSceneDirect.JoinNumber + index)].StringValue = scene.Name;
|
||||
trilist.BooleanInput[(uint)(joinMap.ButtonVisibility.JoinNumber + index)].BoolValue = true;
|
||||
|
||||
// GenericLighitng Actions & FeedBack
|
||||
trilist.SetUShortSigAction(joinMap.SelectScene.JoinNumber, u => lightingDevice.SelectScene(lightingDevice.LightingScenes[u]));
|
||||
sceneIndex++;
|
||||
}
|
||||
|
||||
var sceneIndex = 0;
|
||||
trilist.OnlineStatusChange += (sender, args) =>
|
||||
{
|
||||
if (!args.DeviceOnLine) return;
|
||||
|
||||
sceneIndex = 0;
|
||||
foreach (var scene in lightingDevice.LightingScenes)
|
||||
{
|
||||
var index = sceneIndex;
|
||||
|
||||
trilist.SetSigTrueAction((uint)(joinMap.SelectSceneDirect.JoinNumber + index), () => lightingDevice.SelectScene(lightingDevice.LightingScenes[index]));
|
||||
scene.IsActiveFeedback.LinkInputSig(trilist.BooleanInput[(uint)(joinMap.SelectSceneDirect.JoinNumber + index)]);
|
||||
trilist.StringInput[(uint)(joinMap.SelectSceneDirect.JoinNumber + index)].StringValue = scene.Name;
|
||||
trilist.BooleanInput[(uint)(joinMap.ButtonVisibility.JoinNumber + index)].BoolValue = true;
|
||||
scene.IsActiveFeedback.FireUpdate();
|
||||
|
||||
sceneIndex++;
|
||||
}
|
||||
};
|
||||
|
||||
trilist.OnlineStatusChange += (sender, args) =>
|
||||
{
|
||||
if (!args.DeviceOnLine) return;
|
||||
|
||||
sceneIndex = 0;
|
||||
foreach (var scene in lightingDevice.LightingScenes)
|
||||
{
|
||||
var index = sceneIndex;
|
||||
|
||||
trilist.StringInput[(uint)(joinMap.SelectSceneDirect.JoinNumber + index)].StringValue = scene.Name;
|
||||
trilist.BooleanInput[(uint)(joinMap.ButtonVisibility.JoinNumber + index)].BoolValue = true;
|
||||
scene.IsActiveFeedback.FireUpdate();
|
||||
|
||||
sceneIndex++;
|
||||
}
|
||||
};
|
||||
|
||||
return joinMap;
|
||||
}
|
||||
return joinMap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Room.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Room
|
||||
namespace PepperDash.Essentials.Devices.Common.Room;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IEssentialsHuddleSpaceRoom
|
||||
/// </summary>
|
||||
public interface IEssentialsHuddleSpaceRoom : IEssentialsRoom, IHasCurrentSourceInfoChange, IRunRouteAction, IHasDefaultDisplay, IHasCurrentVolumeControls, IRoomOccupancy,
|
||||
IEmergency, IMicrophonePrivacy
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the contract for IEssentialsHuddleSpaceRoom
|
||||
/// Gets whether to exclude this room from global functions
|
||||
/// </summary>
|
||||
public interface IEssentialsHuddleSpaceRoom : IEssentialsRoom, IHasCurrentSourceInfoChange, IRunRouteAction, IHasDefaultDisplay, IHasCurrentVolumeControls, IRoomOccupancy,
|
||||
IEmergency, IMicrophonePrivacy
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets whether to exclude this room from global functions
|
||||
/// </summary>
|
||||
bool ExcludeFromGlobalFunctions { get; }
|
||||
bool ExcludeFromGlobalFunctions { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Runs the route action for the given routeKey and sourceListKey
|
||||
/// </summary>
|
||||
/// <param name="routeKey">The route key</param>
|
||||
void RunRouteAction(string routeKey);
|
||||
/// <summary>
|
||||
/// Runs the route action for the given routeKey and sourceListKey
|
||||
/// </summary>
|
||||
/// <param name="routeKey">The route key</param>
|
||||
void RunRouteAction(string routeKey);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the PropertiesConfig
|
||||
/// </summary>
|
||||
EssentialsHuddleRoomPropertiesConfig PropertiesConfig { get; }
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the PropertiesConfig
|
||||
/// </summary>
|
||||
EssentialsHuddleRoomPropertiesConfig PropertiesConfig { get; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,51 +1,53 @@
|
|||
using PepperDash.Essentials.Core;
|
||||
using System;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Devices.Common.AudioCodec;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
using PepperDash.Essentials.Room.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Room
|
||||
namespace PepperDash.Essentials.Devices.Common.Room;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IEssentialsHuddleVtc1Room
|
||||
/// </summary>
|
||||
[Obsolete("Obsolete in favor of IEssentialsRoom. This interface will be removed in a future release.")]
|
||||
public interface IEssentialsHuddleVtc1Room : IEssentialsRoom, IHasCurrentSourceInfoChange, IHasCurrentVolumeControls, IRunRouteAction, IRunDefaultCallRoute, IHasVideoCodec, IHasAudioCodec, IHasDefaultDisplay, IHasInCallFeedback,
|
||||
IRoomOccupancy, IEmergency, IMicrophonePrivacy
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the contract for IEssentialsHuddleVtc1Room
|
||||
/// Gets the PropertiesConfig
|
||||
/// </summary>
|
||||
public interface IEssentialsHuddleVtc1Room : IEssentialsRoom, IHasCurrentSourceInfoChange, IHasCurrentVolumeControls, IRunRouteAction, IRunDefaultCallRoute, IHasVideoCodec, IHasAudioCodec, IHasDefaultDisplay, IHasInCallFeedback,
|
||||
IRoomOccupancy, IEmergency, IMicrophonePrivacy
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the PropertiesConfig
|
||||
/// </summary>
|
||||
EssentialsHuddleVtc1PropertiesConfig PropertiesConfig { get; }
|
||||
EssentialsHuddleVtc1PropertiesConfig PropertiesConfig { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether to exclude this room from global functions
|
||||
/// </summary>
|
||||
bool ExcludeFromGlobalFunctions { get; }
|
||||
/// <summary>
|
||||
/// Gets whether to exclude this room from global functions
|
||||
/// </summary>
|
||||
bool ExcludeFromGlobalFunctions { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Runs the route action for the given routeKey and sourceListKey
|
||||
/// </summary>
|
||||
/// <param name="routeKey">The route key</param>
|
||||
void RunRouteAction(string routeKey);
|
||||
/// <summary>
|
||||
/// Runs the route action for the given routeKey and sourceListKey
|
||||
/// </summary>
|
||||
/// <param name="routeKey">The route key</param>
|
||||
void RunRouteAction(string routeKey);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the ScheduleSource
|
||||
/// </summary>
|
||||
IHasScheduleAwareness ScheduleSource { get; }
|
||||
/// <summary>
|
||||
/// Gets the ScheduleSource
|
||||
/// </summary>
|
||||
IHasScheduleAwareness ScheduleSource { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the InCallFeedback
|
||||
/// </summary>
|
||||
new BoolFeedback InCallFeedback { get; }
|
||||
/// <summary>
|
||||
/// Gets the InCallFeedback
|
||||
/// </summary>
|
||||
new BoolFeedback InCallFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the PrivacyModeIsOnFeedback
|
||||
/// </summary>
|
||||
new BoolFeedback PrivacyModeIsOnFeedback { get; }
|
||||
/// <summary>
|
||||
/// Gets the PrivacyModeIsOnFeedback
|
||||
/// </summary>
|
||||
new BoolFeedback PrivacyModeIsOnFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the DefaultCodecRouteString
|
||||
/// </summary>
|
||||
string DefaultCodecRouteString { get; }
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the DefaultCodecRouteString
|
||||
/// </summary>
|
||||
string DefaultCodecRouteString { get; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,16 @@
|
|||
using PepperDash.Essentials.Room.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Room
|
||||
namespace PepperDash.Essentials.Devices.Common.Room;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IEssentialsRoomPropertiesConfig
|
||||
/// </summary>
|
||||
public interface IEssentialsRoomPropertiesConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the contract for IEssentialsRoomPropertiesConfig
|
||||
/// Gets the PropertiesConfig
|
||||
/// </summary>
|
||||
public interface IEssentialsRoomPropertiesConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the PropertiesConfig
|
||||
/// </summary>
|
||||
EssentialsRoomPropertiesConfig PropertiesConfig { get; }
|
||||
}
|
||||
EssentialsRoomPropertiesConfig PropertiesConfig { get; }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,37 +5,36 @@ using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
|||
using PepperDash.Essentials.Devices.Common.Displays;
|
||||
using PepperDash.Essentials.Room.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Room;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Room
|
||||
/// <summary>
|
||||
/// Defines the contract for IEssentialsTechRoom
|
||||
/// </summary>
|
||||
public interface IEssentialsTechRoom : IEssentialsRoom, ITvPresetsProvider, IBridgeAdvanced, IRunDirectRouteAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the contract for IEssentialsTechRoom
|
||||
/// Gets the PropertiesConfig
|
||||
/// </summary>
|
||||
public interface IEssentialsTechRoom : IEssentialsRoom, ITvPresetsProvider, IBridgeAdvanced, IRunDirectRouteAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the PropertiesConfig
|
||||
/// </summary>
|
||||
EssentialsTechRoomConfig PropertiesConfig { get; }
|
||||
EssentialsTechRoomConfig PropertiesConfig { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Tuners
|
||||
/// </summary>
|
||||
Dictionary<string, IRSetTopBoxBase> Tuners { get; }
|
||||
/// <summary>
|
||||
/// Gets the Tuners
|
||||
/// </summary>
|
||||
Dictionary<string, IRSetTopBoxBase> Tuners { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Displays
|
||||
/// </summary>
|
||||
Dictionary<string, TwoWayDisplayBase> Displays { get; }
|
||||
/// <summary>
|
||||
/// Gets the Displays
|
||||
/// </summary>
|
||||
Dictionary<string, TwoWayDisplayBase> Displays { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Powers on the room
|
||||
/// </summary>
|
||||
void RoomPowerOn();
|
||||
/// <summary>
|
||||
/// Powers on the room
|
||||
/// </summary>
|
||||
void RoomPowerOn();
|
||||
|
||||
/// <summary>
|
||||
/// Powers off the room
|
||||
/// </summary>
|
||||
void RoomPowerOff();
|
||||
}
|
||||
/// <summary>
|
||||
/// Powers off the room
|
||||
/// </summary>
|
||||
void RoomPowerOff();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -656,5 +656,5 @@ namespace PepperDash.Essentials.Devices.Common
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,36 +1,35 @@
|
|||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common
|
||||
namespace PepperDash.Essentials.Devices.Common;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a SetTopBoxPropertiesConfig
|
||||
/// </summary>
|
||||
public class SetTopBoxPropertiesConfig : PepperDash.Essentials.Core.Config.SourceDevicePropertiesConfigBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a SetTopBoxPropertiesConfig
|
||||
/// Gets or sets the HasPresets
|
||||
/// </summary>
|
||||
public class SetTopBoxPropertiesConfig : PepperDash.Essentials.Core.Config.SourceDevicePropertiesConfigBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the HasPresets
|
||||
/// </summary>
|
||||
public bool HasPresets { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the HasDvr
|
||||
/// </summary>
|
||||
public bool HasDvr { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the HasDpad
|
||||
/// </summary>
|
||||
public bool HasDpad { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the HasNumeric
|
||||
/// </summary>
|
||||
public bool HasNumeric { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the IrPulseTime
|
||||
/// </summary>
|
||||
public int IrPulseTime { get; set; }
|
||||
public bool HasPresets { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the HasDvr
|
||||
/// </summary>
|
||||
public bool HasDvr { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the HasDpad
|
||||
/// </summary>
|
||||
public bool HasDpad { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the HasNumeric
|
||||
/// </summary>
|
||||
public bool HasNumeric { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the IrPulseTime
|
||||
/// </summary>
|
||||
public int IrPulseTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Control
|
||||
/// </summary>
|
||||
public ControlPropertiesConfig Control { get; set; }
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets the Control
|
||||
/// </summary>
|
||||
public ControlPropertiesConfig Control { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,181 +7,169 @@ using PepperDash.Essentials.Core.CrestronIO;
|
|||
using PepperDash.Essentials.Core.Shades;
|
||||
using Serilog.Events;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Shades
|
||||
namespace PepperDash.Essentials.Devices.Common.Shades;
|
||||
|
||||
/// <summary>
|
||||
/// Controls a single shade using three relays
|
||||
/// </summary>
|
||||
public class RelayControlledShade : ShadeBase, IShadesOpenCloseStop
|
||||
{
|
||||
RelayControlledShadeConfigProperties Config;
|
||||
|
||||
ISwitchedOutput OpenRelay;
|
||||
ISwitchedOutput StopOrPresetRelay;
|
||||
ISwitchedOutput CloseRelay;
|
||||
|
||||
int RelayPulseTime;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the label for the stop or preset button, depending on how the shade is configured
|
||||
/// </summary>
|
||||
public string StopOrPresetButtonLabel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for RelayControlledShade
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="config"></param>
|
||||
public RelayControlledShade(string key, string name, RelayControlledShadeConfigProperties config)
|
||||
: base(key, name)
|
||||
{
|
||||
Config = config;
|
||||
|
||||
RelayPulseTime = Config.RelayPulseTime;
|
||||
|
||||
StopOrPresetButtonLabel = Config.StopOrPresetLabel;
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool CustomActivate()
|
||||
{
|
||||
//Create ISwitchedOutput objects based on props
|
||||
OpenRelay = GetSwitchedOutputFromDevice(Config.Relays.Open);
|
||||
StopOrPresetRelay = GetSwitchedOutputFromDevice(Config.Relays.StopOrPreset);
|
||||
CloseRelay = GetSwitchedOutputFromDevice(Config.Relays.Close);
|
||||
|
||||
|
||||
return base.CustomActivate();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Open()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Opening Shade: '{0}'", this.Name);
|
||||
|
||||
PulseOutput(OpenRelay, RelayPulseTime);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
public override void Stop()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Stopping Shade: '{0}'", this.Name);
|
||||
|
||||
PulseOutput(StopOrPresetRelay, RelayPulseTime);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Close()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Closing Shade: '{0}'", this.Name);
|
||||
|
||||
PulseOutput(CloseRelay, RelayPulseTime);
|
||||
}
|
||||
|
||||
void PulseOutput(ISwitchedOutput output, int pulseTime)
|
||||
{
|
||||
output.On();
|
||||
CTimer pulseTimer = new CTimer(new CTimerCallbackFunction((o) => output.Off()), pulseTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to get the port on the specified device from config
|
||||
/// </summary>
|
||||
/// <param name="relayConfig"></param>
|
||||
/// <returns></returns>
|
||||
ISwitchedOutput GetSwitchedOutputFromDevice(IOPortConfig relayConfig)
|
||||
{
|
||||
var portDevice = DeviceManager.GetDeviceForKey(relayConfig.PortDeviceKey);
|
||||
|
||||
if (portDevice != null)
|
||||
{
|
||||
return (portDevice as ISwitchedOutputCollection).SwitchedOutputs[relayConfig.PortNumber];
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Error: Unable to get relay on port '{0}' from device with key '{1}'", relayConfig.PortNumber, relayConfig.PortDeviceKey);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configuration properties for RelayControlledShade
|
||||
/// </summary>
|
||||
public class RelayControlledShadeConfigProperties
|
||||
{
|
||||
/// <summary>
|
||||
/// Controls a single shade using three relays
|
||||
/// The amount of time in milliseconds to pulse the relay for when opening or closing the shade
|
||||
/// </summary>
|
||||
public class RelayControlledShade : ShadeBase, IShadesOpenCloseStop
|
||||
{
|
||||
RelayControlledShadeConfigProperties Config;
|
||||
|
||||
ISwitchedOutput OpenRelay;
|
||||
ISwitchedOutput StopOrPresetRelay;
|
||||
ISwitchedOutput CloseRelay;
|
||||
|
||||
int RelayPulseTime;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the StopOrPresetButtonLabel
|
||||
/// </summary>
|
||||
public string StopOrPresetButtonLabel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the RelayControlledShade class
|
||||
/// </summary>
|
||||
/// <param name="key">The device key</param>
|
||||
/// <param name="name">The device name</param>
|
||||
/// <param name="config">The relay controlled shade configuration</param>
|
||||
public RelayControlledShade(string key, string name, RelayControlledShadeConfigProperties config)
|
||||
: base(key, name)
|
||||
{
|
||||
Config = config;
|
||||
|
||||
RelayPulseTime = Config.RelayPulseTime;
|
||||
|
||||
StopOrPresetButtonLabel = Config.StopOrPresetLabel;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// CustomActivate method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override bool CustomActivate()
|
||||
{
|
||||
//Create ISwitchedOutput objects based on props
|
||||
OpenRelay = GetSwitchedOutputFromDevice(Config.Relays.Open);
|
||||
StopOrPresetRelay = GetSwitchedOutputFromDevice(Config.Relays.StopOrPreset);
|
||||
CloseRelay = GetSwitchedOutputFromDevice(Config.Relays.Close);
|
||||
|
||||
|
||||
return base.CustomActivate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Open method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override void Open()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Opening Shade: '{0}'", this.Name);
|
||||
|
||||
PulseOutput(OpenRelay, RelayPulseTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stop method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override void Stop()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Stopping Shade: '{0}'", this.Name);
|
||||
|
||||
PulseOutput(StopOrPresetRelay, RelayPulseTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Close method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override void Close()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Closing Shade: '{0}'", this.Name);
|
||||
|
||||
PulseOutput(CloseRelay, RelayPulseTime);
|
||||
}
|
||||
|
||||
void PulseOutput(ISwitchedOutput output, int pulseTime)
|
||||
{
|
||||
output.On();
|
||||
CTimer pulseTimer = new CTimer(new CTimerCallbackFunction((o) => output.Off()), pulseTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to get the port on teh specified device from config
|
||||
/// </summary>
|
||||
/// <param name="relayConfig"></param>
|
||||
/// <returns></returns>
|
||||
ISwitchedOutput GetSwitchedOutputFromDevice(IOPortConfig relayConfig)
|
||||
{
|
||||
var portDevice = DeviceManager.GetDeviceForKey(relayConfig.PortDeviceKey);
|
||||
|
||||
if (portDevice != null)
|
||||
{
|
||||
return (portDevice as ISwitchedOutputCollection).SwitchedOutputs[relayConfig.PortNumber];
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Error: Unable to get relay on port '{0}' from device with key '{1}'", relayConfig.PortNumber, relayConfig.PortDeviceKey);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public int RelayPulseTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Represents a RelayControlledShadeConfigProperties
|
||||
/// The relays that control the shade
|
||||
/// </summary>
|
||||
public class RelayControlledShadeConfigProperties
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the RelayPulseTime
|
||||
/// </summary>
|
||||
public int RelayPulseTime { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the Relays
|
||||
/// </summary>
|
||||
public ShadeRelaysConfig Relays { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the StopOrPresetLabel
|
||||
/// </summary>
|
||||
public string StopOrPresetLabel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Represents a ShadeRelaysConfig
|
||||
/// </summary>
|
||||
public class ShadeRelaysConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Open
|
||||
/// </summary>
|
||||
public IOPortConfig Open { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the StopOrPreset
|
||||
/// </summary>
|
||||
public IOPortConfig StopOrPreset { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the Close
|
||||
/// </summary>
|
||||
public IOPortConfig Close { get; set; }
|
||||
}
|
||||
}
|
||||
public ShadeRelaysConfig Relays { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Represents a RelayControlledShadeFactory
|
||||
/// The label for the stop or preset button, depending on how the shade is configured
|
||||
/// </summary>
|
||||
public class RelayControlledShadeFactory : EssentialsDeviceFactory<RelayControlledShade>
|
||||
public string StopOrPresetLabel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Configuration for the relays that control the shade
|
||||
/// </summary>
|
||||
public class ShadeRelaysConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the RelayControlledShadeFactory class
|
||||
/// The relay that opens the shade
|
||||
/// </summary>
|
||||
public RelayControlledShadeFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "relaycontrolledshade" };
|
||||
}
|
||||
public IOPortConfig Open { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// BuildDevice method
|
||||
/// The relay that stops the shade or presets the shade to a certain position, depending on how the shade is configured
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Generic Comm Device");
|
||||
var props = Newtonsoft.Json.JsonConvert.DeserializeObject<RelayControlledShadeConfigProperties>(dc.Properties.ToString());
|
||||
public IOPortConfig StopOrPreset { get; set; }
|
||||
|
||||
return new RelayControlledShade(dc.Key, dc.Name, props);
|
||||
}
|
||||
/// <summary>
|
||||
/// The relay that closes the shade
|
||||
/// </summary>
|
||||
public IOPortConfig Close { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Factory for creating RelayControlledShade devices
|
||||
/// </summary>
|
||||
public class RelayControlledShadeFactory : EssentialsDeviceFactory<RelayControlledShade>
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor for RelayControlledShadeFactory
|
||||
/// </summary>
|
||||
public RelayControlledShadeFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "relaycontrolledshade" };
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Generic Comm Device");
|
||||
var props = Newtonsoft.Json.JsonConvert.DeserializeObject<RelayControlledShadeConfigProperties>(dc.Properties.ToString());
|
||||
|
||||
return new RelayControlledShade(dc.Key, dc.Name, props);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,39 +1,40 @@
|
|||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Shades;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Shades
|
||||
namespace PepperDash.Essentials.Devices.Common.Shades;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Base class for shade devices
|
||||
/// </summary>
|
||||
public abstract class ShadeBase : EssentialsDevice, IShadesOpenCloseStop
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for shade devices
|
||||
/// Initializes a new instance of the ShadeBase class
|
||||
/// </summary>
|
||||
public abstract class ShadeBase : EssentialsDevice, IShadesOpenCloseStop
|
||||
/// <param name="key">The device key</param>
|
||||
/// <param name="name">The device name</param>
|
||||
public ShadeBase(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the ShadeBase class
|
||||
/// </summary>
|
||||
/// <param name="key">The device key</param>
|
||||
/// <param name="name">The device name</param>
|
||||
public ShadeBase(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#region iShadesOpenClose Members
|
||||
|
||||
/// <summary>
|
||||
/// Opens the shade
|
||||
/// </summary>
|
||||
public abstract void Open();
|
||||
/// <summary>
|
||||
/// Stops the shade
|
||||
/// </summary>
|
||||
public abstract void Stop();
|
||||
/// <summary>
|
||||
/// Closes the shade
|
||||
/// </summary>
|
||||
public abstract void Close();
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region iShadesOpenClose Members
|
||||
|
||||
/// <summary>
|
||||
/// Opens the shade
|
||||
/// </summary>
|
||||
public abstract void Open();
|
||||
/// <summary>
|
||||
/// Stops the shade
|
||||
/// </summary>
|
||||
public abstract void Stop();
|
||||
/// <summary>
|
||||
/// Closes the shade
|
||||
/// </summary>
|
||||
public abstract void Close();
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,105 +5,96 @@ using PepperDash.Essentials.Core.Config;
|
|||
using PepperDash.Essentials.Core.Shades;
|
||||
using Serilog.Events;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Shades
|
||||
namespace PepperDash.Essentials.Devices.Common.Shades;
|
||||
|
||||
/// <summary>
|
||||
/// Class that contains the shades to be controlled in a room
|
||||
/// </summary>
|
||||
public class ShadeController : EssentialsDevice, IShades
|
||||
{
|
||||
ShadeControllerConfigProperties Config;
|
||||
|
||||
/// <summary>
|
||||
/// List of shades to be controlled by this controller
|
||||
/// </summary>
|
||||
public List<IShadesOpenCloseStop> Shades { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for ShadeController
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="config"></param>
|
||||
public ShadeController(string key, string name, ShadeControllerConfigProperties config)
|
||||
: base(key, name)
|
||||
{
|
||||
Config = config;
|
||||
|
||||
Shades = new List<IShadesOpenCloseStop>();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool CustomActivate()
|
||||
{
|
||||
foreach (var shadeConfig in Config.Shades)
|
||||
{
|
||||
var shade = DeviceManager.GetDeviceForKey(shadeConfig.Key) as ShadeBase;
|
||||
|
||||
if (shade != null)
|
||||
{
|
||||
AddShade(shade);
|
||||
}
|
||||
}
|
||||
return base.CustomActivate();
|
||||
}
|
||||
|
||||
void AddShade(IShadesOpenCloseStop shade)
|
||||
{
|
||||
Shades.Add(shade);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Class representing the properties for the ShadeController device, including a list of shades to control
|
||||
/// </summary>
|
||||
public class ShadeControllerConfigProperties
|
||||
{
|
||||
/// <summary>
|
||||
/// Class that contains the shades to be controlled in a room
|
||||
/// List of shades to control, represented by their unique keys
|
||||
/// </summary>
|
||||
public class ShadeController : EssentialsDevice, IShades
|
||||
{
|
||||
ShadeControllerConfigProperties Config;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of shades controlled by this controller
|
||||
/// </summary>
|
||||
public List<IShadesOpenCloseStop> Shades { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the ShadeController class
|
||||
/// </summary>
|
||||
/// <param name="key">The device key</param>
|
||||
/// <param name="name">The device name</param>
|
||||
/// <param name="config">The shade controller configuration</param>
|
||||
public ShadeController(string key, string name, ShadeControllerConfigProperties config)
|
||||
: base(key, name)
|
||||
{
|
||||
Config = config;
|
||||
|
||||
Shades = new List<IShadesOpenCloseStop>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// CustomActivate method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override bool CustomActivate()
|
||||
{
|
||||
foreach (var shadeConfig in Config.Shades)
|
||||
{
|
||||
var shade = DeviceManager.GetDeviceForKey(shadeConfig.Key) as ShadeBase;
|
||||
|
||||
if (shade != null)
|
||||
{
|
||||
AddShade(shade);
|
||||
}
|
||||
}
|
||||
return base.CustomActivate();
|
||||
}
|
||||
|
||||
void AddShade(IShadesOpenCloseStop shade)
|
||||
{
|
||||
Shades.Add(shade);
|
||||
}
|
||||
}
|
||||
public List<ShadeConfig> Shades { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Represents a ShadeControllerConfigProperties
|
||||
/// Class representing the configuration for an individual shade, including its unique key
|
||||
/// </summary>
|
||||
public class ShadeControllerConfigProperties
|
||||
public class ShadeConfig : IKeyed
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Shades
|
||||
/// The unique key of the shade device to be controlled
|
||||
/// </summary>
|
||||
public List<ShadeConfig> Shades { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Represents a ShadeConfig
|
||||
/// </summary>
|
||||
public class ShadeConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Key
|
||||
/// </summary>
|
||||
public string Key { get; set; }
|
||||
}
|
||||
public string Key { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Factory for creating ShadeController devices
|
||||
/// </summary>
|
||||
public class ShadeControllerFactory : EssentialsDeviceFactory<ShadeController>
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a ShadeControllerFactory
|
||||
/// Constructor for ShadeControllerFactory
|
||||
/// </summary>
|
||||
public class ShadeControllerFactory : EssentialsDeviceFactory<ShadeController>
|
||||
public ShadeControllerFactory()
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the ShadeControllerFactory class
|
||||
/// </summary>
|
||||
public ShadeControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "shadecontroller" };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// BuildDevice method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new ShadeController Device");
|
||||
var props = Newtonsoft.Json.JsonConvert.DeserializeObject<ShadeControllerConfigProperties>(dc.Properties.ToString());
|
||||
|
||||
return new ShadeController(dc.Key, dc.Name, props);
|
||||
}
|
||||
TypeNames = new List<string>() { "shadecontroller" };
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new ShadeController Device");
|
||||
var props = Newtonsoft.Json.JsonConvert.DeserializeObject<ShadeControllerConfigProperties>(dc.Properties.ToString());
|
||||
|
||||
return new ShadeController(dc.Key, dc.Name, props);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
|
@ -8,188 +8,157 @@ using PepperDash.Essentials.Devices.Common.Sources;
|
|||
using Serilog.Events;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.SoftCodec
|
||||
namespace PepperDash.Essentials.Devices.Common.SoftCodec;
|
||||
|
||||
public class BlueJeansPc : InRoomPc, IRunRouteAction, IRoutingSink
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a BlueJeansPc
|
||||
/// </summary>
|
||||
public class BlueJeansPc : InRoomPc, IRunRouteAction, IRoutingSink
|
||||
|
||||
public RoutingInputPort AnyVideoIn { get; private set; }
|
||||
|
||||
public RoutingInputPort CurrentInputPort => AnyVideoIn;
|
||||
|
||||
#region IRoutingInputs Members
|
||||
|
||||
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public BlueJeansPc(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the AnyVideoIn
|
||||
/// </summary>
|
||||
public RoutingInputPort AnyVideoIn { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the CurrentInputPort
|
||||
/// </summary>
|
||||
public RoutingInputPort CurrentInputPort => AnyVideoIn;
|
||||
|
||||
#region IRoutingInputs Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the InputPorts
|
||||
/// </summary>
|
||||
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BlueJeansPc"/> class
|
||||
/// </summary>
|
||||
/// <param name="key">The device key</param>
|
||||
/// <param name="name">The device name</param>
|
||||
public BlueJeansPc(string key, string name)
|
||||
: base(key, name)
|
||||
InputPorts = new RoutingPortCollection<RoutingInputPort>
|
||||
{
|
||||
InputPorts = new RoutingPortCollection<RoutingInputPort>
|
||||
{
|
||||
(AnyVideoIn = new RoutingInputPort(RoutingPortNames.AnyVideoIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.None, 0, this))
|
||||
};
|
||||
}
|
||||
|
||||
#region IRunRouteAction Members
|
||||
|
||||
/// <summary>
|
||||
/// RunRouteAction method
|
||||
/// </summary>
|
||||
public void RunRouteAction(string routeKey, string sourceListKey)
|
||||
{
|
||||
RunRouteAction(routeKey, sourceListKey, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// RunRouteAction method
|
||||
/// </summary>
|
||||
public void RunRouteAction(string routeKey, string sourceListKey, Action successCallback)
|
||||
{
|
||||
CrestronInvoke.BeginInvoke(o =>
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Run route action '{0}' on SourceList: {1}", routeKey, sourceListKey);
|
||||
|
||||
var dict = ConfigReader.ConfigObject.GetSourceListForKey(sourceListKey);
|
||||
if (dict == null)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "WARNING: Config source list '{0}' not found", sourceListKey);
|
||||
return;
|
||||
}
|
||||
|
||||
// Try to get the list item by it's string key
|
||||
if (!dict.ContainsKey(routeKey))
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "WARNING: No item '{0}' found on config list '{1}'",
|
||||
routeKey, sourceListKey);
|
||||
return;
|
||||
}
|
||||
|
||||
var item = dict[routeKey];
|
||||
|
||||
foreach (var route in item.RouteList)
|
||||
{
|
||||
DoRoute(route);
|
||||
}
|
||||
|
||||
// store the name and UI info for routes
|
||||
if (item.SourceKey == "none")
|
||||
{
|
||||
CurrentSourceInfoKey = routeKey;
|
||||
CurrentSourceInfo = null;
|
||||
}
|
||||
else if (item.SourceKey != null)
|
||||
{
|
||||
CurrentSourceInfoKey = routeKey;
|
||||
CurrentSourceInfo = item;
|
||||
}
|
||||
|
||||
// report back when done
|
||||
if (successCallback != null)
|
||||
successCallback();
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="route"></param>
|
||||
/// <returns></returns>
|
||||
bool DoRoute(SourceRouteListItem route)
|
||||
{
|
||||
IRoutingSink dest = null;
|
||||
|
||||
dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSink;
|
||||
|
||||
if (dest == null)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Cannot route, unknown destination '{0}'", route.DestinationKey);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (route.SourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
dest.ReleaseRoute();
|
||||
if (dest is IHasPowerControl)
|
||||
(dest as IHasPowerControl).PowerOff();
|
||||
}
|
||||
else
|
||||
{
|
||||
var source = DeviceManager.GetDeviceForKey(route.SourceKey) as IRoutingOutputs;
|
||||
if (source == null)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Cannot route unknown source '{0}' to {1}", route.SourceKey, route.DestinationKey);
|
||||
return false;
|
||||
}
|
||||
dest.ReleaseAndMakeRoute(source, route.Type);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region IHasCurrentSourceInfoChange Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CurrentSourceInfoKey
|
||||
/// </summary>
|
||||
public string CurrentSourceInfoKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The SourceListItem last run - containing names and icons
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
SourceListItem _CurrentSourceInfo;
|
||||
|
||||
/// <summary>
|
||||
/// Event fired when the current source changes
|
||||
/// </summary>
|
||||
public event SourceInfoChangeHandler CurrentSourceChange;
|
||||
|
||||
#endregion
|
||||
(AnyVideoIn = new RoutingInputPort(RoutingPortNames.AnyVideoIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.None, 0, this))
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
#region IRunRouteAction Members
|
||||
|
||||
public void RunRouteAction(string routeKey, string sourceListKey)
|
||||
{
|
||||
RunRouteAction(routeKey, sourceListKey, null);
|
||||
}
|
||||
|
||||
public void RunRouteAction(string routeKey, string sourceListKey, Action successCallback)
|
||||
{
|
||||
CrestronInvoke.BeginInvoke(o =>
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Run route action '{0}' on SourceList: {1}", routeKey, sourceListKey);
|
||||
|
||||
var dict = ConfigReader.ConfigObject.GetSourceListForKey(sourceListKey);
|
||||
if (dict == null)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "WARNING: Config source list '{0}' not found", sourceListKey);
|
||||
return;
|
||||
}
|
||||
|
||||
// Try to get the list item by it's string key
|
||||
if (!dict.ContainsKey(routeKey))
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "WARNING: No item '{0}' found on config list '{1}'",
|
||||
routeKey, sourceListKey);
|
||||
return;
|
||||
}
|
||||
|
||||
var item = dict[routeKey];
|
||||
|
||||
foreach (var route in item.RouteList)
|
||||
{
|
||||
DoRoute(route);
|
||||
}
|
||||
|
||||
// store the name and UI info for routes
|
||||
if (item.SourceKey == "none")
|
||||
{
|
||||
CurrentSourceInfoKey = routeKey;
|
||||
CurrentSourceInfo = null;
|
||||
}
|
||||
else if (item.SourceKey != null)
|
||||
{
|
||||
CurrentSourceInfoKey = routeKey;
|
||||
CurrentSourceInfo = item;
|
||||
}
|
||||
|
||||
// report back when done
|
||||
if (successCallback != null)
|
||||
successCallback();
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="route"></param>
|
||||
/// <returns></returns>
|
||||
bool DoRoute(SourceRouteListItem route)
|
||||
{
|
||||
IRoutingSink dest = null;
|
||||
|
||||
dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSink;
|
||||
|
||||
if (dest == null)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Cannot route, unknown destination '{0}'", route.DestinationKey);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (route.SourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
dest.ReleaseRoute();
|
||||
if (dest is IHasPowerControl)
|
||||
(dest as IHasPowerControl).PowerOff();
|
||||
}
|
||||
else
|
||||
{
|
||||
var source = DeviceManager.GetDeviceForKey(route.SourceKey) as IRoutingOutputs;
|
||||
if (source == null)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Cannot route unknown source '{0}' to {1}", route.SourceKey, route.DestinationKey);
|
||||
return false;
|
||||
}
|
||||
dest.ReleaseAndMakeRoute(source, route.Type);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region IHasCurrentSourceInfoChange Members
|
||||
|
||||
public string CurrentSourceInfoKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The SourceListItem last run - containing names and icons
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
SourceListItem _CurrentSourceInfo;
|
||||
|
||||
public event SourceInfoChangeHandler CurrentSourceChange;
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,132 +3,130 @@ using PepperDash.Core;
|
|||
using PepperDash.Essentials.Core;
|
||||
using Serilog.Events;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.SoftCodec
|
||||
namespace PepperDash.Essentials.Devices.Common.SoftCodec;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Represents a GenericSoftCodec
|
||||
/// </summary>
|
||||
public class GenericSoftCodec : EssentialsDevice, IRoutingSource, IRoutingSinkWithSwitchingWithInputPort
|
||||
{
|
||||
private RoutingInputPort _currentInputPort;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a GenericSoftCodec
|
||||
/// Gets or sets the CurrentInputPort
|
||||
/// </summary>
|
||||
public class GenericSoftCodec : EssentialsDevice, IRoutingSource, IRoutingSinkWithSwitchingWithInputPort
|
||||
public RoutingInputPort CurrentInputPort
|
||||
{
|
||||
private RoutingInputPort _currentInputPort;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CurrentInputPort
|
||||
/// </summary>
|
||||
public RoutingInputPort CurrentInputPort
|
||||
get => _currentInputPort;
|
||||
set
|
||||
{
|
||||
get => _currentInputPort;
|
||||
set
|
||||
{
|
||||
_currentInputPort = value;
|
||||
_currentInputPort = value;
|
||||
|
||||
InputChanged?.Invoke(this, _currentInputPort);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GenericSoftCodec"/> class
|
||||
/// </summary>
|
||||
/// <param name="key">The device key</param>
|
||||
/// <param name="name">The device name</param>
|
||||
/// <param name="props">The device properties</param>
|
||||
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($"output{i}", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, null, this);
|
||||
|
||||
OutputPorts.Add(outputPort);
|
||||
}
|
||||
|
||||
for (var i = 1; i <= props.ContentInputCount; i++)
|
||||
{
|
||||
var inputPort = new RoutingInputPort($"contentInput{i}", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, $"contentInput{i}", this);
|
||||
|
||||
InputPorts.Add(inputPort);
|
||||
}
|
||||
|
||||
if (!props.HasCameraInputs)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 1; i <= props.CameraInputCount; i++)
|
||||
{
|
||||
var cameraPort = new RoutingInputPort($"cameraInput{i}", eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, $"cameraInput{i}", this);
|
||||
|
||||
InputPorts.Add(cameraPort);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the InputPorts
|
||||
/// </summary>
|
||||
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the OutputPorts
|
||||
/// </summary>
|
||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the CurrentSourceInfoKey
|
||||
/// </summary>
|
||||
public string CurrentSourceInfoKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CurrentSourceInfo
|
||||
/// </summary>
|
||||
public SourceListItem CurrentSourceInfo
|
||||
{
|
||||
get
|
||||
{
|
||||
return _CurrentSourceInfo;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == _CurrentSourceInfo) return;
|
||||
|
||||
var handler = CurrentSourceChange;
|
||||
|
||||
if (handler != null)
|
||||
handler(_CurrentSourceInfo, ChangeType.WillChange);
|
||||
|
||||
_CurrentSourceInfo = value;
|
||||
|
||||
if (handler != null)
|
||||
handler(_CurrentSourceInfo, ChangeType.DidChange);
|
||||
}
|
||||
}
|
||||
|
||||
SourceListItem _CurrentSourceInfo;
|
||||
|
||||
/// <summary>
|
||||
/// Event fired when the current source changes
|
||||
/// </summary>
|
||||
public event SourceInfoChangeHandler CurrentSourceChange;
|
||||
|
||||
/// <summary>
|
||||
/// Event fired when the input changes
|
||||
/// </summary>
|
||||
public event InputChangedEventHandler InputChanged;
|
||||
|
||||
/// <summary>
|
||||
/// ExecuteSwitch method
|
||||
/// </summary>
|
||||
public void ExecuteSwitch(object inputSelector)
|
||||
{
|
||||
var inputPort = InputPorts.FirstOrDefault(p => p.Selector == inputSelector);
|
||||
|
||||
if (inputPort == null)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Warning, "No input port found for selector {inputSelector}", inputSelector);
|
||||
return;
|
||||
}
|
||||
|
||||
CurrentInputPort = inputPort;
|
||||
InputChanged?.Invoke(this, _currentInputPort);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GenericSoftCodec"/> class
|
||||
/// </summary>
|
||||
/// <param name="key">The device key</param>
|
||||
/// <param name="name">The device name</param>
|
||||
/// <param name="props">The device properties</param>
|
||||
public GenericSoftCodec(string key, string name, GenericSoftCodecProperties props) : base(key, name)
|
||||
{
|
||||
for (var i = 1; i <= props.OutputCount; i++)
|
||||
{
|
||||
var outputPort = new RoutingOutputPort($"output{i}", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, null, this);
|
||||
|
||||
OutputPorts.Add(outputPort);
|
||||
}
|
||||
|
||||
for (var i = 1; i <= props.ContentInputCount; i++)
|
||||
{
|
||||
var inputPort = new RoutingInputPort($"contentInput{i}", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, $"contentInput{i}", this);
|
||||
|
||||
InputPorts.Add(inputPort);
|
||||
}
|
||||
|
||||
if (!props.HasCameraInputs)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 1; i <= props.CameraInputCount; i++)
|
||||
{
|
||||
var cameraPort = new RoutingInputPort($"cameraInput{i}", eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, $"cameraInput{i}", this);
|
||||
|
||||
InputPorts.Add(cameraPort);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the InputPorts
|
||||
/// </summary>
|
||||
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the OutputPorts
|
||||
/// </summary>
|
||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the CurrentSourceInfoKey
|
||||
/// </summary>
|
||||
public string CurrentSourceInfoKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CurrentSourceInfo
|
||||
/// </summary>
|
||||
public SourceListItem CurrentSourceInfo
|
||||
{
|
||||
get
|
||||
{
|
||||
return _CurrentSourceInfo;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == _CurrentSourceInfo) return;
|
||||
|
||||
var handler = CurrentSourceChange;
|
||||
|
||||
if (handler != null)
|
||||
handler(_CurrentSourceInfo, ChangeType.WillChange);
|
||||
|
||||
_CurrentSourceInfo = value;
|
||||
|
||||
if (handler != null)
|
||||
handler(_CurrentSourceInfo, ChangeType.DidChange);
|
||||
}
|
||||
}
|
||||
|
||||
SourceListItem _CurrentSourceInfo;
|
||||
|
||||
/// <summary>
|
||||
/// Event fired when the current source changes
|
||||
/// </summary>
|
||||
public event SourceInfoChangeHandler CurrentSourceChange;
|
||||
|
||||
/// <summary>
|
||||
/// Event fired when the input changes
|
||||
/// </summary>
|
||||
public event InputChangedEventHandler InputChanged;
|
||||
|
||||
/// <summary>
|
||||
/// ExecuteSwitch method
|
||||
/// </summary>
|
||||
public void ExecuteSwitch(object inputSelector)
|
||||
{
|
||||
var inputPort = InputPorts.FirstOrDefault(p => p.Selector == inputSelector);
|
||||
|
||||
if (inputPort == null)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Warning, "No input port found for selector {inputSelector}", inputSelector);
|
||||
return;
|
||||
}
|
||||
|
||||
CurrentInputPort = inputPort;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,83 +1,64 @@
|
|||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Sources
|
||||
namespace PepperDash.Essentials.Devices.Common.Sources;
|
||||
|
||||
public class InRoomPc : EssentialsDevice, IHasFeedback, IRoutingSource, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo, IUsageTracking
|
||||
{
|
||||
public uint DisplayUiType { get { return DisplayUiConstants.TypeLaptop; } }
|
||||
public string IconName { get; set; }
|
||||
public BoolFeedback HasPowerOnFeedback { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Represents a InRoomPc
|
||||
/// Gets or sets the AnyVideoOut
|
||||
/// </summary>
|
||||
public class InRoomPc : EssentialsDevice, IHasFeedback, IRoutingSource, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo, IUsageTracking
|
||||
public RoutingOutputPort AnyVideoOut { get; private set; }
|
||||
|
||||
#region IRoutingOutputs Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the OutputPorts
|
||||
/// </summary>
|
||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="InRoomPc"/> class
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="name"></param>
|
||||
public InRoomPc(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the DisplayUiType
|
||||
/// </summary>
|
||||
public uint DisplayUiType { get { return DisplayUiConstants.TypeLaptop; } }
|
||||
/// <summary>
|
||||
/// Gets or sets the IconName
|
||||
/// </summary>
|
||||
public string IconName { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the HasPowerOnFeedback
|
||||
/// </summary>
|
||||
public BoolFeedback HasPowerOnFeedback { get; private set; }
|
||||
IconName = "PC";
|
||||
HasPowerOnFeedback = new BoolFeedback("HasPowerFeedback",
|
||||
() => this.GetVideoStatuses() != VideoStatusOutputs.NoStatus);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the AnyVideoOut
|
||||
/// </summary>
|
||||
public RoutingOutputPort AnyVideoOut { get; private set; }
|
||||
|
||||
#region IRoutingOutputs Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the OutputPorts
|
||||
/// </summary>
|
||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="InRoomPc"/> class
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="name"></param>
|
||||
public InRoomPc(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
IconName = "PC";
|
||||
HasPowerOnFeedback = new BoolFeedback("HasPowerFeedback",
|
||||
() => this.GetVideoStatuses() != VideoStatusOutputs.NoStatus);
|
||||
|
||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort>
|
||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort>
|
||||
{
|
||||
(AnyVideoOut = new RoutingOutputPort(RoutingPortNames.AnyVideoOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.None, 0, this))
|
||||
};
|
||||
}
|
||||
|
||||
#region IHasFeedback Members
|
||||
|
||||
/// <summary>
|
||||
/// Passes through the VideoStatuses list
|
||||
/// </summary>
|
||||
public FeedbackCollection<Feedback> Feedbacks
|
||||
{
|
||||
get
|
||||
{
|
||||
var newList = new FeedbackCollection<Feedback>();
|
||||
newList.AddRange(this.GetVideoStatuses().ToList());
|
||||
return newList;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IUsageTracking Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the UsageTracker
|
||||
/// </summary>
|
||||
public UsageTracking UsageTracker { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Passes through the VideoStatuses list
|
||||
/// </summary>
|
||||
public FeedbackCollection<Feedback> Feedbacks
|
||||
{
|
||||
get
|
||||
{
|
||||
var newList = new FeedbackCollection<Feedback>();
|
||||
newList.AddRange(this.GetVideoStatuses().ToList());
|
||||
return newList;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region IUsageTracking Members
|
||||
|
||||
public UsageTracking UsageTracker { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,83 +1,68 @@
|
|||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Sources
|
||||
namespace PepperDash.Essentials.Devices.Common.Sources;
|
||||
|
||||
public class Laptop : EssentialsDevice, IHasFeedback, IRoutingSource, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo, IUsageTracking
|
||||
{
|
||||
public uint DisplayUiType { get { return DisplayUiConstants.TypeLaptop; } }
|
||||
public string IconName { get; set; }
|
||||
public BoolFeedback HasPowerOnFeedback { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Represents a Laptop
|
||||
/// Gets or sets the AnyVideoOut
|
||||
/// </summary>
|
||||
public class Laptop : EssentialsDevice, IHasFeedback, IRoutingSource, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo, IUsageTracking
|
||||
public RoutingOutputPort AnyVideoOut { get; private set; }
|
||||
|
||||
#region IRoutingOutputs Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the OutputPorts
|
||||
/// </summary>
|
||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the Laptop class
|
||||
/// </summary>
|
||||
/// <param name="key">The device key</param>
|
||||
/// <param name="name">The device name</param>
|
||||
public Laptop(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the DisplayUiType
|
||||
/// </summary>
|
||||
public uint DisplayUiType { get { return DisplayUiConstants.TypeLaptop; } }
|
||||
/// <summary>
|
||||
/// Gets or sets the IconName
|
||||
/// </summary>
|
||||
public string IconName { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the HasPowerOnFeedback
|
||||
/// </summary>
|
||||
public BoolFeedback HasPowerOnFeedback { get; private set; }
|
||||
IconName = "Laptop";
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the AnyVideoOut
|
||||
/// </summary>
|
||||
public RoutingOutputPort AnyVideoOut { get; private set; }
|
||||
HasPowerOnFeedback = new BoolFeedback("HasPowerFeedback",
|
||||
() => this.GetVideoStatuses() != VideoStatusOutputs.NoStatus);
|
||||
|
||||
#region IRoutingOutputs Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the OutputPorts
|
||||
/// </summary>
|
||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the Laptop class
|
||||
/// </summary>
|
||||
/// <param name="key">The device key</param>
|
||||
/// <param name="name">The device name</param>
|
||||
public Laptop(string key, string name)
|
||||
: base(key, name)
|
||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort>
|
||||
{
|
||||
IconName = "Laptop";
|
||||
|
||||
HasPowerOnFeedback = new BoolFeedback("HasPowerFeedback",
|
||||
() => this.GetVideoStatuses() != VideoStatusOutputs.NoStatus);
|
||||
|
||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort>
|
||||
{
|
||||
(AnyVideoOut = new RoutingOutputPort(RoutingPortNames.AnyOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.None, 0, this))
|
||||
};
|
||||
}
|
||||
|
||||
#region IHasFeedback Members
|
||||
|
||||
/// <summary>
|
||||
/// Passes through the VideoStatuses list
|
||||
/// </summary>
|
||||
public FeedbackCollection<Feedback> Feedbacks
|
||||
{
|
||||
get
|
||||
{
|
||||
var newList = new FeedbackCollection<Feedback>();
|
||||
newList.AddRange(this.GetVideoStatuses().ToList());
|
||||
return newList;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IUsageTracking Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the UsageTracker
|
||||
/// </summary>
|
||||
public UsageTracking UsageTracker { get; set; }
|
||||
|
||||
#endregion
|
||||
(AnyVideoOut = new RoutingOutputPort(RoutingPortNames.AnyOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.None, 0, this))
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#region IHasFeedback Members
|
||||
|
||||
/// <summary>
|
||||
/// Passes through the VideoStatuses list
|
||||
/// </summary>
|
||||
public FeedbackCollection<Feedback> Feedbacks
|
||||
{
|
||||
get
|
||||
{
|
||||
var newList = new FeedbackCollection<Feedback>();
|
||||
newList.AddRange(this.GetVideoStatuses().ToList());
|
||||
return newList;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IUsageTracking Members
|
||||
|
||||
public UsageTracking UsageTracker { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,244 +7,244 @@ using PepperDash.Essentials.Core;
|
|||
using PepperDash.Essentials.Core.Bridges;
|
||||
using Serilog.Events;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common
|
||||
namespace PepperDash.Essentials.Devices.Common;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a AppleTV
|
||||
/// Wrapper class for an IR-Controlled AppleTV
|
||||
/// </summary>
|
||||
[Description("Wrapper class for an IR-Controlled AppleTV")]
|
||||
public class AppleTV : EssentialsBridgeableDevice, IDPad, ITransport, IUiDisplayInfo, IRoutingSource, IRoutingOutputs
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a AppleTV
|
||||
/// Wrapper class for an IR-Controlled AppleTV
|
||||
/// Gets or sets the IrPort
|
||||
/// </summary>
|
||||
[Description("Wrapper class for an IR-Controlled AppleTV")]
|
||||
public class AppleTV : EssentialsBridgeableDevice, IDPad, ITransport, IUiDisplayInfo, IRoutingSource, IRoutingOutputs
|
||||
public IrOutputPortController IrPort { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Standard Driver Name
|
||||
/// </summary>
|
||||
public const string StandardDriverName = "Apple_AppleTV_4th_Gen_Essentials.ir";
|
||||
/// <summary>
|
||||
/// Gets or sets the DisplayUiType
|
||||
/// </summary>
|
||||
public uint DisplayUiType { get { return DisplayUiConstants.TypeAppleTv; } }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AppleTV"/> class
|
||||
/// </summary>
|
||||
/// <param name="key">The device key</param>
|
||||
/// <param name="name">The device name</param>
|
||||
/// <param name="portCont">The IR output port controller</param>
|
||||
public AppleTV(string key, string name, IrOutputPortController portCont)
|
||||
: base(key, name)
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the IrPort
|
||||
/// </summary>
|
||||
public IrOutputPortController IrPort { get; private set; }
|
||||
IrPort = portCont;
|
||||
DeviceManager.AddDevice(portCont);
|
||||
|
||||
/// <summary>
|
||||
/// Standard Driver Name
|
||||
/// </summary>
|
||||
public const string StandardDriverName = "Apple_AppleTV_4th_Gen_Essentials.ir";
|
||||
/// <summary>
|
||||
/// Gets or sets the DisplayUiType
|
||||
/// </summary>
|
||||
public uint DisplayUiType { get { return DisplayUiConstants.TypeAppleTv; } }
|
||||
HdmiOut = new RoutingOutputPort(RoutingPortNames.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Hdmi, null, this);
|
||||
AnyAudioOut = new RoutingOutputPort(RoutingPortNames.AnyAudioOut, eRoutingSignalType.Audio,
|
||||
eRoutingPortConnectionType.DigitalAudio, null, this);
|
||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort> { HdmiOut, AnyAudioOut };
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AppleTV"/> class
|
||||
/// </summary>
|
||||
/// <param name="key">The device key</param>
|
||||
/// <param name="name">The device name</param>
|
||||
/// <param name="portCont">The IR output port controller</param>
|
||||
public AppleTV(string key, string name, IrOutputPortController portCont)
|
||||
: base(key, name)
|
||||
PrintExpectedIrCommands();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PrintExpectedIrCommands method
|
||||
/// </summary>
|
||||
public void PrintExpectedIrCommands()
|
||||
{
|
||||
var cmds = typeof(AppleTvIrCommands).GetFields(BindingFlags.Public | BindingFlags.Static);
|
||||
|
||||
foreach (var value in cmds.Select(cmd => cmd.GetValue(null)).OfType<string>())
|
||||
{
|
||||
IrPort = portCont;
|
||||
DeviceManager.AddDevice(portCont);
|
||||
|
||||
HdmiOut = new RoutingOutputPort(RoutingPortNames.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Hdmi, null, this);
|
||||
AnyAudioOut = new RoutingOutputPort(RoutingPortNames.AnyAudioOut, eRoutingSignalType.Audio,
|
||||
eRoutingPortConnectionType.DigitalAudio, null, this);
|
||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort> { HdmiOut, AnyAudioOut };
|
||||
|
||||
PrintExpectedIrCommands();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PrintExpectedIrCommands method
|
||||
/// </summary>
|
||||
public void PrintExpectedIrCommands()
|
||||
{
|
||||
var cmds = typeof(AppleTvIrCommands).GetFields(BindingFlags.Public | BindingFlags.Static);
|
||||
|
||||
foreach (var value in cmds.Select(cmd => cmd.GetValue(null)).OfType<string>())
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Verbose, this, "Expected IR Function Name: {0}", value);
|
||||
}
|
||||
}
|
||||
|
||||
#region IDPad Members
|
||||
|
||||
/// <summary>
|
||||
/// Up method
|
||||
/// </summary>
|
||||
public void Up(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(AppleTvIrCommands.Up, pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Down method
|
||||
/// </summary>
|
||||
public void Down(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(AppleTvIrCommands.Down, pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Left method
|
||||
/// </summary>
|
||||
public void Left(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(AppleTvIrCommands.Left, pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Right method
|
||||
/// </summary>
|
||||
public void Right(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(AppleTvIrCommands.Right, pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Select method
|
||||
/// </summary>
|
||||
public void Select(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(AppleTvIrCommands.Enter, pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Menu method
|
||||
/// </summary>
|
||||
public void Menu(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(AppleTvIrCommands.Menu, pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Exit method
|
||||
/// </summary>
|
||||
public void Exit(bool pressRelease)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ITransport Members
|
||||
|
||||
/// <summary>
|
||||
/// Play method
|
||||
/// </summary>
|
||||
public void Play(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(AppleTvIrCommands.PlayPause, pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pause method
|
||||
/// </summary>
|
||||
public void Pause(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(AppleTvIrCommands.PlayPause, pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not implemented
|
||||
/// </summary>
|
||||
/// <param name="pressRelease"></param>
|
||||
/// <summary>
|
||||
/// Rewind method
|
||||
/// </summary>
|
||||
public void Rewind(bool pressRelease)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not implemented
|
||||
/// </summary>
|
||||
/// <param name="pressRelease"></param>
|
||||
public void FFwd(bool pressRelease)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not implemented
|
||||
/// </summary>
|
||||
/// <param name="pressRelease"></param>
|
||||
public void ChapMinus(bool pressRelease)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not implemented
|
||||
/// </summary>
|
||||
/// <param name="pressRelease"></param>
|
||||
public void ChapPlus(bool pressRelease)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not implemented
|
||||
/// </summary>
|
||||
/// <param name="pressRelease"></param>
|
||||
public void Stop(bool pressRelease)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not implemented
|
||||
/// </summary>
|
||||
/// <param name="pressRelease"></param>
|
||||
public void Record(bool pressRelease)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IRoutingOutputs Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets the HdmiOut
|
||||
/// </summary>
|
||||
public RoutingOutputPort HdmiOut { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the AnyAudioOut
|
||||
/// </summary>
|
||||
public RoutingOutputPort AnyAudioOut { get; private set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the OutputPorts
|
||||
/// </summary>
|
||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// LinkToApi method
|
||||
/// </summary>
|
||||
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
var joinMap = new AppleTvJoinMap(joinStart);
|
||||
|
||||
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||
joinMap = JsonConvert.DeserializeObject<AppleTvJoinMap>(joinMapSerialized);
|
||||
|
||||
if (bridge != null)
|
||||
{
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Information, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
|
||||
}
|
||||
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
Debug.LogMessage(LogEventLevel.Information, "Linking to Bridge Type {0}", GetType().Name);
|
||||
|
||||
trilist.SetBoolSigAction(joinMap.UpArrow.JoinNumber, Up);
|
||||
trilist.SetBoolSigAction(joinMap.DnArrow.JoinNumber, Down);
|
||||
trilist.SetBoolSigAction(joinMap.LeftArrow.JoinNumber, Left);
|
||||
trilist.SetBoolSigAction(joinMap.RightArrow.JoinNumber, Right);
|
||||
trilist.SetBoolSigAction(joinMap.Select.JoinNumber, Select);
|
||||
trilist.SetBoolSigAction(joinMap.Menu.JoinNumber, Menu);
|
||||
trilist.SetBoolSigAction(joinMap.PlayPause.JoinNumber, Play);
|
||||
Debug.LogMessage(LogEventLevel.Verbose, this, "Expected IR Function Name: {0}", value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region IDPad Members
|
||||
|
||||
/// <summary>
|
||||
/// Up method
|
||||
/// </summary>
|
||||
public void Up(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(AppleTvIrCommands.Up, pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Down method
|
||||
/// </summary>
|
||||
public void Down(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(AppleTvIrCommands.Down, pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Left method
|
||||
/// </summary>
|
||||
public void Left(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(AppleTvIrCommands.Left, pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Right method
|
||||
/// </summary>
|
||||
public void Right(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(AppleTvIrCommands.Right, pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Select method
|
||||
/// </summary>
|
||||
public void Select(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(AppleTvIrCommands.Enter, pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Menu method
|
||||
/// </summary>
|
||||
public void Menu(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(AppleTvIrCommands.Menu, pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Exit method
|
||||
/// </summary>
|
||||
public void Exit(bool pressRelease)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ITransport Members
|
||||
|
||||
/// <summary>
|
||||
/// Play method
|
||||
/// </summary>
|
||||
public void Play(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(AppleTvIrCommands.PlayPause, pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pause method
|
||||
/// </summary>
|
||||
public void Pause(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(AppleTvIrCommands.PlayPause, pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not implemented
|
||||
/// </summary>
|
||||
/// <param name="pressRelease"></param>
|
||||
/// <summary>
|
||||
/// Rewind method
|
||||
/// </summary>
|
||||
public void Rewind(bool pressRelease)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not implemented
|
||||
/// </summary>
|
||||
/// <param name="pressRelease"></param>
|
||||
public void FFwd(bool pressRelease)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not implemented
|
||||
/// </summary>
|
||||
/// <param name="pressRelease"></param>
|
||||
public void ChapMinus(bool pressRelease)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not implemented
|
||||
/// </summary>
|
||||
/// <param name="pressRelease"></param>
|
||||
public void ChapPlus(bool pressRelease)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not implemented
|
||||
/// </summary>
|
||||
/// <param name="pressRelease"></param>
|
||||
public void Stop(bool pressRelease)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not implemented
|
||||
/// </summary>
|
||||
/// <param name="pressRelease"></param>
|
||||
public void Record(bool pressRelease)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IRoutingOutputs Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets the HdmiOut
|
||||
/// </summary>
|
||||
public RoutingOutputPort HdmiOut { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the AnyAudioOut
|
||||
/// </summary>
|
||||
public RoutingOutputPort AnyAudioOut { get; private set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the OutputPorts
|
||||
/// </summary>
|
||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// LinkToApi method
|
||||
/// </summary>
|
||||
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
var joinMap = new AppleTvJoinMap(joinStart);
|
||||
|
||||
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||
joinMap = JsonConvert.DeserializeObject<AppleTvJoinMap>(joinMapSerialized);
|
||||
|
||||
if (bridge != null)
|
||||
{
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Information, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
|
||||
}
|
||||
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
Debug.LogMessage(LogEventLevel.Information, "Linking to Bridge Type {0}", GetType().Name);
|
||||
|
||||
trilist.SetBoolSigAction(joinMap.UpArrow.JoinNumber, Up);
|
||||
trilist.SetBoolSigAction(joinMap.DnArrow.JoinNumber, Down);
|
||||
trilist.SetBoolSigAction(joinMap.LeftArrow.JoinNumber, Left);
|
||||
trilist.SetBoolSigAction(joinMap.RightArrow.JoinNumber, Right);
|
||||
trilist.SetBoolSigAction(joinMap.Select.JoinNumber, Select);
|
||||
trilist.SetBoolSigAction(joinMap.Menu.JoinNumber, Menu);
|
||||
trilist.SetBoolSigAction(joinMap.PlayPause.JoinNumber, Play);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,220 +1,220 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Represents a CiscoCallHistory
|
||||
/// </summary>
|
||||
public class CiscoCallHistory
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a CiscoCallHistory
|
||||
/// Represents a CallbackNumber
|
||||
/// </summary>
|
||||
public class CiscoCallHistory
|
||||
public class CallbackNumber
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a CallbackNumber
|
||||
/// Gets or sets the Value
|
||||
/// </summary>
|
||||
public class CallbackNumber
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Value
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a DisplayName
|
||||
/// </summary>
|
||||
public class DisplayName
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Value
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a LastOccurrenceStartTime
|
||||
/// </summary>
|
||||
public class LastOccurrenceStartTime
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Value
|
||||
/// </summary>
|
||||
public DateTime Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a LastOccurrenceDaysAgo
|
||||
/// </summary>
|
||||
public class LastOccurrenceDaysAgo
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Value
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a LastOccurrenceHistoryId
|
||||
/// </summary>
|
||||
public class LastOccurrenceHistoryId
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Value
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a OccurrenceType
|
||||
/// </summary>
|
||||
public class OccurrenceType
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Value
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a IsAcknowledged
|
||||
/// </summary>
|
||||
public class IsAcknowledged
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Value
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a OccurrenceCount
|
||||
/// </summary>
|
||||
public class OccurrenceCount
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Value
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a Entry
|
||||
/// </summary>
|
||||
public class Entry
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the id
|
||||
/// </summary>
|
||||
public string id { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the CallbackNumber
|
||||
/// </summary>
|
||||
public CallbackNumber CallbackNumber { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the DisplayName
|
||||
/// </summary>
|
||||
public DisplayName DisplayName { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the LastOccurrenceStartTime
|
||||
/// </summary>
|
||||
public LastOccurrenceStartTime LastOccurrenceStartTime { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the LastOccurrenceDaysAgo
|
||||
/// </summary>
|
||||
public LastOccurrenceDaysAgo LastOccurrenceDaysAgo { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the LastOccurrenceHistoryId
|
||||
/// </summary>
|
||||
public LastOccurrenceHistoryId LastOccurrenceHistoryId { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the OccurrenceType
|
||||
/// </summary>
|
||||
public OccurrenceType OccurrenceType { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the IsAcknowledged
|
||||
/// </summary>
|
||||
public IsAcknowledged IsAcknowledged { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the OccurrenceCount
|
||||
/// </summary>
|
||||
public OccurrenceCount OccurrenceCount { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a Offset
|
||||
/// </summary>
|
||||
public class Offset
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Value
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a Limit
|
||||
/// </summary>
|
||||
public class Limit
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Value
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a ResultInfo
|
||||
/// </summary>
|
||||
public class ResultInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Offset
|
||||
/// </summary>
|
||||
public Offset Offset { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the Limit
|
||||
/// </summary>
|
||||
public Limit Limit { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a CallHistoryRecentsResult
|
||||
/// </summary>
|
||||
public class CallHistoryRecentsResult
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the status
|
||||
/// </summary>
|
||||
public string status { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the Entry
|
||||
/// </summary>
|
||||
public List<Entry> Entry { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the ResultInfo
|
||||
/// </summary>
|
||||
public ResultInfo ResultInfo { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a CommandResponse
|
||||
/// </summary>
|
||||
public class CommandResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the CallHistoryRecentsResult
|
||||
/// </summary>
|
||||
public CallHistoryRecentsResult CallHistoryRecentsResult { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a RootObject
|
||||
/// </summary>
|
||||
public class RootObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the CommandResponse
|
||||
/// </summary>
|
||||
public CommandResponse CommandResponse { get; set; }
|
||||
}
|
||||
public string Value { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a DisplayName
|
||||
/// </summary>
|
||||
public class DisplayName
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Value
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a LastOccurrenceStartTime
|
||||
/// </summary>
|
||||
public class LastOccurrenceStartTime
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Value
|
||||
/// </summary>
|
||||
public DateTime Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a LastOccurrenceDaysAgo
|
||||
/// </summary>
|
||||
public class LastOccurrenceDaysAgo
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Value
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a LastOccurrenceHistoryId
|
||||
/// </summary>
|
||||
public class LastOccurrenceHistoryId
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Value
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a OccurrenceType
|
||||
/// </summary>
|
||||
public class OccurrenceType
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Value
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a IsAcknowledged
|
||||
/// </summary>
|
||||
public class IsAcknowledged
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Value
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a OccurrenceCount
|
||||
/// </summary>
|
||||
public class OccurrenceCount
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Value
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a Entry
|
||||
/// </summary>
|
||||
public class Entry
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the id
|
||||
/// </summary>
|
||||
public string id { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the CallbackNumber
|
||||
/// </summary>
|
||||
public CallbackNumber CallbackNumber { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the DisplayName
|
||||
/// </summary>
|
||||
public DisplayName DisplayName { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the LastOccurrenceStartTime
|
||||
/// </summary>
|
||||
public LastOccurrenceStartTime LastOccurrenceStartTime { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the LastOccurrenceDaysAgo
|
||||
/// </summary>
|
||||
public LastOccurrenceDaysAgo LastOccurrenceDaysAgo { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the LastOccurrenceHistoryId
|
||||
/// </summary>
|
||||
public LastOccurrenceHistoryId LastOccurrenceHistoryId { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the OccurrenceType
|
||||
/// </summary>
|
||||
public OccurrenceType OccurrenceType { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the IsAcknowledged
|
||||
/// </summary>
|
||||
public IsAcknowledged IsAcknowledged { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the OccurrenceCount
|
||||
/// </summary>
|
||||
public OccurrenceCount OccurrenceCount { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a Offset
|
||||
/// </summary>
|
||||
public class Offset
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Value
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a Limit
|
||||
/// </summary>
|
||||
public class Limit
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Value
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a ResultInfo
|
||||
/// </summary>
|
||||
public class ResultInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Offset
|
||||
/// </summary>
|
||||
public Offset Offset { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the Limit
|
||||
/// </summary>
|
||||
public Limit Limit { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a CallHistoryRecentsResult
|
||||
/// </summary>
|
||||
public class CallHistoryRecentsResult
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the status
|
||||
/// </summary>
|
||||
public string status { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the Entry
|
||||
/// </summary>
|
||||
public List<Entry> Entry { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the ResultInfo
|
||||
/// </summary>
|
||||
public ResultInfo ResultInfo { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a CommandResponse
|
||||
/// </summary>
|
||||
public class CommandResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the CallHistoryRecentsResult
|
||||
/// </summary>
|
||||
public CallHistoryRecentsResult CallHistoryRecentsResult { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a RootObject
|
||||
/// </summary>
|
||||
public class RootObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the CommandResponse
|
||||
/// </summary>
|
||||
public CommandResponse CommandResponse { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,84 +3,83 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using PepperDash.Essentials.Core.Presets;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for camera presets
|
||||
/// </summary>
|
||||
public interface IHasCodecRoomPresets
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface for camera presets
|
||||
/// Event that is raised when the list of room presets has changed.
|
||||
/// </summary>
|
||||
public interface IHasCodecRoomPresets
|
||||
{
|
||||
/// <summary>
|
||||
/// Event that is raised when the list of room presets has changed.
|
||||
/// </summary>
|
||||
event EventHandler<EventArgs> CodecRoomPresetsListHasChanged;
|
||||
|
||||
/// <summary>
|
||||
/// List of near end presets that can be recalled.
|
||||
/// </summary>
|
||||
List<CodecRoomPreset> NearEndPresets { get; }
|
||||
|
||||
/// <summary>
|
||||
/// List of far end presets that can be recalled.
|
||||
/// </summary>
|
||||
List<CodecRoomPreset> FarEndRoomPresets { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Selects a near end preset by its ID.
|
||||
/// </summary>
|
||||
/// <param name="preset"></param>
|
||||
void CodecRoomPresetSelect(int preset);
|
||||
|
||||
/// <summary>
|
||||
/// Stores a near end preset with the given ID and description.
|
||||
/// </summary>
|
||||
/// <param name="preset"></param>
|
||||
/// <param name="description"></param>
|
||||
void CodecRoomPresetStore(int preset, string description);
|
||||
|
||||
/// <summary>
|
||||
/// Selects a far end preset by its ID. This is typically used to recall a preset that has been defined on the far end codec.
|
||||
/// </summary>
|
||||
/// <param name="preset"></param>
|
||||
void SelectFarEndPreset(int preset);
|
||||
}
|
||||
event EventHandler<EventArgs> CodecRoomPresetsListHasChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Static class for converting non-generic RoomPresets to generic CameraPresets.
|
||||
/// List of near end presets that can be recalled.
|
||||
/// </summary>
|
||||
public static class RoomPresets
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts non-generic RoomPresets to generic CameraPresets
|
||||
/// </summary>
|
||||
/// <param name="presets"></param>
|
||||
/// <returns></returns>
|
||||
public static List<TDestination> GetGenericPresets<TSource, TDestination>(this List<TSource> presets) where TSource : ConvertiblePreset where TDestination : PresetBase
|
||||
{
|
||||
return
|
||||
presets.Select(preset => preset.ConvertCodecPreset())
|
||||
.Where(newPreset => newPreset != null)
|
||||
.Cast<TDestination>()
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
List<CodecRoomPreset> NearEndPresets { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Represents a CodecRoomPreset
|
||||
/// List of far end presets that can be recalled.
|
||||
/// </summary>
|
||||
public class CodecRoomPreset : PresetBase
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="description"></param>
|
||||
/// <param name="def"></param>
|
||||
/// <param name="isDef"></param>
|
||||
public CodecRoomPreset(int id, string description, bool def, bool isDef)
|
||||
: base(id, description, def, isDef)
|
||||
{
|
||||
List<CodecRoomPreset> FarEndRoomPresets { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Selects a near end preset by its ID.
|
||||
/// </summary>
|
||||
/// <param name="preset"></param>
|
||||
void CodecRoomPresetSelect(int preset);
|
||||
|
||||
/// <summary>
|
||||
/// Stores a near end preset with the given ID and description.
|
||||
/// </summary>
|
||||
/// <param name="preset"></param>
|
||||
/// <param name="description"></param>
|
||||
void CodecRoomPresetStore(int preset, string description);
|
||||
|
||||
/// <summary>
|
||||
/// Selects a far end preset by its ID. This is typically used to recall a preset that has been defined on the far end codec.
|
||||
/// </summary>
|
||||
/// <param name="preset"></param>
|
||||
void SelectFarEndPreset(int preset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Static class for converting non-generic RoomPresets to generic CameraPresets.
|
||||
/// </summary>
|
||||
public static class RoomPresets
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts non-generic RoomPresets to generic CameraPresets
|
||||
/// </summary>
|
||||
/// <param name="presets"></param>
|
||||
/// <returns></returns>
|
||||
public static List<TDestination> GetGenericPresets<TSource, TDestination>(this List<TSource> presets) where TSource : ConvertiblePreset where TDestination : PresetBase
|
||||
{
|
||||
return
|
||||
presets.Select(preset => preset.ConvertCodecPreset())
|
||||
.Where(newPreset => newPreset != null)
|
||||
.Cast<TDestination>()
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a room preset on a video codec. Typically stores camera position(s) and video routing. Can be recalled by Far End if enabled.
|
||||
/// </summary>
|
||||
public class CodecRoomPreset : PresetBase
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="description"></param>
|
||||
/// <param name="def"></param>
|
||||
/// <param name="isDef"></param>
|
||||
public CodecRoomPreset(int id, string description, bool def, bool isDef)
|
||||
: base(id, description, def, isDef)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
{
|
||||
enum eCommandType { SessionStart, SessionEnd, Command, GetStatus, GetConfiguration };
|
||||
}
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco;
|
||||
|
||||
enum eCommandType { SessionStart, SessionEnd, Command, GetStatus, GetConfiguration };
|
||||
|
|
@ -22,4 +22,4 @@
|
|||
/// </summary>
|
||||
Error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,4 +34,4 @@
|
|||
/// </summary>
|
||||
other
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
using PepperDash.Essentials.Core.Presets;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Base class for presets that can be converted to PresetBase
|
||||
/// </summary>
|
||||
public abstract class ConvertiblePreset
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for presets that can be converted to PresetBase
|
||||
/// Converts the preset to a PresetBase
|
||||
/// </summary>
|
||||
public abstract class ConvertiblePreset
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts the preset to a PresetBase
|
||||
/// </summary>
|
||||
/// <returns><see cref="PresetBase"/></returns>
|
||||
public abstract PresetBase ConvertCodecPreset();
|
||||
}
|
||||
}
|
||||
/// <returns><see cref="PresetBase"/></returns>
|
||||
public abstract PresetBase ConvertCodecPreset();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,30 +1,29 @@
|
|||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the required elements for layout control
|
||||
/// </summary>
|
||||
public interface IHasCodecLayouts
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the required elements for layout control
|
||||
/// Feedback that indicates the current layout on the local display
|
||||
/// </summary>
|
||||
public interface IHasCodecLayouts
|
||||
{
|
||||
/// <summary>
|
||||
/// Feedback that indicates the current layout on the local display
|
||||
/// </summary>
|
||||
StringFeedback LocalLayoutFeedback { get; }
|
||||
StringFeedback LocalLayoutFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Toggles the local layout
|
||||
/// </summary>
|
||||
void LocalLayoutToggle();
|
||||
/// <summary>
|
||||
/// Toggles the local layout
|
||||
/// </summary>
|
||||
void LocalLayoutToggle();
|
||||
|
||||
/// <summary>
|
||||
/// Toggles the local layout to single prominent
|
||||
/// </summary>
|
||||
void LocalLayoutToggleSingleProminent();
|
||||
/// <summary>
|
||||
/// Toggles the local layout to single prominent
|
||||
/// </summary>
|
||||
void LocalLayoutToggleSingleProminent();
|
||||
|
||||
/// <summary>
|
||||
/// Toggle the MinMax layout
|
||||
/// </summary>
|
||||
void MinMaxLayoutToggle();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Toggle the MinMax layout
|
||||
/// </summary>
|
||||
void MinMaxLayoutToggle();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,35 +1,35 @@
|
|||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Defines the requred elements for selfview control
|
||||
/// </summary>
|
||||
public interface IHasCodecSelfView
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the requred elements for selfview control
|
||||
/// Feedback that indicates whether Selfview is on
|
||||
/// </summary>
|
||||
public interface IHasCodecSelfView
|
||||
{
|
||||
/// <summary>
|
||||
/// Feedback that indicates whether Selfview is on
|
||||
/// </summary>
|
||||
BoolFeedback SelfviewIsOnFeedback { get; }
|
||||
BoolFeedback SelfviewIsOnFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Setting that indicates whether the device shows selfview by default
|
||||
/// </summary>
|
||||
bool ShowSelfViewByDefault { get; }
|
||||
/// <summary>
|
||||
/// Setting that indicates whether the device shows selfview by default
|
||||
/// </summary>
|
||||
bool ShowSelfViewByDefault { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Turns selfview on
|
||||
/// </summary>
|
||||
void SelfViewModeOn();
|
||||
/// <summary>
|
||||
/// Turns selfview on
|
||||
/// </summary>
|
||||
void SelfViewModeOn();
|
||||
|
||||
/// <summary>
|
||||
/// Turns selfview off
|
||||
/// </summary>
|
||||
void SelfViewModeOff();
|
||||
/// <summary>
|
||||
/// Turns selfview off
|
||||
/// </summary>
|
||||
void SelfViewModeOff();
|
||||
|
||||
/// <summary>
|
||||
/// Toggles selfview mode
|
||||
/// </summary>
|
||||
void SelfViewModeToggle();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Toggles selfview mode
|
||||
/// </summary>
|
||||
void SelfViewModeToggle();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,21 +2,21 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Describes a device that provides meeting information (like a ZoomRoom)
|
||||
/// </summary>
|
||||
public interface IHasMeetingInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes a device that provides meeting information (like a ZoomRoom)
|
||||
/// Raised when meeting info changes
|
||||
/// </summary>
|
||||
public interface IHasMeetingInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Raised when meeting info changes
|
||||
/// </summary>
|
||||
event EventHandler<MeetingInfoEventArgs> MeetingInfoChanged;
|
||||
event EventHandler<MeetingInfoEventArgs> MeetingInfoChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current meeting information
|
||||
/// </summary>
|
||||
MeetingInfo MeetingInfo { get; }
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the current meeting information
|
||||
/// </summary>
|
||||
MeetingInfo MeetingInfo { get; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,30 +1,29 @@
|
|||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IHasMeetingLock
|
||||
/// </summary>
|
||||
public interface IHasMeetingLock
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the contract for IHasMeetingLock
|
||||
/// Feedback that indicates whether the meeting is locked
|
||||
/// </summary>
|
||||
public interface IHasMeetingLock
|
||||
{
|
||||
/// <summary>
|
||||
/// Feedback that indicates whether the meeting is locked
|
||||
/// </summary>
|
||||
BoolFeedback MeetingIsLockedFeedback { get; }
|
||||
BoolFeedback MeetingIsLockedFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Locks the meeting
|
||||
/// </summary>
|
||||
void LockMeeting();
|
||||
/// <summary>
|
||||
/// Locks the meeting
|
||||
/// </summary>
|
||||
void LockMeeting();
|
||||
|
||||
/// <summary>
|
||||
/// Unlocks the meeting
|
||||
/// </summary>
|
||||
void UnLockMeeting();
|
||||
/// <summary>
|
||||
/// Unlocks the meeting
|
||||
/// </summary>
|
||||
void UnLockMeeting();
|
||||
|
||||
/// <summary>
|
||||
/// Toggles the meeting lock state
|
||||
/// </summary>
|
||||
void ToggleMeetingLock();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Toggles the meeting lock state
|
||||
/// </summary>
|
||||
void ToggleMeetingLock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,30 +1,30 @@
|
|||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IHasMeetingRecording
|
||||
/// </summary>
|
||||
public interface IHasMeetingRecording
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the contract for IHasMeetingRecording
|
||||
/// Feedback that indicates whether the meeting is being recorded
|
||||
/// </summary>
|
||||
public interface IHasMeetingRecording
|
||||
{
|
||||
/// <summary>
|
||||
/// Feedback that indicates whether the meeting is being recorded
|
||||
/// </summary>
|
||||
BoolFeedback MeetingIsRecordingFeedback { get; }
|
||||
BoolFeedback MeetingIsRecordingFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Starts recording the meeting
|
||||
/// </summary>
|
||||
void StartRecording();
|
||||
/// <summary>
|
||||
/// Starts recording the meeting
|
||||
/// </summary>
|
||||
void StartRecording();
|
||||
|
||||
/// <summary>
|
||||
/// Stops recording the meeting
|
||||
/// </summary>
|
||||
void StopRecording();
|
||||
/// <summary>
|
||||
/// Stops recording the meeting
|
||||
/// </summary>
|
||||
void StopRecording();
|
||||
|
||||
/// <summary>
|
||||
/// Toggles recording the meeting
|
||||
/// </summary>
|
||||
void ToggleRecording();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Toggles recording the meeting
|
||||
/// </summary>
|
||||
void ToggleRecording();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,4 +28,4 @@
|
|||
/// <param name="userId"></param>
|
||||
void AdmitParticipantFromWaitingRoom(int userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,58 +1,57 @@
|
|||
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IHasPresentationOnlyMeeting
|
||||
/// </summary>
|
||||
public interface IHasPresentationOnlyMeeting
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the contract for IHasPresentationOnlyMeeting
|
||||
/// Starts a presentation only meeting
|
||||
/// </summary>
|
||||
public interface IHasPresentationOnlyMeeting
|
||||
{
|
||||
/// <summary>
|
||||
/// Starts a presentation only meeting
|
||||
/// </summary>
|
||||
void StartSharingOnlyMeeting();
|
||||
|
||||
/// <summary>
|
||||
/// Starts a presentation only meeting with specified display mode
|
||||
/// </summary>
|
||||
/// <param name="displayMode">The display mode for the meeting</param>
|
||||
void StartSharingOnlyMeeting(eSharingMeetingMode displayMode);
|
||||
|
||||
/// <summary>
|
||||
/// Starts a presentation only meeting with specified display mode and duration
|
||||
/// </summary>
|
||||
/// <param name="displayMode">The display mode for the meeting</param>
|
||||
/// <param name="duration">The duration for the meeting</param>
|
||||
void StartSharingOnlyMeeting(eSharingMeetingMode displayMode, uint duration);
|
||||
|
||||
/// <summary>
|
||||
/// Starts a presentation only meeting with specified display mode, duration, and password
|
||||
/// </summary>
|
||||
/// <param name="displayMode">The display mode for the meeting</param>
|
||||
/// <param name="duration">The duration for the meeting</param>
|
||||
/// <param name="password">The password for the meeting</param>
|
||||
void StartSharingOnlyMeeting(eSharingMeetingMode displayMode, uint duration, string password);
|
||||
|
||||
/// <summary>
|
||||
/// Starts a normal meeting from a sharing only meeting
|
||||
/// </summary>
|
||||
void StartNormalMeetingFromSharingOnlyMeeting();
|
||||
}
|
||||
void StartSharingOnlyMeeting();
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration of eSharingMeetingMode values
|
||||
/// Starts a presentation only meeting with specified display mode
|
||||
/// </summary>
|
||||
public enum eSharingMeetingMode
|
||||
{
|
||||
/// <summary>
|
||||
/// No specific sharing mode
|
||||
/// </summary>
|
||||
None,
|
||||
/// <summary>
|
||||
/// Laptop sharing mode
|
||||
/// </summary>
|
||||
Laptop,
|
||||
/// <summary>
|
||||
/// iOS sharing mode
|
||||
/// </summary>
|
||||
Ios,
|
||||
}
|
||||
}
|
||||
/// <param name="displayMode">The display mode for the meeting</param>
|
||||
void StartSharingOnlyMeeting(eSharingMeetingMode displayMode);
|
||||
|
||||
/// <summary>
|
||||
/// Starts a presentation only meeting with specified display mode and duration
|
||||
/// </summary>
|
||||
/// <param name="displayMode">The display mode for the meeting</param>
|
||||
/// <param name="duration">The duration for the meeting</param>
|
||||
void StartSharingOnlyMeeting(eSharingMeetingMode displayMode, uint duration);
|
||||
|
||||
/// <summary>
|
||||
/// Starts a presentation only meeting with specified display mode, duration, and password
|
||||
/// </summary>
|
||||
/// <param name="displayMode">The display mode for the meeting</param>
|
||||
/// <param name="duration">The duration for the meeting</param>
|
||||
/// <param name="password">The password for the meeting</param>
|
||||
void StartSharingOnlyMeeting(eSharingMeetingMode displayMode, uint duration, string password);
|
||||
|
||||
/// <summary>
|
||||
/// Starts a normal meeting from a sharing only meeting
|
||||
/// </summary>
|
||||
void StartNormalMeetingFromSharingOnlyMeeting();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration of eSharingMeetingMode values
|
||||
/// </summary>
|
||||
public enum eSharingMeetingMode
|
||||
{
|
||||
/// <summary>
|
||||
/// No specific sharing mode
|
||||
/// </summary>
|
||||
None,
|
||||
/// <summary>
|
||||
/// Laptop sharing mode
|
||||
/// </summary>
|
||||
Laptop,
|
||||
/// <summary>
|
||||
/// iOS sharing mode
|
||||
/// </summary>
|
||||
Ios,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,25 +1,25 @@
|
|||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
|
||||
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
|
||||
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IHasSelfviewPosition
|
||||
/// </summary>
|
||||
public interface IHasSelfviewPosition
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the contract for IHasSelfviewPosition
|
||||
/// Gets the SelfviewPipPositionFeedback
|
||||
/// </summary>
|
||||
public interface IHasSelfviewPosition
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the SelfviewPipPositionFeedback
|
||||
/// </summary>
|
||||
StringFeedback SelfviewPipPositionFeedback { get; }
|
||||
StringFeedback SelfviewPipPositionFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets the selfview position
|
||||
/// </summary>
|
||||
void SelfviewPipPositionSet(CodecCommandWithLabel position);
|
||||
/// <summary>
|
||||
/// Sets the selfview position
|
||||
/// </summary>
|
||||
void SelfviewPipPositionSet(CodecCommandWithLabel position);
|
||||
|
||||
/// <summary>
|
||||
/// Toggles the selfview position
|
||||
/// </summary>
|
||||
void SelfviewPipPositionToggle();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Toggles the selfview position
|
||||
/// </summary>
|
||||
void SelfviewPipPositionToggle();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,26 +1,25 @@
|
|||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
|
||||
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
|
||||
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IHasSelfviewSize
|
||||
/// </summary>
|
||||
public interface IHasSelfviewSize
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the contract for IHasSelfviewSize
|
||||
/// Gets the SelfviewPipSizeFeedback
|
||||
/// </summary>
|
||||
public interface IHasSelfviewSize
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the SelfviewPipSizeFeedback
|
||||
/// </summary>
|
||||
StringFeedback SelfviewPipSizeFeedback { get; }
|
||||
StringFeedback SelfviewPipSizeFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets the selfview size
|
||||
/// </summary>
|
||||
/// <param name="size">The new selfview size</param>
|
||||
void SelfviewPipSizeSet(CodecCommandWithLabel size);
|
||||
/// <summary>
|
||||
/// Sets the selfview size
|
||||
/// </summary>
|
||||
/// <param name="size">The new selfview size</param>
|
||||
void SelfviewPipSizeSet(CodecCommandWithLabel size);
|
||||
|
||||
/// <summary>
|
||||
/// Toggles the selfview size
|
||||
/// </summary>
|
||||
void SelfviewPipSizeToggle();
|
||||
}
|
||||
/// <summary>
|
||||
/// Toggles the selfview size
|
||||
/// </summary>
|
||||
void SelfviewPipSizeToggle();
|
||||
}
|
||||
|
|
@ -1,46 +1,46 @@
|
|||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Describes a device that has Standby Mode capability
|
||||
/// </summary>
|
||||
public interface IHasStandbyMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes a device that has Standby Mode capability
|
||||
/// Feedback that indicates whether Standby Mode is on
|
||||
/// </summary>
|
||||
public interface IHasStandbyMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Feedback that indicates whether Standby Mode is on
|
||||
/// </summary>
|
||||
BoolFeedback StandbyIsOnFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Activates Standby Mode
|
||||
/// </summary>
|
||||
void StandbyActivate();
|
||||
|
||||
/// <summary>
|
||||
/// Deactivates Standby Mode
|
||||
/// </summary>
|
||||
void StandbyDeactivate();
|
||||
}
|
||||
BoolFeedback StandbyIsOnFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IHasHalfWakeMode
|
||||
/// Activates Standby Mode
|
||||
/// </summary>
|
||||
public interface IHasHalfWakeMode : IHasStandbyMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Feedback that indicates whether Half Wake Mode is on
|
||||
/// </summary>
|
||||
BoolFeedback HalfWakeModeIsOnFeedback { get; }
|
||||
void StandbyActivate();
|
||||
|
||||
/// <summary>
|
||||
/// Feedback that indicates whether the device is entering Standby Mode
|
||||
/// </summary>
|
||||
BoolFeedback EnteringStandbyModeFeedback { get; }
|
||||
/// <summary>
|
||||
/// Deactivates Standby Mode
|
||||
/// </summary>
|
||||
void StandbyDeactivate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Activates Half Wake Mode
|
||||
/// </summary>
|
||||
void HalfwakeActivate();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Defines the contract for IHasHalfWakeMode
|
||||
/// </summary>
|
||||
public interface IHasHalfWakeMode : IHasStandbyMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Feedback that indicates whether Half Wake Mode is on
|
||||
/// </summary>
|
||||
BoolFeedback HalfWakeModeIsOnFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Feedback that indicates whether the device is entering Standby Mode
|
||||
/// </summary>
|
||||
BoolFeedback EnteringStandbyModeFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Activates Half Wake Mode
|
||||
/// </summary>
|
||||
void HalfwakeActivate();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,24 +1,23 @@
|
|||
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces;
|
||||
|
||||
/// <summary>
|
||||
/// Describes the ability to start an ad-hoc meeting
|
||||
/// </summary>
|
||||
public interface IHasStartMeeting
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes the ability to start an ad-hoc meeting
|
||||
/// The default meeting duration in minutes
|
||||
/// </summary>
|
||||
public interface IHasStartMeeting
|
||||
{
|
||||
/// <summary>
|
||||
/// The default meeting duration in minutes
|
||||
/// </summary>
|
||||
uint DefaultMeetingDurationMin { get; }
|
||||
uint DefaultMeetingDurationMin { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Start an ad-hoc meeting for the specified duration
|
||||
/// </summary>
|
||||
/// <param name="duration"></param>
|
||||
void StartMeeting(uint duration);
|
||||
/// <summary>
|
||||
/// Start an ad-hoc meeting for the specified duration
|
||||
/// </summary>
|
||||
/// <param name="duration"></param>
|
||||
void StartMeeting(uint duration);
|
||||
|
||||
/// <summary>
|
||||
/// Leaves a meeting without ending it
|
||||
/// </summary>
|
||||
void LeaveMeeting();
|
||||
}
|
||||
/// <summary>
|
||||
/// Leaves a meeting without ending it
|
||||
/// </summary>
|
||||
void LeaveMeeting();
|
||||
}
|
||||
|
|
@ -1,26 +1,25 @@
|
|||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
|
||||
/// <summary>
|
||||
/// For rooms that have video codec
|
||||
/// </summary>
|
||||
public interface IHasVideoCodec : IHasInCallFeedback, IPrivacy
|
||||
{
|
||||
/// <summary>
|
||||
/// For rooms that have video codec
|
||||
/// Gets the VideoCodecBase instance
|
||||
/// </summary>
|
||||
public interface IHasVideoCodec : IHasInCallFeedback, IPrivacy
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the VideoCodecBase instance
|
||||
/// </summary>
|
||||
VideoCodecBase VideoCodec { get; }
|
||||
VideoCodecBase VideoCodec { get; }
|
||||
|
||||
/// <summary>
|
||||
/// States: 0 for on hook, 1 for video, 2 for audio, 3 for telekenesis
|
||||
/// </summary>
|
||||
IntFeedback CallTypeFeedback { get; }
|
||||
/// <summary>
|
||||
/// States: 0 for on hook, 1 for video, 2 for audio, 3 for telekenesis
|
||||
/// </summary>
|
||||
IntFeedback CallTypeFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// When something in the room is sharing with the far end or through other means
|
||||
/// </summary>
|
||||
BoolFeedback IsSharingFeedback { get; }
|
||||
/// <summary>
|
||||
/// When something in the room is sharing with the far end or through other means
|
||||
/// </summary>
|
||||
BoolFeedback IsSharingFeedback { get; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +1,21 @@
|
|||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IJoinCalls
|
||||
/// </summary>
|
||||
public interface IJoinCalls
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the contract for IJoinCalls
|
||||
/// Joins a call
|
||||
/// </summary>
|
||||
public interface IJoinCalls
|
||||
{
|
||||
/// <summary>
|
||||
/// Joins a call
|
||||
/// </summary>
|
||||
/// <param name="activeCall">The active call to join</param>
|
||||
void JoinCall(CodecActiveCallItem activeCall);
|
||||
/// <param name="activeCall">The active call to join</param>
|
||||
void JoinCall(CodecActiveCallItem activeCall);
|
||||
|
||||
/// <summary>
|
||||
/// Joins all calls
|
||||
/// </summary>
|
||||
void JoinAllCalls();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Joins all calls
|
||||
/// </summary>
|
||||
void JoinAllCalls();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,299 +4,198 @@ using PepperDash.Essentials.Core.Bridges;
|
|||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
using Serilog.Events;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Cameras
|
||||
namespace PepperDash.Essentials.Devices.Common.Cameras;
|
||||
|
||||
public class MockVCCamera : CameraBase, IHasCameraPtzControl, IHasCameraFocusControl, IBridgeAdvanced
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a MockVCCamera
|
||||
/// </summary>
|
||||
public class MockVCCamera : CameraBase, IHasCameraPtzControl, IHasCameraFocusControl, IBridgeAdvanced
|
||||
protected VideoCodecBase ParentCodec { get; private set; }
|
||||
|
||||
|
||||
public MockVCCamera(string key, string name, VideoCodecBase codec)
|
||||
: base(key, name)
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the parent video codec
|
||||
/// </summary>
|
||||
protected VideoCodecBase ParentCodec { get; private set; }
|
||||
Capabilities = eCameraCapabilities.Pan | eCameraCapabilities.Tilt | eCameraCapabilities.Zoom | eCameraCapabilities.Focus;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the MockVCCamera class
|
||||
/// </summary>
|
||||
/// <param name="key">The device key</param>
|
||||
/// <param name="name">The device name</param>
|
||||
/// <param name="codec">The parent video codec</param>
|
||||
public MockVCCamera(string key, string name, VideoCodecBase codec)
|
||||
: base(key, name)
|
||||
{
|
||||
Capabilities = eCameraCapabilities.Pan | eCameraCapabilities.Tilt | eCameraCapabilities.Zoom | eCameraCapabilities.Focus;
|
||||
|
||||
ParentCodec = codec;
|
||||
}
|
||||
|
||||
#region IHasCameraPtzControl Members
|
||||
|
||||
/// <summary>
|
||||
/// PositionHome method
|
||||
/// </summary>
|
||||
public void PositionHome()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Resetting to home position");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IHasCameraPanControl Members
|
||||
|
||||
/// <summary>
|
||||
/// PanLeft method
|
||||
/// </summary>
|
||||
public void PanLeft()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Panning Left");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PanRight method
|
||||
/// </summary>
|
||||
public void PanRight()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Panning Right");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PanStop method
|
||||
/// </summary>
|
||||
public void PanStop()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Stopping Pan");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IHasCameraTiltControl Members
|
||||
|
||||
/// <summary>
|
||||
/// TiltDown method
|
||||
/// </summary>
|
||||
public void TiltDown()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Tilting Down");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TiltUp method
|
||||
/// </summary>
|
||||
public void TiltUp()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Tilting Up");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TiltStop method
|
||||
/// </summary>
|
||||
public void TiltStop()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Stopping Tilt");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IHasCameraZoomControl Members
|
||||
|
||||
/// <summary>
|
||||
/// ZoomIn method
|
||||
/// </summary>
|
||||
public void ZoomIn()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Zooming In");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ZoomOut method
|
||||
/// </summary>
|
||||
public void ZoomOut()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Zooming Out");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ZoomStop method
|
||||
/// </summary>
|
||||
public void ZoomStop()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Stopping Zoom");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IHasCameraFocusControl Members
|
||||
|
||||
/// <summary>
|
||||
/// FocusNear method
|
||||
/// </summary>
|
||||
public void FocusNear()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Focusing Near");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// FocusFar method
|
||||
/// </summary>
|
||||
public void FocusFar()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Focusing Far");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// FocusStop method
|
||||
/// </summary>
|
||||
public void FocusStop()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Stopping Focus");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TriggerAutoFocus method
|
||||
/// </summary>
|
||||
public void TriggerAutoFocus()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "AutoFocus Triggered");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// LinkToApi method
|
||||
/// </summary>
|
||||
public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
LinkCameraToApi(this, trilist, joinStart, joinMapKey, bridge);
|
||||
}
|
||||
ParentCodec = codec;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a MockFarEndVCCamera
|
||||
/// </summary>
|
||||
public class MockFarEndVCCamera : CameraBase, IHasCameraPtzControl, IAmFarEndCamera, IBridgeAdvanced
|
||||
#region IHasCameraPtzControl Members
|
||||
|
||||
public void PositionHome()
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the parent video codec
|
||||
/// </summary>
|
||||
protected VideoCodecBase ParentCodec { get; private set; }
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Resetting to home position");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the MockFarEndVCCamera class
|
||||
/// </summary>
|
||||
/// <param name="key">The device key</param>
|
||||
/// <param name="name">The device name</param>
|
||||
/// <param name="codec">The parent video codec</param>
|
||||
public MockFarEndVCCamera(string key, string name, VideoCodecBase codec)
|
||||
: base(key, name)
|
||||
{
|
||||
Capabilities = eCameraCapabilities.Pan | eCameraCapabilities.Tilt | eCameraCapabilities.Zoom;
|
||||
#endregion
|
||||
|
||||
ParentCodec = codec;
|
||||
}
|
||||
#region IHasCameraPanControl Members
|
||||
|
||||
#region IHasCameraPtzControl Members
|
||||
public void PanLeft()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Panning Left");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PositionHome method
|
||||
/// </summary>
|
||||
public void PositionHome()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Resetting to home position");
|
||||
}
|
||||
public void PanRight()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Panning Right");
|
||||
}
|
||||
|
||||
#endregion
|
||||
public void PanStop()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Stopping Pan");
|
||||
}
|
||||
|
||||
#region IHasCameraPanControl Members
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// PanLeft method
|
||||
/// </summary>
|
||||
public void PanLeft()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Panning Left");
|
||||
}
|
||||
#region IHasCameraTiltControl Members
|
||||
|
||||
/// <summary>
|
||||
/// PanRight method
|
||||
/// </summary>
|
||||
public void PanRight()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Panning Right");
|
||||
}
|
||||
public void TiltDown()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Tilting Down");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PanStop method
|
||||
/// </summary>
|
||||
public void PanStop()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Stopping Pan");
|
||||
}
|
||||
public void TiltUp()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Tilting Up");
|
||||
}
|
||||
|
||||
#endregion
|
||||
public void TiltStop()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Stopping Tilt");
|
||||
}
|
||||
|
||||
#region IHasCameraTiltControl Members
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// TiltDown method
|
||||
/// </summary>
|
||||
public void TiltDown()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Tilting Down");
|
||||
}
|
||||
#region IHasCameraZoomControl Members
|
||||
|
||||
/// <summary>
|
||||
/// TiltUp method
|
||||
/// </summary>
|
||||
public void TiltUp()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Tilting Up");
|
||||
}
|
||||
public void ZoomIn()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Zooming In");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TiltStop method
|
||||
/// </summary>
|
||||
public void TiltStop()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Stopping Tilt");
|
||||
}
|
||||
public void ZoomOut()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Zooming Out");
|
||||
}
|
||||
|
||||
#endregion
|
||||
public void ZoomStop()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Stopping Zoom");
|
||||
}
|
||||
|
||||
#region IHasCameraZoomControl Members
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// ZoomIn method
|
||||
/// </summary>
|
||||
public void ZoomIn()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Zooming In");
|
||||
}
|
||||
#region IHasCameraFocusControl Members
|
||||
|
||||
/// <summary>
|
||||
/// ZoomOut method
|
||||
/// </summary>
|
||||
public void ZoomOut()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Zooming Out");
|
||||
}
|
||||
public void FocusNear()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Focusing Near");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ZoomStop method
|
||||
/// </summary>
|
||||
public void ZoomStop()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Stopping Zoom");
|
||||
}
|
||||
public void FocusFar()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Focusing Far");
|
||||
}
|
||||
|
||||
#endregion
|
||||
public void FocusStop()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Stopping Focus");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// LinkToApi method
|
||||
/// </summary>
|
||||
public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
LinkCameraToApi(this, trilist, joinStart, joinMapKey, bridge);
|
||||
}
|
||||
public void TriggerAutoFocus()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "AutoFocus Triggered");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
LinkCameraToApi(this, trilist, joinStart, joinMapKey, bridge);
|
||||
}
|
||||
}
|
||||
|
||||
public class MockFarEndVCCamera : CameraBase, IHasCameraPtzControl, IAmFarEndCamera, IBridgeAdvanced
|
||||
{
|
||||
protected VideoCodecBase ParentCodec { get; private set; }
|
||||
|
||||
|
||||
public MockFarEndVCCamera(string key, string name, VideoCodecBase codec)
|
||||
: base(key, name)
|
||||
{
|
||||
Capabilities = eCameraCapabilities.Pan | eCameraCapabilities.Tilt | eCameraCapabilities.Zoom;
|
||||
|
||||
ParentCodec = codec;
|
||||
}
|
||||
|
||||
#region IHasCameraPtzControl Members
|
||||
|
||||
public void PositionHome()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Resetting to home position");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IHasCameraPanControl Members
|
||||
|
||||
public void PanLeft()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Panning Left");
|
||||
}
|
||||
|
||||
public void PanRight()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Panning Right");
|
||||
}
|
||||
|
||||
public void PanStop()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Stopping Pan");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IHasCameraTiltControl Members
|
||||
|
||||
public void TiltDown()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Tilting Down");
|
||||
}
|
||||
|
||||
public void TiltUp()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Tilting Up");
|
||||
}
|
||||
|
||||
public void TiltStop()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Stopping Tilt");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IHasCameraZoomControl Members
|
||||
|
||||
public void ZoomIn()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Zooming In");
|
||||
}
|
||||
|
||||
public void ZoomOut()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Zooming Out");
|
||||
}
|
||||
|
||||
public void ZoomStop()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, "Stopping Zoom");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
LinkCameraToApi(this, trilist, joinStart, joinMapKey, bridge);
|
||||
}
|
||||
}
|
||||
|
|
@ -2,32 +2,32 @@
|
|||
using Newtonsoft.Json;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Represents a MockVcPropertiesConfig
|
||||
/// </summary>
|
||||
public class MockVcPropertiesConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a MockVcPropertiesConfig
|
||||
/// Gets or sets the Favorites
|
||||
/// </summary>
|
||||
public class MockVcPropertiesConfig
|
||||
[JsonProperty("favorites")]
|
||||
public List<CodecActiveCallItem> Favorites { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Presets
|
||||
/// </summary>
|
||||
[JsonProperty("presets")]
|
||||
public List<CodecRoomPreset> Presets { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MockVcPropertiesConfig"/> class.
|
||||
/// </summary>
|
||||
public MockVcPropertiesConfig()
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Favorites
|
||||
/// </summary>
|
||||
[JsonProperty("favorites")]
|
||||
public List<CodecActiveCallItem> Favorites { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Presets
|
||||
/// </summary>
|
||||
[JsonProperty("presets")]
|
||||
public List<CodecRoomPreset> Presets { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MockVcPropertiesConfig"/> class.
|
||||
/// </summary>
|
||||
public MockVcPropertiesConfig()
|
||||
{
|
||||
Favorites = new List<CodecActiveCallItem>();
|
||||
Presets = new List<CodecRoomPreset>();
|
||||
}
|
||||
Favorites = new List<CodecActiveCallItem>();
|
||||
Presets = new List<CodecRoomPreset>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue