diff --git a/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj
index 5ac950e4..f963a171 100644
--- a/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj
+++ b/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj
@@ -138,6 +138,7 @@
+
diff --git a/Essentials Core/PepperDashEssentialsBase/Ramps and Increments/NumericalHelpers.cs b/Essentials Core/PepperDashEssentialsBase/Ramps and Increments/NumericalHelpers.cs
new file mode 100644
index 00000000..50c12ddc
--- /dev/null
+++ b/Essentials Core/PepperDashEssentialsBase/Ramps and Increments/NumericalHelpers.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Crestron.SimplSharp;
+
+namespace PepperDash.Essentials.Core
+{
+ public class NumericalHelpers
+ {
+ ///
+ /// Scales a value
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static double Scale(double input, double inMin, double inMax, double outMin, double outMax)
+ {
+ //Debug.Console(2, this, "Scaling (double) input '{0}' with min '{1}'/max '{2}' to output range min '{3}'/max '{4}'", input, inMin, inMax, outMin, outMax);
+
+ double inputRange = inMax - inMin;
+
+ if (inputRange <= 0)
+ {
+ throw new ArithmeticException(string.Format("Invalid Input Range '{0}' for Scaling. Min '{1}' Max '{2}'.", inputRange, inMin, inMax));
+ }
+
+ double outputRange = outMax - outMin;
+
+ var output = (((input - inMin) * outputRange) / inputRange) + outMin;
+
+ // Debug.Console(2, this, "Scaled output '{0}'", output);
+
+ return output;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Essentials DM/Essentials_DM/Chassis/DmCardAudioOutput.cs b/Essentials DM/Essentials_DM/Chassis/DmCardAudioOutput.cs
index 3a069c39..4b4a927e 100644
--- a/Essentials DM/Essentials_DM/Chassis/DmCardAudioOutput.cs
+++ b/Essentials DM/Essentials_DM/Chassis/DmCardAudioOutput.cs
@@ -89,8 +89,10 @@ namespace PepperDash.Essentials.DM
public void VolumeDown(bool pressRelease)
{
if (pressRelease)
- Output.Volume.CreateRamp(0, 400);
-#warning SCALE THIS RAMP
+ {
+ var remainingRatio = Output.Volume.UShortValue / 65535;
+ Output.Volume.CreateRamp(0, (uint)(400 * remainingRatio));
+ }
else
Output.Volume.StopRamp();
}
@@ -101,7 +103,10 @@ namespace PepperDash.Essentials.DM
public void VolumeUp(bool pressRelease)
{
if (pressRelease)
+ {
+ var remainingRatio = (65535 - Output.Volume.UShortValue) / 65535;
Output.Volume.CreateRamp(65535, 400);
+ }
else
Output.Volume.StopRamp();
}
diff --git a/Essentials Devices Common/Essentials Devices Common/DSP/BiampTesira/BiampTesiraForteDspLevel.cs b/Essentials Devices Common/Essentials Devices Common/DSP/BiampTesira/BiampTesiraForteDspLevel.cs
index 31c69528..c1b6884c 100644
--- a/Essentials Devices Common/Essentials Devices Common/DSP/BiampTesira/BiampTesiraForteDspLevel.cs
+++ b/Essentials Devices Common/Essentials Devices Common/DSP/BiampTesira/BiampTesiraForteDspLevel.cs
@@ -10,18 +10,6 @@ using System.Text.RegularExpressions;
namespace PepperDash.Essentials.Devices.Common.DSP
{
-
- // QUESTIONS:
- //
- // When subscribing, just use the Instance ID for Custom Name?
-
- // Verbose on subscriptions?
-
- // ! "publishToken":"name" "value":-77.0
- // ! "myLevelName" -77
-
-#warning Working here when set aside for config editor work
-
public class TesiraForteLevelControl : TesiraForteControlPoint, IDspLevelControl, IKeyed
{
bool _IsMuted;
diff --git a/Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs b/Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs
index 64d1487e..ee6ec9c6 100644
--- a/Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs
+++ b/Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs
@@ -266,7 +266,7 @@ namespace PepperDash.Essentials.Devices.Displays
///
void UpdateVolumeFB(byte b)
{
- var newVol = (ushort)Scale((double)b, 0, 100, 0, 65535);
+ var newVol = (ushort)NumericalHelpers.Scale((double)b, 0, 100, 0, 65535);
if (!VolumeIsRamping)
_LastVolumeSent = newVol;
if (newVol != _VolumeLevelForSig)
@@ -482,40 +482,11 @@ namespace PepperDash.Essentials.Devices.Displays
public void SetVolume(ushort level)
{
_LastVolumeSent = level;
- var scaled = (int)Scale(level, 0, 65535, 0, 100);
+ var scaled = (int)NumericalHelpers.Scale(level, 0, 65535, 0, 100);
// The inputs to Scale ensure that byte won't overflow
SendBytes(new byte[] { 0xAA, 0x12, 0x00, 0x01, Convert.ToByte(scaled), 0x00 });
}
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- double Scale(double input, double inMin, double inMax, double outMin, double outMax)
- {
- //Debug.Console(2, this, "Scaling (double) input '{0}' with min '{1}'/max '{2}' to output range min '{3}'/max '{4}'", input, inMin, inMax, outMin, outMax);
-
- double inputRange = inMax - inMin;
-
- if (inputRange <= 0)
- {
- throw new ArithmeticException(string.Format("Invalid Input Range '{0}' for Scaling. Min '{1}' Max '{2}'.", inputRange, inMin, inMax));
- }
-
- double outputRange = outMax - outMin;
-
- var output = (((input - inMin) * outputRange) / inputRange) + outMin;
-
- // Debug.Console(2, this, "Scaled output '{0}'", output);
-
- return output;
- }
-
#region IBasicVolumeWithFeedback Members
public IntFeedback VolumeLevelFeedback { get; private set; }
diff --git a/Essentials/PepperDashEssentials/FOR REFERENCE Room/EssentialsRoom.cs b/Essentials/PepperDashEssentials/FOR REFERENCE Room/EssentialsRoom.cs
deleted file mode 100644
index 9dadf858..00000000
--- a/Essentials/PepperDashEssentials/FOR REFERENCE Room/EssentialsRoom.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-//using System;
-//using System.Collections.Generic;
-//using System.Linq;
-//using System.Text;
-//using Crestron.SimplSharp;
-//using Crestron.SimplSharpPro;
-
-//using PepperDash.Core;
-//using PepperDash.Essentials.Core;
-
-//namespace PepperDash.Essentials
-//{
-// //***************************************************************************************************
-// public abstract class EssentialsRoom : Room
-// {
-// public event EventHandler PresentationSourceChange;
-// public event EventHandler AudioDeviceWillChange;
-// public Dictionary Sources { get; protected set; }
-
-// public abstract BoolFeedback RoomIsOnStandby { get; protected set; }
-// public abstract BoolFeedback RoomIsOccupied { get; protected set; }
-
-// public uint UnattendedShutdownTimeMs { get; set; }
-
-// ///
-// /// For use when turning on room without a source selection - e.g. from
-// /// wake-on signal or occ sensor
-// ///
-// public SourceListItem DefaultPresentationSource { get; set; }
-
-//#warning This might need more "guts" and shouldn't be public
-// public SourceListItem CurrentPresentationSourceInfo { get; set; }
-
-// //public IPresentationSource CurrentPresentationSource { get; protected set; }
-// //{
-// // get
-// // {
-// // if (_CurrentPresentationSource == null)
-// // _CurrentPresentationSource = PresentationDevice.Default;
-// // return _CurrentPresentationSource;
-// // }
-// // protected set { _CurrentPresentationSource = value; }
-// //}
-// //IPresentationSource _CurrentPresentationSource;
-
-// ///
-// /// The volume control device for this room - changing it will trigger event
-// ///
-// public IBasicVolumeControls CurrentAudioDevice
-// {
-// get { return _CurrentAudioDevice; }
-// protected set
-// {
-// if (value != _CurrentAudioDevice)
-// if (AudioDeviceWillChange != null)
-// AudioDeviceWillChange(this,
-// new EssentialsRoomAudioDeviceChangeEventArgs(this, _CurrentAudioDevice, value));
-// _CurrentAudioDevice = value;
-// }
-// }
-// IBasicVolumeControls _CurrentAudioDevice;
-
-// public EssentialsRoom(string key, string name)
-// : base(key, name)
-// {
-// }
-
-// public virtual void SelectSource(uint sourceNum) { }
-
-// public virtual void SelectSource(IPresentationSource newSrc) { }
-
-// ///
-// /// Make sure that this is called before changing the source
-// ///
-// protected void OnPresentationSourceChange(SourceListItem currentSource, SourceListItem newSource)
-// {
-// var handler = PresentationSourceChange;
-// if (handler != null)
-// PresentationSourceChange(this,
-// new EssentialsRoomSourceChangeEventArgs(this, currentSource, newSource));
-// }
-// }
-
-//}
\ No newline at end of file
diff --git a/Essentials/PepperDashEssentials/FOR REFERENCE Room/RoomEventArgs.cs b/Essentials/PepperDashEssentials/FOR REFERENCE Room/RoomEventArgs.cs
deleted file mode 100644
index e8c648b2..00000000
--- a/Essentials/PepperDashEssentials/FOR REFERENCE Room/RoomEventArgs.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-//using System;
-//using System.Collections.Generic;
-//using System.Linq;
-//using System.Text;
-//using Crestron.SimplSharp;
-//using Crestron.SimplSharpPro;
-
-//using PepperDash.Core;
-//using PepperDash.Essentials.Core;
-
-//namespace PepperDash.Essentials
-//{
-// public class EssentialsRoomSourceChangeEventArgs : EventArgs
-// {
-// public EssentialsRoom Room { get; private set; }
-// public SourceListItem OldSource { get; private set; }
-// public SourceListItem NewSource { get; private set; }
-
-// public EssentialsRoomSourceChangeEventArgs(EssentialsRoom room,
-// SourceListItem oldSource, SourceListItem newSource)
-// {
-// Room = room;
-// OldSource = oldSource;
-// NewSource = newSource;
-// }
-// }
-
-
-
-// public class EssentialsRoomAudioDeviceChangeEventArgs : EventArgs
-// {
-// public EssentialsRoom Room { get; private set; }
-// public IBasicVolumeControls OldDevice { get; private set; }
-// public IBasicVolumeControls NewDevice { get; private set; }
-
-// public EssentialsRoomAudioDeviceChangeEventArgs(EssentialsRoom room,
-// IBasicVolumeControls oldDevice, IBasicVolumeControls newDevice)
-// {
-// Room = room;
-// OldDevice = oldDevice;
-// NewDevice = newDevice;
-// }
-// }
-
-//}
\ No newline at end of file
diff --git a/Essentials/PepperDashEssentials/PepperDashEssentials.csproj b/Essentials/PepperDashEssentials/PepperDashEssentials.csproj
index 3a68cb03..4e062dea 100644
--- a/Essentials/PepperDashEssentials/PepperDashEssentials.csproj
+++ b/Essentials/PepperDashEssentials/PepperDashEssentials.csproj
@@ -141,7 +141,6 @@
-
@@ -155,15 +154,13 @@
-
-
-
+
@@ -177,14 +174,14 @@
-
-
-
+
+
+
-
-
+
+
diff --git a/Essentials/PepperDashEssentials/UI/CrestronTouchpanelPropertiesConfig.cs b/Essentials/PepperDashEssentials/Room/UI/CrestronTouchpanelPropertiesConfig.cs
similarity index 100%
rename from Essentials/PepperDashEssentials/UI/CrestronTouchpanelPropertiesConfig.cs
rename to Essentials/PepperDashEssentials/Room/UI/CrestronTouchpanelPropertiesConfig.cs
diff --git a/Essentials/PepperDashEssentials/UI/DualDisplaySourceSRLController.cs b/Essentials/PepperDashEssentials/Room/UI/DualDisplaySourceSRLController.cs
similarity index 100%
rename from Essentials/PepperDashEssentials/UI/DualDisplaySourceSRLController.cs
rename to Essentials/PepperDashEssentials/Room/UI/DualDisplaySourceSRLController.cs
diff --git a/Essentials/PepperDashEssentials/UI/EssentialsTouchpanelController.cs b/Essentials/PepperDashEssentials/Room/UI/EssentialsTouchpanelController.cs
similarity index 95%
rename from Essentials/PepperDashEssentials/UI/EssentialsTouchpanelController.cs
rename to Essentials/PepperDashEssentials/Room/UI/EssentialsTouchpanelController.cs
index 89e5ea2d..8ad6ab1a 100644
--- a/Essentials/PepperDashEssentials/UI/EssentialsTouchpanelController.cs
+++ b/Essentials/PepperDashEssentials/Room/UI/EssentialsTouchpanelController.cs
@@ -1,224 +1,221 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Crestron.SimplSharp;
-using Crestron.SimplSharp.CrestronIO;
-using Crestron.SimplSharpPro;
-using Crestron.SimplSharpPro.DeviceSupport;
-using Crestron.SimplSharpPro.UI;
-using PepperDash.Core;
-using PepperDash.Essentials.Core;
-using PepperDash.Essentials.Core.PageManagers;
-
-namespace PepperDash.Essentials
-{
- public class EssentialsTouchpanelController : Device
- {
- public BasicTriListWithSmartObject Panel { get; private set; }
-
- public PanelDriverBase PanelDriver { get; private set; }
-
- CTimer BacklightTransitionedOnTimer;
-
- public EssentialsTouchpanelController(string key, string name, Tswx52ButtonVoiceControl tsw,
- string projectName, string sgdPath)
- : base(key, name)
- {
- Panel = tsw;
- tsw.LoadSmartObjects(sgdPath);
- tsw.SigChange += new Crestron.SimplSharpPro.DeviceSupport.SigEventHandler(Tsw_SigChange);
- }
-
- ///
- /// Config constructor
- ///
- public EssentialsTouchpanelController(string key, string name, string type, CrestronTouchpanelPropertiesConfig props, uint id)
- : base(key, name)
- {
- AddPostActivationAction(() =>
- {
- Debug.Console(2, this, "post-activation linking");
- type = type.ToLower();
- try
- {
- if (type == "crestronapp")
- {
- var app = new CrestronApp(id, Global.ControlSystem);
- app.ParameterProjectName.Value = props.ProjectName;
- Panel = app;
- }
- else if (type == "tsw560")
- Panel = new Tsw560(id, Global.ControlSystem);
- else if (type == "tsw752")
- Panel = new Tsw752(id, Global.ControlSystem);
- else if (type == "tsw1052")
- Panel = new Tsw1052(id, Global.ControlSystem);
- else
- {
- Debug.Console(0, this, "WARNING: Cannot create TSW controller with type '{0}'", type);
- return;
- }
- }
- catch (Exception e)
- {
- Debug.Console(0, this, "WARNING: Cannot create TSW base class. Panel will not function: {0}", e.Message);
- return;
- }
-
- // Reserved sigs
- if (Panel is TswFt5ButtonSystem)
- {
- var tsw = Panel as TswFt5ButtonSystem;
- tsw.ExtenderSystemReservedSigs.Use();
- tsw.ExtenderSystemReservedSigs.DeviceExtenderSigChange
- += ExtenderSystemReservedSigs_DeviceExtenderSigChange;
- }
-
- new CTimer(o =>
- {
- var regSuccess = Panel.Register();
- if (regSuccess != eDeviceRegistrationUnRegistrationResponse.Success)
- Debug.Console(0, this, "WARNING: Registration failed. Continuing, but panel may not function: {0}", regSuccess);
-
- // Give up cleanly if SGD is not present.
- var sgdName = @"\NVRAM\Program" + InitialParametersClass.ApplicationNumber
- + @"\sgd\" + props.SgdFile;
- if (!File.Exists(sgdName))
- {
- Debug.Console(0, this, "WARNING: Smart object file '{0}' not present. Exiting TSW load", sgdName);
- return;
- }
-
- Panel.LoadSmartObjects(sgdName);
- Panel.SigChange += Tsw_SigChange;
-
- var mainDriver = new EssentialsPanelMainInterfaceDriver(Panel, props);
- // Then the AV driver
-
- // spin up different room drivers depending on room type
- var room = DeviceManager.GetDeviceForKey(props.DefaultRoomKey);
- if (room is EssentialsHuddleSpaceRoom)
- {
- Debug.Console(0, this, "Adding huddle space driver");
- var avDriver = new EssentialsHuddlePanelAvFunctionsDriver(mainDriver, props);
- avDriver.CurrentRoom = room as EssentialsHuddleSpaceRoom;
- avDriver.DefaultRoomKey = props.DefaultRoomKey;
- mainDriver.AvDriver = avDriver;
- LoadAndShowDriver(mainDriver); // This is a little convoluted.
-
- if (Panel is TswFt5ButtonSystem)
- {
- var tsw = Panel as TswFt5ButtonSystem;
- // Wire up hard keys
- tsw.Power.UserObject = new Action(b => { if (!b) avDriver.PowerButtonPressed(); });
- //tsw.Home.UserObject = new Action(b => { if (!b) HomePressed(); });
- tsw.Up.UserObject = new Action(avDriver.VolumeUpPress);
- tsw.Down.UserObject = new Action(avDriver.VolumeDownPress);
- tsw.ButtonStateChange += new ButtonEventHandler(Tsw_ButtonStateChange);
- }
- }
- else if (room is EssentialsPresentationRoom)
- {
- Debug.Console(0, this, "Adding presentation room driver");
- var avDriver = new EssentialsPresentationPanelAvFunctionsDriver(mainDriver, props);
- avDriver.CurrentRoom = room as EssentialsPresentationRoom;
- avDriver.DefaultRoomKey = props.DefaultRoomKey;
- mainDriver.AvDriver = avDriver;
- LoadAndShowDriver(mainDriver);
-
- if (Panel is TswFt5ButtonSystem)
- {
- var tsw = Panel as TswFt5ButtonSystem;
- // Wire up hard keys
- tsw.Power.UserObject = new Action(b => { if (!b) avDriver.PowerButtonPressed(); });
- //tsw.Home.UserObject = new Action(b => { if (!b) HomePressed(); });
- tsw.Up.UserObject = new Action(avDriver.VolumeUpPress);
- tsw.Down.UserObject = new Action(avDriver.VolumeDownPress);
- tsw.ButtonStateChange += new ButtonEventHandler(Tsw_ButtonStateChange);
- }
- }
- else
- {
- Debug.Console(0, this, "ERROR: Cannot load AvFunctionsDriver for room '{0}'", props.DefaultRoomKey);
- }
- }, 0);
- });
- }
-
- public void LoadAndShowDriver(PanelDriverBase driver)
- {
- PanelDriver = driver;
- driver.Show();
- }
-
- void HomePressed()
- {
- if (BacklightTransitionedOnTimer != null)
- Debug.Console(2, this, "Home pressed from dark screen");
- else
- PanelDriver.BackButtonPressed();
- }
-
-
- void ExtenderSystemReservedSigs_DeviceExtenderSigChange(DeviceExtender currentDeviceExtender, SigEventArgs args)
- {
- // If the sig is transitioning on, mark it in case it was home button that transitioned it
- var blOnSig = (Panel as TswFt5ButtonSystem).ExtenderSystemReservedSigs.BacklightOnFeedback;
- if (args.Sig == blOnSig && blOnSig.BoolValue)
- {
- Debug.Console(2, this, "Backlight transitioning on");
- BacklightTransitionedOnTimer = new CTimer(o =>
- {
- BacklightTransitionedOnTimer = null;
- }, 200);
- }
- }
-
- public void PulseBool(uint join)
- {
- var act = Panel.BooleanInput[join].UserObject as Action;
- if (act != null)
- {
- act(true);
- act(false);
- }
- }
-
- public void SetBoolSig(uint join, bool value)
- {
- var act = Panel.BooleanInput[join].UserObject as Action;
- if (act != null)
- act(value);
- }
-
- public void SetIntSig(uint join, ushort value)
- {
- var act = Panel.BooleanInput[join].UserObject as Action;
- if (act != null)
- {
- act(value);
- }
- }
-
- void Tsw_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
- {
- if (Debug.Level == 2)
- Debug.Console(2, this, "Sig change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
- var uo = args.Sig.UserObject;
- if (uo is Action)
- (uo as Action)(args.Sig.BoolValue);
- else if (uo is Action)
- (uo as Action)(args.Sig.UShortValue);
- else if (uo is Action)
- (uo as Action)(args.Sig.StringValue);
- }
-
- void Tsw_ButtonStateChange(GenericBase device, ButtonEventArgs args)
- {
- var uo = args.Button.UserObject;
- if(uo is Action)
- (uo as Action)(args.Button.State == eButtonState.Pressed);
- }
- }
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Crestron.SimplSharp;
+using Crestron.SimplSharp.CrestronIO;
+using Crestron.SimplSharpPro;
+using Crestron.SimplSharpPro.DeviceSupport;
+using Crestron.SimplSharpPro.UI;
+using PepperDash.Core;
+using PepperDash.Essentials.Core;
+using PepperDash.Essentials.Core.PageManagers;
+
+namespace PepperDash.Essentials
+{
+ public class EssentialsTouchpanelController : Device
+ {
+ public BasicTriListWithSmartObject Panel { get; private set; }
+
+ public PanelDriverBase PanelDriver { get; private set; }
+
+ CTimer BacklightTransitionedOnTimer;
+
+ public EssentialsTouchpanelController(string key, string name, Tswx52ButtonVoiceControl tsw,
+ string projectName, string sgdPath)
+ : base(key, name)
+ {
+ Panel = tsw;
+ tsw.LoadSmartObjects(sgdPath);
+ tsw.SigChange += new Crestron.SimplSharpPro.DeviceSupport.SigEventHandler(Tsw_SigChange);
+ }
+
+ ///
+ /// Config constructor
+ ///
+ public EssentialsTouchpanelController(string key, string name, string type, CrestronTouchpanelPropertiesConfig props, uint id)
+ : base(key, name)
+ {
+ AddPostActivationAction(() =>
+ {
+ Debug.Console(0, this, "post-activation linking");
+ type = type.ToLower();
+ try
+ {
+ if (type == "crestronapp")
+ {
+ var app = new CrestronApp(id, Global.ControlSystem);
+ app.ParameterProjectName.Value = props.ProjectName;
+ Panel = app;
+ }
+ else if (type == "tsw560")
+ Panel = new Tsw560(id, Global.ControlSystem);
+ else if (type == "tsw752")
+ Panel = new Tsw752(id, Global.ControlSystem);
+ else if (type == "tsw1052")
+ Panel = new Tsw1052(id, Global.ControlSystem);
+ else
+ {
+ Debug.Console(0, this, "WARNING: Cannot create TSW controller with type '{0}'", type);
+ return;
+ }
+ }
+ catch (Exception e)
+ {
+ Debug.Console(0, this, "WARNING: Cannot create TSW base class. Panel will not function: {0}", e.Message);
+ return;
+ }
+
+ // Reserved sigs
+ if (Panel is TswFt5ButtonSystem)
+ {
+ var tsw = Panel as TswFt5ButtonSystem;
+ tsw.ExtenderSystemReservedSigs.Use();
+ tsw.ExtenderSystemReservedSigs.DeviceExtenderSigChange
+ += ExtenderSystemReservedSigs_DeviceExtenderSigChange;
+ }
+
+ new CTimer(o =>
+ {
+ var regSuccess = Panel.Register();
+ if (regSuccess != eDeviceRegistrationUnRegistrationResponse.Success)
+ Debug.Console(0, this, "WARNING: Registration failed. Continuing, but panel may not function: {0}", regSuccess);
+
+ // Give up cleanly if SGD is not present.
+ var sgdName = @"\NVRAM\Program" + InitialParametersClass.ApplicationNumber
+ + @"\sgd\" + props.SgdFile;
+ if (!File.Exists(sgdName))
+ {
+ Debug.Console(0, this, "WARNING: Smart object file '{0}' not present. Exiting TSW load", sgdName);
+ return;
+ }
+
+ Panel.LoadSmartObjects(sgdName);
+ Panel.SigChange += Tsw_SigChange;
+
+ var mainDriver = new EssentialsPanelMainInterfaceDriver(Panel, props);
+ // Then the AV driver
+
+ // spin up different room drivers depending on room type
+ var room = DeviceManager.GetDeviceForKey(props.DefaultRoomKey);
+ if (room is EssentialsHuddleSpaceRoom)
+ {
+ Debug.Console(0, this, "Adding huddle space driver");
+ var avDriver = new EssentialsHuddlePanelAvFunctionsDriver(mainDriver, props);
+ avDriver.CurrentRoom = room as EssentialsHuddleSpaceRoom;
+ avDriver.DefaultRoomKey = props.DefaultRoomKey;
+ mainDriver.AvDriver = avDriver;
+ LoadAndShowDriver(mainDriver); // This is a little convoluted.
+
+ if (Panel is TswFt5ButtonSystem)
+ {
+ var tsw = Panel as TswFt5ButtonSystem;
+ // Wire up hard keys
+ tsw.Power.UserObject = new Action(b => { if (!b) avDriver.PowerButtonPressed(); });
+ //tsw.Home.UserObject = new Action(b => { if (!b) HomePressed(); });
+ tsw.Up.UserObject = new Action(avDriver.VolumeUpPress);
+ tsw.Down.UserObject = new Action(avDriver.VolumeDownPress);
+ tsw.ButtonStateChange += new ButtonEventHandler(Tsw_ButtonStateChange);
+ }
+ }
+ else if (room is EssentialsPresentationRoom)
+ {
+ Debug.Console(0, this, "Adding presentation room driver");
+ var avDriver = new EssentialsPresentationPanelAvFunctionsDriver(mainDriver, props);
+ avDriver.CurrentRoom = room as EssentialsPresentationRoom;
+ avDriver.DefaultRoomKey = props.DefaultRoomKey;
+ mainDriver.AvDriver = avDriver;
+ LoadAndShowDriver(mainDriver);
+
+ if (Panel is TswFt5ButtonSystem)
+ {
+ var tsw = Panel as TswFt5ButtonSystem;
+ // Wire up hard keys
+ tsw.Power.UserObject = new Action(b => { if (!b) avDriver.PowerButtonPressed(); });
+ //tsw.Home.UserObject = new Action(b => { if (!b) HomePressed(); });
+ tsw.Up.UserObject = new Action(avDriver.VolumeUpPress);
+ tsw.Down.UserObject = new Action(avDriver.VolumeDownPress);
+ tsw.ButtonStateChange += new ButtonEventHandler(Tsw_ButtonStateChange);
+ }
+ }
+ else
+ {
+ Debug.Console(0, this, "ERROR: Cannot load AvFunctionsDriver for room '{0}'", props.DefaultRoomKey);
+ }
+ }, 0);
+ });
+ }
+
+ public void LoadAndShowDriver(PanelDriverBase driver)
+ {
+ PanelDriver = driver;
+ driver.Show();
+ }
+
+ void HomePressed()
+ {
+ if (BacklightTransitionedOnTimer == null)
+ PanelDriver.BackButtonPressed();
+ }
+
+
+ void ExtenderSystemReservedSigs_DeviceExtenderSigChange(DeviceExtender currentDeviceExtender, SigEventArgs args)
+ {
+ // If the sig is transitioning on, mark it in case it was home button that transitioned it
+ var blOnSig = (Panel as TswFt5ButtonSystem).ExtenderSystemReservedSigs.BacklightOnFeedback;
+ if (args.Sig == blOnSig && blOnSig.BoolValue)
+ {
+ BacklightTransitionedOnTimer = new CTimer(o =>
+ {
+ BacklightTransitionedOnTimer = null;
+ }, 200);
+ }
+ }
+
+ public void PulseBool(uint join)
+ {
+ var act = Panel.BooleanInput[join].UserObject as Action;
+ if (act != null)
+ {
+ act(true);
+ act(false);
+ }
+ }
+
+ public void SetBoolSig(uint join, bool value)
+ {
+ var act = Panel.BooleanInput[join].UserObject as Action;
+ if (act != null)
+ act(value);
+ }
+
+ public void SetIntSig(uint join, ushort value)
+ {
+ var act = Panel.BooleanInput[join].UserObject as Action;
+ if (act != null)
+ {
+ act(value);
+ }
+ }
+
+ void Tsw_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
+ {
+ if (Debug.Level == 2)
+ Debug.Console(2, this, "Sig change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
+ var uo = args.Sig.UserObject;
+ if (uo is Action)
+ (uo as Action)(args.Sig.BoolValue);
+ else if (uo is Action)
+ (uo as Action)(args.Sig.UShortValue);
+ else if (uo is Action)
+ (uo as Action)(args.Sig.StringValue);
+ }
+
+ void Tsw_ButtonStateChange(GenericBase device, ButtonEventArgs args)
+ {
+ var uo = args.Button.UserObject;
+ if(uo is Action)
+ (uo as Action)(args.Button.State == eButtonState.Pressed);
+ }
+ }
}
\ No newline at end of file
diff --git a/Essentials/PepperDashEssentials/UI/SubpageReferenceListActivityItem.cs b/Essentials/PepperDashEssentials/Room/UI/SubpageReferenceListActivityItem.cs
similarity index 100%
rename from Essentials/PepperDashEssentials/UI/SubpageReferenceListActivityItem.cs
rename to Essentials/PepperDashEssentials/Room/UI/SubpageReferenceListActivityItem.cs
diff --git a/Essentials/PepperDashEssentials/UI/SubpageReferenceListSourceItem.cs b/Essentials/PepperDashEssentials/Room/UI/SubpageReferenceListSourceItem.cs
similarity index 100%
rename from Essentials/PepperDashEssentials/UI/SubpageReferenceListSourceItem.cs
rename to Essentials/PepperDashEssentials/Room/UI/SubpageReferenceListSourceItem.cs
diff --git a/Essentials/PepperDashEssentials/UI Drivers/EssentialsHuddlePanelAvFunctionsDriver.cs b/Essentials/PepperDashEssentials/UI Drivers/EssentialsHuddlePanelAvFunctionsDriver.cs
index bff1725d..ea1edd48 100644
--- a/Essentials/PepperDashEssentials/UI Drivers/EssentialsHuddlePanelAvFunctionsDriver.cs
+++ b/Essentials/PepperDashEssentials/UI Drivers/EssentialsHuddlePanelAvFunctionsDriver.cs
@@ -334,6 +334,7 @@ namespace PepperDash.Essentials
ActivityFooterSrl.Count = 2;
TriList.UShortInput[UIUshortJoin.PresentationListCaretMode].UShortValue = 1;
EndMeetingButtonSig = ActivityFooterSrl.BoolInputSig(2, 1);
+ ShareButtonSig.BoolValue = CurrentRoom.OnFeedback.BoolValue;
}
///
@@ -529,7 +530,7 @@ namespace PepperDash.Essentials
///
void ShutdownPromptTimer_HasFinished(object sender, EventArgs e)
{
- Debug.Console(2, "*#*UI shutdown prompt finished");
+ //Debug.Console(2, "*#*UI shutdown prompt finished");
EndMeetingButtonSig.BoolValue = false;
CurrentRoom.ShutdownPromptTimer.TimeRemainingFeedback.OutputChange -= ShutdownPromptTimer_TimeRemainingFeedback_OutputChange;
CurrentRoom.ShutdownPromptTimer.PercentFeedback.OutputChange -= ShutdownPromptTimer_PercentFeedback_OutputChange;
@@ -543,10 +544,11 @@ namespace PepperDash.Essentials
///
void ShutdownPromptTimer_WasCancelled(object sender, EventArgs e)
{
- Debug.Console(2, "*#*UI shutdown prompt cancelled");
+ //Debug.Console(2, "*#*UI shutdown prompt cancelled");
if (PowerDownModal != null)
PowerDownModal.HideDialog();
EndMeetingButtonSig.BoolValue = false;
+ ShareButtonSig.BoolValue = CurrentRoom.OnFeedback.BoolValue;
CurrentRoom.ShutdownPromptTimer.TimeRemainingFeedback.OutputChange += ShutdownPromptTimer_TimeRemainingFeedback_OutputChange;
CurrentRoom.ShutdownPromptTimer.PercentFeedback.OutputChange -= ShutdownPromptTimer_PercentFeedback_OutputChange;
@@ -663,7 +665,7 @@ namespace PepperDash.Essentials
var actualSource = DeviceManager.GetDeviceForKey(srcConfig.SourceKey) as Device;
if (actualSource == null)
{
- Debug.Console(0, "Cannot assign missing source '{0}' to source UI list",
+ Debug.Console(1, "Cannot assign missing source '{0}' to source UI list",
srcConfig.SourceKey);
continue;
}
@@ -679,13 +681,11 @@ namespace PepperDash.Essentials
TriList.StringInput[UIStringJoin.CurrentRoomName].StringValue = _CurrentRoom.Name;
if (_CurrentRoom.LogoUrl == null)
{
- Debug.Console(2, _CurrentRoom, "Using default logo");
TriList.BooleanInput[UIBoolJoin.LogoDefaultVisible].BoolValue = true;
TriList.BooleanInput[UIBoolJoin.LogoUrlVisible].BoolValue = false;
}
else
{
- Debug.Console(2, _CurrentRoom, "Using logo at URL: {0}", _CurrentRoom.LogoUrl);
TriList.BooleanInput[UIBoolJoin.LogoDefaultVisible].BoolValue = false;
TriList.BooleanInput[UIBoolJoin.LogoUrlVisible].BoolValue = true;
TriList.StringInput[UIStringJoin.LogoUrl].StringValue = _CurrentRoom.LogoUrl;
@@ -697,7 +697,6 @@ namespace PepperDash.Essentials
_CurrentRoom.ShutdownPromptTimer.WasCancelled += ShutdownPromptTimer_WasCancelled;
// Link up all the change events from the room
- Debug.Console(2, "UI -- Room is already on={0} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%", _CurrentRoom.OnFeedback.BoolValue);
_CurrentRoom.OnFeedback.OutputChange += CurrentRoom_OnFeedback_OutputChange;
CurrentRoom_SyncOnFeedback();
_CurrentRoom.IsWarmingUpFeedback.OutputChange += CurrentRoom_IsWarmingFeedback_OutputChange;
@@ -726,7 +725,7 @@ namespace PepperDash.Essentials
void CurrentRoom_SyncOnFeedback()
{
var value = _CurrentRoom.OnFeedback.BoolValue;
- Debug.Console(2, CurrentRoom, "UI: Is on event={0}", value);
+ //Debug.Console(2, CurrentRoom, "UI: Is on event={0}", value);
TriList.BooleanInput[UIBoolJoin.RoomIsOn].BoolValue = value;
if (value) //ON
@@ -736,6 +735,7 @@ namespace PepperDash.Essentials
TriList.BooleanInput[UIBoolJoin.StagingPageVisible].BoolValue = true;
TriList.BooleanInput[UIBoolJoin.StartPageVisible].BoolValue = false;
TriList.BooleanInput[UIBoolJoin.VolumeSingleMute1Visible].BoolValue = true;
+
}
else
{
@@ -752,7 +752,7 @@ namespace PepperDash.Essentials
void CurrentRoom_IsWarmingFeedback_OutputChange(object sender, EventArgs e)
{
var value = CurrentRoom.IsWarmingUpFeedback.BoolValue;
- Debug.Console(2, CurrentRoom, "UI: WARMING event={0}", value);
+ //Debug.Console(2, CurrentRoom, "UI: WARMING event={0}", value);
if (value)
{
@@ -771,7 +771,7 @@ namespace PepperDash.Essentials
void IsCoolingDownFeedback_OutputChange(object sender, EventArgs e)
{
var value = CurrentRoom.IsCoolingDownFeedback.BoolValue;
- Debug.Console(2, CurrentRoom, "UI: Cooldown event={0}", value);
+ //Debug.Console(2, CurrentRoom, "UI: Cooldown event={0}", value);
if (value)
{
diff --git a/Essentials/PepperDashEssentials/Room/VolumeAndSourceChangeArgs.cs b/Essentials/PepperDashEssentials/UI Drivers/VolumeAndSourceChangeArgs.cs
similarity index 100%
rename from Essentials/PepperDashEssentials/Room/VolumeAndSourceChangeArgs.cs
rename to Essentials/PepperDashEssentials/UI Drivers/VolumeAndSourceChangeArgs.cs
diff --git a/Release Package/PepperDashEssentials.cpz b/Release Package/PepperDashEssentials.cpz
index d2e28568..49199624 100644
Binary files a/Release Package/PepperDashEssentials.cpz and b/Release Package/PepperDashEssentials.cpz differ
diff --git a/Release Package/PepperDashEssentials.dll b/Release Package/PepperDashEssentials.dll
index 231641c7..99e13b35 100644
Binary files a/Release Package/PepperDashEssentials.dll and b/Release Package/PepperDashEssentials.dll differ