mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 12:44:58 +00:00
Compare commits
23 Commits
v2.3.0-rou
...
v2.4.4-gen
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eeb106c489 | ||
|
|
c1d62ea5d4 | ||
|
|
9148cfd819 | ||
|
|
60550caf99 | ||
|
|
59baa74dd7 | ||
|
|
bf31bf9e93 | ||
|
|
ee8776cfb1 | ||
|
|
0b59990532 | ||
|
|
8d3fd343f1 | ||
|
|
372274d9fa | ||
|
|
403c03491c | ||
|
|
3770c2a47d | ||
|
|
5f4a1f768e | ||
|
|
7eed7866f1 | ||
|
|
c5403f33c5 | ||
|
|
2c0739df4b | ||
|
|
b77fc3647a | ||
|
|
1fe8993db3 | ||
|
|
f735f7377d | ||
|
|
157ef3397f | ||
|
|
16c39b5201 | ||
|
|
8f278f4ec2 | ||
|
|
a81f92481c |
@@ -1,6 +1,6 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Version>2.0.0-local</Version>
|
||||
<Version>2.4.0-local</Version>
|
||||
<InformationalVersion>$(Version)</InformationalVersion>
|
||||
<Authors>PepperDash Technology</Authors>
|
||||
<Company>PepperDash Technology</Company>
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace PepperDash.Essentials.Core
|
||||
Hardware.OnlineStatusChange += Hardware_OnlineStatusChange;
|
||||
CommunicationMonitor.Start();
|
||||
|
||||
return true;
|
||||
return base.CustomActivate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -11,5 +11,16 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
|
||||
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,16 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using System.ComponentModel;
|
||||
|
||||
using PepperDash.Core;
|
||||
using Serilog.Events;
|
||||
|
||||
using System.Threading;
|
||||
using PepperDash.Core.Logging;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
@@ -31,35 +22,34 @@ namespace PepperDash.Essentials.Core
|
||||
/// <summary>
|
||||
/// Return true if the Client is ISocketStatus
|
||||
/// </summary>
|
||||
public bool IsSocket
|
||||
{
|
||||
get
|
||||
{
|
||||
return Client is ISocketStatus;
|
||||
}
|
||||
}
|
||||
public bool IsSocket => Client is ISocketStatus;
|
||||
|
||||
long PollTime;
|
||||
CTimer PollTimer;
|
||||
string PollString;
|
||||
Action PollAction;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="pollTime">in MS, >= 5000</param>
|
||||
/// <param name="warningTime">in MS, >= 5000</param>
|
||||
/// <param name="errorTime">in MS, >= 5000</param>
|
||||
/// <param name="pollString">String to send to comm</param>
|
||||
public GenericCommunicationMonitor(IKeyed parent, IBasicCommunication client, long pollTime,
|
||||
private readonly string PollString;
|
||||
private readonly Action PollAction;
|
||||
private readonly long PollTime;
|
||||
|
||||
private Timer PollTimer;
|
||||
|
||||
private SemaphoreSlim semaphore = new SemaphoreSlim(1, 1);
|
||||
|
||||
/// <summary>
|
||||
/// GenericCommunicationMonitor constructor
|
||||
///
|
||||
/// Note: If the client is a socket, the connection status will be monitored and the PollTimer will be started automatically when the client is connected
|
||||
/// </summary>
|
||||
/// <param name="parent">Parent device</param>
|
||||
/// <param name="client">Communications Client</param>
|
||||
/// <param name="pollTime">Time in MS for polling</param>
|
||||
/// <param name="warningTime">Warning time in MS. If a message is not received before this elapsed time the status will be Warning</param>
|
||||
/// <param name="errorTime">Error time in MS. If a message is not received before this elapsed time the status will be Error</param>
|
||||
/// <param name="pollString">string to send for polling</param>
|
||||
/// <exception cref="ArgumentException">Poll time must be less than warning and error time</exception>
|
||||
public GenericCommunicationMonitor(IKeyed parent, IBasicCommunication client, long pollTime,
|
||||
long warningTime, long errorTime, string pollString) :
|
||||
base(parent, warningTime, errorTime)
|
||||
{
|
||||
if (pollTime > warningTime || pollTime > errorTime)
|
||||
throw new ArgumentException("pollTime must be less than warning or errorTime");
|
||||
//if (pollTime < 5000)
|
||||
// throw new ArgumentException("pollTime cannot be less than 5000 ms");
|
||||
|
||||
Client = client;
|
||||
PollTime = pollTime;
|
||||
@@ -67,26 +57,41 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
if (IsSocket)
|
||||
{
|
||||
(Client as ISocketStatus).ConnectionChange += new EventHandler<GenericSocketStatusChageEventArgs>(socket_ConnectionChange);
|
||||
(Client as ISocketStatus).ConnectionChange += Socket_ConnectionChange;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// GenericCommunicationMonitor constructor with a bool to specify whether to monitor BytesReceived
|
||||
///
|
||||
/// Note: If the client is a socket, the connection status will be monitored and the PollTimer will be started automatically when the client is connected
|
||||
/// </summary>
|
||||
/// <param name="parent">Parent device</param>
|
||||
/// <param name="client">Communications Client</param>
|
||||
/// <param name="pollTime">Time in MS for polling</param>
|
||||
/// <param name="warningTime">Warning time in MS. If a message is not received before this elapsed time the status will be Warning</param>
|
||||
/// <param name="errorTime">Error time in MS. If a message is not received before this elapsed time the status will be Error</param>
|
||||
/// <param name="pollString">string to send for polling</param>
|
||||
/// <param name="monitorBytesReceived">Use bytesReceived event instead of textReceived when true</param>
|
||||
public GenericCommunicationMonitor(IKeyed parent, IBasicCommunication client, long pollTime,
|
||||
long warningTime, long errorTime, string pollString, bool monitorBytesReceived) :
|
||||
this(parent, client, pollTime, warningTime, errorTime, pollString)
|
||||
{
|
||||
SetMonitorBytesReceived(monitorBytesReceived);
|
||||
MonitorBytesReceived = monitorBytesReceived;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Poll is a provided action instead of string
|
||||
/// GenericCommunicationMonitor constructor with a poll action instead of a poll string
|
||||
///
|
||||
/// Note: If the client is a socket, the connection status will be monitored and the PollTimer will be started automatically when the client is connected
|
||||
/// </summary>
|
||||
/// <param name="parent"></param>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="pollTime"></param>
|
||||
/// <param name="warningTime"></param>
|
||||
/// <param name="errorTime"></param>
|
||||
/// <param name="pollBytes"></param>
|
||||
/// <param name="parent">Parent device</param>
|
||||
/// <param name="client">Communications Client</param>
|
||||
/// <param name="pollTime">Time in MS for polling</param>
|
||||
/// <param name="warningTime">Warning time in MS. If a message is not received before this elapsed time the status will be Warning</param>
|
||||
/// <param name="errorTime">Error time in MS. If a message is not received before this elapsed time the status will be Error</param>
|
||||
/// <param name="pollAction">Action to execute for polling</param>
|
||||
/// <exception cref="ArgumentException">Poll time must be less than warning and error time</exception>
|
||||
public GenericCommunicationMonitor(IKeyed parent, IBasicCommunication client, long pollTime,
|
||||
long warningTime, long errorTime, Action pollAction) :
|
||||
base(parent, warningTime, errorTime)
|
||||
@@ -102,51 +107,67 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
if (IsSocket)
|
||||
{
|
||||
(Client as ISocketStatus).ConnectionChange += new EventHandler<GenericSocketStatusChageEventArgs>(socket_ConnectionChange);
|
||||
(Client as ISocketStatus).ConnectionChange += Socket_ConnectionChange;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// GenericCommunicationMonitor constructor with a poll action instead of a poll string and a bool to specify whether to monitor BytesReceived
|
||||
///
|
||||
/// Note: If the client is a socket, the connection status will be monitored and the PollTimer will be started automatically when the client is connected
|
||||
/// </summary>
|
||||
/// <param name="parent">Parent device</param>
|
||||
/// <param name="client">Communications Client</param>
|
||||
/// <param name="pollTime">Time in MS for polling</param>
|
||||
/// <param name="warningTime">Warning time in MS. If a message is not received before this elapsed time the status will be Warning</param>
|
||||
/// <param name="errorTime">Error time in MS. If a message is not received before this elapsed time the status will be Error</param>
|
||||
/// <param name="pollAction">Action to execute for polling</param>
|
||||
/// <param name="monitorBytesReceived">Use bytesReceived event instead of textReceived when true</param>
|
||||
public GenericCommunicationMonitor(IKeyed parent, IBasicCommunication client, long pollTime,
|
||||
long warningTime, long errorTime, Action pollAction, bool monitorBytesReceived) :
|
||||
this(parent, client, pollTime, warningTime, errorTime, pollAction)
|
||||
{
|
||||
SetMonitorBytesReceived(monitorBytesReceived);
|
||||
MonitorBytesReceived = monitorBytesReceived;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Build the monitor from a config object
|
||||
/// </summary>
|
||||
public GenericCommunicationMonitor(IKeyed parent, IBasicCommunication client,
|
||||
/// <summary>
|
||||
/// GenericCommunicationMonitor constructor with a config object
|
||||
///
|
||||
/// Note: If the client is a socket, the connection status will be monitored and the PollTimer will be started automatically when the client is connected
|
||||
/// </summary>
|
||||
/// <param name="parent">Parent Device</param>
|
||||
/// <param name="client">Communications Client</param>
|
||||
/// <param name="props"><see cref="CommunicationMonitorConfig">Communication Monitor Config</see> object</param>
|
||||
public GenericCommunicationMonitor(IKeyed parent, IBasicCommunication client,
|
||||
CommunicationMonitorConfig props) :
|
||||
this(parent, client, props.PollInterval, props.TimeToWarning, props.TimeToError, props.PollString)
|
||||
{
|
||||
if (IsSocket)
|
||||
{
|
||||
(Client as ISocketStatus).ConnectionChange += new EventHandler<GenericSocketStatusChageEventArgs>(socket_ConnectionChange);
|
||||
(Client as ISocketStatus).ConnectionChange += Socket_ConnectionChange;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Builds the monitor from a config object and takes a bool to specify whether to monitor BytesReceived
|
||||
/// Default is to monitor TextReceived
|
||||
/// GenericCommunicationMonitor constructor with a config object and a bool to specify whether to monitor BytesReceived
|
||||
///
|
||||
/// Note: If the client is a socket, the connection status will be monitored and the PollTimer will be started automatically when the client is connected
|
||||
/// </summary>
|
||||
/// <param name="parent"></param>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="props"></param>
|
||||
/// <param name="monitorBytesReceived"></param>
|
||||
/// <param name="parent">Parent Device</param>
|
||||
/// <param name="client">Communications Client</param>
|
||||
/// <param name="props"><see cref="CommunicationMonitorConfig">Communication Monitor Config</see> object</param>
|
||||
/// <param name="monitorBytesReceived">Use bytesReceived event instead of textReceived when true</param>
|
||||
public GenericCommunicationMonitor(IKeyed parent, IBasicCommunication client, CommunicationMonitorConfig props, bool monitorBytesReceived) :
|
||||
this(parent, client, props.PollInterval, props.TimeToWarning, props.TimeToError, props.PollString)
|
||||
{
|
||||
SetMonitorBytesReceived(monitorBytesReceived);
|
||||
}
|
||||
|
||||
void SetMonitorBytesReceived(bool monitorBytesReceived)
|
||||
{
|
||||
MonitorBytesReceived = monitorBytesReceived;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start the poll cycle
|
||||
/// </summary>
|
||||
public override void Start()
|
||||
{
|
||||
if (MonitorBytesReceived)
|
||||
@@ -163,7 +184,7 @@ namespace PepperDash.Essentials.Core
|
||||
BeginPolling();
|
||||
}
|
||||
|
||||
void socket_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e)
|
||||
private void Socket_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e)
|
||||
{
|
||||
if (!e.Client.IsConnected)
|
||||
{
|
||||
@@ -176,58 +197,72 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
// Start polling and set status to unknow and let poll result update the status to IsOk when a response is received
|
||||
Status = MonitorStatus.StatusUnknown;
|
||||
Start();
|
||||
BeginPolling();
|
||||
Start();
|
||||
}
|
||||
}
|
||||
|
||||
void BeginPolling()
|
||||
private void BeginPolling()
|
||||
{
|
||||
Poll();
|
||||
PollTimer = new CTimer(o => Poll(), null, PollTime, PollTime);
|
||||
try
|
||||
{
|
||||
semaphore.Wait();
|
||||
{
|
||||
if (PollTimer != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PollTimer = new Timer(o => Poll(), null, 0, PollTime);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
semaphore.Release();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stop the poll cycle
|
||||
/// </summary>
|
||||
public override void Stop()
|
||||
{
|
||||
if(MonitorBytesReceived)
|
||||
{
|
||||
Client.BytesReceived -= this.Client_BytesReceived;
|
||||
Client.BytesReceived -= Client_BytesReceived;
|
||||
}
|
||||
else
|
||||
{
|
||||
Client.TextReceived -= Client_TextReceived;
|
||||
}
|
||||
|
||||
if (PollTimer != null)
|
||||
StopErrorTimers();
|
||||
|
||||
if (PollTimer == null)
|
||||
{
|
||||
PollTimer.Stop();
|
||||
PollTimer = null;
|
||||
StopErrorTimers();
|
||||
return;
|
||||
}
|
||||
|
||||
PollTimer.Dispose();
|
||||
PollTimer = null;
|
||||
}
|
||||
|
||||
void Client_TextReceived(object sender, GenericCommMethodReceiveTextArgs e)
|
||||
private void Client_TextReceived(object sender, GenericCommMethodReceiveTextArgs e)
|
||||
{
|
||||
DataReceived();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Upon any receipt of data, set everything to ok!
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void Client_BytesReceived(object sender, GenericCommMethodReceiveBytesArgs e)
|
||||
private void Client_BytesReceived(object sender, GenericCommMethodReceiveBytesArgs e)
|
||||
{
|
||||
DataReceived();
|
||||
}
|
||||
|
||||
void DataReceived()
|
||||
private void DataReceived()
|
||||
{
|
||||
Status = MonitorStatus.IsOk;
|
||||
ResetErrorTimers();
|
||||
}
|
||||
|
||||
void Poll()
|
||||
private void Poll()
|
||||
{
|
||||
StartErrorTimers();
|
||||
if (Client.IsConnected)
|
||||
@@ -240,12 +275,14 @@ namespace PepperDash.Essentials.Core
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Verbose, this, "Comm not connected");
|
||||
this.LogVerbose("Comm not connected");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Communication Monitor Configuration from Essentials Configuration
|
||||
/// </summary>
|
||||
public class CommunicationMonitorConfig
|
||||
{
|
||||
public int PollInterval { get; set; }
|
||||
@@ -253,6 +290,9 @@ namespace PepperDash.Essentials.Core
|
||||
public int TimeToError { get; set; }
|
||||
public string PollString { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor. Sets pollInterval to 30s, TimeToWarning to 120s, and TimeToError to 300s
|
||||
/// </summary>
|
||||
public CommunicationMonitorConfig()
|
||||
{
|
||||
PollInterval = 30000;
|
||||
|
||||
@@ -278,7 +278,7 @@ namespace PepperDash.Essentials.Core
|
||||
if (destinationPort == null)
|
||||
{
|
||||
destinationTieLines = TieLineCollection.Default.Where(t =>
|
||||
t.DestinationPort.ParentDevice.Key == destination.Key && (t.Type.HasFlag(signalType)));
|
||||
t.DestinationPort.ParentDevice.Key == destination.Key && (t.Type.HasFlag(signalType) || signalType == eRoutingSignalType.AudioVideo));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -37,6 +37,7 @@ namespace PepperDash.Essentials.Devices.Common.Cameras
|
||||
|
||||
#region IRoutingOutputs Members
|
||||
|
||||
[JsonIgnore]
|
||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
using Newtonsoft.Json;
|
||||
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 IHasInputsMessenger<TKey> : MessengerBase
|
||||
{
|
||||
private readonly IHasInputs<TKey> itemDevice;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a messenger for a device that implements IHasInputs<typeparamref name="TKey"/>
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
/// <param name="device"></param>
|
||||
public IHasInputsMessenger(string key, string messagePath, IHasInputs<TKey> device) : base(key, messagePath, device)
|
||||
{
|
||||
itemDevice = device;
|
||||
}
|
||||
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
AddAction("/fullStatus", (id, context) =>
|
||||
{
|
||||
SendFullStatus();
|
||||
});
|
||||
|
||||
itemDevice.Inputs.ItemsUpdated += (sender, args) =>
|
||||
{
|
||||
SendFullStatus();
|
||||
};
|
||||
|
||||
itemDevice.Inputs.CurrentItemChanged += (sender, args) =>
|
||||
{
|
||||
SendFullStatus();
|
||||
};
|
||||
|
||||
foreach (var input in itemDevice.Inputs.Items)
|
||||
{
|
||||
var key = input.Key;
|
||||
var localItem = input.Value;
|
||||
|
||||
AddAction($"/{key}", (id, content) =>
|
||||
{
|
||||
localItem.Select();
|
||||
});
|
||||
|
||||
localItem.ItemUpdated += (sender, args) =>
|
||||
{
|
||||
SendFullStatus();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private void SendFullStatus()
|
||||
{
|
||||
try
|
||||
{
|
||||
this.LogInformation("Sending full status");
|
||||
|
||||
var stateObject = new IHasInputsStateMessage<TKey>
|
||||
{
|
||||
Inputs = new Inputs<TKey>
|
||||
{
|
||||
Items = itemDevice.Inputs.Items,
|
||||
CurrentItem = itemDevice.Inputs.CurrentItem
|
||||
}
|
||||
};
|
||||
|
||||
PostStatusMessage(stateObject);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
this.LogError("Error sending full status: {0}", e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class IHasInputsStateMessage<TKey> : DeviceStateMessageBase
|
||||
{
|
||||
[JsonProperty("inputs")]
|
||||
public Inputs<TKey> Inputs { get; set; }
|
||||
}
|
||||
|
||||
public class Inputs<TKey>
|
||||
{
|
||||
[JsonProperty("items")]
|
||||
public Dictionary<TKey, ISelectableItem> Items { get; set; }
|
||||
|
||||
[JsonProperty("currentItem")]
|
||||
public TKey CurrentItem { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Core.Logging;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
@@ -10,11 +8,18 @@ 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 readonly ISelectableItems<TKey> itemDevice;
|
||||
|
||||
private readonly string _propName;
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a messenger for a device that implements ISelectableItems<typeparamref name="TKey"/>
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
/// <param name="device"></param>
|
||||
/// <param name="propName"></param>
|
||||
public ISelectableItemsMessenger(string key, string messagePath, ISelectableItems<TKey> device, string propName) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
itemDevice = device;
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -763,11 +763,10 @@ namespace PepperDash.Essentials
|
||||
{
|
||||
this.LogVerbose("Adding InputsMessenger<string> for {deviceKey}", device.Key);
|
||||
|
||||
var messenger = new ISelectableItemsMessenger<string>(
|
||||
var messenger = new IHasInputsMessenger<string>(
|
||||
$"{device.Key}-inputs-{Key}",
|
||||
$"/device/{device.Key}",
|
||||
stringInputs.Inputs,
|
||||
"inputs"
|
||||
stringInputs
|
||||
);
|
||||
|
||||
AddDefaultDeviceMessenger(messenger);
|
||||
@@ -779,11 +778,10 @@ namespace PepperDash.Essentials
|
||||
{
|
||||
this.LogVerbose("Adding InputsMessenger for {deviceKey}", device.Key);
|
||||
|
||||
var messenger = new ISelectableItemsMessenger<byte>(
|
||||
var messenger = new IHasInputsMessenger<byte>(
|
||||
$"{device.Key}-inputs-{Key}",
|
||||
$"/device/{device.Key}",
|
||||
byteInputs.Inputs,
|
||||
"inputs"
|
||||
byteInputs
|
||||
);
|
||||
|
||||
AddDefaultDeviceMessenger(messenger);
|
||||
@@ -795,11 +793,10 @@ namespace PepperDash.Essentials
|
||||
{
|
||||
this.LogVerbose("Adding InputsMessenger for {deviceKey}", device.Key);
|
||||
|
||||
var messenger = new ISelectableItemsMessenger<int>(
|
||||
var messenger = new IHasInputsMessenger<int>(
|
||||
$"{device.Key}-inputs-{Key}",
|
||||
$"/device/{device.Key}",
|
||||
intInputs.Inputs,
|
||||
"inputs"
|
||||
intInputs
|
||||
);
|
||||
|
||||
AddDefaultDeviceMessenger(messenger);
|
||||
|
||||
@@ -113,10 +113,7 @@ namespace PepperDash.Essentials
|
||||
|
||||
_server.SendMessageToAllClients(message);
|
||||
|
||||
_server.LogVerbose("Message TX To all clients: {message}", null, message);
|
||||
|
||||
|
||||
|
||||
_server.LogVerbose("Message TX To all clients: {message}", message);
|
||||
}
|
||||
catch (ThreadAbortException)
|
||||
{
|
||||
@@ -126,8 +123,6 @@ namespace PepperDash.Essentials
|
||||
{
|
||||
Debug.LogMessage(ex, "Caught an exception in the Transmit Processor");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -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];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user