mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 05:05:00 +00:00
Fixed volume up/down; Working on linking display power fb to room on fb
This commit is contained in:
@@ -40,8 +40,8 @@ namespace PepperDash.Essentials.Core
|
|||||||
{
|
{
|
||||||
if (pollTime > warningTime || pollTime > errorTime)
|
if (pollTime > warningTime || pollTime > errorTime)
|
||||||
throw new ArgumentException("pollTime must be less than warning or errorTime");
|
throw new ArgumentException("pollTime must be less than warning or errorTime");
|
||||||
if (pollTime < 5000)
|
//if (pollTime < 5000)
|
||||||
throw new ArgumentException("pollTime cannot be less than 5000 ms");
|
// throw new ArgumentException("pollTime cannot be less than 5000 ms");
|
||||||
|
|
||||||
Client = client;
|
Client = client;
|
||||||
PollTime = pollTime;
|
PollTime = pollTime;
|
||||||
@@ -63,8 +63,8 @@ namespace PepperDash.Essentials.Core
|
|||||||
{
|
{
|
||||||
if (pollTime > warningTime || pollTime > errorTime)
|
if (pollTime > warningTime || pollTime > errorTime)
|
||||||
throw new ArgumentException("pollTime must be less than warning or errorTime");
|
throw new ArgumentException("pollTime must be less than warning or errorTime");
|
||||||
if (pollTime < 5000)
|
//if (pollTime < 5000)
|
||||||
throw new ArgumentException("pollTime cannot be less than 5000 ms");
|
// throw new ArgumentException("pollTime cannot be less than 5000 ms");
|
||||||
|
|
||||||
Client = client;
|
Client = client;
|
||||||
PollTime = pollTime;
|
PollTime = pollTime;
|
||||||
@@ -112,7 +112,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
StartErrorTimers();
|
StartErrorTimers();
|
||||||
if (Client.IsConnected)
|
if (Client.IsConnected)
|
||||||
{
|
{
|
||||||
Debug.Console(2, Client, "Monitor, Polling");
|
Debug.Console(2, this, "Polling");
|
||||||
if(PollAction != null)
|
if(PollAction != null)
|
||||||
PollAction.Invoke();
|
PollAction.Invoke();
|
||||||
else
|
else
|
||||||
@@ -120,7 +120,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.Console(2, Client, "Monitor, Comm not connected");
|
Debug.Console(2, this, "Comm not connected");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
if (Client.IsConnected)
|
if (Client.IsConnected)
|
||||||
{
|
{
|
||||||
//Client.IsConnected -= OneTimeConnectHandler;
|
//Client.IsConnected -= OneTimeConnectHandler;
|
||||||
Debug.Console(2, Client, "Monitor, Comm connected");
|
Debug.Console(2, this, "Comm connected");
|
||||||
Poll();
|
Poll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,6 +99,7 @@
|
|||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Ramps and Increments\ActionIncrementer.cs" />
|
||||||
<Compile Include="Comm and IR\CommFactory.cs" />
|
<Compile Include="Comm and IR\CommFactory.cs" />
|
||||||
<Compile Include="Comm and IR\CommunicationExtras.cs" />
|
<Compile Include="Comm and IR\CommunicationExtras.cs" />
|
||||||
<Compile Include="Comm and IR\REMOVE ComPortConfig.cs" />
|
<Compile Include="Comm and IR\REMOVE ComPortConfig.cs" />
|
||||||
@@ -132,6 +133,7 @@
|
|||||||
<Compile Include="Devices\IVolumeAndAudioInterfaces.cs" />
|
<Compile Include="Devices\IVolumeAndAudioInterfaces.cs" />
|
||||||
<Compile Include="Display\BasicIrDisplay.cs" />
|
<Compile Include="Display\BasicIrDisplay.cs" />
|
||||||
<Compile Include="Feedbacks\BoolFeedbackOneShot.cs" />
|
<Compile Include="Feedbacks\BoolFeedbackOneShot.cs" />
|
||||||
|
<Compile Include="Ramps and Increments\UshortSigIncrementer.cs" />
|
||||||
<Compile Include="Routing\ICardPortsDevice.cs" />
|
<Compile Include="Routing\ICardPortsDevice.cs" />
|
||||||
<Compile Include="InUseTracking\IInUseTracking.cs" />
|
<Compile Include="InUseTracking\IInUseTracking.cs" />
|
||||||
<Compile Include="InUseTracking\InUseTracking.cs" />
|
<Compile Include="InUseTracking\InUseTracking.cs" />
|
||||||
|
|||||||
Binary file not shown.
@@ -0,0 +1,120 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An incrementer that can use the values of some other object/primitive value to do its thing.
|
||||||
|
/// It uses an Action to set the value and a Func to get the value from whatever this is
|
||||||
|
/// attached to.
|
||||||
|
/// </summary>
|
||||||
|
public class ActionIncrementer
|
||||||
|
{
|
||||||
|
public int ChangeAmount { get; set; }
|
||||||
|
public int MaxValue { get; set; }
|
||||||
|
public int MinValue { get; set; }
|
||||||
|
public uint RepeatDelay { get; set; }
|
||||||
|
public uint RepeatTime { get; set; }
|
||||||
|
|
||||||
|
Action<int> SetAction;
|
||||||
|
Func<int> GetFunc;
|
||||||
|
CTimer Timer;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="changeAmount"></param>
|
||||||
|
/// <param name="minValue"></param>
|
||||||
|
/// <param name="maxValue"></param>
|
||||||
|
/// <param name="repeatDelay"></param>
|
||||||
|
/// <param name="repeatTime"></param>
|
||||||
|
/// <param name="setAction">Action that will be called when this needs to set the destination value</param>
|
||||||
|
/// <param name="getFunc">Func that is called to get the current value</param>
|
||||||
|
public ActionIncrementer(int changeAmount, int minValue, int maxValue, uint repeatDelay, uint repeatTime, Action<int> setAction, Func<int> getFunc)
|
||||||
|
{
|
||||||
|
SetAction = setAction;
|
||||||
|
GetFunc = getFunc;
|
||||||
|
ChangeAmount = changeAmount;
|
||||||
|
MaxValue = maxValue;
|
||||||
|
MinValue = minValue;
|
||||||
|
RepeatDelay = repeatDelay;
|
||||||
|
RepeatTime = repeatTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Starts incrementing cycle
|
||||||
|
/// </summary>
|
||||||
|
public void StartUp()
|
||||||
|
{
|
||||||
|
if (Timer != null) return;
|
||||||
|
Go(ChangeAmount);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Starts decrementing cycle
|
||||||
|
/// </summary>
|
||||||
|
public void StartDown()
|
||||||
|
{
|
||||||
|
if (Timer != null) return;
|
||||||
|
Go(-ChangeAmount);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stops the repeat
|
||||||
|
/// </summary>
|
||||||
|
public void Stop()
|
||||||
|
{
|
||||||
|
if (Timer != null)
|
||||||
|
Timer.Stop();
|
||||||
|
Timer = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper that does the work of setting new level, and starting repeat loop, checking against bounds first.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="change"></param>
|
||||||
|
void Go(int change)
|
||||||
|
{
|
||||||
|
int currentLevel = GetFunc();
|
||||||
|
// Fire once then pause
|
||||||
|
int newLevel = currentLevel + change;
|
||||||
|
bool atLimit = CheckLevel(newLevel, out newLevel);
|
||||||
|
SetAction(newLevel);
|
||||||
|
|
||||||
|
if (atLimit) // Don't go past end
|
||||||
|
Stop();
|
||||||
|
else if (Timer == null) // Only enter the timer if it's not already running
|
||||||
|
Timer = new CTimer(o => { Go(change); }, null, RepeatDelay, RepeatTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper to check a new level against min/max. Returns revised level if new level
|
||||||
|
/// will go out of bounds
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="levelIn">The level to check against bounds</param>
|
||||||
|
/// <param name="levelOut">Revised level if bounds are exceeded. Min or max</param>
|
||||||
|
/// <returns>true if new level is at or past bounds</returns>
|
||||||
|
bool CheckLevel(int levelIn, out int levelOut)
|
||||||
|
{
|
||||||
|
bool isAtLimit = false;
|
||||||
|
if (levelIn > MaxValue)
|
||||||
|
{
|
||||||
|
levelOut = MaxValue;
|
||||||
|
isAtLimit = true;
|
||||||
|
}
|
||||||
|
else if (levelIn < MinValue)
|
||||||
|
{
|
||||||
|
levelOut = MinValue;
|
||||||
|
isAtLimit = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
levelOut = levelIn;
|
||||||
|
return isAtLimit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Attaches to UShortInputSig and does incremental ramping of the signal
|
||||||
|
/// </summary>
|
||||||
|
public class UshortSigIncrementer
|
||||||
|
{
|
||||||
|
UShortInputSig TheSig;
|
||||||
|
public ushort ChangeAmount { get; set; }
|
||||||
|
public int MaxValue { get; set; }
|
||||||
|
public int MinValue { get; set; }
|
||||||
|
public uint RepeatDelay { get; set; }
|
||||||
|
public uint RepeatTime { get; set; }
|
||||||
|
bool SignedMode;
|
||||||
|
CTimer Timer;
|
||||||
|
|
||||||
|
public UshortSigIncrementer(UShortInputSig sig, ushort changeAmount, int minValue, int maxValue, uint repeatDelay, uint repeatTime)
|
||||||
|
{
|
||||||
|
TheSig = sig;
|
||||||
|
ChangeAmount = changeAmount;
|
||||||
|
MaxValue = maxValue;
|
||||||
|
MinValue = minValue;
|
||||||
|
if (MinValue < 0 || MaxValue < 0) SignedMode = true;
|
||||||
|
RepeatDelay = repeatDelay;
|
||||||
|
RepeatTime = repeatTime;
|
||||||
|
if (SignedMode && (MinValue < -32768 || MaxValue > 32767))
|
||||||
|
Debug.Console(1, "UshortSigIncrementer has signed values that exceed range of -32768, 32767");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartUp()
|
||||||
|
{
|
||||||
|
if (Timer != null) return;
|
||||||
|
Go(ChangeAmount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartDown()
|
||||||
|
{
|
||||||
|
if (Timer != null) return;
|
||||||
|
Go(-ChangeAmount);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Go(int change)
|
||||||
|
{
|
||||||
|
int level;
|
||||||
|
if (SignedMode) level = TheSig.ShortValue;
|
||||||
|
else level = TheSig.UShortValue;
|
||||||
|
|
||||||
|
// Fire once then pause
|
||||||
|
int newLevel = level + change;
|
||||||
|
bool atLimit = CheckLevel(newLevel, out newLevel);
|
||||||
|
SetValue((ushort)newLevel);
|
||||||
|
|
||||||
|
|
||||||
|
if (atLimit) // Don't go past end
|
||||||
|
Stop();
|
||||||
|
else if (Timer == null) // Only enter the timer if it's not already running
|
||||||
|
Timer = new CTimer(o => { Go(change); }, null, RepeatDelay, RepeatTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CheckLevel(int levelIn, out int levelOut)
|
||||||
|
{
|
||||||
|
bool IsAtLimit = false;
|
||||||
|
if (levelIn > MaxValue)
|
||||||
|
{
|
||||||
|
levelOut = MaxValue;
|
||||||
|
IsAtLimit = true;
|
||||||
|
}
|
||||||
|
else if (levelIn < MinValue)
|
||||||
|
{
|
||||||
|
levelOut = MinValue;
|
||||||
|
IsAtLimit = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
levelOut = levelIn;
|
||||||
|
return IsAtLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Stop()
|
||||||
|
{
|
||||||
|
if (Timer != null)
|
||||||
|
Timer.Stop();
|
||||||
|
Timer = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetValue(ushort value)
|
||||||
|
{
|
||||||
|
//CrestronConsole.PrintLine("Increment level:{0} / {1}", value, (short)value);
|
||||||
|
TheSig.UShortValue = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -69,93 +69,4 @@ namespace PepperDash.Essentials.Core
|
|||||||
sig.CreateRamp(level, time / 10);
|
sig.CreateRamp(level, time / 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Attaches to UShortInputSig and does incremental ramping of the signal
|
|
||||||
/// </summary>
|
|
||||||
public class UshortSigIncrementer
|
|
||||||
{
|
|
||||||
UShortInputSig TheSig;
|
|
||||||
public ushort ChangeAmount { get; set; }
|
|
||||||
public int MaxValue { get; set; }
|
|
||||||
public int MinValue { get; set; }
|
|
||||||
public uint RepeatDelay { get; set; }
|
|
||||||
public uint RepeatTime { get; set; }
|
|
||||||
bool SignedMode;
|
|
||||||
CTimer Timer;
|
|
||||||
|
|
||||||
public UshortSigIncrementer(UShortInputSig sig, ushort changeAmount, int minValue, int maxValue, uint repeatDelay, uint repeatTime)
|
|
||||||
{
|
|
||||||
TheSig = sig;
|
|
||||||
ChangeAmount = changeAmount;
|
|
||||||
MaxValue = maxValue;
|
|
||||||
MinValue = minValue;
|
|
||||||
if (MinValue < 0 || MaxValue < 0) SignedMode = true;
|
|
||||||
RepeatDelay = repeatDelay;
|
|
||||||
RepeatTime = repeatTime;
|
|
||||||
if (SignedMode && (MinValue < -32768 || MaxValue > 32767))
|
|
||||||
Debug.Console(1, "UshortSigIncrementer has signed values that exceed range of -32768, 32767");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void StartUp()
|
|
||||||
{
|
|
||||||
if (Timer != null) return;
|
|
||||||
Go(ChangeAmount);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void StartDown()
|
|
||||||
{
|
|
||||||
if (Timer != null) return;
|
|
||||||
Go(-ChangeAmount);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Go(int change)
|
|
||||||
{
|
|
||||||
int level;
|
|
||||||
if (SignedMode) level = TheSig.ShortValue;
|
|
||||||
else level = TheSig.UShortValue;
|
|
||||||
|
|
||||||
// Fire once then pause
|
|
||||||
int newLevel = level + change;
|
|
||||||
bool atLimit = CheckLevel(newLevel, out newLevel);
|
|
||||||
SetValue((ushort)newLevel);
|
|
||||||
|
|
||||||
|
|
||||||
if (atLimit) // Don't go past end
|
|
||||||
Stop();
|
|
||||||
else if (Timer == null) // Only enter the timer if it's not already running
|
|
||||||
Timer = new CTimer(o => { Go(change); }, null, RepeatDelay, RepeatTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CheckLevel(int levelIn, out int levelOut)
|
|
||||||
{
|
|
||||||
bool IsAtLimit = false;
|
|
||||||
if (levelIn > MaxValue)
|
|
||||||
{
|
|
||||||
levelOut = MaxValue;
|
|
||||||
IsAtLimit = true;
|
|
||||||
}
|
|
||||||
else if (levelIn < MinValue)
|
|
||||||
{
|
|
||||||
levelOut = MinValue;
|
|
||||||
IsAtLimit = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
levelOut = levelIn;
|
|
||||||
return IsAtLimit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Stop()
|
|
||||||
{
|
|
||||||
if (Timer != null)
|
|
||||||
Timer.Stop();
|
|
||||||
Timer = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetValue(ushort value)
|
|
||||||
{
|
|
||||||
//CrestronConsole.PrintLine("Increment level:{0} / {1}", value, (short)value);
|
|
||||||
TheSig.UShortValue = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Binary file not shown.
@@ -24,11 +24,13 @@ namespace PepperDash.Essentials.Devices.Displays
|
|||||||
bool _PowerIsOn;
|
bool _PowerIsOn;
|
||||||
bool _IsWarmingUp;
|
bool _IsWarmingUp;
|
||||||
bool _IsCoolingDown;
|
bool _IsCoolingDown;
|
||||||
ushort _VolumeLevel;
|
ushort _VolumeLevelForSig;
|
||||||
|
int _LastVolumeSent;
|
||||||
bool _IsMuted;
|
bool _IsMuted;
|
||||||
RoutingInputPort _CurrentInputPort;
|
RoutingInputPort _CurrentInputPort;
|
||||||
byte[] IncomingBuffer = new byte[]{};
|
byte[] IncomingBuffer = new byte[]{};
|
||||||
//CTimer StatusTimer;
|
ActionIncrementer VolumeIncrementer;
|
||||||
|
bool VolumeIsRamping;
|
||||||
|
|
||||||
protected override Func<bool> PowerIsOnFeedbackFunc { get { return () => _PowerIsOn; } }
|
protected override Func<bool> PowerIsOnFeedbackFunc { get { return () => _PowerIsOn; } }
|
||||||
protected override Func<bool> IsCoolingDownFeedbackFunc { get { return () => _IsCoolingDown; } }
|
protected override Func<bool> IsCoolingDownFeedbackFunc { get { return () => _IsCoolingDown; } }
|
||||||
@@ -85,9 +87,13 @@ namespace PepperDash.Essentials.Devices.Displays
|
|||||||
void Init()
|
void Init()
|
||||||
{
|
{
|
||||||
WarmupTime = 10000;
|
WarmupTime = 10000;
|
||||||
CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, 30000, 120000, 300000, StatusGet);
|
CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, 2000, 120000, 300000, StatusGet);
|
||||||
DeviceManager.AddDevice(CommunicationMonitor);
|
DeviceManager.AddDevice(CommunicationMonitor);
|
||||||
|
|
||||||
|
VolumeIncrementer = new ActionIncrementer(655, 0, 65535, 800, 80,
|
||||||
|
v => SetVolume((ushort)v),
|
||||||
|
() => _LastVolumeSent);
|
||||||
|
|
||||||
AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.AudioVideo,
|
AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.AudioVideo,
|
||||||
eRoutingPortConnectionType.Hdmi, new Action(InputHdmi1), this), 0x21);
|
eRoutingPortConnectionType.Hdmi, new Action(InputHdmi1), this), 0x21);
|
||||||
|
|
||||||
@@ -112,7 +118,7 @@ namespace PepperDash.Essentials.Devices.Displays
|
|||||||
AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.RgbIn2, eRoutingSignalType.Video,
|
AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.RgbIn2, eRoutingSignalType.Video,
|
||||||
eRoutingPortConnectionType.Rgb, new Action(new Action(InputRgb2)), this), 0x1E);
|
eRoutingPortConnectionType.Rgb, new Action(new Action(InputRgb2)), this), 0x1E);
|
||||||
|
|
||||||
VolumeLevelFeedback = new IntFeedback(() => { return _VolumeLevel; });
|
VolumeLevelFeedback = new IntFeedback(() => { return _VolumeLevelForSig; });
|
||||||
MuteFeedback = new BoolFeedback(() => _IsMuted);
|
MuteFeedback = new BoolFeedback(() => _IsMuted);
|
||||||
|
|
||||||
StatusGet();
|
StatusGet();
|
||||||
@@ -238,7 +244,6 @@ namespace PepperDash.Essentials.Devices.Displays
|
|||||||
_PowerIsOn = newVal;
|
_PowerIsOn = newVal;
|
||||||
PowerIsOnFeedback.FireUpdate();
|
PowerIsOnFeedback.FireUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -248,9 +253,11 @@ namespace PepperDash.Essentials.Devices.Displays
|
|||||||
void UpdateVolumeFB(byte b)
|
void UpdateVolumeFB(byte b)
|
||||||
{
|
{
|
||||||
var newVol = (ushort)Scale((double)b, 0, 100, 0, 65535);
|
var newVol = (ushort)Scale((double)b, 0, 100, 0, 65535);
|
||||||
if (newVol != _VolumeLevel)
|
if (!VolumeIsRamping)
|
||||||
|
_LastVolumeSent = newVol;
|
||||||
|
if (newVol != _VolumeLevelForSig)
|
||||||
{
|
{
|
||||||
_VolumeLevel = newVol;
|
_VolumeLevelForSig = newVol;
|
||||||
VolumeLevelFeedback.FireUpdate();
|
VolumeLevelFeedback.FireUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -450,8 +457,10 @@ namespace PepperDash.Essentials.Devices.Displays
|
|||||||
/// <param name="level"></param>
|
/// <param name="level"></param>
|
||||||
public void SetVolume(ushort level)
|
public void SetVolume(ushort level)
|
||||||
{
|
{
|
||||||
var volByte = Convert.ToByte(Scale(level, 0, 65535, 0, 100)); // The inputs to Scale ensures it won't overflow
|
_LastVolumeSent = level;
|
||||||
SendBytes(new byte[] { 0xAA, 0x12, 0x00, 0x01, volByte, 0x00 });
|
var scaled = (int)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 });
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -534,7 +543,16 @@ namespace PepperDash.Essentials.Devices.Displays
|
|||||||
/// <param name="pressRelease"></param>
|
/// <param name="pressRelease"></param>
|
||||||
public void VolumeDown(bool pressRelease)
|
public void VolumeDown(bool pressRelease)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
if (pressRelease)
|
||||||
|
{
|
||||||
|
VolumeIncrementer.StartDown();
|
||||||
|
VolumeIsRamping = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VolumeIsRamping = false;
|
||||||
|
VolumeIncrementer.Stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -543,9 +561,21 @@ namespace PepperDash.Essentials.Devices.Displays
|
|||||||
/// <param name="pressRelease"></param>
|
/// <param name="pressRelease"></param>
|
||||||
public void VolumeUp(bool pressRelease)
|
public void VolumeUp(bool pressRelease)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
if (pressRelease)
|
||||||
}
|
{
|
||||||
|
VolumeIncrementer.StartUp();
|
||||||
|
VolumeIsRamping = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VolumeIsRamping = false;
|
||||||
|
VolumeIncrementer.Stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public void VolumeGet()
|
public void VolumeGet()
|
||||||
{
|
{
|
||||||
SendBytes(new byte[] { 0xAA, 0x12, 0x00, 0x00, 0x00 });
|
SendBytes(new byte[] { 0xAA, 0x12, 0x00, 0x00, 0x00 });
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -14,6 +14,23 @@ namespace PepperDash.Essentials
|
|||||||
public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange;
|
public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange;
|
||||||
public event SourceInfoChangeHandler CurrentSingleSourceChange;
|
public event SourceInfoChangeHandler CurrentSingleSourceChange;
|
||||||
|
|
||||||
|
protected override Func<bool> OnFeedbackFunc
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return () =>
|
||||||
|
{
|
||||||
|
var disp = DefaultDisplay as DisplayBase;
|
||||||
|
var val = CurrentSourceInfo != null
|
||||||
|
&& CurrentSourceInfo.Type == eSourceListItemType.Route
|
||||||
|
&& disp != null
|
||||||
|
&& disp.PowerIsOnFeedback.BoolValue;
|
||||||
|
Debug.Console(2, this, "************** ROOM POWER {0}", val);
|
||||||
|
return val;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public EssentialsRoomPropertiesConfig Config { get; private set; }
|
public EssentialsRoomPropertiesConfig Config { get; private set; }
|
||||||
|
|
||||||
public IRoutingSinkWithSwitching DefaultDisplay { get; private set; }
|
public IRoutingSinkWithSwitching DefaultDisplay { get; private set; }
|
||||||
@@ -91,11 +108,6 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
public string CurrentSourceInfoKey { get; private set; }
|
public string CurrentSourceInfoKey { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public BoolFeedback OnFeedback { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -115,13 +127,19 @@ namespace PepperDash.Essentials
|
|||||||
CurrentVolumeControls = DefaultVolumeControls;
|
CurrentVolumeControls = DefaultVolumeControls;
|
||||||
|
|
||||||
var disp = DefaultDisplay as DisplayBase;
|
var disp = DefaultDisplay as DisplayBase;
|
||||||
OnFeedback = new BoolFeedback(() =>
|
if (disp != null)
|
||||||
{
|
{
|
||||||
return CurrentSourceInfo != null
|
disp.PowerIsOnFeedback.OutputChange += (o, a) =>
|
||||||
&& CurrentSourceInfo.Type == eSourceListItemType.Route
|
{
|
||||||
&& disp != null
|
if (disp.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue)
|
||||||
&& disp.PowerIsOnFeedback.BoolValue;
|
{
|
||||||
});
|
if (!disp.PowerIsOnFeedback.BoolValue)
|
||||||
|
CurrentSourceInfo = null;
|
||||||
|
OnFeedback.FireUpdate();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
SourceListKey = "default";
|
SourceListKey = "default";
|
||||||
EnablePowerOnToLastSource = true;
|
EnablePowerOnToLastSource = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,14 @@ namespace PepperDash.Essentials
|
|||||||
public event SourceInfoChangeHandler CurrentDisplay1SourceChange;
|
public event SourceInfoChangeHandler CurrentDisplay1SourceChange;
|
||||||
public event SourceInfoChangeHandler CurrentDisplay2SourceChange;
|
public event SourceInfoChangeHandler CurrentDisplay2SourceChange;
|
||||||
|
|
||||||
|
protected override Func<bool> OnFeedbackFunc { get {
|
||||||
|
return () => (CurrentSingleSourceInfo != null
|
||||||
|
&& CurrentSingleSourceInfo.Type != eSourceListItemType.Off)
|
||||||
|
|| (Display1SourceInfo != null
|
||||||
|
&& Display1SourceInfo.Type != eSourceListItemType.Off)
|
||||||
|
|| (Display2SourceInfo != null
|
||||||
|
&& Display2SourceInfo.Type != eSourceListItemType.Off); } }
|
||||||
|
|
||||||
public EssentialsPresentationRoomPropertiesConfig Config { get; private set; }
|
public EssentialsPresentationRoomPropertiesConfig Config { get; private set; }
|
||||||
|
|
||||||
public Dictionary<uint, IRoutingSinkNoSwitching> Displays { get; private set; }
|
public Dictionary<uint, IRoutingSinkNoSwitching> Displays { get; private set; }
|
||||||
@@ -141,16 +149,10 @@ namespace PepperDash.Essentials
|
|||||||
}
|
}
|
||||||
SourceListItem _Display2SourceInfo;
|
SourceListItem _Display2SourceInfo;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public BoolFeedback OnFeedback { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If an audio dialer is available for this room
|
/// If an audio dialer is available for this room
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool HasAudioDialer { get { return false; } }
|
public bool HasAudioDialer { get { return false; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -173,15 +175,7 @@ namespace PepperDash.Essentials
|
|||||||
//else if (defaultAudio is IHasVolumeDevice)
|
//else if (defaultAudio is IHasVolumeDevice)
|
||||||
// DefaultVolumeControls = (defaultAudio as IHasVolumeDevice).VolumeDevice;
|
// DefaultVolumeControls = (defaultAudio as IHasVolumeDevice).VolumeDevice;
|
||||||
|
|
||||||
OnFeedback = new BoolFeedback(() =>
|
|
||||||
{ return (CurrentSingleSourceInfo != null
|
|
||||||
&& CurrentSingleSourceInfo.Type != eSourceListItemType.Off)
|
|
||||||
|| (Display1SourceInfo != null
|
|
||||||
&& Display1SourceInfo.Type != eSourceListItemType.Off)
|
|
||||||
|| (Display2SourceInfo != null
|
|
||||||
&& Display2SourceInfo.Type != eSourceListItemType.Off);
|
|
||||||
|
|
||||||
});
|
|
||||||
SourceListKey = "default";
|
SourceListKey = "default";
|
||||||
EnablePowerOnToLastSource = true;
|
EnablePowerOnToLastSource = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,11 +20,23 @@ namespace PepperDash.Essentials
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class EssentialsRoomBase : Device
|
public abstract class EssentialsRoomBase : Device
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public BoolFeedback OnFeedback { get; private set; }
|
||||||
|
|
||||||
|
public BoolFeedback IsWarmingFeedback { get; private set; }
|
||||||
|
public BoolFeedback IsCoolingFeedback { get; private set; }
|
||||||
|
public BoolFeedback ShutdownPendingFeedback { get; private set; }
|
||||||
|
|
||||||
|
protected abstract Func<bool> OnFeedbackFunc { get; }
|
||||||
|
|
||||||
|
|
||||||
public EssentialsRoomBase(string key, string name) : base(key, name)
|
public EssentialsRoomBase(string key, string name) : base(key, name)
|
||||||
{
|
{
|
||||||
|
OnFeedback = new BoolFeedback(OnFeedbackFunc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -147,13 +147,7 @@ namespace PepperDash.Essentials
|
|||||||
: base(parent.TriList)
|
: base(parent.TriList)
|
||||||
{
|
{
|
||||||
Config = config;
|
Config = config;
|
||||||
Parent = parent;
|
Parent = parent;
|
||||||
|
|
||||||
//SelectASourceVisibleFeedback = new BoolFeedback(() =>
|
|
||||||
// CurrentRoom != null && !CurrentRoom.OnFeedback.BoolValue && this.IsVisible);
|
|
||||||
|
|
||||||
//SourcesDynamicList = new SmartObjectDynamicList(
|
|
||||||
// TriList.SmartObjects[UISmartObjectJoin.SourceList], true, 3200);
|
|
||||||
|
|
||||||
SourcesSrl = new SubpageReferenceList(TriList, 3200, 3, 3, 3);
|
SourcesSrl = new SubpageReferenceList(TriList, 3200, 3, 3, 3);
|
||||||
ActivityFooterSrl = new SubpageReferenceList(TriList, 15022, 3, 3, 3);
|
ActivityFooterSrl = new SubpageReferenceList(TriList, 15022, 3, 3, 3);
|
||||||
@@ -242,12 +236,16 @@ namespace PepperDash.Essentials
|
|||||||
base.Show();
|
base.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handler for room on/off feedback
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
void OnFeedback_OutputChange(object sender, EventArgs e)
|
void OnFeedback_OutputChange(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (CurrentRoom.OnFeedback.BoolValue)
|
if (CurrentRoom.OnFeedback.BoolValue)
|
||||||
{
|
{
|
||||||
TriList.BooleanInput[UIBoolJoin.VolumeSingleMute1Visible].BoolValue = true;
|
TriList.BooleanInput[UIBoolJoin.VolumeSingleMute1Visible].BoolValue = true;
|
||||||
//TriList.BooleanInput[UIBoolJoin.StagingPageVisible].BoolValue = true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user