WIP Cresnet Gateway SUpport

This commit is contained in:
Trevor Payne
2020-07-01 10:35:57 -05:00
parent ac379763ce
commit 0a3f2bb524
5 changed files with 232 additions and 117 deletions

View File

@@ -21,6 +21,8 @@ namespace PepperDash.Essentials.Core
[Description("Wrapper class for all HR-Series remotes")]
public class Hrxx0WirelessRemoteController : EssentialsBridgeableDevice, IHasFeedback
{
private CenRfgwController _gateway;
private Hr1x0WirelessRemoteBase _remote;
public FeedbackCollection<Feedback> Feedbacks { get; set; }
@@ -33,6 +35,39 @@ namespace PepperDash.Essentials.Core
{
Feedbacks = new FeedbackCollection<Feedback>();
var props = JsonConvert.DeserializeObject<CrestronRemotePropertiesConfig>(config.Properties.ToString());
var type = config.Type;
var rfId = (uint)props.Control.InfinetIdInt;
GatewayBase gateway;
if (props.GatewayDeviceKey == "processor")
{
gateway = Global.ControlSystem.ControllerRFGatewayDevice;
}
else
{
var gatewayDev = DeviceManager.GetDeviceForKey(props.GatewayDeviceKey) as CenRfgwController;
if (gatewayDev == null)
{
Debug.Console(0, "GetHr1x0WirelessRemote: Device '{0}' is not a valid device", props.GatewayDeviceKey);
}
if (gatewayDev != null)
{
Debug.Console(0, "GetHr1x0WirelessRemote: Device '{0}' is a valid device", props.GatewayDeviceKey);
gateway = gatewayDev.GateWay;
_gateway = gatewayDev;
}
}
if (_gateway != null)
{
_gateway.IsReady += new PepperDash_Essentials_Core.IsReadyEventHandler(_gateway_IsReady);
}
AddPreActivationAction(() =>
{
_remote = preActivationFunc(config);
@@ -47,6 +82,11 @@ namespace PepperDash.Essentials.Core
});
}
void _gateway_IsReady(object source, PepperDash_Essentials_Core.IsReadyEventArgs e)
{
throw new NotImplementedException();
}
void _remote_BaseEvent(GenericBase device, BaseEventArgs args)
{
if(args.EventId == Hr1x0EventIds.BatteryCriticalFeedbackEventId)
@@ -137,11 +177,6 @@ namespace PepperDash.Essentials.Core
return remoteBase;
}
static void gateway_BaseEvent(GenericBase device, BaseEventArgs args)
{
throw new NotImplementedException();
}
#endregion
#region Factory