Merged in feature/ecs-1123 (pull request #17)

Feature/ecs 1123

Approved-by: Neil Dorin <ndorin@pepperdash.com>
This commit is contained in:
Neil Dorin
2019-07-09 22:53:53 +00:00
24 changed files with 1255 additions and 789 deletions

Binary file not shown.

View File

@@ -19,7 +19,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// <summary> /// <summary>
/// 221 /// 221
/// </summary> /// </summary>
const uint BDialHangup = 221; const uint BDialHangupOnHook = 221;
/// <summary> /// <summary>
/// 251 /// 251
/// </summary> /// </summary>
@@ -134,7 +135,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
{ {
CurrentCallItem.Status = (eCodecCallStatus)Enum.Parse(typeof(eCodecCallStatus), s, true); CurrentCallItem.Status = (eCodecCallStatus)Enum.Parse(typeof(eCodecCallStatus), s, true);
//GetCurrentCallList(); //GetCurrentCallList();
SendCallsList(); SendFullStatus();
}); });
EISC.SetStringSigAction(SCurrentCallNumber, s => EISC.SetStringSigAction(SCurrentCallNumber, s =>
@@ -162,7 +163,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
// Add straight pulse calls // Add straight pulse calls
Action<string, uint> addAction = (s, u) => Action<string, uint> addAction = (s, u) =>
AppServerController.AddAction(MessagePath + s, new Action(() => EISC.PulseBool(u, 100))); AppServerController.AddAction(MessagePath + s, new Action(() => EISC.PulseBool(u, 100)));
addAction("/endCallById", BDialHangup); addAction("/endCallById", BDialHangupOnHook);
addAction("/endAllCalls", BDialHangupOnHook);
addAction("/acceptById", BIncomingAnswer); addAction("/acceptById", BIncomingAnswer);
addAction("/rejectById", BIncomingReject); addAction("/rejectById", BIncomingReject);
addAction("/speedDial1", BSpeedDial1); addAction("/speedDial1", BSpeedDial1);

View File

@@ -123,6 +123,15 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary> /// </summary>
const uint BCameraModeOff = 833; const uint BCameraModeOff = 833;
/// <summary>
/// 841
/// </summary>
const uint BCameraSelfView = 841;
/// <summary>
/// 842
/// </summary>
const uint BCameraLayout = 842;
/********* Ushorts *********/ /********* Ushorts *********/
@@ -330,6 +339,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
EISC.SetSigTrueAction(BCameraModeManual, () => PostCameraMode()); EISC.SetSigTrueAction(BCameraModeManual, () => PostCameraMode());
EISC.SetSigTrueAction(BCameraModeOff, () => PostCameraMode()); EISC.SetSigTrueAction(BCameraModeOff, () => PostCameraMode());
EISC.SetBoolSigAction(BCameraSelfView, b => PostStatusMessage(new
{
cameraSelfView = b
}));
EISC.SetUShortSigAction(UCameraNumberSelect, (u) => PostSelectedCamera()); EISC.SetUShortSigAction(UCameraNumberSelect, (u) => PostSelectedCamera());
@@ -347,6 +361,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
Action<string, uint> addAction = (s, u) => Action<string, uint> addAction = (s, u) =>
AppServerController.AddAction(MessagePath + s, new Action(() => EISC.PulseBool(u, 100))); AppServerController.AddAction(MessagePath + s, new Action(() => EISC.PulseBool(u, 100)));
addAction("/endCallById", BDialHangup); addAction("/endCallById", BDialHangup);
addAction("/endAllCalls", BDialHangup);
addAction("/acceptById", BIncomingAnswer); addAction("/acceptById", BIncomingAnswer);
addAction("/rejectById", BIncomingReject); addAction("/rejectById", BIncomingReject);
addAction("/speedDial1", BSpeedDial1); addAction("/speedDial1", BSpeedDial1);
@@ -356,6 +371,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
addAction("/cameraModeAuto", BCameraModeAuto); addAction("/cameraModeAuto", BCameraModeAuto);
addAction("/cameraModeManual", BCameraModeManual); addAction("/cameraModeManual", BCameraModeManual);
addAction("/cameraModeOff", BCameraModeOff); addAction("/cameraModeOff", BCameraModeOff);
addAction("/cameraSelfView", BCameraSelfView);
addAction("/cameraLayout", BCameraLayout);
asc.AddAction("/cameraSelect", new Action<string>(SelectCamera)); asc.AddAction("/cameraSelect", new Action<string>(SelectCamera));
@@ -437,6 +454,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
{ {
calls = GetCurrentCallList(), calls = GetCurrentCallList(),
cameraMode = GetCameraMode(), cameraMode = GetCameraMode(),
cameraSelfView = EISC.GetBool(BCameraSelfView),
currentCallString = EISC.GetString(SCurrentCallNumber), currentCallString = EISC.GetString(SCurrentCallNumber),
currentDialString = EISC.GetString(SCurrentDialString), currentDialString = EISC.GetString(SCurrentDialString),
directoryContactSelected = new directoryContactSelected = new
@@ -448,8 +466,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
isInCall = EISC.GetString(SHookState) == "Connected", isInCall = EISC.GetString(SHookState) == "Connected",
hasDirectory = true, hasDirectory = true,
hasDirectorySearch = false, hasDirectorySearch = false,
hasRecents = true, hasRecents = !EISC.BooleanOutput[502].BoolValue,
hasCameras = true, hasCameras = true,
showCamerasWhenNotInCall = EISC.BooleanOutput[503].BoolValue,
selectedCamera = GetSelectedCamera(), selectedCamera = GetSelectedCamera(),
}); });
} }

View File

@@ -8,6 +8,7 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using PepperDash.Essentials.Devices.Common.Codec; using PepperDash.Essentials.Devices.Common.Codec;
using PepperDash.Essentials.Devices.Common.Cameras;
using PepperDash.Essentials.Devices.Common.VideoCodec; using PepperDash.Essentials.Devices.Common.VideoCodec;
namespace PepperDash.Essentials.AppServer.Messengers namespace PepperDash.Essentials.AppServer.Messengers
@@ -365,7 +366,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
hasDirectory = Codec is IHasDirectory, hasDirectory = Codec is IHasDirectory,
hasDirectorySearch = true, hasDirectorySearch = true,
hasRecents = Codec is IHasCallHistory, hasRecents = Codec is IHasCallHistory,
hasCameras = Codec is IHasCameraControl hasCameras = Codec is IHasCodecCameras
}); });
} }
} }

View File

