mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-28 11:54:57 +00:00
69 lines
1.9 KiB
C#
69 lines
1.9 KiB
C#
using PepperDash.Core;
|
|
using Serilog.Events;
|
|
|
|
//using PepperDash.Essentials.Devices.Common.Cameras;
|
|
|
|
namespace PepperDash.Essentials.Core.Bridges
|
|
{
|
|
/// <summary>
|
|
/// Helper methods for bridges
|
|
/// </summary>
|
|
public static class BridgeHelper
|
|
{
|
|
public static void PrintJoinMap(string command)
|
|
{
|
|
var targets = command.Split(' ');
|
|
|
|
var bridgeKey = targets[0].Trim();
|
|
|
|
if (!(DeviceManager.GetDeviceForKey(bridgeKey) is EiscApiAdvanced bridge))
|
|
{
|
|
Debug.LogMessage(LogEventLevel.Information, "Unable to find advanced bridge with key: '{0}'", bridgeKey);
|
|
return;
|
|
}
|
|
|
|
if (targets.Length > 1)
|
|
{
|
|
var deviceKey = targets[1].Trim();
|
|
|
|
if (string.IsNullOrEmpty(deviceKey)) return;
|
|
bridge.PrintJoinMapForDevice(deviceKey);
|
|
}
|
|
else
|
|
{
|
|
bridge.PrintJoinMaps();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// JoinmapMarkdown method
|
|
/// </summary>
|
|
public static void JoinmapMarkdown(string command)
|
|
{
|
|
var targets = command.Split(' ');
|
|
|
|
var bridgeKey = targets[0].Trim();
|
|
|
|
var bridge = DeviceManager.GetDeviceForKey(bridgeKey) as EiscApiAdvanced;
|
|
|
|
if (bridge == null)
|
|
{
|
|
Debug.LogMessage(LogEventLevel.Information, "Unable to find advanced bridge with key: '{0}'", bridgeKey);
|
|
return;
|
|
}
|
|
|
|
if (targets.Length > 1)
|
|
{
|
|
var deviceKey = targets[1].Trim();
|
|
|
|
if (string.IsNullOrEmpty(deviceKey)) return;
|
|
bridge.MarkdownJoinMapForDevice(deviceKey, bridgeKey);
|
|
}
|
|
else
|
|
{
|
|
bridge.MarkdownForBridge(bridgeKey);
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
} |