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,22 +745,21 @@ 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
var auxFaderDict = new Dictionary<string, Volume>();
for (uint i = 2; i <= count; i++) for (uint i = 2; i <= count; i++)
{ {
auxFaders.Add( auxFaderDict.Add("level-" + i,
new Volume(string.Format("level-{0}", i), new Volume("level-" + i,
EISC.UShortOutput[i].UShortValue, EISC.UShortOutput[i].UShortValue,
EISC.BooleanOutput[i].BoolValue, EISC.BooleanOutput[i].BoolValue,
EISC.StringOutput[800 + i].StringValue, EISC.StringOutput[i].StringValue,
true, true,
"someting.png")); "someting.png"));
} }
@@ -714,14 +769,17 @@ namespace PepperDash.Essentials.Room.Cotija
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,10 +14,9 @@ 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?
@@ -40,11 +39,11 @@ public class BridgeFactory
return null; return null;
} }
} }
public class CommBridge : Device public class CommBridge : Device
{ {
public CommBridgeProperties Properties { get; private set; } public CommBridgeProperties Properties { get; private set; }
public List<IBasicCommunication> CommDevices { get; private set; } public List<IBasicCommunication> CommDevices { get; private set; }
@@ -87,11 +86,11 @@ public class CommBridge : Device
return true; 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; }
@@ -102,17 +101,17 @@ public class EiscBridgeProperties
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; }
@@ -136,6 +135,5 @@ public class BridgeApiEisc
else if (uo is Action<string>) else if (uo is Action<string>)
(uo as Action<string>)(args.Sig.StringValue); (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();
var commMonitor = displayDevice as ICommunicationMonitor;
if (commMonitor != null)
{
commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
}
InputNumberFeedback = new IntFeedback(() => { return InputNumber; }); 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 // Two way feedbacks
trilist.SetSigTrueAction(JoinMap.PowerOff, () => 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();
} }
if (twoWayDisplay != null)
InputNumberFeedback.FireUpdate(); 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)
@@ -127,17 +155,25 @@ namespace PepperDash.Essentials.Bridges
} }
public class DisplayControllerJoinMap : JoinMapBase public class DisplayControllerJoinMap : JoinMapBase
{ {
// Digital
public uint PowerOff { get; set; }
public uint PowerOn { get; set; }
public uint IsTwoWayDisplay { get; set; }
public uint VolumeUp { get; set; }
public uint VolumeDown { get; set; }
public uint VolumeMute { get; set; }
public uint InputSelectOffset { get; set; }
public uint ButtonVisibilityOffset { 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 Name { get; set; }
public uint InputNamesOffset { 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() public DisplayControllerJoinMap()
{ {
@@ -145,14 +181,21 @@ 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;
InputSelectOffset = 10;
// Analog
InputSelect = 11;
VolumeLevelFB = 5;
// Serial
Name = 1; Name = 1;
InputNamesOffset = 10; InputNamesOffset = 10;
InputSelectOffset = 4;
// Analog
} }
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

@@ -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

@@ -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);
@@ -197,37 +197,70 @@ namespace PepperDash.Essentials
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 zFiles = di.GetFiles("*.cplz");
foreach (var fi in zFiles)
{
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"); var files = di.GetFiles("*.dll");
Dictionary<string, Assembly> assyList = new Dictionary<string, Assembly>();
foreach (FileInfo fi in files) foreach (FileInfo fi in files)
{ {
// TODO COPY plugin to loadedPlugins folder // TODO COPY plugin to loadedPlugins folder
// TODO LOAD that loadedPlugins dll file // TODO LOAD that loadedPlugins dll file
try
{
var assy = Assembly.LoadFrom(fi.FullName); var assy = Assembly.LoadFrom(fi.FullName);
var ver = assy.GetName().Version; var ver = assy.GetName().Version;
var verStr = string.Format("{0}.{1}.{2}.{3}", ver.Major, ver.Minor, ver.Build, ver.Revision); 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); 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 // iteratate this assembly's classes, looking for "LoadPlugin()" methods
var types = assy.GetTypes(); try
{
var types = assy.Value.GetTypes();
foreach (var type in types) foreach (var type in types)
{
try
{ {
var methods = type.GetMethods(BindingFlags.Public | BindingFlags.Static); var methods = type.GetMethods(BindingFlags.Public | BindingFlags.Static);
var loadPlugin = methods.FirstOrDefault(m => m.Name.Equals("LoadPlugin")); var loadPlugin = methods.FirstOrDefault(m => m.Name.Equals("LoadPlugin"));
if (loadPlugin != null) if (loadPlugin != null)
{ {
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Adding type {0}", fi.FullName, type.FullName); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Adding type {0}", assy.Key, type.FullName);
loadPlugin.Invoke(null, null); loadPlugin.Invoke(null, null);
} }
}
catch
{
Debug.Console(2, "Load Plugin not found. {0} is not a plugin assembly", assy.Value.FullName);
continue;
} }
}
}
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 // plugin dll will be loaded. Any classes in plugin should have a static constructor
// that registers that class with the Core.DeviceFactory // that registers that class with the Core.DeviceFactory
} }
} }
}
/// <summary> /// <summary>
/// Verifies filesystem is set up. IR, SGD, and programX folders /// Verifies filesystem is set up. IR, SGD, and programX folders
@@ -248,6 +281,10 @@ namespace PepperDash.Essentials
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;
} }
@@ -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"
//{ //{

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,7 +27,15 @@ 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>
@@ -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" ]}