@@ -27,6 +27,11 @@ namespace PepperDash.Essentials.Room.Cotija
/// </summary> /// </summary>
public const uint RoomIsOn = 301; public const uint RoomIsOn = 301;
/// <summary>
/// 12
/// </summary>
public const uint PrivacyMute = 12;
/// <summary> /// <summary>
/// 41 /// 41
/// </summary> /// </summary>
@@ -38,15 +43,15 @@ namespace PepperDash.Essentials.Room.Cotija
/// <summary> /// <summary>
/// 51 /// 51
/// </summary> /// </summary>
public const uint ActivitySharePress = 51; public const uint ActivityShare = 51;
/// <summary> /// <summary>
/// 52 /// 52
/// </summary> /// </summary>
public const uint ActivityPhoneCallPress = 52; public const uint ActivityPhoneCall = 52;
/// <summary> /// <summary>
/// 53 /// 53
/// </summary> /// </summary>
public const uint ActivityVideoCallPress = 53; public const uint ActivityVideoCall = 53;
/// <summary> /// <summary>
/// 1 /// 1
@@ -85,6 +90,14 @@ namespace PepperDash.Essentials.Room.Cotija
/// </summary> /// </summary>
public const uint ConfigIsReady = 501; public const uint ConfigIsReady = 501;
/// <summary> /// <summary>
/// 502
/// </summary>
public const uint HideVideoConfRecents = 502;
/// <summary>
/// 503
/// </summary>
public const uint ShowCameraWhenNotInCall = 503;
/// <summary>
/// 601 /// 601
/// </summary> /// </summary>
public const uint SourceShareDisableStartJoin = 601; public const uint SourceShareDisableStartJoin = 601;
@@ -319,16 +332,26 @@ 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.ActivityShare)));
Parent.AddAction(@"/room/room1/activityVideo", new Action(() =>
EISC.PulseBool(BoolJoin.ActivityVideoCallPress)));
Parent.AddAction(@"/room/room1/activityPhone", new Action(() => Parent.AddAction(@"/room/room1/activityPhone", new Action(() =>
EISC.PulseBool(BoolJoin.ActivityPhoneCallPress))); EISC.PulseBool(BoolJoin.ActivityPhoneCall)));
Parent.AddAction(@"/room/room1/activityVideo", new Action(() =>
EISC.PulseBool(BoolJoin.ActivityVideoCall)));
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)));
Parent.AddAction(@"/room/room1/volumes/master/muteToggle", new Action(() => Parent.AddAction(@"/room/room1/volumes/master/muteToggle", new Action(() =>
EISC.PulseBool(BoolJoin.MasterVolumeIsMuted))); EISC.PulseBool(BoolJoin.MasterVolumeIsMuted)));
Parent.AddAction(@"/room/room1/volumes/master/privacyMuteToggle", new Action(() =>
EISC.PulseBool(BoolJoin.PrivacyMute)));
for (uint i = 2; i <= 7; i++)
{
var index = i;
Parent.AddAction(string.Format(@"/room/room1/volumes/level-{0}/level", index), new Action<ushort>(u =>
EISC.SetUshort(index, u)));
Parent.AddAction(string.Format(@"/room/room1/volumes/level-{0}/muteToggle", index), new Action(() =>
EISC.PulseBool(index)));
}
Parent.AddAction(@"/room/room1/shutdownStart", new Action(() => Parent.AddAction(@"/room/room1/shutdownStart", new Action(() =>
EISC.PulseBool(BoolJoin.ShutdownStart))); EISC.PulseBool(BoolJoin.ShutdownStart)));
@@ -387,7 +410,6 @@ namespace PepperDash.Essentials.Room.Cotija
} }
} }
})); }));
EISC.SetBoolSigAction(BoolJoin.MasterVolumeIsMuted, b => EISC.SetBoolSigAction(BoolJoin.MasterVolumeIsMuted, b =>
PostStatusMessage(new PostStatusMessage(new
{ {
@@ -399,6 +421,48 @@ namespace PepperDash.Essentials.Room.Cotija
} }
} }
})); }));
EISC.SetBoolSigAction(BoolJoin.PrivacyMute, b =>
PostStatusMessage(new
{
volumes = new
{
master = new
{
privacyMuted = b
}
}
}));
for (uint i = 2; i <= 7; i++)
{
var index = i; // local scope for lambdas
EISC.SetUShortSigAction(index, u => // start at join 2
{
// need a dict in order to create the level-n property on auxFaders
var dict = new Dictionary<string, object>();
dict.Add("level-" + index, new { level = u });
PostStatusMessage(new
{
volumes = new
{
auxFaders = dict,
}
});
});
EISC.SetBoolSigAction(index, b =>
{
// need a dict in order to create the level-n property on auxFaders
var dict = new Dictionary<string, object>();
dict.Add("level-" + index, new { muted = b });
PostStatusMessage(new
{
volumes = new
{
auxFaders = dict,
}
});
});
}
// shutdown things // shutdown things
@@ -421,6 +485,23 @@ namespace PepperDash.Essentials.Room.Cotija
// Config things // Config things
EISC.SetSigTrueAction(BoolJoin.ConfigIsReady, LoadConfigValues); EISC.SetSigTrueAction(BoolJoin.ConfigIsReady, LoadConfigValues);
// Activity modes
EISC.SetSigTrueAction(BoolJoin.ActivityShare, () => UpdateActivity(1));
EISC.SetSigTrueAction(BoolJoin.ActivityPhoneCall, () => UpdateActivity(2));
EISC.SetSigTrueAction(BoolJoin.ActivityVideoCall, () => UpdateActivity(3));
}
/// <summary>
/// Updates activity states
/// </summary>
void UpdateActivity(int mode)
{
PostStatusMessage(new
{
activityMode = mode,
});
} }
/// <summary> /// <summary>
@@ -471,17 +552,6 @@ namespace PepperDash.Essentials.Room.Cotija
rmProps.RoomPhoneNumber = EISC.StringOutput[StringJoin.ConfigRoomPhoneNumber].StringValue; rmProps.RoomPhoneNumber = EISC.StringOutput[StringJoin.ConfigRoomPhoneNumber].StringValue;
rmProps.RoomURI = EISC.StringOutput[StringJoin.ConfigRoomURI].StringValue; rmProps.RoomURI = EISC.StringOutput[StringJoin.ConfigRoomURI].StringValue;
rmProps.SpeedDials = new List<DDVC01SpeedDial>(); rmProps.SpeedDials = new List<DDVC01SpeedDial>();
// add speed dials as long as there are more - up to 4
#warning fix speed dials - 512-515 names, 516-519 numbers
for (uint i = 512; i <= 519; i = i + 2)
{
var num = EISC.StringOutput[i].StringValue;
if (string.IsNullOrEmpty(num))
break;
var name = EISC.StringOutput[i + 1].StringValue;
rmProps.SpeedDials.Add(new DDVC01SpeedDial { Number = num, Name = name});
}
// This MAY need a check // This MAY need a check
rmProps.AudioCodecKey = "audioCodec"; rmProps.AudioCodecKey = "audioCodec";
@@ -575,7 +645,7 @@ namespace PepperDash.Essentials.Room.Cotija
co.SourceLists.Add("default", newSl); co.SourceLists.Add("default", newSl);
// build "audioCodec" config if we need // Build "audioCodec" config if we need
if (!string.IsNullOrEmpty(rmProps.AudioCodecKey)) if (!string.IsNullOrEmpty(rmProps.AudioCodecKey))
{ {
var acFavs = new List<PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem>(); var acFavs = new List<PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem>();
@@ -610,25 +680,11 @@ namespace PepperDash.Essentials.Room.Cotija
co.Devices.Add(acConf); co.Devices.Add(acConf);
} }
// Build Video codec config
if (!string.IsNullOrEmpty(rmProps.VideoCodecKey)) if (!string.IsNullOrEmpty(rmProps.VideoCodecKey))
{ {
#warning Break out these video codec favs // No favorites, for now?
var favs = new List<PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem>(); var favs = new List<PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem>();
for (uint i = 0; i < 4; i++)
{
if (!EISC.GetBool(BoolJoin.SpeedDialVisibleStartJoin + i))
{
break;
}
favs.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
});
}
// cameras // cameras
var camsProps = new List<object>(); var camsProps = new List<object>();
@@ -689,39 +745,41 @@ namespace PepperDash.Essentials.Room.Cotija
{ {
if (ConfigIsLoaded) if (ConfigIsLoaded)
{ {
var count = EISC.UShortOutput[801].UShortValue; var count = EISC.UShortOutput[101].UShortValue;
Debug.Console(1, this, "The Fader Count is : {0}", count); Debug.Console(1, this, "The Fader Count is : {0}", count);
// build volumes object, serialize and put in content of method below // build volumes object, serialize and put in content of method below
var auxFaders = new List<Volume>();
// Create auxFaders // Create auxFaders
for (uint i = 2; i <= count; i++) var auxFaderDict = new Dictionary<string, Volume>();
{ for (uint i = 2; i <= count; i++)
auxFaders.Add( {
new Volume(string.Format("level-{0}", i), auxFaderDict.Add("level-" + i,
EISC.UShortOutput[i].UShortValue, new Volume("level-" + i,
EISC.BooleanOutput[i].BoolValue, EISC.UShortOutput[i].UShortValue,
EISC.StringOutput[800 + i].StringValue, EISC.BooleanOutput[i].BoolValue,
true, EISC.StringOutput[i].StringValue,
"someting.png")); true,
} "someting.png"));
}
var volumes = new Volumes(); var volumes = new Volumes();
volumes.Master = new Volume("master", volumes.Master = new Volume("master",
EISC.UShortOutput[UshortJoin.MasterVolumeLevel].UShortValue, EISC.UShortOutput[UshortJoin.MasterVolumeLevel].UShortValue,
EISC.BooleanOutput[BoolJoin.MasterVolumeIsMuted].BoolValue, EISC.BooleanOutput[BoolJoin.MasterVolumeIsMuted].BoolValue,
EISC.StringOutput[801].StringValue, EISC.StringOutput[1].StringValue,
true, true,
"something.png"); "something.png");
volumes.Master.HasPrivacyMute = true;
volumes.Master.PrivacyMuted = EISC.BooleanOutput[BoolJoin.PrivacyMute].BoolValue;
volumes.AuxFaders = auxFaders; volumes.AuxFaders = auxFaderDict;
PostStatusMessage(new PostStatusMessage(new
{ {
activityMode = GetActivityMode(),
isOn = EISC.BooleanOutput[BoolJoin.RoomIsOn].BoolValue, isOn = EISC.BooleanOutput[BoolJoin.RoomIsOn].BoolValue,
selectedSourceKey = EISC.StringOutput[StringJoin.SelectedSourceKey].StringValue, selectedSourceKey = EISC.StringOutput[StringJoin.SelectedSourceKey].StringValue,
volumes = volumes volumes = volumes
@@ -736,6 +794,18 @@ namespace PepperDash.Essentials.Room.Cotija
} }
} }
/// <summary>
/// Returns the activity mode int
/// </summary>
/// <returns></returns>
int GetActivityMode()
{
if (EISC.BooleanOutput[BoolJoin.ActivityPhoneCall].BoolValue) return 2;
else if (EISC.BooleanOutput[BoolJoin.ActivityShare].BoolValue) return 1;
else if (EISC.BooleanOutput[BoolJoin.ActivityVideoCall].BoolValue) return 3;
return 0;
}
/// <summary> /// <summary>
/// Helper for posting status message /// Helper for posting status message
/// </summary> /// </summary>

View File

@@ -14,11 +14,11 @@ namespace PepperDash.Essentials.Room.Cotija
public Volume Master { get; set; } public Volume Master { get; set; }
[JsonProperty("auxFaders")] [JsonProperty("auxFaders")]
public List<Volume> AuxFaders { get; set; } public Dictionary<string, Volume> AuxFaders { get; set; }
public Volumes() public Volumes()
{ {
AuxFaders = new List<Volume>(); AuxFaders = new Dictionary<string, Volume>();
} }
} }
@@ -39,6 +39,13 @@ namespace PepperDash.Essentials.Room.Cotija
[JsonProperty("hasMute")] [JsonProperty("hasMute")]
public bool HasMute { get; set; } public bool HasMute { get; set; }
[JsonProperty("hasPrivacyMute")]
public bool HasPrivacyMute { get; set; }
[JsonProperty("privacyMuted")]
public bool PrivacyMuted { get; set; }
[JsonProperty("muteIcon")] [JsonProperty("muteIcon")]
public string MuteIcon { get; set; } public string MuteIcon { get; set; }

View File

@@ -0,0 +1,122 @@
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;
using PepperDash.Essentials.DM.AirMedia;
namespace PepperDash.Essentials.Bridges
{
public static class AirMediaControllerApiExtensions
{
public static void LinkToApi(this AirMediaController airMedia, BasicTriList trilist, uint joinStart, string joinMapKey)
{
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as AirMediaControllerJoinMap;
if (joinMap == null)
{
joinMap = new AirMediaControllerJoinMap();
}
joinMap.OffsetJoinNumbers(joinStart);
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.Console(0, "Linking to Bridge Type {0}", airMedia.GetType().Name.ToString());
trilist.StringInput[joinMap.Name].StringValue = airMedia.GetType().Name.ToString();
var commMonitor = airMedia as ICommunicationMonitor;
if (commMonitor != null)
{
commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
}
airMedia.IsInSessionFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsInSession]);
airMedia.HdmiVideoSyncDetectedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.HdmiVideoSync]);
trilist.SetSigTrueAction(joinMap.AutomaticInputRoutingEnabled, new Action( airMedia.AirMedia.DisplayControl.EnableAutomaticRouting));
trilist.SetSigFalseAction(joinMap.AutomaticInputRoutingEnabled, new Action( airMedia.AirMedia.DisplayControl.DisableAutomaticRouting));
airMedia.AutomaticInputRoutingEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AutomaticInputRoutingEnabled]);
trilist.SetUShortSigAction(joinMap.VideoOut, new Action<ushort>((u) => airMedia.SelectVideoOut(u)));
airMedia.VideoOutFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoOut]);
airMedia.ErrorFeedback.LinkInputSig(trilist.UShortInput[joinMap.ErrorFB]);
airMedia.NumberOfUsersConnectedFeedback.LinkInputSig(trilist.UShortInput[joinMap.NumberOfUsersConnectedFB]);
trilist.SetUShortSigAction(joinMap.LoginCode, new Action<ushort>((u) => airMedia.AirMedia.AirMedia.LoginCode.UShortValue = u));
airMedia.LoginCodeFeedback.LinkInputSig(trilist.UShortInput[joinMap.LoginCode]);
airMedia.ConnectionAddressFeedback.LinkInputSig(trilist.StringInput[joinMap.ConnectionAddressFB]);
airMedia.HostnameFeedback.LinkInputSig(trilist.StringInput[joinMap.HostnameFB]);
airMedia.SerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.SerialNumberFeedback]);
}
}
public class AirMediaControllerJoinMap : JoinMapBase
{
// Digital
public uint IsOnline { get; set; }
public uint IsInSession { get; set; }
public uint HdmiVideoSync { get; set; }
public uint AutomaticInputRoutingEnabled { get; set; }
// Analog
public uint VideoOut { get; set; }
public uint ErrorFB { get; set; }
public uint NumberOfUsersConnectedFB { get; set; }
public uint LoginCode { get; set; }
// Serial
public uint Name { get; set; }
public uint ConnectionAddressFB { get; set; }
public uint HostnameFB { get; set; }
public uint SerialNumberFeedback { get; set; }
public AirMediaControllerJoinMap()
{
// Digital
IsOnline = 1;
IsInSession = 2;
HdmiVideoSync = 3;
AutomaticInputRoutingEnabled = 4;
// Analog
VideoOut = 1;
ErrorFB = 2;
NumberOfUsersConnectedFB = 3;
LoginCode = 4;
// Serial
Name = 1;
ConnectionAddressFB = 2;
HostnameFB = 3;
SerialNumberFeedback = 4;
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
IsOnline = IsOnline + joinOffset;
IsInSession = IsInSession + joinOffset;
HdmiVideoSync = HdmiVideoSync + joinOffset;
AutomaticInputRoutingEnabled = AutomaticInputRoutingEnabled + joinOffset;
VideoOut = VideoOut + joinOffset;
ErrorFB = ErrorFB + joinOffset;
NumberOfUsersConnectedFB = NumberOfUsersConnectedFB + joinOffset;
LoginCode = LoginCode + joinOffset;
Name = Name + joinOffset;
ConnectionAddressFB = ConnectionAddressFB + joinOffset;
HostnameFB = HostnameFB + joinOffset;
SerialNumberFeedback = SerialNumberFeedback + joinOffset;
}
}
}

