v1.0.33.* -Fixed issues with versiport configuration for pull up resistor based on feedback from Alex onsite. Corrected issue with RoomIsOccupiedFeedback_OutputChange method in EssentialsRoomBase. Updated Fusion Remote Occ sensor logic.

This commit is contained in:
Neil Dorin
2018-01-22 16:37:27 -07:00
parent b83b3737e9
commit b85abe1b79
10 changed files with 81 additions and 43 deletions

View File

@@ -26,19 +26,25 @@ namespace PepperDash.Essentials.Core.CrestronIO
}
}
public GenericVersiportDigitalInputDevice(string key, Versiport inputPort):
public GenericVersiportDigitalInputDevice(string key, Versiport inputPort, IOPortConfig props):
base(key)
{
InputStateFeedback = new BoolFeedback(InputStateFeedbackFunc);
InputPort = inputPort;
InputPort.SetVersiportConfiguration(eVersiportConfiguration.DigitalInput);
InputPort.SetVersiportConfiguration(eVersiportConfiguration.DigitalInput);
if (props.DisablePullUpResistor)
InputPort.DisablePullUpResistor = true;
InputPort.VersiportChange += new VersiportEventHandler(InputPort_VersiportChange);
Debug.Console(1, this, "Created GenericVersiportDigitalInputDevice on port '{0}'. DisablePullUpResistor: '{1}'", props.PortNumber, InputPort.DisablePullUpResistor);
}
void InputPort_VersiportChange(Versiport port, VersiportEventArgs args)
{
Debug.Console(1, this, "Versiport change: {0}", args.Event);
InputStateFeedback.FireUpdate();
if(args.Event == eVersiportEvent.DigitalInChange)
InputStateFeedback.FireUpdate();
}
}
}

View File

@@ -40,11 +40,13 @@ namespace PepperDash.Essentials.Core
{
Debug.Console(0, this, "Activating");
var response = Hardware.RegisterWithLogging(Key);
if (response == eDeviceRegistrationUnRegistrationResponse.Success)
if (response != eDeviceRegistrationUnRegistrationResponse.Success)
{
Hardware.OnlineStatusChange += new OnlineStatusChangeEventHandler(Hardware_OnlineStatusChange);
CommunicationMonitor.Start();
Debug.Console(0, this, "ERROR: Cannot register Crestron device: {0}", response);
return false;
}
Hardware.OnlineStatusChange += new OnlineStatusChangeEventHandler(Hardware_OnlineStatusChange);
CommunicationMonitor.Start();
return true;
}

View File

@@ -63,10 +63,17 @@ namespace PepperDash.Essentials.Core
public static void ActivateAll()
{
foreach (var d in Devices.Values)
{
if (d is Device)
(d as Device).Activate();
}
{
try
{
if (d is Device)
(d as Device).Activate();
}
catch (Exception e)
{
Debug.Console(0, d, "ERROR: Device activation failure:\r{0}", e);
}
}
}
/// <summary>

View File

@@ -177,28 +177,10 @@ namespace PepperDash.Essentials.Devices.Common
return null;
}
if (cs.SupportsDigitalInput)
if (cs.SupportsVersiport)
{
if (props.PortNumber > cs.NumberOfDigitalInputPorts)
{
Debug.Console(0, "WARNING: Cannot register DIO port {0} on {1}. Out of range",
props.PortNumber, props.PortDeviceKey);
return null;
}
Debug.Console(1, "Attempting to add Digital Input device to Versiport port '{0}'", props.PortNumber);
DigitalInput digitalInput = cs.DigitalInputPorts[props.PortNumber];
if (!digitalInput.Registered)
{
if (digitalInput.Register() == eDeviceRegistrationUnRegistrationResponse.Success)
return new GenericDigitalInputDevice(key, digitalInput);
else
Debug.Console(0, "WARNING: Attempt to register digital input {0} on device with key '{1}' failed.",
props.PortNumber, props.PortDeviceKey);
}
}
else if (cs.SupportsVersiport)
{
if (props.PortNumber > cs.NumberOfVersiPorts)
{
Debug.Console(0, "WARNING: Cannot add Vesiport {0} on {1}. Out of range",
@@ -212,10 +194,9 @@ namespace PepperDash.Essentials.Devices.Common
{
var regSuccess = vp.Register();
if (regSuccess == eDeviceRegistrationUnRegistrationResponse.Success)
{
if (props.DisablePullUpResistor)
vp.DisablePullUpResistor = true;
return new GenericVersiportDigitalInputDevice(key, vp);
{
Debug.Console(1, "Successfully Created Digital Input Device on Versiport");
return new GenericVersiportDigitalInputDevice(key, vp, props);
}
else
{
@@ -225,6 +206,31 @@ namespace PepperDash.Essentials.Devices.Common
}
}
}
else if (cs.SupportsDigitalInput)
{
Debug.Console(1, "Attempting to add Digital Input device to Digital Input port '{0}'", props.PortNumber);
if (props.PortNumber > cs.NumberOfDigitalInputPorts)
{
Debug.Console(0, "WARNING: Cannot register DIO port {0} on {1}. Out of range",
props.PortNumber, props.PortDeviceKey);
return null;
}
DigitalInput digitalInput = cs.DigitalInputPorts[props.PortNumber];
if (!digitalInput.Registered)
{
if (digitalInput.Register() == eDeviceRegistrationUnRegistrationResponse.Success)
{
Debug.Console(1, "Successfully Created Digital Input Device on Digital Input");
return new GenericDigitalInputDevice(key, digitalInput);
}
else
Debug.Console(0, "WARNING: Attempt to register digital input {0} on device with key '{1}' failed.",
props.PortNumber, props.PortDeviceKey);
}
}
}
}

View File

@@ -50,7 +50,7 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy
Debug.Console(1, this, "In Mock Mode: '{0}'", InTestMode);
}
public void SetTestState(bool state)
public void SetTestOccupiedState(bool state)
{
if (!InTestMode)
Debug.Console(1, "Mock mode not enabled");

View File

@@ -68,7 +68,6 @@ namespace PepperDash.Essentials
Load();
DeviceManager.ActivateAll();
Debug.Console(0, "Essentials load complete\r" +
"-------------------------------------------------------------");
}
@@ -147,6 +146,8 @@ namespace PepperDash.Essentials
LoadTieLines();
LoadRooms();
LoadLogoServer();
DeviceManager.ActivateAll();
}

