mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-14 12:15:01 +00:00
Significant refactoring of DeviceFactory for touchpanel device building. Moved SetupHeaderButtons() out of AV driver classes and into new EssentialsHeaderDriver class.
This commit is contained in:
@@ -22,16 +22,30 @@ namespace PepperDash.Essentials.Devices.Common.Environment.Lighting
|
||||
/// <summary>
|
||||
/// Collection of generic switched outputs
|
||||
/// </summary>
|
||||
public Dictionary<uint, ISwitchedOutput> SwitchedOutputs;
|
||||
public Dictionary<uint, ISwitchedOutput> SwitchedOutputs { get; private set; }
|
||||
|
||||
public Din8sw8Controller(string key, string cresnetId)
|
||||
public Din8sw8Controller(string key, uint cresnetId)
|
||||
: base(key)
|
||||
{
|
||||
SwitchedOutputs = new Dictionary<uint, ISwitchedOutput>();
|
||||
|
||||
SwitchModule = new Din8Sw8(cresnetId, Global.ControlSystem);
|
||||
|
||||
if (SwitchModule.Register() != eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
{
|
||||
Debug.Console(2, this, "Error registering Din8sw8. Reason: {0}", SwitchModule.RegistrationFailureReason);
|
||||
}
|
||||
|
||||
PopulateDictionary();
|
||||
}
|
||||
|
||||
public override bool CustomActivate()
|
||||
{
|
||||
|
||||
|
||||
return base.CustomActivate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Populates the generic collection with the loads from the Crestron collection
|
||||
/// </summary>
|
||||
@@ -70,4 +84,5 @@ namespace PepperDash.Essentials.Devices.Common.Environment.Lighting
|
||||
SwitchedOutput.FullOff();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,21 +16,32 @@ namespace PepperDash.Essentials.Devices.Common.Environment.Somfy
|
||||
/// </summary>
|
||||
public class RelayControlledShade : ShadeBase
|
||||
{
|
||||
RelayControlledShadeConfigProperties Config;
|
||||
|
||||
ISwitchedOutput OpenRelay;
|
||||
ISwitchedOutput StopRelay;
|
||||
ISwitchedOutput CloseRelay;
|
||||
|
||||
int RelayPulseTime;
|
||||
|
||||
public RelayControlledShade(string key, string name, RelayControlledShadeConfigProperties props)
|
||||
public RelayControlledShade(string key, string name, RelayControlledShadeConfigProperties config)
|
||||
: base(key, name)
|
||||
{
|
||||
RelayPulseTime = props.RelayPulseTime;
|
||||
//Create ISwitchedOutput objects based on props
|
||||
Config = config;
|
||||
|
||||
OpenRelay = GetSwitchedOutputFromDevice(props.Relays.Open);
|
||||
StopRelay = GetSwitchedOutputFromDevice(props.Relays.Stop);
|
||||
CloseRelay = GetSwitchedOutputFromDevice(props.Relays.Close);
|
||||
RelayPulseTime = Config.RelayPulseTime;
|
||||
|
||||
}
|
||||
|
||||
public override bool CustomActivate()
|
||||
{
|
||||
//Create ISwitchedOutput objects based on props
|
||||
OpenRelay = GetSwitchedOutputFromDevice(Config.Relays.Open);
|
||||
StopRelay = GetSwitchedOutputFromDevice(Config.Relays.Stop);
|
||||
CloseRelay = GetSwitchedOutputFromDevice(Config.Relays.Close);
|
||||
|
||||
|
||||
return base.CustomActivate();
|
||||
}
|
||||
|
||||
public override void Open()
|
||||
|
||||
@@ -299,9 +299,31 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
|
||||
return new Environment.Lutron.LutronQuantumArea(key, name, comm, props);
|
||||
}
|
||||
else if (typeName == "din8sw8")
|
||||
{
|
||||
var comm = CommFactory.GetControlPropertiesConfig(dc);
|
||||
|
||||
return new Environment.Lighting.Din8sw8Controller(key, comm.CresnetIdInt);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (groupName == "environment")
|
||||
{
|
||||
if (typeName == "shadecontroller")
|
||||
{
|
||||
var props = JsonConvert.DeserializeObject<Core.Shades.ShadeControllerConfigProperties>(properties.ToString());
|
||||
|
||||
return new Core.Shades.ShadeController(key, name, props);
|
||||
}
|
||||
else if (typeName == "relaycontrolledshade")
|
||||
{
|
||||
var props = JsonConvert.DeserializeObject<Environment.Somfy.RelayControlledShadeConfigProperties>(properties.ToString());
|
||||
|
||||
return new Environment.Somfy.RelayControlledShade(key, name, props);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy
|
||||
: base(key, name, sensor)
|
||||
{
|
||||
OccSensor = sensor;
|
||||
|
||||
RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc);
|
||||
|
||||
OccSensor.GlsOccupancySensorChange += new GlsOccupancySensorChangeEventHandler(sensor_GlsOccupancySensorChange);
|
||||
|
||||
Reference in New Issue
Block a user