View 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.Devices.Common;
namespace PepperDash.Essentials.Bridges
{
public static class AppleTvApiExtensions
{
public static void LinkToApi(this AppleTV appleTv, BasicTriList trilist, uint joinStart, string joinMapKey)
{
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as AppleTvJoinMap;
if (joinMap == null)
{
joinMap = new AppleTvJoinMap();
}
joinMap.OffsetJoinNumbers(joinStart);
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.Console(0, "Linking to Bridge Type {0}", appleTv.GetType().Name.ToString());
trilist.SetBoolSigAction(joinMap.UpArrow, (b) => appleTv.Up(b));
trilist.SetBoolSigAction(joinMap.DnArrow, (b) => appleTv.Down(b));
trilist.SetBoolSigAction(joinMap.LeftArrow, (b) => appleTv.Left(b));
trilist.SetBoolSigAction(joinMap.RightArrow, (b) => appleTv.Right(b));
trilist.SetBoolSigAction(joinMap.Select, (b) => appleTv.Select(b));
trilist.SetBoolSigAction(joinMap.Menu, (b) => appleTv.Menu(b));
trilist.SetBoolSigAction(joinMap.PlayPause, (b) => appleTv.Play(b));
}
}
public class AppleTvJoinMap : JoinMapBase
{
// Digital
public uint UpArrow { get; set; }
public uint DnArrow { get; set; }
public uint LeftArrow { get; set; }
public uint RightArrow { get; set; }
public uint Menu { get; set; }
public uint Select { get; set; }
public uint PlayPause { get; set; }
public AppleTvJoinMap()
{
UpArrow = 1;
DnArrow = 2;
LeftArrow = 3;
RightArrow = 4;
Menu = 5;
Select = 6;
PlayPause = 7;
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
UpArrow = UpArrow + joinOffset;
DnArrow = DnArrow + joinOffset;
LeftArrow = LeftArrow + joinOffset;
RightArrow = RightArrow + joinOffset;
Menu = Menu + joinOffset;
Select = Select + joinOffset;
PlayPause = PlayPause + joinOffset;
}
}
}

View File

