diff --git a/.github/workflows/EssentialsPlugins-builds-caller.yml b/.github/workflows/EssentialsPlugins-builds-caller.yml
new file mode 100644
index 0000000..6d9f244
--- /dev/null
+++ b/.github/workflows/EssentialsPlugins-builds-caller.yml
@@ -0,0 +1,31 @@
+name: Build Essentials Plugin
+
+on:
+ push:
+ branches:
+ - '**'
+
+jobs:
+ getVersion:
+ uses: PepperDash/workflow-templates/.github/workflows/essentialsplugins-getversion.yml@main
+ secrets: inherit
+ build-3Series:
+ uses: PepperDash/workflow-templates/.github/workflows/essentialsplugins-3Series-builds.yml@main
+ secrets: inherit
+ needs: getVersion
+ if: needs.getVersion.outputs.newVersion == 'true'
+ with:
+ newVersion: ${{ needs.getVersion.outputs.newVersion }}
+ version: ${{ needs.getVersion.outputs.version }}
+ tag: ${{ needs.getVersion.outputs.tag }}
+ channel: ${{ needs.getVersion.outputs.channel }}
+ build-4Series:
+ uses: PepperDash/workflow-templates/.github/workflows/essentialsplugins-4Series-builds.yml@main
+ secrets: inherit
+ needs: getVersion
+ if: needs.getVersion.outputs.newVersion == 'true'
+ with:
+ newVersion: ${{ needs.getVersion.outputs.newVersion }}
+ version: ${{ needs.getVersion.outputs.version }}
+ tag: ${{ needs.getVersion.outputs.tag }}
+ channel: ${{ needs.getVersion.outputs.channel }}
\ No newline at end of file
diff --git a/.github/workflows/essentialsplugins-betabuilds-caller.yml b/.github/workflows/essentialsplugins-betabuilds-caller.yml
deleted file mode 100644
index 8ca618c..0000000
--- a/.github/workflows/essentialsplugins-betabuilds-caller.yml
+++ /dev/null
@@ -1,22 +0,0 @@
-name: Beta Build
-
-on:
- push:
- branches-ignore:
- - "main"
-
- workflow_dispatch:
- inputs:
- branch:
- description: 'Branch to build'
- required: true
- type: string
-
-jobs:
- call-workflow:
- uses: PepperDash/workflow-templates/.github/workflows/essentialsplugins-builds.yml@main
- secrets: inherit
- with:
- branch: ${{ github.ref_name }}
- default-branch: "main"
-
diff --git a/.github/workflows/essentialsplugins-releasebuilds-caller.yml b/.github/workflows/essentialsplugins-releasebuilds-caller.yml
deleted file mode 100644
index d17c1d5..0000000
--- a/.github/workflows/essentialsplugins-releasebuilds-caller.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-name: Release Build
-
-on:
- release:
- types:
- - released
- branches:
- - "main"
-
- workflow_dispatch:
- inputs:
- branch:
- description: 'Branch to build'
- required: true
- type: string
-
-jobs:
- call-workflow:
- uses: PepperDash/workflow-templates/.github/workflows/essentialsplugins-builds.yml@main
- secrets: inherit
- with:
- branch: "main"
- default-branch: "main"
-
-
diff --git a/.github/workflows/essentialsplugins-updatereadme-caller.yml b/.github/workflows/essentialsplugins-updatereadme-caller.yml
new file mode 100644
index 0000000..e3680bd
--- /dev/null
+++ b/.github/workflows/essentialsplugins-updatereadme-caller.yml
@@ -0,0 +1,14 @@
+
+name: Generate README
+
+on:
+ push:
+ branches-ignore:
+ - 'robot-docs'
+
+jobs:
+ call-update-readme:
+ uses: PepperDash/workflow-templates/.github/workflows/update-readme.yml@development
+ with:
+ target-branch: ${{ github.ref_name }}
+
diff --git a/.releaserc.json b/.releaserc.json
new file mode 100644
index 0000000..68e16b2
--- /dev/null
+++ b/.releaserc.json
@@ -0,0 +1,35 @@
+{
+ "plugins": [
+ [
+ "@semantic-release/commit-analyzer",
+ {
+ "releaseRules": [
+ { "scope": "force-patch", "release": "patch" },
+ { "scope": "no-release", "release": false }
+ ]
+ }
+ ],
+ "@semantic-release/release-notes-generator",
+ ["@semantic-release/changelog",
+ {
+ "changelogFile": "CHANGELOG.md"
+ }
+ ],
+ [
+ "@semantic-release/exec",
+ {
+ "verifyReleaseCmd": "echo \"newVersion=true\" >> $GITHUB_OUTPUT",
+ "publishCmd": "echo \"version=${nextRelease.version}\" >> $GITHUB_OUTPUT && echo \"tag=${nextRelease.gitTag}\" >> $GITHUB_OUTPUT && echo \"type=${nextRelease.type}\" >> $GITHUB_OUTPUT && echo \"channel=${nextRelease.channel}\" >> $GITHUB_OUTPUT"
+ }
+ ]
+ ],
+ "branches": [
+ "main",
+ {"name": "release", "prerelease": "rc", "channel": "rc"},
+ {
+ "name": "replace-me-feature-branch",
+ "prerelease": "replace-me-prerelease",
+ "channel": "replace-me-prerelease"
+ }
+ ]
+ }
\ No newline at end of file
diff --git a/README.md b/README.md
index 284b739..3a6231e 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,4 @@
# Internal Essentials Plugin Template (c) 2022
-
## License
Provided under MIT license
diff --git a/ConfiguraitonFile Example/.vscode/sftp.json b/_ConfiguraitonFile Example/.vscode/sftp.json
similarity index 100%
rename from ConfiguraitonFile Example/.vscode/sftp.json
rename to _ConfiguraitonFile Example/.vscode/sftp.json
diff --git a/ConfiguraitonFile Example/LocalConfig/configurationFile.json b/_ConfiguraitonFile Example/LocalConfig/configurationFile.json
similarity index 100%
rename from ConfiguraitonFile Example/LocalConfig/configurationFile.json
rename to _ConfiguraitonFile Example/LocalConfig/configurationFile.json
diff --git a/ConfiguraitonFile Example/configurationFile.json b/_ConfiguraitonFile Example/configurationFile.json
similarity index 100%
rename from ConfiguraitonFile Example/configurationFile.json
rename to _ConfiguraitonFile Example/configurationFile.json
diff --git a/ConfiguraitonFile Example/plugins/loadedAssemblies/PDT.CustomValues.EPI.dll b/_ConfiguraitonFile Example/plugins/loadedAssemblies/PDT.CustomValues.EPI.dll
similarity index 100%
rename from ConfiguraitonFile Example/plugins/loadedAssemblies/PDT.CustomValues.EPI.dll
rename to _ConfiguraitonFile Example/plugins/loadedAssemblies/PDT.CustomValues.EPI.dll
diff --git a/ConfiguraitonFile Example/testFile.test b/_ConfiguraitonFile Example/testFile.test
similarity index 100%
rename from ConfiguraitonFile Example/testFile.test
rename to _ConfiguraitonFile Example/testFile.test
diff --git a/simpl_Example/EPI_Utilities_CustomValues_Example_v00.01.lpz b/_simpl_Example/EPI_Utilities_CustomValues_Example_v00.01.lpz
similarity index 100%
rename from simpl_Example/EPI_Utilities_CustomValues_Example_v00.01.lpz
rename to _simpl_Example/EPI_Utilities_CustomValues_Example_v00.01.lpz
diff --git a/simpl_Example/EPI_Utilities_CustomValues_Example_v00.01.lpz.hash b/_simpl_Example/EPI_Utilities_CustomValues_Example_v00.01.lpz.hash
similarity index 100%
rename from simpl_Example/EPI_Utilities_CustomValues_Example_v00.01.lpz.hash
rename to _simpl_Example/EPI_Utilities_CustomValues_Example_v00.01.lpz.hash
diff --git a/simpl_Example/EPI_Utilities_CustomValues_Example_v00.01.sig b/_simpl_Example/EPI_Utilities_CustomValues_Example_v00.01.sig
similarity index 100%
rename from simpl_Example/EPI_Utilities_CustomValues_Example_v00.01.sig
rename to _simpl_Example/EPI_Utilities_CustomValues_Example_v00.01.sig
diff --git a/simpl_Example/EPI_Utilities_CustomValues_Example_v00.01.sm2 b/_simpl_Example/EPI_Utilities_CustomValues_Example_v00.01.sm2
similarity index 100%
rename from simpl_Example/EPI_Utilities_CustomValues_Example_v00.01.sm2
rename to _simpl_Example/EPI_Utilities_CustomValues_Example_v00.01.sm2
diff --git a/simpl_Example/EPI_Utilities_CustomValues_Example_v00.01.smft b/_simpl_Example/EPI_Utilities_CustomValues_Example_v00.01.smft
similarity index 100%
rename from simpl_Example/EPI_Utilities_CustomValues_Example_v00.01.smft
rename to _simpl_Example/EPI_Utilities_CustomValues_Example_v00.01.smft
diff --git a/simpl_Example/EPI_Utilities_CustomValues_Example_v00.01.smw b/_simpl_Example/EPI_Utilities_CustomValues_Example_v00.01.smw
similarity index 100%
rename from simpl_Example/EPI_Utilities_CustomValues_Example_v00.01.smw
rename to _simpl_Example/EPI_Utilities_CustomValues_Example_v00.01.smw
diff --git a/simpl_Example/EPI_Utilities_CustomValues_Example_v00.01.smw.ASV b/_simpl_Example/EPI_Utilities_CustomValues_Example_v00.01.smw.ASV
similarity index 100%
rename from simpl_Example/EPI_Utilities_CustomValues_Example_v00.01.smw.ASV
rename to _simpl_Example/EPI_Utilities_CustomValues_Example_v00.01.smw.ASV
diff --git a/simpl_Example/EPI_Utilities_CustomValues_Example_v00.01_archive.zip b/_simpl_Example/EPI_Utilities_CustomValues_Example_v00.01_archive.zip
similarity index 100%
rename from simpl_Example/EPI_Utilities_CustomValues_Example_v00.01_archive.zip
rename to _simpl_Example/EPI_Utilities_CustomValues_Example_v00.01_archive.zip
diff --git a/simpl_Example/EPI_Utilities_CustomValues_Example_v00.01_compiled.zip b/_simpl_Example/EPI_Utilities_CustomValues_Example_v00.01_compiled.zip
similarity index 100%
rename from simpl_Example/EPI_Utilities_CustomValues_Example_v00.01_compiled.zip
rename to _simpl_Example/EPI_Utilities_CustomValues_Example_v00.01_compiled.zip
diff --git a/simpl_Example/SPlsWork/Version.ini b/_simpl_Example/SPlsWork/Version.ini
similarity index 100%
rename from simpl_Example/SPlsWork/Version.ini
rename to _simpl_Example/SPlsWork/Version.ini
diff --git a/epi-utilities-custom-values/CustomValuesConfigObject.cs b/epi-utilities-custom-values/CustomValuesConfigObject.cs
deleted file mode 100644
index 9ad4582..0000000
--- a/epi-utilities-custom-values/CustomValuesConfigObject.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-using System.Collections.Generic;
-using Newtonsoft.Json.Linq;
-using Newtonsoft.Json;
-using PepperDash.Essentials.Core;
-using PepperDash.Essentials.Core.Config;
-
-namespace Essentials.Plugin.CustomValues
-{
- ///
- /// Plugin device configuration object
- ///
- public class CustomValuesConfigObject
- {
-
-
- [JsonProperty("filePath")]
- public string FilePath { get; set; }
-
- [JsonProperty("data")]
- public JObject Data { get; set; }
-
- ///
- /// Constuctor
- ///
- ///
- /// If using a collection you must instantiate the collection in the constructor
- /// to avoid exceptions when reading the configuration file
- ///
- public CustomValuesConfigObject()
- {
-
- }
- }
-
- public class CustomValuesProps
- {
-
-
- }
-
-
-}
\ No newline at end of file
diff --git a/epi-utilities-custom-values/PDT.CustomValues.EPI.sln b/epi-utilities-customvalues.3Series.sln
similarity index 80%
rename from epi-utilities-custom-values/PDT.CustomValues.EPI.sln
rename to epi-utilities-customvalues.3Series.sln
index 753ad30..ff7cd38 100644
--- a/epi-utilities-custom-values/PDT.CustomValues.EPI.sln
+++ b/epi-utilities-customvalues.3Series.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PDT.CustomValues.EPI", "PDT.CustomValues.EPI.csproj", "{9D249E47-8F95-4437-A6BB-563510287AD1}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "epi-utilities-customvalues.3Series", "src\epi-utilities-customvalues.3Series.csproj", "{9D249E47-8F95-4437-A6BB-563510287AD1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/epi-utilities-customvalues.4series.sln b/epi-utilities-customvalues.4series.sln
new file mode 100644
index 0000000..dadb7f8
--- /dev/null
+++ b/epi-utilities-customvalues.4series.sln
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.12.35527.113
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "epi-utilities-customvalues.4Series", "src\epi-utilities-customvalues.4Series.csproj", "{41543F44-1EFC-4D69-A08A-5BF5CD36F1BB}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {41543F44-1EFC-4D69-A08A-5BF5CD36F1BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {41543F44-1EFC-4D69-A08A-5BF5CD36F1BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {41543F44-1EFC-4D69-A08A-5BF5CD36F1BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {41543F44-1EFC-4D69-A08A-5BF5CD36F1BB}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/packages.config b/packages.config
index 4765191..da29c1d 100644
--- a/packages.config
+++ b/packages.config
@@ -1,3 +1,3 @@
-
+
\ No newline at end of file
diff --git a/src/CustomValuesConfigObject.cs b/src/CustomValuesConfigObject.cs
new file mode 100644
index 0000000..a101b70
--- /dev/null
+++ b/src/CustomValuesConfigObject.cs
@@ -0,0 +1,20 @@
+using Newtonsoft.Json.Linq;
+using Newtonsoft.Json;
+
+namespace Essentials.Plugin.CustomValues
+{
+ ///
+ /// Plugin device configuration object
+ ///
+ public class CustomValuesConfigObject
+ {
+ [JsonProperty("seed")]
+ public JObject Seed { get; set; }
+
+ [JsonProperty("filePath")]
+ public string FilePath { get; set; }
+
+ [JsonProperty("data")]
+ public JObject Data { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/CustomValuesController.cs b/src/CustomValuesController.cs
new file mode 100644
index 0000000..8f0d180
--- /dev/null
+++ b/src/CustomValuesController.cs
@@ -0,0 +1,243 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Crestron.SimplSharp;
+using Crestron.SimplSharp.CrestronIO;
+using Crestron.SimplSharpPro.DeviceSupport;
+using Essentials.Plugin.CustomValues;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using PepperDash.Core;
+using PepperDash.Essentials.Core;
+using PepperDash.Essentials.Core.Bridges;
+using PepperDash.Essentials.Core.Config;
+using PepperDash.Essentials.Core.Devices;
+using Feedback = PepperDash.Essentials.Core.Feedback;
+
+namespace PDT.CustomValues.EPI
+{
+ public class CustomValuesController : ReconfigurableDevice, IBridgeAdvanced
+ {
+ private readonly CustomValuesConfigObject props;
+ private readonly CTimer saveTimer;
+ private readonly CCriticalSection sync = new CCriticalSection();
+
+ private JObject data;
+
+ public CustomValuesController(DeviceConfig config)
+ : base(config)
+ {
+ saveTimer = new CTimer(_ => WithLock(() =>
+ {
+ if (string.IsNullOrEmpty(props.FilePath))
+ {
+ Debug.Console(0, this, "File path is not specified... so we are going to save these values locally");
+ return;
+ }
+
+ try
+ {
+ SaveData(props.FilePath, data);
+ var handler = DataSaved;
+ if (handler != null)
+ {
+ handler(this, EventArgs.Empty);
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.Console(0, this, Debug.ErrorLogLevel.Warning, "Failed to save custom values data:{0}", ex);
+ }
+ }),
+ Timeout.Infinite);
+
+ props = config.Properties.ToObject();
+
+ AddPreActivationAction(() => data =
+ string.IsNullOrEmpty(props.FilePath)
+ ? props.Data
+ : SeedData(props.FilePath, props.Seed));
+ }
+
+ public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
+ {
+ if (data == null)
+ throw new Exception("The seed data is null... something went wrong. Check that you have either defined a file path or a 'data' object in the config");
+
+ var feedbacks = new List();
+ DataSaved += (sender, args) => feedbacks.ToList().ForEach(f => f.FireUpdate());
+
+ var customJoins = JoinMapHelper.TryGetJoinMapAdvancedForDevice(joinMapKey);
+ if (customJoins == null)
+ {
+ Debug.Console(0, this, "Custom Joins not found!!!");
+ return;
+ }
+
+ Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
+ Debug.Console(1, this, "Linking to Bridge Type {0}", GetType().Name);
+
+ foreach (var customJoin in customJoins)
+ {
+ var path = customJoin.Key;
+ var index = customJoin.Value.JoinNumber;
+ var join = (ushort) (index + joinStart - 1);
+
+ Debug.Console(1, this, "Attempting to map join:{0} to path:{1}", join, path);
+ var value = data.SelectToken(path);
+
+ // Validity Checks
+ if (index == 0)
+ {
+ Debug.Console(0, this, "Missing Join number for path:{0}", path);
+ continue;
+ }
+
+ Debug.Console(1, this, "Mapping join:{0} to value:{1} with path:{2}", join, value.ToString(), path);
+
+ switch (value.Type)
+ {
+ case JTokenType.Integer:
+ {
+ Debug.Console(2, this, "I AM INT");
+
+ trilist.SetUShortSigAction(@join, x => WithLock(() =>
+ {
+ data.SelectToken(path).Replace(x);
+ saveTimer.Reset(1000);
+ }));
+
+ var feedback = new IntFeedback(() => data.SelectToken(path).Value());
+ feedback.LinkInputSig(trilist.UShortInput[@join]);
+ feedbacks.Add(feedback);
+ feedback.FireUpdate();
+ feedback.OutputChange +=
+ (sender, args) =>
+ Debug.Console(1, this, "Value for path:{0} updated to {1}", path, args.IntValue);
+ }
+ break;
+ case JTokenType.String:
+ {
+ Debug.Console(2, this, "I AM STRING");
+
+ trilist.SetStringSigAction(@join, x => WithLock(() =>
+ {
+ data.SelectToken(path).Replace(x);
+ saveTimer.Reset(1000);
+ }));
+
+ var feedback = new StringFeedback(() => data.SelectToken(path).Value());
+ feedback.LinkInputSig(trilist.StringInput[@join]);
+ feedbacks.Add(feedback);
+ feedback.FireUpdate();
+ feedback.OutputChange +=
+ (sender, args) =>
+ Debug.Console(1, this, "Value for path:{0} updated to {1}", path, args.StringValue);
+ }
+ break;
+ case JTokenType.Object:
+ {
+ Debug.Console(2, this, "I AM OBJECT");
+
+ trilist.SetStringSigAction(@join, x =>
+ {
+ data.SelectToken(path).Replace(x);
+ saveTimer.Reset(1000);
+ });
+
+ var feedback = new StringFeedback(() => data.SelectToken(path).Value());
+ feedback.LinkInputSig(trilist.StringInput[@join]);
+ feedbacks.Add(feedback);
+ feedback.FireUpdate();
+ feedback.OutputChange +=
+ (sender, args) =>
+ Debug.Console(1, this, "Value for path:{0} updated to {1}", path, args.StringValue);
+ }
+ break;
+ case JTokenType.Boolean:
+ {
+ Debug.Console(2, this, "I AM BOOL");
+
+ trilist.SetBoolSigAction(@join, x =>
+ {
+ data.SelectToken(path).Replace(x);
+ saveTimer.Reset(1000);
+ });
+
+ var feedback = new BoolFeedback(() => data.SelectToken(path).Value());
+ feedback.LinkInputSig(trilist.BooleanInput[@join]);
+ feedbacks.Add(feedback);
+ feedback.FireUpdate();
+ feedback.OutputChange +=
+ (sender, args) =>
+ Debug.Console(1, this, "Value for path:{0} updated to {1}", path, args.BoolValue);
+ }
+ break;
+ }
+ }
+ }
+
+ private event EventHandler DataSaved;
+
+ private void WithLock(Action a)
+ {
+ sync.Enter();
+ try
+ {
+ a();
+ }
+ catch (Exception ex)
+ {
+ Debug.Console(0, Debug.ErrorLogLevel.Warning, "Caught an exception within the lock:{0}", ex);
+ throw;
+ }
+ finally
+ {
+ sync.Leave();
+ }
+ }
+
+ private static JObject SeedData(string fileName, JObject seed)
+ {
+ var filePath = Path.Combine(Global.FilePathPrefix, fileName);
+ Debug.Console(0, "Attemping to find a file at path:{0}", filePath);
+
+ if (File.Exists(filePath))
+ {
+ using (var fs = File.OpenRead(filePath))
+ using (var stream = new StreamReader(fs))
+ using (var json = new JsonTextReader(stream))
+ {
+ return JObject.Load(json);
+ }
+ }
+
+ Debug.Console(0, "Didn't find a file at path:{0}, creating...", filePath);
+ var dataToSeed = seed ?? new JObject();
+ using (var fs = File.Create(filePath))
+ using (var stream = new StreamWriter(fs))
+ using (var writer = new JsonTextWriter(stream))
+ {
+ dataToSeed.WriteTo(writer);
+ }
+
+ return dataToSeed;
+ }
+
+ private static void SaveData(string fileName, JToken data)
+ {
+ if (data == null)
+ throw new ArgumentNullException("data");
+
+ var filePath = Path.Combine(Global.FilePathPrefix, fileName);
+ Debug.Console(0, "Attemping to write a file at path:{0}", filePath);
+
+ using (var fs = File.OpenWrite(filePath))
+ using (var stream = new StreamWriter(fs))
+ using (var writer = new JsonTextWriter(stream))
+ {
+ data.WriteTo(writer);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/epi-utilities-custom-values/CustomValuesJoinMap.cs b/src/CustomValuesJoinMap.cs
similarity index 100%
rename from epi-utilities-custom-values/CustomValuesJoinMap.cs
rename to src/CustomValuesJoinMap.cs
diff --git a/epi-utilities-custom-values/CustomValuesLogicDevice.cs b/src/CustomValuesLogicDevice.cs
similarity index 87%
rename from epi-utilities-custom-values/CustomValuesLogicDevice.cs
rename to src/CustomValuesLogicDevice.cs
index e259db5..9d8d2e6 100644
--- a/epi-utilities-custom-values/CustomValuesLogicDevice.cs
+++ b/src/CustomValuesLogicDevice.cs
@@ -4,19 +4,17 @@
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
-using Crestron.SimplSharpPro.EthernetCommunication;
using System;
using Newtonsoft.Json;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
-using PepperDash.Essentials.Core.Feedbacks;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharp;
namespace Essentials.Plugin.CustomValues
{
- ///
+ ///
/// Plugin device template for logic devices that don't communicate outside the program
///
///
@@ -35,7 +33,8 @@ public class CustomValuesDevice : ReconfigurableBridgableDevice, IBridgeAdvanced
public const long WriteTimeout = 15000;
public Dictionary Feedbacks;
bool Initialized = false;
- static CCriticalSection fileLock = new CCriticalSection();
+
+ private static readonly CCriticalSection fileLock = new CCriticalSection();
private CustomValuesConfigObject _Properties
{
@@ -167,9 +166,31 @@ public override bool CustomActivate()
void CreateFile()
{
- Debug.Console(2, this, "Creating new file");
- FileIO.WriteDataToFile("{}", _Properties.FilePath);
- FileData = JObject.Parse(FileIO.ReadDataFromFile(FileIO.GetFile(_Properties.FilePath)));
+ fileLock.Enter();
+ try
+ {
+ Debug.Console(2, this, "Creating new file");
+ var seed = _Properties.Seed == null ? "{}" : _Properties.Seed.ToString();
+
+ FileIO.WriteDataToFile(seed, _Properties.FilePath);
+
+ var filePath = _Properties.FilePath;
+ Debug.Console(0, this, "File created at path:{0}", filePath);
+ var file = FileIO.GetFile(filePath);
+ var data = FileIO.ReadDataFromFile(file);
+
+ FileData = JObject.Parse(data);
+ Debug.Console(0, this, "Current data:{0}", FileData);
+ }
+ catch (Exception ex)
+ {
+ Debug.Console(0, Debug.ErrorLogLevel.Error, "Caught an exception creating a file:{0}", ex);
+ throw;
+ }
+ finally
+ {
+ fileLock.Leave();
+ }
}
private void WriteValue(string path, ushort value)
@@ -351,42 +372,38 @@ public override void LinkToApi(BasicTriList trilist, uint joinStart, string join
if (customJoins == null)
{
Debug.Console(0, this, "Custom Joins not found!!!");
+ return;
}
Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.Console(0, this, "Linking to Bridge Type {0}", GetType().Name);
+
foreach (var j in customJoins)
{
-
var path = j.Key;
- uint? index = j.Value.JoinNumber;
- JToken value;
- if (UseFile)
- {
- value = FileData.SelectToken(path);
- }
- else
- {
- value = _Properties.Data.SelectToken(path);
- }
+ var index = j.Value.JoinNumber;
+ var join = (ushort)(index + joinStart - 1);
+ Debug.Console(0, this, "Attempting to map join:{0} to path:{1}", join, path);
+
+ var value = UseFile ? FileData.SelectToken(path) : _Properties.Data.SelectToken(path);
+ Debug.Console(0, this, "Mapping to:{0}", value.ToString());
// Validity Checks
if (index == 0)
{
- Debug.Console(0, this, "Missing Join number for Key {0}", path);
- continue;
- }
- if (value == null)
- {
- Debug.Console(0, this, "Cannot find value for Key {0}", path);
+ Debug.Console(0, this, "Missing Join number for path:{0}", path);
continue;
}
-
+ if (value == null)
+ {
+ Debug.Console(0, this, "Missing value in config for path:{0}", path);
+ continue;
+ }
+
//var path = map.Path;
- ushort join = (ushort)(index + joinStart - 1);
+ Debug.Console(0, this, "Mapping join:{0} to value:{1} with path:{2}", join, value.Type.ToString());
- Debug.Console(2, this, "Read and mapped data {0} {1} {2}", value, join, value.Type.ToString());
if (value.Type == Newtonsoft.Json.Linq.JTokenType.Integer)
{
Debug.Console(2, this, "I AM INT");
@@ -459,10 +476,6 @@ void Eisc_OnlineStatusChange(Crestron.SimplSharpPro.GenericBase currentDevice, C
Debug.Console(2, this, "EISC OFFLINE");
}
}
-
-
-
-
}
}
diff --git a/epi-utilities-custom-values/CustomValuesTemplateFactory.cs b/src/CustomValuesTemplateFactory.cs
similarity index 95%
rename from epi-utilities-custom-values/CustomValuesTemplateFactory.cs
rename to src/CustomValuesTemplateFactory.cs
index 438a9dc..09fec5f 100644
--- a/epi-utilities-custom-values/CustomValuesTemplateFactory.cs
+++ b/src/CustomValuesTemplateFactory.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using PDT.CustomValues.EPI;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using Crestron.SimplSharpPro.UI;
@@ -37,7 +38,7 @@ public EssentialsPluginFactoryLogicDeviceTemplate()
{
// Set the minimum Essentials Framework Version
// TODO [ ] Update the Essentials minimum framework version which this plugin has been tested against
- MinimumEssentialsFrameworkVersion = "1.10.0";
+ MinimumEssentialsFrameworkVersion = "2.4.6";
// 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
@@ -59,7 +60,7 @@ public override EssentialsDevice BuildDevice(PepperDash.Essentials.Core.Config.D
Debug.Console(1, "[{0}] Factory Attempting to create new device from type: {1}", dc.Key, dc.Type);
- return new CustomValuesDevice(dc.Key, dc.Name, dc);
+ return new CustomValuesController(dc);
}
}
diff --git a/epi-utilities-custom-values/Debug2.cs b/src/Debug2.cs
similarity index 100%
rename from epi-utilities-custom-values/Debug2.cs
rename to src/Debug2.cs
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
new file mode 100644
index 0000000..c8926ac
--- /dev/null
+++ b/src/Directory.Build.props
@@ -0,0 +1,21 @@
+
+
+ 1.0.0-local
+ $(Version)
+ PepperDash Technologies
+ PepperDash Technologies
+ PepperDash Essentials Plugin
+ Copyright © 2025
+ https://github.com/PepperDash/epi-utilities-devicemonitor.git
+ git
+ Crestron; 4series
+ ../output
+ True
+ LICENSE.md
+ README.md
+
+
+
+
+
+
diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets
new file mode 100644
index 0000000..3af6067
--- /dev/null
+++ b/src/Directory.Build.targets
@@ -0,0 +1,20 @@
+
+
+
+ true
+ content;
+
+
+ true
+ content;
+
+
+
+
+
+
+
+
+
+
+
diff --git a/epi-utilities-custom-values/IDebug.cs b/src/IDebug.cs
similarity index 100%
rename from epi-utilities-custom-values/IDebug.cs
rename to src/IDebug.cs
diff --git a/epi-utilities-custom-values/Properties/AssemblyInfo.cs b/src/Properties/AssemblyInfo.cs
similarity index 100%
rename from epi-utilities-custom-values/Properties/AssemblyInfo.cs
rename to src/Properties/AssemblyInfo.cs
diff --git a/epi-utilities-custom-values/Properties/ControlSystem.cfg b/src/Properties/ControlSystem.cfg
similarity index 100%
rename from epi-utilities-custom-values/Properties/ControlSystem.cfg
rename to src/Properties/ControlSystem.cfg
diff --git a/epi-utilities-custom-values/PDT.CustomValues.EPI.csproj b/src/epi-utilities-customvalues.3Series.csproj
similarity index 99%
rename from epi-utilities-custom-values/PDT.CustomValues.EPI.csproj
rename to src/epi-utilities-customvalues.3Series.csproj
index 1ba58a2..194faf5 100644
--- a/epi-utilities-custom-values/PDT.CustomValues.EPI.csproj
+++ b/src/epi-utilities-customvalues.3Series.csproj
@@ -103,6 +103,7 @@
+
diff --git a/src/epi-utilities-customvalues.4Series.csproj b/src/epi-utilities-customvalues.4Series.csproj
new file mode 100644
index 0000000..35b1bb2
--- /dev/null
+++ b/src/epi-utilities-customvalues.4Series.csproj
@@ -0,0 +1,59 @@
+
+
+ ProgramLibrary
+
+
+ net472
+ PepperDash.Essentials.Plugin
+ false
+ PepperDash.Essentials.Plugin.Utilities.CustomValues
+ PepperDash Technologies
+ PepperDash Essentials Plugin to Monitor Devices.
+ Copyright 2025
+ 1.0.0-local
+ true
+ $(Version)
+ bin\$(Configuration)\
+ PepperDash Technologies
+ PepperDash.Essentials.Plugins.Utilities.CustomValues
+ https://github.com/PepperDash/epi-utilities-customvalues.git
+ crestron 4series essentials plugin device monitor
+
+
+
+ $(DefineConstants);SERIES4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ runtime
+
+
+
+
+
+
+
+
+
+
+