Updates to add comments and better organize. Updates to Github repo for submodule and to latest release version of Essentials (1.4.31)

This commit is contained in:
Neil Dorin
2020-02-13 12:40:23 -07:00
parent 5281564ba4
commit caf2731dfb
8 changed files with 76 additions and 17 deletions

2
.gitmodules vendored
View File

@@ -1,3 +1,3 @@
[submodule "EssentialsBuilds"]
path = EssentialsBuilds
url = https://bitbucket.org/Pepperdash_Products/essentials-builds.git
url=https://github.com/PepperDash/Essentials-Builds.git

View File

@@ -12,29 +12,35 @@ using PepperDash.Core;
namespace EssentialsPluginTemplateEPI
{
public class EssentialsPluginTemplate : Device
public class EssentialsPluginTemplate
{
/// <summary>
/// This string is used to define the minimum version of the
/// Essentials Framework required for this plugin
/// </summary>
public static string MinimumEssentialsFrameworkVersion = "1.4.23";
/// <summary>
/// This method will get called by Essentials when this plugin is loaded.
/// Use it to add factory methods for all new Device types defined in this plugin
/// </summary>
public static void LoadPlugin()
{
PepperDash.Essentials.Core.DeviceFactory.AddFactoryForType("EssentialsPluginTemplate", EssentialsPluginTemplate.BuildDevice);
}
public static EssentialsPluginTemplate BuildDevice(DeviceConfig dc)
/// <summary>
/// Builds an instance of the device type
/// </summary>
/// <param name="dc">The device configuration</param>
/// <returns>The device</returns>
public static EssentialsPluginTemplateDevice BuildDevice(DeviceConfig dc)
{
var config = JsonConvert.DeserializeObject<EssentialsPluginTemplateConfigObject>(dc.Properties.ToString());
var newMe = new EssentialsPluginTemplate(dc.Key, dc.Name, config);
return newMe;
var config = JsonConvert.DeserializeObject<EssentialsPluginTemplatePropertiesConfig>(dc.Properties.ToString());
var newDevice = new EssentialsPluginTemplateDevice(dc.Key, dc.Name, config);
return newDevice;
}
GenericSecureTcpIpClient_ForServer Client;
public EssentialsPluginTemplate(string key, string name, EssentialsPluginTemplateConfigObject config)
: base(key, name)
{
}
}
}

View File

@@ -4,9 +4,23 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using Newtonsoft.Json;
namespace EssentialsPluginTemplateEPI
{
public class EssentialsPluginTemplateConfigObject
/// <summary>
/// Example of a config class that represents the structure of the Properties object of a DeviceConfig
/// </summary>
public class EssentialsPluginTemplatePropertiesConfig
{
/// <summary>
/// Control properties if needed to communicate with device
/// </summary>
[JsonProperty("control")]
ControlPropertiesConfig Control { get; set; }
}
}

View File

@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Essentials;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Core;
namespace EssentialsPluginTemplateEPI
{
/// <summary>
/// Example of a plugin device
/// </summary>
public class EssentialsPluginTemplateDevice : Device, IBridge
{
/// <summary>
/// Device Constructor. Called by
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="config"></param>
public EssentialsPluginTemplateDevice(string key, string name, EssentialsPluginTemplatePropertiesConfig config)
: base(key, name)
{
}
public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey)
{
}
}
}

View File

@@ -95,6 +95,7 @@
<Compile Include="EssentialsPluginTemplateBridge.cs" />
<Compile Include="EssentialsPluginTemplateConfigObject.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="EssentialsPluginTemplateDevice.cs" />
<None Include="Properties\ControlSystem.cfg" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />