mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-12 19:24:53 +00:00
File diff suppressed because it is too large
Load Diff
187
PepperDashEssentials/AppServer/Messengers/AtcDdvc01Messenger.cs
Normal file
187
PepperDashEssentials/AppServer/Messengers/AtcDdvc01Messenger.cs
Normal file
@@ -0,0 +1,187 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Devices.Common.Codec;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
|
{
|
||||||
|
public class Ddvc01AtcMessenger : MessengerBase
|
||||||
|
{
|
||||||
|
BasicTriList EISC;
|
||||||
|
|
||||||
|
const uint BDialHangup = 221;
|
||||||
|
const uint BIncomingAnswer = 251;
|
||||||
|
const uint BIncomingReject = 252;
|
||||||
|
const uint BSpeedDial1 = 241;
|
||||||
|
const uint BSpeedDial2 = 242;
|
||||||
|
const uint BSpeedDial3 = 243;
|
||||||
|
const uint BSpeedDial4 = 244;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 201
|
||||||
|
/// </summary>
|
||||||
|
const uint SCurrentDialString = 201;
|
||||||
|
/// <summary>
|
||||||
|
/// 211
|
||||||
|
/// </summary>
|
||||||
|
const uint SCurrentCallNumber = 211;
|
||||||
|
/// <summary>
|
||||||
|
/// 212
|
||||||
|
/// </summary>
|
||||||
|
const uint SCurrentCallName = 212;
|
||||||
|
/// <summary>
|
||||||
|
/// 221
|
||||||
|
/// </summary>
|
||||||
|
const uint SHookState = 221;
|
||||||
|
/// <summary>
|
||||||
|
/// 222
|
||||||
|
/// </summary>
|
||||||
|
const uint SCallDirection = 222;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
Dictionary<string, uint> DTMFMap = new Dictionary<string, uint>
|
||||||
|
{
|
||||||
|
{ "1", 201 },
|
||||||
|
{ "2", 202 },
|
||||||
|
{ "3", 203 },
|
||||||
|
{ "4", 204 },
|
||||||
|
{ "5", 205 },
|
||||||
|
{ "6", 206 },
|
||||||
|
{ "7", 207 },
|
||||||
|
{ "8", 208 },
|
||||||
|
{ "9", 209 },
|
||||||
|
{ "0", 210 },
|
||||||
|
{ "*", 211 },
|
||||||
|
{ "#", 212 },
|
||||||
|
};
|
||||||
|
|
||||||
|
CodecActiveCallItem CurrentCallItem;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="eisc"></param>
|
||||||
|
/// <param name="messagePath"></param>
|
||||||
|
public Ddvc01AtcMessenger(string key, BasicTriList eisc, string messagePath)
|
||||||
|
: base(key, messagePath)
|
||||||
|
{
|
||||||
|
EISC = eisc;
|
||||||
|
|
||||||
|
CurrentCallItem = new CodecActiveCallItem();
|
||||||
|
CurrentCallItem.Type = eCodecCallType.Audio;
|
||||||
|
CurrentCallItem.Id = "-audio-";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
void SendFullStatus()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
this.PostStatusMessage(new
|
||||||
|
{
|
||||||
|
calls = GetCurrentCallList(),
|
||||||
|
currentCallString = EISC.GetString(SCurrentCallNumber),
|
||||||
|
currentDialString = EISC.GetString(SCurrentDialString),
|
||||||
|
isInCall = EISC.GetString(SHookState) == "Connected"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="appServerController"></param>
|
||||||
|
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
|
||||||
|
{
|
||||||
|
//EISC.SetStringSigAction(SCurrentDialString, s => PostStatusMessage(new { currentDialString = s }));
|
||||||
|
|
||||||
|
EISC.SetStringSigAction(SHookState, s =>
|
||||||
|
{
|
||||||
|
CurrentCallItem.Status = (eCodecCallStatus)Enum.Parse(typeof(eCodecCallStatus), s, true);
|
||||||
|
//GetCurrentCallList();
|
||||||
|
SendCallsList();
|
||||||
|
});
|
||||||
|
|
||||||
|
EISC.SetStringSigAction(SCurrentCallNumber, s =>
|
||||||
|
{
|
||||||
|
CurrentCallItem.Number = s;
|
||||||
|
SendCallsList();
|
||||||
|
});
|
||||||
|
|
||||||
|
EISC.SetStringSigAction(SCurrentCallName, s =>
|
||||||
|
{
|
||||||
|
CurrentCallItem.Name = s;
|
||||||
|
SendCallsList();
|
||||||
|
});
|
||||||
|
|
||||||
|
EISC.SetStringSigAction(SCallDirection, s =>
|
||||||
|
{
|
||||||
|
CurrentCallItem.Direction = (eCodecCallDirection)Enum.Parse(typeof(eCodecCallDirection), s, true);
|
||||||
|
SendCallsList();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add press and holds using helper
|
||||||
|
Action<string, uint> addPHAction = (s, u) =>
|
||||||
|
AppServerController.AddAction(MessagePath + s, new PressAndHoldAction(b => EISC.SetBool(u, b)));
|
||||||
|
|
||||||
|
// Add straight pulse calls
|
||||||
|
Action<string, uint> addAction = (s, u) =>
|
||||||
|
AppServerController.AddAction(MessagePath + s, new Action(() => EISC.PulseBool(u, 100)));
|
||||||
|
addAction("/endCallById", BDialHangup);
|
||||||
|
addAction("/acceptById", BIncomingAnswer);
|
||||||
|
addAction("/rejectById", BIncomingReject);
|
||||||
|
addAction("/speedDial1", BSpeedDial1);
|
||||||
|
addAction("/speedDial2", BSpeedDial2);
|
||||||
|
addAction("/speedDial3", BSpeedDial3);
|
||||||
|
addAction("/speedDial4", BSpeedDial4);
|
||||||
|
|
||||||
|
// Get status
|
||||||
|
AppServerController.AddAction(MessagePath + "/fullStatus", new Action(SendFullStatus));
|
||||||
|
// Dial on string
|
||||||
|
AppServerController.AddAction(MessagePath + "/dial", new Action<string>(s => EISC.SetString(SCurrentDialString, s)));
|
||||||
|
// Pulse DTMF
|
||||||
|
AppServerController.AddAction(MessagePath + "/dtmf", new Action<string>(s =>
|
||||||
|
{
|
||||||
|
if (DTMFMap.ContainsKey(s))
|
||||||
|
{
|
||||||
|
EISC.PulseBool(DTMFMap[s], 100);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
void SendCallsList()
|
||||||
|
{
|
||||||
|
PostStatusMessage(new
|
||||||
|
{
|
||||||
|
calls = GetCurrentCallList(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Turns the
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
List<CodecActiveCallItem> GetCurrentCallList()
|
||||||
|
{
|
||||||
|
if (CurrentCallItem.Status == eCodecCallStatus.Disconnected)
|
||||||
|
{
|
||||||
|
return new List<CodecActiveCallItem>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new List<CodecActiveCallItem>() { CurrentCallItem };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
using PepperDash.Essentials.Devices.Common.Codec;
|
||||||
|
using PepperDash.Essentials.Devices.Common.AudioCodec;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Provides a messaging bridge for an AudioCodecBase device
|
||||||
|
/// </summary>
|
||||||
|
public class AudioCodecBaseMessenger : MessengerBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Device being bridged
|
||||||
|
/// </summary>
|
||||||
|
public AudioCodecBase Codec { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constuctor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="codec"></param>
|
||||||
|
/// <param name="messagePath"></param>
|
||||||
|
public AudioCodecBaseMessenger(string key, AudioCodecBase codec, string messagePath)
|
||||||
|
: base(key, messagePath)
|
||||||
|
{
|
||||||
|
if (codec == null)
|
||||||
|
throw new ArgumentNullException("codec");
|
||||||
|
|
||||||
|
Codec = codec;
|
||||||
|
codec.CallStatusChange += new EventHandler<CodecCallStatusItemChangeEventArgs>(codec_CallStatusChange);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
|
||||||
|
{
|
||||||
|
appServerController.AddAction(MessagePath + "/fullStatus", new Action(SendAtcFullMessageObject));
|
||||||
|
appServerController.AddAction(MessagePath + "/dial", new Action<string>(s => Codec.Dial(s)));
|
||||||
|
appServerController.AddAction(MessagePath + "/endCallById", new Action<string>(s =>
|
||||||
|
{
|
||||||
|
var call = GetCallWithId(s);
|
||||||
|
if (call != null)
|
||||||
|
Codec.EndCall(call);
|
||||||
|
}));
|
||||||
|
appServerController.AddAction(MessagePath + "/endAllCalls", new Action(Codec.EndAllCalls));
|
||||||
|
appServerController.AddAction(MessagePath + "/dtmf", new Action<string>(s => Codec.SendDtmf(s)));
|
||||||
|
appServerController.AddAction(MessagePath + "/rejectById", new Action<string>(s =>
|
||||||
|
{
|
||||||
|
var call = GetCallWithId(s);
|
||||||
|
if (call != null)
|
||||||
|
Codec.RejectCall(call);
|
||||||
|
}));
|
||||||
|
appServerController.AddAction(MessagePath + "/acceptById", new Action<string>(s =>
|
||||||
|
{
|
||||||
|
var call = GetCallWithId(s);
|
||||||
|
if (call != null)
|
||||||
|
Codec.AcceptCall(call);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper to grab a call with string ID
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
CodecActiveCallItem GetCallWithId(string id)
|
||||||
|
{
|
||||||
|
return Codec.ActiveCalls.FirstOrDefault(c => c.Id == id);
|
||||||
|
}
|
||||||
|
|
||||||
|
void codec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e)
|
||||||
|
{
|
||||||
|
SendAtcFullMessageObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper method to build call status for vtc
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
void SendAtcFullMessageObject()
|
||||||
|
{
|
||||||
|
|
||||||
|
var info = Codec.CodecInfo;
|
||||||
|
PostStatusMessage(new
|
||||||
|
{
|
||||||
|
isInCall = Codec.IsInCall,
|
||||||
|
calls = Codec.ActiveCalls,
|
||||||
|
info = new
|
||||||
|
{
|
||||||
|
phoneNumber = info.PhoneNumber
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
81
PepperDashEssentials/AppServer/Messengers/MessengerBase.cs
Normal file
81
PepperDashEssentials/AppServer/Messengers/MessengerBase.cs
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
|
||||||
|
using PepperDash.Essentials.Devices.Common.Codec;
|
||||||
|
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Provides a messaging bridge for a VideoCodecBase
|
||||||
|
/// </summary>
|
||||||
|
public abstract class MessengerBase : IKeyed
|
||||||
|
{
|
||||||
|
public string Key { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public CotijaSystemController AppServerController { get; private set; }
|
||||||
|
|
||||||
|
public string MessagePath { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="codec"></param>
|
||||||
|
public MessengerBase(string key, string messagePath)
|
||||||
|
{
|
||||||
|
Key = key;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(messagePath))
|
||||||
|
throw new ArgumentException("messagePath must not be empty or null");
|
||||||
|
|
||||||
|
MessagePath = messagePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registers this messenger with appserver controller
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="appServerController"></param>
|
||||||
|
public void RegisterWithAppServer(CotijaSystemController appServerController)
|
||||||
|
{
|
||||||
|
if (appServerController == null)
|
||||||
|
throw new ArgumentNullException("appServerController");
|
||||||
|
|
||||||
|
AppServerController = appServerController;
|
||||||
|
CustomRegisterWithAppServer(AppServerController);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Implemented in extending classes. Wire up API calls and feedback here
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="appServerController"></param>
|
||||||
|
abstract protected void CustomRegisterWithAppServer(CotijaSystemController appServerController);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper for posting status message
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="contentObject">The contents of the content object</param>
|
||||||
|
protected void PostStatusMessage(object contentObject)
|
||||||
|
{
|
||||||
|
if (AppServerController != null)
|
||||||
|
{
|
||||||
|
AppServerController.SendMessageToServer(JObject.FromObject(new
|
||||||
|
{
|
||||||
|
type = MessagePath,
|
||||||
|
content = contentObject
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Monitoring;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
|
{
|
||||||
|
public class SystemMonitorMessenger : MessengerBase
|
||||||
|
{
|
||||||
|
public SystemMonitorController SysMon { get; private set; }
|
||||||
|
|
||||||
|
public SystemMonitorMessenger(string key, SystemMonitorController sysMon, string messagePath)
|
||||||
|
: base(key, messagePath)
|
||||||
|
{
|
||||||
|
if (sysMon == null)
|
||||||
|
throw new ArgumentNullException("sysMon");
|
||||||
|
|
||||||
|
SysMon = sysMon;
|
||||||
|
|
||||||
|
SysMon.SystemMonitorPropertiesChanged += new EventHandler<EventArgs>(SysMon_SystemMonitorPropertiesChanged);
|
||||||
|
|
||||||
|
foreach (var p in SysMon.ProgramStatusFeedbackCollection)
|
||||||
|
{
|
||||||
|
p.Value.ProgramInfoChanged += new EventHandler<ProgramInfoEventArgs>(ProgramInfoChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
CrestronConsole.AddNewConsoleCommand(s => SendFullStatusMessage(), "SendFullSysMonStatus", "Sends the full System Monitor Status", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Posts the program information message
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
void ProgramInfoChanged(object sender, ProgramInfoEventArgs e)
|
||||||
|
{
|
||||||
|
Debug.Console(1, "Posting Status Message: {0}", e.ProgramInfo.ToString());
|
||||||
|
PostStatusMessage(e.ProgramInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Posts the system monitor properties
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
void SysMon_SystemMonitorPropertiesChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SendSystemMonitorStatusMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SendFullStatusMessage()
|
||||||
|
{
|
||||||
|
SendSystemMonitorStatusMessage();
|
||||||
|
|
||||||
|
foreach (var p in SysMon.ProgramStatusFeedbackCollection)
|
||||||
|
{
|
||||||
|
PostStatusMessage(p.Value.ProgramInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SendSystemMonitorStatusMessage()
|
||||||
|
{
|
||||||
|
Debug.Console(1, "Posting System Monitor Status Message.");
|
||||||
|
|
||||||
|
// This takes a while, launch a new thread
|
||||||
|
CrestronInvoke.BeginInvoke((o) =>
|
||||||
|
{
|
||||||
|
PostStatusMessage(new
|
||||||
|
{
|
||||||
|
timeZone = SysMon.TimeZoneFeedback.IntValue,
|
||||||
|
timeZoneName = SysMon.TimeZoneTextFeedback.StringValue,
|
||||||
|
ioControllerVersion = SysMon.IOControllerVersionFeedback.StringValue,
|
||||||
|
snmpVersion = SysMon.SnmpVersionFeedback.StringValue,
|
||||||
|
bacnetVersion = SysMon.BACnetAppVersionFeedback.StringValue,
|
||||||
|
controllerVersion = SysMon.ControllerVersionFeedback.StringValue
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
|
||||||
|
{
|
||||||
|
AppServerController.AddAction(MessagePath + "/fullStatus", new Action(SendFullStatusMessage));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,31 +13,25 @@ using PepperDash.Essentials.Devices.Common.VideoCodec;
|
|||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides a messaging bridge for a VideoCodecBase
|
/// Provides a messaging bridge for a VideoCodecBase device
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class VideoCodecBaseMessenger
|
public class VideoCodecBaseMessenger : MessengerBase
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public VideoCodecBase Codec { get; private set; }
|
public VideoCodecBase Codec { get; private set; }
|
||||||
|
|
||||||
public CotijaSystemController AppServerController { get; private set; }
|
|
||||||
|
|
||||||
public string MessagePath { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="codec"></param>
|
/// <param name="codec"></param>
|
||||||
public VideoCodecBaseMessenger(VideoCodecBase codec, string messagePath)
|
public VideoCodecBaseMessenger(string key, VideoCodecBase codec, string messagePath)
|
||||||
|
: base(key, messagePath)
|
||||||
{
|
{
|
||||||
if (codec == null)
|
if (codec == null)
|
||||||
throw new ArgumentNullException("codec");
|
throw new ArgumentNullException("codec");
|
||||||
if (string.IsNullOrEmpty(messagePath))
|
|
||||||
throw new ArgumentException("messagePath must not be empty or null");
|
|
||||||
|
|
||||||
MessagePath = messagePath;
|
|
||||||
Codec = codec;
|
Codec = codec;
|
||||||
codec.CallStatusChange += new EventHandler<CodecCallStatusItemChangeEventArgs>(codec_CallStatusChange);
|
codec.CallStatusChange += new EventHandler<CodecCallStatusItemChangeEventArgs>(codec_CallStatusChange);
|
||||||
codec.IsReadyChange += new EventHandler<EventArgs>(codec_IsReadyChange);
|
codec.IsReadyChange += new EventHandler<EventArgs>(codec_IsReadyChange);
|
||||||
@@ -47,7 +41,31 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
{
|
{
|
||||||
dirCodec.DirectoryResultReturned += new EventHandler<DirectoryEventArgs>(dirCodec_DirectoryResultReturned);
|
dirCodec.DirectoryResultReturned += new EventHandler<DirectoryEventArgs>(dirCodec_DirectoryResultReturned);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var recCodec = codec as IHasCallHistory;
|
||||||
|
if (recCodec != null)
|
||||||
|
{
|
||||||
|
recCodec.CallHistory.RecentCallsListHasChanged += new EventHandler<EventArgs>(CallHistory_RecentCallsListHasChanged);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
void CallHistory_RecentCallsListHasChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var recents = (sender as CodecCallHistory).RecentCalls;
|
||||||
|
|
||||||
|
if (recents != null)
|
||||||
|
{
|
||||||
|
PostStatusMessage(new
|
||||||
|
{
|
||||||
|
recentCalls = recents
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@@ -56,7 +74,6 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
void dirCodec_DirectoryResultReturned(object sender, DirectoryEventArgs e)
|
void dirCodec_DirectoryResultReturned(object sender, DirectoryEventArgs e)
|
||||||
{
|
{
|
||||||
var dir = e.Directory;
|
|
||||||
PostStatusMessage(new
|
PostStatusMessage(new
|
||||||
{
|
{
|
||||||
currentDirectory = e.Directory
|
currentDirectory = e.Directory
|
||||||
@@ -77,16 +94,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Registers this codec's messaging with an app server controller
|
/// Called from base's RegisterWithAppServer method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="appServerController"></param>
|
/// <param name="appServerController"></param>
|
||||||
public void RegisterWithAppServer(CotijaSystemController appServerController)
|
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
|
||||||
{
|
{
|
||||||
if (appServerController == null)
|
|
||||||
throw new ArgumentNullException("appServerController");
|
|
||||||
|
|
||||||
AppServerController = appServerController;
|
|
||||||
|
|
||||||
appServerController.AddAction("/device/videoCodec/isReady", new Action(SendIsReady));
|
appServerController.AddAction("/device/videoCodec/isReady", new Action(SendIsReady));
|
||||||
appServerController.AddAction("/device/videoCodec/fullStatus", new Action(SendVtcFullMessageObject));
|
appServerController.AddAction("/device/videoCodec/fullStatus", new Action(SendVtcFullMessageObject));
|
||||||
appServerController.AddAction("/device/videoCodec/dial", new Action<string>(s => Codec.Dial(s)));
|
appServerController.AddAction("/device/videoCodec/dial", new Action<string>(s => Codec.Dial(s)));
|
||||||
@@ -113,6 +125,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
appServerController.AddAction(MessagePath + "/directoryRoot", new Action(GetDirectoryRoot));
|
appServerController.AddAction(MessagePath + "/directoryRoot", new Action(GetDirectoryRoot));
|
||||||
appServerController.AddAction(MessagePath + "/directoryById", new Action<string>(s => GetDirectory(s)));
|
appServerController.AddAction(MessagePath + "/directoryById", new Action<string>(s => GetDirectory(s)));
|
||||||
appServerController.AddAction(MessagePath + "/directorySearch", new Action<string>(s => DirectorySearch(s)));
|
appServerController.AddAction(MessagePath + "/directorySearch", new Action<string>(s => DirectorySearch(s)));
|
||||||
|
appServerController.AddAction(MessagePath + "/getCallHistory", new Action(GetCallHistory));
|
||||||
appServerController.AddAction(MessagePath + "/privacyModeOn", new Action(Codec.PrivacyModeOn));
|
appServerController.AddAction(MessagePath + "/privacyModeOn", new Action(Codec.PrivacyModeOn));
|
||||||
appServerController.AddAction(MessagePath + "/privacyModeOff", new Action(Codec.PrivacyModeOff));
|
appServerController.AddAction(MessagePath + "/privacyModeOff", new Action(Codec.PrivacyModeOff));
|
||||||
appServerController.AddAction(MessagePath + "/privacyModeToggle", new Action(Codec.PrivacyModeToggle));
|
appServerController.AddAction(MessagePath + "/privacyModeToggle", new Action(Codec.PrivacyModeToggle));
|
||||||
@@ -122,6 +135,24 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
appServerController.AddAction(MessagePath + "/standbyOff", new Action(Codec.StandbyDeactivate));
|
appServerController.AddAction(MessagePath + "/standbyOff", new Action(Codec.StandbyDeactivate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GetCallHistory()
|
||||||
|
{
|
||||||
|
var codec = (Codec as IHasCallHistory);
|
||||||
|
|
||||||
|
if (codec != null)
|
||||||
|
{
|
||||||
|
var recents = codec.CallHistory.RecentCalls;
|
||||||
|
|
||||||
|
if (recents != null)
|
||||||
|
{
|
||||||
|
PostStatusMessage(new
|
||||||
|
{
|
||||||
|
recentCalls = recents
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void GetFullStatusMessage()
|
public void GetFullStatusMessage()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -239,21 +270,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
sipURI = info.SipUri
|
sipURI = info.SipUri
|
||||||
},
|
},
|
||||||
showSelfViewByDefault = Codec.ShowSelfViewByDefault,
|
showSelfViewByDefault = Codec.ShowSelfViewByDefault,
|
||||||
hasDirectory = Codec is IHasDirectory
|
hasDirectory = Codec is IHasDirectory,
|
||||||
|
hasRecents = Codec is IHasCallHistory,
|
||||||
|
hasCameras = Codec is IHasCameraControl
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Helper for posting status message
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="contentObject">The contents of the content object</param>
|
|
||||||
void PostStatusMessage(object contentObject)
|
|
||||||
{
|
|
||||||
AppServerController.SendMessageToServer(JObject.FromObject(new
|
|
||||||
{
|
|
||||||
type = MessagePath,
|
|
||||||
content = contentObject
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,6 +10,7 @@ using Newtonsoft.Json;
|
|||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.AppServer.Messengers;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
using PepperDash.Essentials.Room.Config;
|
using PepperDash.Essentials.Room.Config;
|
||||||
@@ -26,6 +27,14 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const uint RoomIsOn = 301;
|
public const uint RoomIsOn = 301;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 41
|
||||||
|
/// </summary>
|
||||||
|
public const uint PromptForCode = 41;
|
||||||
|
/// <summary>
|
||||||
|
/// 42
|
||||||
|
/// </summary>
|
||||||
|
public const uint ClientJoined = 42;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 51
|
/// 51
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -60,14 +69,15 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
/// 63
|
/// 63
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const uint ShutdownStart = 63;
|
public const uint ShutdownStart = 63;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 72
|
/// 72
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const uint SourceHasChanged = 72;
|
public const uint SourceHasChanged = 72;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 261 - The start of the range of speed dial visibles
|
||||||
|
/// </summary>
|
||||||
|
public const uint SpeedDialVisibleStartJoin = 261;
|
||||||
|
/// <summary>
|
||||||
/// 501
|
/// 501
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const uint ConfigIsReady = 501;
|
public const uint ConfigIsReady = 501;
|
||||||
@@ -92,6 +102,16 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
/// 71
|
/// 71
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const uint SelectedSourceKey = 71;
|
public const uint SelectedSourceKey = 71;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 241
|
||||||
|
/// </summary>
|
||||||
|
public const uint SpeedDialNameStartJoin = 241;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 251
|
||||||
|
/// </summary>
|
||||||
|
public const uint SpeedDialNumberStartJoin = 251;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 501
|
/// 501
|
||||||
@@ -145,6 +165,8 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
|
|
||||||
CotijaDdvc01DeviceBridge SourceBridge;
|
CotijaDdvc01DeviceBridge SourceBridge;
|
||||||
|
|
||||||
|
Ddvc01AtcMessenger AtcMessenger;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@@ -182,6 +204,10 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
SetupFunctions();
|
SetupFunctions();
|
||||||
SetupFeedbacks();
|
SetupFeedbacks();
|
||||||
|
|
||||||
|
var key = this.Key + "-" + Parent.Key;
|
||||||
|
AtcMessenger = new Ddvc01AtcMessenger(key, EISC, "/device/audioCodec");
|
||||||
|
AtcMessenger.RegisterWithAppServer(Parent);
|
||||||
|
|
||||||
EISC.SigChange += EISC_SigChange;
|
EISC.SigChange += EISC_SigChange;
|
||||||
EISC.OnlineStatusChange += (o, a) =>
|
EISC.OnlineStatusChange += (o, a) =>
|
||||||
{
|
{
|
||||||
@@ -216,8 +242,6 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
}
|
}
|
||||||
}, "mobilebridgedump", "Dumps DDVC01 bridge EISC data b,u,s", ConsoleAccessLevelEnum.AccessOperator);
|
}, "mobilebridgedump", "Dumps DDVC01 bridge EISC data b,u,s", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
|
||||||
CrestronConsole.AddNewConsoleCommand(s => LoadConfigValues(), "loadddvc", "", ConsoleAccessLevelEnum.AccessOperator);
|
|
||||||
|
|
||||||
return base.CustomActivate();
|
return base.CustomActivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,6 +251,9 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
void SetupFunctions()
|
void SetupFunctions()
|
||||||
{
|
{
|
||||||
|
#warning need join numbers for these
|
||||||
|
Parent.AddAction(@"/room/room1/promptForCode", new Action(() => EISC.PulseBool(BoolJoin.PromptForCode)));
|
||||||
|
Parent.AddAction(@"/room/room1/clientJoined", new Action(() => EISC.PulseBool(BoolJoin.ClientJoined)));
|
||||||
|
|
||||||
Parent.AddAction(@"/room/room1/status", new Action(SendFullStatus));
|
Parent.AddAction(@"/room/room1/status", new Action(SendFullStatus));
|
||||||
|
|
||||||
@@ -238,6 +265,10 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
|
|
||||||
Parent.AddAction(@"/room/room1/defaultsource", new Action(() =>
|
Parent.AddAction(@"/room/room1/defaultsource", new Action(() =>
|
||||||
EISC.PulseBool(BoolJoin.ActivitySharePress)));
|
EISC.PulseBool(BoolJoin.ActivitySharePress)));
|
||||||
|
Parent.AddAction(@"/room/room1/activityVideo", new Action(() =>
|
||||||
|
EISC.PulseBool(BoolJoin.ActivityVideoCallPress)));
|
||||||
|
Parent.AddAction(@"/room/room1/activityPhone", new Action(() =>
|
||||||
|
EISC.PulseBool(BoolJoin.ActivityPhoneCallPress)));
|
||||||
|
|
||||||
Parent.AddAction(@"/room/room1/volumes/master/level", new Action<ushort>(u =>
|
Parent.AddAction(@"/room/room1/volumes/master/level", new Action<ushort>(u =>
|
||||||
EISC.SetUshort(UshortJoin.MasterVolumeLevel, u)));
|
EISC.SetUshort(UshortJoin.MasterVolumeLevel, u)));
|
||||||
@@ -250,20 +281,26 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
EISC.PulseBool(BoolJoin.ShutdownEnd)));
|
EISC.PulseBool(BoolJoin.ShutdownEnd)));
|
||||||
Parent.AddAction(@"/room/room1/shutdownCancel", new Action(() =>
|
Parent.AddAction(@"/room/room1/shutdownCancel", new Action(() =>
|
||||||
EISC.PulseBool(BoolJoin.ShutdownCancel)));
|
EISC.PulseBool(BoolJoin.ShutdownCancel)));
|
||||||
|
|
||||||
|
|
||||||
// Source Device (Current Source)'
|
|
||||||
|
|
||||||
SourceDeviceMapDictionary sourceJoinMap = new SourceDeviceMapDictionary();
|
|
||||||
|
|
||||||
var prefix = @"/device/currentSource/";
|
|
||||||
|
|
||||||
foreach (var item in sourceJoinMap)
|
|
||||||
{
|
|
||||||
Parent.AddAction(string.Format("{0}{1}", prefix, item.Key), new PressAndHoldAction(b => EISC.SetBool(item.Value, b)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="devKey"></param>
|
||||||
|
void SetupSourceFunctions(string devKey)
|
||||||
|
{
|
||||||
|
SourceDeviceMapDictionary sourceJoinMap = new SourceDeviceMapDictionary();
|
||||||
|
|
||||||
|
var prefix = string.Format("/device/{0}/", devKey);
|
||||||
|
|
||||||
|
foreach (var item in sourceJoinMap)
|
||||||
|
{
|
||||||
|
var join = item.Value;
|
||||||
|
Parent.AddAction(string.Format("{0}{1}", prefix, item.Key), new PressAndHoldAction(b => EISC.SetBool(join, b)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Links feedbacks to whatever is gonna happen!
|
/// Links feedbacks to whatever is gonna happen!
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -345,10 +382,10 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
var version = Assembly.GetExecutingAssembly().GetName().Version;
|
var version = Assembly.GetExecutingAssembly().GetName().Version;
|
||||||
co.Info.RuntimeInfo.AssemblyVersion = string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build);
|
co.Info.RuntimeInfo.AssemblyVersion = string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build);
|
||||||
|
|
||||||
|
|
||||||
//Room
|
//Room
|
||||||
if (co.Rooms == null)
|
//if (co.Rooms == null)
|
||||||
co.Rooms = new List<DeviceConfig>();
|
// always start fresh in case simpl changed
|
||||||
|
co.Rooms = new List<DeviceConfig>();
|
||||||
var rm = new DeviceConfig();
|
var rm = new DeviceConfig();
|
||||||
if (co.Rooms.Count == 0)
|
if (co.Rooms.Count == 0)
|
||||||
{
|
{
|
||||||
@@ -388,6 +425,11 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
var name = EISC.StringOutput[i + 1].StringValue;
|
var name = EISC.StringOutput[i + 1].StringValue;
|
||||||
rmProps.SpeedDials.Add(new DDVC01SpeedDial { Number = num, Name = name});
|
rmProps.SpeedDials.Add(new DDVC01SpeedDial { Number = num, Name = name});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This MAY need a check
|
||||||
|
rmProps.AudioCodecKey = "audioCodec";
|
||||||
|
rmProps.VideoCodecKey = null; // "videoCodec";
|
||||||
|
|
||||||
// volume control names
|
// volume control names
|
||||||
var volCount = EISC.UShortOutput[701].UShortValue;
|
var volCount = EISC.UShortOutput[701].UShortValue;
|
||||||
|
|
||||||
@@ -403,7 +445,10 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
co.Devices = new List<DeviceConfig>();
|
co.Devices = new List<DeviceConfig>();
|
||||||
|
|
||||||
// clear out previous DDVC devices
|
// clear out previous DDVC devices
|
||||||
co.Devices.RemoveAll(d => d.Key.StartsWith("source-", StringComparison.OrdinalIgnoreCase));
|
co.Devices.RemoveAll(d =>
|
||||||
|
d.Key.StartsWith("source-", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| d.Key.Equals("audioCodec", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| d.Key.Equals("videoCodec", StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
rmProps.SourceListKey = "default";
|
rmProps.SourceListKey = "default";
|
||||||
rm.Properties = JToken.FromObject(rmProps);
|
rm.Properties = JToken.FromObject(rmProps);
|
||||||
@@ -422,6 +467,7 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
break;
|
break;
|
||||||
var icon = EISC.StringOutput[651 + i].StringValue;
|
var icon = EISC.StringOutput[651 + i].StringValue;
|
||||||
var key = EISC.StringOutput[671 + i].StringValue;
|
var key = EISC.StringOutput[671 + i].StringValue;
|
||||||
|
|
||||||
var type = EISC.StringOutput[701 + i].StringValue;
|
var type = EISC.StringOutput[701 + i].StringValue;
|
||||||
|
|
||||||
Debug.Console(0, this, "Adding source {0} '{1}'", key, name);
|
Debug.Console(0, this, "Adding source {0} '{1}'", key, name);
|
||||||
@@ -430,6 +476,7 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
Name = name,
|
Name = name,
|
||||||
Order = (int)i + 1,
|
Order = (int)i + 1,
|
||||||
SourceKey = key,
|
SourceKey = key,
|
||||||
|
Type = eSourceListItemType.Route
|
||||||
};
|
};
|
||||||
newSl.Add(key, newSLI);
|
newSl.Add(key, newSLI);
|
||||||
|
|
||||||
@@ -447,10 +494,50 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
Type = type
|
Type = type
|
||||||
};
|
};
|
||||||
co.Devices.Add(devConf);
|
co.Devices.Add(devConf);
|
||||||
|
|
||||||
|
if (group.ToLower().StartsWith("settopbox")) // Add others here as needed
|
||||||
|
{
|
||||||
|
SetupSourceFunctions(key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
co.SourceLists.Add("default", newSl);
|
co.SourceLists.Add("default", newSl);
|
||||||
|
|
||||||
|
// build "audioCodec" config if we need
|
||||||
|
if (!string.IsNullOrEmpty(rmProps.AudioCodecKey))
|
||||||
|
{
|
||||||
|
var acFavs = new List<PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem>();
|
||||||
|
for (uint i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
if (!EISC.GetBool(BoolJoin.SpeedDialVisibleStartJoin + i))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
acFavs.Add(new PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem()
|
||||||
|
{
|
||||||
|
Name = EISC.GetString(StringJoin.SpeedDialNameStartJoin + i),
|
||||||
|
Number = EISC.GetString(StringJoin.SpeedDialNumberStartJoin + i),
|
||||||
|
Type = PepperDash.Essentials.Devices.Common.Codec.eCodecCallType.Audio
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var acProps = new
|
||||||
|
{
|
||||||
|
favorites = acFavs
|
||||||
|
};
|
||||||
|
|
||||||
|
var acStr = "audioCodec";
|
||||||
|
var acConf = new DeviceConfig()
|
||||||
|
{
|
||||||
|
Group = acStr,
|
||||||
|
Key = acStr,
|
||||||
|
Name = acStr,
|
||||||
|
Type = acStr,
|
||||||
|
Properties = JToken.FromObject(acProps)
|
||||||
|
};
|
||||||
|
co.Devices.Add(acConf);
|
||||||
|
}
|
||||||
|
|
||||||
Debug.Console(0, this, "******* CONFIG FROM DDVC: \r{0}", JsonConvert.SerializeObject(ConfigReader.ConfigObject, Formatting.Indented));
|
Debug.Console(0, this, "******* CONFIG FROM DDVC: \r{0}", JsonConvert.SerializeObject(ConfigReader.ConfigObject, Formatting.Indented));
|
||||||
|
|
||||||
var handler = ConfigurationIsReady;
|
var handler = ConfigurationIsReady;
|
||||||
@@ -462,6 +549,9 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
ConfigIsLoaded = true;
|
ConfigIsLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
void SendFullStatus()
|
void SendFullStatus()
|
||||||
{
|
{
|
||||||
if (ConfigIsLoaded)
|
if (ConfigIsLoaded)
|
||||||
@@ -585,86 +675,5 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
EISC.StringInput[StringJoin.UserCodeToSystem].StringValue = UserCode;
|
EISC.StringInput[StringJoin.UserCodeToSystem].StringValue = UserCode;
|
||||||
EISC.StringInput[StringJoin.ServerUrl].StringValue = Parent.Config.ClientAppUrl;
|
EISC.StringInput[StringJoin.ServerUrl].StringValue = Parent.Config.ClientAppUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="oldKey"></param>
|
|
||||||
/// <param name="newKey"></param>
|
|
||||||
void SourceChange(string oldKey, string newKey)
|
|
||||||
{
|
|
||||||
/* Example message
|
|
||||||
* {
|
|
||||||
"type":"/room/status",
|
|
||||||
"content": {
|
|
||||||
"selectedSourceKey": "off",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
//if (type == ChangeType.WillChange)
|
|
||||||
//{
|
|
||||||
// // Disconnect from previous source
|
|
||||||
|
|
||||||
// if (info != null)
|
|
||||||
// {
|
|
||||||
// var previousDev = info.SourceDevice;
|
|
||||||
|
|
||||||
// // device type interfaces
|
|
||||||
// if (previousDev is ISetTopBoxControls)
|
|
||||||
// (previousDev as ISetTopBoxControls).UnlinkActions(Parent);
|
|
||||||
// // common interfaces
|
|
||||||
// if (previousDev is IChannel)
|
|
||||||
// (previousDev as IChannel).UnlinkActions(Parent);
|
|
||||||
// if (previousDev is IColor)
|
|
||||||
// (previousDev as IColor).UnlinkActions(Parent);
|
|
||||||
// if (previousDev is IDPad)
|
|
||||||
// (previousDev as IDPad).UnlinkActions(Parent);
|
|
||||||
// if (previousDev is IDvr)
|
|
||||||
// (previousDev as IDvr).UnlinkActions(Parent);
|
|
||||||
// if (previousDev is INumericKeypad)
|
|
||||||
// (previousDev as INumericKeypad).UnlinkActions(Parent);
|
|
||||||
// if (previousDev is IPower)
|
|
||||||
// (previousDev as IPower).UnlinkActions(Parent);
|
|
||||||
// if (previousDev is ITransport)
|
|
||||||
// (previousDev as ITransport).UnlinkActions(Parent);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// var huddleRoom = room as EssentialsHuddleSpaceRoom;
|
|
||||||
// JObject roomStatus = new JObject();
|
|
||||||
// roomStatus.Add("selectedSourceKey", huddleRoom.CurrentSourceInfoKey);
|
|
||||||
|
|
||||||
// JObject message = new JObject();
|
|
||||||
|
|
||||||
// message.Add("type", "/room/status/");
|
|
||||||
// message.Add("content", roomStatus);
|
|
||||||
|
|
||||||
// Parent.PostToServer(message);
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// if (info != null)
|
|
||||||
// {
|
|
||||||
// var dev = info.SourceDevice;
|
|
||||||
|
|
||||||
// if (dev is ISetTopBoxControls)
|
|
||||||
// (dev as ISetTopBoxControls).LinkActions(Parent);
|
|
||||||
// if (dev is IChannel)
|
|
||||||
// (dev as IChannel).LinkActions(Parent);
|
|
||||||
// if (dev is IColor)
|
|
||||||
// (dev as IColor).LinkActions(Parent);
|
|
||||||
// if (dev is IDPad)
|
|
||||||
// (dev as IDPad).LinkActions(Parent);
|
|
||||||
// if (dev is IDvr)
|
|
||||||
// (dev as IDvr).LinkActions(Parent);
|
|
||||||
// if (dev is INumericKeypad)
|
|
||||||
// (dev as INumericKeypad).LinkActions(Parent);
|
|
||||||
// if (dev is IPower)
|
|
||||||
// (dev as IPower).LinkActions(Parent);
|
|
||||||
// if (dev is ITransport)
|
|
||||||
// (dev as ITransport).LinkActions(Parent);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,6 +12,7 @@ using PepperDash.Essentials.Core;
|
|||||||
using PepperDash.Essentials.Room.Cotija;
|
using PepperDash.Essentials.Room.Cotija;
|
||||||
using PepperDash.Essentials.Devices.Common.Codec;
|
using PepperDash.Essentials.Devices.Common.Codec;
|
||||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||||
|
using PepperDash.Essentials.Devices.Common.AudioCodec;
|
||||||
|
|
||||||
namespace PepperDash.Essentials
|
namespace PepperDash.Essentials
|
||||||
{
|
{
|
||||||
@@ -22,6 +23,8 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
public VideoCodecBaseMessenger VCMessenger { get; private set; }
|
public VideoCodecBaseMessenger VCMessenger { get; private set; }
|
||||||
|
|
||||||
|
public AudioCodecBaseMessenger ACMessenger { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -74,7 +77,7 @@ namespace PepperDash.Essentials
|
|||||||
{
|
{
|
||||||
Parent.AddAction(string.Format(@"/room/{0}/volumes/master/level", Room.Key), new Action<ushort>(u =>
|
Parent.AddAction(string.Format(@"/room/{0}/volumes/master/level", Room.Key), new Action<ushort>(u =>
|
||||||
(volumeRoom.CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(u)));
|
(volumeRoom.CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(u)));
|
||||||
Parent.AddAction(string.Format(@"/room/{0}/volumes/master/mute", Room.Key), new Action(() =>
|
Parent.AddAction(string.Format(@"/room/{0}/volumes/master/muteToggle", Room.Key), new Action(() =>
|
||||||
volumeRoom.CurrentVolumeControls.MuteToggle()));
|
volumeRoom.CurrentVolumeControls.MuteToggle()));
|
||||||
volumeRoom.CurrentVolumeDeviceChange += new EventHandler<VolumeDeviceChangeEventArgs>(Room_CurrentVolumeDeviceChange);
|
volumeRoom.CurrentVolumeDeviceChange += new EventHandler<VolumeDeviceChangeEventArgs>(Room_CurrentVolumeDeviceChange);
|
||||||
|
|
||||||
@@ -82,7 +85,7 @@ namespace PepperDash.Essentials
|
|||||||
var currentVolumeDevice = volumeRoom.CurrentVolumeControls as IBasicVolumeWithFeedback;
|
var currentVolumeDevice = volumeRoom.CurrentVolumeControls as IBasicVolumeWithFeedback;
|
||||||
if (currentVolumeDevice != null)
|
if (currentVolumeDevice != null)
|
||||||
{
|
{
|
||||||
currentVolumeDevice.MuteFeedback.OutputChange += VolumeLevelFeedback_OutputChange;
|
currentVolumeDevice.MuteFeedback.OutputChange += MuteFeedback_OutputChange;
|
||||||
currentVolumeDevice.VolumeLevelFeedback.OutputChange += VolumeLevelFeedback_OutputChange;
|
currentVolumeDevice.VolumeLevelFeedback.OutputChange += VolumeLevelFeedback_OutputChange;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,29 +95,25 @@ namespace PepperDash.Essentials
|
|||||||
sscRoom.CurrentSingleSourceChange += new SourceInfoChangeHandler(Room_CurrentSingleSourceChange);
|
sscRoom.CurrentSingleSourceChange += new SourceInfoChangeHandler(Room_CurrentSingleSourceChange);
|
||||||
|
|
||||||
var vcRoom = Room as IHasVideoCodec;
|
var vcRoom = Room as IHasVideoCodec;
|
||||||
if (vcRoom != null)
|
if (vcRoom != null && vcRoom.VideoCodec != null)
|
||||||
{
|
{
|
||||||
var codec = vcRoom.VideoCodec;
|
var codec = vcRoom.VideoCodec;
|
||||||
VCMessenger = new VideoCodecBaseMessenger(vcRoom.VideoCodec, "/device/videoCodec");
|
var key = vcRoom.VideoCodec.Key + "-" + parent.Key;
|
||||||
|
VCMessenger = new VideoCodecBaseMessenger(key, vcRoom.VideoCodec, "/device/videoCodec");
|
||||||
VCMessenger.RegisterWithAppServer(Parent);
|
VCMessenger.RegisterWithAppServer(Parent);
|
||||||
|
|
||||||
// May need to move this or remove this
|
|
||||||
codec.CallStatusChange += new EventHandler<CodecCallStatusItemChangeEventArgs>(codec_CallStatusChange);
|
|
||||||
|
|
||||||
vcRoom.IsSharingFeedback.OutputChange += new EventHandler<FeedbackEventArgs>(IsSharingFeedback_OutputChange);
|
vcRoom.IsSharingFeedback.OutputChange += new EventHandler<FeedbackEventArgs>(IsSharingFeedback_OutputChange);
|
||||||
|
|
||||||
//Parent.AddAction("/device/videoCodec/dial", new Action<string>(s => codec.Dial(s)));
|
|
||||||
//Parent.AddAction("/device/videoCodec/endCall", new Action<string>(s =>
|
|
||||||
//{
|
|
||||||
// var call = codec.ActiveCalls.FirstOrDefault(c => c.Id == s);
|
|
||||||
// if (call != null)
|
|
||||||
// {
|
|
||||||
// codec.EndCall(call);
|
|
||||||
// }
|
|
||||||
//}));
|
|
||||||
//Parent.AddAction("/device/videoCodec/endAllCalls", new Action(() => codec.EndAllCalls()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var acRoom = Room as IHasAudioCodec;
|
||||||
|
if (acRoom != null && acRoom.AudioCodec != null)
|
||||||
|
{
|
||||||
|
var codec = acRoom.AudioCodec;
|
||||||
|
var key = acRoom.AudioCodec.Key + "-" + parent.Key;
|
||||||
|
ACMessenger = new AudioCodecBaseMessenger(key, acRoom.AudioCodec, "/device/audioCodec");
|
||||||
|
ACMessenger.RegisterWithAppServer(Parent);
|
||||||
|
}
|
||||||
|
|
||||||
var defCallRm = Room as IRunDefaultCallRoute;
|
var defCallRm = Room as IRunDefaultCallRoute;
|
||||||
if (defCallRm != null)
|
if (defCallRm != null)
|
||||||
{
|
{
|
||||||
@@ -169,18 +168,18 @@ namespace PepperDash.Essentials
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// Handler for codec changes
|
///// Handler for codec changes
|
||||||
/// </summary>
|
///// </summary>
|
||||||
void codec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e)
|
//void codec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e)
|
||||||
{
|
//{
|
||||||
PostStatusMessage(new
|
// PostStatusMessage(new
|
||||||
{
|
// {
|
||||||
calls = GetCallsMessageObject(),
|
// calls = GetCallsMessageObject(),
|
||||||
//vtc = GetVtcCallsMessageObject()
|
// //vtc = GetVtcCallsMessageObject()
|
||||||
});
|
// });
|
||||||
|
|
||||||
}
|
//}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper for posting status message
|
/// Helper for posting status message
|
||||||
@@ -425,53 +424,52 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
PostStatusMessage(new
|
PostStatusMessage(new
|
||||||
{
|
{
|
||||||
calls = GetCallsMessageObject(),
|
//calls = GetCallsMessageObject(),
|
||||||
isOn = room.OnFeedback.BoolValue,
|
isOn = room.OnFeedback.BoolValue,
|
||||||
selectedSourceKey = sourceKey,
|
selectedSourceKey = sourceKey,
|
||||||
vtc = GetVtcCallsMessageObject(),
|
//vtc = GetVtcCallsMessageObject(),
|
||||||
volumes = volumes
|
volumes = volumes
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// Helper to return a anonymous object with the call data for JSON message
|
///// Helper to return a anonymous object with the call data for JSON message
|
||||||
/// </summary>
|
///// </summary>
|
||||||
/// <returns></returns>
|
///// <returns></returns>
|
||||||
object GetCallsMessageObject()
|
//object GetCallsMessageObject()
|
||||||
{
|
//{
|
||||||
var callRm = Room as IHasVideoCodec;
|
// var callRm = Room as IHasVideoCodec;
|
||||||
if (callRm == null)
|
// if (callRm == null)
|
||||||
return null;
|
// return null;
|
||||||
return new
|
// return new
|
||||||
{
|
// {
|
||||||
activeCalls = callRm.VideoCodec.ActiveCalls,
|
// activeCalls = callRm.VideoCodec.ActiveCalls,
|
||||||
callType = callRm.CallTypeFeedback.IntValue,
|
// callType = callRm.CallTypeFeedback.IntValue,
|
||||||
inCall = callRm.InCallFeedback.BoolValue,
|
// inCall = callRm.InCallFeedback.BoolValue,
|
||||||
isSharing = callRm.IsSharingFeedback.BoolValue,
|
// isSharing = callRm.IsSharingFeedback.BoolValue,
|
||||||
privacyModeIsOn = callRm.PrivacyModeIsOnFeedback.BoolValue
|
// privacyModeIsOn = callRm.PrivacyModeIsOnFeedback.BoolValue
|
||||||
};
|
// };
|
||||||
}
|
//}
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// Helper method to build call status for vtc
|
///// Helper method to build call status for vtc
|
||||||
/// </summary>
|
///// </summary>
|
||||||
/// <returns></returns>
|
///// <returns></returns>
|
||||||
object GetVtcCallsMessageObject()
|
//object GetVtcCallsMessageObject()
|
||||||
{
|
//{
|
||||||
var callRm = Room as IHasVideoCodec;
|
// var callRm = Room as IHasVideoCodec;
|
||||||
object vtc = null;
|
// object vtc = null;
|
||||||
if (callRm != null)
|
// if (callRm != null)
|
||||||
{
|
// {
|
||||||
var codec = callRm.VideoCodec;
|
// var codec = callRm.VideoCodec;
|
||||||
vtc = new
|
// vtc = new
|
||||||
{
|
// {
|
||||||
isInCall = codec.IsInCall,
|
// isInCall = codec.IsInCall,
|
||||||
calls = codec.ActiveCalls
|
// calls = codec.ActiveCalls
|
||||||
};
|
// };
|
||||||
}
|
// }
|
||||||
return vtc;
|
// return vtc;
|
||||||
}
|
//}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
BIN
PepperDashEssentials/Bridges/._EssentialsLightsBridge.cs
Normal file
BIN
PepperDashEssentials/Bridges/._EssentialsLightsBridge.cs
Normal file
Binary file not shown.
@@ -5,9 +5,17 @@ using System.Text;
|
|||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharpPro.EthernetCommunication;
|
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.Lighting;
|
||||||
using PepperDash.Essentials.Core.Devices;
|
using PepperDash.Essentials.Core.Devices;
|
||||||
|
using PepperDash.Essentials.Devices.Common;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
using PepperDash.Essentials.Core.CrestronIO;
|
||||||
|
using PepperDash.Essentials.DM;
|
||||||
|
using PepperDash.Essentials.Devices.Common.Cameras;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Bridges
|
namespace PepperDash.Essentials.Bridges
|
||||||
{
|
{
|
||||||
@@ -44,17 +52,93 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class EiscApi : BridgeApi
|
public class EiscApi : BridgeApi
|
||||||
{
|
{
|
||||||
|
public EiscApiPropertiesConfig PropertiesConfig { get; private set; }
|
||||||
|
|
||||||
public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; }
|
public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
public EiscApi(string key, uint ipid, string hostname) :
|
public EiscApi(DeviceConfig dc) :
|
||||||
base(key)
|
base(dc.Key)
|
||||||
{
|
{
|
||||||
Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(ipid, hostname, Global.ControlSystem);
|
PropertiesConfig = JsonConvert.DeserializeObject<EiscApiPropertiesConfig>(dc.Properties.ToString());
|
||||||
|
|
||||||
|
Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(PropertiesConfig.Control.IpIdInt, PropertiesConfig.Control.TcpSshProperties.Address, Global.ControlSystem);
|
||||||
|
|
||||||
Eisc.SigChange += new Crestron.SimplSharpPro.DeviceSupport.SigEventHandler(Eisc_SigChange);
|
Eisc.SigChange += new Crestron.SimplSharpPro.DeviceSupport.SigEventHandler(Eisc_SigChange);
|
||||||
|
|
||||||
Eisc.Register();
|
Eisc.Register();
|
||||||
|
|
||||||
|
AddPostActivationAction( () =>
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, "Linking Devices...");
|
||||||
|
|
||||||
|
foreach (var d in PropertiesConfig.Devices)
|
||||||
|
{
|
||||||
|
var device = DeviceManager.GetDeviceForKey(d.DeviceKey);
|
||||||
|
|
||||||
|
if (device != null)
|
||||||
|
{
|
||||||
|
if (device is PepperDash.Essentials.Core.Monitoring.SystemMonitorController)
|
||||||
|
{
|
||||||
|
(device as PepperDash.Essentials.Core.Monitoring.SystemMonitorController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (device is GenericComm)
|
||||||
|
{
|
||||||
|
(device as GenericComm).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (device is CameraBase)
|
||||||
|
{
|
||||||
|
(device as CameraBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (device is PepperDash.Essentials.Core.TwoWayDisplayBase)
|
||||||
|
{
|
||||||
|
(device as TwoWayDisplayBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (device is DmChassisController)
|
||||||
|
{
|
||||||
|
(device as DmChassisController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (device is DmTxControllerBase)
|
||||||
|
{
|
||||||
|
(device as DmTxControllerBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (device is DmRmcControllerBase)
|
||||||
|
{
|
||||||
|
(device as DmRmcControllerBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (device is GenericRelayDevice)
|
||||||
|
{
|
||||||
|
(device as GenericRelayDevice).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (device is IDigitalInput)
|
||||||
|
{
|
||||||
|
(device as IDigitalInput).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (device is LightingBase)
|
||||||
|
{
|
||||||
|
(device as LightingBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (device is DigitalLogger)
|
||||||
|
{
|
||||||
|
(device as DigitalLogger).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Console(1, this, "Devices Linked.");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -65,7 +149,7 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
|
void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
|
||||||
{
|
{
|
||||||
if (Debug.Level >= 1)
|
if (Debug.Level >= 1)
|
||||||
Debug.Console(1, this, "BridgeApi EISC change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
Debug.Console(1, this, "EiscApi change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
||||||
var uo = args.Sig.UserObject;
|
var uo = args.Sig.UserObject;
|
||||||
if (uo is Action<bool>)
|
if (uo is Action<bool>)
|
||||||
(uo as Action<bool>)(args.Sig.BoolValue);
|
(uo as Action<bool>)(args.Sig.BoolValue);
|
||||||
@@ -76,138 +160,27 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class EiscApiPropertiesConfig
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Defines each type and it's matching API type
|
|
||||||
/// </summary>
|
|
||||||
public static class DeviceApiFactory
|
|
||||||
{
|
{
|
||||||
public static Dictionary<Type, Type> TypeMap = new Dictionary<Type, Type>
|
[JsonProperty("control")]
|
||||||
|
public EssentialsControlPropertiesConfig Control { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("devices")]
|
||||||
|
public List<ApiDevice> Devices { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public class ApiDevice
|
||||||
{
|
{
|
||||||
{ typeof(DmChassisController), typeof(DmChassisControllerApi) },
|
[JsonProperty("deviceKey")]
|
||||||
{ typeof(IBasicCommunication), typeof(IBasicCommunicationApi) }
|
public string DeviceKey { get; set; }
|
||||||
//{ typeof(SomeShittyDisplayController), typeof(SomeShittyDisplayControllerApi) }
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
[JsonProperty("joinStart")]
|
||||||
|
public uint JoinStart { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
[JsonProperty("joinMapKey")]
|
||||||
/// API class for IBasicCommunication devices
|
public string JoinMapKey { get; set; }
|
||||||
/// </summary>
|
|
||||||
public class IBasicCommunicationApi : DeviceApiBase
|
|
||||||
{
|
|
||||||
public IBasicCommunication Device { get; set; }
|
|
||||||
|
|
||||||
SerialFeedback TextReceivedFeedback;
|
|
||||||
|
|
||||||
public IBasicCommunicationApi(IBasicCommunication dev)
|
|
||||||
{
|
|
||||||
TextReceivedFeedback = new SerialFeedback();
|
|
||||||
|
|
||||||
Device = dev;
|
|
||||||
|
|
||||||
SetupFeedbacks();
|
|
||||||
|
|
||||||
ActionApi = new Dictionary<string, Object>
|
|
||||||
{
|
|
||||||
{ "connect", new Action(Device.Connect) },
|
|
||||||
{ "disconnect", new Action(Device.Disconnect) },
|
|
||||||
{ "connectstate", new Action<bool>( b => ConnectByState(b) ) },
|
|
||||||
{ "sendtext", new Action<string>( s => Device.SendText(s) ) }
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
FeedbackApi = new Dictionary<string, Feedback>
|
|
||||||
{
|
|
||||||
{ "isconnected", new BoolFeedback( () => Device.IsConnected ) },
|
|
||||||
{ "textrecieved", TextReceivedFeedback }
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Controls connection based on state of input
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="state"></param>
|
|
||||||
void ConnectByState(bool state)
|
|
||||||
{
|
|
||||||
if (state)
|
|
||||||
Device.Connect();
|
|
||||||
else
|
|
||||||
Device.Disconnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetupFeedbacks()
|
|
||||||
{
|
|
||||||
Device.TextReceived += new EventHandler<GenericCommMethodReceiveTextArgs>(Device_TextReceived);
|
|
||||||
|
|
||||||
if(Device is ISocketStatus)
|
|
||||||
(Device as ISocketStatus).ConnectionChange += new EventHandler<GenericSocketStatusChageEventArgs>(IBasicCommunicationApi_ConnectionChange);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IBasicCommunicationApi_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e)
|
|
||||||
{
|
|
||||||
FeedbackApi["isconnected"].FireUpdate();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Device_TextReceived(object sender, GenericCommMethodReceiveTextArgs e)
|
|
||||||
{
|
|
||||||
TextReceivedFeedback.FireUpdate(e.Text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class DmChassisController : Device
|
|
||||||
{
|
|
||||||
public DmChassisController(string key)
|
|
||||||
: base(key)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetInput(int input)
|
|
||||||
{
|
|
||||||
Debug.Console(2, this, "Dm Chassis {0}, input {1}", Key, input);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Each flavor of API is a static class with static properties and a static constructor that
|
|
||||||
/// links up the things to do.
|
|
||||||
/// </summary>
|
|
||||||
public class DmChassisControllerApi : DeviceApiBase
|
|
||||||
{
|
|
||||||
IntFeedback Output1Feedback;
|
|
||||||
IntFeedback Output2Feedback;
|
|
||||||
|
|
||||||
public DmChassisControllerApi(DmChassisController dev)
|
|
||||||
{
|
|
||||||
Output1Feedback = new IntFeedback( new Func<int>(() => 1));
|
|
||||||
Output2Feedback = new IntFeedback( new Func<int>(() => 2));
|
|
||||||
|
|
||||||
ActionApi = new Dictionary<string, Object>
|
|
||||||
{
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
FeedbackApi = new Dictionary<string, Feedback>
|
|
||||||
{
|
|
||||||
{ "Output-1/fb", Output1Feedback },
|
|
||||||
{ "Output-2/fb", Output2Feedback }
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Factory method
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dev"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static DmChassisControllerApi GetActionApiForDevice(DmChassisController dev)
|
|
||||||
{
|
|
||||||
return new DmChassisControllerApi(dev);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,176 +9,133 @@ using PepperDash.Essentials.Core;
|
|||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core.Routing;
|
using PepperDash.Essentials.Core.Routing;
|
||||||
|
using PepperDash.Essentials.Bridges;
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.EthernetCommunication;
|
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||||
|
|
||||||
namespace PepperDash.Essentials
|
namespace PepperDash.Essentials
|
||||||
|
|
||||||
{
|
{
|
||||||
public class BridgeFactory
|
public class BridgeFactory
|
||||||
{
|
{
|
||||||
public static IKeyed GetDevice(PepperDash.Essentials.Core.Config.DeviceConfig dc)
|
public static IKeyed GetDevice(DeviceConfig dc)
|
||||||
{
|
{
|
||||||
// ? why is this static JTA 2018-06-13?
|
// ? why is this static JTA 2018-06-13?
|
||||||
|
|
||||||
var key = dc.Key;
|
var key = dc.Key;
|
||||||
var name = dc.Name;
|
var name = dc.Name;
|
||||||
var type = dc.Type;
|
var type = dc.Type;
|
||||||
var properties = dc.Properties;
|
var properties = dc.Properties;
|
||||||
var propAnon = new { };
|
var propAnon = new { };
|
||||||
JsonConvert.DeserializeAnonymousType(dc.Properties.ToString(), propAnon);
|
|
||||||
|
|
||||||
var typeName = dc.Type.ToLower();
|
var typeName = dc.Type.ToLower();
|
||||||
var groupName = dc.Group.ToLower();
|
var groupName = dc.Group.ToLower();
|
||||||
|
|
||||||
Debug.Console(0, "Name {0}, Key {1}, Type {2}, Properties {3}", name, key, type, properties.ToString());
|
//Debug.Console(2, "Name {0}, Key {1}, Type {2}, Properties {3}", name, key, type, properties.ToString());
|
||||||
if (typeName == "dm")
|
|
||||||
{
|
if (typeName == "eiscapi")
|
||||||
return new DmBridge(key, name, properties);
|
{
|
||||||
|
return new EiscApi(dc);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class CommBridge : Device
|
||||||
|
{
|
||||||
|
public CommBridgeProperties Properties { get; private set; }
|
||||||
|
|
||||||
|
public List<IBasicCommunication> CommDevices { get; private set; }
|
||||||
|
|
||||||
|
public CommBridge(string key, string name, JToken properties)
|
||||||
|
: base(key, name)
|
||||||
|
{
|
||||||
|
Properties = JsonConvert.DeserializeObject<CommBridgeProperties>(properties.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CustomActivate()
|
||||||
|
{
|
||||||
|
// Create EiscApis
|
||||||
|
if (Properties.Eiscs != null)
|
||||||
|
{
|
||||||
|
foreach (var eisc in Properties.Eiscs)
|
||||||
|
{
|
||||||
|
var ApiEisc = new BridgeApiEisc(eisc.IpId, eisc.Hostname);
|
||||||
}
|
}
|
||||||
else if (typeName == "comm")
|
|
||||||
{
|
|
||||||
return new CommBridge(key, name, properties);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public class DmBridge : Device
|
foreach (var deviceKey in Properties.CommDevices)
|
||||||
{
|
{
|
||||||
public EiscBridgeProperties Properties { get; private set; }
|
var device = DeviceManager.GetDeviceForKey(deviceKey);
|
||||||
|
|
||||||
public PepperDash.Essentials.DM.DmChassisController DmSwitch { get; private set; }
|
if (device != null)
|
||||||
|
{
|
||||||
public DmBridge(string key, string name, JToken properties) : base(key, name)
|
Debug.Console(0, "deviceKey {0} Found in Device Manager", device.Key);
|
||||||
{
|
CommDevices.Add(device as IBasicCommunication);
|
||||||
Properties = JsonConvert.DeserializeObject<EiscBridgeProperties>(properties.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool CustomActivate()
|
|
||||||
{
|
|
||||||
// Create EiscApis
|
|
||||||
if (Properties.Eiscs != null)
|
|
||||||
{
|
|
||||||
foreach (var eisc in Properties.Eiscs)
|
|
||||||
{
|
|
||||||
var ApiEisc = new BridgeApiEisc(eisc.IpId, eisc.Hostname);
|
|
||||||
|
|
||||||
ApiEisc.Eisc.SetUShortSigAction(101, u => DmSwitch.ExecuteSwitch(u,1, eRoutingSignalType.Video));
|
|
||||||
ApiEisc.Eisc.SetUShortSigAction(102, u => DmSwitch.ExecuteSwitch(u,2, eRoutingSignalType.Video));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
foreach (var device in DeviceManager.AllDevices)
|
{
|
||||||
{
|
Debug.Console(0, "deviceKey {0} Not Found in Device Manager", deviceKey);
|
||||||
if (device.Key == this.Properties.ParentDeviceKey)
|
|
||||||
{
|
|
||||||
Debug.Console(0, "deviceKey {0} Matches", device.Key);
|
|
||||||
DmSwitch = DeviceManager.GetDeviceForKey(device.Key) as PepperDash.Essentials.DM.DmChassisController;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.Console(0, "deviceKey {0} doesn't match", device.Key);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Console(0, "Bridge {0} Activated", this.Name);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Iterate through all the CommDevices and link up their Actions and Feedbacks
|
||||||
|
|
||||||
|
Debug.Console(0, "Bridge {0} Activated", this.Name);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public class CommBridge : Device
|
|
||||||
{
|
|
||||||
public CommBridgeProperties Properties { get; private set; }
|
|
||||||
|
|
||||||
public List<IBasicCommunication> CommDevices { get; private set; }
|
|
||||||
|
|
||||||
public CommBridge(string key, string name, JToken properties)
|
|
||||||
: base(key, name)
|
|
||||||
{
|
|
||||||
Properties = JsonConvert.DeserializeObject<CommBridgeProperties>(properties.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool CustomActivate()
|
|
||||||
{
|
|
||||||
// Create EiscApis
|
|
||||||
if (Properties.Eiscs != null)
|
|
||||||
{
|
|
||||||
foreach (var eisc in Properties.Eiscs)
|
|
||||||
{
|
|
||||||
var ApiEisc = new BridgeApiEisc(eisc.IpId, eisc.Hostname);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var deviceKey in Properties.CommDevices)
|
|
||||||
{
|
|
||||||
var device = DeviceManager.GetDeviceForKey(deviceKey);
|
|
||||||
|
|
||||||
if (device != null)
|
|
||||||
{
|
|
||||||
Debug.Console(0, "deviceKey {0} Found in Device Manager", device.Key);
|
|
||||||
CommDevices.Add(device as IBasicCommunication);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.Console(0, "deviceKey {0} Not Found in Device Manager", deviceKey);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Iterate through all the CommDevices and link up their Actions and Feedbacks
|
|
||||||
|
|
||||||
Debug.Console(0, "Bridge {0} Activated", this.Name);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public class EiscBridgeProperties
|
public class EiscBridgeProperties
|
||||||
{
|
{
|
||||||
public string ParentDeviceKey { get; set; }
|
public string ParentDeviceKey { get; set; }
|
||||||
public eApiType ApiType { get; set; }
|
public eApiType ApiType { get; set; }
|
||||||
public List<EiscProperties> Eiscs { get; set; }
|
public List<EiscProperties> Eiscs { get; set; }
|
||||||
public string ApiOverrideFilePath { get; set; }
|
public string ApiOverrideFilePath { get; set; }
|
||||||
|
|
||||||
public class EiscProperties
|
public class EiscProperties
|
||||||
{
|
{
|
||||||
public string IpId { get; set; }
|
public string IpId { get; set; }
|
||||||
public string Hostname { get; set; }
|
public string Hostname { get; set; }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class CommBridgeProperties : EiscBridgeProperties
|
public class CommBridgeProperties : EiscBridgeProperties
|
||||||
{
|
{
|
||||||
public List<string> CommDevices { get; set; }
|
public List<string> CommDevices { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum eApiType { Eisc = 0 }
|
public enum eApiType { Eisc = 0 }
|
||||||
|
|
||||||
public class BridgeApiEisc
|
public class BridgeApiEisc
|
||||||
{
|
{
|
||||||
public uint Ipid { get; private set; }
|
public uint Ipid { get; private set; }
|
||||||
public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; }
|
public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; }
|
||||||
|
|
||||||
public BridgeApiEisc(string ipid, string hostname)
|
public BridgeApiEisc(string ipid, string hostname)
|
||||||
{
|
{
|
||||||
Ipid = (UInt32)int.Parse(ipid, System.Globalization.NumberStyles.HexNumber);
|
Ipid = (UInt32)int.Parse(ipid, System.Globalization.NumberStyles.HexNumber);
|
||||||
Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(Ipid, hostname, Global.ControlSystem);
|
Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(Ipid, hostname, Global.ControlSystem);
|
||||||
Eisc.Register();
|
Eisc.Register();
|
||||||
Eisc.SigChange += Eisc_SigChange;
|
Eisc.SigChange += Eisc_SigChange;
|
||||||
Debug.Console(0, "BridgeApiEisc Created at Ipid {0}", ipid);
|
Debug.Console(0, "BridgeApiEisc Created at Ipid {0}", ipid);
|
||||||
}
|
|
||||||
void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
|
|
||||||
{
|
|
||||||
if (Debug.Level >= 1)
|
|
||||||
Debug.Console(1, "BridgeApiEisc change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
|
||||||
var uo = args.Sig.UserObject;
|
|
||||||
if (uo is Action<bool>)
|
|
||||||
(uo as Action<bool>)(args.Sig.BoolValue);
|
|
||||||
else if (uo is Action<ushort>)
|
|
||||||
(uo as Action<ushort>)(args.Sig.UShortValue);
|
|
||||||
else if (uo is Action<string>)
|
|
||||||
(uo as Action<string>)(args.Sig.StringValue);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
|
||||||
|
{
|
||||||
|
if (Debug.Level >= 1)
|
||||||
|
Debug.Console(1, "BridgeApiEisc change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
||||||
|
var uo = args.Sig.UserObject;
|
||||||
|
if (uo is Action<bool>)
|
||||||
|
(uo as Action<bool>)(args.Sig.BoolValue);
|
||||||
|
else if (uo is Action<ushort>)
|
||||||
|
(uo as Action<ushort>)(args.Sig.UShortValue);
|
||||||
|
else if (uo is Action<string>)
|
||||||
|
(uo as Action<string>)(args.Sig.StringValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
90
PepperDashEssentials/Bridges/Bridges.BridgeFactory.cs
Normal file
90
PepperDashEssentials/Bridges/Bridges.BridgeFactory.cs
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Routing;
|
||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||||
|
using PepperDash.Essentials.Bridges;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials {
|
||||||
|
public class BridgeFactory {
|
||||||
|
public static IKeyed GetDevice(PepperDash.Essentials.Core.Config.DeviceConfig dc) {
|
||||||
|
// ? why is this static JTA 2018-06-13?
|
||||||
|
|
||||||
|
var key = dc.Key;
|
||||||
|
var name = dc.Name;
|
||||||
|
var type = dc.Type;
|
||||||
|
var properties = dc.Properties;
|
||||||
|
var propAnon = new { };
|
||||||
|
JsonConvert.DeserializeAnonymousType(dc.Properties.ToString(), propAnon);
|
||||||
|
|
||||||
|
var typeName = dc.Type.ToLower();
|
||||||
|
var groupName = dc.Group.ToLower();
|
||||||
|
|
||||||
|
Debug.Console(2, "Name {0}, Key {1}, Type {2}, Properties {3}", name, key, type, properties.ToString());
|
||||||
|
if (typeName == "essentialdm")
|
||||||
|
{
|
||||||
|
return new EssentialDM(key, name, properties);
|
||||||
|
}
|
||||||
|
else if (typeName == "essentialcomm")
|
||||||
|
{
|
||||||
|
Debug.Console(2, "Launch Essential Comm");
|
||||||
|
return new EssentialComm(key, name, properties);
|
||||||
|
}
|
||||||
|
else if (typeName == "essentialdsp")
|
||||||
|
{
|
||||||
|
Debug.Console(2, "Launch EssentialDsp");
|
||||||
|
return new EssentialDsp(key, name, properties);
|
||||||
|
}
|
||||||
|
else if (typeName == "essentialstvone")
|
||||||
|
{
|
||||||
|
Debug.Console(2, "Launch essentialstvone");
|
||||||
|
return new EssentialsTVOne(key, name, properties);
|
||||||
|
}
|
||||||
|
else if (typeName == "essentialslighting")
|
||||||
|
{
|
||||||
|
Debug.Console(2, "Launch essentialslighting");
|
||||||
|
return new EssentialsLightsBridge(key, name, properties);
|
||||||
|
}
|
||||||
|
else if (typeName == "eiscapi")
|
||||||
|
{
|
||||||
|
return new EiscApi(dc);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class BridgeApiEisc {
|
||||||
|
public uint Ipid;
|
||||||
|
public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc;
|
||||||
|
public BridgeApiEisc(string ipid) {
|
||||||
|
Ipid = (UInt32)int.Parse(ipid, System.Globalization.NumberStyles.HexNumber);
|
||||||
|
Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(Ipid, "127.0.0.2", Global.ControlSystem);
|
||||||
|
Eisc.Register();
|
||||||
|
Eisc.SigChange += Eisc_SigChange;
|
||||||
|
Debug.Console(2, "BridgeApiEisc Created at Ipid {0}", ipid);
|
||||||
|
}
|
||||||
|
void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args) {
|
||||||
|
if (Debug.Level >= 1)
|
||||||
|
Debug.Console(2, "DDVC EISC change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
||||||
|
var uo = args.Sig.UserObject;
|
||||||
|
if (uo is Action<bool>)
|
||||||
|
(uo as Action<bool>)(args.Sig.BoolValue);
|
||||||
|
else if (uo is Action<ushort>)
|
||||||
|
(uo as Action<ushort>)(args.Sig.UShortValue);
|
||||||
|
else if (uo is Action<string>)
|
||||||
|
(uo as Action<string>)(args.Sig.StringValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
187
PepperDashEssentials/Bridges/CameraControllerBridge.cs
Normal file
187
PepperDashEssentials/Bridges/CameraControllerBridge.cs
Normal file
@@ -0,0 +1,187 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Devices.Common;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class CameraControllerApiExtensions
|
||||||
|
{
|
||||||
|
|
||||||
|
public static BasicTriList _TriList;
|
||||||
|
public static CameraControllerJoinMap JoinMap;
|
||||||
|
public static void LinkToApi(this PepperDash.Essentials.Devices.Common.Cameras.CameraBase cameraDevice, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
JoinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as CameraControllerJoinMap;
|
||||||
|
|
||||||
|
_TriList = trilist;
|
||||||
|
if (JoinMap == null)
|
||||||
|
{
|
||||||
|
JoinMap = new CameraControllerJoinMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
JoinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
Debug.Console(0, "Linking to Bridge Type {0}", cameraDevice.GetType().Name.ToString());
|
||||||
|
|
||||||
|
var commMonitor = cameraDevice as ICommunicationMonitor;
|
||||||
|
commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.IsOnline]);
|
||||||
|
|
||||||
|
|
||||||
|
trilist.SetBoolSigAction(JoinMap.Left, (b) =>
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
cameraDevice.PanLeft();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cameraDevice.Stop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
trilist.SetBoolSigAction(JoinMap.Right, (b) =>
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
cameraDevice.PanRight();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cameraDevice.Stop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
trilist.SetBoolSigAction(JoinMap.Up, (b) =>
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
cameraDevice.TiltUp();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cameraDevice.Stop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
trilist.SetBoolSigAction(JoinMap.Down, (b) =>
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
cameraDevice.TiltDown();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cameraDevice.Stop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
trilist.SetBoolSigAction(JoinMap.ZoomIn, (b) =>
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
cameraDevice.ZoomIn();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cameraDevice.Stop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
trilist.SetBoolSigAction(JoinMap.ZoomOut, (b) =>
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
cameraDevice.ZoomOut();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cameraDevice.Stop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
if (cameraDevice.GetType().Name.ToString().ToLower() == "cameravisca")
|
||||||
|
{
|
||||||
|
var viscaCamera = cameraDevice as PepperDash.Essentials.Devices.Common.Cameras.CameraVisca;
|
||||||
|
trilist.SetSigTrueAction(JoinMap.PowerOn, () => viscaCamera.PowerOn());
|
||||||
|
trilist.SetSigTrueAction(JoinMap.PowerOff, () => viscaCamera.PowerOff());
|
||||||
|
|
||||||
|
viscaCamera.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.PowerOn]);
|
||||||
|
viscaCamera.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[JoinMap.PowerOff]);
|
||||||
|
|
||||||
|
viscaCamera.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.IsOnline]);
|
||||||
|
for (int i = 0; i < JoinMap.NumberOfPresets; i++)
|
||||||
|
{
|
||||||
|
int tempNum = i;
|
||||||
|
trilist.SetSigTrueAction((ushort)(JoinMap.PresetRecallOffset + tempNum), () =>
|
||||||
|
{
|
||||||
|
viscaCamera.RecallPreset(tempNum);
|
||||||
|
});
|
||||||
|
trilist.SetSigTrueAction((ushort)(JoinMap.PresetSaveOffset + tempNum), () =>
|
||||||
|
{
|
||||||
|
viscaCamera.SavePreset(tempNum);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
public class CameraControllerJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
public uint IsOnline { get; set; }
|
||||||
|
public uint PowerOff { get; set; }
|
||||||
|
public uint PowerOn { get; set; }
|
||||||
|
public uint Up { get; set; }
|
||||||
|
public uint Down { get; set; }
|
||||||
|
public uint Left { get; set; }
|
||||||
|
public uint Right { get; set; }
|
||||||
|
public uint ZoomIn { get; set; }
|
||||||
|
public uint ZoomOut { get; set; }
|
||||||
|
public uint PresetRecallOffset { get; set; }
|
||||||
|
public uint PresetSaveOffset { get; set; }
|
||||||
|
public uint NumberOfPresets { get; set; }
|
||||||
|
|
||||||
|
public CameraControllerJoinMap()
|
||||||
|
{
|
||||||
|
// Digital
|
||||||
|
IsOnline = 9;
|
||||||
|
PowerOff = 8;
|
||||||
|
PowerOn = 7;
|
||||||
|
Up = 1;
|
||||||
|
Down = 2;
|
||||||
|
Left = 3;
|
||||||
|
Right = 4;
|
||||||
|
ZoomIn = 5;
|
||||||
|
ZoomOut = 6;
|
||||||
|
PresetRecallOffset = 10;
|
||||||
|
PresetSaveOffset = 30;
|
||||||
|
NumberOfPresets = 5;
|
||||||
|
// Analog
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
IsOnline = IsOnline + joinOffset;
|
||||||
|
PowerOff = PowerOff + joinOffset;
|
||||||
|
PowerOn = PowerOn + joinOffset;
|
||||||
|
Up = Up + joinOffset;
|
||||||
|
Down = Down + joinOffset;
|
||||||
|
Left = Left + joinOffset;
|
||||||
|
Right = Right + joinOffset;
|
||||||
|
ZoomIn = ZoomIn + joinOffset;
|
||||||
|
ZoomOut = ZoomOut + joinOffset;
|
||||||
|
PresetRecallOffset = PresetRecallOffset + joinOffset;
|
||||||
|
PresetSaveOffset = PresetSaveOffset + joinOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
77
PepperDashEssentials/Bridges/DigitalLoggerBridge.cs
Normal file
77
PepperDashEssentials/Bridges/DigitalLoggerBridge.cs
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Devices.Common;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class DigitalLoggerApiExtensions
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this DigitalLogger DigitalLogger, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DigitalLoggerJoinMap;
|
||||||
|
|
||||||
|
if (joinMap == null)
|
||||||
|
joinMap = new DigitalLoggerJoinMap();
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
Debug.Console(1, DigitalLogger, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
for (uint i = 1; i <= DigitalLogger.CircuitCount; i++)
|
||||||
|
{
|
||||||
|
var circuit = i;
|
||||||
|
DigitalLogger.CircuitNameFeedbacks[circuit - 1].LinkInputSig(trilist.StringInput[joinMap.CircuitNames + circuit]);
|
||||||
|
DigitalLogger.CircuitIsCritical[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitIsCritical + circuit]);
|
||||||
|
DigitalLogger.CircuitState[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitState + circuit]);
|
||||||
|
trilist.SetSigTrueAction(joinMap.CircuitCycle + circuit, () => DigitalLogger.CycleCircuit(circuit - 1));
|
||||||
|
trilist.SetSigTrueAction(joinMap.CircuitOnCmd + circuit, () => DigitalLogger.TurnOnCircuit(circuit - 1));
|
||||||
|
trilist.SetSigTrueAction(joinMap.CircuitOffCmd + circuit, () => DigitalLogger.TurnOffCircuit(circuit - 1));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class DigitalLoggerJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
public uint IsOnline { get; set; }
|
||||||
|
public uint CircuitNames { get; set; }
|
||||||
|
public uint CircuitState { get; set; }
|
||||||
|
public uint CircuitCycle { get; set; }
|
||||||
|
public uint CircuitIsCritical { get; set; }
|
||||||
|
public uint CircuitOnCmd { get; set; }
|
||||||
|
public uint CircuitOffCmd { get; set; }
|
||||||
|
public DigitalLoggerJoinMap()
|
||||||
|
{
|
||||||
|
// Digital
|
||||||
|
IsOnline = 9;
|
||||||
|
CircuitState = 0;
|
||||||
|
CircuitCycle = 0;
|
||||||
|
CircuitIsCritical = 10;
|
||||||
|
CircuitOnCmd = 10;
|
||||||
|
CircuitOffCmd = 20;
|
||||||
|
// Serial
|
||||||
|
CircuitNames = 0;
|
||||||
|
// Analog
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
IsOnline = IsOnline + joinOffset;
|
||||||
|
CircuitNames = CircuitNames + joinOffset;
|
||||||
|
CircuitState = CircuitState + joinOffset;
|
||||||
|
CircuitCycle = CircuitCycle + joinOffset;
|
||||||
|
CircuitIsCritical = CircuitIsCritical + joinOffset;
|
||||||
|
CircuitOnCmd = CircuitOnCmd + joinOffset;
|
||||||
|
CircuitOffCmd = CircuitOffCmd + joinOffset;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
171
PepperDashEssentials/Bridges/DisplayControllerBridge.cs
Normal file
171
PepperDashEssentials/Bridges/DisplayControllerBridge.cs
Normal file
@@ -0,0 +1,171 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Devices.Common;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class DisplayControllerApiExtensions
|
||||||
|
{
|
||||||
|
|
||||||
|
public static BasicTriList _TriList;
|
||||||
|
public static DisplayControllerJoinMap JoinMap;
|
||||||
|
public static int InputNumber;
|
||||||
|
public static IntFeedback InputNumberFeedback;
|
||||||
|
public static List<string> InputKeys = new List<string>();
|
||||||
|
public static void LinkToApi(this PepperDash.Essentials.Core.TwoWayDisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
JoinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DisplayControllerJoinMap;
|
||||||
|
_TriList = trilist;
|
||||||
|
|
||||||
|
if (JoinMap == null)
|
||||||
|
{
|
||||||
|
JoinMap = new DisplayControllerJoinMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
JoinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
Debug.Console(0, "Linking to Bridge Type {0}", displayDevice.GetType().Name.ToString());
|
||||||
|
|
||||||
|
trilist.StringInput[JoinMap.Name].StringValue = displayDevice.GetType().Name.ToString();
|
||||||
|
|
||||||
|
InputNumberFeedback = new IntFeedback(() => { return InputNumber;});
|
||||||
|
InputNumberFeedback.LinkInputSig(trilist.UShortInput[JoinMap.InputSelect]);
|
||||||
|
var commMonitor = displayDevice as ICommunicationMonitor;
|
||||||
|
commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.IsOnline]);
|
||||||
|
|
||||||
|
// Poewer Off
|
||||||
|
trilist.SetSigTrueAction(JoinMap.PowerOff, () =>
|
||||||
|
{
|
||||||
|
InputNumber = 102;
|
||||||
|
InputNumberFeedback.FireUpdate();
|
||||||
|
displayDevice.PowerOff();
|
||||||
|
});
|
||||||
|
|
||||||
|
displayDevice.PowerIsOnFeedback.OutputChange += new EventHandler<FeedbackEventArgs>(PowerIsOnFeedback_OutputChange);
|
||||||
|
displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[JoinMap.PowerOff]);
|
||||||
|
|
||||||
|
// Poewer On
|
||||||
|
trilist.SetSigTrueAction(JoinMap.PowerOn, () =>
|
||||||
|
{
|
||||||
|
InputNumber = 0;
|
||||||
|
InputNumberFeedback.FireUpdate();
|
||||||
|
displayDevice.PowerOn();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.PowerOn]);
|
||||||
|
|
||||||
|
int count = 1;
|
||||||
|
foreach (var input in displayDevice.InputPorts)
|
||||||
|
{
|
||||||
|
InputKeys.Add(input.Key.ToString());
|
||||||
|
var tempKey = InputKeys.ElementAt(count - 1);
|
||||||
|
trilist.SetSigTrueAction((ushort)(JoinMap.InputSelectOffset + count), () => { displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector); });
|
||||||
|
trilist.StringInput[(ushort)(JoinMap.InputNamesOffset + count)].StringValue = input.Key.ToString();
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
displayDevice.CurrentInputFeedback.OutputChange += new EventHandler<FeedbackEventArgs>(CurrentInputFeedback_OutputChange);
|
||||||
|
trilist.SetUShortSigAction(JoinMap.InputSelect, (a) =>
|
||||||
|
{
|
||||||
|
if (a == 0)
|
||||||
|
{
|
||||||
|
displayDevice.PowerOff();
|
||||||
|
InputNumber = 0;
|
||||||
|
}
|
||||||
|
else if (a > 0 && a < displayDevice.InputPorts.Count && a != InputNumber)
|
||||||
|
{
|
||||||
|
displayDevice.ExecuteSwitch(displayDevice.InputPorts.ElementAt(a - 1).Selector);
|
||||||
|
InputNumber = a;
|
||||||
|
}
|
||||||
|
else if (a == 102)
|
||||||
|
{
|
||||||
|
displayDevice.PowerToggle();
|
||||||
|
|
||||||
|
}
|
||||||
|
InputNumberFeedback.FireUpdate();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void CurrentInputFeedback_OutputChange(object sender, FeedbackEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
Debug.Console(0, "CurrentInputFeedback_OutputChange {0}", e.StringValue);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void PowerIsOnFeedback_OutputChange(object sender, FeedbackEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Debug.Console(0, "PowerIsOnFeedback_OutputChange {0}", e.BoolValue);
|
||||||
|
if (!e.BoolValue)
|
||||||
|
{
|
||||||
|
InputNumber = 102;
|
||||||
|
InputNumberFeedback.FireUpdate();
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
InputNumber = 0;
|
||||||
|
InputNumberFeedback.FireUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
public class DisplayControllerJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
public uint Name { get; set; }
|
||||||
|
public uint InputNamesOffset { get; set; }
|
||||||
|
public uint InputSelectOffset { get; set; }
|
||||||
|
public uint IsOnline { get; set; }
|
||||||
|
public uint PowerOff { get; set; }
|
||||||
|
public uint InputSelect { get; set; }
|
||||||
|
public uint PowerOn { get; set; }
|
||||||
|
public uint SelectScene { get; set; }
|
||||||
|
public uint LightingSceneOffset { get; set; }
|
||||||
|
public uint ButtonVisibilityOffset { get; set; }
|
||||||
|
public uint IntegrationIdSet { get; set; }
|
||||||
|
|
||||||
|
public DisplayControllerJoinMap()
|
||||||
|
{
|
||||||
|
// Digital
|
||||||
|
IsOnline = 50;
|
||||||
|
PowerOff = 1;
|
||||||
|
PowerOn = 2;
|
||||||
|
InputSelect = 4;
|
||||||
|
IntegrationIdSet = 1;
|
||||||
|
LightingSceneOffset = 10;
|
||||||
|
ButtonVisibilityOffset = 40;
|
||||||
|
Name = 1;
|
||||||
|
InputNamesOffset = 10;
|
||||||
|
InputSelectOffset = 4;
|
||||||
|
// Analog
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
IsOnline = IsOnline + joinOffset;
|
||||||
|
PowerOff = PowerOff + joinOffset;
|
||||||
|
PowerOn = PowerOn + joinOffset;
|
||||||
|
SelectScene = SelectScene + joinOffset;
|
||||||
|
LightingSceneOffset = LightingSceneOffset + joinOffset;
|
||||||
|
ButtonVisibilityOffset = ButtonVisibilityOffset + joinOffset;
|
||||||
|
Name = Name + joinOffset;
|
||||||
|
InputNamesOffset = InputNamesOffset + joinOffset;
|
||||||
|
InputSelectOffset = InputSelectOffset + joinOffset;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
130
PepperDashEssentials/Bridges/DmChassisControllerBridge.cs
Normal file
130
PepperDashEssentials/Bridges/DmChassisControllerBridge.cs
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.DM;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class DmChassisControllerApiExtentions
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this DmChassisController dmChassis, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DmChassisControllerJoinMap;
|
||||||
|
|
||||||
|
if (joinMap == null)
|
||||||
|
joinMap = new DmChassisControllerJoinMap();
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
|
||||||
|
Debug.Console(1, dmChassis, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
|
||||||
|
dmChassis.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||||
|
|
||||||
|
// Link up outputs
|
||||||
|
for (uint i = 1; i <= dmChassis.Chassis.NumberOfOutputs - 1; i++)
|
||||||
|
{
|
||||||
|
var ioSlot = i;
|
||||||
|
|
||||||
|
// Control
|
||||||
|
trilist.SetUShortSigAction(joinMap.OutputVideo + ioSlot, new Action<ushort>(o => dmChassis.ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video)));
|
||||||
|
trilist.SetUShortSigAction(joinMap.OutputAudio + ioSlot, new Action<ushort>(o => dmChassis.ExecuteSwitch(o, ioSlot, eRoutingSignalType.Audio)));
|
||||||
|
if (dmChassis.TxDictionary.ContainsKey(ioSlot))
|
||||||
|
{
|
||||||
|
Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot);
|
||||||
|
var TxKey = dmChassis.TxDictionary[ioSlot];
|
||||||
|
var TxDevice = DeviceManager.GetDeviceForKey(TxKey) as DmTxControllerBase;
|
||||||
|
TxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
|
||||||
|
// TxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
|
||||||
|
// trilist.SetUShortSigAction((ApiMap.HdcpSupport[ioSlot]), u => TxDevice.SetHdcpSupportAll((ePdtHdcpSupport)(u)));
|
||||||
|
// TxDevice.HdcpSupportAllFeedback.LinkInputSig(trilist.UShortInput[joinMap. + ioSlot]);
|
||||||
|
// trilist.UShortInput[ApiMap.HdcpSupportCapability[ioSlot]].UShortValue = TxDevice.HdcpSupportCapability;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[ApiMap.TxVideoSyncStatus[ioSlot]]);
|
||||||
|
}
|
||||||
|
if (dmChassis.RxDictionary.ContainsKey(ioSlot))
|
||||||
|
{
|
||||||
|
Debug.Console(2, "Creating Rx Feedbacks {0}", ioSlot);
|
||||||
|
var RxKey = dmChassis.RxDictionary[ioSlot];
|
||||||
|
var RxDevice = DeviceManager.GetDeviceForKey(RxKey) as DmRmcControllerBase;
|
||||||
|
RxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
|
||||||
|
}
|
||||||
|
// Feedback
|
||||||
|
dmChassis.VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo + ioSlot]);
|
||||||
|
dmChassis.AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio + ioSlot]);
|
||||||
|
|
||||||
|
dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]);
|
||||||
|
|
||||||
|
dmChassis.OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames + ioSlot]);
|
||||||
|
dmChassis.InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]);
|
||||||
|
dmChassis.OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames + ioSlot]);
|
||||||
|
dmChassis.OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames + ioSlot]);
|
||||||
|
// dmChassis.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
|
||||||
|
// dmChassis.OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class DmChassisControllerJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
public uint IsOnline { get; set; }
|
||||||
|
public uint OutputVideo { get; set; }
|
||||||
|
public uint OutputAudio { get; set; }
|
||||||
|
public uint VideoSyncStatus { get; set; }
|
||||||
|
public uint InputNames { get; set; }
|
||||||
|
public uint OutputNames { get; set; }
|
||||||
|
public uint OutputCurrentVideoInputNames { get; set; }
|
||||||
|
public uint OutputCurrentAudioInputNames { get; set; }
|
||||||
|
public uint InputCurrentResolution { get; set; }
|
||||||
|
public uint InputEndpointOnline { get; set; }
|
||||||
|
public uint OutputEndpointOnline { get; set; }
|
||||||
|
//public uint HdcpSupport { get; set; }
|
||||||
|
//public uint HdcpSupportCapability { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public DmChassisControllerJoinMap()
|
||||||
|
{
|
||||||
|
IsOnline = 11;
|
||||||
|
OutputVideo = 100; //101-299
|
||||||
|
OutputAudio = 300; //301-499
|
||||||
|
VideoSyncStatus = 100; //101-299
|
||||||
|
InputNames = 100; //101-299
|
||||||
|
OutputNames = 300; //301-499
|
||||||
|
OutputCurrentVideoInputNames = 2000; //2001-2199
|
||||||
|
OutputCurrentAudioInputNames = 2200; //2201-2399
|
||||||
|
InputCurrentResolution = 2400; // 2401-2599
|
||||||
|
InputEndpointOnline = 500;
|
||||||
|
OutputEndpointOnline = 700;
|
||||||
|
//HdcpSupport = 1000; //1001-1199
|
||||||
|
//HdcpSupportCapability = 1200; //1201-1399
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
IsOnline = IsOnline + joinOffset;
|
||||||
|
OutputVideo = OutputVideo + joinOffset;
|
||||||
|
OutputAudio = OutputAudio + joinOffset;
|
||||||
|
VideoSyncStatus = VideoSyncStatus + joinOffset;
|
||||||
|
InputNames = InputNames + joinOffset;
|
||||||
|
OutputNames = OutputNames + joinOffset;
|
||||||
|
OutputCurrentVideoInputNames = OutputCurrentVideoInputNames + joinOffset;
|
||||||
|
OutputCurrentAudioInputNames = OutputCurrentAudioInputNames + joinOffset;
|
||||||
|
InputCurrentResolution = InputCurrentResolution + joinOffset;
|
||||||
|
InputEndpointOnline = InputEndpointOnline + joinOffset;
|
||||||
|
OutputEndpointOnline = OutputEndpointOnline + joinOffset;
|
||||||
|
//HdcpSupport = HdcpSupport + joinOffset;
|
||||||
|
//HdcpSupportCapability = HdcpSupportCapability + joinOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
75
PepperDashEssentials/Bridges/DmRmcControllerBridge.cs
Normal file
75
PepperDashEssentials/Bridges/DmRmcControllerBridge.cs
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.DM;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class DmRmcControllerApiExtensions
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this DmRmcControllerBase rmc, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DmRmcControllerJoinMap;
|
||||||
|
|
||||||
|
if (joinMap == null)
|
||||||
|
joinMap = new DmRmcControllerJoinMap();
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
|
||||||
|
Debug.Console(1, rmc, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
|
||||||
|
rmc.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||||
|
if(rmc.VideoOutputResolutionFeedback != null)
|
||||||
|
rmc.VideoOutputResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentOutputResolution]);
|
||||||
|
if(rmc.EdidManufacturerFeedback != null)
|
||||||
|
rmc.EdidManufacturerFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidManufacturer]);
|
||||||
|
if(rmc.EdidNameFeedback != null)
|
||||||
|
rmc.EdidNameFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidName]);
|
||||||
|
if(rmc.EdidPreferredTimingFeedback != null)
|
||||||
|
rmc.EdidPreferredTimingFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidPrefferedTiming]);
|
||||||
|
if(rmc.EdidSerialNumberFeedback != null)
|
||||||
|
rmc.EdidSerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidSerialNumber]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DmRmcControllerJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
public uint IsOnline { get; set; }
|
||||||
|
public uint CurrentOutputResolution { get; set; }
|
||||||
|
public uint EdidManufacturer { get; set; }
|
||||||
|
public uint EdidName { get; set; }
|
||||||
|
public uint EdidPrefferedTiming { get; set; }
|
||||||
|
public uint EdidSerialNumber { get; set; }
|
||||||
|
|
||||||
|
public DmRmcControllerJoinMap()
|
||||||
|
{
|
||||||
|
// Digital
|
||||||
|
IsOnline = 1;
|
||||||
|
|
||||||
|
// Serial
|
||||||
|
CurrentOutputResolution = 1;
|
||||||
|
EdidManufacturer = 2;
|
||||||
|
EdidName = 3;
|
||||||
|
EdidPrefferedTiming = 4;
|
||||||
|
EdidSerialNumber = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
IsOnline = IsOnline + joinOffset;
|
||||||
|
CurrentOutputResolution = CurrentOutputResolution + joinOffset;
|
||||||
|
EdidManufacturer = EdidManufacturer + joinOffset;
|
||||||
|
EdidName = EdidName + joinOffset;
|
||||||
|
EdidPrefferedTiming = EdidPrefferedTiming + joinOffset;
|
||||||
|
EdidSerialNumber = EdidSerialNumber + joinOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
173
PepperDashEssentials/Bridges/DmTxControllerBridge.cs
Normal file
173
PepperDashEssentials/Bridges/DmTxControllerBridge.cs
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DM;
|
||||||
|
using Crestron.SimplSharpPro.DM.Endpoints;
|
||||||
|
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.DM;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class DmTxControllerApiExtensions
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this DmTxControllerBase tx, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DmTxControllerJoinMap;
|
||||||
|
|
||||||
|
if (joinMap == null)
|
||||||
|
joinMap = new DmTxControllerJoinMap();
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
|
||||||
|
Debug.Console(1, tx, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
|
||||||
|
tx.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||||
|
tx.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus]);
|
||||||
|
tx.AnyVideoInput.VideoStatus.VideoResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentInputResolution]);
|
||||||
|
//tx.HdcpSupportAllFeedback.LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportCapability]);
|
||||||
|
|
||||||
|
bool hdcpTypeSimple;
|
||||||
|
|
||||||
|
if (tx.Hardware is DmTx4kX02CBase || tx.Hardware is DmTx4kzX02CBase)
|
||||||
|
hdcpTypeSimple = false;
|
||||||
|
else
|
||||||
|
hdcpTypeSimple = true;
|
||||||
|
|
||||||
|
if (tx is ITxRouting)
|
||||||
|
{
|
||||||
|
var txR = tx as ITxRouting;
|
||||||
|
|
||||||
|
trilist.SetUShortSigAction(joinMap.VideoInput,
|
||||||
|
new Action<ushort>(i => txR.ExecuteNumericSwitch(i, 0, eRoutingSignalType.Video)));
|
||||||
|
trilist.SetUShortSigAction(joinMap.AudioInput,
|
||||||
|
new Action<ushort>(i => txR.ExecuteNumericSwitch(i, 0, eRoutingSignalType.Audio)));
|
||||||
|
|
||||||
|
txR.VideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoInput]);
|
||||||
|
txR.AudioSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioInput]);
|
||||||
|
|
||||||
|
trilist.UShortInput[joinMap.HdcpSupportCapability].UShortValue = (ushort)tx.HdcpSupportCapability;
|
||||||
|
|
||||||
|
if(txR.InputPorts[DmPortName.HdmiIn] != null)
|
||||||
|
{
|
||||||
|
var inputPort = txR.InputPorts[DmPortName.HdmiIn];
|
||||||
|
|
||||||
|
if (tx.Feedbacks["HdmiInHdcpCapability"] != null)
|
||||||
|
(tx.Feedbacks["HdmiInHdcpCapability"] as IntFeedback).LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState]);
|
||||||
|
|
||||||
|
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null)
|
||||||
|
{
|
||||||
|
var port = inputPort.Port as EndpointHdmiInput;
|
||||||
|
|
||||||
|
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState, trilist);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (txR.InputPorts[DmPortName.HdmiIn1] != null)
|
||||||
|
{
|
||||||
|
var inputPort = txR.InputPorts[DmPortName.HdmiIn1];
|
||||||
|
|
||||||
|
if (tx.Feedbacks["HdmiIn1HdcpCapability"] != null)
|
||||||
|
(tx.Feedbacks["HdmiIn1HdcpCapability"] as IntFeedback).LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState]);
|
||||||
|
|
||||||
|
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null)
|
||||||
|
{
|
||||||
|
var port = inputPort.Port as EndpointHdmiInput;
|
||||||
|
|
||||||
|
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState, trilist);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (txR.InputPorts[DmPortName.HdmiIn2] != null)
|
||||||
|
{
|
||||||
|
var inputPort = txR.InputPorts[DmPortName.HdmiIn2];
|
||||||
|
|
||||||
|
if (tx.Feedbacks["HdmiIn2HdcpCapability"] != null)
|
||||||
|
(tx.Feedbacks["HdmiIn2HdcpCapability"] as IntFeedback).LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState]);
|
||||||
|
|
||||||
|
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null)
|
||||||
|
{
|
||||||
|
var port = inputPort.Port as EndpointHdmiInput;
|
||||||
|
|
||||||
|
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port2HdcpState, trilist);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void SetHdcpCapabilityAction(bool hdcpTypeSimple, EndpointHdmiInput port, uint join, BasicTriList trilist)
|
||||||
|
{
|
||||||
|
if (hdcpTypeSimple)
|
||||||
|
{
|
||||||
|
trilist.SetUShortSigAction(join,
|
||||||
|
new Action<ushort>(s =>
|
||||||
|
{
|
||||||
|
if (s == 0)
|
||||||
|
{
|
||||||
|
port.HdcpSupportOff();
|
||||||
|
}
|
||||||
|
else if (s > 0)
|
||||||
|
{
|
||||||
|
port.HdcpSupportOn();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
trilist.SetUShortSigAction(join,
|
||||||
|
new Action<ushort>(s =>
|
||||||
|
{
|
||||||
|
port.HdcpCapability = (eHdcpCapabilityType)s;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DmTxControllerJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
public uint IsOnline { get; set; }
|
||||||
|
public uint VideoSyncStatus { get; set; }
|
||||||
|
public uint CurrentInputResolution { get; set; }
|
||||||
|
public uint HdcpSupportCapability { get; set; }
|
||||||
|
public uint VideoInput { get; set; }
|
||||||
|
public uint AudioInput { get; set; }
|
||||||
|
public uint Port1HdcpState { get; set; }
|
||||||
|
public uint Port2HdcpState { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public DmTxControllerJoinMap()
|
||||||
|
{
|
||||||
|
// Digital
|
||||||
|
IsOnline = 1;
|
||||||
|
VideoSyncStatus = 2;
|
||||||
|
// Serial
|
||||||
|
CurrentInputResolution = 1;
|
||||||
|
// Analog
|
||||||
|
VideoInput = 1;
|
||||||
|
AudioInput = 2;
|
||||||
|
HdcpSupportCapability = 3;
|
||||||
|
Port1HdcpState = 4;
|
||||||
|
Port2HdcpState = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
IsOnline = IsOnline + joinOffset;
|
||||||
|
VideoSyncStatus = VideoSyncStatus + joinOffset;
|
||||||
|
CurrentInputResolution = CurrentInputResolution + joinOffset;
|
||||||
|
VideoInput = VideoInput + joinOffset;
|
||||||
|
AudioInput = AudioInput + joinOffset;
|
||||||
|
HdcpSupportCapability = HdcpSupportCapability + joinOffset;
|
||||||
|
Port1HdcpState = Port1HdcpState + joinOffset;
|
||||||
|
Port2HdcpState = Port2HdcpState + joinOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
120
PepperDashEssentials/Bridges/DspControllerBridge.cs
Normal file
120
PepperDashEssentials/Bridges/DspControllerBridge.cs
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Devices.Common;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class SamsungDisplayControllerApiExtensions
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this PepperDash.Essentials.Core.TwoWayDisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DisplayControllerJoinMap;
|
||||||
|
|
||||||
|
if (joinMap == null)
|
||||||
|
{
|
||||||
|
joinMap = new DisplayControllerJoinMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
Debug.Console(0, "Linking to lighting Type {0}", displayDevice.GetType().Name.ToString());
|
||||||
|
|
||||||
|
var commMonitor = displayDevice as ICommunicationMonitor;
|
||||||
|
commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||||
|
|
||||||
|
|
||||||
|
// Poewer Off
|
||||||
|
trilist.SetSigTrueAction(joinMap.PowerOff, () => displayDevice.PowerOff());
|
||||||
|
displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff]);
|
||||||
|
|
||||||
|
// Poewer On
|
||||||
|
trilist.SetSigTrueAction(joinMap.PowerOn, () => displayDevice.PowerOn());
|
||||||
|
displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn]);
|
||||||
|
|
||||||
|
// GenericLighitng Actions & FeedBack
|
||||||
|
|
||||||
|
// int sceneIndex = 1;
|
||||||
|
/*
|
||||||
|
foreach (var scene in displayDevice.LightingScenes)
|
||||||
|
{
|
||||||
|
var tempIndex = sceneIndex - 1;
|
||||||
|
//trilist.SetSigTrueAction((uint)(joinMap.LightingSceneOffset + sceneIndex), () => displayDevice.SelectScene(displayDevice.LightingScenes[tempIndex]));
|
||||||
|
scene.IsActiveFeedback.LinkInputSig(trilist.BooleanInput[(uint)(joinMap.LightingSceneOffset + sceneIndex)]);
|
||||||
|
trilist.StringInput[(uint)(joinMap.LightingSceneOffset + sceneIndex)].StringValue = scene.Name;
|
||||||
|
trilist.BooleanInput[(uint)(joinMap.ButtonVisibilityOffset + sceneIndex)].BoolValue = true;
|
||||||
|
sceneIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (displayDevice.GetType().Name.ToString() == "LutronQuantumArea")
|
||||||
|
{
|
||||||
|
var lutronDevice = displayDevice as PepperDash.Essentials.Devices.Common.Environment.Lutron.LutronQuantumArea;
|
||||||
|
lutronDevice.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||||
|
trilist.SetStringSigAction(joinMap.IntegrationIdSet, s => lutronDevice.IntegrationId = s);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
//ApiEisc.Eisc.SetStringSigAction(ApiMap.integrationID, (s) => { lutronLights.IntegrationId = s; });
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
var lutronLights = displayDevice as PepperDash.Essentials.Devices.Common.Environment.Lutron.LutronQuantumArea;
|
||||||
|
|
||||||
|
|
||||||
|
for (uint i = 1; i <= lightingBase.CircuitCount; i++)
|
||||||
|
{
|
||||||
|
var circuit = i;
|
||||||
|
lightingBase.CircuitNameFeedbacks[circuit - 1].LinkInputSig(trilist.StringInput[joinMap.CircuitNames + circuit]);
|
||||||
|
lightingBase.CircuitIsCritical[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitIsCritical + circuit]);
|
||||||
|
lightingBase.CircuitState[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitState + circuit]);
|
||||||
|
trilist.SetSigTrueAction(joinMap.CircuitCycle + circuit, () => lightingBase.CycleCircuit(circuit - 1));
|
||||||
|
trilist.SetSigTrueAction(joinMap.CircuitOnCmd + circuit, () => lightingBase.TurnOnCircuit(circuit - 1));
|
||||||
|
trilist.SetSigTrueAction(joinMap.CircuitOffCmd + circuit, () => lightingBase.TurnOffCircuit(circuit - 1));
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class DisplayControllerJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
public uint IsOnline { get; set; }
|
||||||
|
public uint PowerOff { get; set; }
|
||||||
|
public uint PowerOn { get; set; }
|
||||||
|
public uint SelectScene { get; set; }
|
||||||
|
public uint LightingSceneOffset { get; set; }
|
||||||
|
public uint ButtonVisibilityOffset { get; set; }
|
||||||
|
public uint IntegrationIdSet { get; set; }
|
||||||
|
|
||||||
|
public DisplayControllerJoinMap()
|
||||||
|
{
|
||||||
|
// Digital
|
||||||
|
IsOnline = 1;
|
||||||
|
PowerOff = 1;
|
||||||
|
PowerOn = 2;
|
||||||
|
SelectScene = 1;
|
||||||
|
IntegrationIdSet = 1;
|
||||||
|
LightingSceneOffset = 10;
|
||||||
|
ButtonVisibilityOffset = 40;
|
||||||
|
// Analog
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
IsOnline = IsOnline + joinOffset;
|
||||||
|
PowerOff = PowerOff + joinOffset;
|
||||||
|
PowerOn = PowerOn + joinOffset;
|
||||||
|
SelectScene = SelectScene + joinOffset;
|
||||||
|
LightingSceneOffset = LightingSceneOffset + joinOffset;
|
||||||
|
ButtonVisibilityOffset = ButtonVisibilityOffset + joinOffset;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
144
PepperDashEssentials/Bridges/EssentialComms.cs
Normal file
144
PepperDashEssentials/Bridges/EssentialComms.cs
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Routing;
|
||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||||
|
using Crestron.SimplSharpPro.CrestronThread;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials {
|
||||||
|
public class EssentialCommConfig {
|
||||||
|
public string[] EiscApiIpids;
|
||||||
|
public EssentialCommCommConnectionConfigs[] CommConnections;
|
||||||
|
}
|
||||||
|
public class EssentialCommCommConnectionConfigs {
|
||||||
|
public uint joinNumber {get; set; }
|
||||||
|
public EssentialsControlPropertiesConfig control { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class EssentialCommsPort {
|
||||||
|
public IBasicCommunication Comm;
|
||||||
|
public IntFeedback StatusFeedback;
|
||||||
|
public BoolFeedback ConnectedFeedback;
|
||||||
|
public List<EssentialComApiMap> Outputs = new List<EssentialComApiMap>();
|
||||||
|
public String RxBuffer;
|
||||||
|
public EssentialCommsPort(EssentialsControlPropertiesConfig config, string keyPrefix) {
|
||||||
|
Comm = CommFactory.CreateCommForConfig(config, keyPrefix);
|
||||||
|
// var PortGather = new CommunicationGather(Comm, config.EndOfLineChar);
|
||||||
|
Comm.TextReceived += new EventHandler<GenericCommMethodReceiveTextArgs>(Communication_TextReceived);
|
||||||
|
|
||||||
|
var socket = Comm as ISocketStatus;
|
||||||
|
StatusFeedback = new IntFeedback(() => { return (int)socket.ClientStatus; });
|
||||||
|
ConnectedFeedback = new BoolFeedback(() => { return Comm.IsConnected; });
|
||||||
|
|
||||||
|
if (socket != null) {
|
||||||
|
socket.ConnectionChange += new EventHandler<GenericSocketStatusChageEventArgs>(socket_ConnectionChange);
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
void socket_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e) {
|
||||||
|
StatusFeedback.FireUpdate();
|
||||||
|
ConnectedFeedback.FireUpdate();
|
||||||
|
if (e.Client.IsConnected) {
|
||||||
|
// Tasks on connect
|
||||||
|
} else {
|
||||||
|
// Cleanup items from this session
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void Communication_TextReceived(object sender, GenericCommMethodReceiveTextArgs args) {
|
||||||
|
try {
|
||||||
|
foreach (var Output in Outputs) {
|
||||||
|
Output.Api.Eisc.StringInput[Output.Join].StringValue = args.Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception) {
|
||||||
|
throw new FormatException(string.Format("ERROR:{0}"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class EssentialComm : Device {
|
||||||
|
public EssentialCommConfig Properties;
|
||||||
|
|
||||||
|
public CommunicationGather PortGather { get; private set; }
|
||||||
|
public List<BridgeApiEisc> Apis {get; set;}
|
||||||
|
public Dictionary<string, StringFeedback> CommFeedbacks {get; private set; }
|
||||||
|
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
||||||
|
public Dictionary<uint, EssentialCommsPort> CommDictionary { get; private set; }
|
||||||
|
|
||||||
|
public EssentialComm(string key, string name, JToken properties) : base(key, name) {
|
||||||
|
Properties = JsonConvert.DeserializeObject<EssentialCommConfig>(properties.ToString());
|
||||||
|
CommFeedbacks = new Dictionary<string, StringFeedback>();
|
||||||
|
CommDictionary = new Dictionary<uint, EssentialCommsPort>();
|
||||||
|
Apis = new List<BridgeApiEisc>();
|
||||||
|
int commNumber = 1;
|
||||||
|
foreach (var commConfig in Properties.CommConnections) {
|
||||||
|
var commPort = new EssentialCommsPort(commConfig.control, string.Format("{0}-{1}", this.Key, commConfig.joinNumber));
|
||||||
|
CommDictionary.Add(commConfig.joinNumber, commPort);
|
||||||
|
|
||||||
|
commNumber++;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var Ipid in Properties.EiscApiIpids) {
|
||||||
|
var ApiEisc = new BridgeApiEisc(Ipid);
|
||||||
|
Apis.Add(ApiEisc);
|
||||||
|
foreach (var commConnection in CommDictionary) {
|
||||||
|
Debug.Console(2, "Joining Api{0} to comm {1}", Ipid, commConnection.Key);
|
||||||
|
var tempComm = commConnection.Value;
|
||||||
|
var tempJoin = (uint)commConnection.Key;
|
||||||
|
EssentialComApiMap ApiMap = new EssentialComApiMap(ApiEisc, (uint)tempJoin);
|
||||||
|
|
||||||
|
tempComm.Outputs.Add(ApiMap);
|
||||||
|
// Check for ApiMap Overide Values here
|
||||||
|
|
||||||
|
ApiEisc.Eisc.SetBoolSigAction(tempJoin, b => {if (b) { tempComm.Comm.Connect(); } else { tempComm.Comm.Disconnect(); }});
|
||||||
|
ApiEisc.Eisc.SetStringSigAction(tempJoin, s => tempComm.Comm.SendText(s));
|
||||||
|
|
||||||
|
tempComm.StatusFeedback.LinkInputSig(ApiEisc.Eisc.UShortInput[tempJoin]);
|
||||||
|
tempComm.ConnectedFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[tempJoin]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
ApiEisc.Eisc.Register();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public override bool CustomActivate()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Debug.Console(2, "Name {0} Activated", this.Name);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
Debug.Console(0, "Bridge {0}", e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
public class EssentialComApiMap {
|
||||||
|
public uint Join;
|
||||||
|
public BridgeApiEisc Api;
|
||||||
|
public uint connectJoin;
|
||||||
|
public EssentialComApiMap(BridgeApiEisc api, uint join) {
|
||||||
|
Join = join;
|
||||||
|
Api = api;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
150
PepperDashEssentials/Bridges/EssentialDM.cs
Normal file
150
PepperDashEssentials/Bridges/EssentialDM.cs
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
using PepperDash.Essentials.DM;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Routing;
|
||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||||
|
using Crestron.SimplSharpPro.DM;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials {
|
||||||
|
public class EssentialDM : PepperDash.Core.Device {
|
||||||
|
public EssentialDMProperties Properties;
|
||||||
|
public List<BridgeApiEisc> BridgeApiEiscs;
|
||||||
|
private PepperDash.Essentials.DM.DmChassisController DmSwitch;
|
||||||
|
private EssentialDMApiMap ApiMap = new EssentialDMApiMap();
|
||||||
|
public EssentialDM(string key, string name, JToken properties)
|
||||||
|
: base(key, name) {
|
||||||
|
Properties = JsonConvert.DeserializeObject<EssentialDMProperties>(properties.ToString());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
public override bool CustomActivate() {
|
||||||
|
// Create EiscApis
|
||||||
|
try {
|
||||||
|
foreach (var device in DeviceManager.AllDevices) {
|
||||||
|
if (device.Key == this.Properties.connectionDeviceKey) {
|
||||||
|
Debug.Console(2, "deviceKey {0} Matches", device.Key);
|
||||||
|
DmSwitch = DeviceManager.GetDeviceForKey(device.Key) as PepperDash.Essentials.DM.DmChassisController;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else {
|
||||||
|
Debug.Console(2, "deviceKey {0} doesn't match", device.Key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Properties.EiscApiIpids != null) {
|
||||||
|
|
||||||
|
|
||||||
|
foreach (string Ipid in Properties.EiscApiIpids) {
|
||||||
|
var ApiEisc = new BridgeApiEisc(Ipid);
|
||||||
|
for (uint x = 1; x <= DmSwitch.Chassis.NumberOfInputs;x++ ) {
|
||||||
|
uint tempX = x;
|
||||||
|
Debug.Console(2, "Creating EiscActions {0}", tempX);
|
||||||
|
|
||||||
|
|
||||||
|
ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputVideoRoutes[tempX], u => DmSwitch.ExecuteSwitch(u, tempX, eRoutingSignalType.Video));
|
||||||
|
ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputAudioRoutes[tempX], u => DmSwitch.ExecuteSwitch(u, tempX, eRoutingSignalType.Audio));
|
||||||
|
|
||||||
|
|
||||||
|
if (DmSwitch.TxDictionary.ContainsKey(tempX)) {
|
||||||
|
Debug.Console(2, "Creating Tx Feedbacks {0}", tempX);
|
||||||
|
var TxKey = DmSwitch.TxDictionary[tempX];
|
||||||
|
var TxDevice = DeviceManager.GetDeviceForKey(TxKey) as DmTxControllerBase;
|
||||||
|
TxDevice.IsOnline.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.TxOnlineStatus[tempX]]);
|
||||||
|
TxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.TxVideoSyncStatus[tempX]]);
|
||||||
|
ApiEisc.Eisc.SetUShortSigAction((ApiMap.HdcpSupport[tempX]), u => TxDevice.SetHdcpSupportAll((ePdtHdcpSupport)(u)));
|
||||||
|
TxDevice.HdcpSupportAllFeedback.LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.HdcpSupport[tempX]]);
|
||||||
|
ApiEisc.Eisc.UShortInput[ApiMap.HdcpSupportCapability[tempX]].UShortValue = TxDevice.HdcpSupportCapability;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
DmSwitch.VideoInputSyncFeedbacks[tempX].LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.TxVideoSyncStatus[tempX]]);
|
||||||
|
}
|
||||||
|
if (DmSwitch.RxDictionary.ContainsKey(tempX)) {
|
||||||
|
Debug.Console(2, "Creating Rx Feedbacks {0}", tempX);
|
||||||
|
var RxKey = DmSwitch.RxDictionary[tempX];
|
||||||
|
var RxDevice = DeviceManager.GetDeviceForKey(RxKey) as DmRmcControllerBase;
|
||||||
|
RxDevice.IsOnline.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.RxOnlineStatus[tempX]]);
|
||||||
|
}
|
||||||
|
// DmSwitch.InputEndpointOnlineFeedbacks[(ushort)tempOutputNum].LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.OutputVideoRoutes[tempOutputNum]]);
|
||||||
|
DmSwitch.VideoOutputFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.OutputVideoRoutes[tempX]]);
|
||||||
|
DmSwitch.AudioOutputFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.OutputAudioRoutes[tempX]]);
|
||||||
|
DmSwitch.InputNameFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.StringInput[ApiMap.InputNames[tempX]]);
|
||||||
|
DmSwitch.OutputNameFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.StringInput[ApiMap.OutputNames[tempX]]);
|
||||||
|
DmSwitch.OutputRouteNameFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.StringInput[ApiMap.OutputRouteNames[tempX]]);
|
||||||
|
}
|
||||||
|
DmSwitch.IsOnline.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.ChassisOnline]);
|
||||||
|
ApiEisc.Eisc.Register();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Debug.Console(2, "Name {0} Activated", this.Name);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
Debug.Console(2, "BRidge {0}", e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class EssentialDMProperties {
|
||||||
|
public string connectionDeviceKey;
|
||||||
|
public string[] EiscApiIpids;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class EssentialDMApiMap {
|
||||||
|
public ushort ChassisOnline = 11;
|
||||||
|
public Dictionary<uint, ushort> OutputVideoRoutes;
|
||||||
|
public Dictionary<uint, ushort> OutputAudioRoutes;
|
||||||
|
public Dictionary<uint, ushort> TxOnlineStatus;
|
||||||
|
public Dictionary<uint, ushort> RxOnlineStatus;
|
||||||
|
public Dictionary<uint, ushort> TxVideoSyncStatus;
|
||||||
|
public Dictionary<uint, ushort> InputNames;
|
||||||
|
public Dictionary<uint, ushort> OutputNames;
|
||||||
|
public Dictionary<uint, ushort> OutputRouteNames;
|
||||||
|
public Dictionary<uint, ushort> HdcpSupport;
|
||||||
|
public Dictionary<uint, ushort> HdcpSupportCapability;
|
||||||
|
|
||||||
|
public EssentialDMApiMap() {
|
||||||
|
OutputVideoRoutes = new Dictionary<uint, ushort>();
|
||||||
|
OutputAudioRoutes = new Dictionary<uint, ushort>();
|
||||||
|
TxOnlineStatus = new Dictionary<uint, ushort>();
|
||||||
|
RxOnlineStatus = new Dictionary<uint, ushort>();
|
||||||
|
TxVideoSyncStatus = new Dictionary<uint, ushort>();
|
||||||
|
InputNames = new Dictionary<uint, ushort>();
|
||||||
|
OutputNames = new Dictionary<uint, ushort>();
|
||||||
|
OutputRouteNames = new Dictionary<uint, ushort>();
|
||||||
|
HdcpSupport = new Dictionary<uint, ushort>();
|
||||||
|
HdcpSupportCapability = new Dictionary<uint, ushort>();
|
||||||
|
|
||||||
|
for (uint x = 1; x <= 200; x++) {
|
||||||
|
// Debug.Console(0, "Init Value {0}", x);
|
||||||
|
uint tempNum = x;
|
||||||
|
HdcpSupportCapability[tempNum] = (ushort)(tempNum + 1200);
|
||||||
|
HdcpSupport[tempNum] = (ushort)(tempNum + 1000);
|
||||||
|
OutputVideoRoutes[tempNum] = (ushort)(tempNum + 100);
|
||||||
|
OutputAudioRoutes[tempNum] = (ushort)(tempNum + 300);
|
||||||
|
TxOnlineStatus[tempNum] = (ushort)(tempNum + 500);
|
||||||
|
RxOnlineStatus[tempNum] = (ushort)(tempNum + 700);
|
||||||
|
TxVideoSyncStatus[tempNum] = (ushort)(tempNum + 100);
|
||||||
|
InputNames[tempNum] = (ushort)(tempNum + 100);
|
||||||
|
OutputNames[tempNum] = (ushort)(tempNum + 300);
|
||||||
|
OutputRouteNames[tempNum] = (ushort)(tempNum + 2000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
217
PepperDashEssentials/Bridges/EssentialDsp.cs
Normal file
217
PepperDashEssentials/Bridges/EssentialDsp.cs
Normal file
@@ -0,0 +1,217 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
using PepperDash.Essentials.DM;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Routing;
|
||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||||
|
using Crestron.SimplSharpPro.DM;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials {
|
||||||
|
public class EssentialDsp : PepperDash.Core.Device {
|
||||||
|
public EssentialDspProperties Properties;
|
||||||
|
public List<BridgeApiEisc> BridgeApiEiscs;
|
||||||
|
private PepperDash.Essentials.Devices.Common.DSP.QscDsp Dsp;
|
||||||
|
private EssentialDspApiMap ApiMap = new EssentialDspApiMap();
|
||||||
|
public EssentialDsp(string key, string name, JToken properties)
|
||||||
|
: base(key, name) {
|
||||||
|
Properties = JsonConvert.DeserializeObject<EssentialDspProperties>(properties.ToString());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
public override bool CustomActivate() {
|
||||||
|
// Create EiscApis
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ICommunicationMonitor comm = null;
|
||||||
|
foreach (var device in DeviceManager.AllDevices)
|
||||||
|
{
|
||||||
|
if (device.Key == this.Properties.connectionDeviceKey)
|
||||||
|
{
|
||||||
|
if (!(device is ICommunicationMonitor))
|
||||||
|
{
|
||||||
|
comm = device as ICommunicationMonitor;
|
||||||
|
}
|
||||||
|
Debug.Console(2, "deviceKey {0} Matches", device.Key);
|
||||||
|
Dsp = DeviceManager.GetDeviceForKey(device.Key) as PepperDash.Essentials.Devices.Common.DSP.QscDsp;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Console(2, "deviceKey {0} doesn't match", device.Key);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Properties.EiscApiIpids != null && Dsp != null)
|
||||||
|
{
|
||||||
|
foreach (string Ipid in Properties.EiscApiIpids)
|
||||||
|
{
|
||||||
|
var ApiEisc = new BridgeApiEisc(Ipid);
|
||||||
|
Debug.Console(2, "Connecting EiscApi {0} to {1}", ApiEisc.Ipid, Dsp.Name);
|
||||||
|
ushort x = 1;
|
||||||
|
if (comm != null)
|
||||||
|
{
|
||||||
|
comm.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.Online]);
|
||||||
|
}
|
||||||
|
foreach (var channel in Dsp.LevelControlPoints)
|
||||||
|
{
|
||||||
|
//var QscChannel = channel.Value as PepperDash.Essentials.Devices.Common.DSP.QscDspLevelControl;
|
||||||
|
Debug.Console(2, "QscChannel {0} connect", x);
|
||||||
|
|
||||||
|
var genericChannel = channel.Value as IBasicVolumeWithFeedback;
|
||||||
|
if (channel.Value.Enabled)
|
||||||
|
{
|
||||||
|
ApiEisc.Eisc.StringInput[ApiMap.channelName[x]].StringValue = channel.Value.LevelCustomName;
|
||||||
|
ApiEisc.Eisc.UShortInput[ApiMap.channelType[x]].UShortValue = (ushort)channel.Value.Type;
|
||||||
|
|
||||||
|
genericChannel.MuteFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.channelMuteToggle[x]]);
|
||||||
|
genericChannel.VolumeLevelFeedback.LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.channelVolume[x]]);
|
||||||
|
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.channelMuteToggle[x], () => genericChannel.MuteToggle());
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.channelMuteOn[x], () => genericChannel.MuteOn());
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.channelMuteOff[x], () => genericChannel.MuteOff());
|
||||||
|
|
||||||
|
ApiEisc.Eisc.SetBoolSigAction(ApiMap.channelVolumeUp[x], b => genericChannel.VolumeUp(b));
|
||||||
|
ApiEisc.Eisc.SetBoolSigAction(ApiMap.channelVolumeDown[x], b => genericChannel.VolumeDown(b));
|
||||||
|
|
||||||
|
ApiEisc.Eisc.SetUShortSigAction(ApiMap.channelVolume[x], u => genericChannel.SetVolume(u));
|
||||||
|
ApiEisc.Eisc.SetStringSigAction(ApiMap.presetString, s => Dsp.RunPreset(s));
|
||||||
|
}
|
||||||
|
x++;
|
||||||
|
|
||||||
|
}
|
||||||
|
x = 1;
|
||||||
|
foreach (var preset in Dsp.PresetList)
|
||||||
|
{
|
||||||
|
ApiEisc.Eisc.StringInput[ApiMap.presets[x]].StringValue = preset.label;
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.presets[x], () => Dsp.RunPresetNumber(x));
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
foreach (var dialer in Dsp.Dialers)
|
||||||
|
{
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad0, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num0));
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad1, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num1));
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad2, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num2));
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad3, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num3));
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad4, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num4));
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad5, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num5));
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad6, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num6));
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad7, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num7));
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad8, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num8));
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad9, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num9));
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.KeypadStar, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Star));
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.KeypadPound, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Pound));
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.KeypadClear, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Clear));
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.KeypadBackspace, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Backspace));
|
||||||
|
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.Dial, () => dialer.Value.Dial());
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.DoNotDisturbToggle, () => dialer.Value.DoNotDisturbToggle());
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.DoNotDisturbOn, () => dialer.Value.DoNotDisturbOn());
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.DoNotDisturbOff, () => dialer.Value.DoNotDisturbOff());
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.AutoAnswerToggle, () => dialer.Value.AutoAnswerToggle());
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.AutoAnswerOn, () => dialer.Value.AutoAnswerOn());
|
||||||
|
ApiEisc.Eisc.SetSigTrueAction(ApiMap.AutoAnswerOff, () => dialer.Value.AutoAnswerOff());
|
||||||
|
|
||||||
|
dialer.Value.DoNotDisturbFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.DoNotDisturbToggle]);
|
||||||
|
dialer.Value.DoNotDisturbFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.DoNotDisturbOn]);
|
||||||
|
dialer.Value.DoNotDisturbFeedback.LinkComplementInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.DoNotDisturbOff]);
|
||||||
|
|
||||||
|
dialer.Value.AutoAnswerFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.AutoAnswerToggle]);
|
||||||
|
dialer.Value.AutoAnswerFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.AutoAnswerOn]);
|
||||||
|
dialer.Value.AutoAnswerFeedback.LinkComplementInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.AutoAnswerOff]);
|
||||||
|
|
||||||
|
dialer.Value.OffHookFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.Dial]);
|
||||||
|
dialer.Value.DialStringFeedback.LinkInputSig(ApiEisc.Eisc.StringInput[ApiMap.DialString]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Debug.Console(2, "Name {0} Activated", this.Name);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
Debug.Console(0, "Bridge {0}", e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class EssentialDspProperties {
|
||||||
|
public string connectionDeviceKey;
|
||||||
|
public string[] EiscApiIpids;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class EssentialDspApiMap {
|
||||||
|
public ushort Online = 1;
|
||||||
|
public ushort presetString = 2000;
|
||||||
|
public Dictionary<uint, ushort> channelMuteToggle;
|
||||||
|
public Dictionary<uint, ushort> channelMuteOn;
|
||||||
|
public Dictionary<uint, ushort> channelMuteOff;
|
||||||
|
public Dictionary<uint, ushort> channelVolume;
|
||||||
|
public Dictionary<uint, ushort> channelType;
|
||||||
|
public Dictionary<uint, ushort> channelName;
|
||||||
|
public Dictionary<uint, ushort> channelVolumeUp;
|
||||||
|
public Dictionary<uint, ushort> channelVolumeDown;
|
||||||
|
public Dictionary<uint, ushort> presets;
|
||||||
|
public ushort DialString = 3100;
|
||||||
|
public ushort Keypad0 = 3110;
|
||||||
|
public ushort Keypad1 = 3111;
|
||||||
|
public ushort Keypad2 = 3112;
|
||||||
|
public ushort Keypad3 = 3113;
|
||||||
|
public ushort Keypad4 = 3114;
|
||||||
|
public ushort Keypad5 = 3115;
|
||||||
|
public ushort Keypad6 = 3116;
|
||||||
|
public ushort Keypad7 = 3117;
|
||||||
|
public ushort Keypad8 = 3118;
|
||||||
|
public ushort Keypad9 = 3119;
|
||||||
|
public ushort KeypadStar = 3120;
|
||||||
|
public ushort KeypadPound = 3121;
|
||||||
|
public ushort KeypadClear = 3122;
|
||||||
|
public ushort KeypadBackspace = 3123;
|
||||||
|
public ushort Dial = 3124;
|
||||||
|
public ushort DoNotDisturbToggle = 3132;
|
||||||
|
public ushort DoNotDisturbOn = 3133;
|
||||||
|
public ushort DoNotDisturbOff = 3134;
|
||||||
|
public ushort AutoAnswerToggle = 3127;
|
||||||
|
public ushort AutoAnswerOn = 3125;
|
||||||
|
public ushort AutoAnswerOff = 3126;
|
||||||
|
|
||||||
|
public EssentialDspApiMap() {
|
||||||
|
channelMuteToggle = new Dictionary<uint, ushort>();
|
||||||
|
channelMuteOn = new Dictionary<uint, ushort>();
|
||||||
|
channelMuteOff = new Dictionary<uint, ushort>();
|
||||||
|
channelVolume = new Dictionary<uint, ushort>();
|
||||||
|
channelName = new Dictionary<uint, ushort>();
|
||||||
|
channelType = new Dictionary<uint, ushort>();
|
||||||
|
presets = new Dictionary<uint, ushort>();
|
||||||
|
channelVolumeUp = new Dictionary<uint, ushort>();
|
||||||
|
channelVolumeDown = new Dictionary<uint, ushort>();
|
||||||
|
for (uint x = 1; x <= 100; x++) {
|
||||||
|
uint tempNum = x;
|
||||||
|
presets[tempNum] = (ushort)(tempNum + 100);
|
||||||
|
channelMuteToggle[tempNum] = (ushort)(tempNum + 400);
|
||||||
|
channelMuteOn[tempNum] = (ushort)(tempNum + 600);
|
||||||
|
channelMuteOff[tempNum] = (ushort)(tempNum + 800);
|
||||||
|
channelVolume[tempNum] = (ushort)(tempNum + 200);
|
||||||
|
channelName[tempNum] = (ushort)(tempNum + 200);
|
||||||
|
channelType[tempNum] = (ushort)(tempNum + 400);
|
||||||
|
channelVolumeUp[tempNum] = (ushort)(tempNum + 1000);
|
||||||
|
channelVolumeDown[tempNum] = (ushort)(tempNum + 1200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
98
PepperDashEssentials/Bridges/EssentialTVOne.cs
Normal file
98
PepperDashEssentials/Bridges/EssentialTVOne.cs
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
using PepperDash.Essentials.DM;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Routing;
|
||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||||
|
using Crestron.SimplSharpPro.DM;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials
|
||||||
|
{
|
||||||
|
public class EssentialsTVOne : PepperDash.Core.Device
|
||||||
|
{
|
||||||
|
public EssentialTVOneProperties Properties;
|
||||||
|
public List<BridgeApiEisc> BridgeApiEiscs;
|
||||||
|
private PepperDash.Essentials.Devices.Common.TVOneCorio TVOneCorio;
|
||||||
|
private EssentialsTVOneApiMap ApiMap = new EssentialsTVOneApiMap();
|
||||||
|
public EssentialsTVOne(string key, string name, JToken properties)
|
||||||
|
: base(key, name)
|
||||||
|
{
|
||||||
|
Properties = JsonConvert.DeserializeObject<EssentialTVOneProperties>(properties.ToString());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
public override bool CustomActivate() {
|
||||||
|
// Create EiscApis
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach (var device in DeviceManager.AllDevices)
|
||||||
|
{
|
||||||
|
if (device.Key == this.Properties.connectionDeviceKey)
|
||||||
|
{
|
||||||
|
Debug.Console(2, "deviceKey {0} Matches", device.Key);
|
||||||
|
TVOneCorio = DeviceManager.GetDeviceForKey(device.Key) as PepperDash.Essentials.Devices.Common.TVOneCorio;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Console(2, "deviceKey {0} doesn't match", device.Key);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Properties.EiscApiIpids != null && TVOneCorio != null)
|
||||||
|
{
|
||||||
|
foreach (string Ipid in Properties.EiscApiIpids)
|
||||||
|
{
|
||||||
|
var ApiEisc = new BridgeApiEisc(Ipid);
|
||||||
|
Debug.Console(2, "Connecting EiscApi {0} to {1}", ApiEisc.Ipid, TVOneCorio.Name);
|
||||||
|
ushort x = 1;
|
||||||
|
TVOneCorio.OnlineFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.Online]);
|
||||||
|
ApiEisc.Eisc.SetUShortSigAction(ApiMap.CallPreset, u => TVOneCorio.CallPreset(u));
|
||||||
|
TVOneCorio.PresetFeedback.LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.PresetFeedback]);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Debug.Console(2, "Name {0} Activated", this.Name);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
Debug.Console(0, "Bridge {0}", e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class EssentialTVOneProperties
|
||||||
|
{
|
||||||
|
public string connectionDeviceKey;
|
||||||
|
public string[] EiscApiIpids;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class EssentialsTVOneApiMap
|
||||||
|
{
|
||||||
|
public ushort CallPreset = 1;
|
||||||
|
public ushort PresetFeedback = 1;
|
||||||
|
public ushort Online = 1;
|
||||||
|
|
||||||
|
public EssentialsTVOneApiMap()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
103
PepperDashEssentials/Bridges/GenericLightingBridge.cs
Normal file
103
PepperDashEssentials/Bridges/GenericLightingBridge.cs
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Devices.Common;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class GenericLightingApiExtensions
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this PepperDash.Essentials.Core.Lighting.LightingBase lightingDevice, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as GenericLightingJoinMap;
|
||||||
|
|
||||||
|
if (joinMap == null)
|
||||||
|
joinMap = new GenericLightingJoinMap();
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Debug.Console(0, "Linking to lighting Type {0}", lightingDevice.GetType().Name.ToString());
|
||||||
|
|
||||||
|
// GenericLighitng Actions & FeedBack
|
||||||
|
trilist.SetUShortSigAction(joinMap.SelectScene, u => lightingDevice.SelectScene(lightingDevice.LightingScenes[u]));
|
||||||
|
|
||||||
|
int sceneIndex = 1;
|
||||||
|
foreach (var scene in lightingDevice.LightingScenes)
|
||||||
|
{
|
||||||
|
var tempIndex = sceneIndex - 1;
|
||||||
|
trilist.SetSigTrueAction((uint)(joinMap.LightingSceneOffset + sceneIndex), () => lightingDevice.SelectScene(lightingDevice.LightingScenes[tempIndex]));
|
||||||
|
scene.IsActiveFeedback.LinkInputSig(trilist.BooleanInput[(uint)(joinMap.LightingSceneOffset + sceneIndex)]);
|
||||||
|
trilist.StringInput[(uint)(joinMap.LightingSceneOffset + sceneIndex)].StringValue = scene.Name;
|
||||||
|
trilist.BooleanInput[(uint)(joinMap.ButtonVisibilityOffset + sceneIndex)].BoolValue = true;
|
||||||
|
sceneIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lightingDevice.GetType().Name.ToString() == "LutronQuantumArea")
|
||||||
|
{
|
||||||
|
var lutronDevice = lightingDevice as PepperDash.Essentials.Devices.Common.Environment.Lutron.LutronQuantumArea;
|
||||||
|
lutronDevice.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||||
|
trilist.SetStringSigAction(joinMap.IntegrationIdSet, s => lutronDevice.IntegrationId = s);
|
||||||
|
}
|
||||||
|
|
||||||
|
//ApiEisc.Eisc.SetStringSigAction(ApiMap.integrationID, (s) => { lutronLights.IntegrationId = s; });
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
var lutronLights = lightingDevice as PepperDash.Essentials.Devices.Common.Environment.Lutron.LutronQuantumArea;
|
||||||
|
|
||||||
|
|
||||||
|
for (uint i = 1; i <= lightingBase.CircuitCount; i++)
|
||||||
|
{
|
||||||
|
var circuit = i;
|
||||||
|
lightingBase.CircuitNameFeedbacks[circuit - 1].LinkInputSig(trilist.StringInput[joinMap.CircuitNames + circuit]);
|
||||||
|
lightingBase.CircuitIsCritical[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitIsCritical + circuit]);
|
||||||
|
lightingBase.CircuitState[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitState + circuit]);
|
||||||
|
trilist.SetSigTrueAction(joinMap.CircuitCycle + circuit, () => lightingBase.CycleCircuit(circuit - 1));
|
||||||
|
trilist.SetSigTrueAction(joinMap.CircuitOnCmd + circuit, () => lightingBase.TurnOnCircuit(circuit - 1));
|
||||||
|
trilist.SetSigTrueAction(joinMap.CircuitOffCmd + circuit, () => lightingBase.TurnOffCircuit(circuit - 1));
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class GenericLightingJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
public uint IsOnline { get; set; }
|
||||||
|
public uint SelectScene { get; set; }
|
||||||
|
public uint LightingSceneOffset { get; set; }
|
||||||
|
public uint ButtonVisibilityOffset { get; set; }
|
||||||
|
public uint IntegrationIdSet { get; set; }
|
||||||
|
|
||||||
|
public GenericLightingJoinMap()
|
||||||
|
{
|
||||||
|
// Digital
|
||||||
|
IsOnline = 1;
|
||||||
|
SelectScene = 1;
|
||||||
|
IntegrationIdSet = 1;
|
||||||
|
LightingSceneOffset = 10;
|
||||||
|
ButtonVisibilityOffset = 40;
|
||||||
|
// Analog
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
IsOnline = IsOnline + joinOffset;
|
||||||
|
SelectScene = SelectScene + joinOffset;
|
||||||
|
LightingSceneOffset = LightingSceneOffset + joinOffset;
|
||||||
|
ButtonVisibilityOffset = ButtonVisibilityOffset + joinOffset;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
66
PepperDashEssentials/Bridges/GenericRelayDeviceBridge.cs
Normal file
66
PepperDashEssentials/Bridges/GenericRelayDeviceBridge.cs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.CrestronIO;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class GenericRelayDeviceApiExtensions
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this GenericRelayDevice relay, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as GenericRelayControllerJoinMap;
|
||||||
|
|
||||||
|
if (joinMap == null)
|
||||||
|
joinMap = new GenericRelayControllerJoinMap();
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
|
||||||
|
if (relay.RelayOutput == null)
|
||||||
|
{
|
||||||
|
Debug.Console(1, relay, "Unable to link device '{0}'. Relay is null", relay.Key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Console(1, relay, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
|
||||||
|
trilist.SetBoolSigAction(joinMap.Relay, new Action<bool>(b =>
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
relay.CloseRelay();
|
||||||
|
else
|
||||||
|
relay.OpenRelay();
|
||||||
|
}));
|
||||||
|
|
||||||
|
// feedback for relay state
|
||||||
|
|
||||||
|
relay.OutputIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Relay]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GenericRelayControllerJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
//Digital
|
||||||
|
public uint Relay { get; set; }
|
||||||
|
|
||||||
|
public GenericRelayControllerJoinMap()
|
||||||
|
{
|
||||||
|
Relay = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
Relay = Relay + joinOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
103
PepperDashEssentials/Bridges/IBasicCommunicationBridge.cs
Normal file
103
PepperDashEssentials/Bridges/IBasicCommunicationBridge.cs
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class IBasicCommunicationApiExtensions
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this GenericComm comm, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as IBasicCommunicationJoinMap;
|
||||||
|
|
||||||
|
if (joinMap == null)
|
||||||
|
joinMap = new IBasicCommunicationJoinMap();
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
|
||||||
|
if (comm.CommPort == null)
|
||||||
|
{
|
||||||
|
Debug.Console(1, comm, "Unable to link device '{0}'. CommPort is null", comm.Key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Console(1, comm, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
|
||||||
|
// this is a permanent event handler. This cannot be -= from event
|
||||||
|
comm.CommPort.TextReceived += (s, a) => trilist.SetString(joinMap.TextReceived, a.Text);
|
||||||
|
trilist.SetStringSigAction(joinMap.SendText, new Action<string>(s => comm.CommPort.SendText(s)));
|
||||||
|
trilist.SetStringSigAction(joinMap.SetPortConfig + 1, new Action<string>(s => comm.SetPortConfig(s)));
|
||||||
|
|
||||||
|
|
||||||
|
var sComm = comm.CommPort as ISocketStatus;
|
||||||
|
if (sComm != null)
|
||||||
|
{
|
||||||
|
sComm.ConnectionChange += (s, a) =>
|
||||||
|
{
|
||||||
|
trilist.SetUshort(joinMap.Status, (ushort)(a.Client.ClientStatus));
|
||||||
|
trilist.SetBool(joinMap.Connected, a.Client.ClientStatus ==
|
||||||
|
Crestron.SimplSharp.CrestronSockets.SocketStatus.SOCKET_STATUS_CONNECTED);
|
||||||
|
};
|
||||||
|
|
||||||
|
trilist.SetBoolSigAction(joinMap.Connect, new Action<bool>(b =>
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
sComm.Connect();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sComm.Disconnect();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class IBasicCommunicationJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
//Digital
|
||||||
|
public uint Connect { get; set; }
|
||||||
|
public uint Connected { get; set; }
|
||||||
|
|
||||||
|
//Analog
|
||||||
|
public uint Status { get; set; }
|
||||||
|
|
||||||
|
// Serial
|
||||||
|
public uint TextReceived { get; set; }
|
||||||
|
public uint SendText { get; set; }
|
||||||
|
public uint SetPortConfig { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public IBasicCommunicationJoinMap()
|
||||||
|
{
|
||||||
|
TextReceived = 1;
|
||||||
|
SendText = 1;
|
||||||
|
SetPortConfig = 2;
|
||||||
|
Connect = 1;
|
||||||
|
Connected = 1;
|
||||||
|
Status = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
TextReceived = TextReceived + joinOffset;
|
||||||
|
SendText = SendText + joinOffset;
|
||||||
|
SetPortConfig = SetPortConfig + joinOffset;
|
||||||
|
Connect = Connect + joinOffset;
|
||||||
|
Connected = Connected + joinOffset;
|
||||||
|
Status = Status + joinOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
59
PepperDashEssentials/Bridges/IDigitalInputBridge.cs
Normal file
59
PepperDashEssentials/Bridges/IDigitalInputBridge.cs
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.CrestronIO;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class IDigitalInputApiExtenstions
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this IDigitalInput input, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as IDigitalInputApiJoinMap;
|
||||||
|
|
||||||
|
if (joinMap == null)
|
||||||
|
joinMap = new IDigitalInputApiJoinMap();
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Debug.Console(1, input as Device, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
|
||||||
|
// Link feedback for input state
|
||||||
|
input.InputStateFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputState]);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.Console(1, input as Device, "Unable to link device '{0}'. Input is null", (input as Device).Key);
|
||||||
|
Debug.Console(1, input as Device, "Error: {0}", e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class IDigitalInputApiJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
//Digital
|
||||||
|
public uint InputState { get; set; }
|
||||||
|
|
||||||
|
public IDigitalInputApiJoinMap()
|
||||||
|
{
|
||||||
|
InputState = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
InputState = InputState + joinOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
PepperDashEssentials/Bridges/JoinMapBase.cs
Normal file
40
PepperDashEssentials/Bridges/JoinMapBase.cs
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class JoinMapHelper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Attempts to get the join map from config
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="joinMapKey"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static JoinMapBase GetJoinMapForDevice(string joinMapKey)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(joinMapKey))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
// FUTURE TODO: Get the join map from the ConfigReader.ConfigObject
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public abstract class JoinMapBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Modifies all the join numbers by adding the offset. This should never be called twice
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="joinStart"></param>
|
||||||
|
public abstract void OffsetJoinNumbers(uint joinStart);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
150
PepperDashEssentials/Bridges/SystemMonitorBridge.cs
Normal file
150
PepperDashEssentials/Bridges/SystemMonitorBridge.cs
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
using Crestron.SimplSharpPro.Diagnostics;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.Monitoring;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class SystemMonitorBridge
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this SystemMonitorController systemMonitorController, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as SystemMonitorJoinMap;
|
||||||
|
|
||||||
|
if (joinMap == null)
|
||||||
|
joinMap = new SystemMonitorJoinMap();
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
|
||||||
|
//Debug.Console(1, systemMonitorController, "Linking API starting at join: {0}", joinStart);
|
||||||
|
|
||||||
|
systemMonitorController.TimeZoneFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeZone]);
|
||||||
|
//trilist.SetUShortSigAction(joinMap.TimeZone, new Action<ushort>(u => systemMonitorController.SetTimeZone(u)));
|
||||||
|
systemMonitorController.TimeZoneTextFeedback.LinkInputSig(trilist.StringInput[joinMap.TimeZoneName]);
|
||||||
|
|
||||||
|
systemMonitorController.IOControllerVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.IOControllerVersion]);
|
||||||
|
systemMonitorController.SnmpVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.SnmpAppVersion]);
|
||||||
|
systemMonitorController.BACnetAppVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.BACnetAppVersion]);
|
||||||
|
systemMonitorController.ControllerVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.ControllerVersion]);
|
||||||
|
|
||||||
|
|
||||||
|
// iterate the program status feedback collection and map all the joins
|
||||||
|
var programSlotJoinStart = joinMap.ProgramStartJoin;
|
||||||
|
|
||||||
|
foreach (var p in systemMonitorController.ProgramStatusFeedbackCollection)
|
||||||
|
{
|
||||||
|
|
||||||
|
// TODO: link feedbacks for each program slot
|
||||||
|
var programNumber = p.Value.Program.Number;
|
||||||
|
|
||||||
|
//Debug.Console(1, systemMonitorController, "Linking API for Program Slot: {0} starting at join: {1}", programNumber, programSlotJoinStart);
|
||||||
|
|
||||||
|
trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramStart, new Action<bool>
|
||||||
|
(b => SystemMonitor.ProgramCollection[programNumber].OperatingState = eProgramOperatingState.Start));
|
||||||
|
p.Value.ProgramStartedFeedback.LinkInputSig(trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramStart]);
|
||||||
|
|
||||||
|
trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramStop, new Action<bool>
|
||||||
|
(b => SystemMonitor.ProgramCollection[programNumber].OperatingState = eProgramOperatingState.Stop));
|
||||||
|
p.Value.ProgramStoppedFeedback.LinkInputSig(trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramStop]);
|
||||||
|
|
||||||
|
trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramRegister, new Action<bool>
|
||||||
|
(b => SystemMonitor.ProgramCollection[programNumber].RegistrationState = eProgramRegistrationState.Register));
|
||||||
|
p.Value.ProgramRegisteredFeedback.LinkInputSig(trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramRegister]);
|
||||||
|
|
||||||
|
trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramUnregister, new Action<bool>
|
||||||
|
(b => SystemMonitor.ProgramCollection[programNumber].RegistrationState = eProgramRegistrationState.Unregister));
|
||||||
|
p.Value.ProgramUnregisteredFeedback.LinkInputSig(trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramUnregister]);
|
||||||
|
|
||||||
|
programSlotJoinStart = programSlotJoinStart + joinMap.ProgramOffsetJoin;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SystemMonitorJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Offset to indicate where the range of iterated program joins will start
|
||||||
|
/// </summary>
|
||||||
|
public uint ProgramStartJoin { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Offset between each program join set
|
||||||
|
/// </summary>
|
||||||
|
public uint ProgramOffsetJoin { get; set; }
|
||||||
|
|
||||||
|
//Digital
|
||||||
|
public uint ProgramStart { get; set; }
|
||||||
|
public uint ProgramStop { get; set; }
|
||||||
|
public uint ProgramRegister { get; set; }
|
||||||
|
public uint ProgramUnregister { get; set; }
|
||||||
|
|
||||||
|
//Analog
|
||||||
|
public uint TimeZone { get; set; }
|
||||||
|
|
||||||
|
//Serial
|
||||||
|
public uint TimeZoneName { get; set; }
|
||||||
|
public uint IOControllerVersion { get; set; }
|
||||||
|
public uint SnmpAppVersion { get; set; }
|
||||||
|
public uint BACnetAppVersion { get; set; }
|
||||||
|
public uint ControllerVersion { get; set; }
|
||||||
|
|
||||||
|
public uint ProgramName { get; set; }
|
||||||
|
public uint ProgramCompiledTime { get; set; }
|
||||||
|
public uint ProgramCrestronDatabaseVersion { get; set; }
|
||||||
|
public uint ProgramEnvironmentVersion { get; set; }
|
||||||
|
public uint AggregatedProgramInfo { get; set; }
|
||||||
|
|
||||||
|
public SystemMonitorJoinMap()
|
||||||
|
{
|
||||||
|
TimeZone = 1;
|
||||||
|
|
||||||
|
TimeZoneName = 1;
|
||||||
|
IOControllerVersion = 2;
|
||||||
|
SnmpAppVersion = 3;
|
||||||
|
BACnetAppVersion = 4;
|
||||||
|
ControllerVersion = 5;
|
||||||
|
|
||||||
|
|
||||||
|
ProgramStartJoin = 10;
|
||||||
|
|
||||||
|
ProgramOffsetJoin = 5;
|
||||||
|
|
||||||
|
// Offset in groups of 5 joins
|
||||||
|
ProgramStart = 1;
|
||||||
|
ProgramStop = 2;
|
||||||
|
ProgramRegister = 3;
|
||||||
|
ProgramUnregister = 4;
|
||||||
|
|
||||||
|
ProgramName = 1;
|
||||||
|
ProgramCompiledTime = 2;
|
||||||
|
ProgramCrestronDatabaseVersion = 3;
|
||||||
|
ProgramEnvironmentVersion = 4;
|
||||||
|
AggregatedProgramInfo = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
TimeZone = TimeZone + joinOffset;
|
||||||
|
|
||||||
|
TimeZoneName = TimeZoneName + joinOffset;
|
||||||
|
IOControllerVersion = IOControllerVersion + joinOffset;
|
||||||
|
SnmpAppVersion = SnmpAppVersion + joinOffset;
|
||||||
|
BACnetAppVersion = BACnetAppVersion + joinOffset;
|
||||||
|
ControllerVersion = ControllerVersion + joinOffset;
|
||||||
|
|
||||||
|
// Sets the initial join value where the iterated program joins will begin
|
||||||
|
ProgramStartJoin = ProgramStartJoin + joinOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -80,6 +80,16 @@ namespace PepperDash.Essentials
|
|||||||
var dm = new DmMd8x8(ipId, Global.ControlSystem);
|
var dm = new DmMd8x8(ipId, Global.ControlSystem);
|
||||||
//dev = new DmChassisController(devKey, devName, dm);
|
//dev = new DmChassisController(devKey, devName, dm);
|
||||||
}
|
}
|
||||||
|
else if (devType.Equals("dmmd16x16", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
var dm = new DmMd16x16(ipId, Global.ControlSystem);
|
||||||
|
//dev = new DmChassisController(devKey, devName, dm);
|
||||||
|
}
|
||||||
|
else if (devType.Equals("dmmd32x32", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
var dm = new DmMd32x32(ipId, Global.ControlSystem);
|
||||||
|
//dev = new DmChassisController(devKey, devName, dm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ using Crestron.SimplSharp;
|
|||||||
using Crestron.SimplSharp.CrestronIO;
|
using Crestron.SimplSharp.CrestronIO;
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.CrestronThread;
|
using Crestron.SimplSharpPro.CrestronThread;
|
||||||
|
using Crestron.SimplSharpPro.Diagnostics;
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
@@ -32,12 +34,18 @@ namespace PepperDash.Essentials
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public override void InitializeSystem()
|
public override void InitializeSystem()
|
||||||
{
|
{
|
||||||
|
SystemMonitor.ProgramInitialization.ProgramInitializationUnderUserControl = true;
|
||||||
|
|
||||||
DeterminePlatform();
|
DeterminePlatform();
|
||||||
|
|
||||||
//CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Loads configuration file",
|
//CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Loads configuration file",
|
||||||
// ConsoleAccessLevelEnum.AccessOperator);
|
// ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
|
||||||
// CrestronConsole.AddNewConsoleCommand(S => { ConfigWriter.WriteConfigFile(null); }, "writeconfig", "writes the current config to a file", ConsoleAccessLevelEnum.AccessOperator);
|
// CrestronConsole.AddNewConsoleCommand(S => { ConfigWriter.WriteConfigFile(null); }, "writeconfig", "writes the current config to a file", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
CrestronConsole.AddNewConsoleCommand(s =>
|
||||||
|
{
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "CONSOLE MESSAGE: {0}", s);
|
||||||
|
}, "appdebugmessage", "Writes message to log", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
|
||||||
CrestronConsole.AddNewConsoleCommand(s =>
|
CrestronConsole.AddNewConsoleCommand(s =>
|
||||||
{
|
{
|
||||||
@@ -141,12 +149,18 @@ namespace PepperDash.Essentials
|
|||||||
"------------------------------------------------\r" +
|
"------------------------------------------------\r" +
|
||||||
"------------------------------------------------");
|
"------------------------------------------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Debug.Console(0, "FATAL INITIALIZE ERROR. System is in an inconsistent state:\r{0}", e);
|
Debug.Console(0, "FATAL INITIALIZE ERROR. System is in an inconsistent state:\r{0}", e);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Notify the
|
||||||
|
SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -203,16 +217,40 @@ namespace PepperDash.Essentials
|
|||||||
LoadLogoServer();
|
LoadLogoServer();
|
||||||
|
|
||||||
DeviceManager.ActivateAll();
|
DeviceManager.ActivateAll();
|
||||||
|
|
||||||
|
LinkSystemMonitorToAppServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LinkSystemMonitorToAppServer()
|
||||||
|
{
|
||||||
|
var sysMon = DeviceManager.GetDeviceForKey("systemMonitor") as PepperDash.Essentials.Core.Monitoring.SystemMonitorController;
|
||||||
|
|
||||||
|
var appServer = DeviceManager.GetDeviceForKey("appServer") as CotijaSystemController;
|
||||||
|
|
||||||
|
|
||||||
|
if (sysMon != null && appServer != null)
|
||||||
|
{
|
||||||
|
var key = sysMon.Key + "-" + appServer.Key;
|
||||||
|
var messenger = new PepperDash.Essentials.AppServer.Messengers.SystemMonitorMessenger
|
||||||
|
(key, sysMon, "/device/systemMonitor");
|
||||||
|
|
||||||
|
messenger.RegisterWithAppServer(appServer);
|
||||||
|
|
||||||
|
DeviceManager.AddDevice(messenger);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reads all devices from config and adds them to DeviceManager
|
/// Reads all devices from config and adds them to DeviceManager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void LoadDevices()
|
public void LoadDevices()
|
||||||
{
|
{
|
||||||
// Build the processor wrapper class
|
# warning Missing PepperDash.Essentials.Core.Devices.CrestronProcessor("processor"));
|
||||||
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor"));
|
// Build the processor wrapper class
|
||||||
|
// DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor"));
|
||||||
|
|
||||||
|
// Add global System Monitor device
|
||||||
|
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Monitoring.SystemMonitorController("systemMonitor"));
|
||||||
|
|
||||||
foreach (var devConf in ConfigReader.ConfigObject.Devices)
|
foreach (var devConf in ConfigReader.ConfigObject.Devices)
|
||||||
{
|
{
|
||||||
@@ -231,17 +269,23 @@ namespace PepperDash.Essentials
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try local factory first
|
// Try local factories first
|
||||||
var newDev = DeviceFactory.GetDevice(devConf);
|
var newDev = DeviceFactory.GetDevice(devConf);
|
||||||
|
|
||||||
|
if (newDev == null)
|
||||||
|
newDev = BridgeFactory.GetDevice(devConf);
|
||||||
|
|
||||||
// Then associated library factories
|
// Then associated library factories
|
||||||
|
if (newDev == null)
|
||||||
|
newDev = PepperDash.Essentials.Core.DeviceFactory.GetDevice(devConf);
|
||||||
if (newDev == null)
|
if (newDev == null)
|
||||||
newDev = PepperDash.Essentials.Devices.Common.DeviceFactory.GetDevice(devConf);
|
newDev = PepperDash.Essentials.Devices.Common.DeviceFactory.GetDevice(devConf);
|
||||||
if (newDev == null)
|
if (newDev == null)
|
||||||
newDev = PepperDash.Essentials.DM.DeviceFactory.GetDevice(devConf);
|
newDev = PepperDash.Essentials.DM.DeviceFactory.GetDevice(devConf);
|
||||||
if (newDev == null)
|
if (newDev == null)
|
||||||
newDev = PepperDash.Essentials.Devices.Displays.DisplayDeviceFactory.GetDevice(devConf);
|
newDev = PepperDash.Essentials.Devices.Displays.DisplayDeviceFactory.GetDevice(devConf);
|
||||||
|
if (newDev == null)
|
||||||
|
newDev = PepperDash.Essentials.BridgeFactory.GetDevice(devConf);
|
||||||
if (newDev != null)
|
if (newDev != null)
|
||||||
DeviceManager.AddDevice(newDev);
|
DeviceManager.AddDevice(newDev);
|
||||||
else
|
else
|
||||||
@@ -256,6 +300,7 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper method to load tie lines. This should run after devices have loaded
|
/// Helper method to load tie lines. This should run after devices have loaded
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,367 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
using Crestron.SimplSharp.CrestronIO;
|
|
||||||
using Crestron.SimplSharpPro;
|
|
||||||
using Crestron.SimplSharpPro.CrestronThread;
|
|
||||||
using PepperDash.Core;
|
|
||||||
using PepperDash.Core.PortalSync;
|
|
||||||
using PepperDash.Essentials.Core;
|
|
||||||
using PepperDash.Essentials.Devices.Common;
|
|
||||||
using PepperDash.Essentials.DM;
|
|
||||||
using PepperDash.Essentials.Fusion;
|
|
||||||
using PepperDash.Essentials.Room.Cotija;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials
|
|
||||||
{
|
|
||||||
public class ControlSystem : CrestronControlSystem
|
|
||||||
{
|
|
||||||
PepperDashPortalSyncClient PortalSync;
|
|
||||||
HttpLogoServer LogoServer;
|
|
||||||
|
|
||||||
public ControlSystem()
|
|
||||||
: base()
|
|
||||||
{
|
|
||||||
Thread.MaxNumberOfUserThreads = 400;
|
|
||||||
Global.ControlSystem = this;
|
|
||||||
DeviceManager.Initialize(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Git 'er goin'
|
|
||||||
/// </summary>
|
|
||||||
public override void InitializeSystem()
|
|
||||||
{
|
|
||||||
<<<<<<< HEAD
|
|
||||||
DeterminePlatform();
|
|
||||||
|
|
||||||
//CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Loads configuration file",
|
|
||||||
// ConsoleAccessLevelEnum.AccessOperator);
|
|
||||||
=======
|
|
||||||
CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Loads configuration file",
|
|
||||||
ConsoleAccessLevelEnum.AccessOperator);
|
|
||||||
>>>>>>> 600b9f11ff1bbc186f7c2a2945955731b3523b3c
|
|
||||||
|
|
||||||
CrestronConsole.AddNewConsoleCommand(s =>
|
|
||||||
{
|
|
||||||
foreach (var tl in TieLineCollection.Default)
|
|
||||||
CrestronConsole.ConsoleCommandResponse(" {0}\r", tl);
|
|
||||||
},
|
|
||||||
"listtielines", "Prints out all tie lines", ConsoleAccessLevelEnum.AccessOperator);
|
|
||||||
|
|
||||||
CrestronConsole.AddNewConsoleCommand(s =>
|
|
||||||
{
|
|
||||||
CrestronConsole.ConsoleCommandResponse
|
|
||||||
("Current running configuration. This is the merged system and template configuration");
|
|
||||||
CrestronConsole.ConsoleCommandResponse(Newtonsoft.Json.JsonConvert.SerializeObject
|
|
||||||
(ConfigReader.ConfigObject, Newtonsoft.Json.Formatting.Indented));
|
|
||||||
}, "showconfig", "Shows the current running merged config", ConsoleAccessLevelEnum.AccessOperator);
|
|
||||||
|
|
||||||
CrestronConsole.AddNewConsoleCommand(s =>
|
|
||||||
{
|
|
||||||
CrestronConsole.ConsoleCommandResponse("This system can be found at the following URLs:\r" +
|
|
||||||
"System URL: {0}\r" +
|
|
||||||
"Template URL: {1}", ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.TemplateUrl);
|
|
||||||
}, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator);
|
|
||||||
|
|
||||||
//GoWithLoad();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Determines if the program is running on a processor (appliance) or server (XiO Edge).
|
|
||||||
///
|
|
||||||
/// Sets Global.FilePathPrefix based on platform
|
|
||||||
/// </summary>
|
|
||||||
public void DeterminePlatform()
|
|
||||||
{
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Determining Platform....");
|
|
||||||
|
|
||||||
string filePathPrefix;
|
|
||||||
|
|
||||||
var dirSeparator = Global.DirectorySeparator;
|
|
||||||
|
|
||||||
var version = Crestron.SimplSharp.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
|
|
||||||
|
|
||||||
var versionString = string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build);
|
|
||||||
|
|
||||||
string directoryPrefix;
|
|
||||||
|
|
||||||
//directoryPrefix = Crestron.SimplSharp.CrestronIO.Directory.GetApplicationRootDirectory();
|
|
||||||
#warning ^ For use with beta Include4.dat for XiO Edge
|
|
||||||
directoryPrefix = "";
|
|
||||||
|
|
||||||
if (CrestronEnvironment.DevicePlatform != eDevicePlatform.Server)
|
|
||||||
{
|
|
||||||
filePathPrefix = directoryPrefix + dirSeparator + "NVRAM"
|
|
||||||
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber) + dirSeparator;
|
|
||||||
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on 3-series Appliance", versionString);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
filePathPrefix = directoryPrefix + dirSeparator + "User" + dirSeparator;
|
|
||||||
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on XiO Edge Server", versionString);
|
|
||||||
}
|
|
||||||
|
|
||||||
Global.SetFilePathPrefix(filePathPrefix);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Do it, yo
|
|
||||||
/// </summary>
|
|
||||||
public void GoWithLoad()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
CrestronConsole.AddNewConsoleCommand(EnablePortalSync, "portalsync", "Loads Portal Sync",
|
|
||||||
ConsoleAccessLevelEnum.AccessOperator);
|
|
||||||
|
|
||||||
//PortalSync = new PepperDashPortalSyncClient();
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials load from configuration");
|
|
||||||
|
|
||||||
var filesReady = SetupFilesystem();
|
|
||||||
if (filesReady)
|
|
||||||
{
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Folder structure verified. Loading config...");
|
|
||||||
if (!ConfigReader.LoadConfig2())
|
|
||||||
return;
|
|
||||||
|
|
||||||
Load();
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Essentials load complete\r" +
|
|
||||||
"-------------------------------------------------------------");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.Console(0,
|
|
||||||
"------------------------------------------------\r" +
|
|
||||||
"------------------------------------------------\r" +
|
|
||||||
"------------------------------------------------\r" +
|
|
||||||
"Essentials file structure setup completed.\r" +
|
|
||||||
"Please load config, sgd and ir files and\r" +
|
|
||||||
"restart program.\r" +
|
|
||||||
"------------------------------------------------\r" +
|
|
||||||
"------------------------------------------------\r" +
|
|
||||||
"------------------------------------------------");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Debug.Console(0, "FATAL INITIALIZE ERROR. System is in an inconsistent state:\r{0}", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Verifies filesystem is set up. IR, SGD, and program1 folders
|
|
||||||
/// </summary>
|
|
||||||
bool SetupFilesystem()
|
|
||||||
{
|
|
||||||
Debug.Console(0, "Verifying and/or creating folder structure");
|
|
||||||
var configDir = Global.FilePathPrefix;
|
|
||||||
var configExists = Directory.Exists(configDir);
|
|
||||||
if (!configExists)
|
|
||||||
Directory.Create(configDir);
|
|
||||||
|
|
||||||
var irDir = Global.FilePathPrefix + "ir";
|
|
||||||
if (!Directory.Exists(irDir))
|
|
||||||
Directory.Create(irDir);
|
|
||||||
|
|
||||||
var sgdDir = Global.FilePathPrefix + "sgd";
|
|
||||||
if (!Directory.Exists(sgdDir))
|
|
||||||
Directory.Create(sgdDir);
|
|
||||||
|
|
||||||
return configExists;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void EnablePortalSync(string s)
|
|
||||||
{
|
|
||||||
if (s.ToLower() == "enable")
|
|
||||||
{
|
|
||||||
CrestronConsole.ConsoleCommandResponse("Portal Sync features enabled");
|
|
||||||
PortalSync = new PepperDashPortalSyncClient();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void TearDown()
|
|
||||||
{
|
|
||||||
Debug.Console(0, "Tearing down existing system");
|
|
||||||
DeviceManager.DeactivateAll();
|
|
||||||
|
|
||||||
TieLineCollection.Default.Clear();
|
|
||||||
|
|
||||||
foreach (var key in DeviceManager.GetDevices())
|
|
||||||
DeviceManager.RemoveDevice(key);
|
|
||||||
|
|
||||||
Debug.Console(0, "Tear down COMPLETE");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
void Load()
|
|
||||||
{
|
|
||||||
LoadDevices();
|
|
||||||
LoadTieLines();
|
|
||||||
LoadRooms();
|
|
||||||
LoadLogoServer();
|
|
||||||
|
|
||||||
DeviceManager.ActivateAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Reads all devices from config and adds them to DeviceManager
|
|
||||||
/// </summary>
|
|
||||||
public void LoadDevices()
|
|
||||||
{
|
|
||||||
foreach (var devConf in ConfigReader.ConfigObject.Devices)
|
|
||||||
{
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Creating device '{0}'", devConf.Key);
|
|
||||||
// Skip this to prevent unnecessary warnings
|
|
||||||
if (devConf.Key == "processor")
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Try local factory first
|
|
||||||
var newDev = DeviceFactory.GetDevice(devConf);
|
|
||||||
|
|
||||||
// Then associated library factories
|
|
||||||
if (newDev == null)
|
|
||||||
newDev = PepperDash.Essentials.Devices.Common.DeviceFactory.GetDevice(devConf);
|
|
||||||
if (newDev == null)
|
|
||||||
newDev = PepperDash.Essentials.DM.DeviceFactory.GetDevice(devConf);
|
|
||||||
if (newDev == null)
|
|
||||||
newDev = PepperDash.Essentials.Devices.Displays.DisplayDeviceFactory.GetDevice(devConf);
|
|
||||||
|
|
||||||
if (newDev != null)
|
|
||||||
DeviceManager.AddDevice(newDev);
|
|
||||||
else
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "ERROR: Cannot load unknown device type '{0}', key '{1}'.", devConf.Type, devConf.Key);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "ERROR: Creating device {0}. Skipping device. \r{1}", devConf.Key, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Devices Loaded.");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Helper method to load tie lines. This should run after devices have loaded
|
|
||||||
/// </summary>
|
|
||||||
public void LoadTieLines()
|
|
||||||
{
|
|
||||||
// In the future, we can't necessarily just clear here because devices
|
|
||||||
// might be making their own internal sources/tie lines
|
|
||||||
|
|
||||||
var tlc = TieLineCollection.Default;
|
|
||||||
//tlc.Clear();
|
|
||||||
if (ConfigReader.ConfigObject.TieLines == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var tieLineConfig in ConfigReader.ConfigObject.TieLines)
|
|
||||||
{
|
|
||||||
var newTL = tieLineConfig.GetTieLine();
|
|
||||||
if (newTL != null)
|
|
||||||
tlc.Add(newTL);
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Tie Lines Loaded.");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Reads all rooms from config and adds them to DeviceManager
|
|
||||||
/// </summary>
|
|
||||||
public void LoadRooms()
|
|
||||||
{
|
|
||||||
if (ConfigReader.ConfigObject.Rooms == null)
|
|
||||||
{
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Warning, "WARNING: Configuration contains no rooms");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var roomConfig in ConfigReader.ConfigObject.Rooms)
|
|
||||||
{
|
|
||||||
var room = roomConfig.GetRoomObject();
|
|
||||||
if (room != null)
|
|
||||||
{
|
|
||||||
if (room is EssentialsHuddleSpaceRoom)
|
|
||||||
{
|
|
||||||
DeviceManager.AddDevice(room);
|
|
||||||
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleSpaceRoom, attempting to add to DeviceManager with Fusion");
|
|
||||||
DeviceManager.AddDevice(new EssentialsHuddleSpaceFusionSystemControllerBase((EssentialsHuddleSpaceRoom)room, 0xf1));
|
|
||||||
|
|
||||||
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Cotija Bridge...");
|
|
||||||
// Cotija bridge
|
|
||||||
var bridge = new CotijaEssentialsHuddleSpaceRoomBridge(room as EssentialsHuddleSpaceRoom);
|
|
||||||
AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present
|
|
||||||
DeviceManager.AddDevice(bridge);
|
|
||||||
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Cotija Bridge Added...");
|
|
||||||
}
|
|
||||||
else if (room is EssentialsHuddleVtc1Room)
|
|
||||||
{
|
|
||||||
DeviceManager.AddDevice(room);
|
|
||||||
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleVtc1Room, attempting to add to DeviceManager with Fusion");
|
|
||||||
DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController((EssentialsHuddleVtc1Room)room, 0xf1));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is NOT EssentialsHuddleSpaceRoom, attempting to add to DeviceManager w/o Fusion");
|
|
||||||
DeviceManager.AddDevice(room);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create room from config, key '{0}'", roomConfig.Key);
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Rooms Loaded.");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Helps add the post activation steps that link bridges to main controller
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="bridge"></param>
|
|
||||||
void AddBridgePostActivationHelper(CotijaBridgeBase bridge)
|
|
||||||
{
|
|
||||||
bridge.AddPostActivationAction(() =>
|
|
||||||
{
|
|
||||||
var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "appServer") as CotijaSystemController;
|
|
||||||
if (parent == null)
|
|
||||||
{
|
|
||||||
Debug.Console(0, bridge, "ERROR: Cannot connect bridge. System controller not present");
|
|
||||||
}
|
|
||||||
Debug.Console(0, bridge, "Linking to parent controller");
|
|
||||||
bridge.AddParent(parent);
|
|
||||||
parent.AddBridge(bridge);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Fires up a logo server if not already running
|
|
||||||
/// </summary>
|
|
||||||
void LoadLogoServer()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
LogoServer = new HttpLogoServer(8080, Global.FilePathPrefix + "html" + Global.DirectorySeparator + "logo");
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "NOTICE: Logo server cannot be started. Likely already running in another program");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,348 +1,348 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharp.CrestronIO;
|
using Crestron.SimplSharp.CrestronIO;
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
using Crestron.SimplSharpPro.Fusion;
|
using Crestron.SimplSharpPro.Fusion;
|
||||||
|
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials;
|
using PepperDash.Essentials;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
using PepperDash.Essentials.Devices.Common;
|
using PepperDash.Essentials.Devices.Common;
|
||||||
using PepperDash.Essentials.Devices.Common.Occupancy;
|
using PepperDash.Essentials.Devices.Common.Occupancy;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Fusion
|
namespace PepperDash.Essentials.Fusion
|
||||||
{
|
{
|
||||||
public class EssentialsHuddleVtc1FusionController : EssentialsHuddleSpaceFusionSystemControllerBase
|
public class EssentialsHuddleVtc1FusionController : EssentialsHuddleSpaceFusionSystemControllerBase
|
||||||
{
|
{
|
||||||
BooleanSigData CodecIsInCall;
|
BooleanSigData CodecIsInCall;
|
||||||
|
|
||||||
public EssentialsHuddleVtc1FusionController(EssentialsHuddleVtc1Room room, uint ipId)
|
public EssentialsHuddleVtc1FusionController(EssentialsHuddleVtc1Room room, uint ipId)
|
||||||
: base(room, ipId)
|
: base(room, ipId)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called in base class constructor before RVI and GUID files are built
|
/// Called in base class constructor before RVI and GUID files are built
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected override void ExecuteCustomSteps()
|
protected override void ExecuteCustomSteps()
|
||||||
{
|
{
|
||||||
SetUpCodec();
|
SetUpCodec();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a static asset for the codec and maps the joins to the main room symbol
|
/// Creates a static asset for the codec and maps the joins to the main room symbol
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void SetUpCodec()
|
void SetUpCodec()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var codec = (Room as EssentialsHuddleVtc1Room).VideoCodec;
|
var codec = (Room as EssentialsHuddleVtc1Room).VideoCodec;
|
||||||
|
|
||||||
if (codec == null)
|
if (codec == null)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Cannot link codec to Fusion because codec is null");
|
Debug.Console(1, this, "Cannot link codec to Fusion because codec is null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
codec.UsageTracker = new UsageTracking(codec);
|
codec.UsageTracker = new UsageTracking(codec);
|
||||||
codec.UsageTracker.UsageIsTracked = true;
|
codec.UsageTracker.UsageIsTracked = true;
|
||||||
codec.UsageTracker.DeviceUsageEnded += UsageTracker_DeviceUsageEnded;
|
codec.UsageTracker.DeviceUsageEnded += UsageTracker_DeviceUsageEnded;
|
||||||
|
|
||||||
var codecPowerOnAction = new Action<bool>(b => { if (!b) codec.StandbyDeactivate(); });
|
var codecPowerOnAction = new Action<bool>(b => { if (!b) codec.StandbyDeactivate(); });
|
||||||
var codecPowerOffAction = new Action<bool>(b => { if (!b) codec.StandbyActivate(); });
|
var codecPowerOffAction = new Action<bool>(b => { if (!b) codec.StandbyActivate(); });
|
||||||
|
|
||||||
// Map FusionRoom Attributes:
|
// Map FusionRoom Attributes:
|
||||||
|
|
||||||
// Codec volume
|
// Codec volume
|
||||||
var codecVolume = FusionRoom.CreateOffsetUshortSig(50, "Volume - Fader01", eSigIoMask.InputOutputSig);
|
var codecVolume = FusionRoom.CreateOffsetUshortSig(50, "Volume - Fader01", eSigIoMask.InputOutputSig);
|
||||||
codecVolume.OutputSig.UserObject = new Action<ushort>(b => (codec as IBasicVolumeWithFeedback).SetVolume(b));
|
codecVolume.OutputSig.UserObject = new Action<ushort>(b => (codec as IBasicVolumeWithFeedback).SetVolume(b));
|
||||||
(codec as IBasicVolumeWithFeedback).VolumeLevelFeedback.LinkInputSig(codecVolume.InputSig);
|
(codec as IBasicVolumeWithFeedback).VolumeLevelFeedback.LinkInputSig(codecVolume.InputSig);
|
||||||
|
|
||||||
// In Call Status
|
// In Call Status
|
||||||
CodecIsInCall = FusionRoom.CreateOffsetBoolSig(69, "Conf - VC 1 In Call", eSigIoMask.InputSigOnly);
|
CodecIsInCall = FusionRoom.CreateOffsetBoolSig(69, "Conf - VC 1 In Call", eSigIoMask.InputSigOnly);
|
||||||
codec.CallStatusChange += new EventHandler<PepperDash.Essentials.Devices.Common.Codec.CodecCallStatusItemChangeEventArgs>(codec_CallStatusChange);
|
codec.CallStatusChange += new EventHandler<PepperDash.Essentials.Devices.Common.Codec.CodecCallStatusItemChangeEventArgs>(codec_CallStatusChange);
|
||||||
|
|
||||||
// Online status
|
// Online status
|
||||||
if (codec is ICommunicationMonitor)
|
if (codec is ICommunicationMonitor)
|
||||||
{
|
{
|
||||||
var c = codec as ICommunicationMonitor;
|
var c = codec as ICommunicationMonitor;
|
||||||
var codecOnline = FusionRoom.CreateOffsetBoolSig(122, "Online - VC 1", eSigIoMask.InputSigOnly);
|
var codecOnline = FusionRoom.CreateOffsetBoolSig(122, "Online - VC 1", eSigIoMask.InputSigOnly);
|
||||||
codecOnline.InputSig.BoolValue = c.CommunicationMonitor.Status == MonitorStatus.IsOk;
|
codecOnline.InputSig.BoolValue = c.CommunicationMonitor.Status == MonitorStatus.IsOk;
|
||||||
c.CommunicationMonitor.StatusChange += (o, a) =>
|
c.CommunicationMonitor.StatusChange += (o, a) =>
|
||||||
{
|
{
|
||||||
codecOnline.InputSig.BoolValue = a.Status == MonitorStatus.IsOk;
|
codecOnline.InputSig.BoolValue = a.Status == MonitorStatus.IsOk;
|
||||||
};
|
};
|
||||||
Debug.Console(0, this, "Linking '{0}' communication monitor to Fusion '{1}'", codec.Key, "Online - VC 1");
|
Debug.Console(0, this, "Linking '{0}' communication monitor to Fusion '{1}'", codec.Key, "Online - VC 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Codec IP Address
|
// Codec IP Address
|
||||||
bool codecHasIpInfo = false;
|
bool codecHasIpInfo = false;
|
||||||
var codecComm = codec.Communication;
|
var codecComm = codec.Communication;
|
||||||
|
|
||||||
string codecIpAddress = string.Empty;
|
string codecIpAddress = string.Empty;
|
||||||
int codecIpPort = 0;
|
int codecIpPort = 0;
|
||||||
|
|
||||||
StringSigData codecIpAddressSig;
|
StringSigData codecIpAddressSig;
|
||||||
StringSigData codecIpPortSig;
|
StringSigData codecIpPortSig;
|
||||||
|
|
||||||
if(codecComm is GenericSshClient)
|
if(codecComm is GenericSshClient)
|
||||||
{
|
{
|
||||||
codecIpAddress = (codecComm as GenericSshClient).Hostname;
|
codecIpAddress = (codecComm as GenericSshClient).Hostname;
|
||||||
codecIpPort = (codecComm as GenericSshClient).Port;
|
codecIpPort = (codecComm as GenericSshClient).Port;
|
||||||
codecHasIpInfo = true;
|
codecHasIpInfo = true;
|
||||||
}
|
}
|
||||||
else if (codecComm is GenericTcpIpClient)
|
else if (codecComm is GenericTcpIpClient)
|
||||||
{
|
{
|
||||||
codecIpAddress = (codecComm as GenericTcpIpClient).Hostname;
|
codecIpAddress = (codecComm as GenericTcpIpClient).Hostname;
|
||||||
codecIpPort = (codecComm as GenericTcpIpClient).Port;
|
codecIpPort = (codecComm as GenericTcpIpClient).Port;
|
||||||
codecHasIpInfo = true;
|
codecHasIpInfo = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (codecHasIpInfo)
|
if (codecHasIpInfo)
|
||||||
{
|
{
|
||||||
codecIpAddressSig = FusionRoom.CreateOffsetStringSig(121, "IP Address - VC", eSigIoMask.InputSigOnly);
|
codecIpAddressSig = FusionRoom.CreateOffsetStringSig(121, "IP Address - VC", eSigIoMask.InputSigOnly);
|
||||||
codecIpAddressSig.InputSig.StringValue = codecIpAddress;
|
codecIpAddressSig.InputSig.StringValue = codecIpAddress;
|
||||||
|
|
||||||
codecIpPortSig = FusionRoom.CreateOffsetStringSig(150, "IP Port - VC", eSigIoMask.InputSigOnly);
|
codecIpPortSig = FusionRoom.CreateOffsetStringSig(150, "IP Port - VC", eSigIoMask.InputSigOnly);
|
||||||
codecIpPortSig.InputSig.StringValue = codecIpPort.ToString();
|
codecIpPortSig.InputSig.StringValue = codecIpPort.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
var tempAsset = new FusionAsset();
|
var tempAsset = new FusionAsset();
|
||||||
|
|
||||||
var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(c => c.Key.Equals(codec.Key));
|
var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(c => c.Key.Equals(codec.Key));
|
||||||
|
|
||||||
if (FusionStaticAssets.ContainsKey(deviceConfig.Uid))
|
if (FusionStaticAssets.ContainsKey(deviceConfig.Uid))
|
||||||
{
|
{
|
||||||
tempAsset = FusionStaticAssets[deviceConfig.Uid];
|
tempAsset = FusionStaticAssets[deviceConfig.Uid];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Create a new asset
|
// Create a new asset
|
||||||
tempAsset = new FusionAsset(FusionRoomGuids.GetNextAvailableAssetNumber(FusionRoom), codec.Name, "Codec", "");
|
tempAsset = new FusionAsset(FusionRoomGuids.GetNextAvailableAssetNumber(FusionRoom), codec.Name, "Codec", "");
|
||||||
FusionStaticAssets.Add(deviceConfig.Uid, tempAsset);
|
FusionStaticAssets.Add(deviceConfig.Uid, tempAsset);
|
||||||
}
|
}
|
||||||
|
|
||||||
var codecAsset = FusionRoom.CreateStaticAsset(tempAsset.SlotNumber, tempAsset.Name, "Display", tempAsset.InstanceId);
|
var codecAsset = FusionRoom.CreateStaticAsset(tempAsset.SlotNumber, tempAsset.Name, "Display", tempAsset.InstanceId);
|
||||||
codecAsset.PowerOn.OutputSig.UserObject = codecPowerOnAction;
|
codecAsset.PowerOn.OutputSig.UserObject = codecPowerOnAction;
|
||||||
codecAsset.PowerOff.OutputSig.UserObject = codecPowerOffAction;
|
codecAsset.PowerOff.OutputSig.UserObject = codecPowerOffAction;
|
||||||
codec.StandbyIsOnFeedback.LinkComplementInputSig(codecAsset.PowerOn.InputSig);
|
codec.StandbyIsOnFeedback.LinkComplementInputSig(codecAsset.PowerOn.InputSig);
|
||||||
|
|
||||||
// TODO: Map relevant attributes on asset symbol
|
// TODO: Map relevant attributes on asset symbol
|
||||||
|
|
||||||
codecAsset.TrySetMakeModel(codec);
|
codecAsset.TrySetMakeModel(codec);
|
||||||
codecAsset.TryLinkAssetErrorToCommunication(codec);
|
codecAsset.TryLinkAssetErrorToCommunication(codec);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Error setting up codec in Fusion: {0}", e);
|
Debug.Console(1, this, "Error setting up codec in Fusion: {0}", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void codec_CallStatusChange(object sender, PepperDash.Essentials.Devices.Common.Codec.CodecCallStatusItemChangeEventArgs e)
|
void codec_CallStatusChange(object sender, PepperDash.Essentials.Devices.Common.Codec.CodecCallStatusItemChangeEventArgs e)
|
||||||
{
|
{
|
||||||
var codec = (Room as EssentialsHuddleVtc1Room).VideoCodec;
|
var codec = (Room as EssentialsHuddleVtc1Room).VideoCodec;
|
||||||
|
|
||||||
CodecIsInCall.InputSig.BoolValue = codec.IsInCall;
|
CodecIsInCall.InputSig.BoolValue = codec.IsInCall;
|
||||||
}
|
}
|
||||||
|
|
||||||
// These methods are overridden because they access the room class which is of a different type
|
// These methods are overridden because they access the room class which is of a different type
|
||||||
|
|
||||||
protected override void CreateSymbolAndBasicSigs(uint ipId)
|
protected override void CreateSymbolAndBasicSigs(uint ipId)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Creating Fusion Room symbol with GUID: {0}", RoomGuid);
|
Debug.Console(1, this, "Creating Fusion Room symbol with GUID: {0}", RoomGuid);
|
||||||
|
|
||||||
FusionRoom = new FusionRoom(ipId, Global.ControlSystem, Room.Name, RoomGuid);
|
FusionRoom = new FusionRoom(ipId, Global.ControlSystem, Room.Name, RoomGuid);
|
||||||
FusionRoom.ExtenderRoomViewSchedulingDataReservedSigs.Use();
|
FusionRoom.ExtenderRoomViewSchedulingDataReservedSigs.Use();
|
||||||
FusionRoom.ExtenderFusionRoomDataReservedSigs.Use();
|
FusionRoom.ExtenderFusionRoomDataReservedSigs.Use();
|
||||||
|
|
||||||
FusionRoom.Register();
|
FusionRoom.Register();
|
||||||
|
|
||||||
FusionRoom.FusionStateChange += FusionRoom_FusionStateChange;
|
FusionRoom.FusionStateChange += FusionRoom_FusionStateChange;
|
||||||
|
|
||||||
FusionRoom.ExtenderRoomViewSchedulingDataReservedSigs.DeviceExtenderSigChange += FusionRoomSchedule_DeviceExtenderSigChange;
|
FusionRoom.ExtenderRoomViewSchedulingDataReservedSigs.DeviceExtenderSigChange += FusionRoomSchedule_DeviceExtenderSigChange;
|
||||||
FusionRoom.ExtenderFusionRoomDataReservedSigs.DeviceExtenderSigChange += ExtenderFusionRoomDataReservedSigs_DeviceExtenderSigChange;
|
FusionRoom.ExtenderFusionRoomDataReservedSigs.DeviceExtenderSigChange += ExtenderFusionRoomDataReservedSigs_DeviceExtenderSigChange;
|
||||||
FusionRoom.OnlineStatusChange += FusionRoom_OnlineStatusChange;
|
FusionRoom.OnlineStatusChange += FusionRoom_OnlineStatusChange;
|
||||||
|
|
||||||
CrestronConsole.AddNewConsoleCommand(RequestFullRoomSchedule, "FusReqRoomSchedule", "Requests schedule of the room for the next 24 hours", ConsoleAccessLevelEnum.AccessOperator);
|
CrestronConsole.AddNewConsoleCommand(RequestFullRoomSchedule, "FusReqRoomSchedule", "Requests schedule of the room for the next 24 hours", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
CrestronConsole.AddNewConsoleCommand(ModifyMeetingEndTimeConsoleHelper, "FusReqRoomSchMod", "Ends or extends a meeting by the specified time", ConsoleAccessLevelEnum.AccessOperator);
|
CrestronConsole.AddNewConsoleCommand(ModifyMeetingEndTimeConsoleHelper, "FusReqRoomSchMod", "Ends or extends a meeting by the specified time", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
CrestronConsole.AddNewConsoleCommand(CreateAsHocMeeting, "FusCreateMeeting", "Creates and Ad Hoc meeting for on hour or until the next meeting", ConsoleAccessLevelEnum.AccessOperator);
|
CrestronConsole.AddNewConsoleCommand(CreateAsHocMeeting, "FusCreateMeeting", "Creates and Ad Hoc meeting for on hour or until the next meeting", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
|
||||||
// Room to fusion room
|
// Room to fusion room
|
||||||
Room.OnFeedback.LinkInputSig(FusionRoom.SystemPowerOn.InputSig);
|
Room.OnFeedback.LinkInputSig(FusionRoom.SystemPowerOn.InputSig);
|
||||||
|
|
||||||
// Moved to
|
// Moved to
|
||||||
CurrentRoomSourceNameSig = FusionRoom.CreateOffsetStringSig(84, "Display 1 - Current Source", eSigIoMask.InputSigOnly);
|
CurrentRoomSourceNameSig = FusionRoom.CreateOffsetStringSig(84, "Display 1 - Current Source", eSigIoMask.InputSigOnly);
|
||||||
// Don't think we need to get current status of this as nothing should be alive yet.
|
// Don't think we need to get current status of this as nothing should be alive yet.
|
||||||
(Room as EssentialsHuddleVtc1Room).CurrentSingleSourceChange += Room_CurrentSourceInfoChange;
|
(Room as EssentialsHuddleVtc1Room).CurrentSingleSourceChange += Room_CurrentSourceInfoChange;
|
||||||
|
|
||||||
|
|
||||||
FusionRoom.SystemPowerOn.OutputSig.SetSigFalseAction((Room as EssentialsHuddleVtc1Room).PowerOnToDefaultOrLastSource);
|
FusionRoom.SystemPowerOn.OutputSig.SetSigFalseAction((Room as EssentialsHuddleVtc1Room).PowerOnToDefaultOrLastSource);
|
||||||
FusionRoom.SystemPowerOff.OutputSig.SetSigFalseAction(() => (Room as EssentialsHuddleVtc1Room).RunRouteAction("roomOff"));
|
FusionRoom.SystemPowerOff.OutputSig.SetSigFalseAction(() => (Room as EssentialsHuddleVtc1Room).RunRouteAction("roomOff"));
|
||||||
// NO!! room.RoomIsOn.LinkComplementInputSig(FusionRoom.SystemPowerOff.InputSig);
|
// NO!! room.RoomIsOn.LinkComplementInputSig(FusionRoom.SystemPowerOff.InputSig);
|
||||||
|
|
||||||
|
|
||||||
CrestronEnvironment.EthernetEventHandler += CrestronEnvironment_EthernetEventHandler;
|
CrestronEnvironment.EthernetEventHandler += CrestronEnvironment_EthernetEventHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void SetUpSources()
|
protected override void SetUpSources()
|
||||||
{
|
{
|
||||||
// Sources
|
// Sources
|
||||||
var dict = ConfigReader.ConfigObject.GetSourceListForKey((Room as EssentialsHuddleVtc1Room).SourceListKey);
|
var dict = ConfigReader.ConfigObject.GetSourceListForKey((Room as EssentialsHuddleVtc1Room).SourceListKey);
|
||||||
if (dict != null)
|
if (dict != null)
|
||||||
{
|
{
|
||||||
// NEW PROCESS:
|
// NEW PROCESS:
|
||||||
// Make these lists and insert the fusion attributes by iterating these
|
// Make these lists and insert the fusion attributes by iterating these
|
||||||
var setTopBoxes = dict.Where(d => d.Value.SourceDevice is ISetTopBoxControls);
|
var setTopBoxes = dict.Where(d => d.Value.SourceDevice is ISetTopBoxControls);
|
||||||
uint i = 1;
|
uint i = 1;
|
||||||
foreach (var kvp in setTopBoxes)
|
foreach (var kvp in setTopBoxes)
|
||||||
{
|
{
|
||||||
TryAddRouteActionSigs("Display 1 - Source TV " + i, 188 + i, kvp.Key, kvp.Value.SourceDevice);
|
TryAddRouteActionSigs("Display 1 - Source TV " + i, 188 + i, kvp.Key, kvp.Value.SourceDevice);
|
||||||
i++;
|
i++;
|
||||||
if (i > 5) // We only have five spots
|
if (i > 5) // We only have five spots
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var discPlayers = dict.Where(d => d.Value.SourceDevice is IDiscPlayerControls);
|
var discPlayers = dict.Where(d => d.Value.SourceDevice is IDiscPlayerControls);
|
||||||
i = 1;
|
i = 1;
|
||||||
foreach (var kvp in discPlayers)
|
foreach (var kvp in discPlayers)
|
||||||
{
|
{
|
||||||
TryAddRouteActionSigs("Display 1 - Source DVD " + i, 181 + i, kvp.Key, kvp.Value.SourceDevice);
|
TryAddRouteActionSigs("Display 1 - Source DVD " + i, 181 + i, kvp.Key, kvp.Value.SourceDevice);
|
||||||
i++;
|
i++;
|
||||||
if (i > 5) // We only have five spots
|
if (i > 5) // We only have five spots
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var laptops = dict.Where(d => d.Value.SourceDevice is Laptop);
|
var laptops = dict.Where(d => d.Value.SourceDevice is Laptop);
|
||||||
i = 1;
|
i = 1;
|
||||||
foreach (var kvp in laptops)
|
foreach (var kvp in laptops)
|
||||||
{
|
{
|
||||||
TryAddRouteActionSigs("Display 1 - Source Laptop " + i, 166 + i, kvp.Key, kvp.Value.SourceDevice);
|
TryAddRouteActionSigs("Display 1 - Source Laptop " + i, 166 + i, kvp.Key, kvp.Value.SourceDevice);
|
||||||
i++;
|
i++;
|
||||||
if (i > 10) // We only have ten spots???
|
if (i > 10) // We only have ten spots???
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var kvp in dict)
|
foreach (var kvp in dict)
|
||||||
{
|
{
|
||||||
var usageDevice = kvp.Value.SourceDevice as IUsageTracking;
|
var usageDevice = kvp.Value.SourceDevice as IUsageTracking;
|
||||||
|
|
||||||
if (usageDevice != null)
|
if (usageDevice != null)
|
||||||
{
|
{
|
||||||
usageDevice.UsageTracker = new UsageTracking(usageDevice as Device);
|
usageDevice.UsageTracker = new UsageTracking(usageDevice as Device);
|
||||||
usageDevice.UsageTracker.UsageIsTracked = true;
|
usageDevice.UsageTracker.UsageIsTracked = true;
|
||||||
usageDevice.UsageTracker.DeviceUsageEnded += new EventHandler<DeviceUsageEventArgs>(UsageTracker_DeviceUsageEnded);
|
usageDevice.UsageTracker.DeviceUsageEnded += new EventHandler<DeviceUsageEventArgs>(UsageTracker_DeviceUsageEnded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "WARNING: Config source list '{0}' not found for room '{1}'",
|
Debug.Console(1, this, "WARNING: Config source list '{0}' not found for room '{1}'",
|
||||||
(Room as EssentialsHuddleVtc1Room).SourceListKey, Room.Key);
|
(Room as EssentialsHuddleVtc1Room).SourceListKey, Room.Key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void SetUpDisplay()
|
protected override void SetUpDisplay()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//Setup Display Usage Monitoring
|
//Setup Display Usage Monitoring
|
||||||
|
|
||||||
var displays = DeviceManager.AllDevices.Where(d => d is DisplayBase);
|
var displays = DeviceManager.AllDevices.Where(d => d is DisplayBase);
|
||||||
|
|
||||||
// Consider updating this in multiple display systems
|
// Consider updating this in multiple display systems
|
||||||
|
|
||||||
foreach (DisplayBase display in displays)
|
foreach (DisplayBase display in displays)
|
||||||
{
|
{
|
||||||
display.UsageTracker = new UsageTracking(display);
|
display.UsageTracker = new UsageTracking(display);
|
||||||
display.UsageTracker.UsageIsTracked = true;
|
display.UsageTracker.UsageIsTracked = true;
|
||||||
display.UsageTracker.DeviceUsageEnded += new EventHandler<DeviceUsageEventArgs>(UsageTracker_DeviceUsageEnded);
|
display.UsageTracker.DeviceUsageEnded += new EventHandler<DeviceUsageEventArgs>(UsageTracker_DeviceUsageEnded);
|
||||||
}
|
}
|
||||||
|
|
||||||
var defaultDisplay = (Room as EssentialsHuddleVtc1Room).DefaultDisplay as DisplayBase;
|
var defaultDisplay = (Room as EssentialsHuddleVtc1Room).DefaultDisplay as DisplayBase;
|
||||||
if (defaultDisplay == null)
|
if (defaultDisplay == null)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Cannot link null display to Fusion because default display is null");
|
Debug.Console(1, this, "Cannot link null display to Fusion because default display is null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var dispPowerOnAction = new Action<bool>(b => { if (!b) defaultDisplay.PowerOn(); });
|
var dispPowerOnAction = new Action<bool>(b => { if (!b) defaultDisplay.PowerOn(); });
|
||||||
var dispPowerOffAction = new Action<bool>(b => { if (!b) defaultDisplay.PowerOff(); });
|
var dispPowerOffAction = new Action<bool>(b => { if (!b) defaultDisplay.PowerOff(); });
|
||||||
|
|
||||||
// Display to fusion room sigs
|
// Display to fusion room sigs
|
||||||
FusionRoom.DisplayPowerOn.OutputSig.UserObject = dispPowerOnAction;
|
FusionRoom.DisplayPowerOn.OutputSig.UserObject = dispPowerOnAction;
|
||||||
FusionRoom.DisplayPowerOff.OutputSig.UserObject = dispPowerOffAction;
|
FusionRoom.DisplayPowerOff.OutputSig.UserObject = dispPowerOffAction;
|
||||||
defaultDisplay.PowerIsOnFeedback.LinkInputSig(FusionRoom.DisplayPowerOn.InputSig);
|
defaultDisplay.PowerIsOnFeedback.LinkInputSig(FusionRoom.DisplayPowerOn.InputSig);
|
||||||
if (defaultDisplay is IDisplayUsage)
|
if (defaultDisplay is IDisplayUsage)
|
||||||
(defaultDisplay as IDisplayUsage).LampHours.LinkInputSig(FusionRoom.DisplayUsage.InputSig);
|
(defaultDisplay as IDisplayUsage).LampHours.LinkInputSig(FusionRoom.DisplayUsage.InputSig);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MapDisplayToRoomJoins(1, 158, defaultDisplay);
|
MapDisplayToRoomJoins(1, 158, defaultDisplay);
|
||||||
|
|
||||||
|
|
||||||
var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(d => d.Key.Equals(defaultDisplay.Key));
|
var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(d => d.Key.Equals(defaultDisplay.Key));
|
||||||
|
|
||||||
//Check for existing asset in GUIDs collection
|
//Check for existing asset in GUIDs collection
|
||||||
|
|
||||||
var tempAsset = new FusionAsset();
|
var tempAsset = new FusionAsset();
|
||||||
|
|
||||||
if (FusionStaticAssets.ContainsKey(deviceConfig.Uid))
|
if (FusionStaticAssets.ContainsKey(deviceConfig.Uid))
|
||||||
{
|
{
|
||||||
tempAsset = FusionStaticAssets[deviceConfig.Uid];
|
tempAsset = FusionStaticAssets[deviceConfig.Uid];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Create a new asset
|
// Create a new asset
|
||||||
tempAsset = new FusionAsset(FusionRoomGuids.GetNextAvailableAssetNumber(FusionRoom), defaultDisplay.Name, "Display", "");
|
tempAsset = new FusionAsset(FusionRoomGuids.GetNextAvailableAssetNumber(FusionRoom), defaultDisplay.Name, "Display", "");
|
||||||
FusionStaticAssets.Add(deviceConfig.Uid, tempAsset);
|
FusionStaticAssets.Add(deviceConfig.Uid, tempAsset);
|
||||||
}
|
}
|
||||||
|
|
||||||
var dispAsset = FusionRoom.CreateStaticAsset(tempAsset.SlotNumber, tempAsset.Name, "Display", tempAsset.InstanceId);
|
var dispAsset = FusionRoom.CreateStaticAsset(tempAsset.SlotNumber, tempAsset.Name, "Display", tempAsset.InstanceId);
|
||||||
dispAsset.PowerOn.OutputSig.UserObject = dispPowerOnAction;
|
dispAsset.PowerOn.OutputSig.UserObject = dispPowerOnAction;
|
||||||
dispAsset.PowerOff.OutputSig.UserObject = dispPowerOffAction;
|
dispAsset.PowerOff.OutputSig.UserObject = dispPowerOffAction;
|
||||||
defaultDisplay.PowerIsOnFeedback.LinkInputSig(dispAsset.PowerOn.InputSig);
|
defaultDisplay.PowerIsOnFeedback.LinkInputSig(dispAsset.PowerOn.InputSig);
|
||||||
// NO!! display.PowerIsOn.LinkComplementInputSig(dispAsset.PowerOff.InputSig);
|
// NO!! display.PowerIsOn.LinkComplementInputSig(dispAsset.PowerOff.InputSig);
|
||||||
// Use extension methods
|
// Use extension methods
|
||||||
dispAsset.TrySetMakeModel(defaultDisplay);
|
dispAsset.TrySetMakeModel(defaultDisplay);
|
||||||
dispAsset.TryLinkAssetErrorToCommunication(defaultDisplay);
|
dispAsset.TryLinkAssetErrorToCommunication(defaultDisplay);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Error setting up display in Fusion: {0}", e);
|
Debug.Console(1, this, "Error setting up display in Fusion: {0}", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void MapDisplayToRoomJoins(int displayIndex, int joinOffset, DisplayBase display)
|
protected override void MapDisplayToRoomJoins(int displayIndex, int joinOffset, DisplayBase display)
|
||||||
{
|
{
|
||||||
string displayName = string.Format("Display {0} - ", displayIndex);
|
string displayName = string.Format("Display {0} - ", displayIndex);
|
||||||
|
|
||||||
|
|
||||||
if (display == (Room as EssentialsHuddleVtc1Room).DefaultDisplay)
|
if (display == (Room as EssentialsHuddleVtc1Room).DefaultDisplay)
|
||||||
{
|
{
|
||||||
// Power on
|
// Power on
|
||||||
var defaultDisplayPowerOn = FusionRoom.CreateOffsetBoolSig((uint)joinOffset, displayName + "Power On", eSigIoMask.InputOutputSig);
|
var defaultDisplayPowerOn = FusionRoom.CreateOffsetBoolSig((uint)joinOffset, displayName + "Power On", eSigIoMask.InputOutputSig);
|
||||||
defaultDisplayPowerOn.OutputSig.UserObject = new Action<bool>(b => { if (!b) display.PowerOn(); });
|
defaultDisplayPowerOn.OutputSig.UserObject = new Action<bool>(b => { if (!b) display.PowerOn(); });
|
||||||
display.PowerIsOnFeedback.LinkInputSig(defaultDisplayPowerOn.InputSig);
|
display.PowerIsOnFeedback.LinkInputSig(defaultDisplayPowerOn.InputSig);
|
||||||
|
|
||||||
// Power Off
|
// Power Off
|
||||||
var defaultDisplayPowerOff = FusionRoom.CreateOffsetBoolSig((uint)joinOffset + 1, displayName + "Power Off", eSigIoMask.InputOutputSig);
|
var defaultDisplayPowerOff = FusionRoom.CreateOffsetBoolSig((uint)joinOffset + 1, displayName + "Power Off", eSigIoMask.InputOutputSig);
|
||||||
defaultDisplayPowerOn.OutputSig.UserObject = new Action<bool>(b => { if (!b) display.PowerOff(); }); ;
|
defaultDisplayPowerOn.OutputSig.UserObject = new Action<bool>(b => { if (!b) display.PowerOff(); }); ;
|
||||||
display.PowerIsOnFeedback.LinkInputSig(defaultDisplayPowerOn.InputSig);
|
display.PowerIsOnFeedback.LinkInputSig(defaultDisplayPowerOn.InputSig);
|
||||||
|
|
||||||
// Current Source
|
// Current Source
|
||||||
var defaultDisplaySourceNone = FusionRoom.CreateOffsetBoolSig((uint)joinOffset + 8, displayName + "Source None", eSigIoMask.InputOutputSig);
|
var defaultDisplaySourceNone = FusionRoom.CreateOffsetBoolSig((uint)joinOffset + 8, displayName + "Source None", eSigIoMask.InputOutputSig);
|
||||||
defaultDisplaySourceNone.OutputSig.UserObject = new Action<bool>(b => { if (!b) (Room as EssentialsHuddleVtc1Room).RunRouteAction("roomOff"); }); ;
|
defaultDisplaySourceNone.OutputSig.UserObject = new Action<bool>(b => { if (!b) (Room as EssentialsHuddleVtc1Room).RunRouteAction("roomOff"); }); ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,102 +1,119 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using PepperDash.Core;
|
using Newtonsoft.Json.Linq;
|
||||||
using PepperDash.Essentials.Core;
|
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Room.Behaviours;
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
namespace PepperDash.Essentials.Fusion
|
using PepperDash.Essentials.Core.Devices;
|
||||||
{
|
using PepperDash.Essentials.Room.Behaviours;
|
||||||
/// <summary>
|
|
||||||
/// Handles mapping Fusion Custom Property values to system properties
|
namespace PepperDash.Essentials.Fusion
|
||||||
/// </summary>
|
{
|
||||||
public class FusionCustomPropertiesBridge
|
/// <summary>
|
||||||
{
|
/// Handles mapping Fusion Custom Property values to system properties
|
||||||
|
/// </summary>
|
||||||
/// <summary>
|
public class FusionCustomPropertiesBridge
|
||||||
/// Evaluates the room info and custom properties from Fusion and updates the system properties aa needed
|
{
|
||||||
/// </summary>
|
|
||||||
/// <param name="roomInfo"></param>
|
/// <summary>
|
||||||
public void EvaluateRoomInfo(string roomKey, RoomInformation roomInfo)
|
/// Evaluates the room info and custom properties from Fusion and updates the system properties aa needed
|
||||||
{
|
/// </summary>
|
||||||
var runtimeConfigurableDevices = DeviceManager.AllDevices.Where(d => d is IRuntimeConfigurableDevice);
|
/// <param name="roomInfo"></param>
|
||||||
|
public void EvaluateRoomInfo(string roomKey, RoomInformation roomInfo)
|
||||||
try
|
{
|
||||||
{
|
try
|
||||||
foreach (var device in runtimeConfigurableDevices)
|
{
|
||||||
{
|
var reconfigurableDevices = DeviceManager.AllDevices.Where(d => d is ReconfigurableDevice);
|
||||||
// Get the current device config so new values can be overwritten over existing
|
|
||||||
var deviceConfig = (device as IRuntimeConfigurableDevice).GetDeviceConfig();
|
foreach (var device in reconfigurableDevices)
|
||||||
|
{
|
||||||
if (device is RoomOnToDefaultSourceWhenOccupied)
|
// Get the current device config so new values can be overwritten over existing
|
||||||
{
|
var deviceConfig = (device as ReconfigurableDevice).Config;
|
||||||
var devConfig = (deviceConfig as RoomOnToDefaultSourceWhenOccupiedConfig);
|
|
||||||
|
if (device is RoomOnToDefaultSourceWhenOccupied)
|
||||||
var enableFeature = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupied"));
|
{
|
||||||
if (enableFeature != null)
|
Debug.Console(1, "Mapping Room on via Occupancy values from Fusion");
|
||||||
devConfig.EnableRoomOnWhenOccupied = bool.Parse(enableFeature.CustomFieldValue);
|
|
||||||
|
var devProps = JsonConvert.DeserializeObject<RoomOnToDefaultSourceWhenOccupiedConfig>(deviceConfig.Properties.ToString());
|
||||||
var enableTime = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("RoomOnWhenOccupiedStartTime"));
|
|
||||||
if (enableTime != null)
|
var enableFeature = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupied"));
|
||||||
devConfig.OccupancyStartTime = enableTime.CustomFieldValue;
|
if (enableFeature != null)
|
||||||
|
devProps.EnableRoomOnWhenOccupied = bool.Parse(enableFeature.CustomFieldValue);
|
||||||
var disableTime = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("RoomOnWhenOccupiedEndTime"));
|
|
||||||
if (disableTime != null)
|
var enableTime = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("RoomOnWhenOccupiedStartTime"));
|
||||||
devConfig.OccupancyEndTime = disableTime.CustomFieldValue;
|
if (enableTime != null)
|
||||||
|
devProps.OccupancyStartTime = enableTime.CustomFieldValue;
|
||||||
var enableSunday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedSun"));
|
|
||||||
if (enableSunday != null)
|
var disableTime = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("RoomOnWhenOccupiedEndTime"));
|
||||||
devConfig.EnableSunday = bool.Parse(enableSunday.CustomFieldValue);
|
if (disableTime != null)
|
||||||
|
devProps.OccupancyEndTime = disableTime.CustomFieldValue;
|
||||||
var enableMonday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedMon"));
|
|
||||||
if (enableMonday != null)
|
var enableSunday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedSun"));
|
||||||
devConfig.EnableMonday = bool.Parse(enableMonday.CustomFieldValue);
|
if (enableSunday != null)
|
||||||
|
devProps.EnableSunday = bool.Parse(enableSunday.CustomFieldValue);
|
||||||
var enableTuesday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedTue"));
|
|
||||||
if (enableTuesday != null)
|
var enableMonday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedMon"));
|
||||||
devConfig.EnableTuesday = bool.Parse(enableTuesday.CustomFieldValue);
|
if (enableMonday != null)
|
||||||
|
devProps.EnableMonday = bool.Parse(enableMonday.CustomFieldValue);
|
||||||
var enableWednesday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedWed"));
|
|
||||||
if (enableWednesday != null)
|
var enableTuesday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedTue"));
|
||||||
devConfig.EnableWednesday = bool.Parse(enableWednesday.CustomFieldValue);
|
if (enableTuesday != null)
|
||||||
|
devProps.EnableTuesday = bool.Parse(enableTuesday.CustomFieldValue);
|
||||||
var enableThursday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedThu"));
|
|
||||||
if (enableThursday != null)
|
var enableWednesday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedWed"));
|
||||||
devConfig.EnableThursday = bool.Parse(enableThursday.CustomFieldValue);
|
if (enableWednesday != null)
|
||||||
|
devProps.EnableWednesday = bool.Parse(enableWednesday.CustomFieldValue);
|
||||||
var enableFriday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedFri"));
|
|
||||||
if (enableFriday != null)
|
var enableThursday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedThu"));
|
||||||
devConfig.EnableFriday = bool.Parse(enableFriday.CustomFieldValue);
|
if (enableThursday != null)
|
||||||
|
devProps.EnableThursday = bool.Parse(enableThursday.CustomFieldValue);
|
||||||
var enableSaturday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedSat"));
|
|
||||||
if (enableSaturday != null)
|
var enableFriday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedFri"));
|
||||||
devConfig.EnableSaturday = bool.Parse(enableSaturday.CustomFieldValue);
|
if (enableFriday != null)
|
||||||
|
devProps.EnableFriday = bool.Parse(enableFriday.CustomFieldValue);
|
||||||
deviceConfig = devConfig;
|
|
||||||
}
|
var enableSaturday = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("EnRoomOnWhenOccupiedSat"));
|
||||||
|
if (enableSaturday != null)
|
||||||
// Set the config on the device
|
devProps.EnableSaturday = bool.Parse(enableSaturday.CustomFieldValue);
|
||||||
(device as IRuntimeConfigurableDevice).SetDeviceConfig(deviceConfig);
|
|
||||||
}
|
deviceConfig.Properties = JToken.FromObject(devProps);
|
||||||
|
}
|
||||||
//var roomConfig = ConfigReader.ConfigObject.Rooms.FirstOrDefault(r => r.Key.Equals(roomKey);
|
else if (device is EssentialsRoomBase)
|
||||||
|
{
|
||||||
//if(roomConfig != null)
|
// Set the room name
|
||||||
//{
|
if (!string.IsNullOrEmpty(roomInfo.Name))
|
||||||
// roomConfig.Name = roomInfo.Name;
|
{
|
||||||
|
Debug.Console(1, "Current Room Name: {0}. New Room Name: {1}", deviceConfig.Name, roomInfo.Name);
|
||||||
// // Update HelpMessage in room properties
|
// Set the name in config
|
||||||
// roomConfig.Properties.
|
deviceConfig.Name = roomInfo.Name;
|
||||||
//}
|
|
||||||
}
|
Debug.Console(1, "Room Name Successfully Changed.");
|
||||||
catch (Exception e)
|
}
|
||||||
{
|
|
||||||
Debug.Console(1, "FusionCustomPropetiesBridge: Error mapping properties: {0}", e);
|
// Set the help message
|
||||||
}
|
var helpMessage = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("RoomHelpMessage"));
|
||||||
}
|
if (helpMessage != null)
|
||||||
}
|
{
|
||||||
|
//Debug.Console(1, "Current Help Message: {0}. New Help Message: {1}", deviceConfig.Properties["help"]["message"].Value<string>(ToString()), helpMessage.CustomFieldValue);
|
||||||
|
deviceConfig.Properties["helpMessage"] = (string)helpMessage.CustomFieldValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the config on the device
|
||||||
|
(device as ReconfigurableDevice).SetConfig(deviceConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.Console(1, "FusionCustomPropetiesBridge: Error mapping properties: {0}", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -87,9 +87,7 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
else if (typeName == "roomonwhenoccupancydetectedfeature")
|
else if (typeName == "roomonwhenoccupancydetectedfeature")
|
||||||
{
|
{
|
||||||
var props = JsonConvert.DeserializeObject<Room.Behaviours.RoomOnToDefaultSourceWhenOccupiedConfig>(properties.ToString());
|
return new Room.Behaviours.RoomOnToDefaultSourceWhenOccupied(dc);
|
||||||
|
|
||||||
return new Room.Behaviours.RoomOnToDefaultSourceWhenOccupied(key, props);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -49,12 +49,12 @@ namespace PepperDash.Essentials
|
|||||||
avDriver.CurrentRoom = room as EssentialsHuddleSpaceRoom;
|
avDriver.CurrentRoom = room as EssentialsHuddleSpaceRoom;
|
||||||
|
|
||||||
// Environment Driver
|
// Environment Driver
|
||||||
if (avDriver.CurrentRoom.Config.Environment != null && avDriver.CurrentRoom.Config.Environment.DeviceKeys.Count > 0)
|
if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0)
|
||||||
{
|
{
|
||||||
Debug.Console(0, panelController, "Adding environment driver");
|
Debug.Console(0, panelController, "Adding environment driver");
|
||||||
mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props);
|
mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props);
|
||||||
|
|
||||||
mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.Config.Environment);
|
mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment);
|
||||||
}
|
}
|
||||||
|
|
||||||
mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom);
|
mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom);
|
||||||
@@ -118,12 +118,12 @@ namespace PepperDash.Essentials
|
|||||||
avDriver.CurrentRoom = room as EssentialsHuddleVtc1Room;
|
avDriver.CurrentRoom = room as EssentialsHuddleVtc1Room;
|
||||||
|
|
||||||
// Environment Driver
|
// Environment Driver
|
||||||
if (avDriver.CurrentRoom.Config.Environment != null && avDriver.CurrentRoom.Config.Environment.DeviceKeys.Count > 0)
|
if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0)
|
||||||
{
|
{
|
||||||
Debug.Console(0, panelController, "Adding environment driver");
|
Debug.Console(0, panelController, "Adding environment driver");
|
||||||
mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props);
|
mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props);
|
||||||
|
|
||||||
mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.Config.Environment);
|
mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment);
|
||||||
}
|
}
|
||||||
|
|
||||||
mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom);
|
mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom);
|
||||||
|
|||||||
@@ -101,17 +101,33 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SimplSharpTimerEventInterface, Version=1.0.6197.20052, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
<Reference Include="SimplSharpTimerEventInterface, Version=1.0.6197.20052, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpTimerEventInterface.dll</HintPath>
|
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpTimerEventInterface.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="AppServer\Messengers\AtcDdvc01Messenger.cs" />
|
||||||
|
<Compile Include="AppServer\Messengers\AudioCodecBaseMessenger.cs" />
|
||||||
|
<Compile Include="AppServer\Messengers\MessengerBase.cs" />
|
||||||
|
<Compile Include="AppServer\Messengers\SystemMonitorMessenger.cs" />
|
||||||
<Compile Include="AppServer\Messengers\VideoCodecBaseMessenger.cs" />
|
<Compile Include="AppServer\Messengers\VideoCodecBaseMessenger.cs" />
|
||||||
<Compile Include="Audio\EssentialsVolumeLevelConfig.cs" />
|
<Compile Include="Audio\EssentialsVolumeLevelConfig.cs" />
|
||||||
<Compile Include="Bridges\BridgeBase.cs" />
|
<Compile Include="Bridges\BridgeBase.cs" />
|
||||||
<Compile Include="Bridges\BridgeFactory.cs" />
|
<Compile Include="Bridges\BridgeFactory.cs" />
|
||||||
|
<Compile Include="Bridges\CameraControllerBridge.cs" />
|
||||||
|
<Compile Include="Bridges\DisplayControllerBridge.cs" />
|
||||||
|
<Compile Include="Bridges\DigitalLoggerBridge.cs" />
|
||||||
|
<Compile Include="Bridges\DmChassisControllerBridge.cs" />
|
||||||
|
<Compile Include="Bridges\DmTxControllerBridge.cs" />
|
||||||
|
<Compile Include="Bridges\GenericLightingBridge.cs" />
|
||||||
|
<Compile Include="Bridges\GenericRelayDeviceBridge.cs" />
|
||||||
|
<Compile Include="Bridges\IBasicCommunicationBridge.cs" />
|
||||||
|
<Compile Include="Bridges\DmRmcControllerBridge.cs" />
|
||||||
|
<Compile Include="Bridges\IDigitalInputBridge.cs" />
|
||||||
|
<Compile Include="Bridges\JoinMapBase.cs" />
|
||||||
|
<Compile Include="Bridges\SystemMonitorBridge.cs" />
|
||||||
<Compile Include="Configuration ORIGINAL\Builders\TPConfig.cs" />
|
<Compile Include="Configuration ORIGINAL\Builders\TPConfig.cs" />
|
||||||
<Compile Include="Configuration ORIGINAL\Configuration.cs" />
|
<Compile Include="Configuration ORIGINAL\Configuration.cs" />
|
||||||
<Compile Include="Configuration ORIGINAL\ConfigurationHelpers.cs" />
|
<Compile Include="Configuration ORIGINAL\ConfigurationHelpers.cs" />
|
||||||
@@ -132,13 +148,13 @@
|
|||||||
<Compile Include="Devices\NUMERIC AppleTV.cs" />
|
<Compile Include="Devices\NUMERIC AppleTV.cs" />
|
||||||
<Compile Include="ControlSystem.cs" />
|
<Compile Include="ControlSystem.cs" />
|
||||||
<Compile Include="Factory\UiDeviceFactory.cs" />
|
<Compile Include="Factory\UiDeviceFactory.cs" />
|
||||||
<Compile Include="OTHER\Fusion\EssentialsHuddleVtc1FusionController.cs" />
|
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\EssentialsHuddleVtc1FusionController.cs" />
|
||||||
<Compile Include="OTHER\Fusion\FusionCustomPropertiesBridge.cs" />
|
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\FusionCustomPropertiesBridge.cs" />
|
||||||
<Compile Include="OTHER\Fusion\FusionEventHandlers.cs" />
|
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\FusionEventHandlers.cs" />
|
||||||
<Compile Include="OTHER\Fusion\FusionProcessorQueries.cs" />
|
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\FusionProcessorQueries.cs" />
|
||||||
<Compile Include="OTHER\Fusion\FusionRviDataClasses.cs" />
|
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\FusionRviDataClasses.cs" />
|
||||||
<Compile Include="REMOVE EssentialsApp.cs" />
|
<Compile Include="REMOVE EssentialsApp.cs" />
|
||||||
<Compile Include="OTHER\Fusion\EssentialsHuddleSpaceFusionSystemControllerBase.cs" />
|
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\EssentialsHuddleSpaceFusionSystemControllerBase.cs" />
|
||||||
<Compile Include="HttpApiHandler.cs" />
|
<Compile Include="HttpApiHandler.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Room\Behaviours\RoomOnToDefaultSourceWhenOccupied.cs" />
|
<Compile Include="Room\Behaviours\RoomOnToDefaultSourceWhenOccupied.cs" />
|
||||||
|
|||||||
@@ -4,5 +4,5 @@
|
|||||||
[assembly: AssemblyCompany("PepperDash Technology Corp")]
|
[assembly: AssemblyCompany("PepperDash Technology Corp")]
|
||||||
[assembly: AssemblyProduct("PepperDashEssentials")]
|
[assembly: AssemblyProduct("PepperDashEssentials")]
|
||||||
[assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2018")]
|
[assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2018")]
|
||||||
[assembly: AssemblyVersion("1.2.6.*")]
|
[assembly: AssemblyVersion("1.3.1.*")]
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ControlSystem>
|
<ControlSystem>
|
||||||
<Name>Test RMC3</Name>
|
<Name>192.168.10.1</Name>
|
||||||
<Address>auto 192.168.1.40</Address>
|
<Address>auto 192.168.10.1</Address>
|
||||||
<ProgramSlot>Program01</ProgramSlot>
|
<ProgramSlot>Program01</ProgramSlot>
|
||||||
<Storage>Internal Flash</Storage>
|
<Storage>Internal Flash</Storage>
|
||||||
</ControlSystem>
|
</ControlSystem>
|
||||||
@@ -11,6 +11,7 @@ using Newtonsoft.Json.Linq;
|
|||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
using PepperDash.Essentials.Core.Devices;
|
||||||
using PepperDash.Essentials.Devices.Common.Occupancy;
|
using PepperDash.Essentials.Devices.Common.Occupancy;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Room.Behaviours
|
namespace PepperDash.Essentials.Room.Behaviours
|
||||||
@@ -18,9 +19,9 @@ namespace PepperDash.Essentials.Room.Behaviours
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A device that when linked to a room can power the room on when enabled during scheduled hours.
|
/// A device that when linked to a room can power the room on when enabled during scheduled hours.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class RoomOnToDefaultSourceWhenOccupied : Device, IRuntimeConfigurableDevice
|
public class RoomOnToDefaultSourceWhenOccupied : ReconfigurableDevice
|
||||||
{
|
{
|
||||||
RoomOnToDefaultSourceWhenOccupiedConfig Config;
|
RoomOnToDefaultSourceWhenOccupiedConfig PropertiesConfig;
|
||||||
|
|
||||||
public bool FeatureEnabled { get; private set; }
|
public bool FeatureEnabled { get; private set; }
|
||||||
|
|
||||||
@@ -42,10 +43,10 @@ namespace PepperDash.Essentials.Room.Behaviours
|
|||||||
|
|
||||||
private Fusion.EssentialsHuddleSpaceFusionSystemControllerBase FusionRoom;
|
private Fusion.EssentialsHuddleSpaceFusionSystemControllerBase FusionRoom;
|
||||||
|
|
||||||
public RoomOnToDefaultSourceWhenOccupied(string key, RoomOnToDefaultSourceWhenOccupiedConfig config)
|
public RoomOnToDefaultSourceWhenOccupied(DeviceConfig config) :
|
||||||
: base(key)
|
base (config)
|
||||||
{
|
{
|
||||||
Config = config;
|
PropertiesConfig = JsonConvert.DeserializeObject<RoomOnToDefaultSourceWhenOccupiedConfig>(config.Properties.ToString());
|
||||||
|
|
||||||
FeatureEventGroup = new ScheduledEventGroup(this.Key);
|
FeatureEventGroup = new ScheduledEventGroup(this.Key);
|
||||||
|
|
||||||
@@ -63,7 +64,7 @@ namespace PepperDash.Essentials.Room.Behaviours
|
|||||||
else
|
else
|
||||||
Debug.Console(1, this, "Room has no RoomOccupancy object set");
|
Debug.Console(1, this, "Room has no RoomOccupancy object set");
|
||||||
|
|
||||||
var fusionRoomKey = Config.RoomKey + "-fusion";
|
var fusionRoomKey = PropertiesConfig.RoomKey + "-fusion";
|
||||||
|
|
||||||
FusionRoom = DeviceManager.GetDeviceForKey(fusionRoomKey) as Fusion.EssentialsHuddleSpaceFusionSystemControllerBase;
|
FusionRoom = DeviceManager.GetDeviceForKey(fusionRoomKey) as Fusion.EssentialsHuddleSpaceFusionSystemControllerBase;
|
||||||
|
|
||||||
@@ -79,45 +80,48 @@ namespace PepperDash.Essentials.Room.Behaviours
|
|||||||
return base.CustomActivate();
|
return base.CustomActivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets up device based on config values
|
||||||
|
/// </summary>
|
||||||
void SetUpDevice()
|
void SetUpDevice()
|
||||||
{
|
{
|
||||||
Room = DeviceManager.GetDeviceForKey(Config.RoomKey) as EssentialsRoomBase;
|
Room = DeviceManager.GetDeviceForKey(PropertiesConfig.RoomKey) as EssentialsRoomBase;
|
||||||
|
|
||||||
if (Room != null)
|
if (Room != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FeatureEnabledTime = DateTime.Parse(Config.OccupancyStartTime);
|
FeatureEnabledTime = DateTime.Parse(PropertiesConfig.OccupancyStartTime);
|
||||||
|
|
||||||
if (FeatureEnabledTime != null)
|
if (FeatureEnabledTime != null)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Enabled Time: {0}", FeatureEnabledTime.ToString());
|
Debug.Console(1, this, "Enabled Time: {0}", FeatureEnabledTime.ToString());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Debug.Console(1, this, "Unable to parse {0} to DateTime", Config.OccupancyStartTime);
|
Debug.Console(1, this, "Unable to parse {0} to DateTime", PropertiesConfig.OccupancyStartTime);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Unable to parse OccupancyStartTime property: {0} \n Error: {1}", Config.OccupancyStartTime, e);
|
Debug.Console(1, this, "Unable to parse OccupancyStartTime property: {0} \n Error: {1}", PropertiesConfig.OccupancyStartTime, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FeatureDisabledTime = DateTime.Parse(Config.OccupancyEndTime);
|
FeatureDisabledTime = DateTime.Parse(PropertiesConfig.OccupancyEndTime);
|
||||||
|
|
||||||
if (FeatureDisabledTime != null)
|
if (FeatureDisabledTime != null)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Disabled Time: {0}", FeatureDisabledTime.ToString());
|
Debug.Console(1, this, "Disabled Time: {0}", FeatureDisabledTime.ToString());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Debug.Console(1, this, "Unable to parse {0} to DateTime", Config.OccupancyEndTime);
|
Debug.Console(1, this, "Unable to parse {0} to DateTime", PropertiesConfig.OccupancyEndTime);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Unable to parse a DateTime config value \n Error: {1}", e);
|
Debug.Console(1, this, "Unable to parse a DateTime config value \n Error: {1}", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Config.EnableRoomOnWhenOccupied)
|
if (!PropertiesConfig.EnableRoomOnWhenOccupied)
|
||||||
FeatureEventGroup.ClearAllEvents();
|
FeatureEventGroup.ClearAllEvents();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -133,30 +137,18 @@ namespace PepperDash.Essentials.Room.Behaviours
|
|||||||
FeatureEnabled = CheckIfFeatureShouldBeEnabled();
|
FeatureEnabled = CheckIfFeatureShouldBeEnabled();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Debug.Console(1, this, "Unable to get room from Device Manager with key: {0}", Config.RoomKey);
|
Debug.Console(1, this, "Unable to get room from Device Manager with key: {0}", PropertiesConfig.RoomKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns a JObject of the device config properties as they currently exist at runtime
|
protected override void CustomSetConfig(DeviceConfig config)
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public JToken GetLocalConfigProperties()
|
|
||||||
{
|
{
|
||||||
return JToken.FromObject(Config);
|
var newPropertiesConfig = JsonConvert.DeserializeObject<RoomOnToDefaultSourceWhenOccupiedConfig>(config.Properties.ToString());
|
||||||
}
|
|
||||||
|
|
||||||
public object GetDeviceConfig()
|
if(newPropertiesConfig != null)
|
||||||
{
|
PropertiesConfig = newPropertiesConfig;
|
||||||
return Config;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetDeviceConfig(object config)
|
ConfigWriter.UpdateDeviceConfig(config);
|
||||||
{
|
|
||||||
var newConfig = config as RoomOnToDefaultSourceWhenOccupiedConfig;
|
|
||||||
|
|
||||||
Config = newConfig;
|
|
||||||
|
|
||||||
ConfigWriter.UpdateDeviceProperties(this.Key, GetLocalConfigProperties());
|
|
||||||
|
|
||||||
SetUpDevice();
|
SetUpDevice();
|
||||||
}
|
}
|
||||||
@@ -182,7 +174,7 @@ namespace PepperDash.Essentials.Room.Behaviours
|
|||||||
{
|
{
|
||||||
if (SchEvent.Name == FeatureEnableEventName)
|
if (SchEvent.Name == FeatureEnableEventName)
|
||||||
{
|
{
|
||||||
if (Config.EnableRoomOnWhenOccupied)
|
if (PropertiesConfig.EnableRoomOnWhenOccupied)
|
||||||
FeatureEnabled = true;
|
FeatureEnabled = true;
|
||||||
|
|
||||||
Debug.Console(1, this, "*****Feature Enabled by event.*****");
|
Debug.Console(1, this, "*****Feature Enabled by event.*****");
|
||||||
@@ -204,7 +196,7 @@ namespace PepperDash.Essentials.Room.Behaviours
|
|||||||
{
|
{
|
||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
|
|
||||||
if(Config.EnableRoomOnWhenOccupied)
|
if(PropertiesConfig.EnableRoomOnWhenOccupied)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Current Time: {0} \n FeatureEnabledTime: {1} \n FeatureDisabledTime: {2}", DateTime.Now, FeatureEnabledTime, FeatureDisabledTime);
|
Debug.Console(1, this, "Current Time: {0} \n FeatureEnabledTime: {1} \n FeatureDisabledTime: {2}", DateTime.Now, FeatureEnabledTime, FeatureDisabledTime);
|
||||||
|
|
||||||
@@ -446,19 +438,19 @@ namespace PepperDash.Essentials.Room.Behaviours
|
|||||||
{
|
{
|
||||||
ScheduledEventCommon.eWeekDays value = new ScheduledEventCommon.eWeekDays();
|
ScheduledEventCommon.eWeekDays value = new ScheduledEventCommon.eWeekDays();
|
||||||
|
|
||||||
if (Config.EnableSunday)
|
if (PropertiesConfig.EnableSunday)
|
||||||
value = value | ScheduledEventCommon.eWeekDays.Sunday;
|
value = value | ScheduledEventCommon.eWeekDays.Sunday;
|
||||||
if (Config.EnableMonday)
|
if (PropertiesConfig.EnableMonday)
|
||||||
value = value | ScheduledEventCommon.eWeekDays.Monday;
|
value = value | ScheduledEventCommon.eWeekDays.Monday;
|
||||||
if (Config.EnableTuesday)
|
if (PropertiesConfig.EnableTuesday)
|
||||||
value = value | ScheduledEventCommon.eWeekDays.Tuesday;
|
value = value | ScheduledEventCommon.eWeekDays.Tuesday;
|
||||||
if (Config.EnableWednesday)
|
if (PropertiesConfig.EnableWednesday)
|
||||||
value = value | ScheduledEventCommon.eWeekDays.Wednesday;
|
value = value | ScheduledEventCommon.eWeekDays.Wednesday;
|
||||||
if (Config.EnableThursday)
|
if (PropertiesConfig.EnableThursday)
|
||||||
value = value | ScheduledEventCommon.eWeekDays.Thursday;
|
value = value | ScheduledEventCommon.eWeekDays.Thursday;
|
||||||
if (Config.EnableFriday)
|
if (PropertiesConfig.EnableFriday)
|
||||||
value = value | ScheduledEventCommon.eWeekDays.Friday;
|
value = value | ScheduledEventCommon.eWeekDays.Friday;
|
||||||
if (Config.EnableSaturday)
|
if (PropertiesConfig.EnableSaturday)
|
||||||
value = value | ScheduledEventCommon.eWeekDays.Saturday;
|
value = value | ScheduledEventCommon.eWeekDays.Saturday;
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
@@ -473,7 +465,7 @@ namespace PepperDash.Essentials.Room.Behaviours
|
|||||||
{
|
{
|
||||||
if (type == ScheduledEventCommon.eCallbackReason.NormalExpiration)
|
if (type == ScheduledEventCommon.eCallbackReason.NormalExpiration)
|
||||||
{
|
{
|
||||||
if(Config.EnableRoomOnWhenOccupied)
|
if(PropertiesConfig.EnableRoomOnWhenOccupied)
|
||||||
FeatureEnabled = true;
|
FeatureEnabled = true;
|
||||||
|
|
||||||
Debug.Console(1, this, "RoomOnToDefaultSourceWhenOccupied Feature Enabled.");
|
Debug.Console(1, this, "RoomOnToDefaultSourceWhenOccupied Feature Enabled.");
|
||||||
|
|||||||
@@ -20,5 +20,7 @@ namespace PepperDash.Essentials.Room.Config
|
|||||||
public string DefaultSourceItem { get; set; }
|
public string DefaultSourceItem { get; set; }
|
||||||
[JsonProperty("videoCodecKey")]
|
[JsonProperty("videoCodecKey")]
|
||||||
public string VideoCodecKey { get; set; }
|
public string VideoCodecKey { get; set; }
|
||||||
|
[JsonProperty("audioCodecKey")]
|
||||||
|
public string AudioCodecKey { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -24,64 +24,14 @@ namespace PepperDash.Essentials.Room.Config
|
|||||||
var typeName = roomConfig.Type.ToLower();
|
var typeName = roomConfig.Type.ToLower();
|
||||||
if (typeName == "huddle")
|
if (typeName == "huddle")
|
||||||
{
|
{
|
||||||
var props = JsonConvert.DeserializeObject<EssentialsHuddleRoomPropertiesConfig>
|
var huddle = new EssentialsHuddleSpaceRoom(roomConfig);
|
||||||
(roomConfig.Properties.ToString());
|
|
||||||
var disp = DeviceManager.GetDeviceForKey(props.DefaultDisplayKey) as IRoutingSinkWithSwitching;
|
|
||||||
var audio = DeviceManager.GetDeviceForKey(props.DefaultAudioKey) as IRoutingSinkNoSwitching;
|
|
||||||
var huddle = new EssentialsHuddleSpaceRoom(roomConfig.Key, roomConfig.Name, disp, audio, props);
|
|
||||||
|
|
||||||
if (props.Occupancy != null)
|
|
||||||
huddle.SetRoomOccupancy(DeviceManager.GetDeviceForKey(props.Occupancy.DeviceKey) as
|
|
||||||
PepperDash.Essentials.Devices.Common.Occupancy.IOccupancyStatusProvider, props.Occupancy.TimoutMinutes);
|
|
||||||
huddle.LogoUrl = props.Logo.GetUrl();
|
|
||||||
huddle.SourceListKey = props.SourceListKey;
|
|
||||||
huddle.DefaultSourceItem = props.DefaultSourceItem;
|
|
||||||
huddle.DefaultVolume = (ushort)(props.Volumes.Master.Level * 65535 / 100);
|
|
||||||
return huddle;
|
return huddle;
|
||||||
}
|
}
|
||||||
//else if (typeName == "presentation")
|
|
||||||
//{
|
|
||||||
// var props = JsonConvert.DeserializeObject<EssentialsPresentationRoomPropertiesConfig>
|
|
||||||
// (this.Properties.ToString());
|
|
||||||
// var displaysDict = new Dictionary<uint, IRoutingSinkNoSwitching>();
|
|
||||||
// uint i = 1;
|
|
||||||
// foreach (var dispKey in props.DisplayKeys) // read in the ordered displays list
|
|
||||||
// {
|
|
||||||
// var disp = DeviceManager.GetDeviceForKey(dispKey) as IRoutingSinkWithSwitching;
|
|
||||||
// displaysDict.Add(i++, disp);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Get the master volume control
|
|
||||||
// IBasicVolumeWithFeedback masterVolumeControlDev = props.Volumes.Master.GetDevice();
|
|
||||||
|
|
||||||
|
|
||||||
// var presRoom = new EssentialsPresentationRoom(Key, Name, displaysDict, masterVolumeControlDev, props);
|
|
||||||
// return presRoom;
|
|
||||||
//}
|
|
||||||
else if (typeName == "huddlevtc1")
|
else if (typeName == "huddlevtc1")
|
||||||
{
|
{
|
||||||
var props = JsonConvert.DeserializeObject<EssentialsHuddleVtc1PropertiesConfig>
|
var rm = new EssentialsHuddleVtc1Room(roomConfig);
|
||||||
(roomConfig.Properties.ToString());
|
|
||||||
var disp = DeviceManager.GetDeviceForKey(props.DefaultDisplayKey) as IRoutingSinkWithSwitching;
|
|
||||||
|
|
||||||
var codec = DeviceManager.GetDeviceForKey(props.VideoCodecKey) as
|
|
||||||
PepperDash.Essentials.Devices.Common.VideoCodec.VideoCodecBase;
|
|
||||||
|
|
||||||
var rm = new EssentialsHuddleVtc1Room(roomConfig.Key, roomConfig.Name, disp, codec, codec, props);
|
|
||||||
// Add Occupancy object from config
|
|
||||||
|
|
||||||
if (props.Occupancy != null)
|
|
||||||
rm.SetRoomOccupancy(DeviceManager.GetDeviceForKey(props.Occupancy.DeviceKey) as
|
|
||||||
PepperDash.Essentials.Devices.Common.Occupancy.IOccupancyStatusProvider, props.Occupancy.TimoutMinutes);
|
|
||||||
rm.LogoUrl = props.Logo.GetUrl();
|
|
||||||
rm.SourceListKey = props.SourceListKey;
|
|
||||||
rm.DefaultSourceItem = props.DefaultSourceItem;
|
|
||||||
rm.DefaultVolume = (ushort)(props.Volumes.Master.Level * 65535 / 100);
|
|
||||||
|
|
||||||
rm.MicrophonePrivacy = GetMicrophonePrivacy(props, rm); // Get Microphone Privacy object, if any
|
|
||||||
|
|
||||||
rm.Emergency = GetEmergency(props, rm); // Get emergency object, if any
|
|
||||||
|
|
||||||
return rm;
|
return rm;
|
||||||
}
|
}
|
||||||
else if (typeName == "ddvc01Bridge")
|
else if (typeName == "ddvc01Bridge")
|
||||||
@@ -96,7 +46,7 @@ namespace PepperDash.Essentials.Room.Config
|
|||||||
/// Gets and operating, standalone emergegncy object that can be plugged into a room.
|
/// Gets and operating, standalone emergegncy object that can be plugged into a room.
|
||||||
/// Returns null if there is no emergency defined
|
/// Returns null if there is no emergency defined
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static EssentialsRoomEmergencyBase GetEmergency(EssentialsRoomPropertiesConfig props, EssentialsRoomBase room)
|
public static EssentialsRoomEmergencyBase GetEmergency(EssentialsRoomPropertiesConfig props, EssentialsRoomBase room)
|
||||||
{
|
{
|
||||||
// This emergency
|
// This emergency
|
||||||
var emergency = props.Emergency;
|
var emergency = props.Emergency;
|
||||||
@@ -115,7 +65,7 @@ namespace PepperDash.Essentials.Room.Config
|
|||||||
/// <param name="props"></param>
|
/// <param name="props"></param>
|
||||||
/// <param name="room"></param>
|
/// <param name="room"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
static PepperDash.Essentials.Devices.Common.Microphones.MicrophonePrivacyController GetMicrophonePrivacy(
|
public static PepperDash.Essentials.Devices.Common.Microphones.MicrophonePrivacyController GetMicrophonePrivacy(
|
||||||
EssentialsRoomPropertiesConfig props, EssentialsHuddleVtc1Room room)
|
EssentialsRoomPropertiesConfig props, EssentialsHuddleVtc1Room room)
|
||||||
{
|
{
|
||||||
var microphonePrivacy = props.MicrophonePrivacy;
|
var microphonePrivacy = props.MicrophonePrivacy;
|
||||||
@@ -322,8 +272,8 @@ namespace PepperDash.Essentials.Room.Config
|
|||||||
[JsonProperty("deviceKey")]
|
[JsonProperty("deviceKey")]
|
||||||
public string DeviceKey { get; set; }
|
public string DeviceKey { get; set; }
|
||||||
|
|
||||||
[JsonProperty("timoutMinutes")]
|
[JsonProperty("timeoutMinutes")]
|
||||||
public int TimoutMinutes { get; set; }
|
public int TimeoutMinutes { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EssentialsRoomTechConfig
|
public class EssentialsRoomTechConfig
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
@@ -66,7 +68,7 @@ namespace PepperDash.Essentials
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public EssentialsRoomPropertiesConfig Config { get; private set; }
|
public EssentialsHuddleRoomPropertiesConfig PropertiesConfig { get; private set; }
|
||||||
|
|
||||||
public IRoutingSinkWithSwitching DefaultDisplay { get; private set; }
|
public IRoutingSinkWithSwitching DefaultDisplay { get; private set; }
|
||||||
public IRoutingSinkNoSwitching DefaultAudioDevice { get; private set; }
|
public IRoutingSinkNoSwitching DefaultAudioDevice { get; private set; }
|
||||||
@@ -147,22 +149,32 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
public string CurrentSourceInfoKey { get; private set; }
|
public string CurrentSourceInfoKey { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
public EssentialsHuddleSpaceRoom(DeviceConfig config)
|
||||||
///
|
: base(config)
|
||||||
/// </summary>
|
{
|
||||||
/// <param name="key"></param>
|
try
|
||||||
/// <param name="name"></param>
|
{
|
||||||
public EssentialsHuddleSpaceRoom(string key, string name, IRoutingSinkWithSwitching defaultDisplay,
|
PropertiesConfig = JsonConvert.DeserializeObject<EssentialsHuddleRoomPropertiesConfig>
|
||||||
IRoutingSinkNoSwitching defaultAudio, EssentialsRoomPropertiesConfig config)
|
(config.Properties.ToString());
|
||||||
: base(key, name)
|
DefaultDisplay = DeviceManager.GetDeviceForKey(PropertiesConfig.DefaultDisplayKey) as IRoutingSinkWithSwitching;
|
||||||
|
|
||||||
|
|
||||||
|
DefaultAudioDevice = DeviceManager.GetDeviceForKey(PropertiesConfig.DefaultAudioKey) as IRoutingSinkWithSwitching;
|
||||||
|
|
||||||
|
Initialize();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, "Error building room: \n{0}", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Initialize()
|
||||||
{
|
{
|
||||||
Config = config;
|
if (DefaultAudioDevice is IBasicVolumeControls)
|
||||||
DefaultDisplay = defaultDisplay;
|
DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls;
|
||||||
DefaultAudioDevice = defaultAudio;
|
else if (DefaultAudioDevice is IHasVolumeDevice)
|
||||||
if (defaultAudio is IBasicVolumeControls)
|
DefaultVolumeControls = (DefaultAudioDevice as IHasVolumeDevice).VolumeDevice;
|
||||||
DefaultVolumeControls = defaultAudio as IBasicVolumeControls;
|
|
||||||
else if (defaultAudio is IHasVolumeDevice)
|
|
||||||
DefaultVolumeControls = (defaultAudio as IHasVolumeDevice).VolumeDevice;
|
|
||||||
CurrentVolumeControls = DefaultVolumeControls;
|
CurrentVolumeControls = DefaultVolumeControls;
|
||||||
|
|
||||||
var disp = DefaultDisplay as DisplayBase;
|
var disp = DefaultDisplay as DisplayBase;
|
||||||
@@ -195,6 +207,15 @@ namespace PepperDash.Essentials
|
|||||||
EnablePowerOnToLastSource = true;
|
EnablePowerOnToLastSource = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void CustomSetConfig(DeviceConfig config)
|
||||||
|
{
|
||||||
|
var newPropertiesConfig = JsonConvert.DeserializeObject<EssentialsHuddleRoomPropertiesConfig>(config.Properties.ToString());
|
||||||
|
|
||||||
|
if (newPropertiesConfig != null)
|
||||||
|
PropertiesConfig = newPropertiesConfig;
|
||||||
|
|
||||||
|
ConfigWriter.UpdateRoomConfig(config);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@@ -225,6 +246,21 @@ namespace PepperDash.Essentials
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool CustomActivate()
|
||||||
|
{
|
||||||
|
// Add Occupancy object from config
|
||||||
|
if (PropertiesConfig.Occupancy != null)
|
||||||
|
this.SetRoomOccupancy(DeviceManager.GetDeviceForKey(PropertiesConfig.Occupancy.DeviceKey) as
|
||||||
|
PepperDash.Essentials.Devices.Common.Occupancy.IOccupancyStatusProvider, PropertiesConfig.Occupancy.TimeoutMinutes);
|
||||||
|
|
||||||
|
this.LogoUrl = PropertiesConfig.Logo.GetUrl();
|
||||||
|
this.SourceListKey = PropertiesConfig.SourceListKey;
|
||||||
|
this.DefaultSourceItem = PropertiesConfig.DefaultSourceItem;
|
||||||
|
this.DefaultVolume = (ushort)(PropertiesConfig.Volumes.Master.Level * 65535 / 100);
|
||||||
|
|
||||||
|
return base.CustomActivate();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -7,6 +7,8 @@ using Crestron.SimplSharp.Scheduler;
|
|||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
using PepperDash.Essentials.Core.Devices;
|
||||||
using PepperDash.Essentials.Devices.Common.Occupancy;
|
using PepperDash.Essentials.Devices.Common.Occupancy;
|
||||||
|
|
||||||
namespace PepperDash.Essentials
|
namespace PepperDash.Essentials
|
||||||
@@ -14,7 +16,7 @@ namespace PepperDash.Essentials
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class EssentialsRoomBase : Device
|
public abstract class EssentialsRoomBase : ReconfigurableDevice
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@@ -80,12 +82,9 @@ namespace PepperDash.Essentials
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool ZeroVolumeWhenSwtichingVolumeDevices { get; private set; }
|
public bool ZeroVolumeWhenSwtichingVolumeDevices { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
public EssentialsRoomBase(DeviceConfig config)
|
||||||
/// </summary>
|
: base(config)
|
||||||
/// <param name="key"></param>
|
|
||||||
/// <param name="name"></param>
|
|
||||||
public EssentialsRoomBase(string key, string name) : base(key, name)
|
|
||||||
{
|
{
|
||||||
// Setup the ShutdownPromptTimer
|
// Setup the ShutdownPromptTimer
|
||||||
ShutdownPromptTimer = new SecondsCountdownTimer(Key + "-offTimer");
|
ShutdownPromptTimer = new SecondsCountdownTimer(Key + "-offTimer");
|
||||||
@@ -159,6 +158,8 @@ namespace PepperDash.Essentials
|
|||||||
ShutdownPromptTimer.SecondsToCount = ShutdownVacancySeconds;
|
ShutdownPromptTimer.SecondsToCount = ShutdownVacancySeconds;
|
||||||
ShutdownType = type;
|
ShutdownType = type;
|
||||||
ShutdownPromptTimer.Start();
|
ShutdownPromptTimer.Start();
|
||||||
|
|
||||||
|
Debug.Console(0, this, "ShutdwonPromptTimer Started. Type: {0}. Seconds: {1}", ShutdownType, ShutdownPromptTimer.SecondsToCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartRoomVacancyTimer(eVacancyMode mode)
|
public void StartRoomVacancyTimer(eVacancyMode mode)
|
||||||
@@ -170,7 +171,7 @@ namespace PepperDash.Essentials
|
|||||||
VacancyMode = mode;
|
VacancyMode = mode;
|
||||||
RoomVacancyShutdownTimer.Start();
|
RoomVacancyShutdownTimer.Start();
|
||||||
|
|
||||||
Debug.Console(0, this, "Vacancy Timer Started.");
|
Debug.Console(0, this, "Vacancy Timer Started. Mode: {0}. Seconds: {1}", VacancyMode, RoomVacancyShutdownTimer.SecondsToCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -199,7 +200,7 @@ namespace PepperDash.Essentials
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="statusProvider"></param>
|
/// <param name="statusProvider"></param>
|
||||||
public void SetRoomOccupancy(IOccupancyStatusProvider statusProvider, int timeoutMinutes)
|
public void SetRoomOccupancy(IOccupancyStatusProvider statusProvider, int timeoutMinutes)
|
||||||
{
|
{
|
||||||
if (statusProvider == null)
|
if (statusProvider == null)
|
||||||
{
|
{
|
||||||
Debug.Console(0, this, "ERROR: Occupancy sensor device is null");
|
Debug.Console(0, this, "ERROR: Occupancy sensor device is null");
|
||||||
@@ -213,6 +214,8 @@ namespace PepperDash.Essentials
|
|||||||
if(timeoutMinutes > 0)
|
if(timeoutMinutes > 0)
|
||||||
RoomVacancyShutdownSeconds = timeoutMinutes * 60;
|
RoomVacancyShutdownSeconds = timeoutMinutes * 60;
|
||||||
|
|
||||||
|
Debug.Console(1, this, "RoomVacancyShutdownSeconds set to {0}", RoomVacancyShutdownSeconds);
|
||||||
|
|
||||||
RoomOccupancy = statusProvider;
|
RoomOccupancy = statusProvider;
|
||||||
|
|
||||||
OnRoomOccupancyIsSet();
|
OnRoomOccupancyIsSet();
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ namespace PepperDash.Essentials
|
|||||||
avDriver.PopupInterlock.HideAndClear());
|
avDriver.PopupInterlock.HideAndClear());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetUpHelpButton(EssentialsRoomPropertiesConfig roomConf)
|
public void SetUpHelpButton(EssentialsRoomPropertiesConfig roomConf)
|
||||||
{
|
{
|
||||||
// Help roomConf and popup
|
// Help roomConf and popup
|
||||||
if (roomConf.Help != null)
|
if (roomConf.Help != null)
|
||||||
@@ -107,7 +107,7 @@ namespace PepperDash.Essentials
|
|||||||
var room = DeviceManager.GetDeviceForKey(Config.DefaultRoomKey)
|
var room = DeviceManager.GetDeviceForKey(Config.DefaultRoomKey)
|
||||||
as EssentialsHuddleSpaceRoom;
|
as EssentialsHuddleSpaceRoom;
|
||||||
if (room != null)
|
if (room != null)
|
||||||
message = room.Config.HelpMessage;
|
message = room.PropertiesConfig.HelpMessage;
|
||||||
else
|
else
|
||||||
message = "Sorry, no help message available. No room connected.";
|
message = "Sorry, no help message available. No room connected.";
|
||||||
//TriList.StringInput[UIStringJoin.HelpMessage].StringValue = message;
|
//TriList.StringInput[UIStringJoin.HelpMessage].StringValue = message;
|
||||||
@@ -227,7 +227,7 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true);
|
TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true);
|
||||||
|
|
||||||
var roomConf = currentRoom.Config;
|
var roomConf = currentRoom.PropertiesConfig;
|
||||||
|
|
||||||
// Register for the PopupInterlock IsShowsFeedback event to tie the header carets subpage visiblity to it
|
// Register for the PopupInterlock IsShowsFeedback event to tie the header carets subpage visiblity to it
|
||||||
Parent.AvDriver.PopupInterlock.StatusChanged -= PopupInterlock_StatusChanged;
|
Parent.AvDriver.PopupInterlock.StatusChanged -= PopupInterlock_StatusChanged;
|
||||||
@@ -289,7 +289,7 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true);
|
TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true);
|
||||||
|
|
||||||
var roomConf = currentRoom.Config;
|
var roomConf = currentRoom.PropertiesConfig;
|
||||||
|
|
||||||
// Register for the PopupInterlock IsShowsFeedback event to tie the header carets subpage visiblity to it
|
// Register for the PopupInterlock IsShowsFeedback event to tie the header carets subpage visiblity to it
|
||||||
Parent.AvDriver.PopupInterlock.StatusChanged -= PopupInterlock_StatusChanged;
|
Parent.AvDriver.PopupInterlock.StatusChanged -= PopupInterlock_StatusChanged;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -484,9 +484,9 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
|||||||
TriList.SetString(timeTextOffset + i, timeText);
|
TriList.SetString(timeTextOffset + i, timeText);
|
||||||
|
|
||||||
string iconName = null;
|
string iconName = null;
|
||||||
if (c.OccurenceType == eCodecOccurrenceType.Received)
|
if (c.OccurrenceType == eCodecOccurrenceType.Received)
|
||||||
iconName = "Misc-18_Light";
|
iconName = "Misc-18_Light";
|
||||||
else if (c.OccurenceType == eCodecOccurrenceType.Placed)
|
else if (c.OccurrenceType == eCodecOccurrenceType.Placed)
|
||||||
iconName = "Misc-17_Light";
|
iconName = "Misc-17_Light";
|
||||||
else
|
else
|
||||||
iconName = "Delete";
|
iconName = "Delete";
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Submodule essentials-framework updated: 09ff7fdc86...4cfd0abff1
Reference in New Issue
Block a user