diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 890b7769..d44e7848 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/CenIoCom/CenIoComController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/CenIoCom/CenIoComController.cs new file mode 100644 index 00000000..bbd496b4 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/CenIoCom/CenIoComController.cs @@ -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 +{ + /// + /// Wrapper class for CEN-IO-COM-Xxx expander module + /// + [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 ComPorts + { + get { return _cenIoCom.ComPorts; } + } + + public int NumberOfComPorts + { + get { return _cenIoCom.NumberOfComPorts; } + } + + #endregion + + } + + public class CenIoCom102ControllerFactory : EssentialsDeviceFactory + { + private const string CenIoCom102Type = "ceniocom102"; + private const string CenIoCom202Type = "ceniocom202"; + + public CenIoCom102ControllerFactory() + { + TypeNames = new List { 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; + } + } + } + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdPsXxxAnalogAuxMixerController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdPsXxxAnalogAuxMixerController.cs new file mode 100644 index 00000000..7d27d35b --- /dev/null +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdPsXxxAnalogAuxMixerController.cs @@ -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 + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdPsXxxOutputAudioController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdPsXxxOutputAudioController.cs new file mode 100644 index 00000000..57067bde --- /dev/null +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdPsXxxOutputAudioController.cs @@ -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 + } +} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Bridges/JoinMaps/AirMediaControllerJoinMap.cs b/src/PepperDash.Essentials.Core/Bridges/JoinMaps/AirMediaControllerJoinMap.cs index fa5f2ac4..c46df18c 100644 --- a/src/PepperDash.Essentials.Core/Bridges/JoinMaps/AirMediaControllerJoinMap.cs +++ b/src/PepperDash.Essentials.Core/Bridges/JoinMaps/AirMediaControllerJoinMap.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace PepperDash.Essentials.Core.Bridges { diff --git a/src/PepperDash.Essentials.Core/Bridges/JoinMaps/DmRmcControllerJoinMap.cs b/src/PepperDash.Essentials.Core/Bridges/JoinMaps/DmRmcControllerJoinMap.cs index 56f0825c..bdcc3a69 100644 --- a/src/PepperDash.Essentials.Core/Bridges/JoinMaps/DmRmcControllerJoinMap.cs +++ b/src/PepperDash.Essentials.Core/Bridges/JoinMaps/DmRmcControllerJoinMap.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace PepperDash.Essentials.Core.Bridges { diff --git a/src/PepperDash.Essentials.Core/PepperDash_Essentials_Core.csproj b/src/PepperDash.Essentials.Core/PepperDash_Essentials_Core.csproj index bd727697..65ab1427 100644 --- a/src/PepperDash.Essentials.Core/PepperDash_Essentials_Core.csproj +++ b/src/PepperDash.Essentials.Core/PepperDash_Essentials_Core.csproj @@ -1,4 +1,4 @@ - + Release AnyCPU diff --git a/src/PepperDash.Essentials.Core/Touchpanels/Mpc3Touchpanel.cs b/src/PepperDash.Essentials.Core/Touchpanels/Mpc3Touchpanel.cs index c75a95b4..8ea9772f 100644 --- a/src/PepperDash.Essentials.Core/Touchpanels/Mpc3Touchpanel.cs +++ b/src/PepperDash.Essentials.Core/Touchpanels/Mpc3Touchpanel.cs @@ -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); + } } /// diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/VideoCodecBase.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/VideoCodecBase.cs index 0f706b7a..71fd2a61 100644 --- a/src/PepperDash.Essentials.Devices.Common/VideoCodec/VideoCodecBase.cs +++ b/src/PepperDash.Essentials.Devices.Common/VideoCodec/VideoCodecBase.cs @@ -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;