mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 20:54:55 +00:00
Merge pull request #458 from PepperDash/feature/IDspPreset
Add IDspPreset Interface
This commit is contained in:
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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" />
|
||||||
|
|||||||
@@ -12,15 +12,15 @@ using System.Text.RegularExpressions;
|
|||||||
namespace PepperDash.Essentials.Devices.Common.DSP
|
namespace PepperDash.Essentials.Devices.Common.DSP
|
||||||
{
|
{
|
||||||
|
|
||||||
// QUESTIONS:
|
// QUESTIONS:
|
||||||
//
|
//
|
||||||
// When subscribing, just use the Instance ID for Custom Name?
|
// When subscribing, just use the Instance ID for Custom Name?
|
||||||
|
|
||||||
// Verbose on subscriptions?
|
// Verbose on subscriptions?
|
||||||
|
|
||||||
// Example subscription feedback responses
|
// Example subscription feedback responses
|
||||||
// ! "publishToken":"name" "value":-77.0
|
// ! "publishToken":"name" "value":-77.0
|
||||||
// ! "myLevelName" -77
|
// ! "myLevelName" -77
|
||||||
|
|
||||||
public class BiampTesiraForteDsp : DspBase
|
public class BiampTesiraForteDsp : DspBase
|
||||||
{
|
{
|
||||||
@@ -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,8 +47,9 @@ 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,
|
||||||
base(key, name)
|
BiampTesiraFortePropertiesConfig props) :
|
||||||
|
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
|
||||||
@@ -225,7 +232,7 @@ namespace PepperDash.Essentials.Devices.Common.DSP
|
|||||||
if (CommandQueue.Peek() is QueuedCommand)
|
if (CommandQueue.Peek() is QueuedCommand)
|
||||||
{
|
{
|
||||||
// Expected response belongs to a child class
|
// Expected response belongs to a child class
|
||||||
QueuedCommand tempCommand = (QueuedCommand)CommandQueue.TryToDequeue();
|
QueuedCommand tempCommand = (QueuedCommand) CommandQueue.TryToDequeue();
|
||||||
//Debug.Console(1, this, "Command Dequeued. CommandQueue Size: {0}", CommandQueue.Count);
|
//Debug.Console(1, this, "Command Dequeued. CommandQueue Size: {0}", CommandQueue.Count);
|
||||||
|
|
||||||
tempCommand.ControlPoint.ParseGetMessage(tempCommand.AttributeCode, args.Text);
|
tempCommand.ControlPoint.ParseGetMessage(tempCommand.AttributeCode, args.Text);
|
||||||
@@ -233,7 +240,7 @@ namespace PepperDash.Essentials.Devices.Common.DSP
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Expected response belongs to this class
|
// Expected response belongs to this class
|
||||||
string temp = (string)CommandQueue.TryToDequeue();
|
string temp = (string) CommandQueue.TryToDequeue();
|
||||||
//Debug.Console(1, this, "Command Dequeued. CommandQueue Size: {0}", CommandQueue.Count);
|
//Debug.Console(1, this, "Command Dequeued. CommandQueue Size: {0}", CommandQueue.Count);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -254,15 +261,15 @@ namespace PepperDash.Essentials.Devices.Common.DSP
|
|||||||
switch (args.Text)
|
switch (args.Text)
|
||||||
{
|
{
|
||||||
case "-ERR ALREADY_SUBSCRIBED":
|
case "-ERR ALREADY_SUBSCRIBED":
|
||||||
{
|
{
|
||||||
ResetSubscriptionTimer();
|
ResetSubscriptionTimer();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
Debug.Console(0, this, "Error From DSP: '{0}'", args.Text);
|
Debug.Console(0, this, "Error From DSP: '{0}'", args.Text);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -294,10 +301,11 @@ namespace PepperDash.Essentials.Devices.Common.DSP
|
|||||||
CommandQueue.Enqueue(commandToEnqueue);
|
CommandQueue.Enqueue(commandToEnqueue);
|
||||||
//Debug.Console(1, this, "Command (QueuedCommand) Enqueued '{0}'. CommandQueue has '{1}' Elements.", commandToEnqueue.Command, CommandQueue.Count);
|
//Debug.Console(1, this, "Command (QueuedCommand) Enqueued '{0}'. CommandQueue has '{1}' Elements.", commandToEnqueue.Command, CommandQueue.Count);
|
||||||
|
|
||||||
if(!CommandQueueInProgress)
|
if (!CommandQueueInProgress)
|
||||||
SendNextQueuedCommand();
|
SendNextQueuedCommand();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a raw string command to the queue
|
/// Adds a raw string command to the queue
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -314,47 +322,47 @@ 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);
|
||||||
|
|
||||||
//if (CommandQueue.IsEmpty)
|
//if (CommandQueue.IsEmpty)
|
||||||
// CommandQueueInProgress = false;
|
// CommandQueueInProgress = false;
|
||||||
|
|
||||||
//Debug.Console(1, this, "CommandQueue has {0} Elements:\n", CommandQueue.Count);
|
//Debug.Console(1, this, "CommandQueue has {0} Elements:\n", CommandQueue.Count);
|
||||||
|
|
||||||
//foreach (object o in CommandQueue)
|
//foreach (object o in CommandQueue)
|
||||||
//{
|
//{
|
||||||
// if (o is string)
|
// if (o is string)
|
||||||
// Debug.Console(1, this, "{0}", o);
|
// Debug.Console(1, this, "{0}", o);
|
||||||
// else if(o is QueuedCommand)
|
// else if(o is QueuedCommand)
|
||||||
// {
|
// {
|
||||||
// var item = (QueuedCommand)o;
|
// var item = (QueuedCommand)o;
|
||||||
// Debug.Console(1, this, "{0}", item.Command);
|
// Debug.Console(1, this, "{0}", item.Command);
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//Debug.Console(1, this, "End of CommandQueue");
|
//Debug.Console(1, this, "End of CommandQueue");
|
||||||
|
|
||||||
if (Communication.IsConnected && !CommandQueue.IsEmpty)
|
if (Communication.IsConnected && !CommandQueue.IsEmpty)
|
||||||
|
{
|
||||||
|
CommandQueueInProgress = true;
|
||||||
|
|
||||||
|
if (CommandQueue.Peek() is QueuedCommand)
|
||||||
{
|
{
|
||||||
CommandQueueInProgress = true;
|
QueuedCommand nextCommand = new QueuedCommand();
|
||||||
|
|
||||||
if (CommandQueue.Peek() is QueuedCommand)
|
nextCommand = (QueuedCommand) CommandQueue.Peek();
|
||||||
{
|
|
||||||
QueuedCommand nextCommand = new QueuedCommand();
|
|
||||||
|
|
||||||
nextCommand = (QueuedCommand)CommandQueue.Peek();
|
SendLine(nextCommand.Command);
|
||||||
|
|
||||||
SendLine(nextCommand.Command);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
string nextCommand = (string)CommandQueue.Peek();
|
|
||||||
|
|
||||||
SendLine(nextCommand);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string nextCommand = (string) CommandQueue.Peek();
|
||||||
|
|
||||||
|
SendLine(nextCommand);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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));
|
||||||
}
|
}
|
||||||
@@ -379,7 +387,7 @@ namespace PepperDash.Essentials.Devices.Common.DSP
|
|||||||
{
|
{
|
||||||
public BiampTesiraForteDspFactory()
|
public BiampTesiraForteDspFactory()
|
||||||
{
|
{
|
||||||
TypeNames = new List<string>() { "biamptesira" };
|
TypeNames = new List<string>() {"biamptesira"};
|
||||||
}
|
}
|
||||||
|
|
||||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||||
|
|||||||
@@ -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) :
|
||||||
|
base(key, name)
|
||||||
public DspBase(string key, string name) :
|
{
|
||||||
base(key, name) { }
|
}
|
||||||
|
|
||||||
|
|
||||||
// in audio call feedback
|
// in audio call feedback
|
||||||
|
|
||||||
// VOIP
|
// VOIP
|
||||||
// Phone dialer
|
// Phone dialer
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fusion
|
// Fusion
|
||||||
|
|||||||
Reference in New Issue
Block a user