fix: ReleaseRoute callse ExecuteSwitch with null for input selector

Most devices that implement IRouting will now need to handle the possiblity of a null as the input selector, with the idea being that a null input selector should clear the route to whatever device is selected as the input selector. This may change to a typed value in the future.
This commit is contained in:
Andrew Welker
2024-07-26 06:51:45 -05:00
parent e374f7b50f
commit 1fb1947158

View File

@@ -60,10 +60,12 @@ namespace PepperDash.Essentials.Core
/// </summary> /// </summary>
public void ReleaseRoutes() public void ReleaseRoutes()
{ {
foreach (var route in Routes) foreach (var route in Routes.Where(r => r.SwitchingDevice is IRouting))
{ {
if (route.SwitchingDevice is IRouting) if (route.SwitchingDevice is IRouting switchingDevice)
{ {
switchingDevice.ExecuteSwitch(null, route.OutputPort.Selector, SignalType);
// Pull the route from the port. Whatever is watching the output's in use tracker is // Pull the route from the port. Whatever is watching the output's in use tracker is
// responsible for responding appropriately. // responsible for responding appropriately.
route.OutputPort.InUseTracker.RemoveUser(Destination, "destination-" + SignalType); route.OutputPort.InUseTracker.RemoveUser(Destination, "destination-" + SignalType);