Merge pull request #1288 from PepperDash/mc-touchpanel-cs

Backwards Compatibility issues
This commit is contained in:
Andrew Welker
2025-07-17 12:33:01 -05:00
committed by GitHub
3 changed files with 44 additions and 11 deletions

View File

@@ -111,13 +111,42 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
Action<string, string, JToken> Action { get; } Action<string, string, JToken> Action { get; }
} }
/// <summary>
/// Describes a MobileControl Touchpanel Controller
/// </summary>
public interface IMobileControlTouchpanelController : IKeyed public interface IMobileControlTouchpanelController : IKeyed
{ {
/// <summary>
/// The default room key for the controller
/// </summary>
string DefaultRoomKey { get; } string DefaultRoomKey { get; }
void SetAppUrl(string url);
bool UseDirectServer { get; }
bool ZoomRoomController { get; }
/// <summary>
/// Sets the application URL for the controller
/// </summary>
/// <param name="url">The application URL</param>
void SetAppUrl(string url);
/// <summary>
/// Indicates whether the controller uses a direct server connection
/// </summary>
bool UseDirectServer { get; }
/// <summary>
/// Indicates whether the controller is a Zoom Room controller
/// </summary>
bool ZoomRoomController { get; }
}
/// <summary>
/// Describes a MobileControl Crestron Touchpanel Controller
/// This interface extends the IMobileControlTouchpanelController to include connected IP information
/// </summary>
public interface IMobileControlCrestronTouchpanelController : IMobileControlTouchpanelController
{
/// <summary>
/// Gets a collection of connected IP information for the touchpanel controller
/// </summary>
ReadOnlyCollection<ConnectedIpInformation> ConnectedIps { get; } ReadOnlyCollection<ConnectedIpInformation> ConnectedIps { get; }
} }
} }

View File

@@ -22,7 +22,7 @@ namespace PepperDash.Essentials.Touchpanel
/// Mobile Control touchpanel controller that provides app control, Zoom integration, /// Mobile Control touchpanel controller that provides app control, Zoom integration,
/// and mobile control functionality for Crestron touchpanels. /// and mobile control functionality for Crestron touchpanels.
/// </summary> /// </summary>
public class MobileControlTouchpanelController : TouchpanelBase, IHasFeedback, ITswAppControl, ITswZoomControl, IDeviceInfoProvider, IMobileControlTouchpanelController, ITheme public class MobileControlTouchpanelController : TouchpanelBase, IHasFeedback, ITswAppControl, ITswZoomControl, IDeviceInfoProvider, IMobileControlCrestronTouchpanelController, ITheme
{ {
private readonly MobileControlTouchpanelProperties localConfig; private readonly MobileControlTouchpanelProperties localConfig;
private IMobileControlRoomMessenger _bridge; private IMobileControlRoomMessenger _bridge;

View File

@@ -319,7 +319,10 @@ namespace PepperDash.Essentials.WebSocketServer
continue; continue;
} }
var ip = touchpanel.Touchpanel.ConnectedIps.Any(ipInfo => string ip = processorIp;
if (touchpanel.Touchpanel is IMobileControlCrestronTouchpanelController crestronTouchpanel)
{
ip = crestronTouchpanel.ConnectedIps.Any(ipInfo =>
{ {
if (System.Net.IPAddress.TryParse(ipInfo.DeviceIpAddress, out var parsedIp)) if (System.Net.IPAddress.TryParse(ipInfo.DeviceIpAddress, out var parsedIp))
{ {
@@ -328,6 +331,7 @@ namespace PepperDash.Essentials.WebSocketServer
this.LogWarning("Invalid IP address: {deviceIpAddress}", ipInfo.DeviceIpAddress); this.LogWarning("Invalid IP address: {deviceIpAddress}", ipInfo.DeviceIpAddress);
return false; return false;
}) ? csIpAddress.ToString() : processorIp; }) ? csIpAddress.ToString() : processorIp;
}
var appUrl = $"http://{ip}:{_parent.Config.DirectServer.Port}/mc/app?token={touchpanel.Key}"; var appUrl = $"http://{ip}:{_parent.Config.DirectServer.Port}/mc/app?token={touchpanel.Key}";