mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-12 11:15:08 +00:00
feat: wip commit prior to removing the crestron library
This commit is contained in:
@@ -8,9 +8,11 @@ using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Communications;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Devices;
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using PepperDash.Essentials.Core.Monitoring;
|
||||
using Serilog.Events;
|
||||
|
||||
//using PepperDash.Essentials.Devices.Common.Cameras;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Devices;
|
||||
using Serilog.Events;
|
||||
|
||||
//using PepperDash.Essentials.Devices.Common.Cameras;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a AirMediaControllerJoinMap
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a AppleTvJoinMap
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a C2nRthsControllerJoinMap
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a CameraControllerJoinMap
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a CenOdtOccupancySensorBaseJoinMap
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a DisplayControllerJoinMap
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges {
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a DmBladeChassisControllerJoinMap
|
||||
/// </summary>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a DmChassisControllerJoinMap
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a DmRmcControllerJoinMap
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a DmTxControllerJoinMap
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a DmpsAudioOutputControllerJoinMap
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a DmpsMicrophoneControllerJoinMap
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a DmpsRoutingControllerJoinMap
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
public sealed class GenericIrControllerJoinMap : JoinMapBaseAdvanced
|
||||
{
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a GenericLightingJoinMap
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a GenericRelayControllerJoinMap
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a GlsOccupancySensorBaseJoinMap
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a HdMdNxM4kEControllerJoinMap
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a HdMdxxxCEControllerJoinMap
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a HdPsXxxControllerJoinMap
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a Hrxxx0WirelessRemoteControllerJoinMap
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a IAnalogInputJoinMap
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a IBasicCommunicationJoinMap
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a IDigitalInputJoinMap
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a IDigitalOutputJoinMap
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Join map for IRBlurayBase devices
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a PduJoinMapBase
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a SetTopBoxControllerJoinMap
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a StatusSignControllerJoinMap
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a SystemMonitorJoinMap
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using PepperDash.Essentials.Core.JoinMaps;
|
||||
using System;
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
|
||||
72
src/PepperDash.Essentials.Core/Bridges/SigHelper.cs
Normal file
72
src/PepperDash.Essentials.Core/Bridges/SigHelper.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
{
|
||||
/// <summary>
|
||||
/// Helper class for various Sig events
|
||||
/// </summary>
|
||||
public class SigHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Runs action when Sig is pressed
|
||||
/// </summary>
|
||||
/// <param name="sig"></param>
|
||||
public static void Pressed(Sig sig, Action act) { if (sig.BoolValue) act(); }
|
||||
|
||||
/// <summary>
|
||||
/// Runs action when Sig is released
|
||||
/// </summary>
|
||||
public static void Released(Sig sig, Action act) { if (!sig.BoolValue) act(); }
|
||||
|
||||
/// <summary>
|
||||
/// SetBoolOutAction method
|
||||
/// </summary>
|
||||
public static void SetBoolOutAction(BoolOutputSig sig, Action<bool> a)
|
||||
{
|
||||
if (sig != null)
|
||||
sig.UserObject = a;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Safely clears action of non-null sig.
|
||||
/// </summary>
|
||||
public static void ClearBoolOutAction(BoolOutputSig sig)
|
||||
{
|
||||
if (sig != null)
|
||||
sig.UserObject = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Does a timed ramp, where the time is scaled proportional to the
|
||||
/// remaining range to cover
|
||||
/// </summary>
|
||||
/// <param name="sig">Ushort sig to scale</param>
|
||||
/// <param name="newLevel">Level to go to</param>
|
||||
/// <param name="time">In ms (not hundredths like Crestron Sig ramp function)</param>
|
||||
/// <summary>
|
||||
/// RampTimeScaled method
|
||||
/// </summary>
|
||||
public static void RampTimeScaled(Sig sig, ushort newLevel, uint time)
|
||||
{
|
||||
var level = sig.UShortValue;
|
||||
var diff = Math.Abs(level - newLevel);
|
||||
var scaledTime = (uint)(diff * time / 65535);
|
||||
Ramp(sig, newLevel, scaledTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ramps signal
|
||||
/// </summary>
|
||||
/// <param name="sig"></param>
|
||||
/// <param name="level"></param>
|
||||
/// <param name="time">In ms (not hundredths like Crestron Sig ramp function)</param>
|
||||
/// <summary>
|
||||
/// Ramp method
|
||||
/// </summary>
|
||||
public static void Ramp(Sig sig, ushort level, uint time)
|
||||
{
|
||||
sig.CreateRamp(level, time / 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user