mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-20 07:56:50 +00:00
chore: move all files to file-scoped namespace
This commit is contained in:
parent
aaa5b0532b
commit
3ece4f0b7b
522 changed files with 39628 additions and 45678 deletions
|
|
@ -1,37 +1,38 @@
|
|||
using Newtonsoft.Json;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
namespace PepperDash.Essentials;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Represents a AuthorizationResponse
|
||||
/// </summary>
|
||||
public class AuthorizationResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a AuthorizationResponse
|
||||
/// </summary>
|
||||
public class AuthorizationResponse
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Authorized
|
||||
/// </summary>
|
||||
[JsonProperty("authorized")]
|
||||
public bool Authorized { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Reason
|
||||
/// </summary>
|
||||
[JsonProperty("reason", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Reason { get; set; } = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a AuthorizationRequest
|
||||
/// Gets or sets the Authorized
|
||||
/// </summary>
|
||||
public class AuthorizationRequest
|
||||
{
|
||||
[JsonProperty("authorized")]
|
||||
public bool Authorized { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the GrantCode
|
||||
/// </summary>
|
||||
[JsonProperty("grantCode")]
|
||||
public string GrantCode { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Reason
|
||||
/// </summary>
|
||||
[JsonProperty("reason", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Reason { get; set; } = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a AuthorizationRequest
|
||||
/// </summary>
|
||||
public class AuthorizationRequest
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the GrantCode
|
||||
/// </summary>
|
||||
[JsonProperty("grantCode")]
|
||||
public string GrantCode { get; set; }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,32 +2,33 @@
|
|||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
namespace PepperDash.Essentials;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Represents a MobileControlAction
|
||||
/// </summary>
|
||||
public class MobileControlAction : IMobileControlAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a MobileControlAction
|
||||
/// Gets the Messenger
|
||||
/// </summary>
|
||||
public class MobileControlAction : IMobileControlAction
|
||||
public IMobileControlMessenger Messenger { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Action to execute when this path is matched
|
||||
/// </summary>
|
||||
public Action<string, string, JToken> Action { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initialize an instance of the <see cref="MobileControlAction"/> class
|
||||
/// </summary>
|
||||
/// <param name="messenger">Messenger associated with this action</param>
|
||||
/// <param name="handler">Action to take when this path is matched</param>
|
||||
public MobileControlAction(IMobileControlMessenger messenger, Action<string, string, JToken> handler)
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the Messenger
|
||||
/// </summary>
|
||||
public IMobileControlMessenger Messenger { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Action to execute when this path is matched
|
||||
/// </summary>
|
||||
public Action<string, string, JToken> Action { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initialize an instance of the <see cref="MobileControlAction"/> class
|
||||
/// </summary>
|
||||
/// <param name="messenger">Messenger associated with this action</param>
|
||||
/// <param name="handler">Action to take when this path is matched</param>
|
||||
public MobileControlAction(IMobileControlMessenger messenger, Action<string, string, JToken> handler)
|
||||
{
|
||||
Messenger = messenger;
|
||||
Action = handler;
|
||||
}
|
||||
Messenger = messenger;
|
||||
Action = handler;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,34 +5,26 @@ using PepperDash.Essentials.Core;
|
|||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
/// <summary>
|
||||
/// Factory to create a Mobile Control System Controller
|
||||
/// </summary>
|
||||
public class MobileControlDeviceFactory : EssentialsDeviceFactory<MobileControlSystemController>
|
||||
{
|
||||
/// <summary>
|
||||
/// Create the factory for a Mobile Control System Controller
|
||||
/// </summary>
|
||||
public MobileControlDeviceFactory()
|
||||
{
|
||||
TypeNames = new List<string> { "appserver", "mobilecontrol", "webserver" };
|
||||
}
|
||||
namespace PepperDash.Essentials;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
public class MobileControlDeviceFactory : EssentialsDeviceFactory<MobileControlSystemController>
|
||||
{
|
||||
public MobileControlDeviceFactory()
|
||||
{
|
||||
TypeNames = new List<string> { "appserver", "mobilecontrol", "webserver" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
var props = dc.Properties.ToObject<MobileControlConfig>();
|
||||
return new MobileControlSystemController(dc.Key, dc.Name, props);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogMessage(e, "Error building Mobile Control System Controller");
|
||||
return null;
|
||||
}
|
||||
var props = dc.Properties.ToObject<MobileControlConfig>();
|
||||
return new MobileControlSystemController(dc.Key, dc.Name, props);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogMessage(e, "Error building Mobile Control System Controller");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,74 +1,75 @@
|
|||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Essentials;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
namespace PepperDash.Essentials;
|
||||
|
||||
/// <summary>
|
||||
/// Configuration class for sending data to Mobile Control Edge or a client using the Direct Server
|
||||
/// </summary>
|
||||
public class MobileControlEssentialsConfig : EssentialsConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Configuration class for sending data to Mobile Control Edge or a client using the Direct Server
|
||||
/// Current versions for the system
|
||||
/// </summary>
|
||||
public class MobileControlEssentialsConfig : EssentialsConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Current versions for the system
|
||||
/// </summary>
|
||||
[JsonProperty("runtimeInfo")]
|
||||
public MobileControlRuntimeInfo RuntimeInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Create Configuration for Mobile Control. Used as part of the data sent to a client
|
||||
/// </summary>
|
||||
/// <param name="config">The base configuration</param>
|
||||
public MobileControlEssentialsConfig(EssentialsConfig config)
|
||||
: base()
|
||||
{
|
||||
Devices = config.Devices;
|
||||
Info = config.Info;
|
||||
JoinMaps = config.JoinMaps;
|
||||
Rooms = config.Rooms;
|
||||
SourceLists = config.SourceLists;
|
||||
DestinationLists = config.DestinationLists;
|
||||
SystemUrl = config.SystemUrl;
|
||||
TemplateUrl = config.TemplateUrl;
|
||||
TieLines = config.TieLines;
|
||||
|
||||
if (Info == null)
|
||||
Info = new InfoConfig();
|
||||
|
||||
RuntimeInfo = new MobileControlRuntimeInfo();
|
||||
}
|
||||
}
|
||||
[JsonProperty("runtimeInfo")]
|
||||
public MobileControlRuntimeInfo RuntimeInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Represents a MobileControlRuntimeInfo
|
||||
/// Create Configuration for Mobile Control. Used as part of the data sent to a client
|
||||
/// </summary>
|
||||
public class MobileControlRuntimeInfo
|
||||
/// <param name="config">The base configuration</param>
|
||||
public MobileControlEssentialsConfig(EssentialsConfig config)
|
||||
: base()
|
||||
{
|
||||
Devices = config.Devices;
|
||||
Info = config.Info;
|
||||
JoinMaps = config.JoinMaps;
|
||||
Rooms = config.Rooms;
|
||||
SourceLists = config.SourceLists;
|
||||
DestinationLists = config.DestinationLists;
|
||||
SystemUrl = config.SystemUrl;
|
||||
TemplateUrl = config.TemplateUrl;
|
||||
TieLines = config.TieLines;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the PluginVersion
|
||||
/// </summary>
|
||||
[JsonProperty("pluginVersion")]
|
||||
public string PluginVersion { get; set; }
|
||||
if (Info == null)
|
||||
Info = new InfoConfig();
|
||||
|
||||
/// <summary>
|
||||
/// Essentials Version
|
||||
/// </summary>
|
||||
[JsonProperty("essentialsVersion")]
|
||||
public string EssentialsVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// PepperDash Core Version
|
||||
/// </summary>
|
||||
[JsonProperty("pepperDashCoreVersion")]
|
||||
public string PepperDashCoreVersion { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// List of Plugins loaded on this system
|
||||
/// </summary>
|
||||
[JsonProperty("essentialsPlugins")]
|
||||
public List<LoadedAssembly> EssentialsPlugins { get; set; }
|
||||
RuntimeInfo = new MobileControlRuntimeInfo();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a MobileControlRuntimeInfo
|
||||
/// </summary>
|
||||
public class MobileControlRuntimeInfo
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the PluginVersion
|
||||
/// </summary>
|
||||
[JsonProperty("pluginVersion")]
|
||||
public string PluginVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Essentials Version
|
||||
/// </summary>
|
||||
[JsonProperty("essentialsVersion")]
|
||||
public string EssentialsVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// PepperDash Core Version
|
||||
/// </summary>
|
||||
[JsonProperty("pepperDashCoreVersion")]
|
||||
public string PepperDashCoreVersion { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// List of Plugins loaded on this system
|
||||
/// </summary>
|
||||
[JsonProperty("essentialsPlugins")]
|
||||
public List<LoadedAssembly> EssentialsPlugins { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2510,4 +2510,4 @@ namespace PepperDash.Essentials
|
|||
CrestronConsole.ConsoleCommandResponse("Usage: mobilehttprequest:N get/post url\r");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,193 +5,126 @@ using PepperDash.Essentials.AppServer.Messengers;
|
|||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.RoomBridges
|
||||
namespace PepperDash.Essentials.RoomBridges;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public abstract class MobileControlBridgeBase : MessengerBase, IMobileControlRoomMessenger
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for a Mobile Control Bridge that's used to control a room
|
||||
/// </summary>
|
||||
public abstract class MobileControlBridgeBase : MessengerBase, IMobileControlRoomMessenger
|
||||
public event EventHandler<EventArgs> UserCodeChanged;
|
||||
|
||||
public event EventHandler<EventArgs> UserPromptedForCode;
|
||||
|
||||
public event EventHandler<EventArgs> ClientJoined;
|
||||
|
||||
public event EventHandler<EventArgs> AppUrlChanged;
|
||||
|
||||
public IMobileControl Parent { get; private set; }
|
||||
|
||||
public string AppUrl { get; private set; }
|
||||
public string UserCode { get; private set; }
|
||||
|
||||
public string QrCodeUrl { get; protected set; }
|
||||
|
||||
public string QrCodeChecksum { get; protected set; }
|
||||
|
||||
public string McServerUrl { get; private set; }
|
||||
|
||||
public abstract string RoomName { get; }
|
||||
|
||||
public abstract string RoomKey { get; }
|
||||
|
||||
protected MobileControlBridgeBase(string key, string messagePath)
|
||||
: base(key, messagePath)
|
||||
{
|
||||
/// <summary>
|
||||
/// Triggered when the user Code changes
|
||||
/// </summary>
|
||||
public event EventHandler<EventArgs> UserCodeChanged;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when a user should be prompted for the new code
|
||||
/// </summary>
|
||||
public event EventHandler<EventArgs> UserPromptedForCode;
|
||||
protected MobileControlBridgeBase(string key, string messagePath, IKeyName device)
|
||||
: base(key, messagePath, device)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when a client joins to control this room
|
||||
/// </summary>
|
||||
public event EventHandler<EventArgs> ClientJoined;
|
||||
/// <summary>
|
||||
/// Set the parent. Does nothing else. Override to add functionality such
|
||||
/// as adding actions to parent
|
||||
/// </summary>
|
||||
/// <param name="parent"></param>
|
||||
public virtual void AddParent(IMobileControl parent)
|
||||
{
|
||||
Parent = parent;
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when the App URL for this room changes
|
||||
/// </summary>
|
||||
public event EventHandler<EventArgs> AppUrlChanged;
|
||||
McServerUrl = Parent.ClientAppUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Parent
|
||||
/// </summary>
|
||||
public IMobileControl Parent { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the AppUrl
|
||||
/// </summary>
|
||||
public string AppUrl { get; private set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the UserCode
|
||||
/// </summary>
|
||||
public string UserCode { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the QrCodeUrl
|
||||
/// </summary>
|
||||
public string QrCodeUrl { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the QrCodeChecksum
|
||||
/// </summary>
|
||||
public string QrCodeChecksum { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the McServerUrl
|
||||
/// </summary>
|
||||
public string McServerUrl { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Room Name
|
||||
/// </summary>
|
||||
public abstract string RoomName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Room key
|
||||
/// </summary>
|
||||
public abstract string RoomKey { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Create an instance of the <see cref="MobileControlBridgeBase"/> class
|
||||
/// </summary>
|
||||
/// <param name="key">The unique key for this bridge</param>
|
||||
/// <param name="messagePath">The message path for this bridge</param>
|
||||
protected MobileControlBridgeBase(string key, string messagePath)
|
||||
: base(key, messagePath)
|
||||
/// <summary>
|
||||
/// Sets the UserCode on the bridge object. Called from controller. A changed code will
|
||||
/// fire method UserCodeChange. Override that to handle changes
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
public void SetUserCode(string code)
|
||||
{
|
||||
var changed = UserCode != code;
|
||||
UserCode = code;
|
||||
if (changed)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an instance of the <see cref="MobileControlBridgeBase"/> class
|
||||
/// </summary>
|
||||
/// <param name="key">The unique key for this bridge</param>
|
||||
/// <param name="messagePath">The message path for this bridge</param>
|
||||
/// <param name="device">The device associated with this bridge</param>
|
||||
protected MobileControlBridgeBase(string key, string messagePath, IKeyName device)
|
||||
: base(key, messagePath, device)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the parent. Does nothing else. Override to add functionality such
|
||||
/// as adding actions to parent
|
||||
/// </summary>
|
||||
/// <param name="parent"></param>
|
||||
/// <summary>
|
||||
/// AddParent method
|
||||
/// </summary>
|
||||
public virtual void AddParent(IMobileControl parent)
|
||||
{
|
||||
Parent = parent;
|
||||
|
||||
McServerUrl = Parent.ClientAppUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the UserCode on the bridge object. Called from controller. A changed code will
|
||||
/// fire method UserCodeChange. Override that to handle changes
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <summary>
|
||||
/// SetUserCode method
|
||||
/// </summary>
|
||||
public void SetUserCode(string code)
|
||||
{
|
||||
var changed = UserCode != code;
|
||||
UserCode = code;
|
||||
if (changed)
|
||||
{
|
||||
UserCodeChange();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sets the UserCode on the bridge object. Called from controller. A changed code will
|
||||
/// fire method UserCodeChange. Override that to handle changes
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <param name="qrChecksum">Checksum of the QR code. Used for Cisco codec branding command</param>
|
||||
public void SetUserCode(string code, string qrChecksum)
|
||||
{
|
||||
QrCodeChecksum = qrChecksum;
|
||||
|
||||
SetUserCode(code);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the App Url with the provided URL
|
||||
/// </summary>
|
||||
/// <param name="url">The new App URL</param>
|
||||
public virtual void UpdateAppUrl(string url)
|
||||
{
|
||||
AppUrl = url;
|
||||
|
||||
var handler = AppUrlChanged;
|
||||
|
||||
if (handler == null) return;
|
||||
|
||||
handler(this, new EventArgs());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Empty method in base class. Override this to add functionality
|
||||
/// when code changes
|
||||
/// </summary>
|
||||
protected virtual void UserCodeChange()
|
||||
{
|
||||
this.LogDebug("Server user code changed: {userCode}", UserCode);
|
||||
|
||||
var qrUrl = string.Format($"{Parent.Host}/api/rooms/{Parent.SystemUuid}/{RoomKey}/qr?x={new Random().Next()}");
|
||||
QrCodeUrl = qrUrl;
|
||||
|
||||
this.LogDebug("Server user code changed: {userCode} - {qrCodeUrl}", UserCode, qrUrl);
|
||||
|
||||
OnUserCodeChanged();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Trigger the UserCodeChanged event
|
||||
/// </summary>
|
||||
protected void OnUserCodeChanged()
|
||||
{
|
||||
UserCodeChanged?.Invoke(this, new EventArgs());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Trigger the UserPromptedForCode event
|
||||
/// </summary>
|
||||
protected void OnUserPromptedForCode()
|
||||
{
|
||||
UserPromptedForCode?.Invoke(this, new EventArgs());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Trigger the ClientJoined event
|
||||
/// </summary>
|
||||
protected void OnClientJoined()
|
||||
{
|
||||
ClientJoined?.Invoke(this, new EventArgs());
|
||||
UserCodeChange();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sets the UserCode on the bridge object. Called from controller. A changed code will
|
||||
/// fire method UserCodeChange. Override that to handle changes
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <param name="qrChecksum">Checksum of the QR code. Used for Cisco codec branding command</param>
|
||||
public void SetUserCode(string code, string qrChecksum)
|
||||
{
|
||||
QrCodeChecksum = qrChecksum;
|
||||
|
||||
SetUserCode(code);
|
||||
}
|
||||
|
||||
public virtual void UpdateAppUrl(string url)
|
||||
{
|
||||
AppUrl = url;
|
||||
|
||||
var handler = AppUrlChanged;
|
||||
|
||||
if (handler == null) return;
|
||||
|
||||
handler(this, new EventArgs());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Empty method in base class. Override this to add functionality
|
||||
/// when code changes
|
||||
/// </summary>
|
||||
protected virtual void UserCodeChange()
|
||||
{
|
||||
this.LogDebug("Server user code changed: {userCode}", UserCode);
|
||||
|
||||
var qrUrl = string.Format($"{Parent.Host}/api/rooms/{Parent.SystemUuid}/{RoomKey}/qr?x={new Random().Next()}");
|
||||
QrCodeUrl = qrUrl;
|
||||
|
||||
this.LogDebug("Server user code changed: {userCode} - {qrCodeUrl}", UserCode, qrUrl);
|
||||
|
||||
OnUserCodeChanged();
|
||||
}
|
||||
|
||||
protected void OnUserCodeChanged()
|
||||
{
|
||||
UserCodeChanged?.Invoke(this, new EventArgs());
|
||||
}
|
||||
|
||||
protected void OnUserPromptedForCode()
|
||||
{
|
||||
UserPromptedForCode?.Invoke(this, new EventArgs());
|
||||
}
|
||||
|
||||
protected void OnClientJoined()
|
||||
{
|
||||
ClientJoined?.Invoke(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
|
@ -3,89 +3,74 @@ using System.Net.Http;
|
|||
using System.Threading.Tasks;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Services
|
||||
namespace PepperDash.Essentials.Services;
|
||||
|
||||
|
||||
public class MobileControlApiService
|
||||
{
|
||||
private readonly HttpClient _client;
|
||||
|
||||
/// <summary>
|
||||
/// Service for interacting with a Mobile Control Edge server instance
|
||||
/// </summary>
|
||||
public class MobileControlApiService
|
||||
public MobileControlApiService(string apiUrl)
|
||||
{
|
||||
private readonly HttpClient _client;
|
||||
|
||||
/// <summary>
|
||||
/// Create an instance of the <see cref="MobileControlApiService"/> class.
|
||||
/// </summary>
|
||||
/// <param name="apiUrl">Mobile Control Edge API URL</param>
|
||||
public MobileControlApiService(string apiUrl)
|
||||
var handler = new HttpClientHandler
|
||||
{
|
||||
var handler = new HttpClientHandler
|
||||
AllowAutoRedirect = false,
|
||||
ServerCertificateCustomValidationCallback = (req, cert, certChain, errors) => true
|
||||
};
|
||||
|
||||
_client = new HttpClient(handler);
|
||||
}
|
||||
|
||||
public async Task<AuthorizationResponse> SendAuthorizationRequest(string apiUrl, string grantCode, string systemUuid)
|
||||
{
|
||||
try
|
||||
{
|
||||
var request = new HttpRequestMessage(HttpMethod.Get, $"{apiUrl}/system/{systemUuid}/authorize?grantCode={grantCode}");
|
||||
|
||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Sending authorization request to {host}", null, request.RequestUri);
|
||||
|
||||
var response = await _client.SendAsync(request);
|
||||
|
||||
var authResponse = new AuthorizationResponse
|
||||
{
|
||||
AllowAutoRedirect = false,
|
||||
ServerCertificateCustomValidationCallback = (req, cert, certChain, errors) => true
|
||||
Authorized = response.StatusCode == System.Net.HttpStatusCode.OK
|
||||
};
|
||||
|
||||
_client = new HttpClient(handler);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send authorization request to Mobile Control Edge Server
|
||||
/// </summary>
|
||||
/// <param name="apiUrl">Mobile Control Edge API URL</param>
|
||||
/// <param name="grantCode">Grant code for authorization</param>
|
||||
/// <param name="systemUuid">System UUID for authorization</param>
|
||||
/// <returns>Authorization response</returns>
|
||||
public async Task<AuthorizationResponse> SendAuthorizationRequest(string apiUrl, string grantCode, string systemUuid)
|
||||
{
|
||||
try
|
||||
if (authResponse.Authorized)
|
||||
{
|
||||
var request = new HttpRequestMessage(HttpMethod.Get, $"{apiUrl}/system/{systemUuid}/authorize?grantCode={grantCode}");
|
||||
return authResponse;
|
||||
}
|
||||
|
||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Sending authorization request to {host}", null, request.RequestUri);
|
||||
if (response.StatusCode == System.Net.HttpStatusCode.Moved)
|
||||
{
|
||||
var location = response.Headers.Location;
|
||||
|
||||
var response = await _client.SendAsync(request);
|
||||
|
||||
var authResponse = new AuthorizationResponse
|
||||
{
|
||||
Authorized = response.StatusCode == System.Net.HttpStatusCode.OK
|
||||
};
|
||||
|
||||
if (authResponse.Authorized)
|
||||
{
|
||||
return authResponse;
|
||||
}
|
||||
|
||||
if (response.StatusCode == System.Net.HttpStatusCode.Moved)
|
||||
{
|
||||
var location = response.Headers.Location;
|
||||
|
||||
authResponse.Reason = $"ERROR: Mobile Control API has moved. Please adjust configuration to \"{location}\"";
|
||||
|
||||
return authResponse;
|
||||
}
|
||||
|
||||
var responseString = await response.Content.ReadAsStringAsync();
|
||||
|
||||
switch (responseString)
|
||||
{
|
||||
case "codeNotFound":
|
||||
authResponse.Reason = $"Authorization failed. Code not found for system UUID {systemUuid}";
|
||||
break;
|
||||
case "uuidNotFound":
|
||||
authResponse.Reason = $"Authorization failed. System UUID {systemUuid} not found. Check Essentials configuration.";
|
||||
break;
|
||||
default:
|
||||
authResponse.Reason = $"Authorization failed. Response {response.StatusCode}: {responseString}";
|
||||
break;
|
||||
}
|
||||
authResponse.Reason = $"ERROR: Mobile Control API has moved. Please adjust configuration to \"{location}\"";
|
||||
|
||||
return authResponse;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
var responseString = await response.Content.ReadAsStringAsync();
|
||||
|
||||
switch (responseString)
|
||||
{
|
||||
Debug.LogMessage(ex, "Error authorizing with Mobile Control");
|
||||
return new AuthorizationResponse { Authorized = false, Reason = ex.Message };
|
||||
case "codeNotFound":
|
||||
authResponse.Reason = $"Authorization failed. Code not found for system UUID {systemUuid}";
|
||||
break;
|
||||
case "uuidNotFound":
|
||||
authResponse.Reason = $"Authorization failed. System UUID {systemUuid} not found. Check Essentials configuration.";
|
||||
break;
|
||||
default:
|
||||
authResponse.Reason = $"Authorization failed. Response {response.StatusCode}: {responseString}";
|
||||
break;
|
||||
}
|
||||
|
||||
return authResponse;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogMessage(ex, "Error authorizing with Mobile Control");
|
||||
return new AuthorizationResponse { Authorized = false, Reason = ex.Message };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +1,21 @@
|
|||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Touchpanel
|
||||
namespace PepperDash.Essentials.Touchpanel;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for ITheme
|
||||
/// </summary>
|
||||
public interface ITheme : IKeyed
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the contract for ITheme
|
||||
/// Current theme
|
||||
/// </summary>
|
||||
public interface ITheme : IKeyed
|
||||
{
|
||||
/// <summary>
|
||||
/// Current theme
|
||||
/// </summary>
|
||||
string Theme { get; }
|
||||
string Theme { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Set the theme with the given value
|
||||
/// </summary>
|
||||
/// <param name="theme">The theme to set</param>
|
||||
void UpdateTheme(string theme);
|
||||
}
|
||||
/// <summary>
|
||||
/// Set the theme with the given value
|
||||
/// </summary>
|
||||
/// <param name="theme">The theme to set</param>
|
||||
void UpdateTheme(string theme);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,52 +1,53 @@
|
|||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Touchpanel
|
||||
namespace PepperDash.Essentials.Touchpanel;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for ITswAppControl
|
||||
/// </summary>
|
||||
public interface ITswAppControl : IKeyed
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the contract for ITswAppControl
|
||||
/// Updates when the Zoom Room Control Application opens or closes
|
||||
/// </summary>
|
||||
public interface ITswAppControl : IKeyed
|
||||
{
|
||||
/// <summary>
|
||||
/// Updates when the Zoom Room Control Application opens or closes
|
||||
/// </summary>
|
||||
BoolFeedback AppOpenFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Hide the Zoom App and show the User Control Application
|
||||
/// </summary>
|
||||
void HideOpenApp();
|
||||
|
||||
/// <summary>
|
||||
/// Close the Zoom App and show the User Control Application
|
||||
/// </summary>
|
||||
void CloseOpenApp();
|
||||
|
||||
/// <summary>
|
||||
/// Open the Zoom App
|
||||
/// </summary>
|
||||
void OpenApp();
|
||||
}
|
||||
BoolFeedback AppOpenFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for ITswZoomControl
|
||||
/// Hide the Zoom App and show the User Control Application
|
||||
/// </summary>
|
||||
public interface ITswZoomControl : IKeyed
|
||||
{
|
||||
/// <summary>
|
||||
/// Updates when Zoom has an incoming call
|
||||
/// </summary>
|
||||
BoolFeedback ZoomIncomingCallFeedback { get; }
|
||||
void HideOpenApp();
|
||||
|
||||
/// <summary>
|
||||
/// Updates when Zoom is in a call
|
||||
/// </summary>
|
||||
BoolFeedback ZoomInCallFeedback { get; }
|
||||
/// <summary>
|
||||
/// Close the Zoom App and show the User Control Application
|
||||
/// </summary>
|
||||
void CloseOpenApp();
|
||||
|
||||
/// <summary>
|
||||
/// End a Zoom Call
|
||||
/// </summary>
|
||||
void EndZoomCall();
|
||||
}
|
||||
/// <summary>
|
||||
/// Open the Zoom App
|
||||
/// </summary>
|
||||
void OpenApp();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for ITswZoomControl
|
||||
/// </summary>
|
||||
public interface ITswZoomControl : IKeyed
|
||||
{
|
||||
/// <summary>
|
||||
/// Updates when Zoom has an incoming call
|
||||
/// </summary>
|
||||
BoolFeedback ZoomIncomingCallFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Updates when Zoom is in a call
|
||||
/// </summary>
|
||||
BoolFeedback ZoomInCallFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// End a Zoom Call
|
||||
/// </summary>
|
||||
void EndZoomCall();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -72,4 +72,4 @@ namespace PepperDash.Essentials.Touchpanel
|
|||
[JsonProperty("appOpen", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? AppOpen { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -92,4 +92,4 @@ namespace PepperDash.Essentials.Touchpanel
|
|||
[JsonProperty("incomingCall", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? IncomingCall { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -818,4 +818,4 @@ namespace PepperDash.Essentials.Touchpanel
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,39 +1,40 @@
|
|||
using Newtonsoft.Json;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Touchpanel
|
||||
namespace PepperDash.Essentials.Touchpanel;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a MobileControlTouchpanelProperties
|
||||
/// </summary>
|
||||
public class MobileControlTouchpanelProperties : CrestronTouchpanelPropertiesConfig
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Represents a MobileControlTouchpanelProperties
|
||||
/// Gets or sets the UseDirectServer
|
||||
/// </summary>
|
||||
public class MobileControlTouchpanelProperties : CrestronTouchpanelPropertiesConfig
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the UseDirectServer
|
||||
/// </summary>
|
||||
[JsonProperty("useDirectServer")]
|
||||
public bool UseDirectServer { get; set; } = false;
|
||||
[JsonProperty("useDirectServer")]
|
||||
public bool UseDirectServer { get; set; } = false;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ZoomRoomController
|
||||
/// </summary>
|
||||
[JsonProperty("zoomRoomController")]
|
||||
public bool ZoomRoomController { get; set; } = false;
|
||||
/// <summary>
|
||||
/// Gets or sets the ZoomRoomController
|
||||
/// </summary>
|
||||
[JsonProperty("zoomRoomController")]
|
||||
public bool ZoomRoomController { get; set; } = false;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ButtonToolbarTimoutInS
|
||||
/// </summary>
|
||||
[JsonProperty("buttonToolbarTimeoutInS")]
|
||||
public ushort ButtonToolbarTimoutInS { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Gets or sets the ButtonToolbarTimoutInS
|
||||
/// </summary>
|
||||
[JsonProperty("buttonToolbarTimeoutInS")]
|
||||
public ushort ButtonToolbarTimoutInS { get; set; } = 0;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Theme
|
||||
/// </summary>
|
||||
[JsonProperty("theme")]
|
||||
public string Theme { get; set; } = "light";
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets the Theme
|
||||
/// </summary>
|
||||
[JsonProperty("theme")]
|
||||
public string Theme { get; set; } = "light";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,4 +57,4 @@ namespace PepperDash.Essentials.Touchpanel
|
|||
[JsonProperty("theme")]
|
||||
public string Theme { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +1,24 @@
|
|||
using Newtonsoft.Json;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
namespace PepperDash.Essentials;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a UserCodeChangedContent
|
||||
/// </summary>
|
||||
public class UserCodeChangedContent
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Represents a UserCodeChangedContent
|
||||
/// Gets or sets the UserCode
|
||||
/// </summary>
|
||||
public class UserCodeChangedContent
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the UserCode
|
||||
/// </summary>
|
||||
[JsonProperty("userCode")]
|
||||
public string UserCode { get; set; }
|
||||
[JsonProperty("userCode")]
|
||||
public string UserCode { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the QrChecksum
|
||||
/// </summary>
|
||||
[JsonProperty("qrChecksum", NullValueHandling = NullValueHandling.Include)]
|
||||
public string QrChecksum { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets the QrChecksum
|
||||
/// </summary>
|
||||
[JsonProperty("qrChecksum", NullValueHandling = NullValueHandling.Include)]
|
||||
public string QrChecksum { get; set; }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,137 +1,137 @@
|
|||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
namespace PepperDash.Essentials;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Represents a Volumes
|
||||
/// </summary>
|
||||
public class Volumes
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Master
|
||||
/// </summary>
|
||||
[JsonProperty("master", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public Volume Master { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Aux Faders as configured in the room
|
||||
/// </summary>
|
||||
[JsonProperty("auxFaders", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public Dictionary<string, Volume> AuxFaders { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Count of aux faders for this system
|
||||
/// </summary>
|
||||
[JsonProperty("numberOfAuxFaders", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public int? NumberOfAuxFaders { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a Volume
|
||||
/// </summary>
|
||||
public class Volume
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a Volumes
|
||||
/// Gets or sets the Key
|
||||
/// </summary>
|
||||
public class Volumes
|
||||
[JsonProperty("key", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Key { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Level for this volume object
|
||||
/// </summary>
|
||||
[JsonProperty("level", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public int? Level { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// True if this volume control is muted
|
||||
/// </summary>
|
||||
[JsonProperty("muted", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? Muted { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Label
|
||||
/// </summary>
|
||||
[JsonProperty("label", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Label { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// True if this volume object has mute control
|
||||
/// </summary>
|
||||
[JsonProperty("hasMute", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? HasMute { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// True if this volume object has Privacy mute control
|
||||
/// </summary>
|
||||
[JsonProperty("hasPrivacyMute", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? HasPrivacyMute { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// True if the privacy mute is muted
|
||||
/// </summary>
|
||||
[JsonProperty("privacyMuted", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? PrivacyMuted { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the MuteIcon
|
||||
/// </summary>
|
||||
[JsonProperty("muteIcon", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string MuteIcon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Create an instance of the <see cref="Volume" /> class
|
||||
/// </summary>
|
||||
/// <param name="key">The key for this volume object</param>
|
||||
/// <param name="level">The level for this volume object</param>
|
||||
/// <param name="muted">True if this volume control is muted</param>
|
||||
/// <param name="label">The label for this volume object</param>
|
||||
/// <param name="hasMute">True if this volume object has mute control</param>
|
||||
/// <param name="muteIcon">The mute icon for this volume object</param>
|
||||
public Volume(string key, int level, bool muted, string label, bool hasMute, string muteIcon)
|
||||
: this(key)
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Master
|
||||
/// </summary>
|
||||
[JsonProperty("master", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public Volume Master { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Aux Faders as configured in the room
|
||||
/// </summary>
|
||||
[JsonProperty("auxFaders", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public Dictionary<string, Volume> AuxFaders { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Count of aux faders for this system
|
||||
/// </summary>
|
||||
[JsonProperty("numberOfAuxFaders", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public int? NumberOfAuxFaders { get; set; }
|
||||
Level = level;
|
||||
Muted = muted;
|
||||
Label = label;
|
||||
HasMute = hasMute;
|
||||
MuteIcon = muteIcon;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a Volume
|
||||
/// Create an instance of the <see cref="Volume" /> class
|
||||
/// </summary>
|
||||
public class Volume
|
||||
/// <param name="key">The key for this volume object</param>
|
||||
/// <param name="level">The level for this volume object</param>
|
||||
public Volume(string key, int level)
|
||||
: this(key)
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Key
|
||||
/// </summary>
|
||||
[JsonProperty("key", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Key { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Level for this volume object
|
||||
/// </summary>
|
||||
[JsonProperty("level", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public int? Level { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// True if this volume control is muted
|
||||
/// </summary>
|
||||
[JsonProperty("muted", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? Muted { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Label
|
||||
/// </summary>
|
||||
[JsonProperty("label", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Label { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// True if this volume object has mute control
|
||||
/// </summary>
|
||||
[JsonProperty("hasMute", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? HasMute { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// True if this volume object has Privacy mute control
|
||||
/// </summary>
|
||||
[JsonProperty("hasPrivacyMute", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? HasPrivacyMute { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// True if the privacy mute is muted
|
||||
/// </summary>
|
||||
[JsonProperty("privacyMuted", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? PrivacyMuted { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the MuteIcon
|
||||
/// </summary>
|
||||
[JsonProperty("muteIcon", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string MuteIcon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Create an instance of the <see cref="Volume" /> class
|
||||
/// </summary>
|
||||
/// <param name="key">The key for this volume object</param>
|
||||
/// <param name="level">The level for this volume object</param>
|
||||
/// <param name="muted">True if this volume control is muted</param>
|
||||
/// <param name="label">The label for this volume object</param>
|
||||
/// <param name="hasMute">True if this volume object has mute control</param>
|
||||
/// <param name="muteIcon">The mute icon for this volume object</param>
|
||||
public Volume(string key, int level, bool muted, string label, bool hasMute, string muteIcon)
|
||||
: this(key)
|
||||
{
|
||||
Level = level;
|
||||
Muted = muted;
|
||||
Label = label;
|
||||
HasMute = hasMute;
|
||||
MuteIcon = muteIcon;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an instance of the <see cref="Volume" /> class
|
||||
/// </summary>
|
||||
/// <param name="key">The key for this volume object</param>
|
||||
/// <param name="level">The level for this volume object</param>
|
||||
public Volume(string key, int level)
|
||||
: this(key)
|
||||
{
|
||||
Level = level;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an instance of the <see cref="Volume" /> class
|
||||
/// </summary>
|
||||
/// <param name="key">The key for this volume object</param>
|
||||
/// <param name="muted">True if this volume control is muted</param>
|
||||
public Volume(string key, bool muted)
|
||||
: this(key)
|
||||
{
|
||||
Muted = muted;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an instance of the <see cref="Volume" /> class
|
||||
/// </summary>
|
||||
/// <param name="key">The key for this volume object</param>
|
||||
public Volume(string key)
|
||||
{
|
||||
Key = key;
|
||||
}
|
||||
Level = level;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an instance of the <see cref="Volume" /> class
|
||||
/// </summary>
|
||||
/// <param name="key">The key for this volume object</param>
|
||||
/// <param name="muted">True if this volume control is muted</param>
|
||||
public Volume(string key, bool muted)
|
||||
: this(key)
|
||||
{
|
||||
Muted = muted;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an instance of the <see cref="Volume" /> class
|
||||
/// </summary>
|
||||
/// <param name="key">The key for this volume object</param>
|
||||
public Volume(string key)
|
||||
{
|
||||
Key = key;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,4 +81,4 @@ namespace PepperDash.Essentials.WebApiHandlers
|
|||
[JsonProperty("path")]
|
||||
public string Path { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -68,4 +68,4 @@ namespace PepperDash.Essentials.WebApiHandlers
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -284,4 +284,4 @@ namespace PepperDash.Essentials.WebApiHandlers
|
|||
this.client = client;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
using Crestron.SimplSharp.WebScripting;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
|
|
|
|||
|
|
@ -1,26 +1,29 @@
|
|||
using System.Collections.Concurrent;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Security.Authentication;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using PepperDash.Essentials.Core;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using Crestron.SimplSharp;
|
||||
using System.Linq;
|
||||
using PepperDash.Core.Logging;
|
||||
using PepperDash.Essentials.Core.Web;
|
||||
using Crestron.SimplSharp.WebScripting;
|
||||
using Newtonsoft.Json;
|
||||
using Org.BouncyCastle.Crypto.Prng;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Core.Logging;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using PepperDash.Essentials.Core.Web;
|
||||
using PepperDash.Essentials.RoomBridges;
|
||||
using PepperDash.Essentials.WebApiHandlers;
|
||||
using Serilog.Events;
|
||||
using WebSocketSharp;
|
||||
using WebSocketSharp.Net;
|
||||
using WebSocketSharp.Server;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using Serilog.Events;
|
||||
using PepperDash.Essentials.RoomBridges;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.WebSocketServer
|
||||
{
|
||||
|
|
@ -48,7 +51,7 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||
private HttpServer _server;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the WebSocketServer instance
|
||||
/// Gets the HttpServer instance
|
||||
/// </summary>
|
||||
public HttpServer Server => _server;
|
||||
|
||||
|
|
@ -264,35 +267,34 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||
{
|
||||
base.Initialize();
|
||||
|
||||
_server = new HttpServer(Port, false);
|
||||
|
||||
|
||||
|
||||
_server.OnGet += (sender, e) => Server_OnGet(sender, e);
|
||||
|
||||
_server.OnOptions += (sender, e) => Server_OnOptions(sender, e);
|
||||
|
||||
if (_parent.Config.DirectServer.Logging.EnableRemoteLogging)
|
||||
{
|
||||
_server.OnPost += (sender, e) => Server_OnPost(sender, e);
|
||||
}
|
||||
ServerSslConfiguration sslConfig = null;
|
||||
|
||||
if (_parent.Config.DirectServer.Secure)
|
||||
{
|
||||
this.LogInformation("Adding SSL Configuration to server");
|
||||
|
||||
ServerSslConfiguration sslConfig = null;
|
||||
|
||||
sslConfig = new ServerSslConfiguration(new X509Certificate2($"\\user\\{certificateName}.pfx", certificatePassword))
|
||||
{
|
||||
ClientCertificateRequired = false,
|
||||
CheckCertificateRevocation = false,
|
||||
EnabledSslProtocols = SslProtocols.Tls12 | SslProtocols.Tls11
|
||||
};
|
||||
}
|
||||
|
||||
_server = new HttpServer(Port, false);
|
||||
if (sslConfig != null)
|
||||
{
|
||||
_server.SslConfiguration.ServerCertificate = sslConfig.ServerCertificate;
|
||||
}
|
||||
|
||||
_server.OnGet += Server_OnGet;
|
||||
|
||||
_server.OnOptions += Server_OnOptions;
|
||||
|
||||
if (_parent.Config.DirectServer.Logging.EnableRemoteLogging)
|
||||
{
|
||||
_server.OnPost += Server_OnPost;
|
||||
}
|
||||
|
||||
_server.Log.Output = (data, message) => Utilities.ConvertWebsocketLog(data, message, this);
|
||||
|
||||
// setting to trace to allow logging level to be controlled by appdebug
|
||||
|
|
@ -1463,4 +1465,4 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -267,4 +267,4 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||
this.LogDebug(e.Exception, "Stack Trace");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -52,4 +52,4 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue