From 4143783d2e8b8b58f47f3307629fbf2a879a5dfb Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Fri, 5 Feb 2021 10:57:39 -0700 Subject: [PATCH 1/2] Adds example of GenericQueue on EssentialsPluginTemplateDevice and updates dependency version to 1.7.5 --- .../EssentialsPluginTemplateDevice.cs | 22 ++++++++++++++++++- .../EssentialsPluginTemplateFactory.cs | 2 +- packages.config | 2 +- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateDevice.cs b/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateDevice.cs index 837eb2c..20c99da 100644 --- a/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateDevice.cs +++ b/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateDevice.cs @@ -5,6 +5,8 @@ using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; +using PepperDash_Essentials_Core.Queues; + namespace EssentialsPluginTemplate { @@ -24,6 +26,11 @@ public class EssentialsPluginTemplateDevice : EssentialsBridgeableDevice /// private EssentialsPluginConfigObjectTemplate _config; + /// + /// Provides a queue and dedicated worker thread for processing feedback messages from a device. + /// + private GenericQueue ReceiveQueue; + #region IBasicCommunication Properties and Constructor. Remove if not needed. // TODO [ ] Add, modify, remove properties and fields as needed for the plugin being developed @@ -100,6 +107,8 @@ public EssentialsPluginTemplateDevice(string key, string name, EssentialsPluginC _config = config; + ReceiveQueue = new GenericQueue(key + "-rxqueue"); // If you need to set the thread priority, use one of the available overloaded constructors. + ConnectFeedback = new BoolFeedback(() => Connect); OnlineFeedback = new BoolFeedback(() => _commsMonitor.IsOnline); StatusFeedback = new IntFeedback(() => (int)_commsMonitor.Status); @@ -149,7 +158,9 @@ private void socket_ConnectionChange(object sender, GenericSocketStatusChageEven private void Handle_LineRecieved(object sender, GenericCommMethodReceiveTextArgs args) { // TODO [ ] Implement method - throw new System.NotImplementedException(); + + // Enqueues the message to be processed in a dedicated thread, but the specified method + ReceiveQueue.Enqueue(new ProcessStringMessage(args.Text, ProcessFeedbackMessage)); } // TODO [ ] If not using an HEX/byte based API with no delimeter, delete the method below @@ -166,6 +177,15 @@ void Handle_TextReceived(object sender, GenericCommMethodReceiveTextArgs e) throw new System.NotImplementedException(); } + /// + /// This method should perform any necessary parsing of feedback messages from the device + /// + /// + void ProcessFeedbackMessage(string message) + { + + } + // TODO [ ] If not using an ACII based API, delete the properties below /// diff --git a/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateFactory.cs b/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateFactory.cs index 8cfa212..1798d19 100644 --- a/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateFactory.cs +++ b/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateFactory.cs @@ -188,7 +188,7 @@ public EssentialsPluginFactoryCrestronDeviceTemplate() { // Set the minimum Essentials Framework Version // TODO [ ] Update the Essentials minimum framework version which this plugin has been tested against - MinimumEssentialsFrameworkVersion = "1.6.4"; + MinimumEssentialsFrameworkVersion = "1.7.5"; // In the constructor we initialize the list with the typenames that will build an instance of this device // TODO [ ] Update the TypeNames for the plugin being developed diff --git a/packages.config b/packages.config index fa05b32..c66e4a9 100644 --- a/packages.config +++ b/packages.config @@ -1,3 +1,3 @@ - + \ No newline at end of file From 6fb86d82c8cf2345bd3239e4efa6f9c04e1ffed8 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Fri, 5 Feb 2021 13:43:28 -0700 Subject: [PATCH 2/2] removes deprecated set-env from build script --- .github/workflows/docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 0ccab74..9072303 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -42,7 +42,7 @@ jobs: run: | if("$($Env:GITHUB_REF)".contains("$($Env:RELEASE_BRANCH)")) { Write-Host "Setting build type to Release" - Write-Output "::set-env name=BUILD_TYPE::Release" + Write-Output "echo "BUILD_TYPE='Release'" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append" } # Fetch all tags - name: Fetch tags @@ -52,7 +52,7 @@ jobs: shell: powershell run: | $version = ./.github/scripts/GenerateVersionNumber.ps1 - Write-Output "::set-env name=VERSION::$version" + Write-Output "echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append" # Use the version number to set the version of the assemblies - name: Update AssemblyInfo.cs shell: powershell