Compare commits

...

6 Commits

4 changed files with 84 additions and 11 deletions

View File

@@ -30,6 +30,17 @@ namespace PepperDash.Essentials.Core.Bridges
{
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
protected BridgeApi(string key, string name) :
base(key, name)
{
}
}
/// <summary>
@@ -58,7 +69,7 @@ namespace PepperDash.Essentials.Core.Bridges
/// <param name="dc">Device configuration</param>
/// <param name="eisc">EISC instance</param>
public EiscApiAdvanced(DeviceConfig dc, BasicTriList eisc) :
base(dc.Key)
base(dc.Key, dc.Name)
{
JoinMaps = new Dictionary<string, JoinMapBaseAdvanced>();

View File

@@ -0,0 +1,16 @@
using System.Collections.Generic;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Interface for rooms with a list of destinations
/// </summary>
public interface IHasDestinations
{
/// <summary>
/// Gets the dictionary of destinations.
/// </summary>
Dictionary<string, IRoutingSink> Destinations { get; }
}
}

View File

@@ -0,0 +1,15 @@
using System.Collections.Generic;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Interface for rooms with a list of destinations
/// </summary>
public interface IHasSourceList
{
/// <summary>
/// Gets the list of sources.
/// </summary>
Dictionary<string, SourceListItem> SourceList { get; }
}
}

View File

@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
@@ -230,6 +231,15 @@ namespace PepperDash.Essentials.Core.Routing
return roomDefaultDisplay.DefaultDisplay.Key == destination.Key;
}
if (r is IHasDestinations roomDestinationList)
{
return roomDestinationList.Destinations.Any(d =>
d.Value.Key == destination.Key
);
}
var destList = ConfigReader.ConfigObject.GetDestinationListForKey(r.DestinationListKey);
return false;
}
);
@@ -245,9 +255,17 @@ namespace PepperDash.Essentials.Core.Routing
return;
}
// Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Found room {room} for destination {destination}", this, room.Key, destination.Key);
Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Found room {room} for destination {destination}", this, room.Key, destination.Key);
var sourceList = ConfigReader.ConfigObject.GetSourceListForKey(room.SourceListKey);
Dictionary<string, SourceListItem> sourceList = null;
if (room is IHasSourceList roomWithSourceList)
{
sourceList = roomWithSourceList.SourceList;
}
else {
sourceList = ConfigReader.ConfigObject.GetSourceListForKey(room.SourceListKey);
}
if (sourceList == null)
{
@@ -263,14 +281,27 @@ namespace PepperDash.Essentials.Core.Routing
// Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Found sourceList for room {room}", this, room.Key);
if (sourceTieLine.SourcePort?.ParentDevice == null)
{
Debug.LogMessage(
Serilog.Events.LogEventLevel.Debug,
"********SourcePort or ParentDevice is null for tieLine. Unable to find source for destination {destination}.",
this,
destination.Key
);
return;
}
var sourceListItem = sourceList.FirstOrDefault(sli =>
{
//// Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose,
// "SourceListItem {sourceListItem}:{sourceKey} tieLine sourceport device key {sourcePortDeviceKey}",
// this,
// sli.Key,
// sli.Value.SourceKey,
// sourceTieLine.SourcePort.ParentDevice.Key);
if (sli.Value == null) return false;
Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose,
"********SourceListItem {sourceListItem}:{sourceKey} tieLine sourceport device key {sourcePortDeviceKey}",
this,
sli.Key,
sli.Value.SourceKey,
sourceTieLine.SourcePort.ParentDevice.Key);
return sli.Value.SourceKey.Equals(
sourceTieLine.SourcePort.ParentDevice.Key,
@@ -288,7 +319,7 @@ namespace PepperDash.Essentials.Core.Routing
"No source found for device {key}. Creating transient source for {destination}",
this,
sourceTieLine.SourcePort.ParentDevice.Key,
destination
destination.Key
);
var tempSourceListItem = new SourceListItem
@@ -302,7 +333,7 @@ namespace PepperDash.Essentials.Core.Routing
return;
}
//Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Got Source {@source} with key {sourceKey}", this, source, sourceKey);
Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Got Source {@source} with key {sourceKey}", this, source, sourceKey);
destination.CurrentSourceInfoKey = sourceKey;
destination.CurrentSourceInfo = source;