mirror of
https://github.com/PepperDash/EssentialsPluginTemplate.git
synced 2026-02-15 20:54:40 +00:00
Update Join map and bridging methods
This commit is contained in:
@@ -1,57 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
|
||||||
|
|
||||||
using PepperDash.Core;
|
|
||||||
using PepperDash.Essentials.Core;
|
|
||||||
using PepperDash.Essentials.Bridges;
|
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace EssentialsPluginTemplateEPI
|
|
||||||
{
|
|
||||||
public static class EssentialsPluginTemplateBridge
|
|
||||||
{
|
|
||||||
public static void LinkToApiExt(this EssentialsPluginFactory DspDevice, BasicTriList trilist, uint joinStart, string joinMapKey)
|
|
||||||
{
|
|
||||||
// Construct the default join map
|
|
||||||
EssentialsPluginTemplateBridgeJoinMap joinMap = new EssentialsPluginTemplateBridgeJoinMap();
|
|
||||||
|
|
||||||
// Attempt to get a custom join map if specified in config
|
|
||||||
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
|
|
||||||
|
|
||||||
// If we find a custom join map, deserialize it
|
|
||||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
|
||||||
joinMap = JsonConvert.DeserializeObject<EssentialsPluginTemplateBridgeJoinMap>(joinMapSerialized);
|
|
||||||
|
|
||||||
// Offset the joins based on the join start
|
|
||||||
joinMap.OffsetJoinNumbers(joinStart);
|
|
||||||
|
|
||||||
|
|
||||||
// Set all your join actions here
|
|
||||||
|
|
||||||
|
|
||||||
// Link all your feedbacks to joins here
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public class EssentialsPluginTemplateBridgeJoinMap : JoinMapBase
|
|
||||||
{
|
|
||||||
// Specify your joins here
|
|
||||||
|
|
||||||
|
|
||||||
public EssentialsPluginTemplateBridgeJoinMap()
|
|
||||||
{
|
|
||||||
// Set the values of your joins here
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OffsetJoinNumbers(uint joinStart)
|
|
||||||
{
|
|
||||||
// Offset the joins from joinStart as applicable
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
|
namespace PDT.EssentialsPluginTemplate.EPI
|
||||||
|
{
|
||||||
|
public class EssentialsPluginTemplateBridgeJoinMap : JoinMapBaseAdvanced
|
||||||
|
{
|
||||||
|
[JoinName("IsOnline")]
|
||||||
|
public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData {JoinNumber = 1, JoinSpan = 1},
|
||||||
|
new JoinMetadata
|
||||||
|
{
|
||||||
|
Description = "Device is Online",
|
||||||
|
JoinType = eJoinType.Digital,
|
||||||
|
JoinCapabilities = eJoinCapabilities.ToSIMPL
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
public EssentialsPluginTemplateBridgeJoinMap(uint joinStart):base(joinStart, typeof(EssentialsPluginTemplateBridgeJoinMap))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user