mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-12 19:24:53 +00:00
Compare commits
38 Commits
v2.1.0-fea
...
v2.3.1-fix
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3770c2a47d | ||
|
|
5f4a1f768e | ||
|
|
2c0739df4b | ||
|
|
b77fc3647a | ||
|
|
1fe8993db3 | ||
|
|
f735f7377d | ||
|
|
4e43565c1a | ||
|
|
97e157b5b6 | ||
|
|
157ef3397f | ||
|
|
16c39b5201 | ||
|
|
8f278f4ec2 | ||
|
|
3411fe0cf3 | ||
|
|
6713ea53f2 | ||
|
|
a81f92481c | ||
|
|
607f6084de | ||
|
|
1625cbe6de | ||
|
|
63e6829a03 | ||
|
|
d3719ee505 | ||
|
|
041059210c | ||
|
|
1a45ef5d0f | ||
|
|
65a0743dac | ||
|
|
32e090648c | ||
|
|
bb045ba06b | ||
|
|
474b2eb647 | ||
|
|
e6cf2794bc | ||
|
|
09dd8f0bcd | ||
|
|
99c6163c0e | ||
|
|
90aa4a5d62 | ||
|
|
8b3eda1d18 | ||
|
|
2c28b57806 | ||
|
|
8762f84548 | ||
|
|
b0a68f38f5 | ||
|
|
46887579e4 | ||
|
|
b095d926d2 | ||
|
|
7cebf861cc | ||
|
|
2e0b003118 | ||
|
|
bada7e3a25 | ||
|
|
67a7422cd0 |
@@ -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)
|
||||
@@ -104,7 +104,7 @@ namespace PepperDash.Essentials.Core
|
||||
Hardware.OnlineStatusChange += Hardware_OnlineStatusChange;
|
||||
CommunicationMonitor.Start();
|
||||
|
||||
return true;
|
||||
return base.CustomActivate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,27 +1,7 @@
|
||||
using PepperDash.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Describes a device that has selectable inputs
|
||||
/// </summary>
|
||||
/// <typeparam name="TKey">the type to use as the key for each input item. Most likely an enum or string</typeparam>\
|
||||
/// <example>
|
||||
/// See MockDisplay for example implemntation
|
||||
/// </example>
|
||||
[Obsolete("Use IHasInputs<T> instead. Will be removed for 2.0 release")]
|
||||
public interface IHasInputs<T, TSelector>: IKeyName
|
||||
{
|
||||
ISelectableItems<T> Inputs { get; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Describes a device that has selectable inputs
|
||||
/// </summary>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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; }
|
||||
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,7 @@ namespace PepperDash.Essentials.Devices.Common.Cameras
|
||||
|
||||
#region IRoutingOutputs Members
|
||||
|
||||
[JsonIgnore]
|
||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -8,9 +8,9 @@ namespace PepperDash.Essentials.Room.MobileControl
|
||||
{
|
||||
private readonly IChannel channelDevice;
|
||||
|
||||
public IChannelMessenger(string key, string messagePath, Device device) : base(key, messagePath, device)
|
||||
public IChannelMessenger(string key, string messagePath, IChannel device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
channelDevice = device as IChannel;
|
||||
channelDevice = device;
|
||||
}
|
||||
|
||||
protected override void RegisterActions()
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace PepperDash.Essentials.Room.MobileControl
|
||||
public class IColorMessenger : MessengerBase
|
||||
{
|
||||
private readonly IColor colorDevice;
|
||||
public IColorMessenger(string key, string messagePath, Device device) : base(key, messagePath, device)
|
||||
public IColorMessenger(string key, string messagePath, IColor device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
colorDevice = device as IColor;
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@ namespace PepperDash.Essentials.Room.MobileControl
|
||||
public class IDPadMessenger : MessengerBase
|
||||
{
|
||||
private readonly IDPad dpadDevice;
|
||||
public IDPadMessenger(string key, string messagePath, Device device) : base(key, messagePath, device)
|
||||
public IDPadMessenger(string key, string messagePath, IDPad device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
dpadDevice = device as IDPad;
|
||||
dpadDevice = device;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@ namespace PepperDash.Essentials.Room.MobileControl
|
||||
public class IDvrMessenger : MessengerBase
|
||||
{
|
||||
private readonly IDvr dvrDevice;
|
||||
public IDvrMessenger(string key, string messagePath, Device device) : base(key, messagePath, device)
|
||||
public IDvrMessenger(string key, string messagePath, IDvr device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
dvrDevice = device as IDvr;
|
||||
dvrDevice = device;
|
||||
}
|
||||
|
||||
protected override void RegisterActions()
|
||||
|
||||
@@ -7,9 +7,9 @@ namespace PepperDash.Essentials.Room.MobileControl
|
||||
public class IHasPowerMessenger : MessengerBase
|
||||
{
|
||||
private readonly IHasPowerControl powerDevice;
|
||||
public IHasPowerMessenger(string key, string messagePath, Device device) : base(key, messagePath, device)
|
||||
public IHasPowerMessenger(string key, string messagePath, IHasPowerControl device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
powerDevice = device as IHasPowerControl;
|
||||
powerDevice = device;
|
||||
}
|
||||
|
||||
protected override void RegisterActions()
|
||||
|
||||
@@ -7,9 +7,9 @@ namespace PepperDash.Essentials.Room.MobileControl
|
||||
public class INumericKeypadMessenger : MessengerBase
|
||||
{
|
||||
private readonly INumericKeypad keypadDevice;
|
||||
public INumericKeypadMessenger(string key, string messagePath, Device device) : base(key, messagePath, device)
|
||||
public INumericKeypadMessenger(string key, string messagePath, INumericKeypad device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
keypadDevice = device as INumericKeypad;
|
||||
keypadDevice = device;
|
||||
}
|
||||
|
||||
protected override void RegisterActions()
|
||||
|
||||
@@ -7,9 +7,9 @@ namespace PepperDash.Essentials.Room.MobileControl
|
||||
public class ISetTopBoxControlsMessenger : MessengerBase
|
||||
{
|
||||
private readonly ISetTopBoxControls stbDevice;
|
||||
public ISetTopBoxControlsMessenger(string key, string messagePath, IKeyName device) : base(key, messagePath, device)
|
||||
public ISetTopBoxControlsMessenger(string key, string messagePath, ISetTopBoxControls device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
stbDevice = device as ISetTopBoxControls;
|
||||
stbDevice = device;
|
||||
}
|
||||
|
||||
protected override void RegisterActions()
|
||||
|
||||
@@ -7,9 +7,9 @@ namespace PepperDash.Essentials.Room.MobileControl
|
||||
public class ITransportMessenger : MessengerBase
|
||||
{
|
||||
private readonly ITransport transportDevice;
|
||||
public ITransportMessenger(string key, string messagePath, Device device) : base(key, messagePath, device)
|
||||
public ITransportMessenger(string key, string messagePath, ITransport device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
transportDevice = device as ITransport;
|
||||
transportDevice = device;
|
||||
}
|
||||
|
||||
protected override void RegisterActions()
|
||||
|
||||
@@ -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>>();
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
private readonly IEssentialsRoomCombiner _roomCombiner;
|
||||
|
||||
public IEssentialsRoomCombinerMessenger(string key, string messagePath, IEssentialsRoomCombiner roomCombiner)
|
||||
: base(key, messagePath, roomCombiner as Device)
|
||||
: base(key, messagePath, roomCombiner as IKeyName)
|
||||
{
|
||||
_roomCombiner = roomCombiner;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
private readonly IHasPowerControlWithFeedback _powerControl;
|
||||
|
||||
public IHasPowerControlWithFeedbackMessenger(string key, string messagePath, IHasPowerControlWithFeedback powerControl)
|
||||
: base(key, messagePath, powerControl as Device)
|
||||
: base(key, messagePath, powerControl as IKeyName)
|
||||
{
|
||||
_powerControl = powerControl;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
public IHasScheduleAwareness ScheduleSource { get; private set; }
|
||||
|
||||
public IHasScheduleAwarenessMessenger(string key, IHasScheduleAwareness scheduleSource, string messagePath)
|
||||
: base(key, messagePath, scheduleSource as Device)
|
||||
: base(key, messagePath, scheduleSource as IKeyName)
|
||||
{
|
||||
ScheduleSource = scheduleSource ?? throw new ArgumentNullException("scheduleSource");
|
||||
ScheduleSource.CodecSchedule.MeetingsListHasChanged += new EventHandler<EventArgs>(CodecSchedule_MeetingsListHasChanged);
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
private readonly IHumiditySensor device;
|
||||
|
||||
public IHumiditySensorMessenger(string key, IHumiditySensor device, string messagePath)
|
||||
: base(key, messagePath, device as Device)
|
||||
: base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
this.device = device;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
public class ILevelControlsMessenger : MessengerBase
|
||||
{
|
||||
private ILevelControls levelControlsDevice;
|
||||
public ILevelControlsMessenger(string key, string messagePath, ILevelControls device) : base(key, messagePath, device as Device)
|
||||
public ILevelControlsMessenger(string key, string messagePath, ILevelControls device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
levelControlsDevice = device;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
public class IMatrixRoutingMessenger : MessengerBase
|
||||
{
|
||||
private readonly IMatrixRouting matrixDevice;
|
||||
public IMatrixRoutingMessenger(string key, string messagePath, IMatrixRouting device) : base(key, messagePath, device as Device)
|
||||
public IMatrixRoutingMessenger(string key, string messagePath, IMatrixRouting device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
matrixDevice = device;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
private readonly IProjectorScreenLiftControl device;
|
||||
|
||||
public IProjectorScreenLiftControlMessenger(string key, string messagePath, IProjectorScreenLiftControl screenLiftDevice)
|
||||
: base(key, messagePath, screenLiftDevice as Device)
|
||||
: base(key, messagePath, screenLiftDevice as IKeyName)
|
||||
{
|
||||
device = screenLiftDevice;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
public IRunRouteAction RoutingDevice { get; private set; }
|
||||
|
||||
public RunRouteActionMessenger(string key, IRunRouteAction routingDevice, string messagePath)
|
||||
: base(key, messagePath, routingDevice as Device)
|
||||
: base(key, messagePath, routingDevice as IKeyName)
|
||||
{
|
||||
RoutingDevice = routingDevice ?? throw new ArgumentNullException("routingDevice");
|
||||
|
||||
|
||||
@@ -2,17 +2,20 @@
|
||||
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
|
||||
{
|
||||
public class ISelectableItemsMessenger<TKey> : MessengerBase
|
||||
{
|
||||
private static readonly JsonSerializer serializer = new JsonSerializer { Converters = { new StringEnumConverter() } };
|
||||
private ISelectableItems<TKey> itemDevice;
|
||||
private readonly ISelectableItems<TKey> itemDevice;
|
||||
|
||||
private readonly string _propName;
|
||||
public ISelectableItemsMessenger(string key, string messagePath, ISelectableItems<TKey> device, string propName) : base(key, messagePath, device as Device)
|
||||
public ISelectableItemsMessenger(string key, string messagePath, ISelectableItems<TKey> device, string propName) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
itemDevice = device;
|
||||
_propName = propName;
|
||||
@@ -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; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
private readonly IShutdownPromptTimer _room;
|
||||
|
||||
public IShutdownPromptTimerMessenger(string key, string messagePath, IShutdownPromptTimer room)
|
||||
: base(key, messagePath, room as Device)
|
||||
: base(key, messagePath, room as IKeyName)
|
||||
{
|
||||
_room = room;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
private readonly ISwitchedOutput device;
|
||||
|
||||
public ISwitchedOutputMessenger(string key, ISwitchedOutput device, string messagePath)
|
||||
: base(key, messagePath, device as Device)
|
||||
: base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
this.device = device;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
private readonly ITechPassword _room;
|
||||
|
||||
public ITechPasswordMessenger(string key, string messagePath, ITechPassword room)
|
||||
: base(key, messagePath, room as Device)
|
||||
: base(key, messagePath, room as IKeyName)
|
||||
{
|
||||
_room = room;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
private readonly ITemperatureSensor device;
|
||||
|
||||
public ITemperatureSensorMessenger(string key, ITemperatureSensor device, string messagePath)
|
||||
: base(key, messagePath, device as Device)
|
||||
: base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
this.device = device;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
protected ILightingScenes Device { get; private set; }
|
||||
|
||||
public ILightingScenesMessenger(string key, ILightingScenes device, string messagePath)
|
||||
: base(key, messagePath, device as Device)
|
||||
: base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
Device = device ?? throw new ArgumentNullException("device");
|
||||
Device.LightingSceneChange += new EventHandler<LightingSceneChangeEventArgs>(LightingDevice_LightingSceneChange);
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
|
||||
|
||||
public RoomEventScheduleMessenger(string key, string messagePath, IRoomEventSchedule room)
|
||||
: base(key, messagePath, room as Device)
|
||||
: base(key, messagePath, room as IKeyName)
|
||||
{
|
||||
_room = room;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
private readonly IShadesOpenCloseStop device;
|
||||
|
||||
public IShadesOpenCloseStopMessenger(string key, IShadesOpenCloseStop shades, string messagePath)
|
||||
: base(key, messagePath, shades as Device)
|
||||
: base(key, messagePath, shades as IKeyName)
|
||||
{
|
||||
device = shades;
|
||||
}
|
||||
|
||||
@@ -9,12 +9,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
private readonly TwoWayDisplayBase _display;
|
||||
|
||||
public TwoWayDisplayBaseMessenger(string key, string messagePath) : base(key, messagePath)
|
||||
{
|
||||
}
|
||||
|
||||
public TwoWayDisplayBaseMessenger(string key, string messagePath, TwoWayDisplayBase display)
|
||||
: this(key, messagePath)
|
||||
: base(key, messagePath, display)
|
||||
{
|
||||
_display = display;
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -566,18 +566,16 @@ namespace PepperDash.Essentials
|
||||
messengerAdded = true;
|
||||
}
|
||||
|
||||
if (device is ISetTopBoxControls)
|
||||
if (device is ISetTopBoxControls stbDevice)
|
||||
{
|
||||
this.LogVerbose(
|
||||
"Adding ISetTopBoxControlMessenger for {deviceKey}"
|
||||
);
|
||||
|
||||
var dev = device as Device;
|
||||
);
|
||||
|
||||
var messenger = new ISetTopBoxControlsMessenger(
|
||||
$"{device.Key}-stb-{Key}",
|
||||
$"/device/{device.Key}",
|
||||
dev
|
||||
stbDevice
|
||||
);
|
||||
|
||||
AddDefaultDeviceMessenger(messenger);
|
||||
@@ -585,18 +583,16 @@ namespace PepperDash.Essentials
|
||||
messengerAdded = true;
|
||||
}
|
||||
|
||||
if (device is IChannel)
|
||||
if (device is IChannel channelDevice)
|
||||
{
|
||||
this.LogVerbose(
|
||||
"Adding IChannelMessenger for {deviceKey}", device.Key
|
||||
);
|
||||
|
||||
var dev = device as PepperDash.Core.Device;
|
||||
);
|
||||
|
||||
var messenger = new IChannelMessenger(
|
||||
$"{device.Key}-channel-{Key}",
|
||||
$"/device/{device.Key}",
|
||||
dev
|
||||
channelDevice
|
||||
);
|
||||
|
||||
AddDefaultDeviceMessenger(messenger);
|
||||
@@ -604,16 +600,14 @@ namespace PepperDash.Essentials
|
||||
messengerAdded = true;
|
||||
}
|
||||
|
||||
if (device is IColor)
|
||||
if (device is IColor colorDevice)
|
||||
{
|
||||
this.LogVerbose("Adding IColorMessenger for {deviceKey}", device.Key);
|
||||
|
||||
var dev = device as PepperDash.Core.Device;
|
||||
this.LogVerbose("Adding IColorMessenger for {deviceKey}", device.Key);
|
||||
|
||||
var messenger = new IColorMessenger(
|
||||
$"{device.Key}-color-{Key}",
|
||||
$"/device/{device.Key}",
|
||||
dev
|
||||
colorDevice
|
||||
);
|
||||
|
||||
AddDefaultDeviceMessenger(messenger);
|
||||
@@ -621,16 +615,14 @@ namespace PepperDash.Essentials
|
||||
messengerAdded = true;
|
||||
}
|
||||
|
||||
if (device is IDPad)
|
||||
if (device is IDPad dPadDevice)
|
||||
{
|
||||
this.LogVerbose("Adding IDPadMessenger for {deviceKey}", device.Key);
|
||||
|
||||
var dev = device as PepperDash.Core.Device;
|
||||
this.LogVerbose("Adding IDPadMessenger for {deviceKey}", device.Key);
|
||||
|
||||
var messenger = new IDPadMessenger(
|
||||
$"{device.Key}-dPad-{Key}",
|
||||
$"/device/{device.Key}",
|
||||
dev
|
||||
dPadDevice
|
||||
);
|
||||
|
||||
AddDefaultDeviceMessenger(messenger);
|
||||
@@ -638,16 +630,14 @@ namespace PepperDash.Essentials
|
||||
messengerAdded = true;
|
||||
}
|
||||
|
||||
if (device is INumericKeypad)
|
||||
if (device is INumericKeypad nkDevice)
|
||||
{
|
||||
this.LogVerbose("Adding INumericKeyapdMessenger for {deviceKey}", device.Key);
|
||||
|
||||
var dev = device as PepperDash.Core.Device;
|
||||
this.LogVerbose("Adding INumericKeyapdMessenger for {deviceKey}", device.Key);
|
||||
|
||||
var messenger = new INumericKeypadMessenger(
|
||||
$"{device.Key}-numericKeypad-{Key}",
|
||||
$"/device/{device.Key}",
|
||||
dev
|
||||
nkDevice
|
||||
);
|
||||
|
||||
AddDefaultDeviceMessenger(messenger);
|
||||
@@ -655,16 +645,14 @@ namespace PepperDash.Essentials
|
||||
messengerAdded = true;
|
||||
}
|
||||
|
||||
if (device is IHasPowerControl)
|
||||
if (device is IHasPowerControl pcDevice)
|
||||
{
|
||||
this.LogVerbose("Adding IHasPowerControlMessenger for {deviceKey}", device.Key);
|
||||
|
||||
var dev = device as PepperDash.Core.Device;
|
||||
this.LogVerbose("Adding IHasPowerControlMessenger for {deviceKey}", device.Key);
|
||||
|
||||
var messenger = new IHasPowerMessenger(
|
||||
$"{device.Key}-powerControl-{Key}",
|
||||
$"/device/{device.Key}",
|
||||
dev
|
||||
pcDevice
|
||||
);
|
||||
|
||||
AddDefaultDeviceMessenger(messenger);
|
||||
@@ -689,18 +677,16 @@ namespace PepperDash.Essentials
|
||||
messengerAdded = true;
|
||||
}
|
||||
|
||||
if (device is ITransport)
|
||||
if (device is ITransport transportDevice)
|
||||
{
|
||||
this.LogVerbose(
|
||||
"Adding ITransportMessenger for {deviceKey}", device.Key
|
||||
);
|
||||
);
|
||||
|
||||
var dev = device as PepperDash.Core.Device;
|
||||
|
||||
var messenger = new IChannelMessenger(
|
||||
var messenger = new ITransportMessenger(
|
||||
$"{device.Key}-transport-{Key}",
|
||||
$"/device/{device.Key}",
|
||||
dev
|
||||
transportDevice
|
||||
);
|
||||
|
||||
AddDefaultDeviceMessenger(messenger);
|
||||
@@ -708,14 +694,14 @@ namespace PepperDash.Essentials
|
||||
messengerAdded = true;
|
||||
}
|
||||
|
||||
if (device is IHasCurrentSourceInfoChange)
|
||||
if (device is IHasCurrentSourceInfoChange csiChange)
|
||||
{
|
||||
this.LogVerbose("Adding IHasCurrentSourceInfoMessenger for {deviceKey}", device.Key);
|
||||
|
||||
var messenger = new IHasCurrentSourceInfoMessenger(
|
||||
$"{device.Key}-currentSource-{Key}",
|
||||
$"/device/{device.Key}",
|
||||
device as IHasCurrentSourceInfoChange
|
||||
csiChange
|
||||
);
|
||||
|
||||
AddDefaultDeviceMessenger(messenger);
|
||||
@@ -723,7 +709,7 @@ namespace PepperDash.Essentials
|
||||
messengerAdded = true;
|
||||
}
|
||||
|
||||
if (device is ISwitchedOutput)
|
||||
if (device is ISwitchedOutput switchedDevice)
|
||||
{
|
||||
this.LogVerbose(
|
||||
"Adding ISwitchedOutputMessenger for {deviceKey}", device.Key
|
||||
@@ -731,7 +717,7 @@ namespace PepperDash.Essentials
|
||||
|
||||
var messenger = new ISwitchedOutputMessenger(
|
||||
$"{device.Key}-switchedOutput-{Key}",
|
||||
device as ISwitchedOutput,
|
||||
switchedDevice,
|
||||
$"/device/{device.Key}"
|
||||
);
|
||||
|
||||
@@ -773,40 +759,6 @@ namespace PepperDash.Essentials
|
||||
messengerAdded = true;
|
||||
}
|
||||
|
||||
// This will work if TKey and TSelector are both string types.
|
||||
// Otherwise plugin device needs to instantiate ISelectableItemsMessenger and add it to the controller.
|
||||
//if (device is IHasInputs<string, string> inputs)
|
||||
//{
|
||||
// this.LogVerbose("Adding InputsMessenger<string,string> for {deviceKey}", device.Key);
|
||||
|
||||
// var messenger = new ISelectableItemsMessenger<string>(
|
||||
// $"{device.Key}-inputs-{Key}",
|
||||
// $"/device/{device.Key}",
|
||||
// inputs.Inputs,
|
||||
// "inputs"
|
||||
// );
|
||||
|
||||
// AddDefaultDeviceMessenger(messenger);
|
||||
|
||||
// messengerAdded = true;
|
||||
//}
|
||||
|
||||
//if (device is IHasInputs<byte, int> byteIntInputs)
|
||||
//{
|
||||
// this.LogVerbose("Adding InputsMessenger<byte, int> for {deviceKey}", device.Key);
|
||||
|
||||
// var messenger = new ISelectableItemsMessenger<byte>(
|
||||
// $"{device.Key}-inputs-{Key}",
|
||||
// $"/device/{device.Key}",
|
||||
// byteIntInputs.Inputs,
|
||||
// "inputs"
|
||||
// );
|
||||
|
||||
// AddDefaultDeviceMessenger(messenger);
|
||||
|
||||
// messengerAdded = true;
|
||||
//}
|
||||
|
||||
if (device is IHasInputs<string> stringInputs)
|
||||
{
|
||||
this.LogVerbose("Adding InputsMessenger<string> for {deviceKey}", device.Key);
|
||||
@@ -855,7 +807,6 @@ namespace PepperDash.Essentials
|
||||
messengerAdded = true;
|
||||
}
|
||||
|
||||
|
||||
if (device is IMatrixRouting matrix)
|
||||
{
|
||||
this.LogVerbose(
|
||||
@@ -1182,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)
|
||||
@@ -2279,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)
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -679,6 +679,14 @@ namespace PepperDash.Essentials.WebSocketServer
|
||||
}
|
||||
|
||||
var values = s.Split(' ');
|
||||
|
||||
if(values.Length < 2)
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse("Invalid number of arguments. Please provide a room key and a grant code");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var roomKey = values[0];
|
||||
var grantCode = values[1];
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user