diff --git a/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs b/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs new file mode 100644 index 00000000..d7720920 --- /dev/null +++ b/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs @@ -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 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(); + } + } +} \ No newline at end of file diff --git a/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericVersiportInputDevice.cs b/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericVersiportInputDevice.cs index d9a60f6b..a7103c68 100644 --- a/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericVersiportInputDevice.cs +++ b/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericVersiportInputDevice.cs @@ -5,39 +5,38 @@ using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; - namespace PepperDash.Essentials.Core.Crestron_IO { /// /// Represents a generic digital input deviced tied to a versiport /// - 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 InputStateFeedbackFunc - //{ - // get - // { - // return () => InputPort.DigitalIn; - // } - //} + Func 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(); + } } } \ No newline at end of file diff --git a/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/IDigitalInput.cs b/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/IDigitalInput.cs index 7ed86822..4adc77f7 100644 --- a/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/IDigitalInput.cs +++ b/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/IDigitalInput.cs @@ -6,8 +6,11 @@ using Crestron.SimplSharp; namespace PepperDash.Essentials.Core.Crestron_IO { + /// + /// Represents a device that provides digital input + /// public interface IDigitalInput { - + BoolFeedback InputStateFeedback { get; } } } \ No newline at end of file diff --git a/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs b/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs index f4fc57f9..94bf1cc7 100644 --- a/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs +++ b/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs @@ -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 /// 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 relaystatefeedbackfunc - //{ - // get - // { - // return () => relayoutput.state; - // } - //} + Func 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(); + } } } \ No newline at end of file diff --git a/Essentials Core/PepperDashEssentialsBase/Microphone Privacy/MicrophonePrivacyController.cs b/Essentials Core/PepperDashEssentialsBase/Microphone Privacy/MicrophonePrivacyController.cs new file mode 100644 index 00000000..070e47a6 --- /dev/null +++ b/Essentials Core/PepperDashEssentialsBase/Microphone Privacy/MicrophonePrivacyController.cs @@ -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 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(PrivacyModeIsOnFeedback_OutputChange); + + Inputs = new List(); + } + + 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(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; + } + + /// + /// Check the state of the input change and handle accordingly + /// + /// + /// + void InputStateFeedback_OutputChange(object sender, EventArgs e) + { + if ((sender as IDigitalInput).InputStateFeedback.BoolValue) + TogglePrivacyMute(); + } + + /// + /// Toggles the state of the privacy mute + /// + void TogglePrivacyMute() + { + PrivacyDevice.PrivacyModeToggle(); + } + } +} \ No newline at end of file diff --git a/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj index a3004a17..4ca18905 100644 --- a/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -103,11 +103,13 @@ + + diff --git a/Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs b/Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs index e0389093..2a49bd24 100644 --- a/Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs +++ b/Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs @@ -38,4 +38,17 @@ namespace PepperDash.Essentials.Devices.Common.Codec } } } + + /// + /// + /// + public class CodecCallStatusItemChangeEventArgs : EventArgs + { + public CodecActiveCallItem CallItem { get; private set; } + + public CodecCallStatusItemChangeEventArgs(CodecActiveCallItem item) + { + CallItem = item; + } + } } \ No newline at end of file diff --git a/Essentials Devices Common/Essentials Devices Common/Codec/iHasDialer.cs b/Essentials Devices Common/Essentials Devices Common/Codec/iHasDialer.cs index 6a18de99..a4452b21 100644 --- a/Essentials Devices Common/Essentials Devices Common/Codec/iHasDialer.cs +++ b/Essentials Devices Common/Essentials Devices Common/Codec/iHasDialer.cs @@ -24,27 +24,7 @@ namespace PepperDash.Essentials.Devices.Common.Codec void RejectCall(CodecActiveCallItem item); void SendDtmf(string digit); - //BoolFeedback IncomingCallFeedback { get; } + bool IsInCall { get; } } - - /// - /// - /// - 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; - } - } } \ No newline at end of file diff --git a/Release Package/PepperDashEssentials.cpz b/Release Package/PepperDashEssentials.cpz index 4bd4dcce..4dd408f3 100644 Binary files a/Release Package/PepperDashEssentials.cpz and b/Release Package/PepperDashEssentials.cpz differ diff --git a/Release Package/PepperDashEssentials.dll b/Release Package/PepperDashEssentials.dll index 77253186..80dd7a13 100644 Binary files a/Release Package/PepperDashEssentials.dll and b/Release Package/PepperDashEssentials.dll differ