mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-31 13:25: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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -103,11 +103,13 @@
|
||||
<Reference Include="System.Data" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Crestron IO\Inputs\GenericDigitalInputDevice.cs" />
|
||||
<Compile Include="Crestron IO\Inputs\GenericVersiportInputDevice.cs" />
|
||||
<Compile Include="Crestron IO\Inputs\IDigitalInput.cs" />
|
||||
<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" />
|
||||
|
||||
@@ -38,4 +38,17 @@ namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CodecCallStatusItemChangeEventArgs : EventArgs
|
||||
{
|
||||
public CodecActiveCallItem CallItem { get; private set; }
|
||||
|
||||
public CodecCallStatusItemChangeEventArgs(CodecActiveCallItem item)
|
||||
{
|
||||
CallItem = item;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,27 +24,7 @@ namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
void RejectCall(CodecActiveCallItem item);
|
||||
void SendDtmf(string digit);
|
||||
|
||||
//BoolFeedback IncomingCallFeedback { get; }
|
||||
bool IsInCall { get; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CodecCallStatusItemChangeEventArgs : EventArgs
|
||||
{
|
||||
public CodecActiveCallItem CallItem { get; private set; }
|
||||
|
||||
//public eCodecCallStatus PreviousStatus { get; private set; }
|
||||
|
||||
//public eCodecCallStatus NewStatus { get; private set; }
|
||||
|
||||
public CodecCallStatusItemChangeEventArgs(/*eCodecCallStatus previousStatus,
|
||||
eCodecCallStatus newStatus,*/ CodecActiveCallItem item)
|
||||
{
|
||||
//PreviousStatus = previousStatus;
|
||||
//NewStatus = newStatus;
|
||||
CallItem = item;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user