mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 20:54:55 +00:00
Merge pull request #253 from PepperDash/hotfix/eiscApiAdvanced-backwards-compatibility
Add backwards compatability with `IBridge` to `EiscApiAdvanced`
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Bridges
|
namespace PepperDash.Essentials.Bridges
|
||||||
{
|
{
|
||||||
@@ -7,8 +6,7 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
/// Defines a device that uses the legacy JoinMapBase for its join map
|
/// Defines a device that uses the legacy JoinMapBase for its join map
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Obsolete("IBridgeAdvanced should be used going forward with JoinMapBaseAdvanced")]
|
[Obsolete("IBridgeAdvanced should be used going forward with JoinMapBaseAdvanced")]
|
||||||
public interface IBridge
|
public interface IBridge:Core.Bridges.IBridge
|
||||||
{
|
{
|
||||||
void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -110,15 +110,24 @@ namespace PepperDash.Essentials.Core.Bridges
|
|||||||
if (device == null) continue;
|
if (device == null) continue;
|
||||||
|
|
||||||
Debug.Console(1, this, "Linking Device: '{0}'", device.Key);
|
Debug.Console(1, this, "Linking Device: '{0}'", device.Key);
|
||||||
//if (device is IBridge) // Check for this first to allow bridges in plugins to override existing bridges that apply to the same type.
|
|
||||||
//{
|
if (typeof (IBridge).IsAssignableFrom(device.GetType().GetCType()))
|
||||||
// Debug.Console(2, this, "'{0}' is IBridge", device.Key);
|
{
|
||||||
//}
|
var basicBridge = device as IBridge;
|
||||||
|
if (basicBridge != null)
|
||||||
|
{
|
||||||
|
Debug.Console(0, this, Debug.ErrorLogLevel.Notice,
|
||||||
|
"Linking EiscApiAdvanced {0} to device {1} using obsolete join map. Please update the device's join map.",
|
||||||
|
Key, device.Key);
|
||||||
|
basicBridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!typeof (IBridgeAdvanced).IsAssignableFrom(device.GetType().GetCType()))
|
if (!typeof (IBridgeAdvanced).IsAssignableFrom(device.GetType().GetCType()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var bridge = device as IBridgeAdvanced;
|
var bridge = device as IBridgeAdvanced;
|
||||||
if (bridge != null) bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this);
|
if (bridge != null) bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,19 @@
|
|||||||
using System;
|
using System;
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
using PepperDash.Core;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines a device that uses JoinMapBaseAdvanced for its join map
|
/// Defines a device that uses JoinMapBaseAdvanced for its join map
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IBridgeAdvanced
|
public interface IBridgeAdvanced:IKeyed
|
||||||
{
|
{
|
||||||
void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge);
|
void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface IBridge:IKeyed
|
||||||
|
{
|
||||||
|
void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user