@@ -56,7 +56,6 @@ namespace PepperDash.Essentials.Bridges
public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; } public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; }
public EiscApi(DeviceConfig dc) : public EiscApi(DeviceConfig dc) :
base(dc.Key) base(dc.Key)
{ {
@@ -93,9 +92,9 @@ namespace PepperDash.Essentials.Bridges
// (device as CameraBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); // (device as CameraBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
// continue; // continue;
//} //}
else if (device is PepperDash.Essentials.Core.TwoWayDisplayBase) else if (device is PepperDash.Essentials.Core.DisplayBase)
{ {
(device as TwoWayDisplayBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); (device as DisplayBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue; continue;
} }
else if (device is DmChassisController) else if (device is DmChassisController)
@@ -123,6 +122,16 @@ namespace PepperDash.Essentials.Bridges
{ {
(device as IDigitalInput).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); (device as IDigitalInput).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue; continue;
}
else if (device is AppleTV)
{
(device as AppleTV).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
}
else if (device is IBridge)
{
(device as IBridge).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
} }
//else if (device is LightingBase) //else if (device is LightingBase)
//{ //{
@@ -141,6 +150,66 @@ namespace PepperDash.Essentials.Bridges
}); });
} }
/// <summary>
/// Used for debugging to trigger an action based on a join number and type
/// </summary>
/// <param name="join"></param>
/// <param name="type"></param>
public void ExecuteJoinAction(uint join, string type, object state)
{
try
{
switch (type.ToLower())
{
case "digital":
{
var uo = Eisc.BooleanOutput[join].UserObject as Action<bool>;
if (uo != null)
{
Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
uo(Convert.ToBoolean(state));
}
else
Debug.Console(1, this, "User Action is null. Nothing to Execute");
break;
}
case "analog":
{
var uo = Eisc.BooleanOutput[join].UserObject as Action<ushort>;
if (uo != null)
{
Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
uo(Convert.ToUInt16(state));
}
else
Debug.Console(1, this, "User Action is null. Nothing to Execute"); break;
}
case "serial":
{
var uo = Eisc.BooleanOutput[join].UserObject as Action<string>;
if (uo != null)
{
Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
uo(Convert.ToString(state));
}
else
Debug.Console(1, this, "User Action is null. Nothing to Execute");
break;
}
default:
{
Debug.Console(1, "Unknown join type. Use digital/serial/analog");
break;
}
}
}
catch (Exception e)
{
Debug.Console(1, this, "Error: {0}", e);
}
}
/// <summary> /// <summary>
/// Handles incoming sig changes /// Handles incoming sig changes
/// </summary> /// </summary>
@@ -151,6 +220,7 @@ namespace PepperDash.Essentials.Bridges
if (Debug.Level >= 1) if (Debug.Level >= 1)
Debug.Console(1, this, "EiscApi 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;
Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
if (uo is Action<bool>) if (uo is Action<bool>)
(uo as Action<bool>)(args.Sig.BoolValue); (uo as Action<bool>)(args.Sig.BoolValue);
else if (uo is Action<ushort>) else if (uo is Action<ushort>)

View File

@@ -14,128 +14,126 @@ 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(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 { };
var typeName = dc.Type.ToLower(); var typeName = dc.Type.ToLower();
var groupName = dc.Group.ToLower(); var groupName = dc.Group.ToLower();
//Debug.Console(2, "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 == "eiscapi") if (typeName == "eiscapi")
{ {
return new EiscApi(dc); return new EiscApi(dc);
} }
return null; 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);
}
}
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 string ParentDeviceKey { get; set; }
public eApiType ApiType { get; set; }
public List<EiscProperties> Eiscs { get; set; }
public string ApiOverrideFilePath { get; set; }
public class EiscProperties
{
public string IpId { get; set; }
public string Hostname { get; set; }
}
}
public class CommBridgeProperties : EiscBridgeProperties
{
public List<string> CommDevices { get; set; }
}
public enum eApiType { Eisc = 0 }
public class BridgeApiEisc
{
public uint Ipid { get; private set; }
public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; }
public BridgeApiEisc(string ipid, string hostname)
{
Ipid = (UInt32)int.Parse(ipid, System.Globalization.NumberStyles.HexNumber);
Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(Ipid, hostname, Global.ControlSystem);
Eisc.Register();
Eisc.SigChange += Eisc_SigChange;
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);
}
}
} }
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 string ParentDeviceKey { get; set; }
public eApiType ApiType { get; set; }
public List<EiscProperties> Eiscs { get; set; }
public string ApiOverrideFilePath { get; set; }
public class EiscProperties
{
public string IpId { get; set; }
public string Hostname { get; set; }
}
}
public class CommBridgeProperties : EiscBridgeProperties
{
public List<string> CommDevices { get; set; }
}
public enum eApiType { Eisc = 0 }
public class BridgeApiEisc
{
public uint Ipid { get; private set; }
public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; }
public BridgeApiEisc(string ipid, string hostname)
{
Ipid = (UInt32)int.Parse(ipid, System.Globalization.NumberStyles.HexNumber);
Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(Ipid, hostname, Global.ControlSystem);
Eisc.Register();
Eisc.SigChange += Eisc_SigChange;
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);
}
}
}

View File

