diff --git a/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericVersiportInputDevice.cs b/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericVersiportInputDevice.cs
index f9f56d7d..37f978a1 100644
--- a/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericVersiportInputDevice.cs
+++ b/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericVersiportInputDevice.cs
@@ -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();
}
}
}
\ No newline at end of file
diff --git a/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs b/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs
index 40260ce2..ac88f0d7 100644
--- a/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs
+++ b/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs
@@ -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;
}
diff --git a/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs b/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs
index ca81a982..adfb2499 100644
--- a/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs
+++ b/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs
@@ -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);
+ }
+ }
}
///
diff --git a/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs b/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs
index 6b0e548c..74bb76c2 100644
--- a/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs
+++ b/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs
@@ -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);
+ }
+ }
}
}
diff --git a/Essentials Devices Common/Essentials Devices Common/Occupancy/EssentialsGlsOccupancySensorBaseController.cs b/Essentials Devices Common/Essentials Devices Common/Occupancy/EssentialsGlsOccupancySensorBaseController.cs
index 8317a6dc..05425970 100644
--- a/Essentials Devices Common/Essentials Devices Common/Occupancy/EssentialsGlsOccupancySensorBaseController.cs
+++ b/Essentials Devices Common/Essentials Devices Common/Occupancy/EssentialsGlsOccupancySensorBaseController.cs
@@ -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");
diff --git a/Essentials/PepperDashEssentials/ControlSystem.cs b/Essentials/PepperDashEssentials/ControlSystem.cs
index 130419a2..d75ddd1e 100644
--- a/Essentials/PepperDashEssentials/ControlSystem.cs
+++ b/Essentials/PepperDashEssentials/ControlSystem.cs
@@ -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();
}
diff --git a/Essentials/PepperDashEssentials/OTHER/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs b/Essentials/PepperDashEssentials/OTHER/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs
index b2c9eac0..ce70e381 100644
--- a/Essentials/PepperDashEssentials/OTHER/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs
+++ b/Essentials/PepperDashEssentials/OTHER/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs
@@ -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();
+
+ }
+
///
/// Sets up remote occupancy that will relay the occupancy status determined by local system devices to Fusion
///
diff --git a/Essentials/PepperDashEssentials/Properties/AssemblyInfo.cs b/Essentials/PepperDashEssentials/Properties/AssemblyInfo.cs
index 98dbd4eb..bb3fc49d 100644
--- a/Essentials/PepperDashEssentials/Properties/AssemblyInfo.cs
+++ b/Essentials/PepperDashEssentials/Properties/AssemblyInfo.cs
@@ -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.*")]
diff --git a/Essentials/PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs b/Essentials/PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs
index cce57191..54f5a959 100644
--- a/Essentials/PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs
+++ b/Essentials/PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs
@@ -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
diff --git a/Essentials/PepperDashEssentials/Room/Types/EssentialsRoomBase.cs b/Essentials/PepperDashEssentials/Room/Types/EssentialsRoomBase.cs
index c5e3830d..7e18f55b 100644
--- a/Essentials/PepperDashEssentials/Room/Types/EssentialsRoomBase.cs
+++ b/Essentials/PepperDashEssentials/Room/Types/EssentialsRoomBase.cs
@@ -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
///
///
- 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(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