Fixed issues with Debug calls in PreActivation Actions for Cresnet Devices

Fixed issues related to subscribing to GlsOccupancySensorBase Events

Resolves #292
This commit is contained in:
Trevor Payne
2020-07-01 16:57:42 -05:00
parent 00958164ff
commit 0d802bdeed
6 changed files with 39 additions and 37 deletions

View File

@@ -115,17 +115,17 @@ namespace PepperDash.Essentials.Core.CrestronIO
if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nRths");
Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nRths", parentKey);
return new C2nRths(cresnetId, Global.ControlSystem);
}
var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as ICresnetBridge;
if (cresnetBridge != null)
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nRths");
Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nRths", parentKey);
return new C2nRths(cresnetId, cresnetBridge.Branches[branchId]);
}
Debug.Console(0, "Device {0} is not a valid cresnet master", branchId);
Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
return null;
}
#endregion

View File

@@ -185,17 +185,17 @@ namespace PepperDash.Essentials.Core.CrestronIO
if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new StatusSign");
Debug.Console(0, "Device {0} is a valid cresnet master - creating new StatusSign", parentKey);
return new StatusSign(cresnetId, Global.ControlSystem);
}
var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as ICresnetBridge;
if (cresnetBridge != null)
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new StatusSign");
Debug.Console(0, "Device {0} is a valid cresnet master - creating new StatusSign", parentKey);
return new StatusSign(cresnetId, cresnetBridge.Branches[branchId]);
}
Debug.Console(0, "Device {0} is not a valid cresnet master", branchId);
Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
return null;
}
#endregion

View File

@@ -113,7 +113,7 @@ namespace PepperDash.Essentials.Core
if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOdtCCn");
Debug.Console(0, "Device {0} is a valid cresnet master - creating new CenRfgw", parentKey);
if (type.Equals("cenerfgwpoe", StringComparison.InvariantCultureIgnoreCase))
{
return new CenErfgwPoeCresnet(cresnetId, Global.ControlSystem);
@@ -127,7 +127,7 @@ namespace PepperDash.Essentials.Core
if (cresnetBridge != null)
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOdtCCn");
Debug.Console(0, "Device {0} is a valid cresnet master - creating new CenRfgw", parentKey);
if (type.Equals("cenerfgwpoe", StringComparison.InvariantCultureIgnoreCase))
{
@@ -138,7 +138,7 @@ namespace PepperDash.Essentials.Core
return new CenRfgwExCresnet(cresnetId, cresnetBridge.Branches[branchId]);
}
}
Debug.Console(0, "Device {0} is not a valid cresnet master", branchId);
Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
return null;
}

View File

@@ -243,17 +243,17 @@ namespace PepperDash.Essentials.Core
if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsPartCn");
Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsPartCn", parentKey);
return new GlsPartCn(cresnetId, Global.ControlSystem);
}
var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as ICresnetBridge;
if (cresnetBridge != null)
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsPartCn");
Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsPartCn", parentKey);
return new GlsPartCn(cresnetId, cresnetBridge.Branches[branchId]);
}
Debug.Console(0, "Device {0} is not a valid cresnet master", branchId);
Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
return null;
}
#endregion

View File

