made config publicly accessible

This commit is contained in:
Andrew Welker
2020-07-08 16:32:40 -06:00
parent 0534a3631f
commit c64f1d4a55

View File

@@ -21,33 +21,33 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
public const string DefaultCodecRouteString = "codecOsd"; public const string DefaultCodecRouteString = "codecOsd";
private EssentialsHuddleVtc1PropertiesConfig _propertiesConfig; public EssentialsHuddleVtc1PropertiesConfig PropertiesConfig { get; private set; }
public EssentialsHuddleVtc1Room(DeviceConfig config) public EssentialsHuddleVtc1Room(DeviceConfig config)
: base(config) : base(config)
{ {
try try
{ {
_propertiesConfig = JsonConvert.DeserializeObject<EssentialsHuddleVtc1PropertiesConfig> PropertiesConfig = JsonConvert.DeserializeObject<EssentialsHuddleVtc1PropertiesConfig>
(config.Properties.ToString()); (config.Properties.ToString());
DefaultDisplay = DefaultDisplay =
DeviceManager.GetDeviceForKey(_propertiesConfig.DefaultDisplayKey) as IRoutingSinkWithSwitching; DeviceManager.GetDeviceForKey(PropertiesConfig.DefaultDisplayKey) as IRoutingSinkWithSwitching;
VideoCodec = DeviceManager.GetDeviceForKey(_propertiesConfig.VideoCodecKey) as VideoCodec = DeviceManager.GetDeviceForKey(PropertiesConfig.VideoCodecKey) as
VideoCodecBase; VideoCodecBase;
if (VideoCodec == null) if (VideoCodec == null)
{ {
throw new ArgumentNullException("codec cannot be null"); throw new ArgumentNullException("codec cannot be null");
} }
AudioCodec = DeviceManager.GetDeviceForKey(_propertiesConfig.AudioCodecKey) as AudioCodec = DeviceManager.GetDeviceForKey(PropertiesConfig.AudioCodecKey) as
AudioCodecBase; AudioCodecBase;
if (AudioCodec == null) if (AudioCodec == null)
{ {
Debug.Console(0, this, "No Audio Codec Found"); Debug.Console(0, this, "No Audio Codec Found");
} }
DefaultAudioDevice = DeviceManager.GetDeviceForKey(_propertiesConfig.DefaultAudioKey) as IRoutingSink; DefaultAudioDevice = DeviceManager.GetDeviceForKey(PropertiesConfig.DefaultAudioKey) as IRoutingSink;
Initialize(); Initialize();
} }
@@ -166,12 +166,12 @@ namespace PepperDash.Essentials
}); });
// Get Microphone Privacy object, if any MUST HAPPEN AFTER setting InCallFeedback // Get Microphone Privacy object, if any MUST HAPPEN AFTER setting InCallFeedback
MicrophonePrivacy = EssentialsRoomConfigHelper.GetMicrophonePrivacy(_propertiesConfig, this); MicrophonePrivacy = EssentialsRoomConfigHelper.GetMicrophonePrivacy(PropertiesConfig, this);
Debug.Console(2, this, "Microphone Privacy Config evaluated."); Debug.Console(2, this, "Microphone Privacy Config evaluated.");
// Get emergency object, if any // Get emergency object, if any
Emergency = EssentialsRoomConfigHelper.GetEmergency(_propertiesConfig, this); Emergency = EssentialsRoomConfigHelper.GetEmergency(PropertiesConfig, this);
Debug.Console(2, this, "Emergency Config evaluated."); Debug.Console(2, this, "Emergency Config evaluated.");
@@ -222,7 +222,7 @@ namespace PepperDash.Essentials
if (newPropertiesConfig != null) if (newPropertiesConfig != null)
{ {
_propertiesConfig = newPropertiesConfig; PropertiesConfig = newPropertiesConfig;
} }
ConfigWriter.UpdateRoomConfig(config); ConfigWriter.UpdateRoomConfig(config);
@@ -231,17 +231,17 @@ namespace PepperDash.Essentials
public override bool CustomActivate() public override bool CustomActivate()
{ {
// Add Occupancy object from config // Add Occupancy object from config
if (_propertiesConfig.Occupancy != null) if (PropertiesConfig.Occupancy != null)
{ {
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Setting Occupancy Provider for room"); Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Setting Occupancy Provider for room");
SetRoomOccupancy(DeviceManager.GetDeviceForKey(_propertiesConfig.Occupancy.DeviceKey) as SetRoomOccupancy(DeviceManager.GetDeviceForKey(PropertiesConfig.Occupancy.DeviceKey) as
IOccupancyStatusProvider, _propertiesConfig.Occupancy.TimeoutMinutes); IOccupancyStatusProvider, PropertiesConfig.Occupancy.TimeoutMinutes);
} }
LogoUrl = _propertiesConfig.Logo.GetUrl(); LogoUrl = PropertiesConfig.Logo.GetUrl();
SourceListKey = _propertiesConfig.SourceListKey; SourceListKey = PropertiesConfig.SourceListKey;
DefaultSourceItem = _propertiesConfig.DefaultSourceItem; DefaultSourceItem = PropertiesConfig.DefaultSourceItem;
DefaultVolume = (ushort) (_propertiesConfig.Volumes.Master.Level*65535/100); DefaultVolume = (ushort) (PropertiesConfig.Volumes.Master.Level*65535/100);
return base.CustomActivate(); return base.CustomActivate();
} }