mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-28 11:54:57 +00:00
Compare commits
31 Commits
1.6.7-alph
...
1.6.7-alph
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
669f9e71bc | ||
|
|
5d2f20efd5 | ||
|
|
e705f67333 | ||
|
|
7d72d54862 | ||
|
|
ed6ad6ae76 | ||
|
|
1689b15d95 | ||
|
|
010fdde45c | ||
|
|
10509991c1 | ||
|
|
c686ee394d | ||
|
|
985902092e | ||
|
|
944b72e2a8 | ||
|
|
d074be323c | ||
|
|
0098401584 | ||
|
|
0d7d5fe380 | ||
|
|
1cb9fb6058 | ||
|
|
5076ba405e | ||
|
|
3c60dfdf7b | ||
|
|
5d44b5f3ef | ||
|
|
40cdd4c1e7 | ||
|
|
f5753109d5 | ||
|
|
51e338749a | ||
|
|
e37fb33afe | ||
|
|
47af06578a | ||
|
|
ad0cbba0b1 | ||
|
|
c7a3282dd9 | ||
|
|
fd593baa07 | ||
|
|
8250246f34 | ||
|
|
dd6e26ae4b | ||
|
|
fac1dd3d61 | ||
|
|
f22bf60eb6 | ||
|
|
f036c3f1cc |
@@ -538,6 +538,20 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
void LoadLogoServer()
|
||||
{
|
||||
if (ConfigReader.ConfigObject.Rooms == null)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "No rooms configured. Bypassing Logo server startup.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
!ConfigReader.ConfigObject.Rooms.Any(
|
||||
CheckRoomConfig))
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "No rooms configured to use system Logo server. Bypassing Logo server startup");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
LogoServer = new HttpLogoServer(8080, Global.DirectorySeparator + "html" + Global.DirectorySeparator + "logo");
|
||||
@@ -547,5 +561,30 @@ namespace PepperDash.Essentials
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "NOTICE: Logo server cannot be started. Likely already running in another program");
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckRoomConfig(DeviceConfig c)
|
||||
{
|
||||
string logoDark = null;
|
||||
string logoLight = null;
|
||||
string logo = null;
|
||||
|
||||
if (c.Properties["logoDark"] != null)
|
||||
{
|
||||
logoDark = c.Properties["logoDark"].Value<string>("type");
|
||||
}
|
||||
|
||||
if (c.Properties["logoLight"] != null)
|
||||
{
|
||||
logoLight = c.Properties["logoLight"].Value<string>("type");
|
||||
}
|
||||
|
||||
if (c.Properties["logo"] != null)
|
||||
{
|
||||
logo = c.Properties["logo"].Value<string>("type");
|
||||
}
|
||||
|
||||
return ((logoDark != null && logoDark == "system") ||
|
||||
(logoLight != null && logoLight == "system") || (logo != null && logo == "system"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,15 +273,18 @@ namespace PepperDash.Essentials.Fusion
|
||||
// Display to fusion room sigs
|
||||
FusionRoom.DisplayPowerOn.OutputSig.UserObject = dispPowerOnAction;
|
||||
FusionRoom.DisplayPowerOff.OutputSig.UserObject = dispPowerOffAction;
|
||||
defaultDisplay.PowerIsOnFeedback.LinkInputSig(FusionRoom.DisplayPowerOn.InputSig);
|
||||
|
||||
var defaultDisplayTwoWay = defaultDisplay as IHasPowerControlWithFeedback;
|
||||
if (defaultDisplayTwoWay != null)
|
||||
{
|
||||
defaultDisplayTwoWay.PowerIsOnFeedback.LinkInputSig(FusionRoom.DisplayPowerOn.InputSig);
|
||||
}
|
||||
|
||||
if (defaultDisplay is IDisplayUsage)
|
||||
(defaultDisplay as IDisplayUsage).LampHours.LinkInputSig(FusionRoom.DisplayUsage.InputSig);
|
||||
|
||||
|
||||
|
||||
MapDisplayToRoomJoins(1, 158, defaultDisplay);
|
||||
|
||||
|
||||
var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(d => d.Key.Equals(defaultDisplay.Key));
|
||||
|
||||
//Check for existing asset in GUIDs collection
|
||||
@@ -302,8 +305,18 @@ namespace PepperDash.Essentials.Fusion
|
||||
var dispAsset = FusionRoom.CreateStaticAsset(tempAsset.SlotNumber, tempAsset.Name, "Display", tempAsset.InstanceId);
|
||||
dispAsset.PowerOn.OutputSig.UserObject = dispPowerOnAction;
|
||||
dispAsset.PowerOff.OutputSig.UserObject = dispPowerOffAction;
|
||||
defaultDisplay.PowerIsOnFeedback.LinkInputSig(dispAsset.PowerOn.InputSig);
|
||||
// NO!! display.PowerIsOn.LinkComplementInputSig(dispAsset.PowerOff.InputSig);
|
||||
|
||||
|
||||
var defaultTwoWayDisplay = defaultDisplay as IHasPowerControlWithFeedback;
|
||||
if (defaultTwoWayDisplay != null)
|
||||
{
|
||||
defaultTwoWayDisplay.PowerIsOnFeedback.LinkInputSig(FusionRoom.DisplayPowerOn.InputSig);
|
||||
if (defaultDisplay is IDisplayUsage)
|
||||
(defaultDisplay as IDisplayUsage).LampHours.LinkInputSig(FusionRoom.DisplayUsage.InputSig);
|
||||
|
||||
defaultTwoWayDisplay.PowerIsOnFeedback.LinkInputSig(dispAsset.PowerOn.InputSig);
|
||||
}
|
||||
|
||||
// Use extension methods
|
||||
dispAsset.TrySetMakeModel(defaultDisplay);
|
||||
dispAsset.TryLinkAssetErrorToCommunication(defaultDisplay);
|
||||
@@ -325,12 +338,17 @@ namespace PepperDash.Essentials.Fusion
|
||||
// Power on
|
||||
var defaultDisplayPowerOn = FusionRoom.CreateOffsetBoolSig((uint)joinOffset, displayName + "Power On", eSigIoMask.InputOutputSig);
|
||||
defaultDisplayPowerOn.OutputSig.UserObject = new Action<bool>(b => { if (!b) display.PowerOn(); });
|
||||
display.PowerIsOnFeedback.LinkInputSig(defaultDisplayPowerOn.InputSig);
|
||||
|
||||
// Power Off
|
||||
var defaultDisplayPowerOff = FusionRoom.CreateOffsetBoolSig((uint)joinOffset + 1, displayName + "Power Off", eSigIoMask.InputOutputSig);
|
||||
defaultDisplayPowerOn.OutputSig.UserObject = new Action<bool>(b => { if (!b) display.PowerOff(); }); ;
|
||||
display.PowerIsOnFeedback.LinkInputSig(defaultDisplayPowerOn.InputSig);
|
||||
|
||||
var displayTwoWay = display as IHasPowerControlWithFeedback;
|
||||
if (displayTwoWay != null)
|
||||
{
|
||||
displayTwoWay.PowerIsOnFeedback.LinkInputSig(defaultDisplayPowerOn.InputSig);
|
||||
displayTwoWay.PowerIsOnFeedback.LinkInputSig(defaultDisplayPowerOn.InputSig);
|
||||
}
|
||||
|
||||
// Current Source
|
||||
var defaultDisplaySourceNone = FusionRoom.CreateOffsetBoolSig((uint)joinOffset + 8, displayName + "Source None", eSigIoMask.InputOutputSig);
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="PepperDash_Core, Version=1.0.41.31808, Culture=neutral, processorArchitecture=MSIL">
|
||||
<Reference Include="PepperDash_Core, Version=1.0.42.30563, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\PepperDashCore\lib\net35\PepperDash_Core.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
@@ -283,19 +283,23 @@ namespace PepperDash.Essentials
|
||||
if (disp != null)
|
||||
{
|
||||
// Link power, warming, cooling to display
|
||||
disp.PowerIsOnFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
if (disp.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue)
|
||||
var dispTwoWay = disp as IHasPowerControlWithFeedback;
|
||||
if (dispTwoWay != null)
|
||||
{
|
||||
dispTwoWay.PowerIsOnFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
if (!disp.PowerIsOnFeedback.BoolValue)
|
||||
disp.CurrentSourceInfo = null;
|
||||
OnFeedback.FireUpdate();
|
||||
}
|
||||
if (disp.PowerIsOnFeedback.BoolValue)
|
||||
{
|
||||
SetDefaultLevels();
|
||||
}
|
||||
};
|
||||
if (dispTwoWay.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue)
|
||||
{
|
||||
if (!dispTwoWay.PowerIsOnFeedback.BoolValue)
|
||||
disp.CurrentSourceInfo = null;
|
||||
OnFeedback.FireUpdate();
|
||||
}
|
||||
if (dispTwoWay.PowerIsOnFeedback.BoolValue)
|
||||
{
|
||||
SetDefaultLevels();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
disp.IsWarmingUpFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
@@ -579,8 +583,8 @@ namespace PepperDash.Essentials
|
||||
|
||||
|
||||
|
||||
if (dest is IPower)
|
||||
(dest as IPower).PowerOff();
|
||||
if (dest is IHasPowerControl)
|
||||
(dest as IHasPowerControl).PowerOff();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -176,15 +176,19 @@ namespace PepperDash.Essentials
|
||||
if (disp != null)
|
||||
{
|
||||
// Link power, warming, cooling to display
|
||||
disp.PowerIsOnFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
if (disp.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue)
|
||||
{
|
||||
if (!disp.PowerIsOnFeedback.BoolValue)
|
||||
CurrentSourceInfo = null;
|
||||
OnFeedback.FireUpdate();
|
||||
}
|
||||
};
|
||||
var dispTwoWay = disp as IHasPowerControlWithFeedback;
|
||||
if (dispTwoWay != null)
|
||||
{
|
||||
dispTwoWay.PowerIsOnFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
if (dispTwoWay.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue)
|
||||
{
|
||||
if (!dispTwoWay.PowerIsOnFeedback.BoolValue)
|
||||
CurrentSourceInfo = null;
|
||||
OnFeedback.FireUpdate();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
disp.IsWarmingUpFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
@@ -495,8 +499,8 @@ namespace PepperDash.Essentials
|
||||
if (route.SourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
dest.ReleaseRoute();
|
||||
if (dest is IPower)
|
||||
(dest as IPower).PowerOff();
|
||||
if (dest is IHasPowerControl)
|
||||
(dest as IHasPowerControl).PowerOff();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -190,6 +190,12 @@ namespace PepperDash.Essentials
|
||||
(_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.AddUser(this, "control");
|
||||
if (handler != null)
|
||||
handler(_CurrentSourceInfo, ChangeType.DidChange);
|
||||
|
||||
var vc = VideoCodec as IHasExternalSourceSwitching;
|
||||
if (vc != null)
|
||||
{
|
||||
vc.SetSelectedSource(CurrentSourceInfoKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
SourceListItem _CurrentSourceInfo;
|
||||
@@ -273,19 +279,23 @@ namespace PepperDash.Essentials
|
||||
if (disp != null)
|
||||
{
|
||||
// Link power, warming, cooling to display
|
||||
disp.PowerIsOnFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
if (disp.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue)
|
||||
var dispTwoWay = disp as IHasPowerControlWithFeedback;
|
||||
if (dispTwoWay != null)
|
||||
{
|
||||
dispTwoWay.PowerIsOnFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
if (!disp.PowerIsOnFeedback.BoolValue)
|
||||
CurrentSourceInfo = null;
|
||||
OnFeedback.FireUpdate();
|
||||
}
|
||||
if (disp.PowerIsOnFeedback.BoolValue)
|
||||
{
|
||||
SetDefaultLevels();
|
||||
}
|
||||
};
|
||||
if (dispTwoWay.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue)
|
||||
{
|
||||
if (!dispTwoWay.PowerIsOnFeedback.BoolValue)
|
||||
CurrentSourceInfo = null;
|
||||
OnFeedback.FireUpdate();
|
||||
}
|
||||
if (dispTwoWay.PowerIsOnFeedback.BoolValue)
|
||||
{
|
||||
SetDefaultLevels();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
disp.IsWarmingUpFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
@@ -640,8 +650,8 @@ namespace PepperDash.Essentials
|
||||
if (route.SourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
dest.ReleaseRoute();
|
||||
if (dest is IPower)
|
||||
(dest as IPower).PowerOff();
|
||||
if (dest is IHasPowerControl)
|
||||
(dest as IHasPowerControl).PowerOff();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.CrestronIO;
|
||||
using Crestron.SimplSharp.Net.Http;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
@@ -16,12 +13,12 @@ namespace PepperDash.Essentials
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
HttpServer Server;
|
||||
readonly HttpServer _server;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
string FileDirectory;
|
||||
readonly string _fileDirectory;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -45,18 +42,17 @@ namespace PepperDash.Essentials
|
||||
//{ ".js", "application/javascript" },
|
||||
//{ ".json", "application/json" },
|
||||
//{ ".map", "application/x-navimap" },
|
||||
{ ".pdf", "application.pdf" },
|
||||
{ ".pdf", "application/pdf" },
|
||||
{ ".png", "image/png" },
|
||||
//{ ".txt", "text/plain" },
|
||||
};
|
||||
|
||||
Server = new HttpServer();
|
||||
Server.Port = port;
|
||||
FileDirectory = directory;
|
||||
Server.OnHttpRequest += new OnHttpRequestHandler(Server_OnHttpRequest);
|
||||
Server.Open();
|
||||
_server = new HttpServer {Port = port};
|
||||
_fileDirectory = directory;
|
||||
_server.OnHttpRequest += Server_OnHttpRequest;
|
||||
_server.Open();
|
||||
|
||||
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
|
||||
CrestronEnvironment.ProgramStatusEventHandler += CrestronEnvironment_ProgramStatusEventHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -67,27 +63,40 @@ namespace PepperDash.Essentials
|
||||
var path = args.Request.Path;
|
||||
Debug.Console(2, "HTTP Request with path: '{0}'", args.Request.Path);
|
||||
|
||||
if (File.Exists(FileDirectory + path))
|
||||
try
|
||||
{
|
||||
string filePath = path.Replace('/', '\\');
|
||||
string localPath = string.Format(@"{0}{1}", FileDirectory, filePath);
|
||||
|
||||
Debug.Console(2, "HTTP Logo Server attempting to find file: '{0}'", localPath);
|
||||
if (File.Exists(localPath))
|
||||
if (File.Exists(_fileDirectory + path))
|
||||
{
|
||||
args.Response.Header.ContentType = GetContentType(new FileInfo(localPath).Extension);
|
||||
args.Response.ContentStream = new FileStream(localPath, FileMode.Open, FileAccess.Read);
|
||||
var filePath = path.Replace('/', '\\');
|
||||
var localPath = string.Format(@"{0}{1}", _fileDirectory, filePath);
|
||||
|
||||
Debug.Console(2, "HTTP Logo Server attempting to find file: '{0}'", localPath);
|
||||
if (File.Exists(localPath))
|
||||
{
|
||||
args.Response.Header.ContentType = GetContentType(new FileInfo(localPath).Extension);
|
||||
args.Response.ContentStream = new FileStream(localPath, FileMode.Open, FileAccess.Read);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(2, "HTTP Logo Server Cannot find file '{0}'", localPath);
|
||||
args.Response.ContentString = string.Format("Not found: '{0}'", filePath);
|
||||
args.Response.Code = 404;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(2, "HTTP Logo Server Cannot find file '{0}'", localPath);
|
||||
args.Response.ContentString = string.Format("Not found: '{0}'", filePath);
|
||||
Debug.Console(2, "HTTP Logo Server: '{0}' does not exist", _fileDirectory + path);
|
||||
args.Response.ContentString = string.Format("Not found: '{0}'", _fileDirectory + path);
|
||||
args.Response.Code = 404;
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.Console(2, "HTTP Logo Server: '{0}' does not exist", FileDirectory + path);
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "Exception getting file: {0}", ex.Message);
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "Stack Trace: {0}", ex.StackTrace);
|
||||
|
||||
args.Response.Code = 400;
|
||||
args.Response.ContentString = string.Format("invalid request");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +106,7 @@ namespace PepperDash.Essentials
|
||||
void CrestronEnvironment_ProgramStatusEventHandler(eProgramStatusEventType programEventType)
|
||||
{
|
||||
if (programEventType == eProgramStatusEventType.Stopping)
|
||||
Server.Close();
|
||||
_server.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -107,11 +116,7 @@ namespace PepperDash.Essentials
|
||||
/// <returns></returns>
|
||||
public static string GetContentType(string extension)
|
||||
{
|
||||
string type;
|
||||
if (ExtensionContentTypes.ContainsKey(extension))
|
||||
type = ExtensionContentTypes[extension];
|
||||
else
|
||||
type = "text/plain";
|
||||
var type = ExtensionContentTypes.ContainsKey(extension) ? ExtensionContentTypes[extension] : "text/plain";
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,9 +305,9 @@ namespace PepperDash.Essentials
|
||||
TriList.SetSigFalseAction(UIBoolJoin.ShowPowerOffPress, EndMeetingPress);
|
||||
|
||||
TriList.SetSigFalseAction(UIBoolJoin.DisplayPowerTogglePress, () =>
|
||||
{
|
||||
if (CurrentRoom != null && CurrentRoom.DefaultDisplay is IPower)
|
||||
(CurrentRoom.DefaultDisplay as IPower).PowerToggle();
|
||||
{
|
||||
if (CurrentRoom != null && CurrentRoom.DefaultDisplay is IHasPowerControl)
|
||||
(CurrentRoom.DefaultDisplay as IHasPowerControl).PowerToggle();
|
||||
});
|
||||
|
||||
base.Show();
|
||||
@@ -984,8 +984,8 @@ namespace PepperDash.Essentials
|
||||
(previousDev as IDvr).UnlinkButtons(TriList);
|
||||
if (previousDev is INumericKeypad)
|
||||
(previousDev as INumericKeypad).UnlinkButtons(TriList);
|
||||
if (previousDev is IPower)
|
||||
(previousDev as IPower).UnlinkButtons(TriList);
|
||||
if (previousDev is IHasPowerControl)
|
||||
(previousDev as IHasPowerControl).UnlinkButtons(TriList);
|
||||
if (previousDev is ITransport)
|
||||
(previousDev as ITransport).UnlinkButtons(TriList);
|
||||
//if (previousDev is IRadio)
|
||||
@@ -1044,8 +1044,8 @@ namespace PepperDash.Essentials
|
||||
(dev as IDvr).LinkButtons(TriList);
|
||||
if (dev is INumericKeypad)
|
||||
(dev as INumericKeypad).LinkButtons(TriList);
|
||||
if (dev is IPower)
|
||||
(dev as IPower).LinkButtons(TriList);
|
||||
if (dev is IHasPowerControl)
|
||||
(dev as IHasPowerControl).LinkButtons(TriList);
|
||||
if (dev is ITransport)
|
||||
(dev as ITransport).LinkButtons(TriList);
|
||||
//if (dev is IRadio)
|
||||
|
||||
@@ -319,8 +319,8 @@ namespace PepperDash.Essentials
|
||||
|
||||
TriList.SetSigFalseAction(UIBoolJoin.DisplayPowerTogglePress, () =>
|
||||
{
|
||||
if (CurrentRoom != null && CurrentRoom.DefaultDisplay is IPower)
|
||||
(CurrentRoom.DefaultDisplay as IPower).PowerToggle();
|
||||
if (CurrentRoom != null && CurrentRoom.DefaultDisplay is IHasPowerControl)
|
||||
(CurrentRoom.DefaultDisplay as IHasPowerControl).PowerToggle();
|
||||
});
|
||||
|
||||
SetupNextMeetingTimer();
|
||||
@@ -1293,8 +1293,8 @@ namespace PepperDash.Essentials
|
||||
(previousDev as IDvr).UnlinkButtons(TriList);
|
||||
if (previousDev is INumericKeypad)
|
||||
(previousDev as INumericKeypad).UnlinkButtons(TriList);
|
||||
if (previousDev is IPower)
|
||||
(previousDev as IPower).UnlinkButtons(TriList);
|
||||
if (previousDev is IHasPowerControl)
|
||||
(previousDev as IHasPowerControl).UnlinkButtons(TriList);
|
||||
if (previousDev is ITransport)
|
||||
(previousDev as ITransport).UnlinkButtons(TriList);
|
||||
}
|
||||
@@ -1351,8 +1351,8 @@ namespace PepperDash.Essentials
|
||||
(dev as IDvr).LinkButtons(TriList);
|
||||
if (dev is INumericKeypad)
|
||||
(dev as INumericKeypad).LinkButtons(TriList);
|
||||
if (dev is IPower)
|
||||
(dev as IPower).LinkButtons(TriList);
|
||||
if (dev is IHasPowerControl)
|
||||
(dev as IHasPowerControl).LinkButtons(TriList);
|
||||
if (dev is ITransport)
|
||||
(dev as ITransport).LinkButtons(TriList);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace PepperDash.Essentials.Core.DeviceInfo
|
||||
{
|
||||
public class DeviceInfo
|
||||
{
|
||||
public string HostName { get; set; }
|
||||
public string IpAddress { get; set; }
|
||||
public string MacAddress { get; set; }
|
||||
public string SerialNumber { get; set; }
|
||||
public string FirmwareVersion { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.DeviceInfo
|
||||
{
|
||||
public class DeviceInfoEventArgs:EventArgs
|
||||
{
|
||||
public DeviceInfo DeviceInfo { get; set; }
|
||||
|
||||
public DeviceInfoEventArgs()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public DeviceInfoEventArgs(DeviceInfo devInfo)
|
||||
{
|
||||
DeviceInfo = devInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core.DeviceInfo
|
||||
{
|
||||
public interface IDeviceInfoProvider:IKeyed
|
||||
{
|
||||
DeviceInfo DeviceInfo { get; }
|
||||
|
||||
event DeviceInfoChangeHandler DeviceInfoChanged;
|
||||
|
||||
void UpdateDeviceInfo();
|
||||
}
|
||||
|
||||
public delegate void DeviceInfoChangeHandler(IKeyed device, DeviceInfoEventArgs args);
|
||||
}
|
||||
@@ -6,7 +6,7 @@ using PepperDash.Essentials.Core.SmartObjects;
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
|
||||
public interface IDiscPlayerControls : IColor, IDPad, INumericKeypad, IPower, ITransport, IUiDisplayInfo
|
||||
public interface IDiscPlayerControls : IColor, IDPad, INumericKeypad, IHasPowerControl, ITransport, IUiDisplayInfo
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -14,35 +14,64 @@ using PepperDash.Essentials.Core.SmartObjects;
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// Defines the ability to power a device on and off
|
||||
/// </summary>
|
||||
[Obsolete("Will be replaced by IHasPowerControlWithFeedback")]
|
||||
public interface IPower
|
||||
{
|
||||
void PowerOn();
|
||||
void PowerOff();
|
||||
void PowerToggle();
|
||||
BoolFeedback PowerIsOnFeedback { get; }
|
||||
BoolFeedback PowerIsOnFeedback { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds feedback for current power state
|
||||
/// </summary>
|
||||
public interface IHasPowerControlWithFeedback : IHasPowerControl
|
||||
{
|
||||
BoolFeedback PowerIsOnFeedback { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the ability to power a device on and off
|
||||
/// </summary>
|
||||
public interface IHasPowerControl
|
||||
{
|
||||
void PowerOn();
|
||||
void PowerOff();
|
||||
void PowerToggle();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static class IPowerExtensions
|
||||
public static class IHasPowerControlExtensions
|
||||
{
|
||||
public static void LinkButtons(this IPower dev, BasicTriList triList)
|
||||
public static void LinkButtons(this IHasPowerControl dev, BasicTriList triList)
|
||||
{
|
||||
triList.SetSigFalseAction(101, dev.PowerOn);
|
||||
triList.SetSigFalseAction(102, dev.PowerOff);
|
||||
triList.SetSigFalseAction(103, dev.PowerToggle);
|
||||
dev.PowerIsOnFeedback.LinkInputSig(triList.BooleanInput[101]);
|
||||
|
||||
var fbdev = dev as IHasPowerControlWithFeedback;
|
||||
if (fbdev != null)
|
||||
{
|
||||
fbdev.PowerIsOnFeedback.LinkInputSig(triList.BooleanInput[101]);
|
||||
}
|
||||
}
|
||||
|
||||
public static void UnlinkButtons(this IPower dev, BasicTriList triList)
|
||||
public static void UnlinkButtons(this IHasPowerControl dev, BasicTriList triList)
|
||||
{
|
||||
triList.ClearBoolSigAction(101);
|
||||
triList.ClearBoolSigAction(102);
|
||||
triList.ClearBoolSigAction(103);
|
||||
dev.PowerIsOnFeedback.UnlinkInputSig(triList.BooleanInput[101]);
|
||||
|
||||
var fbdev = dev as IHasPowerControlWithFeedback;
|
||||
if (fbdev != null)
|
||||
{
|
||||
fbdev.PowerIsOnFeedback.UnlinkInputSig(triList.BooleanInput[101]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,10 +20,12 @@ namespace PepperDash.Essentials.Core
|
||||
public IrOutputPortController IrPort { get; private set; }
|
||||
public ushort IrPulseTime { get; set; }
|
||||
|
||||
protected override Func<bool> PowerIsOnFeedbackFunc
|
||||
{
|
||||
get { return () => _PowerIsOn; }
|
||||
}
|
||||
public BoolFeedback PowerIsOnFeedback { get; private set; }
|
||||
|
||||
protected Func<bool> PowerIsOnFeedbackFunc
|
||||
{
|
||||
get { return () => _PowerIsOn; }
|
||||
}
|
||||
protected override Func<bool> IsCoolingDownFeedbackFunc
|
||||
{
|
||||
get { return () => _IsCoolingDown; }
|
||||
@@ -33,7 +35,7 @@ namespace PepperDash.Essentials.Core
|
||||
get { return () => _IsWarmingUp; }
|
||||
}
|
||||
|
||||
bool _PowerIsOn;
|
||||
bool _PowerIsOn;
|
||||
bool _IsWarmingUp;
|
||||
bool _IsCoolingDown;
|
||||
|
||||
@@ -43,11 +45,14 @@ namespace PepperDash.Essentials.Core
|
||||
IrPort = new IrOutputPortController(key + "-ir", port, irDriverFilepath);
|
||||
DeviceManager.AddDevice(IrPort);
|
||||
|
||||
PowerIsOnFeedback.OutputChange += (o, a) => {
|
||||
Debug.Console(2, this, "Power on={0}", _PowerIsOn);
|
||||
if (_PowerIsOn) StartWarmingTimer();
|
||||
else StartCoolingTimer();
|
||||
};
|
||||
PowerIsOnFeedback = new BoolFeedback(PowerIsOnFeedbackFunc);
|
||||
|
||||
PowerIsOnFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
Debug.Console(2, this, "Power on={0}", _PowerIsOn);
|
||||
if (_PowerIsOn) StartWarmingTimer();
|
||||
else StartCoolingTimer();
|
||||
};
|
||||
IsWarmingUpFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Warming up={0}", _IsWarmingUp);
|
||||
IsCoolingDownFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Cooling down={0}", _IsCoolingDown);
|
||||
|
||||
@@ -110,21 +115,21 @@ namespace PepperDash.Essentials.Core
|
||||
public override void PowerOn()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_ON, IrPulseTime);
|
||||
_PowerIsOn = true;
|
||||
PowerIsOnFeedback.FireUpdate();
|
||||
_PowerIsOn = true;
|
||||
PowerIsOnFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
public override void PowerOff()
|
||||
{
|
||||
_PowerIsOn = false;
|
||||
PowerIsOnFeedback.FireUpdate();
|
||||
_PowerIsOn = false;
|
||||
PowerIsOnFeedback.FireUpdate();
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_OFF, IrPulseTime);
|
||||
}
|
||||
|
||||
public override void PowerToggle()
|
||||
{
|
||||
_PowerIsOn = false;
|
||||
PowerIsOnFeedback.FireUpdate();
|
||||
_PowerIsOn = false;
|
||||
PowerIsOnFeedback.FireUpdate();
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER, IrPulseTime);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,131 +1,117 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.DM;
|
||||
using Crestron.SimplSharpPro.DM.Endpoints;
|
||||
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.DM;
|
||||
using Crestron.SimplSharpPro.DM.Endpoints;
|
||||
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public abstract class DisplayBase : EssentialsDevice, IHasFeedback, IRoutingSinkWithSwitching, IPower, IWarmingCooling, IUsageTracking
|
||||
{
|
||||
public event SourceInfoChangeHandler CurrentSourceChange;
|
||||
|
||||
public string CurrentSourceInfoKey { get; set; }
|
||||
public SourceListItem CurrentSourceInfo
|
||||
{
|
||||
get
|
||||
{
|
||||
return _CurrentSourceInfo;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == _CurrentSourceInfo) return;
|
||||
|
||||
var handler = CurrentSourceChange;
|
||||
|
||||
if (handler != null)
|
||||
handler(_CurrentSourceInfo, ChangeType.WillChange);
|
||||
|
||||
_CurrentSourceInfo = value;
|
||||
|
||||
if (handler != null)
|
||||
handler(_CurrentSourceInfo, ChangeType.DidChange);
|
||||
}
|
||||
}
|
||||
SourceListItem _CurrentSourceInfo;
|
||||
|
||||
public BoolFeedback PowerIsOnFeedback { get; protected set; }
|
||||
public BoolFeedback IsCoolingDownFeedback { get; protected set; }
|
||||
public BoolFeedback IsWarmingUpFeedback { get; private set; }
|
||||
|
||||
public UsageTracking UsageTracker { get; set; }
|
||||
|
||||
public uint WarmupTime { get; set; }
|
||||
public uint CooldownTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Bool Func that will provide a value for the PowerIsOn Output. Must be implemented
|
||||
/// by concrete sub-classes
|
||||
/// </summary>
|
||||
abstract protected Func<bool> PowerIsOnFeedbackFunc { get; }
|
||||
abstract protected Func<bool> IsCoolingDownFeedbackFunc { get; }
|
||||
abstract protected Func<bool> IsWarmingUpFeedbackFunc { get; }
|
||||
|
||||
|
||||
protected CTimer WarmupTimer;
|
||||
protected CTimer CooldownTimer;
|
||||
|
||||
#region IRoutingInputs Members
|
||||
|
||||
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
protected DisplayBase(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
PowerIsOnFeedback = new BoolFeedback("PowerOnFeedback", PowerIsOnFeedbackFunc);
|
||||
IsCoolingDownFeedback = new BoolFeedback("IsCoolingDown", IsCoolingDownFeedbackFunc);
|
||||
IsWarmingUpFeedback = new BoolFeedback("IsWarmingUp", IsWarmingUpFeedbackFunc);
|
||||
|
||||
InputPorts = new RoutingPortCollection<RoutingInputPort>();
|
||||
|
||||
PowerIsOnFeedback.OutputChange += PowerIsOnFeedback_OutputChange;
|
||||
}
|
||||
|
||||
void PowerIsOnFeedback_OutputChange(object sender, EventArgs e)
|
||||
{
|
||||
if (UsageTracker != null)
|
||||
{
|
||||
if (PowerIsOnFeedback.BoolValue)
|
||||
UsageTracker.StartDeviceUsage();
|
||||
else
|
||||
UsageTracker.EndDeviceUsage();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void PowerOn();
|
||||
public abstract void PowerOff();
|
||||
public abstract void PowerToggle();
|
||||
|
||||
public virtual FeedbackCollection<Feedback> Feedbacks
|
||||
{
|
||||
get
|
||||
{
|
||||
return new FeedbackCollection<Feedback>
|
||||
{
|
||||
PowerIsOnFeedback,
|
||||
IsCoolingDownFeedback,
|
||||
IsWarmingUpFeedback
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void ExecuteSwitch(object selector);
|
||||
|
||||
protected void LinkDisplayToApi(DisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey,
|
||||
EiscApiAdvanced bridge)
|
||||
{
|
||||
var inputNumber = 0;
|
||||
var inputKeys = new List<string>();
|
||||
|
||||
var joinMap = new DisplayControllerJoinMap(joinStart);
|
||||
|
||||
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||
public abstract class DisplayBase : EssentialsDevice, IHasFeedback, IRoutingSinkWithSwitching, IHasPowerControl, IWarmingCooling, IUsageTracking
|
||||
{
|
||||
public event SourceInfoChangeHandler CurrentSourceChange;
|
||||
|
||||
public string CurrentSourceInfoKey { get; set; }
|
||||
public SourceListItem CurrentSourceInfo
|
||||
{
|
||||
get
|
||||
{
|
||||
return _CurrentSourceInfo;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == _CurrentSourceInfo) return;
|
||||
|
||||
var handler = CurrentSourceChange;
|
||||
|
||||
if (handler != null)
|
||||
handler(_CurrentSourceInfo, ChangeType.WillChange);
|
||||
|
||||
_CurrentSourceInfo = value;
|
||||
|
||||
if (handler != null)
|
||||
handler(_CurrentSourceInfo, ChangeType.DidChange);
|
||||
}
|
||||
}
|
||||
SourceListItem _CurrentSourceInfo;
|
||||
|
||||
public BoolFeedback IsCoolingDownFeedback { get; protected set; }
|
||||
public BoolFeedback IsWarmingUpFeedback { get; private set; }
|
||||
|
||||
public UsageTracking UsageTracker { get; set; }
|
||||
|
||||
public uint WarmupTime { get; set; }
|
||||
public uint CooldownTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Bool Func that will provide a value for the PowerIsOn Output. Must be implemented
|
||||
/// by concrete sub-classes
|
||||
/// </summary>
|
||||
abstract protected Func<bool> IsCoolingDownFeedbackFunc { get; }
|
||||
abstract protected Func<bool> IsWarmingUpFeedbackFunc { get; }
|
||||
|
||||
|
||||
protected CTimer WarmupTimer;
|
||||
protected CTimer CooldownTimer;
|
||||
|
||||
#region IRoutingInputs Members
|
||||
|
||||
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
protected DisplayBase(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
IsCoolingDownFeedback = new BoolFeedback("IsCoolingDown", IsCoolingDownFeedbackFunc);
|
||||
IsWarmingUpFeedback = new BoolFeedback("IsWarmingUp", IsWarmingUpFeedbackFunc);
|
||||
|
||||
InputPorts = new RoutingPortCollection<RoutingInputPort>();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public abstract void PowerOn();
|
||||
public abstract void PowerOff();
|
||||
public abstract void PowerToggle();
|
||||
|
||||
public virtual FeedbackCollection<Feedback> Feedbacks
|
||||
{
|
||||
get
|
||||
{
|
||||
return new FeedbackCollection<Feedback>
|
||||
{
|
||||
IsCoolingDownFeedback,
|
||||
IsWarmingUpFeedback
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void ExecuteSwitch(object selector);
|
||||
|
||||
protected void LinkDisplayToApi(DisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey,
|
||||
EiscApiAdvanced bridge)
|
||||
{
|
||||
var inputNumber = 0;
|
||||
var inputKeys = new List<string>();
|
||||
|
||||
var joinMap = new DisplayControllerJoinMap(joinStart);
|
||||
|
||||
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||
joinMap = JsonConvert.DeserializeObject<DisplayControllerJoinMap>(joinMapSerialized);
|
||||
|
||||
if (bridge != null)
|
||||
@@ -137,164 +123,186 @@ namespace PepperDash.Essentials.Core
|
||||
Debug.Console(0,this,"Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
|
||||
}
|
||||
|
||||
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
Debug.Console(0, "Linking to Display: {0}", displayDevice.Name);
|
||||
|
||||
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = displayDevice.Name;
|
||||
|
||||
var commMonitor = displayDevice as ICommunicationMonitor;
|
||||
if (commMonitor != null)
|
||||
{
|
||||
commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
|
||||
}
|
||||
|
||||
var inputNumberFeedback = new IntFeedback(() => inputNumber);
|
||||
|
||||
// Two way feedbacks
|
||||
var twoWayDisplay = displayDevice as TwoWayDisplayBase;
|
||||
|
||||
if (twoWayDisplay != null)
|
||||
{
|
||||
trilist.SetBool(joinMap.IsTwoWayDisplay.JoinNumber, true);
|
||||
|
||||
twoWayDisplay.CurrentInputFeedback.OutputChange += (o, a) => Debug.Console(0, "CurrentInputFeedback_OutputChange {0}", a.StringValue);
|
||||
|
||||
|
||||
inputNumberFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputSelect.JoinNumber]);
|
||||
}
|
||||
|
||||
// Power Off
|
||||
trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, () =>
|
||||
{
|
||||
inputNumber = 102;
|
||||
inputNumberFeedback.FireUpdate();
|
||||
displayDevice.PowerOff();
|
||||
});
|
||||
|
||||
displayDevice.PowerIsOnFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
if (!a.BoolValue)
|
||||
{
|
||||
inputNumber = 102;
|
||||
inputNumberFeedback.FireUpdate();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
inputNumber = 0;
|
||||
inputNumberFeedback.FireUpdate();
|
||||
}
|
||||
};
|
||||
|
||||
displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff.JoinNumber]);
|
||||
|
||||
// PowerOn
|
||||
trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, () =>
|
||||
{
|
||||
inputNumber = 0;
|
||||
inputNumberFeedback.FireUpdate();
|
||||
displayDevice.PowerOn();
|
||||
});
|
||||
|
||||
|
||||
displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn.JoinNumber]);
|
||||
|
||||
for (int i = 0; i < displayDevice.InputPorts.Count; i++)
|
||||
{
|
||||
if (i < joinMap.InputNamesOffset.JoinSpan)
|
||||
{
|
||||
inputKeys.Add(displayDevice.InputPorts[i].Key);
|
||||
var tempKey = inputKeys.ElementAt(i);
|
||||
trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset.JoinNumber + i),
|
||||
() => displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector));
|
||||
Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}",
|
||||
joinMap.InputSelectOffset.JoinNumber + i, displayDevice.InputPorts[tempKey].Key.ToString());
|
||||
trilist.StringInput[(ushort)(joinMap.InputNamesOffset.JoinNumber + i)].StringValue = displayDevice.InputPorts[i].Key.ToString();
|
||||
}
|
||||
else
|
||||
Debug.Console(0, displayDevice, Debug.ErrorLogLevel.Warning, "Device has {0} inputs. The Join Map allows up to {1} inputs. Discarding inputs {2} - {3} from bridge.",
|
||||
displayDevice.InputPorts.Count, joinMap.InputNamesOffset.JoinSpan, i + 1, displayDevice.InputPorts.Count);
|
||||
}
|
||||
|
||||
Debug.Console(2, displayDevice, "Setting Input Select Action on Analog Join {0}", joinMap.InputSelect);
|
||||
trilist.SetUShortSigAction(joinMap.InputSelect.JoinNumber, (a) =>
|
||||
{
|
||||
if (a == 0)
|
||||
{
|
||||
displayDevice.PowerOff();
|
||||
inputNumber = 0;
|
||||
}
|
||||
else if (a > 0 && a < displayDevice.InputPorts.Count && a != inputNumber)
|
||||
{
|
||||
displayDevice.ExecuteSwitch(displayDevice.InputPorts.ElementAt(a - 1).Selector);
|
||||
inputNumber = a;
|
||||
}
|
||||
else if (a == 102)
|
||||
{
|
||||
displayDevice.PowerToggle();
|
||||
|
||||
}
|
||||
if (twoWayDisplay != null)
|
||||
inputNumberFeedback.FireUpdate();
|
||||
});
|
||||
|
||||
|
||||
var volumeDisplay = displayDevice as IBasicVolumeControls;
|
||||
if (volumeDisplay == null) return;
|
||||
|
||||
trilist.SetBoolSigAction(joinMap.VolumeUp.JoinNumber, volumeDisplay.VolumeUp);
|
||||
trilist.SetBoolSigAction(joinMap.VolumeDown.JoinNumber, volumeDisplay.VolumeDown);
|
||||
trilist.SetSigTrueAction(joinMap.VolumeMute.JoinNumber, volumeDisplay.MuteToggle);
|
||||
|
||||
var volumeDisplayWithFeedback = volumeDisplay as IBasicVolumeWithFeedback;
|
||||
|
||||
if (volumeDisplayWithFeedback == null) return;
|
||||
trilist.SetSigTrueAction(joinMap.VolumeMuteOn.JoinNumber, volumeDisplayWithFeedback.MuteOn);
|
||||
trilist.SetSigTrueAction(joinMap.VolumeMuteOff.JoinNumber, volumeDisplayWithFeedback.MuteOff);
|
||||
|
||||
|
||||
trilist.SetUShortSigAction(joinMap.VolumeLevel.JoinNumber, volumeDisplayWithFeedback.SetVolume);
|
||||
volumeDisplayWithFeedback.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.VolumeLevel.JoinNumber]);
|
||||
volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMute.JoinNumber]);
|
||||
volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMuteOn.JoinNumber]);
|
||||
volumeDisplayWithFeedback.MuteFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.VolumeMuteOff.JoinNumber]);
|
||||
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
Debug.Console(0, "Linking to Display: {0}", displayDevice.Name);
|
||||
|
||||
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = displayDevice.Name;
|
||||
|
||||
var commMonitor = displayDevice as ICommunicationMonitor;
|
||||
if (commMonitor != null)
|
||||
{
|
||||
commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
|
||||
}
|
||||
|
||||
var inputNumberFeedback = new IntFeedback(() => inputNumber);
|
||||
|
||||
// Two way feedbacks
|
||||
var twoWayDisplay = displayDevice as TwoWayDisplayBase;
|
||||
|
||||
if (twoWayDisplay != null)
|
||||
{
|
||||
trilist.SetBool(joinMap.IsTwoWayDisplay.JoinNumber, true);
|
||||
|
||||
twoWayDisplay.CurrentInputFeedback.OutputChange += (o, a) => Debug.Console(0, "CurrentInputFeedback_OutputChange {0}", a.StringValue);
|
||||
|
||||
|
||||
inputNumberFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputSelect.JoinNumber]);
|
||||
}
|
||||
|
||||
// Power Off
|
||||
trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, () =>
|
||||
{
|
||||
inputNumber = 102;
|
||||
inputNumberFeedback.FireUpdate();
|
||||
displayDevice.PowerOff();
|
||||
});
|
||||
|
||||
var twoWayDisplayDevice = displayDevice as TwoWayDisplayBase;
|
||||
if (twoWayDisplayDevice != null)
|
||||
{
|
||||
twoWayDisplayDevice.PowerIsOnFeedback.OutputChange += (o, a) =>
|
||||
{
|
||||
if (!a.BoolValue)
|
||||
{
|
||||
inputNumber = 102;
|
||||
inputNumberFeedback.FireUpdate();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
inputNumber = 0;
|
||||
inputNumberFeedback.FireUpdate();
|
||||
}
|
||||
};
|
||||
|
||||
twoWayDisplayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff.JoinNumber]);
|
||||
twoWayDisplayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn.JoinNumber]);
|
||||
}
|
||||
|
||||
// PowerOn
|
||||
trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, () =>
|
||||
{
|
||||
inputNumber = 0;
|
||||
inputNumberFeedback.FireUpdate();
|
||||
displayDevice.PowerOn();
|
||||
});
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < displayDevice.InputPorts.Count; i++)
|
||||
{
|
||||
if (i < joinMap.InputNamesOffset.JoinSpan)
|
||||
{
|
||||
inputKeys.Add(displayDevice.InputPorts[i].Key);
|
||||
var tempKey = inputKeys.ElementAt(i);
|
||||
trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset.JoinNumber + i),
|
||||
() => displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector));
|
||||
Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}",
|
||||
joinMap.InputSelectOffset.JoinNumber + i, displayDevice.InputPorts[tempKey].Key.ToString());
|
||||
trilist.StringInput[(ushort)(joinMap.InputNamesOffset.JoinNumber + i)].StringValue = displayDevice.InputPorts[i].Key.ToString();
|
||||
}
|
||||
else
|
||||
Debug.Console(0, displayDevice, Debug.ErrorLogLevel.Warning, "Device has {0} inputs. The Join Map allows up to {1} inputs. Discarding inputs {2} - {3} from bridge.",
|
||||
displayDevice.InputPorts.Count, joinMap.InputNamesOffset.JoinSpan, i + 1, displayDevice.InputPorts.Count);
|
||||
}
|
||||
|
||||
Debug.Console(2, displayDevice, "Setting Input Select Action on Analog Join {0}", joinMap.InputSelect);
|
||||
trilist.SetUShortSigAction(joinMap.InputSelect.JoinNumber, (a) =>
|
||||
{
|
||||
if (a == 0)
|
||||
{
|
||||
displayDevice.PowerOff();
|
||||
inputNumber = 0;
|
||||
}
|
||||
else if (a > 0 && a < displayDevice.InputPorts.Count && a != inputNumber)
|
||||
{
|
||||
displayDevice.ExecuteSwitch(displayDevice.InputPorts.ElementAt(a - 1).Selector);
|
||||
inputNumber = a;
|
||||
}
|
||||
else if (a == 102)
|
||||
{
|
||||
displayDevice.PowerToggle();
|
||||
|
||||
}
|
||||
if (twoWayDisplay != null)
|
||||
inputNumberFeedback.FireUpdate();
|
||||
});
|
||||
|
||||
|
||||
var volumeDisplay = displayDevice as IBasicVolumeControls;
|
||||
if (volumeDisplay == null) return;
|
||||
|
||||
trilist.SetBoolSigAction(joinMap.VolumeUp.JoinNumber, volumeDisplay.VolumeUp);
|
||||
trilist.SetBoolSigAction(joinMap.VolumeDown.JoinNumber, volumeDisplay.VolumeDown);
|
||||
trilist.SetSigTrueAction(joinMap.VolumeMute.JoinNumber, volumeDisplay.MuteToggle);
|
||||
|
||||
var volumeDisplayWithFeedback = volumeDisplay as IBasicVolumeWithFeedback;
|
||||
|
||||
if (volumeDisplayWithFeedback == null) return;
|
||||
trilist.SetSigTrueAction(joinMap.VolumeMuteOn.JoinNumber, volumeDisplayWithFeedback.MuteOn);
|
||||
trilist.SetSigTrueAction(joinMap.VolumeMuteOff.JoinNumber, volumeDisplayWithFeedback.MuteOff);
|
||||
|
||||
|
||||
trilist.SetUShortSigAction(joinMap.VolumeLevel.JoinNumber, volumeDisplayWithFeedback.SetVolume);
|
||||
volumeDisplayWithFeedback.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.VolumeLevel.JoinNumber]);
|
||||
volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMute.JoinNumber]);
|
||||
volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMuteOn.JoinNumber]);
|
||||
volumeDisplayWithFeedback.MuteFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.VolumeMuteOff.JoinNumber]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public abstract class TwoWayDisplayBase : DisplayBase, IRoutingFeedback
|
||||
{
|
||||
public StringFeedback CurrentInputFeedback { get; private set; }
|
||||
|
||||
abstract protected Func<string> CurrentInputFeedbackFunc { get; }
|
||||
|
||||
|
||||
public static MockDisplay DefaultDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_DefaultDisplay == null)
|
||||
_DefaultDisplay = new MockDisplay("default", "Default Display");
|
||||
return _DefaultDisplay;
|
||||
}
|
||||
}
|
||||
static MockDisplay _DefaultDisplay;
|
||||
|
||||
public TwoWayDisplayBase(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
CurrentInputFeedback = new StringFeedback(CurrentInputFeedbackFunc);
|
||||
|
||||
WarmupTime = 7000;
|
||||
CooldownTime = 15000;
|
||||
|
||||
Feedbacks.Add(CurrentInputFeedback);
|
||||
|
||||
|
||||
public abstract class TwoWayDisplayBase : DisplayBase, IRoutingFeedback, IHasPowerControlWithFeedback
|
||||
{
|
||||
public StringFeedback CurrentInputFeedback { get; private set; }
|
||||
|
||||
abstract protected Func<string> CurrentInputFeedbackFunc { get; }
|
||||
|
||||
public BoolFeedback PowerIsOnFeedback { get; protected set; }
|
||||
abstract protected Func<bool> PowerIsOnFeedbackFunc { get; }
|
||||
|
||||
|
||||
public static MockDisplay DefaultDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_DefaultDisplay == null)
|
||||
_DefaultDisplay = new MockDisplay("default", "Default Display");
|
||||
return _DefaultDisplay;
|
||||
}
|
||||
}
|
||||
static MockDisplay _DefaultDisplay;
|
||||
|
||||
public TwoWayDisplayBase(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
CurrentInputFeedback = new StringFeedback(CurrentInputFeedbackFunc);
|
||||
|
||||
WarmupTime = 7000;
|
||||
CooldownTime = 15000;
|
||||
|
||||
PowerIsOnFeedback = new BoolFeedback("PowerOnFeedback", PowerIsOnFeedbackFunc);
|
||||
|
||||
Feedbacks.Add(CurrentInputFeedback);
|
||||
Feedbacks.Add(PowerIsOnFeedback);
|
||||
|
||||
PowerIsOnFeedback.OutputChange += PowerIsOnFeedback_OutputChange;
|
||||
|
||||
}
|
||||
|
||||
void PowerIsOnFeedback_OutputChange(object sender, EventArgs e)
|
||||
{
|
||||
if (UsageTracker != null)
|
||||
{
|
||||
if (PowerIsOnFeedback.BoolValue)
|
||||
UsageTracker.StartDeviceUsage();
|
||||
else
|
||||
UsageTracker.EndDeviceUsage();
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<RoutingNumericEventArgs> NumericSwitchChange;
|
||||
|
||||
@@ -309,5 +317,5 @@ namespace PepperDash.Essentials.Core
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -83,7 +83,7 @@
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="PepperDash_Core, Version=1.0.41.31808, Culture=neutral, processorArchitecture=MSIL">
|
||||
<Reference Include="PepperDash_Core, Version=1.0.42.30563, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\packages\PepperDashCore\lib\net35\PepperDash_Core.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -183,6 +183,9 @@
|
||||
<Compile Include="Crestron IO\Relay\GenericRelayDevice.cs" />
|
||||
<Compile Include="Crestron IO\Relay\ISwitchedOutput.cs" />
|
||||
<Compile Include="Crestron IO\StatusSign\StatusSignController.cs" />
|
||||
<Compile Include="Device Info\DeviceInfo.cs" />
|
||||
<Compile Include="Device Info\DeviceInfoEventArgs.cs" />
|
||||
<Compile Include="Device Info\IDeviceInfoProvider.cs" />
|
||||
<Compile Include="Devices\CodecInterfaces.cs" />
|
||||
<Compile Include="Devices\CrestronProcessor.cs" />
|
||||
<Compile Include="Devices\DeviceApiBase.cs" />
|
||||
|
||||
@@ -774,10 +774,15 @@ namespace PepperDash.Essentials.DM
|
||||
{
|
||||
var portKey = string.Format("{0}--{1}", cardName, portName);
|
||||
Debug.Console(2, this, "Adding output port '{0}'", portKey);
|
||||
OutputPorts.Add(new RoutingOutputPort(portKey, sigType, portType, selector, this)
|
||||
|
||||
var outputPort = new RoutingOutputPort(portKey, sigType, portType, selector, this);
|
||||
|
||||
if (portName.IndexOf("Loop", StringComparison.InvariantCultureIgnoreCase) < 0)
|
||||
{
|
||||
FeedbackMatchObject = Chassis.Outputs[(uint)selector]
|
||||
});
|
||||
outputPort.FeedbackMatchObject = Chassis.Outputs[(uint) selector];
|
||||
}
|
||||
|
||||
OutputPorts.Add(outputPort);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -786,12 +791,13 @@ namespace PepperDash.Essentials.DM
|
||||
void AddOutputPortWithDebug(string cardName, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, object selector, ICec cecPort)
|
||||
{
|
||||
var portKey = string.Format("{0}--{1}", cardName, portName);
|
||||
Debug.Console(2, this, "Adding output port '{0}'", portKey);
|
||||
var outputPort = new RoutingOutputPort(portKey, sigType, portType, selector, this)
|
||||
Debug.Console(2, this, "Adding output port '{0}'", portKey);
|
||||
var outputPort = new RoutingOutputPort(portKey, sigType, portType, selector, this);
|
||||
|
||||
if (portName.IndexOf("Loop", StringComparison.InvariantCultureIgnoreCase) < 0)
|
||||
{
|
||||
FeedbackMatchObject = Chassis.Outputs[(uint)selector]
|
||||
}; ;
|
||||
|
||||
outputPort.FeedbackMatchObject = Chassis.Outputs[(uint)selector];
|
||||
}
|
||||
if (cecPort != null)
|
||||
outputPort.Port = cecPort;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
@@ -14,15 +15,19 @@ using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using PepperDash.Essentials.Core.DeviceInfo;
|
||||
|
||||
namespace PepperDash.Essentials.DM.Endpoints.DGEs
|
||||
{
|
||||
[Description("Wrapper class for DGE-100")]
|
||||
public class Dge100Controller : CrestronGenericBaseDevice, IComPorts, IIROutputPorts, IHasBasicTriListWithSmartObject, ICec
|
||||
public class Dge100Controller : CrestronGenericBaseDevice, IComPorts, IIROutputPorts, IHasBasicTriListWithSmartObject, ICec, IDeviceInfoProvider
|
||||
{
|
||||
private const int CtpPort = 41795;
|
||||
private readonly Dge100 _dge;
|
||||
|
||||
private readonly TsxCcsUcCodec100EthernetReservedSigs _dgeEthernetInfo;
|
||||
|
||||
public BasicTriListWithSmartObject Panel { get { return _dge; } }
|
||||
|
||||
private DeviceConfig _dc;
|
||||
@@ -32,7 +37,14 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs
|
||||
public Dge100Controller(string key, string name, Dge100 device, DeviceConfig dc, CrestronTouchpanelPropertiesConfig props)
|
||||
:base(key, name, device)
|
||||
{
|
||||
_dge = device;
|
||||
_dge = device;
|
||||
_dgeEthernetInfo = _dge.ExtenderEthernetReservedSigs;
|
||||
_dgeEthernetInfo.DeviceExtenderSigChange += (extender, args) => UpdateDeviceInfo();
|
||||
_dgeEthernetInfo.Use();
|
||||
|
||||
DeviceInfo = new DeviceInfo();
|
||||
|
||||
_dge.OnlineStatusChange += (currentDevice, args) => { if (args.DeviceOnLine) UpdateDeviceInfo(); };
|
||||
|
||||
_dc = dc;
|
||||
|
||||
@@ -69,8 +81,86 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs
|
||||
|
||||
#region ICec Members
|
||||
public Cec StreamCec { get { return _dge.HdmiOut.StreamCec; } }
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Implementation of IDeviceInfoProvider
|
||||
|
||||
public DeviceInfo DeviceInfo { get; private set; }
|
||||
|
||||
public event DeviceInfoChangeHandler DeviceInfoChanged;
|
||||
|
||||
public void UpdateDeviceInfo()
|
||||
{
|
||||
DeviceInfo.IpAddress = _dgeEthernetInfo.IpAddressFeedback.StringValue;
|
||||
DeviceInfo.MacAddress = _dgeEthernetInfo.MacAddressFeedback.StringValue;
|
||||
|
||||
GetFirmwareAndSerialInfo();
|
||||
|
||||
OnDeviceInfoChange();
|
||||
}
|
||||
|
||||
private void GetFirmwareAndSerialInfo()
|
||||
{
|
||||
if (String.IsNullOrEmpty(_dgeEthernetInfo.IpAddressFeedback.StringValue))
|
||||
{
|
||||
Debug.Console(1, this, "IP Address information not yet received. No device is online");
|
||||
return;
|
||||
}
|
||||
|
||||
var tcpClient = new GenericTcpIpClient("", _dgeEthernetInfo.IpAddressFeedback.StringValue, CtpPort, 1024){AutoReconnect = false};
|
||||
|
||||
var gather = new CommunicationGather(tcpClient, "\r\n\r\n");
|
||||
|
||||
tcpClient.ConnectionChange += (sender, args) =>
|
||||
{
|
||||
if (!args.Client.IsConnected)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
args.Client.SendText("ver\r\n");
|
||||
};
|
||||
|
||||
gather.LineReceived += (sender, args) =>
|
||||
{
|
||||
if (args.Text.ToLower().Contains("host"))
|
||||
{
|
||||
DeviceInfo.HostName = args.Text.Split(';')[1].Trim();
|
||||
|
||||
tcpClient.Disconnect();
|
||||
return;
|
||||
}
|
||||
|
||||
//ignore console prompt
|
||||
if (args.Text.ToLower().Contains(">"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!args.Text.ToLower().Contains("dge"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DeviceInfo.SerialNumber = args.Text.Split('[')[1].Split(' ')[4].Replace("#", "");
|
||||
DeviceInfo.FirmwareVersion = args.Text.Split('[')[1].Split(' ')[1];
|
||||
|
||||
tcpClient.SendText("host\r\n");
|
||||
};
|
||||
|
||||
tcpClient.Connect();
|
||||
}
|
||||
|
||||
private void OnDeviceInfoChange()
|
||||
{
|
||||
var handler = DeviceInfoChanged;
|
||||
|
||||
if (handler == null) return;
|
||||
|
||||
handler(this, new DeviceInfoEventArgs(DeviceInfo));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class Dge100ControllerFactory : EssentialsDeviceFactory<Dge100Controller>
|
||||
|
||||
@@ -8,14 +8,16 @@ using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.DeviceInfo;
|
||||
using PepperDash.Essentials.DM.Config;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials.DM
|
||||
{
|
||||
[Description("Wrapper class for all DM-RMC variants")]
|
||||
public abstract class DmRmcControllerBase : CrestronGenericBridgeableBaseDevice
|
||||
public abstract class DmRmcControllerBase : CrestronGenericBridgeableBaseDevice, IDeviceInfoProvider
|
||||
{
|
||||
private const int CtpPort = 41795;
|
||||
private readonly EndpointReceiverBase _rmc; //kept here just in case. Only property or method on this class that's not device-specific is the DMOutput that it's attached to.
|
||||
|
||||
public StringFeedback VideoOutputResolutionFeedback { get; protected set; }
|
||||
@@ -32,6 +34,10 @@ namespace PepperDash.Essentials.DM
|
||||
PreventRegistration = _rmc.DMOutput != null;
|
||||
|
||||
AddToFeedbackList(VideoOutputResolutionFeedback, EdidManufacturerFeedback, EdidSerialNumberFeedback, EdidNameFeedback, EdidPreferredTimingFeedback);
|
||||
|
||||
DeviceInfo = new DeviceInfo();
|
||||
|
||||
_rmc.OnlineStatusChange += (currentDevice, args) => { if (args.DeviceOnLine) UpdateDeviceInfo(); };
|
||||
}
|
||||
|
||||
protected void LinkDmRmcToApi(DmRmcControllerBase rmc, BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
@@ -79,7 +85,106 @@ namespace PepperDash.Essentials.DM
|
||||
|
||||
trilist.SetUShortSigAction(joinMap.AudioVideoSource.JoinNumber, a => routing.ExecuteNumericSwitch(a, 1, eRoutingSignalType.AudioVideo));
|
||||
}
|
||||
}
|
||||
|
||||
#region Implementation of IDeviceInfoProvider
|
||||
|
||||
public DeviceInfo DeviceInfo { get; private set; }
|
||||
public event DeviceInfoChangeHandler DeviceInfoChanged;
|
||||
|
||||
public void UpdateDeviceInfo()
|
||||
{
|
||||
Debug.Console(1, this, "Updating Device Info");
|
||||
|
||||
if (_rmc.ConnectedIpList.Count == 0)
|
||||
{
|
||||
Debug.Console(1, this, "IP Address information not yet received. No device is online");
|
||||
return;
|
||||
}
|
||||
|
||||
DeviceInfo.IpAddress = _rmc.ConnectedIpList[0].DeviceIpAddress;
|
||||
|
||||
foreach (var ip in _rmc.ConnectedIpList)
|
||||
{
|
||||
Debug.Console(0, this, "Connected IP Address: {0}", ip.DeviceIpAddress);
|
||||
}
|
||||
|
||||
GetFirmwareAndSerialInfo();
|
||||
|
||||
OnDeviceInfoChange();
|
||||
}
|
||||
|
||||
private void GetFirmwareAndSerialInfo()
|
||||
{
|
||||
var tcpClient = new GenericTcpIpClient(String.Format("{0}-devInfoSocket", Key), _rmc.ConnectedIpList[0].DeviceIpAddress, CtpPort, 1024)
|
||||
{
|
||||
AutoReconnect = false,
|
||||
};
|
||||
|
||||
var gather = new CommunicationGather(tcpClient, "\r\n\r\n");
|
||||
|
||||
tcpClient.ConnectionChange += (sender, args) =>
|
||||
{
|
||||
if (!args.Client.IsConnected)
|
||||
{
|
||||
OnDeviceInfoChange();
|
||||
return;
|
||||
}
|
||||
|
||||
args.Client.SendText("ver\r\n");
|
||||
};
|
||||
|
||||
gather.LineReceived += (sender, args) =>
|
||||
{
|
||||
//ignore console prompt
|
||||
if (args.Text.ToLower().Contains(">"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (args.Text.ToLower().Contains("host"))
|
||||
{
|
||||
DeviceInfo.HostName = args.Text.Split(':')[1].Trim();
|
||||
|
||||
tcpClient.SendText("maca\r\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Text.ToLower().Contains("mac"))
|
||||
{
|
||||
DeviceInfo.MacAddress = args.Text.Split(':')[1].Trim().Replace(" ", ":");
|
||||
|
||||
tcpClient.Disconnect();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!args.Text.ToLower().Contains("rmc"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DeviceInfo.SerialNumber = args.Text.Split('[')[1].Split(' ')[4].Replace("#", "");
|
||||
DeviceInfo.FirmwareVersion = args.Text.Split('[')[1].Split(' ')[1];
|
||||
|
||||
tcpClient.SendText("host\r\n");
|
||||
};
|
||||
|
||||
tcpClient.Connect();
|
||||
}
|
||||
|
||||
private void OnDeviceInfoChange()
|
||||
{
|
||||
var handler = DeviceInfoChanged;
|
||||
|
||||
if (handler == null) return;
|
||||
|
||||
handler(this, new DeviceInfoEventArgs(DeviceInfo));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public abstract class DmHdBaseTControllerBase : CrestronGenericBaseDevice
|
||||
{
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="PepperDash_Core, Version=1.0.41.31808, Culture=neutral, processorArchitecture=MSIL">
|
||||
<Reference Include="PepperDash_Core, Version=1.0.42.30563, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\packages\PepperDashCore\lib\net35\PepperDash_Core.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
@@ -181,14 +181,18 @@ namespace PepperDash.Essentials.Devices.Common.Cameras
|
||||
});
|
||||
}
|
||||
|
||||
if (cameraDevice is IPower)
|
||||
var powerCamera = cameraDevice as IHasPowerControl;
|
||||
if (powerCamera != null)
|
||||
{
|
||||
var powerCamera = cameraDevice as IPower;
|
||||
trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, () => powerCamera.PowerOn());
|
||||
trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, () => powerCamera.PowerOff());
|
||||
|
||||
powerCamera.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn.JoinNumber]);
|
||||
powerCamera.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff.JoinNumber]);
|
||||
var powerFbCamera = powerCamera as IHasPowerControlWithFeedback;
|
||||
if (powerFbCamera != null)
|
||||
{
|
||||
powerFbCamera.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn.JoinNumber]);
|
||||
powerFbCamera.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff.JoinNumber]);
|
||||
}
|
||||
}
|
||||
|
||||
if (cameraDevice is ICommunicationMonitor)
|
||||
|
||||
@@ -92,8 +92,6 @@ namespace PepperDash.Essentials.Devices.Common.Cameras
|
||||
/// </summary>
|
||||
public interface IHasCameraPanControl : IHasCameraControls
|
||||
{
|
||||
// void PanLeft(bool pressRelease);
|
||||
// void PanRight(bool pressRelease);
|
||||
void PanLeft();
|
||||
void PanRight();
|
||||
void PanStop();
|
||||
@@ -104,8 +102,6 @@ namespace PepperDash.Essentials.Devices.Common.Cameras
|
||||
/// </summary>
|
||||
public interface IHasCameraTiltControl : IHasCameraControls
|
||||
{
|
||||
// void TiltDown(bool pressRelease);
|
||||
// void TildUp(bool pressRelease);
|
||||
void TiltDown();
|
||||
void TiltUp();
|
||||
void TiltStop();
|
||||
@@ -116,8 +112,6 @@ namespace PepperDash.Essentials.Devices.Common.Cameras
|
||||
/// </summary>
|
||||
public interface IHasCameraZoomControl : IHasCameraControls
|
||||
{
|
||||
// void ZoomIn(bool pressRelease);
|
||||
// void ZoomOut(bool pressRelease);
|
||||
void ZoomIn();
|
||||
void ZoomOut();
|
||||
void ZoomStop();
|
||||
@@ -135,6 +129,13 @@ namespace PepperDash.Essentials.Devices.Common.Cameras
|
||||
void TriggerAutoFocus();
|
||||
}
|
||||
|
||||
public interface IHasAutoFocusMode
|
||||
{
|
||||
void SetFocusModeAuto();
|
||||
void SetFocusModeManual();
|
||||
void ToggleFocusMode();
|
||||
}
|
||||
|
||||
public interface IHasCameraAutoMode : IHasCameraControls
|
||||
{
|
||||
void CameraAutoModeOn();
|
||||
|
||||
@@ -12,29 +12,86 @@ using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using System.Text.RegularExpressions;
|
||||
using Crestron.SimplSharp.Reflection;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Cameras
|
||||
{
|
||||
public class CameraVisca : CameraBase, IHasCameraPtzControl, ICommunicationMonitor, IHasCameraPresets, IPower, IBridgeAdvanced
|
||||
public class CameraVisca : CameraBase, IHasCameraPtzControl, ICommunicationMonitor, IHasCameraPresets, IHasPowerControlWithFeedback, IBridgeAdvanced, IHasCameraFocusControl, IHasAutoFocusMode
|
||||
{
|
||||
CameraViscaPropertiesConfig PropertiesConfig;
|
||||
|
||||
public IBasicCommunication Communication { get; private set; }
|
||||
public CommunicationGather PortGather { get; private set; }
|
||||
|
||||
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
||||
|
||||
public byte PanSpeed = 0x10;
|
||||
public byte TiltSpeed = 0x10;
|
||||
/// <summary>
|
||||
/// Used to store the actions to parse inquiry responses as the inquiries are sent
|
||||
/// </summary>
|
||||
private CrestronQueue<Action<byte[]>> InquiryResponseQueue;
|
||||
|
||||
/// <summary>
|
||||
/// Camera ID (Default 1)
|
||||
/// </summary>
|
||||
public byte ID = 0x01;
|
||||
public byte ResponseID;
|
||||
|
||||
|
||||
public byte PanSpeedSlow = 0x10;
|
||||
public byte TiltSpeedSlow = 0x10;
|
||||
|
||||
public byte PanSpeedFast = 0x13;
|
||||
public byte TiltSpeedFast = 0x13;
|
||||
|
||||
private bool IsMoving;
|
||||
private bool IsZooming;
|
||||
public bool PowerIsOn { get; private set; }
|
||||
|
||||
bool _powerIsOn;
|
||||
public bool PowerIsOn
|
||||
{
|
||||
get
|
||||
{
|
||||
return _powerIsOn;
|
||||
}
|
||||
private set
|
||||
{
|
||||
if (value != _powerIsOn)
|
||||
{
|
||||
_powerIsOn = value;
|
||||
PowerIsOnFeedback.FireUpdate();
|
||||
CameraIsOffFeedback.FireUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const byte ZoomInCmd = 0x02;
|
||||
const byte ZoomOutCmd = 0x03;
|
||||
const byte ZoomStopCmd = 0x00;
|
||||
|
||||
/// <summary>
|
||||
/// Used to determine when to move the camera at a faster speed if a direction is held
|
||||
/// </summary>
|
||||
CTimer SpeedTimer;
|
||||
// TODO: Implment speed timer for PTZ controls
|
||||
|
||||
long FastSpeedHoldTimeMs = 2000;
|
||||
|
||||
byte[] IncomingBuffer = new byte[] { };
|
||||
public BoolFeedback PowerIsOnFeedback { get; private set; }
|
||||
|
||||
public CameraVisca(string key, string name, IBasicCommunication comm, CameraPropertiesConfig props) :
|
||||
public CameraVisca(string key, string name, IBasicCommunication comm, CameraViscaPropertiesConfig props) :
|
||||
base(key, name)
|
||||
{
|
||||
InquiryResponseQueue = new CrestronQueue<Action<byte[]>>(15);
|
||||
|
||||
Presets = props.Presets;
|
||||
|
||||
PropertiesConfig = props;
|
||||
|
||||
ID = (byte)(props.Id + 0x80);
|
||||
ResponseID = (byte)((props.Id * 0x10) + 0x80);
|
||||
|
||||
SetupCameraSpeeds();
|
||||
|
||||
OutputPorts.Add(new RoutingOutputPort("videoOut", eRoutingSignalType.Video, eRoutingPortConnectionType.None, null, this, true));
|
||||
|
||||
// Default to all capabilties
|
||||
@@ -51,11 +108,10 @@ namespace PepperDash.Essentials.Devices.Common.Cameras
|
||||
{
|
||||
// This instance uses RS-232 control
|
||||
}
|
||||
PortGather = new CommunicationGather(Communication, "\xFF");
|
||||
|
||||
|
||||
Communication.BytesReceived += new EventHandler<GenericCommMethodReceiveBytesArgs>(Communication_BytesReceived);
|
||||
PowerIsOnFeedback = new BoolFeedback(() => { return PowerIsOn; });
|
||||
CameraIsOffFeedback = new BoolFeedback(() => { return !PowerIsOn; });
|
||||
|
||||
if (props.CommunicationMonitorProperties != null)
|
||||
{
|
||||
@@ -66,9 +122,38 @@ namespace PepperDash.Essentials.Devices.Common.Cameras
|
||||
CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, 20000, 120000, 300000, "\x81\x09\x04\x00\xFF");
|
||||
}
|
||||
DeviceManager.AddDevice(CommunicationMonitor);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sets up camera speed values based on config
|
||||
/// </summary>
|
||||
void SetupCameraSpeeds()
|
||||
{
|
||||
if (PropertiesConfig.FastSpeedHoldTimeMs > 0)
|
||||
{
|
||||
FastSpeedHoldTimeMs = PropertiesConfig.FastSpeedHoldTimeMs;
|
||||
}
|
||||
|
||||
if (PropertiesConfig.PanSpeedSlow > 0)
|
||||
{
|
||||
PanSpeedSlow = (byte)PropertiesConfig.PanSpeedSlow;
|
||||
}
|
||||
if (PropertiesConfig.PanSpeedFast > 0)
|
||||
{
|
||||
PanSpeedFast = (byte)PropertiesConfig.PanSpeedFast;
|
||||
}
|
||||
|
||||
if (PropertiesConfig.TiltSpeedSlow > 0)
|
||||
{
|
||||
TiltSpeedSlow = (byte)PropertiesConfig.TiltSpeedSlow;
|
||||
}
|
||||
if (PropertiesConfig.TiltSpeedFast > 0)
|
||||
{
|
||||
TiltSpeedFast = (byte)PropertiesConfig.TiltSpeedFast;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CustomActivate()
|
||||
{
|
||||
Communication.Connect();
|
||||
@@ -110,40 +195,245 @@ namespace PepperDash.Essentials.Devices.Common.Cameras
|
||||
|
||||
Communication.SendBytes(b);
|
||||
}
|
||||
|
||||
void Communication_BytesReceived(object sender, GenericCommMethodReceiveBytesArgs e)
|
||||
{
|
||||
// This is probably not thread-safe buffering
|
||||
// Append the incoming bytes with whatever is in the buffer
|
||||
var newBytes = new byte[IncomingBuffer.Length + e.Bytes.Length];
|
||||
IncomingBuffer.CopyTo(newBytes, 0);
|
||||
e.Bytes.CopyTo(newBytes, IncomingBuffer.Length);
|
||||
if (Debug.Level == 2) // This check is here to prevent following string format from building unnecessarily on level 0 or 1
|
||||
Debug.Console(2, this, "Received:{0}", ComTextHelper.GetEscapedText(newBytes));
|
||||
}
|
||||
var newBytes = new byte[IncomingBuffer.Length + e.Bytes.Length];
|
||||
|
||||
try
|
||||
{
|
||||
// This is probably not thread-safe buffering
|
||||
// Append the incoming bytes with whatever is in the buffer
|
||||
IncomingBuffer.CopyTo(newBytes, 0);
|
||||
e.Bytes.CopyTo(newBytes, IncomingBuffer.Length);
|
||||
if (Debug.Level == 2) // This check is here to prevent following string format from building unnecessarily on level 0 or 1
|
||||
Debug.Console(2, this, "Received:{0}", ComTextHelper.GetEscapedText(newBytes));
|
||||
|
||||
private void SendPanTiltCommand (byte[] cmd)
|
||||
byte[] message = new byte[] { };
|
||||
|
||||
// Search for the delimiter 0xFF character
|
||||
for (int i = 0; i < newBytes.Length; i++)
|
||||
{
|
||||
if (newBytes[i] == 0xFF)
|
||||
{
|
||||
// i will be the index of the delmiter character
|
||||
message = newBytes.Take(i).ToArray();
|
||||
// Skip over what we just took and save the rest for next time
|
||||
newBytes = newBytes.Skip(i).ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
if (message.Length > 0)
|
||||
{
|
||||
// Check for matching ID
|
||||
if (message[0] != ResponseID)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (message[1])
|
||||
{
|
||||
case 0x40:
|
||||
{
|
||||
// ACK received
|
||||
Debug.Console(2, this, "ACK Received");
|
||||
break;
|
||||
}
|
||||
case 0x50:
|
||||
{
|
||||
|
||||
if (message[2] == 0xFF)
|
||||
{
|
||||
// Completion received
|
||||
Debug.Console(2, this, "Completion Received");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Inquiry response received. Dequeue the next response handler and invoke it
|
||||
if (InquiryResponseQueue.Count > 0)
|
||||
{
|
||||
var inquiryAction = InquiryResponseQueue.Dequeue();
|
||||
|
||||
inquiryAction.Invoke(message.Skip(2).ToArray());
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(2, this, "Response Queue is empty. Nothing to dequeue.");
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 0x60:
|
||||
{
|
||||
// Error message
|
||||
|
||||
switch (message[2])
|
||||
{
|
||||
case 0x01:
|
||||
{
|
||||
// Message Length Error
|
||||
Debug.Console(2, this, "Error from device: Message Length Error");
|
||||
break;
|
||||
}
|
||||
case 0x02:
|
||||
{
|
||||
// Syntax Error
|
||||
Debug.Console(2, this, "Error from device: Syntax Error");
|
||||
break;
|
||||
}
|
||||
case 0x03:
|
||||
{
|
||||
// Command Buffer Full
|
||||
Debug.Console(2, this, "Error from device: Command Buffer Full");
|
||||
break;
|
||||
}
|
||||
case 0x04:
|
||||
{
|
||||
// Command Cancelled
|
||||
Debug.Console(2, this, "Error from device: Command Cancelled");
|
||||
break;
|
||||
}
|
||||
case 0x05:
|
||||
{
|
||||
// No Socket
|
||||
Debug.Console(2, this, "Error from device: No Socket");
|
||||
break;
|
||||
}
|
||||
case 0x41:
|
||||
{
|
||||
// Command not executable
|
||||
Debug.Console(2, this, "Error from device: Command not executable");
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (message == new byte[] { ResponseID, 0x50, 0x02, 0xFF })
|
||||
{
|
||||
PowerIsOn = true;
|
||||
}
|
||||
else if (message == new byte[] { ResponseID, 0x50, 0x03, 0xFF })
|
||||
{
|
||||
PowerIsOn = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
Debug.Console(2, this, "Error parsing feedback: {0}", err);
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Save whatever partial message is here
|
||||
IncomingBuffer = newBytes;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends a pan/tilt command. If the command is not for fastSpeed then it starts a timer to initiate fast speed.
|
||||
/// </summary>
|
||||
/// <param name="cmd"></param>
|
||||
/// <param name="fastSpeed"></param>
|
||||
private void SendPanTiltCommand (byte[] cmd, bool fastSpeedEnabled)
|
||||
{
|
||||
var temp = new Byte[] { 0x81, 0x01, 0x06, 0x01, PanSpeed, TiltSpeed };
|
||||
int length = temp.Length + cmd.Length + 1;
|
||||
|
||||
byte[] sum = new byte[length];
|
||||
temp.CopyTo(sum, 0);
|
||||
cmd.CopyTo(sum, temp.Length);
|
||||
sum[length - 1] = 0xFF;
|
||||
SendBytes(sum);
|
||||
SendBytes(GetPanTiltCommand(cmd, fastSpeedEnabled));
|
||||
|
||||
if (!fastSpeedEnabled)
|
||||
{
|
||||
if (SpeedTimer != null)
|
||||
{
|
||||
StopSpeedTimer();
|
||||
}
|
||||
|
||||
// Start the timer to send fast speed if still moving after FastSpeedHoldTime elapses
|
||||
SpeedTimer = new CTimer((o) => SendPanTiltCommand(GetPanTiltCommand(cmd, true), true), FastSpeedHoldTimeMs);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void StopSpeedTimer()
|
||||
{
|
||||
if (SpeedTimer != null)
|
||||
{
|
||||
SpeedTimer.Stop();
|
||||
SpeedTimer.Dispose();
|
||||
SpeedTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates the pan/tilt command with either slow or fast speed
|
||||
/// </summary>
|
||||
/// <param name="cmd"></param>
|
||||
/// <param name="fastSpeed"></param>
|
||||
/// <returns></returns>
|
||||
private byte[] GetPanTiltCommand(byte[] cmd, bool fastSpeed)
|
||||
{
|
||||
byte panSpeed;
|
||||
byte tiltSpeed;
|
||||
|
||||
if (!fastSpeed)
|
||||
{
|
||||
panSpeed = PanSpeedSlow;
|
||||
tiltSpeed = TiltSpeedSlow;
|
||||
}
|
||||
else
|
||||
{
|
||||
panSpeed = PanSpeedFast;
|
||||
tiltSpeed = TiltSpeedFast;
|
||||
}
|
||||
|
||||
var temp = new byte[] { ID, 0x01, 0x06, 0x01, panSpeed, tiltSpeed };
|
||||
int length = temp.Length + cmd.Length + 1;
|
||||
|
||||
byte[] sum = new byte[length];
|
||||
temp.CopyTo(sum, 0);
|
||||
cmd.CopyTo(sum, temp.Length);
|
||||
sum[length - 1] = 0xFF;
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
|
||||
void SendPowerQuery()
|
||||
{
|
||||
SendBytes(new byte[] { ID, 0x09, 0x04, 0x00, 0xFF });
|
||||
InquiryResponseQueue.Enqueue(HandlePowerResponse);
|
||||
}
|
||||
|
||||
public void PowerOn()
|
||||
{
|
||||
|
||||
SendBytes(new Byte[] { 0x81, 0x01, 0x04, 0x00, 0x02, 0xFF });
|
||||
SendBytes(new byte[] { ID, 0x01, 0x04, 0x00, 0x02, 0xFF });
|
||||
SendPowerQuery();
|
||||
}
|
||||
|
||||
void HandlePowerResponse(byte[] response)
|
||||
{
|
||||
switch (response[0])
|
||||
{
|
||||
case 0x02:
|
||||
{
|
||||
PowerIsOn = true;
|
||||
break;
|
||||
}
|
||||
case 0x03:
|
||||
{
|
||||
PowerIsOn = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void PowerOff()
|
||||
{
|
||||
SendBytes(new Byte[] {0x81, 0x01, 0x04, 0x00, 0x03, 0xFF});
|
||||
}
|
||||
SendBytes(new byte[] {ID, 0x01, 0x04, 0x00, 0x03, 0xFF});
|
||||
SendPowerQuery();
|
||||
}
|
||||
|
||||
public void PowerToggle()
|
||||
{
|
||||
@@ -155,12 +445,12 @@ namespace PepperDash.Essentials.Devices.Common.Cameras
|
||||
|
||||
public void PanLeft()
|
||||
{
|
||||
SendPanTiltCommand(new byte[] {0x01, 0x03});
|
||||
SendPanTiltCommand(new byte[] {0x01, 0x03}, false);
|
||||
IsMoving = true;
|
||||
}
|
||||
public void PanRight()
|
||||
{
|
||||
SendPanTiltCommand(new byte[] { 0x02, 0x03 });
|
||||
SendPanTiltCommand(new byte[] { 0x02, 0x03 }, false);
|
||||
IsMoving = true;
|
||||
}
|
||||
public void PanStop()
|
||||
@@ -169,12 +459,12 @@ namespace PepperDash.Essentials.Devices.Common.Cameras
|
||||
}
|
||||
public void TiltDown()
|
||||
{
|
||||
SendPanTiltCommand(new byte[] { 0x03, 0x02 });
|
||||
SendPanTiltCommand(new byte[] { 0x03, 0x02 }, false);
|
||||
IsMoving = true;
|
||||
}
|
||||
public void TiltUp()
|
||||
{
|
||||
SendPanTiltCommand(new byte[] { 0x03, 0x01 });
|
||||
SendPanTiltCommand(new byte[] { 0x03, 0x01 }, false);
|
||||
IsMoving = true;
|
||||
}
|
||||
public void TiltStop()
|
||||
@@ -184,16 +474,18 @@ namespace PepperDash.Essentials.Devices.Common.Cameras
|
||||
|
||||
private void SendZoomCommand (byte cmd)
|
||||
{
|
||||
SendBytes(new byte[] {0x81, 0x01, 0x04, 0x07, cmd, 0xFF} );
|
||||
SendBytes(new byte[] {ID, 0x01, 0x04, 0x07, cmd, 0xFF} );
|
||||
}
|
||||
|
||||
|
||||
public void ZoomIn()
|
||||
{
|
||||
SendZoomCommand(0x02);
|
||||
SendZoomCommand(ZoomInCmd);
|
||||
IsZooming = true;
|
||||
}
|
||||
public void ZoomOut()
|
||||
{
|
||||
SendZoomCommand(0x03);
|
||||
SendZoomCommand(ZoomOutCmd);
|
||||
IsZooming = true;
|
||||
}
|
||||
public void ZoomStop()
|
||||
@@ -205,26 +497,28 @@ namespace PepperDash.Essentials.Devices.Common.Cameras
|
||||
{
|
||||
if (IsZooming)
|
||||
{
|
||||
SendZoomCommand(0x00);
|
||||
SendZoomCommand(ZoomStopCmd);
|
||||
IsZooming = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
SendPanTiltCommand(new byte[] {0x03, 0x03});
|
||||
StopSpeedTimer();
|
||||
SendPanTiltCommand(new byte[] { 0x03, 0x03 }, false);
|
||||
IsMoving = false;
|
||||
}
|
||||
}
|
||||
public void PositionHome()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
SendBytes(new byte[] { ID, 0x01, 0x06, 0x02, PanSpeedFast, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF });
|
||||
SendBytes(new byte[] { ID, 0x01, 0x04, 0x47, 0x00, 0x00, 0x00, 0x00, 0xFF });
|
||||
}
|
||||
public void RecallPreset(int presetNumber)
|
||||
{
|
||||
SendBytes(new byte[] {0x81, 0x01, 0x04, 0x3F, 0x02, (byte)presetNumber, 0xFF} );
|
||||
SendBytes(new byte[] {ID, 0x01, 0x04, 0x3F, 0x02, (byte)presetNumber, 0xFF} );
|
||||
}
|
||||
public void SavePreset(int presetNumber)
|
||||
{
|
||||
SendBytes(new byte[] { 0x81, 0x01, 0x04, 0x3F, 0x01, (byte)presetNumber, 0xFF });
|
||||
SendBytes(new byte[] { ID, 0x01, 0x04, 0x3F, 0x01, (byte)presetNumber, 0xFF });
|
||||
}
|
||||
|
||||
#region IHasCameraPresets Members
|
||||
@@ -244,6 +538,90 @@ namespace PepperDash.Essentials.Devices.Common.Cameras
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IHasCameraFocusControl Members
|
||||
|
||||
public void FocusNear()
|
||||
{
|
||||
SendBytes(new byte[] { ID, 0x01, 0x04, 0x08, 0x03, 0xFF });
|
||||
}
|
||||
|
||||
public void FocusFar()
|
||||
{
|
||||
SendBytes(new byte[] { ID, 0x01, 0x04, 0x08, 0x02, 0xFF });
|
||||
}
|
||||
|
||||
public void FocusStop()
|
||||
{
|
||||
SendBytes(new byte[] { ID, 0x01, 0x04, 0x08, 0x00, 0xFF });
|
||||
}
|
||||
|
||||
public void TriggerAutoFocus()
|
||||
{
|
||||
SendBytes(new byte[] { ID, 0x01, 0x04, 0x18, 0x01, 0xFF });
|
||||
SendAutoFocusQuery();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IHasAutoFocus Members
|
||||
|
||||
public void SetFocusModeAuto()
|
||||
{
|
||||
SendBytes(new byte[] { ID, 0x01, 0x04, 0x38, 0x02, 0xFF });
|
||||
SendAutoFocusQuery();
|
||||
}
|
||||
|
||||
public void SetFocusModeManual()
|
||||
{
|
||||
SendBytes(new byte[] { ID, 0x01, 0x04, 0x38, 0x03, 0xFF });
|
||||
SendAutoFocusQuery();
|
||||
}
|
||||
|
||||
public void ToggleFocusMode()
|
||||
{
|
||||
SendBytes(new byte[] { ID, 0x01, 0x04, 0x38, 0x10, 0xFF });
|
||||
SendAutoFocusQuery();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
void SendAutoFocusQuery()
|
||||
{
|
||||
SendBytes(new byte[] { ID, 0x09, 0x04, 0x38, 0xFF });
|
||||
InquiryResponseQueue.Enqueue(HandleAutoFocusResponse);
|
||||
}
|
||||
|
||||
void HandleAutoFocusResponse(byte[] response)
|
||||
{
|
||||
switch (response[0])
|
||||
{
|
||||
case 0x02:
|
||||
{
|
||||
// Auto Mode
|
||||
PowerIsOn = true;
|
||||
break;
|
||||
}
|
||||
case 0x03:
|
||||
{
|
||||
// Manual Mode
|
||||
PowerIsOn = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region IHasCameraOff Members
|
||||
|
||||
public BoolFeedback CameraIsOffFeedback { get; private set; }
|
||||
|
||||
|
||||
public void CameraOff()
|
||||
{
|
||||
PowerOff();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class CameraViscaFactory : EssentialsDeviceFactory<CameraVisca>
|
||||
@@ -257,10 +635,51 @@ namespace PepperDash.Essentials.Devices.Common.Cameras
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new CameraVisca Device");
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
var props = Newtonsoft.Json.JsonConvert.DeserializeObject<Cameras.CameraPropertiesConfig>(
|
||||
var props = Newtonsoft.Json.JsonConvert.DeserializeObject<Cameras.CameraViscaPropertiesConfig>(
|
||||
dc.Properties.ToString());
|
||||
return new Cameras.CameraVisca(dc.Key, dc.Name, comm, props);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class CameraViscaPropertiesConfig : CameraPropertiesConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Control ID of the camera (1-7)
|
||||
/// </summary>
|
||||
[JsonProperty("id")]
|
||||
public uint Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Slow Pan speed (0-18)
|
||||
/// </summary>
|
||||
[JsonProperty("panSpeedSlow")]
|
||||
public uint PanSpeedSlow { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Fast Pan speed (0-18)
|
||||
/// </summary>
|
||||
[JsonProperty("panSpeedFast")]
|
||||
public uint PanSpeedFast { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Slow tilt speed (0-18)
|
||||
/// </summary>
|
||||
[JsonProperty("tiltSpeedSlow")]
|
||||
public uint TiltSpeedSlow { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Fast tilt speed (0-18)
|
||||
/// </summary>
|
||||
[JsonProperty("tiltSpeedFast")]
|
||||
public uint TiltSpeedFast { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Time a button must be held before fast speed is engaged (Milliseconds)
|
||||
/// </summary>
|
||||
[JsonProperty("fastSpeedHoldTimeMs")]
|
||||
public uint FastSpeedHoldTimeMs { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,6 +14,7 @@ namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
void AddExternalSource(string connectorId, string key, string name, eExternalSourceType type);
|
||||
void SetExternalSourceState(string key, eExternalSourceMode mode);
|
||||
void ClearExternalSources();
|
||||
void SetSelectedSource(string key);
|
||||
Action<string, string> RunRouteAction { set;}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,26 +10,28 @@ using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Displays
|
||||
{
|
||||
public abstract class ComTcpDisplayBase : DisplayBase, IPower
|
||||
[Obsolete("Please use TwoWayDisplayBase instead")]
|
||||
public abstract class ComTcpDisplayBase : TwoWayDisplayBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Sets the communication method for this - swaps out event handlers and output handlers
|
||||
/// </summary>
|
||||
public IBasicCommunication CommunicationMethod
|
||||
{
|
||||
get { return _CommunicationMethod; }
|
||||
set
|
||||
{
|
||||
if (_CommunicationMethod != null)
|
||||
_CommunicationMethod.BytesReceived -= this.CommunicationMethod_BytesReceived;
|
||||
// Outputs???
|
||||
_CommunicationMethod = value;
|
||||
if (_CommunicationMethod != null)
|
||||
_CommunicationMethod.BytesReceived += this.CommunicationMethod_BytesReceived;
|
||||
// Outputs?
|
||||
}
|
||||
}
|
||||
IBasicCommunication _CommunicationMethod;
|
||||
|
||||
///// <summary>
|
||||
///// Sets the communication method for this - swaps out event handlers and output handlers
|
||||
///// </summary>
|
||||
//public IBasicCommunication CommunicationMethod
|
||||
//{
|
||||
// get { return _CommunicationMethod; }
|
||||
// set
|
||||
// {
|
||||
// if (_CommunicationMethod != null)
|
||||
// _CommunicationMethod.BytesReceived -= this.CommunicationMethod_BytesReceived;
|
||||
// // Outputs???
|
||||
// _CommunicationMethod = value;
|
||||
// if (_CommunicationMethod != null)
|
||||
// _CommunicationMethod.BytesReceived += this.CommunicationMethod_BytesReceived;
|
||||
// // Outputs?
|
||||
// }
|
||||
//}
|
||||
//IBasicCommunication _CommunicationMethod;
|
||||
|
||||
public ComTcpDisplayBase(string key, string name)
|
||||
: base(key, name)
|
||||
@@ -38,6 +40,6 @@ namespace PepperDash.Essentials.Devices.Displays
|
||||
}
|
||||
|
||||
|
||||
protected abstract void CommunicationMethod_BytesReceived(object sender, GenericCommMethodReceiveBytesArgs args);
|
||||
//protected abstract void CommunicationMethod_BytesReceived(object sender, GenericCommMethodReceiveBytesArgs args);
|
||||
}
|
||||
}
|
||||
@@ -11,217 +11,222 @@ using PepperDash.Essentials.Core.Bridges;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Displays
|
||||
{
|
||||
public class NecPaSeriesProjector : ComTcpDisplayBase, IBridgeAdvanced
|
||||
{
|
||||
public readonly IntFeedback Lamp1RemainingPercent;
|
||||
int _Lamp1RemainingPercent;
|
||||
public readonly IntFeedback Lamp2RemainingPercent;
|
||||
int _Lamp2RemainingPercent;
|
||||
protected override Func<bool> PowerIsOnFeedbackFunc
|
||||
{
|
||||
get { return () => _PowerIsOn; }
|
||||
}
|
||||
bool _PowerIsOn;
|
||||
//public class NecPaSeriesProjector : TwoWayDisplayBase, IBridgeAdvanced
|
||||
//{
|
||||
// public readonly IntFeedback Lamp1RemainingPercent;
|
||||
// int _Lamp1RemainingPercent;
|
||||
// public readonly IntFeedback Lamp2RemainingPercent;
|
||||
// int _Lamp2RemainingPercent;
|
||||
|
||||
protected override Func<bool> IsCoolingDownFeedbackFunc
|
||||
{
|
||||
get { return () => false; }
|
||||
}
|
||||
// RoutingInputPort _CurrentInputPort;
|
||||
|
||||
protected override Func<bool> IsWarmingUpFeedbackFunc
|
||||
{
|
||||
get { return () => false; }
|
||||
}
|
||||
// protected override Func<string> CurrentInputFeedbackFunc { get { return () => _CurrentInputPort.Key; } }
|
||||
|
||||
// protected override Func<bool> PowerIsOnFeedbackFunc
|
||||
// {
|
||||
// get { return () => _PowerIsOn; }
|
||||
// }
|
||||
// bool _PowerIsOn;
|
||||
|
||||
public override void PowerToggle()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
// protected override Func<bool> IsCoolingDownFeedbackFunc
|
||||
// {
|
||||
// get { return () => false; }
|
||||
// }
|
||||
|
||||
public override void ExecuteSwitch(object selector)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
// protected override Func<bool> IsWarmingUpFeedbackFunc
|
||||
// {
|
||||
// get { return () => false; }
|
||||
// }
|
||||
|
||||
Dictionary<string, string> InputMap;
|
||||
// public override void PowerToggle()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public NecPaSeriesProjector(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
Lamp1RemainingPercent = new IntFeedback("Lamp1RemainingPercent", () => _Lamp1RemainingPercent);
|
||||
Lamp2RemainingPercent = new IntFeedback("Lamp2RemainingPercent", () => _Lamp2RemainingPercent);
|
||||
// public override void ExecuteSwitch(object selector)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
InputMap = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
{ "computer1", "\x02\x03\x00\x00\x02\x01\x01\x09" },
|
||||
{ "computer2", "\x02\x03\x00\x00\x02\x01\x02\x0a" },
|
||||
{ "computer3", "\x02\x03\x00\x00\x02\x01\x03\x0b" },
|
||||
{ "hdmi", "\x02\x03\x00\x00\x02\x01\x1a\x22" },
|
||||
{ "dp", "\x02\x03\x00\x00\x02\x01\x1b\x23" },
|
||||
{ "video", "\x02\x03\x00\x00\x02\x01\x06\x0e" },
|
||||
{ "viewer", "\x02\x03\x00\x00\x02\x01\x1f\x27" },
|
||||
{ "network", "\x02\x03\x00\x00\x02\x01\x20\x28" },
|
||||
};
|
||||
}
|
||||
// Dictionary<string, string> InputMap;
|
||||
|
||||
void IsConnected_OutputChange(object sender, EventArgs e)
|
||||
{
|
||||
// /// <summary>
|
||||
// /// Constructor
|
||||
// /// </summary>
|
||||
// public NecPaSeriesProjector(string key, string name)
|
||||
// : base(key, name)
|
||||
// {
|
||||
// Lamp1RemainingPercent = new IntFeedback("Lamp1RemainingPercent", () => _Lamp1RemainingPercent);
|
||||
// Lamp2RemainingPercent = new IntFeedback("Lamp2RemainingPercent", () => _Lamp2RemainingPercent);
|
||||
|
||||
}
|
||||
// InputMap = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
|
||||
// {
|
||||
// { "computer1", "\x02\x03\x00\x00\x02\x01\x01\x09" },
|
||||
// { "computer2", "\x02\x03\x00\x00\x02\x01\x02\x0a" },
|
||||
// { "computer3", "\x02\x03\x00\x00\x02\x01\x03\x0b" },
|
||||
// { "hdmi", "\x02\x03\x00\x00\x02\x01\x1a\x22" },
|
||||
// { "dp", "\x02\x03\x00\x00\x02\x01\x1b\x23" },
|
||||
// { "video", "\x02\x03\x00\x00\x02\x01\x06\x0e" },
|
||||
// { "viewer", "\x02\x03\x00\x00\x02\x01\x1f\x27" },
|
||||
// { "network", "\x02\x03\x00\x00\x02\x01\x20\x28" },
|
||||
// };
|
||||
// }
|
||||
|
||||
public void SetEnable(bool state)
|
||||
{
|
||||
var tcp = CommunicationMethod as GenericTcpIpClient;
|
||||
if (tcp != null)
|
||||
{
|
||||
tcp.Connect();
|
||||
}
|
||||
}
|
||||
// void IsConnected_OutputChange(object sender, EventArgs e)
|
||||
// {
|
||||
|
||||
public override void PowerOn()
|
||||
{
|
||||
SendText("\x02\x00\x00\x00\x00\x02");
|
||||
}
|
||||
// }
|
||||
|
||||
public override void PowerOff()
|
||||
{
|
||||
SendText("\x02\x01\x00\x00\x00\x03");
|
||||
}
|
||||
// public void SetEnable(bool state)
|
||||
// {
|
||||
// var tcp = CommunicationMethod as GenericTcpIpClient;
|
||||
// if (tcp != null)
|
||||
// {
|
||||
// tcp.Connect();
|
||||
// }
|
||||
// }
|
||||
|
||||
public void PictureMuteOn()
|
||||
{
|
||||
SendText("\x02\x10\x00\x00\x00\x12");
|
||||
}
|
||||
// public override void PowerOn()
|
||||
// {
|
||||
// SendText("\x02\x00\x00\x00\x00\x02");
|
||||
// }
|
||||
|
||||
public void PictureMuteOff()
|
||||
{
|
||||
SendText("\x02\x11\x00\x00\x00\x13");
|
||||
}
|
||||
// public override void PowerOff()
|
||||
// {
|
||||
// SendText("\x02\x01\x00\x00\x00\x03");
|
||||
// }
|
||||
|
||||
public void GetRunningStatus()
|
||||
{
|
||||
SendText("\x00\x85\x00\x00\x01\x01\x87");
|
||||
}
|
||||
// public void PictureMuteOn()
|
||||
// {
|
||||
// SendText("\x02\x10\x00\x00\x00\x12");
|
||||
// }
|
||||
|
||||
public void GetLampRemaining(int lampNum)
|
||||
{
|
||||
if (!_PowerIsOn) return;
|
||||
// public void PictureMuteOff()
|
||||
// {
|
||||
// SendText("\x02\x11\x00\x00\x00\x13");
|
||||
// }
|
||||
|
||||
var bytes = new byte[]{0x03,0x96,0x00,0x00,0x02,0x00,0x04};
|
||||
if (lampNum == 2)
|
||||
bytes[5] = 0x01;
|
||||
SendBytes(AppendChecksum(bytes));
|
||||
}
|
||||
// public void GetRunningStatus()
|
||||
// {
|
||||
// SendText("\x00\x85\x00\x00\x01\x01\x87");
|
||||
// }
|
||||
|
||||
public void SelectInput(string inputKey)
|
||||
{
|
||||
if (InputMap.ContainsKey(inputKey))
|
||||
SendText(InputMap[inputKey]);
|
||||
}
|
||||
// public void GetLampRemaining(int lampNum)
|
||||
// {
|
||||
// if (!_PowerIsOn) return;
|
||||
|
||||
void SendText(string text)
|
||||
{
|
||||
if (CommunicationMethod != null)
|
||||
CommunicationMethod.SendText(text);
|
||||
}
|
||||
// var bytes = new byte[]{0x03,0x96,0x00,0x00,0x02,0x00,0x04};
|
||||
// if (lampNum == 2)
|
||||
// bytes[5] = 0x01;
|
||||
// SendBytes(AppendChecksum(bytes));
|
||||
// }
|
||||
|
||||
void SendBytes(byte[] bytes)
|
||||
{
|
||||
if (CommunicationMethod != null)
|
||||
CommunicationMethod.SendBytes(bytes);
|
||||
}
|
||||
// public void SelectInput(string inputKey)
|
||||
// {
|
||||
// if (InputMap.ContainsKey(inputKey))
|
||||
// SendText(InputMap[inputKey]);
|
||||
// }
|
||||
|
||||
byte[] AppendChecksum(byte[] bytes)
|
||||
{
|
||||
byte sum = unchecked((byte)bytes.Sum(x => (int)x));
|
||||
var retVal = new byte[bytes.Length + 1];
|
||||
bytes.CopyTo(retVal, 0);
|
||||
retVal[retVal.Length - 1] = sum;
|
||||
return retVal;
|
||||
}
|
||||
// void SendText(string text)
|
||||
// {
|
||||
// if (CommunicationMethod != null)
|
||||
// CommunicationMethod.SendText(text);
|
||||
// }
|
||||
|
||||
protected override void CommunicationMethod_BytesReceived(object sender, GenericCommMethodReceiveBytesArgs args)
|
||||
{
|
||||
var bytes = args.Bytes;
|
||||
ParseBytes(args.Bytes);
|
||||
}
|
||||
// void SendBytes(byte[] bytes)
|
||||
// {
|
||||
// if (CommunicationMethod != null)
|
||||
// CommunicationMethod.SendBytes(bytes);
|
||||
// }
|
||||
|
||||
void ParseBytes(byte[] bytes)
|
||||
{
|
||||
if (bytes[0] == 0x22)
|
||||
{
|
||||
// Power on
|
||||
if (bytes[1] == 0x00)
|
||||
{
|
||||
_PowerIsOn = true;
|
||||
PowerIsOnFeedback.FireUpdate();
|
||||
}
|
||||
// Power off
|
||||
else if (bytes[1] == 0x01)
|
||||
{
|
||||
_PowerIsOn = false;
|
||||
PowerIsOnFeedback.FireUpdate();
|
||||
}
|
||||
}
|
||||
// Running Status
|
||||
else if (bytes[0] == 0x20 && bytes[1] == 0x85 && bytes[4] == 0x10)
|
||||
{
|
||||
var operationStates = new Dictionary<int, string>
|
||||
{
|
||||
{ 0x00, "Standby" },
|
||||
{ 0x04, "Power On" },
|
||||
{ 0x05, "Cooling" },
|
||||
{ 0x06, "Standby (error)" },
|
||||
{ 0x0f, "Standby (power saving" },
|
||||
{ 0x10, "Network Standby" },
|
||||
{ 0xff, "Not supported" }
|
||||
};
|
||||
// byte[] AppendChecksum(byte[] bytes)
|
||||
// {
|
||||
// byte sum = unchecked((byte)bytes.Sum(x => (int)x));
|
||||
// var retVal = new byte[bytes.Length + 1];
|
||||
// bytes.CopyTo(retVal, 0);
|
||||
// retVal[retVal.Length - 1] = sum;
|
||||
// return retVal;
|
||||
// }
|
||||
|
||||
var newPowerIsOn = bytes[7] == 0x01;
|
||||
if (newPowerIsOn != _PowerIsOn)
|
||||
{
|
||||
_PowerIsOn = newPowerIsOn;
|
||||
PowerIsOnFeedback.FireUpdate();
|
||||
}
|
||||
// protected override void CommunicationMethod_BytesReceived(object sender, GenericCommMethodReceiveBytesArgs args)
|
||||
// {
|
||||
// var bytes = args.Bytes;
|
||||
// ParseBytes(args.Bytes);
|
||||
// }
|
||||
|
||||
Debug.Console(2, this, "PowerIsOn={0}\rCooling={1}\rPowering on/off={2}\rStatus={3}",
|
||||
_PowerIsOn,
|
||||
bytes[8] == 0x01,
|
||||
bytes[9] == 0x01,
|
||||
operationStates[bytes[10]]);
|
||||
// void ParseBytes(byte[] bytes)
|
||||
// {
|
||||
// if (bytes[0] == 0x22)
|
||||
// {
|
||||
// // Power on
|
||||
// if (bytes[1] == 0x00)
|
||||
// {
|
||||
// _PowerIsOn = true;
|
||||
// PowerIsOnFeedback.FireUpdate();
|
||||
// }
|
||||
// // Power off
|
||||
// else if (bytes[1] == 0x01)
|
||||
// {
|
||||
// _PowerIsOn = false;
|
||||
// PowerIsOnFeedback.FireUpdate();
|
||||
// }
|
||||
// }
|
||||
// // Running Status
|
||||
// else if (bytes[0] == 0x20 && bytes[1] == 0x85 && bytes[4] == 0x10)
|
||||
// {
|
||||
// var operationStates = new Dictionary<int, string>
|
||||
// {
|
||||
// { 0x00, "Standby" },
|
||||
// { 0x04, "Power On" },
|
||||
// { 0x05, "Cooling" },
|
||||
// { 0x06, "Standby (error)" },
|
||||
// { 0x0f, "Standby (power saving" },
|
||||
// { 0x10, "Network Standby" },
|
||||
// { 0xff, "Not supported" }
|
||||
// };
|
||||
|
||||
// var newPowerIsOn = bytes[7] == 0x01;
|
||||
// if (newPowerIsOn != _PowerIsOn)
|
||||
// {
|
||||
// _PowerIsOn = newPowerIsOn;
|
||||
// PowerIsOnFeedback.FireUpdate();
|
||||
// }
|
||||
|
||||
// Debug.Console(2, this, "PowerIsOn={0}\rCooling={1}\rPowering on/off={2}\rStatus={3}",
|
||||
// _PowerIsOn,
|
||||
// bytes[8] == 0x01,
|
||||
// bytes[9] == 0x01,
|
||||
// operationStates[bytes[10]]);
|
||||
|
||||
}
|
||||
// Lamp remaining
|
||||
else if (bytes[0] == 0x23 && bytes[1] == 0x96 && bytes[4] == 0x06 && bytes[6] == 0x04)
|
||||
{
|
||||
var newValue = bytes[7];
|
||||
if (bytes[5] == 0x00)
|
||||
{
|
||||
if (newValue != _Lamp1RemainingPercent)
|
||||
{
|
||||
_Lamp1RemainingPercent = newValue;
|
||||
Lamp1RemainingPercent.FireUpdate();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (newValue != _Lamp2RemainingPercent)
|
||||
{
|
||||
_Lamp2RemainingPercent = newValue;
|
||||
Lamp2RemainingPercent.FireUpdate();
|
||||
}
|
||||
}
|
||||
Debug.Console(0, this, "Lamp {0}, {1}% remaining", (bytes[5] + 1), bytes[7]);
|
||||
}
|
||||
// }
|
||||
// // Lamp remaining
|
||||
// else if (bytes[0] == 0x23 && bytes[1] == 0x96 && bytes[4] == 0x06 && bytes[6] == 0x04)
|
||||
// {
|
||||
// var newValue = bytes[7];
|
||||
// if (bytes[5] == 0x00)
|
||||
// {
|
||||
// if (newValue != _Lamp1RemainingPercent)
|
||||
// {
|
||||
// _Lamp1RemainingPercent = newValue;
|
||||
// Lamp1RemainingPercent.FireUpdate();
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (newValue != _Lamp2RemainingPercent)
|
||||
// {
|
||||
// _Lamp2RemainingPercent = newValue;
|
||||
// Lamp2RemainingPercent.FireUpdate();
|
||||
// }
|
||||
// }
|
||||
// Debug.Console(0, this, "Lamp {0}, {1}% remaining", (bytes[5] + 1), bytes[7]);
|
||||
// }
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge);
|
||||
}
|
||||
}
|
||||
// public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
// {
|
||||
// LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -63,7 +63,7 @@
|
||||
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Lighting.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="PepperDash_Core, Version=1.0.41.31808, Culture=neutral, processorArchitecture=MSIL">
|
||||
<Reference Include="PepperDash_Core, Version=1.0.42.30563, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\packages\PepperDashCore\lib\net35\PepperDash_Core.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
@@ -16,12 +16,12 @@ using PepperDash.Essentials.Core.Routing;
|
||||
namespace PepperDash.Essentials.Devices.Common
|
||||
{
|
||||
[Description("Wrapper class for an IR Set Top Box")]
|
||||
public class IRSetTopBoxBase : EssentialsBridgeableDevice, ISetTopBoxControls, IRoutingOutputs, IUsageTracking, IPower
|
||||
public class IRSetTopBoxBase : EssentialsBridgeableDevice, ISetTopBoxControls, IRoutingOutputs, IUsageTracking, IHasPowerControl
|
||||
{
|
||||
public IrOutputPortController IrPort { get; private set; }
|
||||
|
||||
public uint DisplayUiType { get { return DisplayUiConstants.TypeDirecTv; } }
|
||||
|
||||
public ushort IrPulseTime { get; set; }
|
||||
|
||||
public bool HasPresets { get; set; }
|
||||
public bool HasDvr { get; set; }
|
||||
@@ -35,6 +35,13 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
: base(key, name)
|
||||
{
|
||||
IrPort = portCont;
|
||||
IrPulseTime = 200;
|
||||
|
||||
if (props.IrPulseTime > 0)
|
||||
{
|
||||
IrPulseTime = (ushort)props.IrPulseTime;
|
||||
}
|
||||
|
||||
DeviceManager.AddDevice(portCont);
|
||||
|
||||
HasPresets = props.HasPresets;
|
||||
@@ -55,7 +62,6 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
AnyAudioOut = new RoutingOutputPort(RoutingPortNames.AnyAudioOut, eRoutingSignalType.Audio,
|
||||
eRoutingPortConnectionType.DigitalAudio, null, this);
|
||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort> { AnyVideoOut, AnyAudioOut };
|
||||
|
||||
}
|
||||
|
||||
public void LoadPresets(string filePath)
|
||||
@@ -348,26 +354,17 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
|
||||
public void PowerOn()
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_POWER_ON, true);
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_POWER_ON, false);
|
||||
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_ON, IrPulseTime);
|
||||
}
|
||||
|
||||
public void PowerOff()
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_POWER_OFF, true);
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_POWER_OFF, false);
|
||||
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_OFF, IrPulseTime);
|
||||
}
|
||||
|
||||
public void PowerToggle()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public BoolFeedback PowerIsOnFeedback
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER, IrPulseTime);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -395,79 +392,96 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name;
|
||||
|
||||
var stbBase = this as ISetTopBoxControls;
|
||||
if (stbBase != null)
|
||||
{
|
||||
trilist.BooleanInput[joinMap.HasDpad.JoinNumber].BoolValue = stbBase.HasDpad;
|
||||
trilist.BooleanInput[joinMap.HasNumeric.JoinNumber].BoolValue = stbBase.HasNumeric;
|
||||
trilist.BooleanInput[joinMap.HasDvr.JoinNumber].BoolValue = stbBase.HasDvr;
|
||||
trilist.BooleanInput[joinMap.HasPresets.JoinNumber].BoolValue = stbBase.HasPresets;
|
||||
|
||||
trilist.BooleanInput[joinMap.HasDpad.JoinNumber].BoolValue = stbBase.HasDpad;
|
||||
trilist.BooleanInput[joinMap.HasNumeric.JoinNumber].BoolValue = stbBase.HasNumeric;
|
||||
trilist.BooleanInput[joinMap.HasDvr.JoinNumber].BoolValue = stbBase.HasDvr;
|
||||
trilist.BooleanInput[joinMap.HasPresets.JoinNumber].BoolValue = stbBase.HasPresets;
|
||||
trilist.SetBoolSigAction(joinMap.DvrList.JoinNumber, stbBase.DvrList);
|
||||
trilist.SetBoolSigAction(joinMap.Replay.JoinNumber, stbBase.Replay);
|
||||
|
||||
trilist.SetBoolSigAction(joinMap.DvrList.JoinNumber, stbBase.DvrList);
|
||||
trilist.SetBoolSigAction(joinMap.Replay.JoinNumber, stbBase.Replay);
|
||||
trilist.SetStringSigAction(joinMap.LoadPresets.JoinNumber, stbBase.LoadPresets);
|
||||
}
|
||||
|
||||
trilist.SetStringSigAction(joinMap.LoadPresets.JoinNumber, stbBase.LoadPresets);
|
||||
|
||||
var stbPower = this as IPower;
|
||||
|
||||
trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, stbPower.PowerOn);
|
||||
trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, stbPower.PowerOff);
|
||||
trilist.SetSigTrueAction(joinMap.PowerToggle.JoinNumber, stbPower.PowerToggle);
|
||||
var stbPower = this as IHasPowerControl;
|
||||
if (stbPower != null)
|
||||
{
|
||||
trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, stbPower.PowerOn);
|
||||
trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, stbPower.PowerOff);
|
||||
trilist.SetSigTrueAction(joinMap.PowerToggle.JoinNumber, stbPower.PowerToggle);
|
||||
}
|
||||
|
||||
var stbDPad = this as IDPad;
|
||||
|
||||
trilist.SetBoolSigAction(joinMap.Up.JoinNumber, stbDPad.Up);
|
||||
trilist.SetBoolSigAction(joinMap.Down.JoinNumber, stbDPad.Down);
|
||||
trilist.SetBoolSigAction(joinMap.Left.JoinNumber, stbDPad.Left);
|
||||
trilist.SetBoolSigAction(joinMap.Right.JoinNumber, stbDPad.Right);
|
||||
trilist.SetBoolSigAction(joinMap.Select.JoinNumber, stbDPad.Select);
|
||||
trilist.SetBoolSigAction(joinMap.Menu.JoinNumber, stbDPad.Menu);
|
||||
trilist.SetBoolSigAction(joinMap.Exit.JoinNumber, stbDPad.Exit);
|
||||
if (stbDPad != null)
|
||||
{
|
||||
trilist.SetBoolSigAction(joinMap.Up.JoinNumber, stbDPad.Up);
|
||||
trilist.SetBoolSigAction(joinMap.Down.JoinNumber, stbDPad.Down);
|
||||
trilist.SetBoolSigAction(joinMap.Left.JoinNumber, stbDPad.Left);
|
||||
trilist.SetBoolSigAction(joinMap.Right.JoinNumber, stbDPad.Right);
|
||||
trilist.SetBoolSigAction(joinMap.Select.JoinNumber, stbDPad.Select);
|
||||
trilist.SetBoolSigAction(joinMap.Menu.JoinNumber, stbDPad.Menu);
|
||||
trilist.SetBoolSigAction(joinMap.Exit.JoinNumber, stbDPad.Exit);
|
||||
}
|
||||
|
||||
var stbChannel = this as IChannel;
|
||||
trilist.SetBoolSigAction(joinMap.ChannelUp.JoinNumber, stbChannel.ChannelUp);
|
||||
trilist.SetBoolSigAction(joinMap.ChannelDown.JoinNumber, stbChannel.ChannelDown);
|
||||
trilist.SetBoolSigAction(joinMap.LastChannel.JoinNumber, stbChannel.LastChannel);
|
||||
trilist.SetBoolSigAction(joinMap.Guide.JoinNumber, stbChannel.Guide);
|
||||
trilist.SetBoolSigAction(joinMap.Info.JoinNumber, stbChannel.Info);
|
||||
trilist.SetBoolSigAction(joinMap.Exit.JoinNumber, stbChannel.Exit);
|
||||
if (stbChannel != null)
|
||||
{
|
||||
trilist.SetBoolSigAction(joinMap.ChannelUp.JoinNumber, stbChannel.ChannelUp);
|
||||
trilist.SetBoolSigAction(joinMap.ChannelDown.JoinNumber, stbChannel.ChannelDown);
|
||||
trilist.SetBoolSigAction(joinMap.LastChannel.JoinNumber, stbChannel.LastChannel);
|
||||
trilist.SetBoolSigAction(joinMap.Guide.JoinNumber, stbChannel.Guide);
|
||||
trilist.SetBoolSigAction(joinMap.Info.JoinNumber, stbChannel.Info);
|
||||
trilist.SetBoolSigAction(joinMap.Exit.JoinNumber, stbChannel.Exit);
|
||||
}
|
||||
|
||||
var stbColor = this as IColor;
|
||||
trilist.SetBoolSigAction(joinMap.Red.JoinNumber, stbColor.Red);
|
||||
trilist.SetBoolSigAction(joinMap.Green.JoinNumber, stbColor.Green);
|
||||
trilist.SetBoolSigAction(joinMap.Yellow.JoinNumber, stbColor.Yellow);
|
||||
trilist.SetBoolSigAction(joinMap.Blue.JoinNumber, stbColor.Blue);
|
||||
if (stbColor != null)
|
||||
{
|
||||
trilist.SetBoolSigAction(joinMap.Red.JoinNumber, stbColor.Red);
|
||||
trilist.SetBoolSigAction(joinMap.Green.JoinNumber, stbColor.Green);
|
||||
trilist.SetBoolSigAction(joinMap.Yellow.JoinNumber, stbColor.Yellow);
|
||||
trilist.SetBoolSigAction(joinMap.Blue.JoinNumber, stbColor.Blue);
|
||||
}
|
||||
|
||||
var stbKeypad = this as ISetTopBoxNumericKeypad;
|
||||
if (stbKeypad != null)
|
||||
{
|
||||
trilist.StringInput[joinMap.KeypadAccessoryButton1Label.JoinNumber].StringValue = stbKeypad.KeypadAccessoryButton1Label;
|
||||
trilist.StringInput[joinMap.KeypadAccessoryButton2Label.JoinNumber].StringValue = stbKeypad.KeypadAccessoryButton2Label;
|
||||
|
||||
trilist.StringInput[joinMap.KeypadAccessoryButton1Label.JoinNumber].StringValue = stbKeypad.KeypadAccessoryButton1Label;
|
||||
trilist.StringInput[joinMap.KeypadAccessoryButton2Label.JoinNumber].StringValue = stbKeypad.KeypadAccessoryButton2Label;
|
||||
trilist.BooleanInput[joinMap.HasKeypadAccessoryButton1.JoinNumber].BoolValue = stbKeypad.HasKeypadAccessoryButton1;
|
||||
trilist.BooleanInput[joinMap.HasKeypadAccessoryButton2.JoinNumber].BoolValue = stbKeypad.HasKeypadAccessoryButton2;
|
||||
|
||||
trilist.BooleanInput[joinMap.HasKeypadAccessoryButton1.JoinNumber].BoolValue = stbKeypad.HasKeypadAccessoryButton1;
|
||||
trilist.BooleanInput[joinMap.HasKeypadAccessoryButton2.JoinNumber].BoolValue = stbKeypad.HasKeypadAccessoryButton2;
|
||||
|
||||
trilist.SetBoolSigAction(joinMap.Digit0.JoinNumber, stbKeypad.Digit0);
|
||||
trilist.SetBoolSigAction(joinMap.Digit1.JoinNumber, stbKeypad.Digit1);
|
||||
trilist.SetBoolSigAction(joinMap.Digit2.JoinNumber, stbKeypad.Digit2);
|
||||
trilist.SetBoolSigAction(joinMap.Digit3.JoinNumber, stbKeypad.Digit3);
|
||||
trilist.SetBoolSigAction(joinMap.Digit4.JoinNumber, stbKeypad.Digit4);
|
||||
trilist.SetBoolSigAction(joinMap.Digit5.JoinNumber, stbKeypad.Digit5);
|
||||
trilist.SetBoolSigAction(joinMap.Digit6.JoinNumber, stbKeypad.Digit6);
|
||||
trilist.SetBoolSigAction(joinMap.Digit7.JoinNumber, stbKeypad.Digit7);
|
||||
trilist.SetBoolSigAction(joinMap.Digit8.JoinNumber, stbKeypad.Digit8);
|
||||
trilist.SetBoolSigAction(joinMap.Digit9.JoinNumber, stbKeypad.Digit9);
|
||||
trilist.SetBoolSigAction(joinMap.KeypadAccessoryButton1Press.JoinNumber, stbKeypad.KeypadAccessoryButton1);
|
||||
trilist.SetBoolSigAction(joinMap.KeypadAccessoryButton2Press.JoinNumber, stbKeypad.KeypadAccessoryButton1);
|
||||
trilist.SetBoolSigAction(joinMap.Dash.JoinNumber, stbKeypad.Dash);
|
||||
trilist.SetBoolSigAction(joinMap.KeypadEnter.JoinNumber, stbKeypad.KeypadEnter);
|
||||
trilist.SetBoolSigAction(joinMap.Digit0.JoinNumber, stbKeypad.Digit0);
|
||||
trilist.SetBoolSigAction(joinMap.Digit1.JoinNumber, stbKeypad.Digit1);
|
||||
trilist.SetBoolSigAction(joinMap.Digit2.JoinNumber, stbKeypad.Digit2);
|
||||
trilist.SetBoolSigAction(joinMap.Digit3.JoinNumber, stbKeypad.Digit3);
|
||||
trilist.SetBoolSigAction(joinMap.Digit4.JoinNumber, stbKeypad.Digit4);
|
||||
trilist.SetBoolSigAction(joinMap.Digit5.JoinNumber, stbKeypad.Digit5);
|
||||
trilist.SetBoolSigAction(joinMap.Digit6.JoinNumber, stbKeypad.Digit6);
|
||||
trilist.SetBoolSigAction(joinMap.Digit7.JoinNumber, stbKeypad.Digit7);
|
||||
trilist.SetBoolSigAction(joinMap.Digit8.JoinNumber, stbKeypad.Digit8);
|
||||
trilist.SetBoolSigAction(joinMap.Digit9.JoinNumber, stbKeypad.Digit9);
|
||||
trilist.SetBoolSigAction(joinMap.KeypadAccessoryButton1Press.JoinNumber, stbKeypad.KeypadAccessoryButton1);
|
||||
trilist.SetBoolSigAction(joinMap.KeypadAccessoryButton2Press.JoinNumber, stbKeypad.KeypadAccessoryButton1);
|
||||
trilist.SetBoolSigAction(joinMap.Dash.JoinNumber, stbKeypad.Dash);
|
||||
trilist.SetBoolSigAction(joinMap.KeypadEnter.JoinNumber, stbKeypad.KeypadEnter);
|
||||
}
|
||||
|
||||
var stbTransport = this as ITransport;
|
||||
trilist.SetBoolSigAction(joinMap.Play.JoinNumber, stbTransport.Play);
|
||||
trilist.SetBoolSigAction(joinMap.Pause.JoinNumber, stbTransport.Pause);
|
||||
trilist.SetBoolSigAction(joinMap.Rewind.JoinNumber, stbTransport.Rewind);
|
||||
trilist.SetBoolSigAction(joinMap.FFwd.JoinNumber, stbTransport.FFwd);
|
||||
trilist.SetBoolSigAction(joinMap.ChapMinus.JoinNumber, stbTransport.ChapMinus);
|
||||
trilist.SetBoolSigAction(joinMap.ChapPlus.JoinNumber, stbTransport.ChapPlus);
|
||||
trilist.SetBoolSigAction(joinMap.Stop.JoinNumber, stbTransport.Stop);
|
||||
trilist.SetBoolSigAction(joinMap.Record.JoinNumber, stbTransport.Record);
|
||||
if (stbTransport != null)
|
||||
{
|
||||
trilist.SetBoolSigAction(joinMap.Play.JoinNumber, stbTransport.Play);
|
||||
trilist.SetBoolSigAction(joinMap.Pause.JoinNumber, stbTransport.Pause);
|
||||
trilist.SetBoolSigAction(joinMap.Rewind.JoinNumber, stbTransport.Rewind);
|
||||
trilist.SetBoolSigAction(joinMap.FFwd.JoinNumber, stbTransport.FFwd);
|
||||
trilist.SetBoolSigAction(joinMap.ChapMinus.JoinNumber, stbTransport.ChapMinus);
|
||||
trilist.SetBoolSigAction(joinMap.ChapPlus.JoinNumber, stbTransport.ChapPlus);
|
||||
trilist.SetBoolSigAction(joinMap.Stop.JoinNumber, stbTransport.Stop);
|
||||
trilist.SetBoolSigAction(joinMap.Record.JoinNumber, stbTransport.Record);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
public bool HasDvr { get; set; }
|
||||
public bool HasDpad { get; set; }
|
||||
public bool HasNumeric { get; set; }
|
||||
public int IrPulseTime { get; set; }
|
||||
|
||||
public ControlPropertiesConfig Control { get; set; }
|
||||
}
|
||||
|
||||
@@ -106,8 +106,8 @@ namespace PepperDash.Essentials.Devices.Common.SoftCodec
|
||||
if (route.SourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
dest.ReleaseRoute();
|
||||
if (dest is IPower)
|
||||
(dest as IPower).PowerOff();
|
||||
if (dest is IHasPowerControl)
|
||||
(dest as IHasPowerControl).PowerOff();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1339,10 +1339,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
|
||||
public override void SendDtmf(string s)
|
||||
{
|
||||
if (CallFavorites != null)
|
||||
{
|
||||
SendText(string.Format("xCommand Call DTMFSend CallId: {0} DTMFString: \"{1}\"", GetCallId(), s));
|
||||
}
|
||||
SendText(string.Format("xCommand Call DTMFSend CallId: {0} DTMFString: \"{1}\"", GetCallId(), s));
|
||||
}
|
||||
|
||||
public void SelectPresentationSource(int source)
|
||||
@@ -1970,6 +1967,14 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the selected source of the available external sources on teh Touch10 UI
|
||||
/// </summary>
|
||||
public void SetSelectedSource(string key)
|
||||
{
|
||||
SendText(string.Format("xCommand UserInterface Presentation ExternalSource Select SourceIdentifier: {0}", key));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Action that will run when the External Source is selected.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user