@@ -67,45 +67,47 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy
RegisterCrestronGenericBase(OccSensor);
RegisterGlsOdtSensorBaseController();
RegisterGlsOdtSensorBaseController(OccSensor);
});
}
public GlsOccupancySensorBaseController(string key, string name) : base(key, name) {}
protected void RegisterGlsOdtSensorBaseController()
protected void RegisterGlsOdtSensorBaseController(GlsOccupancySensorBase occSensor)
{
OccSensor = occSensor;
RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc);
PirSensorEnabledFeedback = new BoolFeedback(() => OccSensor.PirEnabledFeedback.BoolValue);
PirSensorEnabledFeedback = new BoolFeedback(() => OccSensor.PirEnabledFeedback.BoolValue);
LedFlashEnabledFeedback = new BoolFeedback(() => OccSensor.LedFlashEnabledFeedback.BoolValue);
LedFlashEnabledFeedback = new BoolFeedback(() => OccSensor.LedFlashEnabledFeedback.BoolValue);
ShortTimeoutEnabledFeedback = new BoolFeedback(() => OccSensor.ShortTimeoutEnabledFeedback.BoolValue);
ShortTimeoutEnabledFeedback = new BoolFeedback(() => OccSensor.ShortTimeoutEnabledFeedback.BoolValue);
PirSensitivityInVacantStateFeedback =
new IntFeedback(() => OccSensor.PirSensitivityInVacantStateFeedback.UShortValue);
PirSensitivityInVacantStateFeedback =
new IntFeedback(() => OccSensor.PirSensitivityInVacantStateFeedback.UShortValue);
PirSensitivityInOccupiedStateFeedback =
new IntFeedback(() => OccSensor.PirSensitivityInOccupiedStateFeedback.UShortValue);
PirSensitivityInOccupiedStateFeedback =
new IntFeedback(() => OccSensor.PirSensitivityInOccupiedStateFeedback.UShortValue);
CurrentTimeoutFeedback = new IntFeedback(() => OccSensor.CurrentTimeoutFeedback.UShortValue);
CurrentTimeoutFeedback = new IntFeedback(() => OccSensor.CurrentTimeoutFeedback.UShortValue);
LocalTimoutFeedback = new IntFeedback(() => OccSensor.LocalTimeoutFeedback.UShortValue);
LocalTimoutFeedback = new IntFeedback(() => OccSensor.LocalTimeoutFeedback.UShortValue);
GraceOccupancyDetectedFeedback =
new BoolFeedback(() => OccSensor.GraceOccupancyDetectedFeedback.BoolValue);
GraceOccupancyDetectedFeedback =
new BoolFeedback(() => OccSensor.GraceOccupancyDetectedFeedback.BoolValue);
RawOccupancyFeedback = new BoolFeedback(() => OccSensor.RawOccupancyFeedback.BoolValue);
RawOccupancyFeedback = new BoolFeedback(() => OccSensor.RawOccupancyFeedback.BoolValue);
InternalPhotoSensorValue = new IntFeedback(() => OccSensor.InternalPhotoSensorValueFeedback.UShortValue);
InternalPhotoSensorValue = new IntFeedback(() => OccSensor.InternalPhotoSensorValueFeedback.UShortValue);
ExternalPhotoSensorValue = new IntFeedback(() => OccSensor.ExternalPhotoSensorValueFeedback.UShortValue);
ExternalPhotoSensorValue = new IntFeedback(() => OccSensor.ExternalPhotoSensorValueFeedback.UShortValue);
OccSensor.BaseEvent += new Crestron.SimplSharpPro.BaseEventHandler(OccSensor_BaseEvent);
OccSensor.BaseEvent += OccSensor_BaseEvent;
OccSensor.GlsOccupancySensorChange += OccSensor_GlsOccupancySensorChange;
OccSensor.GlsOccupancySensorChange += OccSensor_GlsOccupancySensorChange;
}
@@ -420,17 +422,17 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy
if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOirCCn");
Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOirCCn", parentKey);
return new GlsOirCCn(cresnetId, Global.ControlSystem);
}
var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as ICresnetBridge;
if (cresnetBridge != null)
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOirCCn");
Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOirCCn", parentKey);
return new GlsOirCCn(cresnetId, cresnetBridge.Branches[branchId]);
}
Debug.Console(0, "Device {0} is not a valid cresnet master", branchId);
Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
return null;
}
#endregion

View File

@@ -45,7 +45,7 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy
RegisterCrestronGenericBase(OccSensor);
RegisterGlsOdtSensorBaseController();
RegisterGlsOdtSensorBaseController(OccSensor);
AndWhenVacatedFeedback = new BoolFeedback(() => OccSensor.AndWhenVacatedFeedback.BoolValue);
@@ -181,17 +181,17 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy
if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOdtCCn");
Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOdtCCn", parentKey);
return new GlsOdtCCn(cresnetId, Global.ControlSystem);
}
var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as ICresnetBridge;
if (cresnetBridge != null)
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOdtCCn");
Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOdtCCn", parentKey);
return new GlsOdtCCn(cresnetId, cresnetBridge.Branches[branchId]);
}
Debug.Console(0, "Device {0} is not a valid cresnet master", branchId);
Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
return null;
}
#endregion