Update C2nRthsController to use IHasCresnetBranches Interface

Inprogress #297
This commit is contained in:
Trevor Payne
2020-07-02 15:36:59 -05:00
parent bfe87ae090
commit 4360dcdca9
3 changed files with 4 additions and 10 deletions

View File

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

View File

@@ -1,15 +1,9 @@
using System; using System.Collections.Generic;
using System.Collections;
using System.Collections.Generic;
using Crestron.SimplSharpPro; using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.GeneralIO; using Crestron.SimplSharpPro.GeneralIO;
using Newtonsoft.Json;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Config;
using System.Linq;
using PepperDash_Essentials_Core.Crestron_IO.DinCenCn;
namespace PepperDash.Essentials.Core namespace PepperDash.Essentials.Core

View File

@@ -6,7 +6,7 @@ using Crestron.SimplSharp;
using Crestron.SimplSharpPro; using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DeviceSupport;
namespace PepperDash_Essentials_Core.Crestron_IO.DinCenCn namespace PepperDash.Essentials.Core
{ {
public interface IHasCresnetBranches public interface IHasCresnetBranches
{ {