Adds debug statement to Hardware_OnlineStatusChange callback to help figure out issues with devices not reporting online status correctly. Removes IsRegistered from Feedbacks and fires update manually.

This commit is contained in:
Neil Dorin
2020-02-12 16:07:43 -07:00
parent 56fae89ae2
commit f1278d0ee4

View File

@@ -47,7 +47,7 @@ namespace PepperDash.Essentials.Core
else else
return string.Empty; return string.Empty;
}); });
AddToFeedbackList(IsOnline, IsRegistered, IpConnectionsText); AddToFeedbackList(IsOnline, IpConnectionsText);
CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, hardware, 120000, 300000); CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, hardware, 120000, 300000);
} }
@@ -69,7 +69,10 @@ namespace PepperDash.Essentials.Core
//Debug.Console(0, this, "ERROR: Cannot register Crestron device: {0}", response); //Debug.Console(0, this, "ERROR: Cannot register Crestron device: {0}", response);
return false; return false;
} }
IsRegistered.FireUpdate();
} }
foreach (var f in Feedbacks) foreach (var f in Feedbacks)
{ {
f.FireUpdate(); f.FireUpdate();
@@ -90,7 +93,11 @@ namespace PepperDash.Essentials.Core
CommunicationMonitor.Stop(); CommunicationMonitor.Stop();
Hardware.OnlineStatusChange -= Hardware_OnlineStatusChange; Hardware.OnlineStatusChange -= Hardware_OnlineStatusChange;
return Hardware.UnRegister() == eDeviceRegistrationUnRegistrationResponse.Success; var success = Hardware.UnRegister() == eDeviceRegistrationUnRegistrationResponse.Success;
IsRegistered.FireUpdate();
return success;
} }
/// <summary> /// <summary>
@@ -113,14 +120,12 @@ namespace PepperDash.Essentials.Core
void Hardware_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args) void Hardware_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
{ {
//if (args.DeviceOnLine) Debug.Console(2, this, "OnlineStatusChange Event. Online = {0}", args.DeviceOnLine);
//{ foreach (var feedback in Feedbacks)
foreach (var feedback in Feedbacks) {
{ if (feedback != null)
if (feedback != null) feedback.FireUpdate();
feedback.FireUpdate(); }
}
//}
} }
#region IStatusMonitor Members #region IStatusMonitor Members