Merge pull request #458 from PepperDash/feature/IDspPreset

Add IDspPreset Interface
This commit is contained in:
Andrew Welker
2020-10-21 16:14:54 -06:00
committed by GitHub
5 changed files with 433 additions and 394 deletions

View File

@@ -0,0 +1,17 @@
using System.Collections.Generic;
namespace PepperDash.Essentials.Core
{
public interface IHasDspPresets
{
List<IDspPreset> Presets { get; }
void RecallPreset(IDspPreset preset);
}
public interface IDspPreset
{
string Name { get; }
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash_Essentials_Core.Gateways
{
public class CenCn2Controller
{
}
}

View File

@@ -190,6 +190,7 @@
<Compile Include="Devices\EssentialsBridgeableDevice.cs" /> <Compile Include="Devices\EssentialsBridgeableDevice.cs" />
<Compile Include="Devices\EssentialsDevice.cs" /> <Compile Include="Devices\EssentialsDevice.cs" />
<Compile Include="Devices\GenericIRController.cs" /> <Compile Include="Devices\GenericIRController.cs" />
<Compile Include="Devices\IDspPreset.cs" />
<Compile Include="Devices\IProjectorInterfaces.cs" /> <Compile Include="Devices\IProjectorInterfaces.cs" />
<Compile Include="Devices\PC\InRoomPc.cs" /> <Compile Include="Devices\PC\InRoomPc.cs" />
<Compile Include="Devices\PC\Laptop.cs" /> <Compile Include="Devices\PC\Laptop.cs" />

View File

@@ -28,15 +28,15 @@ namespace PepperDash.Essentials.Devices.Common.DSP
public CommunicationGather PortGather { get; private set; } public CommunicationGather PortGather { get; private set; }
public StatusMonitorBase CommunicationMonitor { get; private set; } public StatusMonitorBase CommunicationMonitor { get; private set; }
new public Dictionary<string, TesiraForteLevelControl> LevelControlPoints { get; private set; } public new Dictionary<string, TesiraForteLevelControl> LevelControlPoints { get; private set; }
public bool isSubscribed; public bool isSubscribed;
private CTimer SubscriptionTimer; private CTimer SubscriptionTimer;
CrestronQueue CommandQueue; private CrestronQueue CommandQueue;
bool CommandQueueInProgress = false; private bool CommandQueueInProgress = false;
//new public Dictionary<string, DspControlPoint> DialerControlPoints { get; private set; } //new public Dictionary<string, DspControlPoint> DialerControlPoints { get; private set; }
@@ -47,7 +47,8 @@ namespace PepperDash.Essentials.Devices.Common.DSP
/// </summary> /// </summary>
public bool ShowHexResponse { get; set; } public bool ShowHexResponse { get; set; }
public BiampTesiraForteDsp(string key, string name, IBasicCommunication comm, BiampTesiraFortePropertiesConfig props) : public BiampTesiraForteDsp(string key, string name, IBasicCommunication comm,
BiampTesiraFortePropertiesConfig props) :
base(key, name) base(key, name)
{ {
CommandQueue = new CrestronQueue(100); CommandQueue = new CrestronQueue(100);
@@ -68,12 +69,14 @@ namespace PepperDash.Essentials.Devices.Common.DSP
PortGather.LineReceived += this.Port_LineReceived; PortGather.LineReceived += this.Port_LineReceived;
if (props.CommunicationMonitorProperties != null) if (props.CommunicationMonitorProperties != null)
{ {
CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, props.CommunicationMonitorProperties); CommunicationMonitor = new GenericCommunicationMonitor(this, Communication,
props.CommunicationMonitorProperties);
} }
else else
{ {
//#warning Need to deal with this poll string //#warning Need to deal with this poll string
CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, 120000, 120000, 300000, "SESSION get aliases\x0d\x0a"); CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, 120000, 120000, 300000,
"SESSION get aliases\x0d\x0a");
} }
LevelControlPoints = new Dictionary<string, TesiraForteLevelControl>(); LevelControlPoints = new Dictionary<string, TesiraForteLevelControl>();
@@ -88,15 +91,17 @@ namespace PepperDash.Essentials.Devices.Common.DSP
public override bool CustomActivate() public override bool CustomActivate()
{ {
Communication.Connect(); Communication.Connect();
CommunicationMonitor.StatusChange += (o, a) => { Debug.Console(2, this, "Communication monitor state: {0}", CommunicationMonitor.Status); }; CommunicationMonitor.StatusChange +=
(o, a) => { Debug.Console(2, this, "Communication monitor state: {0}", CommunicationMonitor.Status); };
CommunicationMonitor.Start(); CommunicationMonitor.Start();
CrestronConsole.AddNewConsoleCommand(SendLine, "send" + Key, "", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(SendLine, "send" + Key, "", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s => Communication.Connect(), "con" + Key, "", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(s => Communication.Connect(), "con" + Key, "",
ConsoleAccessLevelEnum.AccessOperator);
return true; return true;
} }
void socket_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e) private void socket_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e)
{ {
Debug.Console(2, this, "Socket Status Change: {0}", e.Client.ClientStatus.ToString()); Debug.Console(2, this, "Socket Status Change: {0}", e.Client.ClientStatus.ToString());
@@ -123,7 +128,7 @@ namespace PepperDash.Essentials.Devices.Common.DSP
/// <summary> /// <summary>
/// Initiates the subscription process to the DSP /// Initiates the subscription process to the DSP
/// </summary> /// </summary>
void SubscribeToAttributes() private void SubscribeToAttributes()
{ {
SendLine("SESSION set verbose true"); SendLine("SESSION set verbose true");
@@ -141,7 +146,7 @@ namespace PepperDash.Essentials.Devices.Common.DSP
/// <summary> /// <summary>
/// Resets or Sets the subscription timer /// Resets or Sets the subscription timer
/// </summary> /// </summary>
void ResetSubscriptionTimer() private void ResetSubscriptionTimer()
{ {
isSubscribed = true; isSubscribed = true;
@@ -158,7 +163,7 @@ namespace PepperDash.Essentials.Devices.Common.DSP
/// </summary> /// </summary>
/// <param name="dev"></param> /// <param name="dev"></param>
/// <param name="args"></param> /// <param name="args"></param>
void Port_LineReceived(object dev, GenericCommMethodReceiveTextArgs args) private void Port_LineReceived(object dev, GenericCommMethodReceiveTextArgs args)
{ {
if (Debug.Level == 2) if (Debug.Level == 2)
Debug.Console(2, this, "RX: '{0}'", Debug.Console(2, this, "RX: '{0}'",
@@ -200,7 +205,8 @@ namespace PepperDash.Essentials.Devices.Common.DSP
foreach (KeyValuePair<string, TesiraForteLevelControl> controlPoint in LevelControlPoints) foreach (KeyValuePair<string, TesiraForteLevelControl> controlPoint in LevelControlPoints)
{ {
if (customName == controlPoint.Value.LevelCustomName || customName == controlPoint.Value.MuteCustomName) if (customName == controlPoint.Value.LevelCustomName ||
customName == controlPoint.Value.MuteCustomName)
{ {
controlPoint.Value.ParseSubscriptionMessage(customName, value); controlPoint.Value.ParseSubscriptionMessage(customName, value);
return; return;
@@ -215,7 +221,8 @@ namespace PepperDash.Essentials.Devices.Common.DSP
} }
else if (args.Text.IndexOf("+OK") > -1) else if (args.Text.IndexOf("+OK") > -1)
{ {
if (args.Text == "+OK" || args.Text.IndexOf("list\":") > -1 ) // Check for a simple "+OK" only 'ack' repsonse or a list response and ignore if (args.Text == "+OK" || args.Text.IndexOf("list\":") > -1)
// Check for a simple "+OK" only 'ack' repsonse or a list response and ignore
return; return;
// response is not from a subscribed attribute. From a get/set/toggle/increment/decrement command // response is not from a subscribed attribute. From a get/set/toggle/increment/decrement command
@@ -298,6 +305,7 @@ namespace PepperDash.Essentials.Devices.Common.DSP
SendNextQueuedCommand(); SendNextQueuedCommand();
} }
/// <summary> /// <summary>
/// Adds a raw string command to the queue /// Adds a raw string command to the queue
/// </summary> /// </summary>
@@ -314,7 +322,7 @@ namespace PepperDash.Essentials.Devices.Common.DSP
/// <summary> /// <summary>
/// Sends the next queued command to the DSP /// Sends the next queued command to the DSP
/// </summary> /// </summary>
void SendNextQueuedCommand() private void SendNextQueuedCommand()
{ {
//Debug.Console(2, this, "Attempting to send next queued command. CommandQueueInProgress: {0} Communication isConnected: {1}", CommandQueueInProgress, Communication.IsConnected); //Debug.Console(2, this, "Attempting to send next queued command. CommandQueueInProgress: {0} Communication isConnected: {1}", CommandQueueInProgress, Communication.IsConnected);
@@ -362,7 +370,7 @@ namespace PepperDash.Essentials.Devices.Common.DSP
/// Sends a command to execute a preset /// Sends a command to execute a preset
/// </summary> /// </summary>
/// <param name="name">Preset Name</param> /// <param name="name">Preset Name</param>
public override void RunPreset(string name) public void RunPreset(string name)
{ {
SendLine(string.Format("DEVICE recallPreset {0}", name)); SendLine(string.Format("DEVICE recallPreset {0}", name));
} }

View File

@@ -17,16 +17,17 @@ namespace PepperDash.Essentials.Devices.Common.DSP
public Dictionary<string, DspControlPoint> SwitcherControlPoints { get; private set; } public Dictionary<string, DspControlPoint> SwitcherControlPoints { get; private set; }
public abstract void RunPreset(string name);
public DspBase(string key, string name) : public DspBase(string key, string name) :
base(key, name) { } base(key, name)
{
}
// in audio call feedback // in audio call feedback
// VOIP // VOIP
// Phone dialer // Phone dialer
} }
// Fusion // Fusion