Moved MicrophonePrivacyController to Devices Common. Fixed references

This commit is contained in:
Neil Dorin
2017-11-01 14:20:13 -06:00
parent bc47c65e48
commit a0817307b1
10 changed files with 50 additions and 23 deletions

View File

@@ -9,9 +9,9 @@ namespace PepperDash.Essentials.Core.Crestron_IO
{
public class GenericDigitalInputDevice : IDigitalInput
{
DigitalInput InputPort { get; private set; }
public DigitalInput InputPort { get; private set; }
BoolFeedback InputStateFeedback { get; private set; }
public BoolFeedback InputStateFeedback { get; private set; }
Func<bool> InputStateFeedbackFunc
{
@@ -35,5 +35,6 @@ namespace PepperDash.Essentials.Core.Crestron_IO
{
InputStateFeedback.FireUpdate();
}
}
}

View File

@@ -12,9 +12,9 @@ namespace PepperDash.Essentials.Core.Crestron_IO
/// </summary>
public class GenericVersiportInputDevice : IDigitalInput
{
Versiport InputPort { get; private set; }
public Versiport InputPort { get; private set; }
BoolFeedback InputStateFeedback { get; private set; }
public BoolFeedback InputStateFeedback { get; private set; }
Func<bool> InputStateFeedbackFunc
{

View File

@@ -12,7 +12,7 @@ namespace PepperDash.Essentials.Core.Crestron_IO
/// </summary>
public class GenericRelayDevice
{
Relay RelayOutput { get; private set; }
public Relay RelayOutput { get; private set; }
public BoolFeedback RelayStateFeedback { get; private set; }
@@ -39,17 +39,17 @@ namespace PepperDash.Essentials.Core.Crestron_IO
RelayStateFeedback.FireUpdate();
}
void OpenRelay()
public void OpenRelay()
{
RelayOutput.State = false;
}
void CloseRelay()
public void CloseRelay()
{
RelayOutput.State = true;
}
void ToggleRelayState()
public void ToggleRelayState()
{
if (RelayOutput.State == true)
OpenRelay();

View File

@@ -1,86 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core.Crestron_IO;
namespace PepperDash.Essentials.Core.Microphone_Privacy
{
public class MicrophonePrivacyController
{
public List<IDigitalInput> Inputs { get; private set; }
public GenericRelayDevice RedLedRelay { get; private set; }
public GenericRelayDevice GreenLedRelay { get; private set; }
public IPrivacy PrivacyDevice { get; private set; }
public MicrophonePrivacyController(IPrivacy privacyDevice)
{
PrivacyDevice = privacyDevice;
PrivacyDevice.PrivacyModeIsOnFeedback.OutputChange += new EventHandler<EventArgs>(PrivacyModeIsOnFeedback_OutputChange);
Inputs = new List<IDigitalInput>();
}
void PrivacyModeIsOnFeedback_OutputChange(object sender, EventArgs e)
{
var privacyState = (sender as IPrivacy).PrivacyModeIsOnFeedback.BoolValue;
if(privacyState)
}
void AddInput(IDigitalInput input)
{
Inputs.Add(input);
input.InputStateFeedback.OutputChange += new EventHandler<EventArgs>(InputStateFeedback_OutputChange);
}
void RemoveInput(IDigitalInput input)
{
var tempInput = Inputs.FirstOrDefault(i => i.Equals(input));
if (tempInput != null)
tempInput.InputStateFeedback.OutputChange -= InputStateFeedback_OutputChange;
Inputs.Remove(input);
}
void SetRedLedRelay(GenericRelayDevice relay)
{
RedLedRelay = relay;
}
void SetGreenLedRelay(GenericRelayDevice relay)
{
GreenLedRelay = relay;
}
/// <summary>
/// Check the state of the input change and handle accordingly
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void InputStateFeedback_OutputChange(object sender, EventArgs e)
{
if ((sender as IDigitalInput).InputStateFeedback.BoolValue)
TogglePrivacyMute();
}
/// <summary>
/// Toggles the state of the privacy mute
/// </summary>
void TogglePrivacyMute()
{
PrivacyDevice.PrivacyModeToggle();
}
}
}

View File

@@ -109,7 +109,6 @@
<Compile Include="Crestron IO\Relay\GenericRelayDevice.cs" />
<Compile Include="Devices\CodecInterfaces.cs" />
<Compile Include="Global\JobTimer.cs" />
<Compile Include="Microphone Privacy\MicrophonePrivacyController.cs" />
<Compile Include="Ramps and Increments\ActionIncrementer.cs" />
<Compile Include="Comm and IR\CommFactory.cs" />
<Compile Include="Comm and IR\CommunicationExtras.cs" />