mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 20:54:55 +00:00
Merge pull request #1221 from PepperDash/test-ci
Cleanup leftover files
This commit is contained in:
@@ -1,85 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using Crestron.SimplSharpPro;
|
|
||||||
using Crestron.SimplSharpPro.GeneralIO;
|
|
||||||
using PepperDash.Core;
|
|
||||||
using PepperDash.Essentials.Core.Config;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.CrestronIO
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Wrapper class for CEN-IO-COM-Xxx expander module
|
|
||||||
/// </summary>
|
|
||||||
[Description("Wrapper class for the CEN-IO-COM-102 & CEN-IO-COM-202 expander module")]
|
|
||||||
public class CenIoComController : CrestronGenericBaseDevice, IComPorts
|
|
||||||
{
|
|
||||||
private readonly CenIoCom _cenIoCom;
|
|
||||||
|
|
||||||
public CenIoComController(string key, string name, CenIoCom cenIo)
|
|
||||||
:base(key, name, cenIo)
|
|
||||||
{
|
|
||||||
_cenIoCom = cenIo;
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Implementation of IComPorts
|
|
||||||
|
|
||||||
public CrestronCollection<ComPort> ComPorts
|
|
||||||
{
|
|
||||||
get { return _cenIoCom.ComPorts; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int NumberOfComPorts
|
|
||||||
{
|
|
||||||
get { return _cenIoCom.NumberOfComPorts; }
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class CenIoCom102ControllerFactory : EssentialsDeviceFactory<CenIoComController>
|
|
||||||
{
|
|
||||||
private const string CenIoCom102Type = "ceniocom102";
|
|
||||||
private const string CenIoCom202Type = "ceniocom202";
|
|
||||||
|
|
||||||
public CenIoCom102ControllerFactory()
|
|
||||||
{
|
|
||||||
TypeNames = new List<string> { CenIoCom102Type, CenIoCom202Type };
|
|
||||||
}
|
|
||||||
|
|
||||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
|
||||||
{
|
|
||||||
Debug.Console(1, "Factory Attempting to create new CEN-IO-COM-Xxx Device");
|
|
||||||
|
|
||||||
var control = CommFactory.GetControlPropertiesConfig(dc);
|
|
||||||
if (control == null)
|
|
||||||
{
|
|
||||||
Debug.Console(1, "Factory failed to create a new CEN-IO-COM-Xxx Device, control properties not found");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
var ipid = control.IpIdInt;
|
|
||||||
if (ipid < 2)
|
|
||||||
{
|
|
||||||
Debug.Console(1, "Factory failed to create a new CEN-IO-COM-Xxx Device, invalid IP-ID found");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (dc.Type)
|
|
||||||
{
|
|
||||||
case CenIoCom102Type:
|
|
||||||
{
|
|
||||||
return new CenIoComController(dc.Key, dc.Name, new CenIoCom102(ipid, Global.ControlSystem));
|
|
||||||
}
|
|
||||||
case CenIoCom202Type:
|
|
||||||
{
|
|
||||||
return new CenIoComController(dc.Key, dc.Name, new CenIoCom202(ipid, Global.ControlSystem));
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
Debug.Console(1, "Factory failed to create a new CEN-IO-COM-Xxx Device, invalid type '{0}'", dc.Type);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,185 +0,0 @@
|
|||||||
using Crestron.SimplSharp;
|
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
|
||||||
using Crestron.SimplSharpPro.DM;
|
|
||||||
using PepperDash.Core;
|
|
||||||
using PepperDash.Essentials.Core;
|
|
||||||
|
|
||||||
namespace PepperDash_Essentials_DM.Chassis
|
|
||||||
{
|
|
||||||
public class HdPsXxxAnalogAuxMixerController : IKeyed,
|
|
||||||
IHasVolumeControlWithFeedback, IHasMuteControlWithFeedback
|
|
||||||
{
|
|
||||||
public string Key { get; private set; }
|
|
||||||
|
|
||||||
private readonly HdPsXxxAnalogAuxMixer _mixer;
|
|
||||||
|
|
||||||
public HdPsXxxAnalogAuxMixerController(string parent, uint mixer, HdPsXxx chassis)
|
|
||||||
{
|
|
||||||
Key = string.Format("{0}-analogMixer{1}", parent, mixer);
|
|
||||||
|
|
||||||
_mixer = chassis.AnalogAuxiliaryMixer[mixer];
|
|
||||||
|
|
||||||
_mixer.AuxMixerPropertyChange += OnAuxMixerPropertyChange;
|
|
||||||
_mixer.AuxiliaryMuteControl.MuteAndVolumeControlPropertyChange += OnMuteAndVolumeControlPropertyChange;
|
|
||||||
|
|
||||||
VolumeLevelFeedback = new IntFeedback(() => VolumeLevel);
|
|
||||||
MuteFeedback = new BoolFeedback(() => IsMuted);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Volume
|
|
||||||
|
|
||||||
private void OnAuxMixerPropertyChange(object sender, GenericEventArgs args)
|
|
||||||
{
|
|
||||||
Debug.Console(2, this, "OnAuxMixerPropertyChange: {0} > Index-{1}, EventId-{2}", sender.ToString(), args.Index, args.EventId);
|
|
||||||
|
|
||||||
switch (args.EventId)
|
|
||||||
{
|
|
||||||
case MuteAndVolumeContorlEventIds.VolumeFeedbackEventId:
|
|
||||||
{
|
|
||||||
VolumeLevel = _mixer.VolumeFeedback.ShortValue;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case MuteAndVolumeContorlEventIds.MuteOnEventId:
|
|
||||||
case MuteAndVolumeContorlEventIds.MuteOffEventId:
|
|
||||||
{
|
|
||||||
IsMuted = _mixer.AuxiliaryMuteControl.MuteOnFeedback.BoolValue;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
Debug.Console(1, this, "OnAuxMixerPropertyChange: {0} > Index-{1}, EventId-{2} - unhandled eventId", sender.ToString(), args.Index, args.EventId);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private const ushort CrestronLevelMin = 0;
|
|
||||||
private const ushort CrestronLevelMax = 65535;
|
|
||||||
|
|
||||||
private const int DeviceLevelMin = -800;
|
|
||||||
private const int DeviceLevelMax = 200;
|
|
||||||
|
|
||||||
private const int RampTime = 5000;
|
|
||||||
|
|
||||||
private int _volumeLevel;
|
|
||||||
|
|
||||||
public int VolumeLevel
|
|
||||||
{
|
|
||||||
get { return _volumeLevel; }
|
|
||||||
private set
|
|
||||||
{
|
|
||||||
var level = value;
|
|
||||||
|
|
||||||
_volumeLevel = CrestronEnvironment.ScaleWithLimits(level, DeviceLevelMax, DeviceLevelMin, CrestronLevelMax, CrestronLevelMin);
|
|
||||||
|
|
||||||
Debug.Console(1, this, "VolumeFeedback: level-'{0}', scaled-'{1}'", level, _volumeLevel);
|
|
||||||
|
|
||||||
VolumeLevelFeedback.FireUpdate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IntFeedback VolumeLevelFeedback { get; private set; }
|
|
||||||
|
|
||||||
public void SetVolume(ushort level)
|
|
||||||
{
|
|
||||||
var levelScaled = CrestronEnvironment.ScaleWithLimits(level, CrestronLevelMax, CrestronLevelMin, DeviceLevelMax, DeviceLevelMin);
|
|
||||||
|
|
||||||
Debug.Console(1, this, "SetVolume: level-'{0}', levelScaled-'{1}'", level, levelScaled);
|
|
||||||
|
|
||||||
_mixer.Volume.ShortValue = (short)levelScaled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void VolumeUp(bool pressRelease)
|
|
||||||
{
|
|
||||||
if (pressRelease)
|
|
||||||
{
|
|
||||||
_mixer.Volume.CreateSignedRamp(DeviceLevelMax, RampTime);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_mixer.Volume.StopRamp();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void VolumeDown(bool pressRelease)
|
|
||||||
{
|
|
||||||
if (pressRelease)
|
|
||||||
{
|
|
||||||
_mixer.Volume.CreateSignedRamp(DeviceLevelMin, RampTime);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_mixer.Volume.StopRamp();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region Mute
|
|
||||||
|
|
||||||
private void OnMuteAndVolumeControlPropertyChange(MuteControl device, GenericEventArgs args)
|
|
||||||
{
|
|
||||||
Debug.Console(2, this, "OnMuteAndVolumeControlPropertyChange: {0} > Index-{1}, EventId-{2}", device.ToString(), args.Index, args.EventId);
|
|
||||||
|
|
||||||
switch (args.EventId)
|
|
||||||
{
|
|
||||||
case MuteAndVolumeContorlEventIds.VolumeFeedbackEventId:
|
|
||||||
{
|
|
||||||
VolumeLevel = _mixer.VolumeFeedback.ShortValue;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case MuteAndVolumeContorlEventIds.MuteOnEventId:
|
|
||||||
case MuteAndVolumeContorlEventIds.MuteOffEventId:
|
|
||||||
{
|
|
||||||
IsMuted = _mixer.AuxiliaryMuteControl.MuteOnFeedback.BoolValue;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
Debug.Console(1, this, "OnMuteAndVolumeControlPropertyChange: {0} > Index-{1}, EventId-{2} - unhandled eventId", device.ToString(), args.Index, args.EventId);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool _isMuted;
|
|
||||||
|
|
||||||
public bool IsMuted
|
|
||||||
{
|
|
||||||
get { return _isMuted; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_isMuted = value;
|
|
||||||
|
|
||||||
Debug.Console(1, this, "IsMuted: _isMuted-'{0}'", _isMuted);
|
|
||||||
|
|
||||||
MuteFeedback.FireUpdate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public BoolFeedback MuteFeedback { get; private set; }
|
|
||||||
|
|
||||||
public void MuteOn()
|
|
||||||
{
|
|
||||||
_mixer.AuxiliaryMuteControl.MuteOn();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void MuteOff()
|
|
||||||
{
|
|
||||||
_mixer.AuxiliaryMuteControl.MuteOff();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void MuteToggle()
|
|
||||||
{
|
|
||||||
if (IsMuted)
|
|
||||||
MuteOff();
|
|
||||||
else
|
|
||||||
MuteOn();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,167 +0,0 @@
|
|||||||
using Crestron.SimplSharp;
|
|
||||||
using Crestron.SimplSharpPro.DM;
|
|
||||||
using PepperDash.Core;
|
|
||||||
using PepperDash.Essentials.Core;
|
|
||||||
|
|
||||||
namespace PepperDash_Essentials_DM.Chassis
|
|
||||||
{
|
|
||||||
public class HdPsXxxOutputAudioController : IKeyed,
|
|
||||||
IHasVolumeControlWithFeedback, IHasMuteControlWithFeedback
|
|
||||||
{
|
|
||||||
public string Key { get; private set; }
|
|
||||||
|
|
||||||
private readonly HdPsXxxHdmiDmLiteOutputMixer _mixer; // volume/volumeFeedback
|
|
||||||
private readonly HdPsXxxOutputPort _port; // mute/muteFeedback
|
|
||||||
|
|
||||||
public HdPsXxxOutputAudioController(string parent, uint output, HdPsXxx chassis)
|
|
||||||
{
|
|
||||||
Key = string.Format("{0}-audioOut{1}", parent, output);
|
|
||||||
|
|
||||||
_port = chassis.HdmiDmLiteOutputs[output].OutputPort;
|
|
||||||
_mixer = chassis.HdmiDmLiteOutputs[output].Mixer;
|
|
||||||
|
|
||||||
chassis.DMOutputChange += ChassisOnDmOutputChange;
|
|
||||||
|
|
||||||
VolumeLevelFeedback = new IntFeedback(() => VolumeLevel);
|
|
||||||
MuteFeedback = new BoolFeedback(() => IsMuted);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ChassisOnDmOutputChange(Switch device, DMOutputEventArgs args)
|
|
||||||
{
|
|
||||||
switch (args.EventId)
|
|
||||||
{
|
|
||||||
case (DMOutputEventIds.VolumeEventId):
|
|
||||||
{
|
|
||||||
Debug.Console(2, this, "HdPsXxxOutputAudioController: {0} > Index-{1}, Number-{3}, EventId-{2} - AudioMute/UnmuteEventId",
|
|
||||||
device.ToString(), args.Index, args.EventId, args.Number);
|
|
||||||
|
|
||||||
VolumeLevel = _mixer.VolumeFeedback.ShortValue;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case DMOutputEventIds.MuteOnEventId:
|
|
||||||
case DMOutputEventIds.MuteOffEventId:
|
|
||||||
{
|
|
||||||
Debug.Console(2, this, "HdPsXxxOutputAudioController: {0} > Index-{1}, Number-{3}, EventId-{2} - MuteOnEventId/MuteOffEventId",
|
|
||||||
device.ToString(), args.Index, args.EventId, args.Number);
|
|
||||||
|
|
||||||
IsMuted = _port.MuteOnFeedback.BoolValue;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
Debug.Console(1, this, "HdPsXxxOutputAudioController: {0} > Index-{1}, Number-{3}, EventId-{2} - unhandled eventId",
|
|
||||||
device.ToString(), args.Index, args.EventId, args.Number);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Volume
|
|
||||||
|
|
||||||
private const ushort CrestronLevelMin = 0;
|
|
||||||
private const ushort CrestronLevelMax = 65535;
|
|
||||||
|
|
||||||
private const int DeviceLevelMin = -800;
|
|
||||||
private const int DeviceLevelMax = 200;
|
|
||||||
|
|
||||||
private const int RampTime = 5000;
|
|
||||||
|
|
||||||
private int _volumeLevel;
|
|
||||||
|
|
||||||
public int VolumeLevel
|
|
||||||
{
|
|
||||||
get { return _volumeLevel; }
|
|
||||||
private set
|
|
||||||
{
|
|
||||||
var level = value;
|
|
||||||
|
|
||||||
_volumeLevel = CrestronEnvironment.ScaleWithLimits(level, DeviceLevelMax, DeviceLevelMin, CrestronLevelMax, CrestronLevelMin);
|
|
||||||
|
|
||||||
Debug.Console(2, this, "VolumeFeedback: level-'{0}', scaled-'{1}'", level, _volumeLevel);
|
|
||||||
|
|
||||||
VolumeLevelFeedback.FireUpdate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IntFeedback VolumeLevelFeedback { get; private set; }
|
|
||||||
|
|
||||||
public void SetVolume(ushort level)
|
|
||||||
{
|
|
||||||
var levelScaled = CrestronEnvironment.ScaleWithLimits(level, CrestronLevelMax, CrestronLevelMin, DeviceLevelMax, DeviceLevelMin);
|
|
||||||
|
|
||||||
Debug.Console(1, this, "SetVolume: level-'{0}', levelScaled-'{1}'", level, levelScaled);
|
|
||||||
|
|
||||||
_mixer.Volume.ShortValue = (short)levelScaled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void VolumeUp(bool pressRelease)
|
|
||||||
{
|
|
||||||
if (pressRelease)
|
|
||||||
{
|
|
||||||
_mixer.Volume.CreateSignedRamp(DeviceLevelMax, RampTime);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_mixer.Volume.StopRamp();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void VolumeDown(bool pressRelease)
|
|
||||||
{
|
|
||||||
if (pressRelease)
|
|
||||||
{
|
|
||||||
_mixer.Volume.CreateSignedRamp(DeviceLevelMin, RampTime);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_mixer.Volume.StopRamp();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region Mute
|
|
||||||
|
|
||||||
private bool _isMuted;
|
|
||||||
|
|
||||||
public bool IsMuted
|
|
||||||
{
|
|
||||||
get { return _isMuted; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_isMuted = value;
|
|
||||||
|
|
||||||
Debug.Console(1, this, "IsMuted: _isMuted-'{0}'", _isMuted);
|
|
||||||
|
|
||||||
MuteFeedback.FireUpdate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public BoolFeedback MuteFeedback { get; private set; }
|
|
||||||
|
|
||||||
public void MuteOn()
|
|
||||||
{
|
|
||||||
_port.MuteOn();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void MuteOff()
|
|
||||||
{
|
|
||||||
_port.MuteOff();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void MuteToggle()
|
|
||||||
{
|
|
||||||
if (IsMuted)
|
|
||||||
MuteOff();
|
|
||||||
else
|
|
||||||
MuteOn();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user