View File

@@ -1208,14 +1208,23 @@ namespace PepperDash.Essentials.Fusion
{
RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc);
FusionRoom.FusionAssetStateChange += new FusionAssetStateEventHandler(FusionRoom_FusionAssetStateChange);
// Build Occupancy Asset?
// Link sigs?
Room.SetRoomOccupancy(this);
//Room.SetRoomOccupancy(this as IOccupancyStatusProvider, 0);
}
void FusionRoom_FusionAssetStateChange(FusionBase device, FusionAssetStateEventArgs args)
{
if (args.EventId == FusionAssetEventId.RoomOccupiedReceivedEventId || args.EventId == FusionAssetEventId.RoomUnoccupiedReceivedEventId)
RoomIsOccupiedFeedback.FireUpdate();
}
/// <summary>
/// Sets up remote occupancy that will relay the occupancy status determined by local system devices to Fusion
/// </summary>

View File

@@ -4,5 +4,5 @@
[assembly: AssemblyCompany("PepperDash Technology Corp")]
[assembly: AssemblyProduct("PepperDashEssentials")]
[assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2017")]
[assembly: AssemblyVersion("1.0.30.*")]
[assembly: AssemblyVersion("1.0.33.*")]

View File

@@ -29,6 +29,10 @@ namespace PepperDash.Essentials.Room.Config
var disp = DeviceManager.GetDeviceForKey(props.DefaultDisplayKey) as IRoutingSinkWithSwitching;
var audio = DeviceManager.GetDeviceForKey(props.DefaultAudioKey) as IRoutingSinkNoSwitching;
var huddle = new EssentialsHuddleSpaceRoom(Key, Name, disp, audio, props);
if (props.Occupancy != null)
huddle.SetRoomOccupancy(DeviceManager.GetDeviceForKey(props.Occupancy.DeviceKey) as
PepperDash.Essentials.Devices.Common.Occupancy.IOccupancyStatusProvider, props.Occupancy.TimoutMinutes);
huddle.LogoUrl = props.Logo.GetUrl();
huddle.SourceListKey = props.SourceListKey;
huddle.DefaultSourceItem = props.DefaultSourceItem;
@@ -67,8 +71,8 @@ namespace PepperDash.Essentials.Room.Config
// Add Occupancy object from config
if (props.Occupancy != null)
rm.SetRoomOccupancy(DeviceManager.GetDeviceForKey(props.Occupancy.DeviceKey) as
PepperDash.Essentials.Devices.Common.Occupancy.IOccupancyStatusProvider);
rm.SetRoomOccupancy(DeviceManager.GetDeviceForKey(props.Occupancy.DeviceKey) as
PepperDash.Essentials.Devices.Common.Occupancy.IOccupancyStatusProvider, props.Occupancy.TimoutMinutes);
rm.LogoUrl = props.Logo.GetUrl();
rm.SourceListKey = props.SourceListKey;
rm.DefaultSourceItem = props.DefaultSourceItem;
@@ -252,7 +256,7 @@ namespace PepperDash.Essentials.Room.Config
public class EssentialsRoomOccSensorConfig
{
public string DeviceKey { get; set; }
public string TimoutMinutes { get; set; }
public int TimoutMinutes { get; set; }
}
public class EssentialsRoomTechConfig

View File

@@ -186,7 +186,7 @@ namespace PepperDash.Essentials
/// Sets the object to be used as the IOccupancyStatusProvider for the room. Can be an Occupancy Aggregator or a specific device
/// </summary>
/// <param name="statusProvider"></param>
public void SetRoomOccupancy(IOccupancyStatusProvider statusProvider)
public void SetRoomOccupancy(IOccupancyStatusProvider statusProvider, int timeoutMinutes)
{
if (statusProvider == null)
{
@@ -198,6 +198,9 @@ namespace PepperDash.Essentials
if (statusProvider is PepperDash.Essentials.Fusion.EssentialsHuddleSpaceFusionSystemControllerBase)
OccupancyStatusProviderIsRemote = true;
if(timeoutMinutes > 0)
RoomVacancyShutdownSeconds = timeoutMinutes * 60;
RoomOccupancy = statusProvider;
RoomOccupancy.RoomIsOccupiedFeedback.OutputChange += new EventHandler<EventArgs>(RoomIsOccupiedFeedback_OutputChange);
@@ -205,7 +208,7 @@ namespace PepperDash.Essentials
void RoomIsOccupiedFeedback_OutputChange(object sender, EventArgs e)
{
if ((sender as IOccupancyStatusProvider).RoomIsOccupiedFeedback.BoolValue == false)
if (RoomOccupancy.RoomIsOccupiedFeedback.BoolValue == false)
{
Debug.Console(1, this, "Notice: Vacancy Detected");
// Trigger the timer when the room is vacant