New JoinMap scheme working on CameraControllerJoinMap. Added MobileControlSIMPLRoomJoinMap and began implementing on MobileControlSIMPLRoomBridge

This commit is contained in:
Neil Dorin
2019-12-17 21:36:47 -07:00
parent 0d854270b6
commit 96cd5cfe81
12 changed files with 345 additions and 152 deletions

View File

@@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
using Newtonsoft.Json;
@@ -42,24 +43,101 @@ namespace PepperDash.Essentials.Core
/// <param name="joinStart"></param>
public abstract void OffsetJoinNumbers(uint joinStart);
public Dictionary<string, JoinMetadata> Joins { get; set; }
/// <summary>
/// The collection of joins and associated metadata
/// </summary>
public Dictionary<string, JoinMetadata> Joins = new Dictionary<string, JoinMetadata>();
/// <summary>
/// Prints the join information to console
/// </summary>
public void PrintJoinMapInfo()
{
Debug.Console(0, "{0}:\n", this.GetType().Name);
// Get the joins of each type and print them
Debug.Console(0, "Digitals:");
var digitals = Joins.Where(j => (j.Value.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value);
PrintJoinList(GetSortedJoins(digitals));
Debug.Console(0, "Analogs:");
var analogs = Joins.Where(j => (j.Value.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value);
PrintJoinList(GetSortedJoins(analogs));
Debug.Console(0, "Serials:");
var serials = Joins.Where(j => (j.Value.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value);
PrintJoinList(GetSortedJoins(serials));
}
/// <summary>
/// Returns a sorted list by JoinNumber
/// </summary>
/// <param name="joins"></param>
/// <returns></returns>
List<KeyValuePair<string, JoinMetadata>> GetSortedJoins(Dictionary<string, JoinMetadata> joins)
{
var sortedJoins = joins.ToList();
sortedJoins.Sort((pair1, pair2) => pair1.Value.JoinNumber.CompareTo(pair2.Value.JoinNumber));
return sortedJoins;
}
void PrintJoinList(List<KeyValuePair<string, JoinMetadata>> joins)
{
foreach (var join in joins)
{
Debug.Console(0,
@"Join Number: {0} | Label: '{1}' | JoinSpan: '{2}' | Type: '{3}' | Capabilities: '{4}'",
join.Value.JoinNumber,
join.Value.Label,
join.Value.JoinSpan,
join.Value.JoinType.ToString(),
join.Value.JoinCapabilities.ToString());
}
}
/// <summary>
/// Returns the join number for the join with the specified key
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public uint GetJoinForKey(string key)
{
if (Joins.ContainsKey(key))
return Joins[key].JoinNumber;
else return 0;
}
}
/// <summary>
/// Read = Provides feedback to SIMPL
/// Write = Responds to sig values from SIMPL
/// </summary>
[Flags]
public enum eJoinCapabilities
{
Read = 1,
Write = 2
None = 0,
ToSIMPL = 1,
FromSIMPL = 2,
ToFromSIMPL = ToSIMPL | FromSIMPL
}
[Flags]
public enum eJoinType
{
None = 0,
Digital = 1,
Analog = 2,
Serial = 4
Serial = 4,
DigitalAnalog = Digital | Analog,
DigitalSerial = Digital | Serial,
AnalogSerial = Analog | Serial,
DigitalAnalogSerial = Digital | Analog | Serial
}
/// <summary>
@@ -95,7 +173,4 @@ namespace PepperDash.Essentials.Core
}
}

View File

@@ -11,7 +11,7 @@ using Crestron.SimplSharp.Reflection;
namespace PepperDash.Essentials.Devices.Common.Cameras
{
public class CameraVisca : CameraBase, IHasCameraPtzControl, ICommunicationMonitor, IHasCameraPresets
public class CameraVisca : CameraBase, IHasCameraPtzControl, ICommunicationMonitor, IHasCameraPresets, IPower
{
public IBasicCommunication Communication { get; private set; }
public CommunicationGather PortGather { get; private set; }
@@ -135,6 +135,15 @@ namespace PepperDash.Essentials.Devices.Common.Cameras
{
SendBytes(new Byte[] {0x81, 0x01, 0x04, 0x00, 0x03, 0xFF});
}
public void PowerToggle()
{
if (PowerIsOnFeedback.BoolValue)
PowerOff();
else
PowerOn();
}
public void PanLeft()
{
SendPanTiltCommand(new byte[] {0x01, 0x03});

View File

@@ -10,6 +10,19 @@ using System.Text.RegularExpressions;
namespace PepperDash.Essentials.Devices.Common.DSP
{
public interface IBiampTesiraDspLevelControl : IBasicVolumeWithFeedback
{
/// <summary>
/// In BiAmp: Instance Tag, QSC: Named Control, Polycom:
/// </summary>
string ControlPointTag { get; }
int Index1 { get; }
int Index2 { get; }
bool HasMute { get; }
bool HasLevel { get; }
bool AutomaticUnmuteOnVolumeUp { get; }
}
public class TesiraForteLevelControl : TesiraForteControlPoint, IBiampTesiraDspLevelControl, IKeyed
{
bool _IsMuted;

View File

@@ -49,27 +49,4 @@ namespace PepperDash.Essentials.Devices.Common.DSP
{
}
// Main program
// VTC
// ATC
// Mics, unusual
public interface IBiampTesiraDspLevelControl : IBasicVolumeWithFeedback
{
/// <summary>
/// In BiAmp: Instance Tag, QSC: Named Control, Polycom:
/// </summary>
string ControlPointTag { get; }
#warning I dont think index1 and index2 should be a part of the interface. JTA 2018-07-17
int Index1 { get; }
int Index2 { get; }
bool HasMute { get; }
bool HasLevel { get; }
bool AutomaticUnmuteOnVolumeUp { get; }
}
}

View File

@@ -103,7 +103,7 @@ namespace PepperDash.Essentials.Devices.Common
});
CircuitIsCritical[circuit] = new BoolFeedback(() =>
{
if (CircuitStatus[circuit].critical != null)
if (CircuitStatus[circuit] != null)
{
return CircuitStatus[circuit].critical;
}
@@ -114,7 +114,7 @@ namespace PepperDash.Essentials.Devices.Common
});
CircuitState[circuit] = new BoolFeedback(() =>
{
if (CircuitStatus[circuit].state != null)
if (CircuitStatus[circuit] != null)
{
return CircuitStatus[circuit].state;
}