Skip to content

Commit

Permalink
Merge pull request #7 from PepperDash/feature/updates
Browse files Browse the repository at this point in the history
Update to new JoinMap and plugin loading mechanisms
  • Loading branch information
andrew-welker authored Aug 20, 2020
2 parents 03e2e68 + 10c23fc commit d78fc1d
Show file tree
Hide file tree
Showing 12 changed files with 112 additions and 131 deletions.
4 changes: 2 additions & 2 deletions .github/scripts/GenerateVersionNumber.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$latestVersions = $(git tag --merged origin/master)
$latestVersions = $(git tag --merged origin/main)
$latestVersion = [version]"0.0.0"
Foreach ($version in $latestVersions) {
Write-Host $version
Expand All @@ -17,7 +17,7 @@ $newVersion = [version]$latestVersion
$phase = ""
$newVersionString = ""
switch -regex ($Env:GITHUB_REF) {
'^refs\/heads\/master*.' {
'^refs\/heads\/main*.' {
$newVersionString = "{0}.{1}.{2}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1)
}
'^refs\/heads\/feature\/*.' {
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- feature/*
- hotfix/*
- release/*
- master
- main
- development

env:
Expand All @@ -18,8 +18,8 @@ env:
VERSION: 0.0.0-buildtype-buildnumber
# Defaults to debug for build type
BUILD_TYPE: Debug
# Defaults to master as the release branch. Change as necessary
RELEASE_BRANCH: master
# Defaults to main as the release branch. Change as necessary
RELEASE_BRANCH: main
jobs:
Build_Project:
runs-on: windows-latest
Expand All @@ -38,7 +38,7 @@ jobs:
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
# Set the BUILD_TYPE environment variable
- name: Set Build to Release if triggered from Master
- name: Set Build to Release if triggered from main
run: |
if("$($Env:GITHUB_REF)".contains("$($Env:RELEASE_BRANCH)")) {
Write-Host "Setting build type to Release"
Expand All @@ -59,6 +59,11 @@ jobs:
run: |
Write-Output ${{ env.VERSION }}
./.github/scripts/UpdateAssemblyVersion.ps1 ${{ env.VERSION }}
- name: Login to Docker
uses: azure/docker-login@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
# Build the solutions in the docker image
- name: Build Solution
shell: powershell
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -355,3 +355,5 @@ MigrationBackup/
# Crestron Zip Files
*.cplz
*.clz
*.projectinfo
*.suo
2 changes: 1 addition & 1 deletion EssentialsBuilds
Submodule EssentialsBuilds updated 47 files
+ Crestron.SimplSharpPro.DM.dll
+ Crestron.SimplSharpPro.DeviceSupport.dll
+ Crestron.SimplSharpPro.EthernetCommunications.dll
+ Crestron.SimplSharpPro.Fusion.dll
+ Crestron.SimplSharpPro.Gateways.dll
+ Crestron.SimplSharpPro.GeneralIO.dll
+ Crestron.SimplSharpPro.Lighting.dll
+ Crestron.SimplSharpPro.Remotes.dll
+ Crestron.SimplSharpPro.Shades.dll
+ Crestron.SimplSharpPro.ThreeSeriesCards.dll
+ Crestron.SimplSharpPro.UI.dll
+ Essentials Devices Common.cplz
+ Essentials Devices Common.dll
+ PepperDashEssentials-1.6.1.cpz
+ PepperDashEssentials.dll
+ PepperDashEssentials1.4.14.cpz
+ PepperDashEssentials1.4.15.cpz
+ PepperDashEssentials1.4.16.cpz
+ PepperDashEssentials1.4.17.cpz
+ PepperDashEssentials1.4.18.cpz
+ PepperDashEssentials1.4.19.cpz
+ PepperDashEssentials1.4.20.cpz
+ PepperDashEssentials1.4.21.cpz
+ PepperDashEssentials1.4.22.cpz
+ PepperDashEssentials1.4.23.cpz
+ PepperDashEssentials1.4.24.cpz
+ PepperDashEssentials1.4.25.cpz
+ PepperDashEssentials1.4.26.cpz
+ PepperDashEssentials1.4.27.cpz
+ PepperDashEssentials1.4.28.cpz
+ PepperDashEssentials1.4.29.cpz
+ PepperDashEssentials1.4.30.cpz
+ PepperDashEssentials1.4.31.cpz
+ PepperDash_Core.clz
+ PepperDash_Core.dll
+3,754 −0 PepperDash_Core.xml
+ PepperDash_Essentials_Core.cplz
+ PepperDash_Essentials_Core.dll
+ PepperDash_Essentials_DM.cplz
+ PepperDash_Essentials_DM.dll
+0 −45 README.md
+ SimplSharpCustomAttributesInterface.dll
+ SimplSharpHelperInterface.dll
+ SimplSharpNewtonsoft.dll
+ SimplSharpReflectionInterface.dll
+ SimplSharpSQLHelperInterface.dll
+ SimplSharpTimerEventInterface.dll
52 changes: 0 additions & 52 deletions PDT.EssentialsPluginTemplate.EPI/EssentailsPluginTemplate.cs

This file was deleted.

57 changes: 0 additions & 57 deletions PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateBridge.cs

This file was deleted.

39 changes: 26 additions & 13 deletions PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateDevice.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;

using PepperDash.Essentials;
using Crestron.SimplSharpPro.DeviceSupport;
using Newtonsoft.Json;
using PDT.EssentialsPluginTemplate.EPI;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Core;
using PepperDash.Essentials.Bridges;

namespace EssentialsPluginTemplateEPI
{
/// <summary>
/// Example of a plugin device
/// </summary>
public class EssentialsPluginTemplateDevice : Device, IBridge
public class EssentialsPluginTemplateDevice : EssentialsDevice, IBridgeAdvanced
{
/// <summary>
/// Device Constructor. Called by BuildDevice
Expand Down Expand Up @@ -46,9 +40,28 @@ public override bool CustomActivate()
/// <param name="trilist"></param>
/// <param name="joinStart"></param>
/// <param name="joinMapKey"></param>
public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey)
public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
this.LinkToApi(trilist, joinStart, joinMapKey);
// Construct the default join map
var joinMap = new EssentialsPluginTemplateBridgeJoinMap(joinStart);

// 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);

//Checking if the bridge is null allows for backwards compatability with configurations that use EiscApi instead of EiscApiAdvanced
if (bridge != null)
{
bridge.AddJoinMap(Key, joinMap);
}

// Set all your join actions here


// Link all your feedbacks to joins here
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using Crestron.SimplSharp; // For Basic SIMPL# Classes
using Crestron.SimplSharpPro; // For Basic SIMPL#Pro classes

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

using PepperDash.Essentials;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Core;

namespace EssentialsPluginTemplateEPI
{
/// <summary>
/// This class contains the necessary properties and methods required to function as an Essentials Plugin
/// </summary>
public class EssentialsPluginFactory:EssentialsPluginDeviceFactory<EssentialsPluginTemplateDevice>
{
public EssentialsPluginFactory()
{
// This string is used to define the minimum version of the
// Essentials Framework required for this plugin
MinimumEssentialsFrameworkVersion = "1.6.1";

//The strings defined in this list will be used in the configuration file to build the device in this plugin.
TypeNames = new List<string> {"essentialsPluginTemplateDevice"};
}

#region Overrides of EssentialsDeviceFactory<EssentialsPluginTemplateDevice>

public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
var config = dc.Properties.ToObject<EssentialsPluginTemplatePropertiesConfig>();
var newDevice = new EssentialsPluginTemplateDevice(dc.Key, dc.Name, config);
return newDevice;
}

#endregion
}
}

Original file line number Diff line number Diff line change
@@ -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))
{

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@
<Reference Include="System.Data" />
</ItemGroup>
<ItemGroup>
<Compile Include="EssentailsPluginTemplate.cs" />
<Compile Include="EssentialsPluginTemplateBridge.cs" />
<Compile Include="EssentialsPluginTemplateConfigObject.cs" />
<Compile Include="EssentialsPluginTemplateFactory.cs" />
<Compile Include="EssentialsPluginTemplateJoinMap.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="EssentialsPluginTemplateDevice.cs" />
<None Include="Properties\ControlSystem.cfg" />
Expand Down
Binary file not shown.
Binary file not shown.

0 comments on commit d78fc1d

Please sign in to comment.