Compare commits

..

39 Commits

Author SHA1 Message Date
Neil Dorin
7eed7866f1 Merge pull request #1243 from PepperDash/routing-fixes
Routing fixes
2025-04-04 09:50:27 -06:00
Andrew Welker
c5403f33c5 fix: add previous condition back to the flag check
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-04-04 10:49:04 -05:00
Andrew Welker
c9f10ecb90 build: delete clz files on build 2025-04-04 08:09:42 -05:00
Andrew Welker
ef2da21c2a chore: remove old InRoomPc class
class has moved to Devices.Common library
2025-04-04 08:09:32 -05:00
Andrew Welker
b0920746d1 feat: check base folder for cplz and ir files
In an effort to make things easier for devs and end users, the plugin loading logic will now find .cplz files that are in the `Global.FilePathPrefix` base folder (/user/program{programNumber}/` on an appliance, `/user/` on a server). The same applies for IR files. This should make it so that individual plugin cplzs can be loaded via the VC-4 web interface.
2025-04-04 08:09:24 -05:00
Andrew Welker
b531d724ff fix: add OverrideType property to TieLineConfig
The TielineConfig had no property for the `type` property from an Essentials configuration file to be deserialized into. This has been corrected so that the `type` property in a Tieline JSON configuration is now respected and used to build the tieline.
2025-04-04 00:04:53 -05:00
Andrew Welker
1b17d92ee0 fix: Essentials Routing now checks for SecondaryAudio if necessary
To support NVX Routing, checking for the SecondaryAudio routing type is necessary to find the correct path through the system for audio.
2025-04-04 00:03:21 -05:00
Neil Dorin
2c0739df4b Merge pull request #1241 from PepperDash/release
Release
2025-04-02 11:12:48 -06:00
Andrew Welker
b77fc3647a Merge pull request #1240 from PepperDash/codec-messenger-issues
Codec messenger serialization issues
2025-04-02 12:05:17 -05:00
Andrew Welker
1fe8993db3 fix: ignore CameraBase routing port list
The `RoutingPortCollection` type appears to not be currently
serializable. If a class that contains this collection is going to be
serialized, the collection should have the `JsonIgnore` attribute added.
If the list is needed, use a conversion object and convert it to a
regular list.
2025-04-02 11:56:13 -05:00
Andrew Welker
f735f7377d fix: bring modifications made to plugin over 2025-04-02 10:00:33 -05:00
Neil Dorin
4e43565c1a Merge pull request #1239 from PepperDash/mc-fixes 2025-04-02 08:16:02 -06:00
Andrew Welker
97e157b5b6 fix: bring modifications made to plugin over 2025-04-02 08:39:08 -05:00
Andrew Welker
157ef3397f Merge pull request #1238 from PepperDash/webview-eventhandler 2025-04-02 07:49:37 -05:00
aknous
16c39b5201 feat: adds event handler to IHasWebView 2025-04-01 23:54:49 -04:00
Neil Dorin
8f278f4ec2 Merge pull request #1236 from PepperDash/temp-to-dev
Temp to dev
2025-04-01 11:35:03 -06:00
Jason DeVito
3411fe0cf3 Merge pull request #1235 from PepperDash/fix-volume-add-again
fix: move current volume action creation after power registrations
2025-04-01 10:09:54 -05:00
Andrew Welker
6713ea53f2 fix: move current volume action creation after power registrations 2025-04-01 09:44:18 -05:00
Neil Dorin
a81f92481c Merge pull request #1234 from PepperDash/temp-to-dev 2025-04-01 08:07:55 -06:00
Andrew Welker
607f6084de Merge pull request #1233 from PepperDash/release
Release
2025-04-01 09:03:46 -05:00
Andrew Welker
1625cbe6de Merge pull request #1232 from PepperDash/feature/IHasOsd
Add IHasWebview interface
2025-04-01 08:56:01 -05:00
Neil Dorin
63e6829a03 Merge pull request #1231 from PepperDash/temp-to-dev 2025-03-31 12:28:30 -06:00
Neil Dorin
d3719ee505 Merge pull request #1230 from PepperDash/room-loading-protections 2025-03-31 11:58:14 -06:00
Andrew Welker
041059210c fix: add null check for room before adding to DevManager 2025-03-31 12:53:44 -05:00
Neil Dorin
1a45ef5d0f Merge pull request #1229 from PepperDash/temp-to-dev 2025-03-28 11:14:10 -06:00
Andrew Welker
65a0743dac Merge pull request #1228 from PepperDash/add-routes
fix: add routes to get routing ports & all defined routes
2025-03-28 10:50:04 -05:00
Andrew Welker
32e090648c fix: add missing parameter for GetRoutesHandler 2025-03-28 10:41:21 -05:00
Andrew Welker
bb045ba06b fix: add base URL to routes response 2025-03-28 10:32:16 -05:00
Andrew Welker
474b2eb647 fix: add routes to get routing ports & all defined routes 2025-03-28 10:25:17 -05:00
Andrew Welker
e6cf2794bc Merge pull request #1227 from PepperDash/temp-to-dev 2025-03-26 14:29:27 -05:00
aknous
2c28b57806 fix: removes public access modifier from WebviewIsVisible prop 2025-03-20 00:42:30 -04:00
aknous
8762f84548 feat: adds WebviewVisible property to IHasWebView 2025-03-20 00:40:39 -04:00
aknous
b0a68f38f5 feat: adds bypassPackageCheck to github workflow 2025-03-18 13:18:07 -04:00
aknous
46887579e4 feat: simplifies IHasOsd ShowWebView method signature 2025-03-18 12:35:13 -04:00
Andrew Welker
b095d926d2 Merge branch 'development' into feature-2.0.0/IHasOsd 2025-03-12 13:29:00 -05:00
aknous
7cebf861cc build(force-patch): force rebuild 2025-03-12 14:14:11 -04:00
aknous
2e0b003118 build(force-patch): force build 2025-03-12 13:31:54 -04:00
aknous
bada7e3a25 feat: renames interface 2025-03-12 11:00:44 -04:00
aknous
67a7422cd0 feat: adds IHasOSD interface 2025-03-11 23:33:59 -04:00
23 changed files with 674 additions and 399 deletions

View File

@@ -60,4 +60,4 @@ For detailed documentation, see the [Wiki](https://github.com/PepperDash/Essenti
## How-To (Getting Started)
See [Getting Started](https://github.com/PepperDash/Essentials/wiki/Get-started#how-to-get-started)
See [Getting Started](https://github.com/PepperDash/Essentials/wiki/Get-started#how-to-get-started)

View File

@@ -1,5 +1,9 @@
<Project>
<ItemGroup>
<ItemGroup>
<None Include="$(TargetDir)$(TargetName).$(Version).$(TargetFramework).clz" Condition="$(ProjectType) == 'Library'">
<Pack>true</Pack>
<PackagePath>build;</PackagePath>
</None>
<None Include="$(TargetDir)$(TargetName).$(Version).$(TargetFramework).cpz" Condition="$(ProjectType) == 'Program'">
<Pack>true</Pack>
<PackagePath>build;</PackagePath>
@@ -9,30 +13,41 @@
<PackagePath>build;</PackagePath>
</None>
</ItemGroup>
<PropertyGroup Condition="$(ProjectType) == 'Library'">
<FileName>$(TargetDir)$(TargetName).$(Version).$(TargetFramework).clz</FileName>
</PropertyGroup>
<PropertyGroup Condition="$(ProjectType) == 'ProgramLibrary'">
<FileName>$(TargetDir)$(TargetName).$(Version).$(TargetFramework).cplz</FileName>
</PropertyGroup>
<PropertyGroup Condition="$(ProjectType) == 'Program'">
<FileName>$(TargetDir)$(TargetName).$(Version).$(TargetFramework).cpz</FileName>
</PropertyGroup>
<Target Name="DeleteCPLZ" BeforeTargets="PreBuildEvent" Condition="$(ProjectType) == 'ProgramLibrary' And $(TargetDir) != '' And Exists($(FileName))">
<Delete Files="$(TargetDir)$(TargetName).$(Version).$(TargetFramework).cplz">
<Target Name="DeleteCLZ" BeforeTargets="PreBuildEvent" Condition="$(ProjectType) == 'Library' And $(TargetDir) != '' And Exists($(FileName))">
<Delete Files="$(TargetDir)$(TargetName).$(Version).$(TargetFramework).clz">
<Output TaskParameter="DeletedFiles" ItemName="DeletedList"/>
</Delete>
<Message Text="Deleted files: '@(DeletedList)'" />
</Target>
<Target Name="CreateCPLZ" AfterTargets="Build" Condition="$(ProjectType) == 'ProgramLibrary' And $(TargetDir) != ''" DependsOnTargets="DeleteCPLZ">
<Message Text="Creating CPLZ $(TargetDir)"></Message>
<MakeDir Directories="$(PackageOutputPath)" Condition="!Exists($(PackageOutputPath))" />
<ZipDirectory SourceDirectory="$(TargetDir)" DestinationFile="$(PackageOutputPath)\$(TargetName).$(Version).$(TargetFramework).cplz" Overwrite="true"/>
<Copy SourceFiles="$(PackageOutputPath)\$(TargetName).$(Version).$(TargetFramework).cplz" DestinationFiles="$(TargetDir)$(TargetName).$(Version).$(TargetFramework).cplz" />
</Target>
<Target Name="DeleteCPZ" BeforeTargets="PreBuildEvent" Condition="$(ProjectType) == 'Program' And $(TargetDir) != '' And Exists($(FileName))">
<Delete Files="$(TargetDir)$(TargetName).$(Version).$(TargetFramework).cpz">
<Output TaskParameter="DeletedFiles" ItemName="DeletedList"/>
</Delete>
<Message Text="Deleted files: '@(DeletedList)'" />
</Target>
<Target Name="DeleteCPLZ" BeforeTargets="PreBuildEvent" Condition="$(ProjectType) == 'ProgramLibrary' And $(TargetDir) != '' And Exists($(FileName))">
<Delete Files="$(TargetDir)$(TargetName).$(Version).$(TargetFramework).cplz">
<Output TaskParameter="DeletedFiles" ItemName="DeletedList"/>
</Delete>
<Message Text="Deleted files: '@(DeletedList)'" />
</Target>
<Target Name="CreateCPLZ" AfterTargets="Build" Condition="$(ProjectType) == 'ProgramLibrary' And $(TargetDir) != ''" DependsOnTargets="DeleteCPLZ">
<Message Text="Creating CPLZ $(TargetDir)"></Message>
<MakeDir Directories="$(PackageOutputPath)" Condition="!Exists($(PackageOutputPath))" />
<ZipDirectory SourceDirectory="$(TargetDir)" DestinationFile="$(PackageOutputPath)\$(TargetName).$(Version).$(TargetFramework).cplz" Overwrite="true"/>
<Copy SourceFiles="$(PackageOutputPath)\$(TargetName).$(Version).$(TargetFramework).cplz" DestinationFiles="$(TargetDir)$(TargetName).$(Version).$(TargetFramework).cplz" />
</Target>
<Target Name="Copy CLZ" AfterTargets="SimplSharpPostProcess" Condition="($(ProjectType) == 'Library')">
<Message Text="Copying CLZ"></Message>
<Move SourceFiles="$(TargetDir)\$(TargetName).clz" DestinationFiles="$(TargetDir)\$(TargetName).$(Version).$(TargetFramework).clz"/>

View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
{
public interface IHasWebView
{
bool WebviewIsVisible { get; }
void ShowWebView(string url, string mode, string title, string target);
void HideWebView();
event EventHandler<WebViewStatusChangedEventArgs> WebViewStatusChanged;
}
public class WebViewStatusChangedEventArgs : EventArgs
{
public string Status { get; }
public WebViewStatusChangedEventArgs(string status)
{
Status = status;
}
}
}

View File

@@ -12,6 +12,8 @@ using PepperDash.Essentials.Core.Config;
using PepperDash.Core;
using Serilog.Events;
using System.IO;
using PepperDash.Core.Logging;
namespace PepperDash.Essentials.Core
{
@@ -69,7 +71,26 @@ namespace PepperDash.Essentials.Core
return;
}
var filePath = Global.FilePathPrefix + "ir" + Global.DirectorySeparator + config.Properties["control"]["irFile"].Value<string>();
// var filePath = Global.FilePathPrefix + "ir" + Global.DirectorySeparator + config.Properties["control"]["irFile"].Value<string>();
var fileName = config.Properties["control"]["irFile"].Value<string>();
var files = Directory.GetFiles(Global.FilePathPrefix, fileName, SearchOption.AllDirectories);
if(files.Length == 0)
{
this.LogError("IR file {fileName} not found in {path}", fileName, Global.FilePathPrefix);
return;
}
if(files.Length > 1)
{
this.LogError("IR file {fileName} found in multiple locations: {files}", fileName, files);
return;
}
var filePath = files[0];
Debug.LogMessage(LogEventLevel.Debug, "*************Attempting to load IR file: {0}***************", filePath);
LoadDriver(filePath);

View File

@@ -1,81 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Crestron.SimplSharpPro;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Core;
using Serilog.Events;
namespace PepperDash.Essentials.Core.Devices
{
[Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")]
public class InRoomPc : EssentialsDevice, IHasFeedback, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo, IUsageTracking
{
public uint DisplayUiType { get { return DisplayUiConstants.TypeLaptop; } }
public string IconName { get; set; }
public BoolFeedback HasPowerOnFeedback { get; private set; }
public RoutingOutputPort AnyVideoOut { get; private set; }
#region IRoutingOutputs Members
/// <summary>
/// Options: hdmi
/// </summary>
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
#endregion
public InRoomPc(string key, string name)
: base(key, name)
{
IconName = "PC";
HasPowerOnFeedback = new BoolFeedback("HasPowerFeedback",
() => this.GetVideoStatuses() != VideoStatusOutputs.NoStatus);
OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
OutputPorts.Add(AnyVideoOut = new RoutingOutputPort(RoutingPortNames.AnyVideoOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.None, 0, this));
}
#region IHasFeedback Members
/// <summary>
/// Passes through the VideoStatuses list
/// </summary>
public FeedbackCollection<Feedback> Feedbacks
{
get
{
var newList = new FeedbackCollection<Feedback>();
newList.AddRange(this.GetVideoStatuses().ToList());
return newList;
}
}
#endregion
#region IUsageTracking Members
public UsageTracking UsageTracker { get; set; }
#endregion
}
[Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")]
public class InRoomPcFactory : EssentialsDeviceFactory<InRoomPc>
{
public InRoomPcFactory()
{
TypeNames = new List<string>() { "inroompc" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new InRoomPc Device");
return new InRoomPc(dc.Key, dc.Name);
}
}
}

View File

@@ -2,13 +2,14 @@
using System.Collections.Generic;
using System.Linq;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
// using Crestron.SimplSharp.CrestronIO;
using System.Reflection;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using Serilog.Events;
using Newtonsoft.Json;
using System.IO;
namespace PepperDash.Essentials
{
@@ -283,11 +284,21 @@ namespace PepperDash.Essentials
/// </summary>
static void UnzipAndMoveCplzArchives()
{
Debug.LogMessage(LogEventLevel.Information, "Looking for .cplz archives from plugins folder...");
var di = new DirectoryInfo(_pluginDirectory);
var zFiles = di.GetFiles("*.cplz");
Debug.LogMessage(LogEventLevel.Information, "Looking for .cplz archives from user folder...");
//var di = new DirectoryInfo(_pluginDirectory);
//var zFiles = di.GetFiles("*.cplz");
if (zFiles.Length > 0)
//// Find cplz files at the root of the user folder. Makes development/testing easier for VC-4, and helps with mistakes by end users
//var userDi = new DirectoryInfo(Global.FilePathPrefix);
//var userZFiles = userDi.GetFiles("*.cplz");
Debug.LogInformation("Checking {folder} for .cplz files", Global.FilePathPrefix);
var cplzFiles = Directory.GetFiles(Global.FilePathPrefix, "*.cplz", SearchOption.AllDirectories)
.Select(f => new FileInfo(f))
.ToArray();
if (cplzFiles.Length > 0)
{
if (!Directory.Exists(_loadedPluginsDirectoryPath))
{
@@ -295,12 +306,12 @@ namespace PepperDash.Essentials
}
}
foreach (var zfi in zFiles)
foreach (var zfi in cplzFiles)
{
Directory.CreateDirectory(_tempDirectory);
var tempDi = new DirectoryInfo(_tempDirectory);
Debug.LogMessage(LogEventLevel.Information, "Found cplz: {0}. Unzipping into temp plugins directory", zfi.Name);
Debug.LogMessage(LogEventLevel.Information, "Found cplz: {0}. Unzipping into temp plugins directory", zfi.FullName);
var result = CrestronZIP.Unzip(zfi.FullName, tempDi.FullName);
Debug.LogMessage(LogEventLevel.Information, "UnZip Result: {0}", result.ToString());

View File

@@ -1,4 +1,5 @@
using PepperDash.Essentials.Core.Queues;
using Crestron.SimplSharpPro.Keypads;
using PepperDash.Essentials.Core.Queues;
using PepperDash.Essentials.Core.Routing;
using Serilog.Events;
using System;
@@ -88,9 +89,17 @@ namespace PepperDash.Essentials.Core
Debug.LogMessage(LogEventLevel.Debug, "Attempting to build source route from {sourceKey} of type {type}", destination, source.Key);
var audioRouteDescriptor = new RouteDescriptor(source, destination, destinationPort, eRoutingSignalType.Audio);
RouteDescriptor audioRouteDescriptor;
var audioSuccess = destination.GetRouteToSource(source, null, null, eRoutingSignalType.Audio, 0, audioRouteDescriptor, destinationPort, sourcePort);
if (signalType.HasFlag(eRoutingSignalType.SecondaryAudio))
{
audioRouteDescriptor = new RouteDescriptor(source, destination, destinationPort, eRoutingSignalType.SecondaryAudio);
} else
{
audioRouteDescriptor = new RouteDescriptor(source, destination, destinationPort, eRoutingSignalType.Audio);
}
var audioSuccess = destination.GetRouteToSource(source, null, null, signalType.HasFlag(eRoutingSignalType.SecondaryAudio) ? eRoutingSignalType.SecondaryAudio : eRoutingSignalType.Audio, 0, audioRouteDescriptor, destinationPort, sourcePort);
if (!audioSuccess)
Debug.LogMessage(LogEventLevel.Debug, "Cannot find audio route to {0}", destination, source.Key);
@@ -268,13 +277,12 @@ namespace PepperDash.Essentials.Core
if (destinationPort == null)
{
destinationTieLines = TieLineCollection.Default.Where(t =>
t.DestinationPort.ParentDevice.Key == destination.Key && (t.Type == signalType || t.Type.HasFlag(eRoutingSignalType.AudioVideo)));
t.DestinationPort.ParentDevice.Key == destination.Key && (t.Type.HasFlag(signalType) || signalType == eRoutingSignalType.AudioVideo));
}
else
{
destinationTieLines = TieLineCollection.Default.Where(t => t.DestinationPort.ParentDevice.Key == destination.Key && t.DestinationPort.Key == destinationPort.Key && (t.Type == signalType || t.Type.HasFlag(eRoutingSignalType.AudioVideo)));
destinationTieLines = TieLineCollection.Default.Where(t => t.DestinationPort.ParentDevice.Key == destination.Key && t.DestinationPort.Key == destinationPort.Key && (t.Type.HasFlag(signalType)));
}
// find the TieLine without a port

View File

@@ -1,4 +1,5 @@
using System;
using Newtonsoft.Json;
using System;
namespace PepperDash.Essentials.Core
@@ -8,10 +9,11 @@ namespace PepperDash.Essentials.Core
/// </summary>
public class RoutingInputPort : RoutingPort
{
/// <summary>
/// The IRoutingInputs object this lives on
/// </summary>
public IRoutingInputs ParentDevice { get; private set; }
/// <summary>
/// The IRoutingInputs object this lives on
/// </summary>
[JsonIgnore]
public IRoutingInputs ParentDevice { get; private set; }
/// <summary>
/// Constructor for a basic RoutingInputPort

View File

@@ -1,14 +1,17 @@
using System;
using Newtonsoft.Json;
using System;
namespace PepperDash.Essentials.Core
{
public class RoutingOutputPort : RoutingPort
{
/// <summary>
/// The IRoutingOutputs object this port lives on
/// </summary>
public IRoutingOutputs ParentDevice { get; private set; }
{
/// <summary>
/// The IRoutingOutputs object this port lives on
/// </summary>
///
[JsonIgnore]
public IRoutingOutputs ParentDevice { get; private set; }
public InUseTracking InUseTracker { get; private set; }

View File

@@ -2,9 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
/// <summary>

View File

@@ -57,6 +57,16 @@ namespace PepperDash.Essentials.Core
DestinationPort = destinationPort;
}
/// <summary>
/// Creates a tie line with an overriding Type. See help for OverrideType property for info
/// </summary>
/// <param name="overrideType">The signal type to limit the link to. Overrides DestinationPort.Type</param>
public TieLine(RoutingOutputPort sourcePort, RoutingInputPort destinationPort, eRoutingSignalType? overrideType) :
this(sourcePort, destinationPort)
{
OverrideType = overrideType;
}
/// <summary>
/// Creates a tie line with an overriding Type. See help for OverrideType property for info
/// </summary>

View File

@@ -7,6 +7,7 @@ using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core;
@@ -23,6 +24,10 @@ namespace PepperDash.Essentials.Core.Config
public string DestinationCard { get; set; }
public string DestinationPort { get; set; }
[JsonProperty("type", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(StringEnumConverter))]
public eRoutingSignalType? OverrideType { get; set; }
/// <summary>
/// Returns the appropriate tie line for either a card-based device or
/// regular device with ports on-device.
@@ -65,7 +70,7 @@ namespace PepperDash.Essentials.Core.Config
return null;
}
return new TieLine(sourceOutputPort, destinationInputPort);
return new TieLine(sourceOutputPort, destinationInputPort, OverrideType);
}
void LogError(string msg)

View File

@@ -144,17 +144,17 @@ namespace PepperDash.Essentials.Core.Web
Name = "GetJoinMapsForDeviceKey",
RouteHandler = new GetJoinMapForDeviceKeyRequestHandler()
},
new HttpCwsRoute("debugSession")
{
Name = "DebugSession",
RouteHandler = new DebugSessionRequestHandler()
},
new HttpCwsRoute("doNotLoadConfigOnNextBoot")
{
Name = "DoNotLoadConfigOnNextBoot",
RouteHandler = new DoNotLoadConfigOnNextBootRequestHandler()
},
new HttpCwsRoute("restartProgram")
new HttpCwsRoute("debugSession")
{
Name = "DebugSession",
RouteHandler = new DebugSessionRequestHandler()
},
new HttpCwsRoute("doNotLoadConfigOnNextBoot")
{
Name = "DoNotLoadConfigOnNextBoot",
RouteHandler = new DoNotLoadConfigOnNextBootRequestHandler()
},
new HttpCwsRoute("restartProgram")
{
Name = "Restart Program",
RouteHandler = new RestartProgramRequestHandler()
@@ -164,12 +164,16 @@ namespace PepperDash.Essentials.Core.Web
Name = "Load Config",
RouteHandler = new LoadConfigRequestHandler()
},
new HttpCwsRoute("getTielines")
new HttpCwsRoute("tielines")
{
Name = "Get TieLines",
RouteHandler = new GetTieLinesRequestHandler()
}
},
new HttpCwsRoute("device/{deviceKey}/routingPorts")
{
Name = "Get Routing Ports for a device",
RouteHandler = new GetRoutingPortsHandler()
},
};
AddRoute(routes);
@@ -196,13 +200,18 @@ namespace PepperDash.Essentials.Core.Web
}
}
/// <summary>
/// Initializes the CWS class
/// </summary>
public override void Initialize()
/// <summary>
/// Initializes the CWS class
/// </summary>
public override void Initialize()
{
// If running on an appliance
if (CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance)
AddRoute(new HttpCwsRoute("apiPaths") {
Name = "GetPaths",
RouteHandler = new GetRoutesHandler(_server.GetRouteCollection(), BasePath)
});
// If running on an appliance
if (CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance)
{
/*
WEBSERVER [ON | OFF | TIMEOUT <VALUE IN SECONDS> | MAXSESSIONSPERUSER <Number of sessions>]
@@ -247,8 +256,8 @@ namespace PepperDash.Essentials.Core.Web
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_HOSTNAME, 0);
var path = CrestronEnvironment.DevicePlatform == eDevicePlatform.Server
? $"http(s)://{hostname}/VirtualControl/Rooms/{InitialParametersClass.RoomId}/cws{BasePath}"
: $"http(s)://{currentIp}/cws{BasePath}";
? $"https://{hostname}/VirtualControl/Rooms/{InitialParametersClass.RoomId}/cws{BasePath}"
: $"https://{currentIp}/cws{BasePath}";
Debug.LogMessage(LogEventLevel.Information, this, "Server:{path:l}", path);

View File

@@ -0,0 +1,52 @@
using Crestron.SimplSharp;
using Crestron.SimplSharp.WebScripting;
using Newtonsoft.Json;
using PepperDash.Core.Web.RequestHandlers;
namespace PepperDash.Essentials.Core.Web.RequestHandlers
{
public class GetRoutesHandler:WebApiBaseRequestHandler
{
private HttpCwsRouteCollection routeCollection;
private string basePath;
public GetRoutesHandler(HttpCwsRouteCollection routeCollection, string basePath) {
this.routeCollection = routeCollection;
this.basePath = basePath;
}
protected override void HandleGet(HttpCwsContext context)
{
var currentIp = CrestronEthernetHelper.GetEthernetParameter(
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0);
var hostname = CrestronEthernetHelper.GetEthernetParameter(
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_HOSTNAME, 0);
var path = CrestronEnvironment.DevicePlatform == eDevicePlatform.Server
? $"https://{hostname}/VirtualControl/Rooms/{InitialParametersClass.RoomId}/cws{basePath}"
: $"https://{currentIp}/cws{basePath}";
var response = JsonConvert.SerializeObject(new RoutesResponseObject()
{
Url = path,
Routes = routeCollection
});
context.Response.StatusCode = 200;
context.Response.ContentType = "application/json";
context.Response.Headers.Add("Content-Type", "application/json");
context.Response.Write(response, false);
context.Response.End();
}
}
public class RoutesResponseObject
{
[JsonProperty("url")]
public string Url { set; get; }
[JsonProperty("routes")]
public HttpCwsRouteCollection Routes { get; set; }
}
}

View File

@@ -0,0 +1,70 @@
using Crestron.SimplSharp.WebScripting;
using Newtonsoft.Json;
using PepperDash.Core.Web.RequestHandlers;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PepperDash.Essentials.Core.Web.RequestHandlers
{
public class GetRoutingPortsHandler : WebApiBaseRequestHandler
{
public GetRoutingPortsHandler() : base(true) { }
protected override void HandleGet(HttpCwsContext context)
{
var routeData = context.Request.RouteData;
if (routeData == null)
{
context.Response.StatusCode = 400;
context.Response.StatusDescription = "Bad Request";
context.Response.End();
return;
}
if(!routeData.Values.TryGetValue("deviceKey", out var deviceKey))
{
context.Response.StatusCode = 400;
context.Response.StatusDescription = "Bad Request";
context.Response.End();
return;
}
var device = DeviceManager.GetDeviceForKey(deviceKey.ToString());
if (device == null)
{
context.Response.StatusCode = 404;
context.Response.StatusDescription = "Device Not Found";
context.Response.End();
return;
}
var inputPorts = (device as IRoutingInputs)?.InputPorts;
var outputPorts = (device as IRoutingOutputs)?.OutputPorts;
var response = JsonConvert.SerializeObject( new ReturnValue
{
InputPorts = inputPorts?.Select(p => p.Key).ToList(),
OutputPorts = outputPorts?.Select(p => p.Key).ToList()
});
context.Response.StatusCode = 200;
context.Response.StatusDescription = "OK";
context.Response.ContentType = "application/json";
context.Response.ContentEncoding = Encoding.UTF8;
context.Response.Write(response, false);
context.Response.End();
}
}
internal class ReturnValue {
[JsonProperty("inputPorts", NullValueHandling = NullValueHandling.Ignore)]
public List<string> InputPorts { get; set; }
[JsonProperty("outputPorts", NullValueHandling = NullValueHandling.Ignore)]
public List<string> OutputPorts { get; set; }
}
}

View File

@@ -37,6 +37,7 @@ namespace PepperDash.Essentials.Devices.Common.Cameras
#region IRoutingOutputs Members
[JsonIgnore]
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; protected set; }
#endregion

View File

@@ -43,7 +43,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
protected override void RegisterActions()
{
AddAction("/presets/fullStatus", (id, content) =>
AddAction("/fullStatus", (id, content) =>
{
this.LogInformation("getting full status for client {id}", id);
try
@@ -56,7 +56,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
}
});
AddAction("/presets/recall", (id, content) =>
AddAction("/recall", (id, content) =>
{
var p = content.ToObject<PresetChannelMessage>();
@@ -70,7 +70,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
RecallPreset(dev, p.Preset.Channel);
});
AddAction("/presets/save", (id, content) =>
AddAction("/save", (id, content) =>
{
var presets = content.ToObject<List<PresetChannel>>();

View File

@@ -2,7 +2,10 @@
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Core.Logging;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
using System;
using System.Collections.Generic;
namespace PepperDash.Essentials.AppServer.Messengers
{
@@ -56,10 +59,32 @@ namespace PepperDash.Essentials.AppServer.Messengers
private void SendFullStatus()
{
var stateObject = new JObject();
stateObject[_propName] = JToken.FromObject(itemDevice, serializer);
PostStatusMessage(stateObject);
try
{
this.LogInformation("Sending full status");
var stateObject = new ISelectableItemsStateMessage<TKey>
{
Items = itemDevice.Items,
CurrentItem = itemDevice.CurrentItem
};
PostStatusMessage(stateObject);
}
catch (Exception e)
{
this.LogError("Error sending full status: {0}", e.Message);
}
}
}
public class ISelectableItemsStateMessage<TKey> : DeviceStateMessageBase
{
[JsonProperty("items")]
public Dictionary<TKey, ISelectableItem> Items { get; set; }
[JsonProperty("currentItem")]
public TKey CurrentItem { get; set; }
}
}

View File

@@ -1,6 +1,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Core.Logging;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
using System;
@@ -152,11 +153,13 @@ namespace PepperDash.Essentials.AppServer.Messengers
message.Name = _device.Name;
PostStatusMessage(JToken.FromObject(message), MessagePath, clientId);
var token = JToken.FromObject(message);
PostStatusMessage(token, MessagePath, clientId);
}
catch (Exception ex)
{
Debug.LogMessage(ex, "Exception posting status message", this);
this.LogError(ex, "Exception posting status message for {messagePath} to {clientId}", MessagePath, clientId ?? "all clients");
}
}
@@ -173,11 +176,13 @@ namespace PepperDash.Essentials.AppServer.Messengers
deviceState.MessageBasePath = MessagePath;
PostStatusMessage(JToken.FromObject(deviceState), type, clientId);
var token = JToken.FromObject(deviceState);
PostStatusMessage(token, type, clientId);
}
catch (Exception ex)
{
Debug.LogMessage(ex, "Exception posting status message", this);
this.LogError(ex, "Exception posting status message for {type} to {clientId}", type, clientId ?? "all clients");
}
}

View File

@@ -12,7 +12,6 @@ using PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using static PepperDash.Essentials.AppServer.Messengers.VideoCodecBaseStateMessage.CameraStatus;
namespace PepperDash.Essentials.AppServer.Messengers
{
@@ -78,16 +77,23 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// <param name="e"></param>
private void CallHistory_RecentCallsListHasChanged(object sender, EventArgs e)
{
var state = new VideoCodecBaseStateMessage();
if (!(sender is CodecCallHistory codecCallHistory)) return;
var recents = codecCallHistory.RecentCalls;
if (recents != null)
try
{
state.RecentCalls = recents;
var state = new VideoCodecBaseStateMessage();
PostStatusMessage(state);
if (!(sender is CodecCallHistory codecCallHistory)) return;
var recents = codecCallHistory.RecentCalls;
if (recents != null)
{
state.RecentCalls = recents;
PostStatusMessage(state);
}
}
catch (Exception ex)
{
this.LogError(ex, "Error posting call history");
}
}
@@ -107,28 +113,24 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
protected void SendDirectory(CodecDirectory directory)
{
var state = new VideoCodecBaseStateMessage();
if (Codec is IHasDirectory dirCodec)
try
{
this.LogVerbose("Sending Directory. Directory Item Count: {directoryItemCount}", directory.CurrentDirectoryResults.Count);
var state = new VideoCodecBaseStateMessage();
//state.CurrentDirectory = PrefixDirectoryFolderItems(directory);
state.CurrentDirectory = directory;
CrestronInvoke.BeginInvoke((o) => PostStatusMessage(state));
/* var directoryMessage = new
{
currentDirectory = new
{
directoryResults = prefixedDirectoryResults,
isRootDirectory = isRoot
}
};
if (Codec is IHasDirectory dirCodec)
{
this.LogVerbose("Sending Directory. Directory Item Count: {directoryItemCount}", directory.CurrentDirectoryResults.Count);
//Spool up a thread in case this is a large quantity of data
CrestronInvoke.BeginInvoke((o) => PostStatusMessage(directoryMessage)); */
//state.CurrentDirectory = PrefixDirectoryFolderItems(directory);
state.CurrentDirectory = directory;
CrestronInvoke.BeginInvoke((o) => PostStatusMessage(state));
}
}
catch (Exception ex)
{
this.LogError(ex, "Error sending directory");
}
}
@@ -139,14 +141,20 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// <param name="e"></param>
private void Codec_IsReadyChange(object sender, EventArgs e)
{
var state = new VideoCodecBaseStateMessage
try
{
IsReady = true
};
var state = new VideoCodecBaseStateMessage
{
IsReady = true
};
PostStatusMessage(state);
PostStatusMessage(state);
SendFullStatus();
SendFullStatus();
} catch (Exception ex)
{
this.LogError(ex, "Error sending codec ready status");
}
}
/// <summary>
@@ -353,32 +361,51 @@ namespace PepperDash.Essentials.AppServer.Messengers
private void SharingSourceFeedback_OutputChange(object sender, FeedbackEventArgs e)
{
var state = new VideoCodecBaseStateMessage
try
{
SharingSource = e.StringValue
};
var state = new VideoCodecBaseStateMessage
{
SharingSource = e.StringValue
};
PostStatusMessage(state);
PostStatusMessage(state);
} catch (Exception ex)
{
this.LogError(ex, "Error posting sharing source");
}
}
private void SharingContentIsOnFeedback_OutputChange(object sender, FeedbackEventArgs e)
{
var state = new VideoCodecBaseStateMessage
try
{
SharingContentIsOn = e.BoolValue
};
var state = new VideoCodecBaseStateMessage
{
SharingContentIsOn = e.BoolValue
};
PostStatusMessage(state);
PostStatusMessage(state);
} catch (Exception ex)
{
this.LogError(ex, "Error posting sharing content");
}
}
private void PhonebookSyncState_InitialSyncCompleted(object sender, EventArgs e)
{
var state = new VideoCodecBaseStateMessage
try
{
InitialPhonebookSyncComplete = true
};
var state = new VideoCodecBaseStateMessage
{
InitialPhonebookSyncComplete = true
};
PostStatusMessage(state);
PostStatusMessage(state);
}
catch (Exception ex)
{
this.LogError(ex, "Error posting phonebook sync state");
}
}
private void CameraIsOffFeedback_OutputChange(object sender, FeedbackEventArgs e)
@@ -404,8 +431,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
private void CameraCodec_CameraSelected(object sender, CameraSelectedEventArgs e)
{
MapCameraActions();
PostSelectedCamera();
try
{
MapCameraActions();
PostSelectedCamera();
} catch(Exception ex)
{
this.LogError(ex, "Exception handling camera selected event");
}
}
/// <summary>
@@ -564,21 +597,28 @@ namespace PepperDash.Essentials.AppServer.Messengers
private void PostCallHistory()
{
var codec = (Codec as IHasCallHistory);
if (codec != null)
try
{
var status = new VideoCodecBaseStateMessage();
var codec = (Codec as IHasCallHistory);
var recents = codec.CallHistory.RecentCalls;
if (recents != null)
if (codec != null)
{
status.RecentCalls = codec.CallHistory.RecentCalls;
var status = new VideoCodecBaseStateMessage();
PostStatusMessage(status);
var recents = codec.CallHistory.RecentCalls;
if (recents != null)
{
status.RecentCalls = codec.CallHistory.RecentCalls;
PostStatusMessage(status);
}
}
}
catch (Exception ex)
{
this.LogError(ex, "Error posting call history");
}
}
/// <summary>
@@ -609,23 +649,30 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
private void GetDirectoryRoot()
{
if (!(Codec is IHasDirectory dirCodec))
try
{
// do something else?
return;
}
if (!dirCodec.PhonebookSyncState.InitialSyncComplete)
{
var state = new VideoCodecBaseStateMessage
if (!(Codec is IHasDirectory dirCodec))
{
InitialPhonebookSyncComplete = false
};
// do something else?
return;
}
if (!dirCodec.PhonebookSyncState.InitialSyncComplete)
{
var state = new VideoCodecBaseStateMessage
{
InitialPhonebookSyncComplete = false
};
PostStatusMessage(state);
return;
PostStatusMessage(state);
return;
}
dirCodec.SetCurrentDirectoryToRoot();
}
catch (Exception ex)
{
this.LogError(ex, "Error getting directory root");
}
dirCodec.SetCurrentDirectoryToRoot();
}
/// <summary>
@@ -654,14 +701,21 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
private void SendIsReady()
{
var status = new VideoCodecBaseStateMessage();
try
{
var status = new VideoCodecBaseStateMessage();
var codecType = Codec.GetType();
var codecType = Codec.GetType();
status.IsReady = Codec.IsReady;
status.IsZoomRoom = codecType.GetInterface("IHasZoomRoomLayouts") != null;
status.IsReady = Codec.IsReady;
status.IsZoomRoom = codecType.GetInterface("IHasZoomRoomLayouts") != null;
PostStatusMessage(status);
PostStatusMessage(status);
}
catch (Exception ex)
{
this.LogError(ex, "Error sending codec ready status");
}
}
/// <summary>
@@ -670,55 +724,60 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// <returns></returns>
protected VideoCodecBaseStateMessage GetStatus()
{
var status = new VideoCodecBaseStateMessage();
if (Codec is IHasCodecCameras camerasCodec)
try
{
status.Cameras = new VideoCodecBaseStateMessage.CameraStatus
var status = new VideoCodecBaseStateMessage();
if (Codec is IHasCodecCameras camerasCodec)
{
CameraManualIsSupported = true,
CameraAutoIsSupported = Codec.SupportsCameraAutoMode,
CameraOffIsSupported = Codec.SupportsCameraOff,
CameraMode = GetCameraMode(),
Cameras = camerasCodec.Cameras,
SelectedCamera = GetSelectedCamera(camerasCodec)
};
}
status.Cameras = new CameraStatus
{
CameraManualIsSupported = true,
CameraAutoIsSupported = Codec.SupportsCameraAutoMode,
CameraOffIsSupported = Codec.SupportsCameraOff,
CameraMode = GetCameraMode(),
Cameras = camerasCodec.Cameras,
SelectedCamera = GetSelectedCamera(camerasCodec)
};
}
if (Codec is IHasDirectory directoryCodec)
if (Codec is IHasDirectory directoryCodec)
{
status.HasDirectory = true;
status.HasDirectorySearch = true;
status.CurrentDirectory = directoryCodec.CurrentDirectoryResult;
}
var codecType = Codec.GetType();
status.CameraSelfViewIsOn = Codec is IHasCodecSelfView && (Codec as IHasCodecSelfView).SelfviewIsOnFeedback.BoolValue;
status.IsInCall = Codec.IsInCall;
status.PrivacyModeIsOn = Codec.PrivacyModeIsOnFeedback.BoolValue;
status.SharingContentIsOn = Codec.SharingContentIsOnFeedback.BoolValue;
status.SharingSource = Codec.SharingSourceFeedback.StringValue;
status.StandbyIsOn = Codec.StandbyIsOnFeedback.BoolValue;
status.Calls = Codec.ActiveCalls;
status.Info = Codec.CodecInfo;
status.ShowSelfViewByDefault = Codec.ShowSelfViewByDefault;
status.SupportsAdHocMeeting = Codec is IHasStartMeeting;
status.HasRecents = Codec is IHasCallHistory;
status.HasCameras = Codec is IHasCameras;
status.Presets = GetCurrentPresets();
status.IsZoomRoom = codecType.GetInterface("IHasZoomRoomLayouts") != null;
status.ReceivingContent = Codec is IHasFarEndContentStatus && (Codec as IHasFarEndContentStatus).ReceivingContent.BoolValue;
if (Codec is IHasMeetingInfo meetingInfoCodec)
{
status.MeetingInfo = meetingInfoCodec.MeetingInfo;
}
return status;
}
catch (Exception ex)
{
status.HasDirectory = true;
status.HasDirectorySearch = true;
status.CurrentDirectory = directoryCodec.CurrentDirectoryResult;
this.LogError(ex, "Error getting codec status");
return null;
}
var codecType = Codec.GetType();
status.CameraSelfViewIsOn = Codec is IHasCodecSelfView && (Codec as IHasCodecSelfView).SelfviewIsOnFeedback.BoolValue;
status.IsInCall = Codec.IsInCall;
status.PrivacyModeIsOn = Codec.PrivacyModeIsOnFeedback.BoolValue;
status.SharingContentIsOn = Codec.SharingContentIsOnFeedback.BoolValue;
status.SharingSource = Codec.SharingSourceFeedback.StringValue;
status.StandbyIsOn = Codec.StandbyIsOnFeedback.BoolValue;
status.Calls = Codec.ActiveCalls;
status.Info = Codec.CodecInfo;
status.ShowSelfViewByDefault = Codec.ShowSelfViewByDefault;
status.SupportsAdHocMeeting = Codec is IHasStartMeeting;
status.HasRecents = Codec is IHasCallHistory;
status.HasCameras = Codec is IHasCameras;
status.Presets = GetCurrentPresets();
status.IsZoomRoom = codecType.GetInterface("IHasZoomRoomLayouts") != null;
status.ReceivingContent = Codec is IHasFarEndContentStatus && (Codec as IHasFarEndContentStatus).ReceivingContent.BoolValue;
if (Codec is IHasMeetingInfo meetingInfoCodec)
{
status.MeetingInfo = meetingInfoCodec.MeetingInfo;
}
//Debug.Console(2, this, "VideoCodecBaseStatus:\n{0}", JsonConvert.SerializeObject(status));
return status;
}
protected virtual void SendFullStatus()
@@ -733,22 +792,36 @@ namespace PepperDash.Essentials.AppServer.Messengers
private void PostReceivingContent(bool receivingContent)
{
var state = new VideoCodecBaseStateMessage
try
{
ReceivingContent = receivingContent
};
PostStatusMessage(state);
var state = new VideoCodecBaseStateMessage
{
ReceivingContent = receivingContent
};
PostStatusMessage(state);
} catch(Exception ex)
{
this.LogError(ex, "Error posting receiving content");
}
}
private void PostCameraSelfView()
{
var status = new VideoCodecBaseStateMessage
try
{
CameraSelfViewIsOn = Codec is IHasCodecSelfView
&& (Codec as IHasCodecSelfView).SelfviewIsOnFeedback.BoolValue
};
var status = new VideoCodecBaseStateMessage
{
CameraSelfViewIsOn = Codec is IHasCodecSelfView
&& (Codec as IHasCodecSelfView).SelfviewIsOnFeedback.BoolValue
};
PostStatusMessage(status);
PostStatusMessage(status);
}
catch (Exception ex)
{
this.LogError(ex, "Error posting camera self view");
}
}
/// <summary>
@@ -756,34 +829,56 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
private void PostCameraMode()
{
var status = new VideoCodecBaseStateMessage
try
{
CameraMode = GetCameraMode()
};
var status = new VideoCodecBaseStateMessage
{
CameraMode = GetCameraMode()
};
PostStatusMessage(status);
PostStatusMessage(status);
}
catch (Exception ex)
{
this.LogError(ex, "Error posting camera mode");
}
}
private void PostSelectedCamera()
{
var camerasCodec = Codec as IHasCodecCameras;
var status = new VideoCodecBaseStateMessage
try
{
Cameras = new VideoCodecBaseStateMessage.CameraStatus() { SelectedCamera = GetSelectedCamera(camerasCodec) },
Presets = GetCurrentPresets()
};
PostStatusMessage(status);
var camerasCodec = Codec as IHasCodecCameras;
var status = new VideoCodecBaseStateMessage
{
Cameras = new CameraStatus() { SelectedCamera = GetSelectedCamera(camerasCodec) },
Presets = GetCurrentPresets()
};
PostStatusMessage(status);
}
catch (Exception e)
{
this.LogError(e, "Error posting selected camera");
}
}
private void PostCameraPresets()
{
var status = new VideoCodecBaseStateMessage
try
{
Presets = GetCurrentPresets()
};
var status = new VideoCodecBaseStateMessage
{
Presets = GetCurrentPresets()
};
PostStatusMessage(status);
PostStatusMessage(status);
}
catch (Exception e)
{
this.LogError(e, "Error posting camera presets");
}
}
private Camera GetSelectedCamera(IHasCodecCameras camerasCodec)
@@ -796,7 +891,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
{
camera.Name = camerasCodec.SelectedCamera.Name;
camera.Capabilities = new Camera.CameraCapabilities()
camera.Capabilities = new CameraCapabilities()
{
CanPan = camerasCodec.SelectedCamera.CanPan,
CanTilt = camerasCodec.SelectedCamera.CanTilt,
@@ -922,59 +1017,57 @@ namespace PepperDash.Essentials.AppServer.Messengers
[JsonProperty("supportsAdHocMeeting", NullValueHandling = NullValueHandling.Ignore)]
public bool? SupportsAdHocMeeting { get; set; }
}
public class CameraStatus
{
[JsonProperty("cameraManualSupported", NullValueHandling = NullValueHandling.Ignore)]
public bool? CameraManualIsSupported { get; set; }
public class CameraStatus
{
[JsonProperty("cameraManualSupported", NullValueHandling = NullValueHandling.Ignore)]
public bool? CameraManualIsSupported { get; set; }
[JsonProperty("cameraAutoSupported", NullValueHandling = NullValueHandling.Ignore)]
public bool? CameraAutoIsSupported { get; set; }
[JsonProperty("cameraAutoSupported", NullValueHandling = NullValueHandling.Ignore)]
public bool? CameraAutoIsSupported { get; set; }
[JsonProperty("cameraOffSupported", NullValueHandling = NullValueHandling.Ignore)]
public bool? CameraOffIsSupported { get; set; }
[JsonProperty("cameraOffSupported", NullValueHandling = NullValueHandling.Ignore)]
public bool? CameraOffIsSupported { get; set; }
[JsonProperty("cameraMode", NullValueHandling = NullValueHandling.Ignore)]
public string CameraMode { get; set; }
[JsonProperty("cameraMode", NullValueHandling = NullValueHandling.Ignore)]
public string CameraMode { get; set; }
[JsonProperty("cameraList", NullValueHandling = NullValueHandling.Ignore)]
public List<CameraBase> Cameras { get; set; }
[JsonProperty("cameraList", NullValueHandling = NullValueHandling.Ignore)]
public List<CameraBase> Cameras { get; set; }
[JsonProperty("selectedCamera", NullValueHandling = NullValueHandling.Ignore)]
public Camera SelectedCamera { get; set; }
[JsonProperty("selectedCamera", NullValueHandling = NullValueHandling.Ignore)]
public Camera SelectedCamera { get; set; }
}
public class Camera
{
[JsonProperty("key", NullValueHandling = NullValueHandling.Ignore)]
public string Key { get; set; }
public class Camera
{
[JsonProperty("key", NullValueHandling = NullValueHandling.Ignore)]
public string Key { get; set; }
[JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)]
public string Name { get; set; }
[JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)]
public string Name { get; set; }
[JsonProperty("isFarEnd", NullValueHandling = NullValueHandling.Ignore)]
public bool? IsFarEnd { get; set; }
[JsonProperty("isFarEnd", NullValueHandling = NullValueHandling.Ignore)]
public bool? IsFarEnd { get; set; }
[JsonProperty("capabilities", NullValueHandling = NullValueHandling.Ignore)]
public CameraCapabilities Capabilities { get; set; }
[JsonProperty("capabilities", NullValueHandling = NullValueHandling.Ignore)]
public CameraCapabilities Capabilities { get; set; }
}
public class CameraCapabilities
{
[JsonProperty("canPan", NullValueHandling = NullValueHandling.Ignore)]
public bool? CanPan { get; set; }
public class CameraCapabilities
{
[JsonProperty("canPan", NullValueHandling = NullValueHandling.Ignore)]
public bool? CanPan { get; set; }
[JsonProperty("canTilt", NullValueHandling = NullValueHandling.Ignore)]
public bool? CanTilt { get; set; }
[JsonProperty("canTilt", NullValueHandling = NullValueHandling.Ignore)]
public bool? CanTilt { get; set; }
[JsonProperty("canZoom", NullValueHandling = NullValueHandling.Ignore)]
public bool? CanZoom { get; set; }
[JsonProperty("canZoom", NullValueHandling = NullValueHandling.Ignore)]
public bool? CanZoom { get; set; }
[JsonProperty("canFocus", NullValueHandling = NullValueHandling.Ignore)]
public bool? CanFocus { get; set; }
}
}
}
[JsonProperty("canFocus", NullValueHandling = NullValueHandling.Ignore)]
public bool? CanFocus { get; set; }
}

View File

@@ -1133,7 +1133,11 @@ namespace PepperDash.Essentials
_messengers.Add(messenger.Key, messenger);
messenger.RegisterWithAppServer(this);
if (_initialized)
{
this.LogDebug("Registering messenger {messengerKey} AFTER initialization", messenger.Key);
messenger.RegisterWithAppServer(this);
}
}
private void AddDefaultDeviceMessenger(IMobileControlMessenger messenger)
@@ -2230,16 +2234,14 @@ Mobile Control Direct Server Infromation:
// /room/roomAB
// Can't do direct comparison because it will match /room/roomA with /room/roomA/xxx instead of /room/roomAB/xxx
var handlersKv = _actionDictionary.FirstOrDefault(kv => message.Type.StartsWith(kv.Key + "/")); // adds trailing slash to ensure above case is handled
var handlers = _actionDictionary.Where(kv => message.Type.StartsWith(kv.Key + "/")).SelectMany(kv => kv.Value).ToList(); // adds trailing slash to ensure above case is handled
if (handlersKv.Key == null)
if (handlers.Count == 0)
{
this.LogInformation("-- Warning: Incoming message has no registered handler {type}", message.Type);
break;
}
var handlers = handlersKv.Value;
}
foreach (var handler in handlers)
{

View File

@@ -116,64 +116,6 @@ namespace PepperDash.Essentials.RoomBridges
if (Room is IRunDefaultPresentRoute defaultRoom)
AddAction("/defaultsource", (id, content) => defaultRoom.RunDefaultPresentRoute());
if (Room is IHasCurrentVolumeControls volumeRoom)
{
volumeRoom.CurrentVolumeDeviceChange += Room_CurrentVolumeDeviceChange;
if (volumeRoom.CurrentVolumeControls == null) return;
AddAction("/volumes/master/level", (id, content) =>
{
var msg = content.ToObject<MobileControlSimpleContent<ushort>>();
if (volumeRoom.CurrentVolumeControls is IBasicVolumeWithFeedback basicVolumeWithFeedback)
basicVolumeWithFeedback.SetVolume(msg.Value);
});
AddAction("/volumes/master/muteToggle", (id, content) => volumeRoom.CurrentVolumeControls.MuteToggle());
AddAction("/volumes/master/muteOn", (id, content) =>
{
if (volumeRoom.CurrentVolumeControls is IBasicVolumeWithFeedback basicVolumeWithFeedback)
basicVolumeWithFeedback.MuteOn();
});
AddAction("/volumes/master/muteOff", (id, content) =>
{
if (volumeRoom.CurrentVolumeControls is IBasicVolumeWithFeedback basicVolumeWithFeedback)
basicVolumeWithFeedback.MuteOff();
});
AddAction("/volumes/master/volumeUp", (id, content) => PressAndHoldHandler.HandlePressAndHold(DeviceKey, content, (b) =>
{
if (volumeRoom.CurrentVolumeControls is IBasicVolumeWithFeedback basicVolumeWithFeedback)
{
basicVolumeWithFeedback.VolumeUp(b);
}
}
));
AddAction("/volumes/master/volumeDown", (id, content) => PressAndHoldHandler.HandlePressAndHold(DeviceKey, content, (b) =>
{
if (volumeRoom.CurrentVolumeControls is IBasicVolumeWithFeedback basicVolumeWithFeedback)
{
basicVolumeWithFeedback.VolumeDown(b);
}
}
));
// Registers for initial volume events, if possible
if (volumeRoom.CurrentVolumeControls is IBasicVolumeWithFeedback currentVolumeDevice)
{
this.LogVerbose("Registering for volume feedback events");
currentVolumeDevice.MuteFeedback.OutputChange += MuteFeedback_OutputChange;
currentVolumeDevice.VolumeLevelFeedback.OutputChange += VolumeLevelFeedback_OutputChange;
}
}
if (Room is IHasCurrentSourceInfoChange sscRoom)
sscRoom.CurrentSourceChange += Room_CurrentSingleSourceChange;
@@ -212,6 +154,63 @@ namespace PepperDash.Essentials.RoomBridges
Room.IsWarmingUpFeedback.OutputChange += IsWarmingUpFeedback_OutputChange;
AddTechRoomActions();
if (Room is IHasCurrentVolumeControls volumeRoom)
{
volumeRoom.CurrentVolumeDeviceChange += Room_CurrentVolumeDeviceChange;
if (volumeRoom.CurrentVolumeControls == null) return;
AddAction("/volumes/master/level", (id, content) =>
{
var msg = content.ToObject<MobileControlSimpleContent<ushort>>();
if (volumeRoom.CurrentVolumeControls is IBasicVolumeWithFeedback basicVolumeWithFeedback)
basicVolumeWithFeedback.SetVolume(msg.Value);
});
AddAction("/volumes/master/muteToggle", (id, content) => volumeRoom.CurrentVolumeControls.MuteToggle());
AddAction("/volumes/master/muteOn", (id, content) =>
{
if (volumeRoom.CurrentVolumeControls is IBasicVolumeWithFeedback basicVolumeWithFeedback)
basicVolumeWithFeedback.MuteOn();
});
AddAction("/volumes/master/muteOff", (id, content) =>
{
if (volumeRoom.CurrentVolumeControls is IBasicVolumeWithFeedback basicVolumeWithFeedback)
basicVolumeWithFeedback.MuteOff();
});
AddAction("/volumes/master/volumeUp", (id, content) => PressAndHoldHandler.HandlePressAndHold(DeviceKey, content, (b) =>
{
if (volumeRoom.CurrentVolumeControls is IBasicVolumeWithFeedback basicVolumeWithFeedback)
{
basicVolumeWithFeedback.VolumeUp(b);
}
}
));
AddAction("/volumes/master/volumeDown", (id, content) => PressAndHoldHandler.HandlePressAndHold(DeviceKey, content, (b) =>
{
if (volumeRoom.CurrentVolumeControls is IBasicVolumeWithFeedback basicVolumeWithFeedback)
{
basicVolumeWithFeedback.VolumeDown(b);
}
}
));
// Registers for initial volume events, if possible
if (volumeRoom.CurrentVolumeControls is IBasicVolumeWithFeedback currentVolumeDevice)
{
this.LogVerbose("Registering for volume feedback events");
currentVolumeDevice.MuteFeedback.OutputChange += MuteFeedback_OutputChange;
currentVolumeDevice.VolumeLevelFeedback.OutputChange += VolumeLevelFeedback_OutputChange;
}
}
}
private void OnTouchPanelsUpdated(JToken content)

View File

@@ -483,11 +483,13 @@ namespace PepperDash.Essentials
{
var room = Core.DeviceFactory.GetDevice(roomConfig);
DeviceManager.AddDevice(room);
if (room is ICustomMobileControl)
if(room == null)
{
Debug.LogWarning("ERROR: Cannot load unknown room type '{roomType:l}', key '{roomKey:l}'.", roomConfig.Type, roomConfig.Key);
continue;
}
DeviceManager.AddDevice(room);
} catch (Exception ex)
{
Debug.LogMessage(ex, "Exception loading room {roomKey}:{roomType}", null, roomConfig.Key, roomConfig.Type);