@@ -13,36 +13,48 @@ namespace PepperDash.Essentials.Bridges
public static class DisplayControllerApiExtensions public static class DisplayControllerApiExtensions
{ {
public static BasicTriList _TriList;
public static DisplayControllerJoinMap JoinMap;
public static int InputNumber; public static int InputNumber;
public static IntFeedback InputNumberFeedback; public static IntFeedback InputNumberFeedback;
public static List<string> InputKeys = new List<string>(); public static List<string> InputKeys = new List<string>();
public static void LinkToApi(this PepperDash.Essentials.Core.TwoWayDisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey) public static void LinkToApi(this PepperDash.Essentials.Core.DisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey)
{ {
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DisplayControllerJoinMap;
JoinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DisplayControllerJoinMap; if (joinMap == null)
_TriList = trilist;
if (JoinMap == null)
{ {
JoinMap = new DisplayControllerJoinMap(); joinMap = new DisplayControllerJoinMap();
} }
JoinMap.OffsetJoinNumbers(joinStart); joinMap.OffsetJoinNumbers(joinStart);
Debug.Console(1, "Linking to Trilist '{0}'", _TriList.ID.ToString("X"));
Debug.Console(1, "Linking to Trilist '{0}'",trilist.ID.ToString("X"));
Debug.Console(0, "Linking to Bridge Type {0}", displayDevice.GetType().Name.ToString()); Debug.Console(0, "Linking to Bridge Type {0}", displayDevice.GetType().Name.ToString());
_TriList.StringInput[JoinMap.Name].StringValue = 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; var commMonitor = displayDevice as ICommunicationMonitor;
commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.IsOnline]); if (commMonitor != null)
{
commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
}
// Poewer Off InputNumberFeedback = new IntFeedback(() => { return InputNumber; });
trilist.SetSigTrueAction(JoinMap.PowerOff, () =>
// Two way feedbacks
var twoWayDisplay = displayDevice as PepperDash.Essentials.Core.TwoWayDisplayBase;
if (twoWayDisplay != null)
{
trilist.SetBool(joinMap.IsTwoWayDisplay, true);
twoWayDisplay.CurrentInputFeedback.OutputChange += new EventHandler<FeedbackEventArgs>(CurrentInputFeedback_OutputChange);
InputNumberFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputSelect]);
}
// Power Off
trilist.SetSigTrueAction(joinMap.PowerOff, () =>
{ {
InputNumber = 102; InputNumber = 102;
InputNumberFeedback.FireUpdate(); InputNumberFeedback.FireUpdate();
@@ -50,10 +62,10 @@ namespace PepperDash.Essentials.Bridges
}); });
displayDevice.PowerIsOnFeedback.OutputChange += new EventHandler<FeedbackEventArgs>(PowerIsOnFeedback_OutputChange); displayDevice.PowerIsOnFeedback.OutputChange += new EventHandler<FeedbackEventArgs>(PowerIsOnFeedback_OutputChange);
displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[JoinMap.PowerOff]); displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff]);
// PowerOn // PowerOn
trilist.SetSigTrueAction(JoinMap.PowerOn, () => trilist.SetSigTrueAction(joinMap.PowerOn, () =>
{ {
InputNumber = 0; InputNumber = 0;
InputNumberFeedback.FireUpdate(); InputNumberFeedback.FireUpdate();
@@ -61,20 +73,21 @@ namespace PepperDash.Essentials.Bridges
}); });
displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.PowerOn]); displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn]);
int count = 1; int count = 1;
foreach (var input in displayDevice.InputPorts) foreach (var input in displayDevice.InputPorts)
{ {
InputKeys.Add(input.Key.ToString()); InputKeys.Add(input.Key.ToString());
var tempKey = InputKeys.ElementAt(count - 1); var tempKey = InputKeys.ElementAt(count - 1);
trilist.SetSigTrueAction((ushort)(JoinMap.InputSelectOffset + count), () => { displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector); }); trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset + count), () => { displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector); });
trilist.StringInput[(ushort)(JoinMap.InputNamesOffset + count)].StringValue = input.Key.ToString(); Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}", joinMap.InputSelectOffset + count, displayDevice.InputPorts[tempKey].Key.ToString());
trilist.StringInput[(ushort)(joinMap.InputNamesOffset + count)].StringValue = input.Key.ToString();
count++; count++;
} }
displayDevice.CurrentInputFeedback.OutputChange += new EventHandler<FeedbackEventArgs>(CurrentInputFeedback_OutputChange); Debug.Console(2, displayDevice, "Setting Input Select Action on Analog Join {0}", joinMap.InputSelect);
trilist.SetUShortSigAction(JoinMap.InputSelect, (a) => trilist.SetUShortSigAction(joinMap.InputSelect, (a) =>
{ {
if (a == 0) if (a == 0)
{ {
@@ -91,10 +104,25 @@ namespace PepperDash.Essentials.Bridges
displayDevice.PowerToggle(); displayDevice.PowerToggle();
} }
InputNumberFeedback.FireUpdate(); if (twoWayDisplay != null)
InputNumberFeedback.FireUpdate();
}); });
var volumeDisplay = displayDevice as IBasicVolumeControls;
if (volumeDisplay != null)
{
trilist.SetBoolSigAction(joinMap.VolumeUp, (b) => volumeDisplay.VolumeUp(b));
trilist.SetBoolSigAction(joinMap.VolumeDown, (b) => volumeDisplay.VolumeDown(b));
trilist.SetSigTrueAction(joinMap.VolumeMute, () => volumeDisplay.MuteToggle());
var volumeDisplayWithFeedback = volumeDisplay as IBasicVolumeWithFeedback;
if(volumeDisplayWithFeedback != null)
{
volumeDisplayWithFeedback.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.VolumeLevelFB]);
volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMute]);
}
}
} }
static void CurrentInputFeedback_OutputChange(object sender, FeedbackEventArgs e) static void CurrentInputFeedback_OutputChange(object sender, FeedbackEventArgs e)
@@ -125,19 +153,27 @@ namespace PepperDash.Essentials.Bridges
} }
public class DisplayControllerJoinMap : JoinMapBase public class DisplayControllerJoinMap : JoinMapBase
{ {
public uint Name { get; set; } // Digital
public uint InputNamesOffset { get; set; } public uint PowerOff { get; set; }
public uint InputSelectOffset { get; set; } public uint PowerOn { get; set; }
public uint IsOnline { get; set; } public uint IsTwoWayDisplay { get; set; }
public uint PowerOff { get; set; } public uint VolumeUp { get; set; }
public uint InputSelect { get; set; } public uint VolumeDown { get; set; }
public uint PowerOn { get; set; } public uint VolumeMute { get; set; }
public uint SelectScene { get; set; } public uint InputSelectOffset { get; set; }
public uint LightingSceneOffset { get; set; }
public uint ButtonVisibilityOffset { get; set; } public uint ButtonVisibilityOffset { get; set; }
public uint IntegrationIdSet { get; set; } public uint IsOnline { get; set; }
// Analog
public uint InputSelect { get; set; }
public uint VolumeLevelFB { get; set; }
// Serial
public uint Name { get; set; }
public uint InputNamesOffset { get; set; }
public DisplayControllerJoinMap() public DisplayControllerJoinMap()
{ {
@@ -145,15 +181,22 @@ namespace PepperDash.Essentials.Bridges
IsOnline = 50; IsOnline = 50;
PowerOff = 1; PowerOff = 1;
PowerOn = 2; PowerOn = 2;
InputSelect = 4; IsTwoWayDisplay = 3;
IntegrationIdSet = 1; VolumeUp = 5;
LightingSceneOffset = 10; VolumeDown = 6;
VolumeMute = 7;
ButtonVisibilityOffset = 40; ButtonVisibilityOffset = 40;
Name = 1; InputSelectOffset = 10;
InputNamesOffset = 10;
InputSelectOffset = 4;
// Analog // Analog
} InputSelect = 11;
VolumeLevelFB = 5;
// Serial
Name = 1;
InputNamesOffset = 10;
}
public override void OffsetJoinNumbers(uint joinStart) public override void OffsetJoinNumbers(uint joinStart)
{ {
@@ -162,13 +205,18 @@ namespace PepperDash.Essentials.Bridges
IsOnline = IsOnline + joinOffset; IsOnline = IsOnline + joinOffset;
PowerOff = PowerOff + joinOffset; PowerOff = PowerOff + joinOffset;
PowerOn = PowerOn + joinOffset; PowerOn = PowerOn + joinOffset;
SelectScene = SelectScene + joinOffset; IsTwoWayDisplay = IsTwoWayDisplay + joinOffset;
LightingSceneOffset = LightingSceneOffset + joinOffset;
ButtonVisibilityOffset = ButtonVisibilityOffset + joinOffset; ButtonVisibilityOffset = ButtonVisibilityOffset + joinOffset;
Name = Name + joinOffset; Name = Name + joinOffset;
InputNamesOffset = InputNamesOffset + joinOffset; InputNamesOffset = InputNamesOffset + joinOffset;
InputSelectOffset = InputSelectOffset + joinOffset; InputSelectOffset = InputSelectOffset + joinOffset;
InputSelect = InputSelect + joinOffset;
VolumeUp = VolumeUp + joinOffset;
VolumeDown = VolumeDown + joinOffset;
VolumeMute = VolumeMute + joinOffset;
VolumeLevelFB = VolumeLevelFB + joinOffset;
} }
} }
} }

View File

@@ -103,7 +103,7 @@ namespace PepperDash.Essentials.Bridges
InputEndpointOnline = 500; InputEndpointOnline = 500;
OutputEndpointOnline = 700; OutputEndpointOnline = 700;
//HdcpSupport = 1000; //1001-1199 //HdcpSupport = 1000; //1001-1199
//HdcpSupportCapability = 1200; //1201-1399 //HdcpSupportCapability = 1200; //1201-1399
} }

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
namespace PepperDash.Essentials.Bridges
{
public interface IBridge
{
void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey);
}
}

View File

