mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-11 02:35:00 +00:00
MicrophonePrivacyController progress
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Crestron_IO
|
||||
{
|
||||
public class GenericDigitalInputDevice : IDigitalInput
|
||||
{
|
||||
DigitalInput InputPort { get; private set; }
|
||||
|
||||
BoolFeedback InputStateFeedback { get; private set; }
|
||||
|
||||
Func<bool> InputStateFeedbackFunc
|
||||
{
|
||||
get
|
||||
{
|
||||
return () => InputPort.State;
|
||||
}
|
||||
}
|
||||
|
||||
public GenericDigitalInputDevice(DigitalInput inputPort)
|
||||
{
|
||||
InputStateFeedback = new BoolFeedback(InputStateFeedbackFunc);
|
||||
|
||||
InputPort = inputPort;
|
||||
|
||||
InputPort.StateChange += new DigitalInputEventHandler(InputPort_StateChange);
|
||||
|
||||
}
|
||||
|
||||
void InputPort_StateChange(DigitalInput digitalInput, DigitalInputEventArgs args)
|
||||
{
|
||||
InputStateFeedback.FireUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,39 +5,38 @@ using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core.Crestron_IO
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a generic digital input deviced tied to a versiport
|
||||
/// </summary>
|
||||
public class GenericVersiportInputDevice
|
||||
public class GenericVersiportInputDevice : IDigitalInput
|
||||
{
|
||||
//Versiport InputPort {get; private set;}
|
||||
Versiport InputPort { get; private set; }
|
||||
|
||||
//BoolFeedback InputStateFeedback {get; private set;}
|
||||
BoolFeedback InputStateFeedback { get; private set; }
|
||||
|
||||
//Func<bool> InputStateFeedbackFunc
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return () => InputPort.DigitalIn;
|
||||
// }
|
||||
//}
|
||||
Func<bool> InputStateFeedbackFunc
|
||||
{
|
||||
get
|
||||
{
|
||||
return () => InputPort.DigitalIn;
|
||||
}
|
||||
}
|
||||
|
||||
//public GenericVersiportInputDevice(Versiport inputPort)
|
||||
//{
|
||||
// InputStateFeedback = new BoolFeedback(InputStateFeedbackFunc);
|
||||
public GenericVersiportInputDevice(Versiport inputPort)
|
||||
{
|
||||
InputStateFeedback = new BoolFeedback(InputStateFeedbackFunc);
|
||||
|
||||
// InputPort = inputPort;
|
||||
InputPort = inputPort;
|
||||
|
||||
// InputPort.VersiportChange += new VersiportEventHandler(InputPort_VersiportChange);
|
||||
InputPort.VersiportChange += new VersiportEventHandler(InputPort_VersiportChange);
|
||||
|
||||
//}
|
||||
}
|
||||
|
||||
//void InputPort_VersiportChange(Versiport port, VersiportEventArgs args)
|
||||
//{
|
||||
// InputStateFeedback.FireUpdate();
|
||||
//}
|
||||
void InputPort_VersiportChange(Versiport port, VersiportEventArgs args)
|
||||
{
|
||||
InputStateFeedback.FireUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,11 @@ using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Crestron_IO
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a device that provides digital input
|
||||
/// </summary>
|
||||
public interface IDigitalInput
|
||||
{
|
||||
|
||||
BoolFeedback InputStateFeedback { get; }
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Crestron_IO
|
||||
@@ -13,31 +12,49 @@ namespace PepperDash.Essentials.Core.Crestron_IO
|
||||
/// </summary>
|
||||
public class GenericRelayDevice
|
||||
{
|
||||
//Relay RelayOutput { get; private set; }
|
||||
Relay RelayOutput { get; private set; }
|
||||
|
||||
//public boolfeedback relaystatefeedback { get; private set; }
|
||||
public BoolFeedback RelayStateFeedback { get; private set; }
|
||||
|
||||
//func<bool> relaystatefeedbackfunc
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return () => relayoutput.state;
|
||||
// }
|
||||
//}
|
||||
Func<bool> RelayStateFeedbackFunc
|
||||
{
|
||||
get
|
||||
{
|
||||
return () => RelayOutput.State;
|
||||
}
|
||||
}
|
||||
|
||||
//public genericrelaydevice(relay relay)
|
||||
//{
|
||||
// relaystatefeedback = new boolfeedback(relaystatefeedbackfunc);
|
||||
public GenericRelayDevice(Relay relay)
|
||||
{
|
||||
RelayStateFeedback = new BoolFeedback(RelayStateFeedbackFunc);
|
||||
|
||||
// if(relay.availableforuse)
|
||||
// relayoutput = relay;
|
||||
if (relay.AvailableForUse)
|
||||
RelayOutput = relay;
|
||||
|
||||
// relayoutput.statechange += new relayeventhandler(relayoutput_statechange);
|
||||
//}
|
||||
RelayOutput.StateChange += new RelayEventHandler(RelayOutput_StateChange);
|
||||
}
|
||||
|
||||
//void relayoutput_statechange(relay relay, relayeventargs args)
|
||||
//{
|
||||
// relaystatefeedback.fireupdate();
|
||||
//}
|
||||
void RelayOutput_StateChange(Relay relay, RelayEventArgs args)
|
||||
{
|
||||
RelayStateFeedback.FireUpdate();
|
||||
}
|
||||
|
||||
void OpenRelay()
|
||||
{
|
||||
RelayOutput.State = false;
|
||||
}
|
||||
|
||||
void CloseRelay()
|
||||
{
|
||||
RelayOutput.State = true;
|
||||
}
|
||||
|
||||
void ToggleRelayState()
|
||||
{
|
||||
if (RelayOutput.State == true)
|
||||
OpenRelay();
|
||||
else
|
||||
CloseRelay();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user