chore: add back in config classes

Mobile Control (for the moment) relies on these classes, so they are necessary in Essentials until we determine a better solution.
This commit is contained in:
Andrew Welker
2024-02-07 08:42:22 -06:00
parent 8af0cf2702
commit 49b7faa400
14 changed files with 176 additions and 61 deletions

View File

@@ -1,5 +1,5 @@
namespace PDT.Plugins.Essentials.Rooms.Config
namespace PepperDash.Essentials.Room.Config
{
public class EssentialsDualDisplayRoomPropertiesConfig : EssentialsNDisplayRoomPropertiesConfig
{

View File

@@ -1,6 +1,6 @@
using Newtonsoft.Json;
namespace PDT.Plugins.Essentials.Rooms.Config
namespace PepperDash.Essentials.Room.Config
{
/// <summary>
///

View File

@@ -1,7 +1,7 @@
using Newtonsoft.Json;
namespace PDT.Plugins.Essentials.Rooms.Config
namespace PepperDash.Essentials.Room.Config
{
public class EssentialsHuddleVtc1PropertiesConfig : EssentialsConferenceRoomPropertiesConfig

View File

@@ -4,7 +4,7 @@ using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core;
namespace PDT.Plugins.Essentials.Rooms.Config
namespace PepperDash.Essentials.Room.Config
{
/// <summary>
///

View File

@@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace PDT.Plugins.Essentials.Rooms.Config
namespace PepperDash.Essentials.Room.Config
{
/// <summary>
///

View File

@@ -4,54 +4,12 @@ using Crestron.SimplSharp;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Privacy;
namespace PDT.Plugins.Essentials.Rooms.Config
namespace PepperDash.Essentials.Room.Config
{
public class EssentialsRoomConfigHelper
{
/// <summary>
/// Returns a room object from this config data
/// </summary>
/// <returns></returns>
public static IKeyed GetRoomObject(DeviceConfig roomConfig)
{
var typeName = roomConfig.Type.ToLower();
switch (typeName)
{
case "huddle" :
{
return new EssentialsHuddleSpaceRoom(roomConfig);
}
case "huddlevtc1" :
{
return new EssentialsHuddleVtc1Room(roomConfig);
}
case "ddvc01bridge" :
{
return new Device(roomConfig.Key, roomConfig.Name); // placeholder device that does nothing.
}
case "dualdisplay" :
{
return new EssentialsDualDisplayRoom(roomConfig);
}
case "combinedhuddlevtc1" :
{
return new EssentialsCombinedHuddleVtc1Room(roomConfig);
}
case "techroom" :
{
return new EssentialsTechRoom(roomConfig);
}
default :
{
return DeviceFactory.GetDevice(roomConfig);
}
}
}
/// <summary>
/// Gets and operating, standalone emergegncy object that can be plugged into a room.
/// Returns null if there is no emergency defined

View File

@@ -1,4 +1,4 @@
namespace PDT.Plugins.Essentials.Rooms.Config
namespace PepperDash.Essentials.Room.Config
{
/// <summary>
///

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
using Newtonsoft.Json;
using PepperDash.Essentials.Room.Config;
namespace PDT.Plugins.Essentials.Rooms.Config
namespace PepperDash.Essentials.Room.Config
{
public class EssentialsTechRoomConfig
{

View File

@@ -0,0 +1,91 @@
using System;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Room.Config
{
/// <summary>
///
/// </summary>
public class EssentialsRoomVolumesConfig
{
public EssentialsVolumeLevelConfig Master { get; set; }
public EssentialsVolumeLevelConfig Program { get; set; }
public EssentialsVolumeLevelConfig AudioCallRx { get; set; }
public EssentialsVolumeLevelConfig AudioCallTx { get; set; }
}
/// <summary>
///
/// </summary>
public class EssentialsVolumeLevelConfig
{
public string DeviceKey { get; set; }
public string Label { get; set; }
public int Level { get; set; }
/// <summary>
/// Helper to get the device associated with key - one timer.
/// </summary>
public IBasicVolumeWithFeedback GetDevice()
{
throw new NotImplementedException("This method references DM CHASSIS Directly");
/*
// DM output card format: deviceKey--output~number, dm8x8-1--output~4
var match = Regex.Match(DeviceKey, @"([-_\w]+)--(\w+)~(\d+)");
if (match.Success)
{
var devKey = match.Groups[1].Value;
var chassis = DeviceManager.GetDeviceForKey(devKey) as DmChassisController;
if (chassis != null)
{
var outputNum = Convert.ToUInt32(match.Groups[3].Value);
if (chassis.VolumeControls.ContainsKey(outputNum)) // should always...
return chassis.VolumeControls[outputNum];
}
// No volume for some reason. We have failed as developers
return null;
}
// DSP/DMPS format: deviceKey--levelName, biampTesira-1--master
match = Regex.Match(DeviceKey, @"([-_\w]+)--(.+)");
if (match.Success)
{
var devKey = match.Groups[1].Value;
var dsp = DeviceManager.GetDeviceForKey(devKey) as BiampTesiraForteDsp;
if (dsp != null)
{
var levelTag = match.Groups[2].Value;
if (dsp.LevelControlPoints.ContainsKey(levelTag)) // should always...
return dsp.LevelControlPoints[levelTag];
}
var dmps = DeviceManager.GetDeviceForKey(devKey) as DmpsAudioOutputController;
if (dmps != null)
{
var levelTag = match.Groups[2].Value;
switch (levelTag)
{
case "master":
return dmps.MasterVolumeLevel;
case "source":
return dmps.SourceVolumeLevel;
case "micsmaster":
return dmps.MicsMasterVolumeLevel;
case "codec1":
return dmps.Codec1VolumeLevel;
case "codec2":
return dmps.Codec2VolumeLevel;
default:
return dmps.MasterVolumeLevel;
}
}
// No volume for some reason. We have failed as developers
return null;
}
return null;
}
* */
}
}
}

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using Newtonsoft.Json;
namespace PDT.Plugins.Essentials.Rooms.Config
namespace PepperDash.Essentials.Room.Config
{
public class SimplRoomPropertiesConfig : EssentialsHuddleVtc1PropertiesConfig
{

View File

@@ -0,0 +1,47 @@
using System;
using Crestron.SimplSharpPro;
using PepperDash.Essentials.Room.Config;
namespace PepperDash.Essentials.Core
{
public class EssentialsRoomEmergencyContactClosure : EssentialsRoomEmergencyBase
{
IEssentialsRoom Room;
string Behavior;
bool TriggerOnClose;
public EssentialsRoomEmergencyContactClosure(string key, EssentialsRoomEmergencyConfig config, IEssentialsRoom room) :
base(key)
{
Room = room;
var cs = Global.ControlSystem;
if (config.Trigger.Type.Equals("contact", StringComparison.OrdinalIgnoreCase))
{
var portNum = (uint)config.Trigger.Number;
if (portNum <= cs.NumberOfDigitalInputPorts)
{
cs.DigitalInputPorts[portNum].Register();
cs.DigitalInputPorts[portNum].StateChange += EsentialsRoomEmergencyContactClosure_StateChange;
}
}
Behavior = config.Behavior;
TriggerOnClose = config.Trigger.TriggerOnClose;
}
void EsentialsRoomEmergencyContactClosure_StateChange(DigitalInput digitalInput, DigitalInputEventArgs args)
{
if (args.State && TriggerOnClose || !args.State && !TriggerOnClose)
RunEmergencyBehavior();
}
/// <summary>
///
/// </summary>
public void RunEmergencyBehavior()
{
if (Behavior.Equals("shutdown"))
Room.Shutdown();
}
}
}

View File

@@ -1,7 +1,7 @@
using System;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Room.Config;
namespace PDT.Plugins.Essentials.Rooms
namespace PepperDash.Essentials.Devices.Common.Rooms
{
public interface IEssentialsHuddleSpaceRoom : IEssentialsRoom, IHasCurrentSourceInfoChange, IRunRouteAction, IHasDefaultDisplay, IHasCurrentVolumeControls, IRoomOccupancy,
IEmergency, IMicrophonePrivacy
@@ -10,10 +10,6 @@ namespace PDT.Plugins.Essentials.Rooms
void RunRouteAction(string routeKey);
// EssentialsHuddleRoomPropertiesConfig PropertiesConfig { get; }
IBasicVolumeControls CurrentVolumeControls { get; }
event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange;
EssentialsHuddleRoomPropertiesConfig PropertiesConfig { get; }
}
}

View File

@@ -2,13 +2,14 @@
using PepperDash.Essentials.Devices.Common.AudioCodec;
using PepperDash.Essentials.Devices.Common.Codec;
using PepperDash.Essentials.Devices.Common.VideoCodec;
using PepperDash.Essentials.Room.Config;
namespace PDT.Plugins.Essentials.Rooms
namespace PepperDash.Essentials.Devices.Common.Rooms
{
public interface IEssentialsHuddleVtc1Room : IEssentialsRoom, IHasCurrentSourceInfoChange, IHasCurrentVolumeControls, IRunRouteAction, IRunDefaultCallRoute, IHasVideoCodec, IHasAudioCodec, IHasDefaultDisplay, IHasInCallFeedback,
IRoomOccupancy, IEmergency, IMicrophonePrivacy
{
// EssentialsHuddleVtc1PropertiesConfig PropertiesConfig { get; }
EssentialsHuddleVtc1PropertiesConfig PropertiesConfig { get; }
bool ExcludeFromGlobalFunctions { get; }

View File

@@ -0,0 +1,22 @@
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PepperDash.Essentials.Devices.Common.Room
{
public interface IEssentialsTechRoom:IEssentialsRoom, ITvPresetsProvider,IBridgeAdvanced,IRunDirectRouteAction
{
Dictionary<string, IRSetTopBoxBase> Tuners { get; }
Dictionary<string, TwoWayDisplayBase> Displays { get; }
void RoomPowerOn();
void RoomPowerOff();
}
}