@@ -19,35 +19,35 @@ using PepperDash.Essentials.Room.Cotija;
namespace PepperDash.Essentials namespace PepperDash.Essentials
{ {
public class ControlSystem : CrestronControlSystem public class ControlSystem : CrestronControlSystem
{ {
HttpLogoServer LogoServer; HttpLogoServer LogoServer;
List<object> FactoryObjects = new List<object>(); List<object> FactoryObjects = new List<object>();
public ControlSystem() public ControlSystem()
: base() : base()
{ {
Thread.MaxNumberOfUserThreads = 400; Thread.MaxNumberOfUserThreads = 400;
Global.ControlSystem = this; Global.ControlSystem = this;
DeviceManager.Initialize(this); DeviceManager.Initialize(this);
} }
/// <summary> /// <summary>
/// Git 'er goin' /// Git 'er goin'
/// </summary> /// </summary>
public override void InitializeSystem() public override void InitializeSystem()
{ {
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 => CrestronConsole.AddNewConsoleCommand(s =>
{ {
Debug.Console(0, Debug.ErrorLogLevel.Notice, "CONSOLE MESSAGE: {0}", s); Debug.Console(0, Debug.ErrorLogLevel.Notice, "CONSOLE MESSAGE: {0}", s);
}, "appdebugmessage", "Writes message to log", ConsoleAccessLevelEnum.AccessOperator); }, "appdebugmessage", "Writes message to log", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s => CrestronConsole.AddNewConsoleCommand(s =>
{ {
@@ -56,23 +56,23 @@ namespace PepperDash.Essentials
}, },
"listtielines", "Prints out all tie lines", ConsoleAccessLevelEnum.AccessOperator); "listtielines", "Prints out all tie lines", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s => CrestronConsole.AddNewConsoleCommand(s =>
{ {
CrestronConsole.ConsoleCommandResponse CrestronConsole.ConsoleCommandResponse
("Current running configuration. This is the merged system and template configuration"); ("Current running configuration. This is the merged system and template configuration");
CrestronConsole.ConsoleCommandResponse(Newtonsoft.Json.JsonConvert.SerializeObject CrestronConsole.ConsoleCommandResponse(Newtonsoft.Json.JsonConvert.SerializeObject
(ConfigReader.ConfigObject, Newtonsoft.Json.Formatting.Indented)); (ConfigReader.ConfigObject, Newtonsoft.Json.Formatting.Indented));
}, "showconfig", "Shows the current running merged config", ConsoleAccessLevelEnum.AccessOperator); }, "showconfig", "Shows the current running merged config", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s => CrestronConsole.AddNewConsoleCommand(s =>
{ {
CrestronConsole.ConsoleCommandResponse("This system can be found at the following URLs:\r" + CrestronConsole.ConsoleCommandResponse("This system can be found at the following URLs:\r" +
"System URL: {0}\r" + "System URL: {0}\r" +
"Template URL: {1}", ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.TemplateUrl); "Template URL: {1}", ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.TemplateUrl);
}, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator); }, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator);
GoWithLoad(); GoWithLoad();
} }
/// <summary> /// <summary>
/// Determines if the program is running on a processor (appliance) or server (VC-4). /// Determines if the program is running on a processor (appliance) or server (VC-4).
@@ -100,7 +100,7 @@ namespace PepperDash.Essentials
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on 3-series Appliance", versionString); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on 3-series Appliance", versionString);
// Check if User/ProgramX exists // Check if User/ProgramX exists
if(Directory.Exists(directoryPrefix + dirSeparator + "User" if (Directory.Exists(directoryPrefix + dirSeparator + "User"
+ dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber))) + dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber)))
{ {
Debug.Console(0, @"User/program{0} directory found", InitialParametersClass.ApplicationNumber); Debug.Console(0, @"User/program{0} directory found", InitialParametersClass.ApplicationNumber);
@@ -134,120 +134,157 @@ namespace PepperDash.Essentials
Global.SetFilePathPrefix(filePathPrefix); Global.SetFilePathPrefix(filePathPrefix);
} }
/// <summary> /// <summary>
/// Do it, yo /// Do it, yo
/// </summary> /// </summary>
public void GoWithLoad() public void GoWithLoad()
{ {
try try
{ {
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials load from configuration"); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials load from configuration");
var filesReady = SetupFilesystem(); var filesReady = SetupFilesystem();
if (filesReady) if (filesReady)
{ {
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Checking for plugins"); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Checking for plugins");
LoadPlugins(); LoadPlugins();
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Folder structure verified. Loading config..."); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Folder structure verified. Loading config...");
if (!ConfigReader.LoadConfig2()) if (!ConfigReader.LoadConfig2())
return; return;
Load(); Load();
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Essentials load complete\r" + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Essentials load complete\r" +
"-------------------------------------------------------------"); "-------------------------------------------------------------");
} }
else else
{ {
Debug.Console(0, Debug.Console(0,
"------------------------------------------------\r" + "------------------------------------------------\r" +
"------------------------------------------------\r" + "------------------------------------------------\r" +
"------------------------------------------------\r" + "------------------------------------------------\r" +
"Essentials file structure setup completed.\r" + "Essentials file structure setup completed.\r" +
"Please load config, sgd and ir files and\r" + "Please load config, sgd and ir files and\r" +
"restart program.\r" + "restart program.\r" +
"------------------------------------------------\r" + "------------------------------------------------\r" +
"------------------------------------------------\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 OS that the program intitialization has completed // Notify the OS that the program intitialization has completed
SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true; SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true;
} }
/// <summary> /// <summary>
/// Initial simple implementation. Reads user/programN/plugins folder and /// Initial simple implementation. Reads user/programN/plugins folder and
/// use /// use
/// </summary> /// </summary>
void LoadPlugins() void LoadPlugins()
{ {
var dir = Global.FilePathPrefix + "plugins"; var dir = Global.FilePathPrefix + "plugins";
if (Directory.Exists(dir)) if (Directory.Exists(dir))
{ {
// TODO Clear out or create localPlugins folder (maybe in program slot folder) // TODO Clear out or create localPlugins folder (maybe in program slot folder)
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Plugins directory found, checking for factory plugins"); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Plugins directory found, checking for factory plugins");
var di = new DirectoryInfo(dir); var di = new DirectoryInfo(dir);
var files = di.GetFiles("*.dll"); var zFiles = di.GetFiles("*.cplz");
foreach (FileInfo fi in files) foreach (var fi in zFiles)
{ {
// TODO COPY plugin to loadedPlugins folder Debug.Console(0, "Found cplz: {0}. Unzipping into plugins directory", fi.Name);
var result = CrestronZIP.Unzip(fi.FullName, di.FullName);
Debug.Console(0, "UnZip Result: {0}", result.ToString());
fi.Delete();
}
var files = di.GetFiles("*.dll");
Dictionary<string, Assembly> assyList = new Dictionary<string, Assembly>();
foreach (FileInfo fi in files)
{
// TODO COPY plugin to loadedPlugins folder
// TODO LOAD that loadedPlugins dll file
try
{
var assy = Assembly.LoadFrom(fi.FullName);
var ver = assy.GetName().Version;
var verStr = string.Format("{0}.{1}.{2}.{3}", ver.Major, ver.Minor, ver.Build, ver.Revision);
assyList.Add(fi.FullName, assy);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loaded plugin file '{0}', version {1}", fi.FullName, verStr);
}
catch
{
Debug.Console(2, "Assembly {0} is not a custom assembly", fi.FullName);
continue; //catching any load issues and continuing. There will be exceptions loading Crestron .dlls from the cplz Probably should do something different here
}
}
foreach (var assy in assyList)
{
// iteratate this assembly's classes, looking for "LoadPlugin()" methods
try
{
var types = assy.Value.GetTypes();
foreach (var type in types)
{
try
{
var methods = type.GetMethods(BindingFlags.Public | BindingFlags.Static);
var loadPlugin = methods.FirstOrDefault(m => m.Name.Equals("LoadPlugin"));
if (loadPlugin != null)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Adding type {0}", assy.Key, type.FullName);
loadPlugin.Invoke(null, null);
}
}
catch
{
Debug.Console(2, "Load Plugin not found. {0} is not a plugin assembly", assy.Value.FullName);
continue;
}
// TODO LOAD that loadedPlugins dll file }
}
catch
{
Debug.Console(2, "Assembly {0} is not a custom assembly. Types cannot be loaded.", assy.Value.FullName);
continue;
}
}
// plugin dll will be loaded. Any classes in plugin should have a static constructor
// that registers that class with the Core.DeviceFactory
}
}
var assy = Assembly.LoadFrom(fi.FullName); /// <summary>
var ver = assy.GetName().Version; /// Verifies filesystem is set up. IR, SGD, and programX folders
var verStr = string.Format("{0}.{1}.{2}.{3}", ver.Major, ver.Minor, ver.Build, ver.Revision); /// </summary>
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loaded plugin file '{0}', version {1}", fi.FullName, verStr); 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);
// iteratate this assembly's classes, looking for "LoadPlugin()" methods var irDir = Global.FilePathPrefix + "ir";
var types = assy.GetTypes(); if (!Directory.Exists(irDir))
foreach (var type in types) Directory.Create(irDir);
{
var methods = type.GetMethods(BindingFlags.Public | BindingFlags.Static);
var loadPlugin = methods.FirstOrDefault(m => m.Name.Equals("LoadPlugin"));
if (loadPlugin != null)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Adding type {0}", fi.FullName, type.FullName);
loadPlugin.Invoke(null, null);
}
}
// plugin dll will be loaded. Any classes in plugin should have a static constructor
// that registers that class with the Core.DeviceFactory
}
}
}
/// <summary>
/// Verifies filesystem is set up. IR, SGD, and programX 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"; var sgdDir = Global.FilePathPrefix + "sgd";
if (!Directory.Exists(sgdDir)) if (!Directory.Exists(sgdDir))
Directory.Create(sgdDir); Directory.Create(sgdDir);
var pluginDir = Global.FilePathPrefix + "plugins";
if (!Directory.Exists(pluginDir))
Directory.Create(pluginDir);
return configExists; return configExists;
} }
@@ -292,7 +329,7 @@ namespace PepperDash.Essentials
DeviceManager.ActivateAll(); DeviceManager.ActivateAll();
LinkSystemMonitorToAppServer(); LinkSystemMonitorToAppServer();
} }
void LinkSystemMonitorToAppServer() void LinkSystemMonitorToAppServer()
{ {
@@ -313,24 +350,24 @@ namespace PepperDash.Essentials
} }
} }
/// <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 // Build the processor wrapper class
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor")); DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor"));
// Add global System Monitor device // Add global System Monitor device
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Monitoring.SystemMonitorController("systemMonitor")); DeviceManager.AddDevice(new PepperDash.Essentials.Core.Monitoring.SystemMonitorController("systemMonitor"));
foreach (var devConf in ConfigReader.ConfigObject.Devices) foreach (var devConf in ConfigReader.ConfigObject.Devices)
{ {
try try
{ {
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Creating device '{0}', type '{1}'", devConf.Key, devConf.Type); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Creating device '{0}', type '{1}'", devConf.Key, devConf.Type);
// Skip this to prevent unnecessary warnings // Skip this to prevent unnecessary warnings
if (devConf.Key == "processor") if (devConf.Key == "processor")
{ {
if (devConf.Type.ToLower() != Global.ControlSystem.ControllerPrompt.ToLower()) if (devConf.Type.ToLower() != Global.ControlSystem.ControllerPrompt.ToLower())
@@ -341,13 +378,13 @@ namespace PepperDash.Essentials
continue; continue;
} }
// Try local factories first // Try local factories first
var newDev = DeviceFactory.GetDevice(devConf); var newDev = DeviceFactory.GetDevice(devConf);
if (newDev == null) if (newDev == null)
newDev = BridgeFactory.GetDevice(devConf); newDev = BridgeFactory.GetDevice(devConf);
// Then associated library factories // Then associated library factories
if (newDev == null) if (newDev == null)
newDev = PepperDash.Essentials.Core.DeviceFactory.GetDevice(devConf); newDev = PepperDash.Essentials.Core.DeviceFactory.GetDevice(devConf);
if (newDev == null) if (newDev == null)
@@ -356,8 +393,6 @@ namespace PepperDash.Essentials
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) // might want to consider the ability to override an essentials "type" //if (newDev == null) // might want to consider the ability to override an essentials "type"
//{ //{
@@ -376,59 +411,59 @@ namespace PepperDash.Essentials
DeviceManager.AddDevice(newDev); DeviceManager.AddDevice(newDev);
else else
Debug.Console(0, Debug.ErrorLogLevel.Notice, "ERROR: Cannot load unknown device type '{0}', key '{1}'.", devConf.Type, devConf.Key); Debug.Console(0, Debug.ErrorLogLevel.Notice, "ERROR: Cannot load unknown device type '{0}', key '{1}'.", devConf.Type, devConf.Key);
} }
catch (Exception e) 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, "ERROR: Creating device {0}. Skipping device. \r{1}", devConf.Key, e);
} }
} }
Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Devices Loaded."); Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Devices Loaded.");
} }
/// <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>
public void LoadTieLines() public void LoadTieLines()
{ {
// In the future, we can't necessarily just clear here because devices // In the future, we can't necessarily just clear here because devices
// might be making their own internal sources/tie lines // might be making their own internal sources/tie lines
var tlc = TieLineCollection.Default; var tlc = TieLineCollection.Default;
//tlc.Clear(); //tlc.Clear();
if (ConfigReader.ConfigObject.TieLines == null) if (ConfigReader.ConfigObject.TieLines == null)
{ {
return; return;
} }
foreach (var tieLineConfig in ConfigReader.ConfigObject.TieLines) foreach (var tieLineConfig in ConfigReader.ConfigObject.TieLines)
{ {
var newTL = tieLineConfig.GetTieLine(); var newTL = tieLineConfig.GetTieLine();
if (newTL != null) if (newTL != null)
tlc.Add(newTL); tlc.Add(newTL);
} }
Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Tie Lines Loaded."); Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Tie Lines Loaded.");
} }
/// <summary> /// <summary>
/// Reads all rooms from config and adds them to DeviceManager /// Reads all rooms from config and adds them to DeviceManager
/// </summary> /// </summary>
public void LoadRooms() public void LoadRooms()
{ {
if (ConfigReader.ConfigObject.Rooms == null) if (ConfigReader.ConfigObject.Rooms == null)
{ {
Debug.Console(0, Debug.ErrorLogLevel.Warning, "WARNING: Configuration contains no rooms"); Debug.Console(0, Debug.ErrorLogLevel.Warning, "WARNING: Configuration contains no rooms");
return; return;
} }
foreach (var roomConfig in ConfigReader.ConfigObject.Rooms) foreach (var roomConfig in ConfigReader.ConfigObject.Rooms)
{ {
var room = EssentialsRoomConfigHelper.GetRoomObject(roomConfig) as EssentialsRoomBase; var room = EssentialsRoomConfigHelper.GetRoomObject(roomConfig) as EssentialsRoomBase;
if (room != null) if (room != null)
{ {
if (room is EssentialsHuddleSpaceRoom) if (room is EssentialsHuddleSpaceRoom)
{ {
DeviceManager.AddDevice(room); DeviceManager.AddDevice(room);
@@ -438,10 +473,10 @@ namespace PepperDash.Essentials
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Cotija Bridge..."); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Cotija Bridge...");
// Cotija bridge // Cotija bridge
var bridge = new CotijaEssentialsHuddleSpaceRoomBridge(room as EssentialsHuddleSpaceRoom); var bridge = new CotijaEssentialsHuddleSpaceRoomBridge(room as EssentialsHuddleSpaceRoom);
AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present
DeviceManager.AddDevice(bridge); DeviceManager.AddDevice(bridge);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Cotija Bridge Added..."); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Cotija Bridge Added...");
} }
@@ -452,11 +487,11 @@ namespace PepperDash.Essentials
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleVtc1Room, attempting to add to DeviceManager with Fusion"); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleVtc1Room, attempting to add to DeviceManager with Fusion");
DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController((EssentialsHuddleVtc1Room)room, 0xf1)); DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController((EssentialsHuddleVtc1Room)room, 0xf1));
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Cotija Bridge..."); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Cotija Bridge...");
// Cotija bridge // Cotija bridge
var bridge = new CotijaEssentialsHuddleSpaceRoomBridge(room); var bridge = new CotijaEssentialsHuddleSpaceRoomBridge(room);
AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present
DeviceManager.AddDevice(bridge); DeviceManager.AddDevice(bridge);
} }
else else
{ {
@@ -464,48 +499,48 @@ namespace PepperDash.Essentials
DeviceManager.AddDevice(room); DeviceManager.AddDevice(room);
} }
} }
else else
Debug.Console(0, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create room from config, key '{0}'", roomConfig.Key); 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."); Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Rooms Loaded.");
} }
/// <summary> /// <summary>
/// Helps add the post activation steps that link bridges to main controller /// Helps add the post activation steps that link bridges to main controller
/// </summary> /// </summary>
/// <param name="bridge"></param> /// <param name="bridge"></param>
void AddBridgePostActivationHelper(CotijaBridgeBase bridge) void AddBridgePostActivationHelper(CotijaBridgeBase bridge)
{ {
bridge.AddPostActivationAction(() => bridge.AddPostActivationAction(() =>
{ {
var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "appServer") as CotijaSystemController; var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "appServer") as CotijaSystemController;
if (parent == null) if (parent == null)
{ {
Debug.Console(0, bridge, "ERROR: Cannot connect app server room bridge. System controller not present"); Debug.Console(0, bridge, "ERROR: Cannot connect app server room bridge. System controller not present");
return; return;
} }
Debug.Console(0, bridge, "Linking to parent controller"); Debug.Console(0, bridge, "Linking to parent controller");
bridge.AddParent(parent); bridge.AddParent(parent);
parent.AddBridge(bridge); parent.AddBridge(bridge);
}); });
} }
/// <summary> /// <summary>
/// Fires up a logo server if not already running /// Fires up a logo server if not already running
/// </summary> /// </summary>
void LoadLogoServer() void LoadLogoServer()
{ {
try try
{ {
LogoServer = new HttpLogoServer(8080, Global.DirectorySeparator + "html" + Global.DirectorySeparator + "logo"); LogoServer = new HttpLogoServer(8080, Global.DirectorySeparator + "html" + Global.DirectorySeparator + "logo");
} }
catch (Exception) catch (Exception)
{ {
Debug.Console(0, Debug.ErrorLogLevel.Notice, "NOTICE: Logo server cannot be started. Likely already running in another program"); Debug.Console(0, Debug.ErrorLogLevel.Notice, "NOTICE: Logo server cannot be started. Likely already running in another program");
} }
} }
} }
} }

