Merge remote-tracking branch 'origin/maintenance/KPMG' into feature/ecs-1123

# Conflicts:
#	PepperDashEssentials/Bridges/BridgeBase.cs
#	PepperDashEssentials/ControlSystem.cs
This commit is contained in:
Neil Dorin
2019-07-09 16:49:37 -06:00
7 changed files with 405 additions and 353 deletions

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

@@ -127,6 +127,11 @@ namespace PepperDash.Essentials.Bridges
{ {
(device as AppleTV).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); (device as AppleTV).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue; 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)
//{ //{

View File

@@ -14,7 +14,6 @@ using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.EthernetCommunication; using Crestron.SimplSharpPro.EthernetCommunication;
namespace PepperDash.Essentials namespace PepperDash.Essentials
{ {
public class BridgeFactory public class BridgeFactory
{ {
@@ -138,4 +137,3 @@ public class BridgeApiEisc
} }
} }
} }

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

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

View File

@@ -129,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" />

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;