Merge pull request #14 from PepperDash/feature/add-genericqueue-example

Feature/add genericqueue example
This commit is contained in:
Neil Dorin
2021-02-05 14:02:32 -07:00
committed by GitHub
4 changed files with 25 additions and 5 deletions

View File

@@ -42,7 +42,7 @@ jobs:
run: | run: |
if("$($Env:GITHUB_REF)".contains("$($Env:RELEASE_BRANCH)")) { if("$($Env:GITHUB_REF)".contains("$($Env:RELEASE_BRANCH)")) {
Write-Host "Setting build type to Release" 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 # Fetch all tags
- name: Fetch tags - name: Fetch tags
@@ -52,7 +52,7 @@ jobs:
shell: powershell shell: powershell
run: | run: |
$version = ./.github/scripts/GenerateVersionNumber.ps1 $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 # Use the version number to set the version of the assemblies
- name: Update AssemblyInfo.cs - name: Update AssemblyInfo.cs
shell: powershell shell: powershell

View File

@@ -5,6 +5,8 @@ using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Bridges;
using PepperDash_Essentials_Core.Queues;
namespace EssentialsPluginTemplate namespace EssentialsPluginTemplate
{ {
@@ -24,6 +26,11 @@ namespace EssentialsPluginTemplate
/// </summary> /// </summary>
private EssentialsPluginConfigObjectTemplate _config; private EssentialsPluginConfigObjectTemplate _config;
/// <summary>
/// Provides a queue and dedicated worker thread for processing feedback messages from a device.
/// </summary>
private GenericQueue ReceiveQueue;
#region IBasicCommunication Properties and Constructor. Remove if not needed. #region IBasicCommunication Properties and Constructor. Remove if not needed.
// TODO [ ] Add, modify, remove properties and fields as needed for the plugin being developed // TODO [ ] Add, modify, remove properties and fields as needed for the plugin being developed
@@ -100,6 +107,8 @@ namespace EssentialsPluginTemplate
_config = config; _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); ConnectFeedback = new BoolFeedback(() => Connect);
OnlineFeedback = new BoolFeedback(() => _commsMonitor.IsOnline); OnlineFeedback = new BoolFeedback(() => _commsMonitor.IsOnline);
StatusFeedback = new IntFeedback(() => (int)_commsMonitor.Status); StatusFeedback = new IntFeedback(() => (int)_commsMonitor.Status);
@@ -149,7 +158,9 @@ namespace EssentialsPluginTemplate
private void Handle_LineRecieved(object sender, GenericCommMethodReceiveTextArgs args) private void Handle_LineRecieved(object sender, GenericCommMethodReceiveTextArgs args)
{ {
// TODO [ ] Implement method // 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 // TODO [ ] If not using an HEX/byte based API with no delimeter, delete the method below
@@ -166,6 +177,15 @@ namespace EssentialsPluginTemplate
throw new System.NotImplementedException(); throw new System.NotImplementedException();
} }
/// <summary>
/// This method should perform any necessary parsing of feedback messages from the device
/// </summary>
/// <param name="message"></param>
void ProcessFeedbackMessage(string message)
{
}
// TODO [ ] If not using an ACII based API, delete the properties below // TODO [ ] If not using an ACII based API, delete the properties below
/// <summary> /// <summary>

View File

@@ -188,7 +188,7 @@ namespace EssentialsPluginTemplate
{ {
// Set the minimum Essentials Framework Version // Set the minimum Essentials Framework Version
// TODO [ ] Update the Essentials minimum framework version which this plugin has been tested against // 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 // 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 // TODO [ ] Update the TypeNames for the plugin being developed

View File

@@ -1,3 +1,3 @@
<packages> <packages>
<package id="PepperDashEssentials" version="1.6.4" targetFramework="net35" allowedVersions="[1.0,2.0)"/> <package id="PepperDashEssentials" version="1.7.5" targetFramework="net35" allowedVersions="[1.0,2.0)"/>
</packages> </packages>