diff --git a/.github/scripts/GenerateVersionNumber.ps1 b/.github/scripts/GenerateVersionNumber.ps1 index d05aecd..052d48a 100644 --- a/.github/scripts/GenerateVersionNumber.ps1 +++ b/.github/scripts/GenerateVersionNumber.ps1 @@ -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 @@ -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\/*.' { diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 08c269d..bfff1c9 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -6,7 +6,7 @@ on: - feature/* - hotfix/* - release/* - - master + - main - development env: @@ -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 @@ -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" @@ -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 diff --git a/.gitignore b/.gitignore index e8d2744..f218fa0 100644 --- a/.gitignore +++ b/.gitignore @@ -355,3 +355,5 @@ MigrationBackup/ # Crestron Zip Files *.cplz *.clz +*.projectinfo +*.suo diff --git a/EssentialsBuilds b/EssentialsBuilds index 855dccd..e29501b 160000 --- a/EssentialsBuilds +++ b/EssentialsBuilds @@ -1 +1 @@ -Subproject commit 855dccd0d41aac272512f58d6bcd4764307bbb14 +Subproject commit e29501be5df2c587d1b6221e60565e38d21e369d diff --git a/PDT.EssentialsPluginTemplate.EPI/EssentailsPluginTemplate.cs b/PDT.EssentialsPluginTemplate.EPI/EssentailsPluginTemplate.cs deleted file mode 100644 index 0112c01..0000000 --- a/PDT.EssentialsPluginTemplate.EPI/EssentailsPluginTemplate.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -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 -{ - /// - /// This class contains the necessary properties and static methods required to function as an Essentials Plugin - /// - public class EssentialsPluginFactory - { - /// - /// This string is used to define the minimum version of the - /// Essentials Framework required for this plugin - /// - public static string MinimumEssentialsFrameworkVersion = "1.4.31"; - - /// - /// 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 - /// - public static void LoadPlugin() - { - PepperDash.Essentials.Core.DeviceFactory.AddFactoryForType("EssentialsPluginTemplate", EssentialsPluginFactory.BuildDevice); - - // Add additional factories for each type here - } - - /// - /// Builds an instance of the device type. There should be method like this defined for each device type your plugin needs - /// to be able to build - /// - /// The device configuration - /// The device - public static EssentialsPluginTemplateDevice BuildDevice(DeviceConfig dc) - { - var config = JsonConvert.DeserializeObject(dc.Properties.ToString()); - var newDevice = new EssentialsPluginTemplateDevice(dc.Key, dc.Name, config); - return newDevice; - } - - } -} - diff --git a/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateBridge.cs b/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateBridge.cs deleted file mode 100644 index e26e2d7..0000000 --- a/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateBridge.cs +++ /dev/null @@ -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(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 - } - } -} \ No newline at end of file diff --git a/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateDevice.cs b/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateDevice.cs index 9cfcd62..dda96b2 100644 --- a/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateDevice.cs +++ b/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateDevice.cs @@ -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 { /// /// Example of a plugin device /// - public class EssentialsPluginTemplateDevice : Device, IBridge + public class EssentialsPluginTemplateDevice : EssentialsDevice, IBridgeAdvanced { /// /// Device Constructor. Called by BuildDevice @@ -46,9 +40,28 @@ public override bool CustomActivate() /// /// /// - 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(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 } } } \ No newline at end of file diff --git a/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateFactory.cs b/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateFactory.cs new file mode 100644 index 0000000..79cfcf9 --- /dev/null +++ b/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateFactory.cs @@ -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 +{ + /// + /// This class contains the necessary properties and methods required to function as an Essentials Plugin + /// + public class EssentialsPluginFactory:EssentialsPluginDeviceFactory + { + 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 {"essentialsPluginTemplateDevice"}; + } + + #region Overrides of EssentialsDeviceFactory + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + var config = dc.Properties.ToObject(); + var newDevice = new EssentialsPluginTemplateDevice(dc.Key, dc.Name, config); + return newDevice; + } + + #endregion + } +} + diff --git a/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateJoinMap.cs b/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateJoinMap.cs new file mode 100644 index 0000000..4272a97 --- /dev/null +++ b/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateJoinMap.cs @@ -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)) + { + + } + } +} \ No newline at end of file diff --git a/PDT.EssentialsPluginTemplate.EPI/PDT.EssentialsPluginTemplate.EPI.csproj b/PDT.EssentialsPluginTemplate.EPI/PDT.EssentialsPluginTemplate.EPI.csproj index 5a9ae47..e3bae95 100644 --- a/PDT.EssentialsPluginTemplate.EPI/PDT.EssentialsPluginTemplate.EPI.csproj +++ b/PDT.EssentialsPluginTemplate.EPI/PDT.EssentialsPluginTemplate.EPI.csproj @@ -91,9 +91,9 @@ - - + + diff --git a/PDT.EssentialsPluginTemplate.EPI/PDT.EssentialsPluginTemplate.EPI.suo b/PDT.EssentialsPluginTemplate.EPI/PDT.EssentialsPluginTemplate.EPI.suo deleted file mode 100644 index ad4bc10..0000000 Binary files a/PDT.EssentialsPluginTemplate.EPI/PDT.EssentialsPluginTemplate.EPI.suo and /dev/null differ diff --git a/PDT.EssentialsPluginTemplate.EPI/PDT.EssentialsPluginTemplate.projectinfo b/PDT.EssentialsPluginTemplate.EPI/PDT.EssentialsPluginTemplate.projectinfo deleted file mode 100644 index acdbdf8..0000000 Binary files a/PDT.EssentialsPluginTemplate.EPI/PDT.EssentialsPluginTemplate.projectinfo and /dev/null differ