changes PepperDash.Essentials.Bridges to PepperDash.Essentials.Core.Bridges

This commit is contained in:
Andrew Welker
2020-04-13 16:31:34 -06:00
parent 926e3b7bc8
commit 41d123edf3
50 changed files with 354 additions and 307 deletions

View File

@@ -1,13 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using System.Linq;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash_Essentials_Core.Devices;
namespace PepperDash.Essentials.Core
@@ -15,7 +8,7 @@ namespace PepperDash.Essentials.Core
/// <summary>
/// A bridge class to cover the basic features of GenericBase hardware
/// </summary>
public abstract class CrestronGenericBaseDevice : EssentialsBridgeableDevice, IOnline, IHasFeedback, ICommunicationMonitor, IUsageTracking
public abstract class CrestronGenericBaseDevice : EssentialsDevice, IOnline, IHasFeedback, ICommunicationMonitor, IUsageTracking
{
public virtual GenericBase Hardware { get; protected set; }
@@ -34,7 +27,7 @@ namespace PepperDash.Essentials.Core
/// </summary>
public bool PreventRegistration { get; protected set; }
public CrestronGenericBaseDevice(string key, string name, GenericBase hardware)
protected CrestronGenericBaseDevice(string key, string name, GenericBase hardware)
: base(key, name)
{
Feedbacks = new FeedbackCollection<Feedback>();
@@ -42,13 +35,7 @@ namespace PepperDash.Essentials.Core
Hardware = hardware;
IsOnline = new BoolFeedback("IsOnlineFeedback", () => Hardware.IsOnline);
IsRegistered = new BoolFeedback("IsRegistered", () => Hardware.Registered);
IpConnectionsText = new StringFeedback("IpConnectionsText", () =>
{
if (Hardware.ConnectedIpList != null)
return string.Join(",", Hardware.ConnectedIpList.Select(cip => cip.DeviceIpAddress).ToArray());
else
return string.Empty;
});
IpConnectionsText = new StringFeedback("IpConnectionsText", () => Hardware.ConnectedIpList != null ? string.Join(",", Hardware.ConnectedIpList.Select(cip => cip.DeviceIpAddress).ToArray()) : string.Empty);
AddToFeedbackList(IsOnline, IpConnectionsText);
CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, hardware, 120000, 300000);
@@ -80,7 +67,7 @@ namespace PepperDash.Essentials.Core
f.FireUpdate();
}
Hardware.OnlineStatusChange += new OnlineStatusChangeEventHandler(Hardware_OnlineStatusChange);
Hardware.OnlineStatusChange += Hardware_OnlineStatusChange;
CommunicationMonitor.Start();
return true;
@@ -110,12 +97,11 @@ namespace PepperDash.Essentials.Core
{
foreach (var f in newFbs)
{
if (f != null)
if (f == null) continue;
if (!Feedbacks.Contains(f))
{
if (!Feedbacks.Contains(f))
{
Feedbacks.Add(f);
}
Feedbacks.Add(f);
}
}
}