View File

@@ -43,13 +43,13 @@ namespace PepperDash.Essentials
return new Device(key, name); return new Device(key, name);
} }
// MOVE into something else??? //// MOVE into something else???
else if (typeName == "basicirdisplay") //else if (typeName == "basicirdisplay")
{ //{
var ir = IRPortHelper.GetIrPort(properties); // var ir = IRPortHelper.GetIrPort(properties);
if (ir != null) // if (ir != null)
return new BasicIrDisplay(key, name, ir.Port, ir.FileName); // return new BasicIrDisplay(key, name, ir.Port, ir.FileName);
} //}
else if (typeName == "commmock") else if (typeName == "commmock")
{ {

View File

@@ -13,6 +13,7 @@ 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.PageManagers; using PepperDash.Essentials.Core.PageManagers;
using PepperDash.Essentials.DM.Endpoints.DGEs;
namespace PepperDash.Essentials namespace PepperDash.Essentials
@@ -23,9 +24,31 @@ namespace PepperDash.Essentials
{ {
var comm = CommFactory.GetControlPropertiesConfig(config); var comm = CommFactory.GetControlPropertiesConfig(config);
var typeName = config.Type.ToLower();
EssentialsTouchpanelController panelController = null;
var props = JsonConvert.DeserializeObject<CrestronTouchpanelPropertiesConfig>(config.Properties.ToString()); var props = JsonConvert.DeserializeObject<CrestronTouchpanelPropertiesConfig>(config.Properties.ToString());
EssentialsTouchpanelController panelController = new EssentialsTouchpanelController(config.Key, config.Name, config.Type, props, comm.IpIdInt); if (typeName.Contains("dge"))
{
Dge100 dgeDevice = null;
if (typeName == "dge100")
dgeDevice = new Dge100(comm.IpIdInt, Global.ControlSystem);
else if (typeName == "dmdge200c")
dgeDevice = new DmDge200C(comm.IpIdInt, Global.ControlSystem);
var dgeController = new DgeController(config.Key, config.Name, dgeDevice, config, props);
DeviceManager.AddDevice(dgeController);
panelController = new EssentialsTouchpanelController(config.Key, config.Name, dgeController.DigitalGraphicsEngine,
props.ProjectName, props.SgdFile);
}
else
{
panelController = new EssentialsTouchpanelController(config.Key, config.Name, config.Type, props, comm.IpIdInt);
}
panelController.AddPostActivationAction(() => panelController.AddPostActivationAction(() =>
{ {

View File

@@ -116,9 +116,11 @@
<Compile Include="AppServer\Messengers\SystemMonitorMessenger.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\AppleTvBridge.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\CameraControllerBridge.cs" />
<Compile Include="Bridges\AirMediaControllerBridge.cs" />
<Compile Include="Bridges\DisplayControllerBridge.cs" /> <Compile Include="Bridges\DisplayControllerBridge.cs" />
<Compile Include="Bridges\DigitalLoggerBridge.cs" /> <Compile Include="Bridges\DigitalLoggerBridge.cs" />
<Compile Include="Bridges\DmChassisControllerBridge.cs" /> <Compile Include="Bridges\DmChassisControllerBridge.cs" />
@@ -127,6 +129,7 @@
<Compile Include="Bridges\GenericRelayDeviceBridge.cs" /> <Compile Include="Bridges\GenericRelayDeviceBridge.cs" />
<Compile Include="Bridges\IBasicCommunicationBridge.cs" /> <Compile Include="Bridges\IBasicCommunicationBridge.cs" />
<Compile Include="Bridges\DmRmcControllerBridge.cs" /> <Compile Include="Bridges\DmRmcControllerBridge.cs" />
<Compile Include="Bridges\IBridge.cs" />
<Compile Include="Bridges\IDigitalInputBridge.cs" /> <Compile Include="Bridges\IDigitalInputBridge.cs" />
<Compile Include="Bridges\JoinMapBase.cs" /> <Compile Include="Bridges\JoinMapBase.cs" />
<Compile Include="Bridges\SystemMonitorBridge.cs" /> <Compile Include="Bridges\SystemMonitorBridge.cs" />
@@ -221,7 +224,6 @@
<Compile Include="AppServer\CotijaSystemController.cs" /> <Compile Include="AppServer\CotijaSystemController.cs" />
<Compile Include="UI\DualDisplaySourceSRLController.cs" /> <Compile Include="UI\DualDisplaySourceSRLController.cs" />
<Compile Include="UI\SubpageReferenceListActivityItem.cs" /> <Compile Include="UI\SubpageReferenceListActivityItem.cs" />
<Compile Include="UI\CrestronTouchpanelPropertiesConfig.cs" />
<Compile Include="FOR REFERENCE UI\Panels\REMOVE UiCue.cs" /> <Compile Include="FOR REFERENCE UI\Panels\REMOVE UiCue.cs" />
<Compile Include="FOR REFERENCE UI\SRL\SourceListSubpageReferenceList.cs" /> <Compile Include="FOR REFERENCE UI\SRL\SourceListSubpageReferenceList.cs" />
<Compile Include="Room\Types\EssentialsHuddleSpaceRoom.cs" /> <Compile Include="Room\Types\EssentialsHuddleSpaceRoom.cs" />

View File

@@ -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.4.0.*")] [assembly: AssemblyVersion("1.4.11.*")]

View File

@@ -1,48 +0,0 @@
namespace PepperDash.Essentials
{
public class CrestronTouchpanelPropertiesConfig
{
public string IpId { get; set; }
public string DefaultRoomKey { get; set; }
public string RoomListKey { get; set; }
public string SgdFile { get; set; }
public string ProjectName { get; set; }
public bool ShowVolumeGauge { get; set; }
public bool UsesSplashPage { get; set; }
public bool ShowDate { get; set; }
public bool ShowTime { get; set; }
public UiSetupPropertiesConfig Setup { get; set; }
public string HeaderStyle { get; set; }
public bool IncludeInFusionRoomHealth { get; set; }
/// <summary>
/// The count of sources that will trigger the "additional" arrows to show on the SRL.
/// Defaults to 5
/// </summary>
public int SourcesOverflowCount { get; set; }
public CrestronTouchpanelPropertiesConfig()
{
SourcesOverflowCount = 5;
HeaderStyle = CrestronTouchpanelPropertiesConfig.Habanero;
}
/// <summary>
/// "habanero"
/// </summary>
public const string Habanero = "habanero";
/// <summary>
/// "verbose"
/// </summary>
public const string Verbose = "verbose";
}
/// <summary>
///
/// </summary>
public class UiSetupPropertiesConfig
{
public bool IsVisible { get; set; }
}
}

View File

@@ -27,9 +27,17 @@ namespace PepperDash.Essentials
{ {
Panel = tsw; Panel = tsw;
tsw.LoadSmartObjects(sgdPath); tsw.LoadSmartObjects(sgdPath);
tsw.SigChange += new Crestron.SimplSharpPro.DeviceSupport.SigEventHandler(Tsw_SigChange); tsw.SigChange += Panel_SigChange;
} }
public EssentialsTouchpanelController(string key, string name, Dge100 panel, string projectName, string sgdPath)
: base(key, name)
{
Panel = panel;
panel.LoadSmartObjects(sgdPath);
panel.SigChange += Panel_SigChange;
}
/// <summary> /// <summary>
/// Config constructor /// Config constructor
/// </summary> /// </summary>
@@ -102,7 +110,7 @@ namespace PepperDash.Essentials
} }
Panel.LoadSmartObjects(sgdName); Panel.LoadSmartObjects(sgdName);
Panel.SigChange += Tsw_SigChange; Panel.SigChange += Panel_SigChange;
} }
@@ -158,7 +166,7 @@ namespace PepperDash.Essentials
} }
} }
void Tsw_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args) void Panel_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
{ {
if (Debug.Level == 2) if (Debug.Level == 2)
Debug.Console(2, this, "Sig change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue); Debug.Console(2, this, "Sig change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);

View File

@@ -712,10 +712,10 @@ namespace PepperDash.Essentials.UIDrivers.VC
void SetupLayoutControls() void SetupLayoutControls()
{ {
TriList.SetSigFalseAction(UIBoolJoin.VCStagingSelfViewLayoutPress, this.ShowSelfViewLayout); TriList.SetSigFalseAction(UIBoolJoin.VCStagingSelfViewLayoutPress, this.ShowSelfViewLayout);
var svc = Codec as IHasCodecSelfview; var svc = Codec as IHasCodecSelfView;
if (svc != null) if (svc != null)
{ {
TriList.SetSigFalseAction(UIBoolJoin.VCSelfViewTogglePress, svc.SelfviewModeToggle); TriList.SetSigFalseAction(UIBoolJoin.VCSelfViewTogglePress, svc.SelfViewModeToggle);
svc.SelfviewIsOnFeedback.LinkInputSig(TriList.BooleanInput[UIBoolJoin.VCSelfViewTogglePress]); svc.SelfviewIsOnFeedback.LinkInputSig(TriList.BooleanInput[UIBoolJoin.VCSelfViewTogglePress]);
} }
var lc = Codec as IHasCodecLayouts; var lc = Codec as IHasCodecLayouts;

16
README.md Normal file
View File

@@ -0,0 +1,16 @@
# Pepperdash Essentials
#### How to merge
## Essentials Framework
- If any external references have changed (like PepperDash.Core), make not of them in the commit in Framework
- Make changes
- Build
- Test on your system
- Commit and push to framework
- Commit and push to essentials
- Curse a whole lot when you try to figure out how to then get developments all synced up

View File

@@ -35,3 +35,7 @@ devjson:3 {"deviceKey":"room1.RoomOccupancy.RoomIsOccupiedFeedback","methodName"
devjson:2 {"deviceKey":"codec-comms-ssh", "methodName":"SendText", "params": ["xcommand dial number: 10.11.50.211\r"]} devjson:2 {"deviceKey":"codec-comms-ssh", "methodName":"SendText", "params": ["xcommand dial number: 10.11.50.211\r"]}
devjson:2 {"deviceKey":"codec-comms-ssh", "methodName":"Connect", "params": []} devjson:2 {"deviceKey":"codec-comms-ssh", "methodName":"Connect", "params": []}
devjson:1 {"deviceKey":"commBridge", "methodName":"ExecuteJoinAction", "params":[ 301, "digital", true ]}
devjson:2 {"deviceKey":"display01Comm-com", "methodName":"SendText", "params": [ "I'M GETTING TIRED OF THIS" ]}