mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-11 19:44:52 +00:00
Merge branch 'development' into release-2.0.0
This commit is contained in:
@@ -91,8 +91,8 @@ we receive and the availability of resources to evaluate contributions, we antic
|
||||
project remains dynamic and relevant. This may affect our responsiveness and ability to accept pull requests
|
||||
quickly. This does not mean we are ignoring them.
|
||||
- Not all innovative ideas need to be accepted as pull requests into this GitHub project to be valuable to the community.
|
||||
There may be times when we recommend that you just share your code for some enhancement to Ghidra from your own
|
||||
repository. As we identify and recognize extensions that are of general interest to the reverse engineering community, we
|
||||
There may be times when we recommend that you just share your code for some enhancement to Essentials from your own
|
||||
repository. As we identify and recognize extensions that are of general interest to Essentials, we
|
||||
may seek to incorporate them with our baseline.
|
||||
|
||||
## Legal
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
|
||||
@@ -56,6 +56,8 @@ namespace PepperDash.Essentials.Core.Touchpanels
|
||||
InitializeButton(buttonKey, buttonConfig);
|
||||
InitializeButtonFeedback(buttonKey, buttonConfig);
|
||||
}
|
||||
|
||||
ListButtons();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -319,6 +321,23 @@ namespace PepperDash.Essentials.Core.Touchpanels
|
||||
|
||||
foreach (var eventType in button.EventTypes[type]) DeviceJsonApi.DoDeviceAction(eventType);
|
||||
}
|
||||
|
||||
|
||||
public void ListButtons()
|
||||
{
|
||||
var line = new string('-', 35);
|
||||
|
||||
Debug.Console(0, this, line);
|
||||
|
||||
Debug.Console(0, this, "MPC3 Controller {0} - Available Butons", Key);
|
||||
|
||||
foreach (var button in _buttons)
|
||||
{
|
||||
Debug.Console(0, this, "Key: {0}", button.Key);
|
||||
}
|
||||
|
||||
Debug.Console(0, this, line);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp.CrestronIO;
|
||||
using Crestron.SimplSharp.Reflection;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
Reference in New Issue
Block a user