mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-13 03:35:00 +00:00
MIcrophone Privacy feature tested and working as far as relay switching. Needs someone to short the digital inputs on the office RMC and load to PRO3 or other versiport compatible processor to test mic button contact closure input.
This commit is contained in:
@@ -61,7 +61,7 @@
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="PepperDash_Core, Version=1.0.6284.20368, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\pepperdash-simplsharp-core\Pepperdash Core\CLZ Builds\PepperDash_Core.dll</HintPath>
|
||||
<HintPath>..\..\..\PepperDash.Core\Pepperdash Core\Pepperdash Core\bin\PepperDash_Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SimplSharpCustomAttributesInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
@@ -119,6 +119,8 @@
|
||||
<Compile Include="DSP\PolycomSoundStructure\SoundStructureBasics.cs" />
|
||||
<Compile Include="Factory\DeviceFactory.cs" />
|
||||
<Compile Include="Generic\GenericSource.cs" />
|
||||
<Compile Include="MIcrophone\MicrophonePrivacyController.cs" />
|
||||
<Compile Include="MIcrophone\MicrophonePrivacyControllerConfig.cs" />
|
||||
<Compile Include="Occupancy\EssentialsGlsOccupancySensorBaseController.cs" />
|
||||
<Compile Include="Occupancy\EssentialsOccupancyAggregator.cs" />
|
||||
<Compile Include="Occupancy\iOccupancyStatusProvider.cs" />
|
||||
|
||||
@@ -9,6 +9,7 @@ using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.CrestronIO;
|
||||
|
||||
using PepperDash.Essentials.Devices.Common.DSP;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
@@ -118,11 +119,114 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
|
||||
else if (typeName == "versiportinput")
|
||||
{
|
||||
var props = JsonConvert.DeserializeObject < PepperDash.Essentials.Core.Crestron_IO.GenericVersiportInputDeviceConfigProperties>(properties.ToString());
|
||||
var props = JsonConvert.DeserializeObject<IOPortConfig>(properties.ToString());
|
||||
|
||||
IIOPorts portDevice;
|
||||
|
||||
//Versiport inputPort = new Versiport();
|
||||
//return new PepperDash.Essentials.Core.Crestron_IO.GenericVersiportInputDevice(inputPort);
|
||||
if (props.PortDeviceKey == "processor")
|
||||
portDevice = Global.ControlSystem as IIOPorts;
|
||||
else
|
||||
portDevice = DeviceManager.GetDeviceForKey(props.PortDeviceKey) as IIOPorts;
|
||||
|
||||
if(portDevice == null)
|
||||
Debug.Console(0, "Unable to add versiport device with key '{0}'. Port Device does not support versiports", key);
|
||||
else
|
||||
{
|
||||
var cs = (portDevice as CrestronControlSystem);
|
||||
|
||||
if (cs != null)
|
||||
if (cs.SupportsVersiport && props.PortNumber <= cs.NumberOfVersiPorts)
|
||||
{
|
||||
Versiport versiport = cs.VersiPorts[props.PortNumber];
|
||||
|
||||
if(!versiport.Registered)
|
||||
{
|
||||
if (versiport.Register() == eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
return new GenericVersiportInputDevice(key, versiport);
|
||||
else
|
||||
Debug.Console(0, "Attempt to register versiport {0} on device with key '{1}' failed.", props.PortNumber, props.PortDeviceKey);
|
||||
}
|
||||
}
|
||||
|
||||
// Future: Check if portDevice is 3-series card or other non control system that supports versiports
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
else if (typeName == "digitalinput")
|
||||
{
|
||||
var props = JsonConvert.DeserializeObject<IOPortConfig>(properties.ToString());
|
||||
|
||||
IDigitalInputPorts portDevice;
|
||||
|
||||
if (props.PortDeviceKey == "processor")
|
||||
portDevice = Global.ControlSystem as IDigitalInputPorts;
|
||||
else
|
||||
portDevice = DeviceManager.GetDeviceForKey(props.PortDeviceKey) as IDigitalInputPorts;
|
||||
|
||||
if (portDevice == null)
|
||||
Debug.Console(0, "Unable to add digital input device with key '{0}'. Port Device does not support digital inputs", key);
|
||||
else
|
||||
{
|
||||
var cs = (portDevice as CrestronControlSystem);
|
||||
|
||||
if (cs != null)
|
||||
if (cs.SupportsDigitalInput && props.PortNumber <= cs.NumberOfDigitalInputPorts)
|
||||
{
|
||||
DigitalInput digitalInput = cs.DigitalInputPorts[props.PortNumber];
|
||||
|
||||
if (!digitalInput.Registered)
|
||||
{
|
||||
if(digitalInput.Register() == eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
return new GenericDigitalInputDevice(key, digitalInput);
|
||||
else
|
||||
Debug.Console(0, "Attempt to register digital input {0} on device with key '{1}' failed.", props.PortNumber, props.PortDeviceKey);
|
||||
}
|
||||
}
|
||||
// Future: Check if portDevice is 3-series card or other non control system that supports versiports
|
||||
}
|
||||
}
|
||||
|
||||
else if (typeName == "relayoutput")
|
||||
{
|
||||
var props = JsonConvert.DeserializeObject<IOPortConfig>(properties.ToString());
|
||||
|
||||
IRelayPorts portDevice;
|
||||
|
||||
if (props.PortDeviceKey == "processor")
|
||||
portDevice = Global.ControlSystem as IRelayPorts;
|
||||
else
|
||||
portDevice = DeviceManager.GetDeviceForKey(props.PortDeviceKey) as IRelayPorts;
|
||||
|
||||
if (portDevice == null)
|
||||
Debug.Console(0, "Unable to add relay device with key '{0}'. Port Device does not support relays", key);
|
||||
else
|
||||
{
|
||||
var cs = (portDevice as CrestronControlSystem);
|
||||
|
||||
if(cs != null)
|
||||
if (cs.SupportsRelay && props.PortNumber <= cs.NumberOfRelayPorts)
|
||||
{
|
||||
Relay relay = cs.RelayPorts[props.PortNumber];
|
||||
|
||||
if (!relay.Registered)
|
||||
{
|
||||
if(relay.Register() == eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
return new GenericRelayDevice(key, relay);
|
||||
else
|
||||
Debug.Console(0, "Attempt to register relay {0} on device with key '{1}' failed.", props.PortNumber, props.PortDeviceKey);
|
||||
}
|
||||
}
|
||||
|
||||
// Future: Check if portDevice is 3-series card or other non control system that supports versiports
|
||||
}
|
||||
}
|
||||
|
||||
else if (typeName == "microphoneprivacycontroller")
|
||||
{
|
||||
var props = JsonConvert.DeserializeObject<Microphones.MicrophonePrivacyControllerConfig>(properties.ToString());
|
||||
|
||||
return new Microphones.MicrophonePrivacyController(key, props);
|
||||
}
|
||||
|
||||
else if (groupName == "settopbox") //(typeName == "irstbbase")
|
||||
|
||||
@@ -6,7 +6,7 @@ using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Crestron_IO;
|
||||
using PepperDash.Essentials.Core.CrestronIO;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Microphones
|
||||
@@ -17,6 +17,8 @@ namespace PepperDash.Essentials.Devices.Common.Microphones
|
||||
/// </summary>
|
||||
public class MicrophonePrivacyController : Device
|
||||
{
|
||||
MicrophonePrivacyControllerConfig Config;
|
||||
|
||||
public bool EnableLeds
|
||||
{
|
||||
get
|
||||
@@ -25,11 +27,15 @@ namespace PepperDash.Essentials.Devices.Common.Microphones
|
||||
}
|
||||
set
|
||||
{
|
||||
_enableLeds = value;
|
||||
|
||||
if (value)
|
||||
SetLedRelayStates();
|
||||
{
|
||||
CheckPrivacyMode();
|
||||
SetLedStates();
|
||||
}
|
||||
else
|
||||
TurnOffAllLeds();
|
||||
_enableLeds = value;
|
||||
}
|
||||
}
|
||||
bool _enableLeds;
|
||||
@@ -47,9 +53,40 @@ namespace PepperDash.Essentials.Devices.Common.Microphones
|
||||
public MicrophonePrivacyController(string key, MicrophonePrivacyControllerConfig config) :
|
||||
base(key)
|
||||
{
|
||||
Config = config;
|
||||
|
||||
Inputs = new List<IDigitalInput>();
|
||||
}
|
||||
|
||||
public override bool CustomActivate()
|
||||
{
|
||||
foreach (var i in Config.Inputs)
|
||||
{
|
||||
var input = DeviceManager.GetDeviceForKey(i.DeviceKey) as IDigitalInput;
|
||||
|
||||
if(input != null)
|
||||
AddInput(input);
|
||||
}
|
||||
|
||||
var greenLed = DeviceManager.GetDeviceForKey(Config.GreenLedRelay.DeviceKey) as GenericRelayDevice;
|
||||
|
||||
if (greenLed != null)
|
||||
GreenLedRelay = greenLed;
|
||||
else
|
||||
Debug.Console(0, this, "Unable to add Green LED device");
|
||||
|
||||
var redLed = DeviceManager.GetDeviceForKey(Config.RedLedRelay.DeviceKey) as GenericRelayDevice;
|
||||
|
||||
if (redLed != null)
|
||||
RedLedRelay = redLed;
|
||||
else
|
||||
Debug.Console(0, this, "Unable to add Red LED device");
|
||||
|
||||
CheckPrivacyMode();
|
||||
|
||||
return base.CustomActivate();
|
||||
}
|
||||
|
||||
public void SetPrivacyDevice(IPrivacy privacyDevice)
|
||||
{
|
||||
PrivacyDevice = privacyDevice;
|
||||
@@ -59,13 +96,20 @@ namespace PepperDash.Essentials.Devices.Common.Microphones
|
||||
|
||||
void PrivacyModeIsOnFeedback_OutputChange(object sender, EventArgs e)
|
||||
{
|
||||
var privacyState = (sender as IPrivacy).PrivacyModeIsOnFeedback.BoolValue;
|
||||
CheckPrivacyMode();
|
||||
}
|
||||
|
||||
if (privacyState)
|
||||
TurnOnRedLeds();
|
||||
else
|
||||
TurnOnGreenLeds();
|
||||
void CheckPrivacyMode()
|
||||
{
|
||||
if (PrivacyDevice != null)
|
||||
{
|
||||
var privacyState = PrivacyDevice.PrivacyModeIsOnFeedback.BoolValue;
|
||||
|
||||
if (privacyState)
|
||||
TurnOnRedLeds();
|
||||
else
|
||||
TurnOnGreenLeds();
|
||||
}
|
||||
}
|
||||
|
||||
void AddInput(IDigitalInput input)
|
||||
@@ -118,32 +162,24 @@ namespace PepperDash.Essentials.Devices.Common.Microphones
|
||||
{
|
||||
_greenLedRelayState = false;
|
||||
_redLedRelayState = true;
|
||||
SetLedRelayStates();
|
||||
SetLedStates();
|
||||
}
|
||||
|
||||
void TurnOnGreenLeds()
|
||||
{
|
||||
_redLedRelayState = false;
|
||||
_greenLedRelayState = true;
|
||||
SetLedRelayStates();
|
||||
SetLedStates();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If enabled, sets the actual state of the relays
|
||||
/// </summary>
|
||||
void SetLedRelayStates()
|
||||
void SetLedStates()
|
||||
{
|
||||
if (_enableLeds)
|
||||
{
|
||||
if (_redLedRelayState)
|
||||
RedLedRelay.CloseRelay();
|
||||
else
|
||||
RedLedRelay.OpenRelay();
|
||||
|
||||
if (_greenLedRelayState)
|
||||
GreenLedRelay.CloseRelay();
|
||||
else
|
||||
GreenLedRelay.OpenRelay();
|
||||
SetRelayStates();
|
||||
}
|
||||
else
|
||||
TurnOffAllLeds();
|
||||
@@ -154,8 +190,29 @@ namespace PepperDash.Essentials.Devices.Common.Microphones
|
||||
/// </summary>
|
||||
void TurnOffAllLeds()
|
||||
{
|
||||
GreenLedRelay.OpenRelay();
|
||||
RedLedRelay.OpenRelay();
|
||||
_redLedRelayState = false;
|
||||
_greenLedRelayState = false;
|
||||
|
||||
SetRelayStates();
|
||||
}
|
||||
|
||||
void SetRelayStates()
|
||||
{
|
||||
if (RedLedRelay != null)
|
||||
{
|
||||
if (_redLedRelayState)
|
||||
RedLedRelay.CloseRelay();
|
||||
else
|
||||
RedLedRelay.OpenRelay();
|
||||
}
|
||||
|
||||
if(GreenLedRelay != null)
|
||||
{
|
||||
if (_greenLedRelayState)
|
||||
GreenLedRelay.CloseRelay();
|
||||
else
|
||||
GreenLedRelay.OpenRelay();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Essentials.Core.CrestronIO;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Microphones
|
||||
{
|
||||
public class MicrophonePrivacyControllerConfig
|
||||
{
|
||||
public List<KeyedDevice> Inputs { get; set; }
|
||||
public KeyedDevice GreenLedRelay { get; set; }
|
||||
public KeyedDevice RedLedRelay { get; set; }
|
||||
}
|
||||
|
||||
public class KeyedDevice
|
||||
{
|
||||
public string DeviceKey { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Microphones
|
||||
{
|
||||
public class MicrophonePrivacyControllerConfig
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -75,8 +75,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
new CodecCommandWithLabel("prominent","Prominent"),
|
||||
new CodecCommandWithLabel("single","Single")
|
||||
};
|
||||
|
||||
private CiscoCodecConfiguration.RootObject CodecConfiguration;
|
||||
|
||||
private CiscoCodecConfiguration.RootObject CodecConfiguration = new CiscoCodecConfiguration.RootObject();
|
||||
|
||||
private CiscoCodecStatus.RootObject CodecStatus = new CiscoCodecStatus.RootObject();
|
||||
|
||||
@@ -272,9 +272,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
PortGather.IncludeDelimiter = true;
|
||||
PortGather.LineReceived += this.Port_LineReceived;
|
||||
|
||||
CodecConfiguration = new CiscoCodecConfiguration.RootObject();
|
||||
//CodecStatus = new CiscoCodecStatus.RootObject();
|
||||
|
||||
CodecInfo = new CiscoCodecInfo(CodecStatus, CodecConfiguration);
|
||||
|
||||
CallHistory = new CodecCallHistory();
|
||||
|
||||
Reference in New Issue
Block a user