Skip to content

Commit b833024

Browse files
Merge pull request #33 from PepperDash/remove-3series
feat: update for Essentials 2 & remove deprecation warnings
2 parents ba5d0f3 + a86f97c commit b833024

15 files changed

+508
-475
lines changed

.editorconfig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
root=true
2+
3+
[*.cs]
4+
indent_style=space
5+
indent_size=2
6+
7+
# .editorconfig
8+
9+
# Define a naming style for camelCase without an underscore prefix
10+
dotnet_naming_style.private_field_camel_case.capitalization = camel_case
11+
dotnet_naming_style.private_field_camel_case.required_prefix =
12+
13+
# Define a naming rule for private fields to use the defined style
14+
dotnet_naming_rule.private_field_no_underscore.symbols = private_fields
15+
dotnet_naming_rule.private_field_no_underscore.style = private_field_camel_case
16+
dotnet_naming_rule.private_field_no_underscore.severity = warning
17+
18+
# Define the symbol kind for private fields
19+
dotnet_naming_symbols.private_fields.applicable_kinds = field
20+
dotnet_naming_symbols.private_fields.applicable_accessibilities = private

.vscode/extensions.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"recommendations": [
3+
"ms-dotnettools.vscode-dotnet-runtime",
4+
"ms-dotnettools.csharp",
5+
"ms-dotnettools.csdevkit",
6+
"vivaxy.vscode-conventional-commits",
7+
"mhutchie.git-graph"
8+
]
9+
}

.vscode/settings.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"workbench.colorCustomizations": {
3+
"activityBar.activeBackground": "#8c57e5",
4+
"activityBar.background": "#8c57e5",
5+
"activityBar.foreground": "#e7e7e7",
6+
"activityBar.inactiveForeground": "#e7e7e799",
7+
"activityBarBadge.background": "#6e3411",
8+
"activityBarBadge.foreground": "#e7e7e7",
9+
"commandCenter.border": "#e7e7e799",
10+
"sash.hoverBorder": "#8c57e5",
11+
"statusBar.background": "#6e2bde",
12+
"statusBar.foreground": "#e7e7e7",
13+
"statusBarItem.hoverBackground": "#8c57e5",
14+
"statusBarItem.remoteBackground": "#6e2bde",
15+
"statusBarItem.remoteForeground": "#e7e7e7",
16+
"titleBar.activeBackground": "#6e2bde",
17+
"titleBar.activeForeground": "#e7e7e7",
18+
"titleBar.inactiveBackground": "#6e2bde99",
19+
"titleBar.inactiveForeground": "#e7e7e799"
20+
},
21+
"peacock.color": "#6e2bde",
22+
"[csharp]": {
23+
"editor.defaultFormatter": "ms-dotnettools.csharp",
24+
"editor.formatOnSave": true,
25+
"editor.formatOnSaveMode": "file"
26+
},
27+
"csharp.inlayHints.enableInlayHintsForImplicitObjectCreation": true,
28+
"csharp.inlayHints.enableInlayHintsForImplicitVariableTypes": true,
29+
"csharp.inlayHints.enableInlayHintsForLambdaParameterTypes": true,
30+
"csharp.inlayHints.enableInlayHintsForTypes": true,
31+
"dotnet.formatting.organizeImportsOnFormat": true
32+
}

README.md

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
![PepperDash Essentials Pluign Logo](/images/essentials-plugin-blue.png)
22

3-
# Essentials Plugin Template (c) 2023
3+
# Essentials Plugin Template (c) 2025
44

55
## License
66

77
Provided under MIT license
88

99
## Overview
1010

11-
Fork this repo when creating a new plugin for Essentials. For more information about plugins, refer to the Essentials Wiki [Plugins](https://github.com/PepperDash/Essentials/wiki/Plugins) article.
11+
Fork this repo when creating a new plugin for Essentials. For more information about plugins, refer to the Essentials Wiki [Plugins](https://pepperdash.github.io/Essentials/docs/Plugins.html) article.
1212

1313
This repo contains example classes for the three main categories of devices:
14-
* `EssentialsPluginTemplateDevice`: Used for most third party devices which require communication over a streaming mechanism such as a Com port, TCP/SSh/UDP socket, CEC, etc
15-
* `EssentialsPluginTemplateLogicDevice`: Used for devices that contain logic, but don't require any communication with third parties outside the program
16-
* `EssentialsPluginTemplateCrestronDevice`: Used for devices that represent a piece of Crestron hardware
14+
* `MakeModelDevice`: Used for most third party devices which require communication over a streaming mechanism such as a Com port, TCP/SSh/UDP socket, CEC, etc
15+
* `MakeModelLogicDevice`: Used for devices that contain logic, but don't require any communication with third parties outside the program
16+
* `MakeModelCrestronDevice`: Used for devices that represent a piece of Crestron hardware
1717

18-
There are matching factory classes for each of the three categories of devices. The `EssentialsPluginTemplateConfigObject` should be used as a template and modified for any of the categories of device. Same goes for the `EssentialsPluginTemplateBridgeJoinMap`.
18+
There are matching factory classes for each of the three categories of devices. The `MakeModelConfigObject` should be used as a template and modified for any of the categories of device. Same goes for the `MakeModeleBridgeJoinMap`.
1919

2020
This also illustrates how a plugin can contain multiple devices.
2121

@@ -29,14 +29,7 @@ The [Essentials](https://github.com/PepperDash/Essentials) libraries are require
2929

3030
### Installing Dependencies
3131

32-
To install dependencies once nuget.exe is installed, run the following command from the root directory of your repository:
33-
`nuget install .\packages.config -OutputDirectory .\packages -excludeVersion`.
34-
Alternatively, you can simply run the `GetPackages.bat` file.
35-
To verify that the packages installed correctly, open the plugin solution in your repo and make sure that all references are found, then try and build it.
36-
37-
### Installing Different versions of PepperDash Core
38-
39-
If you need a different version of PepperDash Core, use the command `nuget install .\packages.config -OutputDirectory .\packages -excludeVersion -Version {versionToGet}`. Omitting the `-Version` option will pull the version indicated in the packages.config file.
32+
Dependencies will be automatically installed when
4033

4134
### Instructions for Renaming Solution and Files
4235

@@ -46,15 +39,10 @@ For renaming instructions in particular, see the XML `remarks` tags on class def
4639

4740
## Build Instructions (PepperDash Internal)
4841

49-
## Generating Nuget Package
50-
51-
In the solution folder is a file named "PDT.EssentialsPluginTemplate.nuspec"
52-
53-
1. Rename the file to match your plugin solution name
54-
2. Edit the file to include your project specifics including
55-
1. <id>PepperDash.Essentials.Plugin.MakeModel</id> Convention is to use the prefix "PepperDash.Essentials.Plugin" and include the MakeModel of the device.
56-
2. <projectUrl>https://github.com/PepperDash/EssentialsPluginTemplate</projectUrl> Change to your url to the project repo
42+
## Generating Nuget Package
5743

58-
There is no longer a requirement to adjust workflow files for nuget generation for private and public repositories. This is now handled automatically in the workflow.
44+
A nuget package is automatically generated when the plugin is build. To modify the name and other details of the package, edit the following properties in the .csproj file:
5945

60-
__If you do not make these changes to the nuspec file, the project will not generate a nuget package__
46+
1. `PackageId` - This is the name that will be used to pull the package from Nuget once it's published
47+
2. `PackgeProjectUrl` - This should match the URL for the plugin repo
48+
3. `AssemblyTitle` - This is the dll file name that is will show on a processor when the plugin is loaded

epi-make-model.3Series.sln

Lines changed: 0 additions & 20 deletions
This file was deleted.

packages.config

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/MakeModelConfigObject.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
using System.Collections.Generic;
2-
using Newtonsoft.Json;
3-
using PepperDash.Essentials.Core;
4-
1+
using System.Collections.Generic;
2+
using Newtonsoft.Json;
3+
using PepperDash.Essentials.Core;
4+
55
namespace PepperDash.Essentials.Plugin
66
{
77
/// <summary>
@@ -14,7 +14,7 @@ namespace PepperDash.Essentials.Plugin
1414
/// "EssentialsPluginConfigObjectTemplate" renamed to "SamsungMdcConfig"
1515
/// </example>
1616
[ConfigSnippet("\"properties\":{\"control\":{}")]
17-
public class EssentialsPluginTemplateConfigObject
17+
public class MakeModelConfig
1818
{
1919
/// <summary>
2020
/// JSON control object
@@ -27,7 +27,7 @@ public class EssentialsPluginTemplateConfigObject
2727
/// <example>
2828
/// <code>
2929
/// "control": {
30-
/// "method": "tcpIp",
30+
/// "method": "tcpIp",
3131
/// "controlPortDevKey": "processor",
3232
/// "controlPortNumber": 1,
3333
/// "comParams": {
@@ -139,7 +139,7 @@ public class EssentialsPluginTemplateConfigObject
139139
/// </code>
140140
/// </example>
141141
[JsonProperty("DeviceDictionary")]
142-
public Dictionary<string, EssentialsPluginTemplateConfigObjectDictionary> DeviceDictionary { get; set; }
142+
public Dictionary<string, MakeModelConfigDictionary> DeviceDictionary { get; set; }
143143

144144
/// <summary>
145145
/// Constuctor
@@ -148,9 +148,9 @@ public class EssentialsPluginTemplateConfigObject
148148
/// If using a collection you must instantiate the collection in the constructor
149149
/// to avoid exceptions when reading the configuration file
150150
/// </remarks>
151-
public EssentialsPluginTemplateConfigObject()
151+
public MakeModelConfig()
152152
{
153-
DeviceDictionary = new Dictionary<string, EssentialsPluginTemplateConfigObjectDictionary>();
153+
DeviceDictionary = new Dictionary<string, MakeModelConfigDictionary>();
154154
}
155155
}
156156

@@ -172,7 +172,7 @@ public EssentialsPluginTemplateConfigObject()
172172
/// }
173173
/// </code>
174174
/// </example>
175-
public class EssentialsPluginTemplateConfigObjectDictionary
175+
public class MakeModelConfigDictionary
176176
{
177177
/// <summary>
178178
/// Serializes collection name property

src/MakeModelCrestronDevice.cs

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
// For Basic SIMPL# Classes
2-
// For Basic SIMPL#Pro classes
3-
4-
using Crestron.SimplSharpPro;
5-
using Crestron.SimplSharpPro.DeviceSupport;
6-
using PepperDash.Core;
7-
using PepperDash.Essentials.Core;
8-
using PepperDash.Essentials.Core.Bridges;
9-
2+
// For Basic SIMPL#Pro classes
3+
4+
using Crestron.SimplSharpPro;
5+
using Crestron.SimplSharpPro.DeviceSupport;
6+
using PepperDash.Core.Logging;
7+
using PepperDash.Essentials.Core;
8+
using PepperDash.Essentials.Core.Bridges;
9+
1010
namespace PepperDash.Essentials.Plugin
1111
{
12-
/// <summary>
13-
/// Plugin device
14-
/// </summary>
15-
/// <remarks>
16-
/// Rename the class to match the device plugin being developed.
17-
/// </remarks>
18-
/// <example>
19-
/// "EssentialsPluginDeviceTemplate" renamed to "SamsungMdcDevice"
20-
/// </example>
21-
public class EssentialsPluginTemplateCrestronDevice : CrestronGenericBridgeableBaseDevice
12+
/// <summary>
13+
/// Plugin device
14+
/// </summary>
15+
/// <remarks>
16+
/// Rename the class to match the device plugin being developed.
17+
/// </remarks>
18+
/// <example>
19+
/// "EssentialsPluginDeviceTemplate" renamed to "SamsungMdcDevice"
20+
/// </example>
21+
public class MakeModelCrestronDevice : CrestronGenericBridgeableBaseDevice
2222
{
2323
/// <summary>
2424
/// It is often desirable to store the config
2525
/// </summary>
26-
private EssentialsPluginTemplateConfigObject _config;
26+
private readonly MakeModelConfig config;
2727

2828

2929
#region Constructor for Devices without IBasicCommunication. Remove if not needed
@@ -34,16 +34,16 @@ public class EssentialsPluginTemplateCrestronDevice : CrestronGenericBridgeableB
3434
/// <param name="name"></param>
3535
/// <param name="config"></param>
3636
/// <param name="hardware"></param>
37-
public EssentialsPluginTemplateCrestronDevice(string key, string name, EssentialsPluginTemplateConfigObject config, GenericBase hardware)
37+
public MakeModelCrestronDevice(string key, string name, MakeModelConfig config, GenericBase hardware)
3838
: base(key, name, hardware)
3939
{
40-
Debug.Console(0, this, "Constructing new {0} instance", name);
40+
this.LogInformation("Constructing new {0} instance", name);
4141

4242
// The base class takes care of registering the hardware device for you
4343

4444
// TODO [ ] Update the constructor as needed for the plugin device being developed
4545

46-
_config = config;
46+
this.config = config;
4747
}
4848

4949
#endregion
@@ -63,10 +63,7 @@ public override void LinkToApi(BasicTriList trilist, uint joinStart, string join
6363
var joinMap = new EssentialsPluginTemplateBridgeJoinMap(joinStart);
6464

6565
// This adds the join map to the collection on the bridge
66-
if (bridge != null)
67-
{
68-
bridge.AddJoinMap(Key, joinMap);
69-
}
66+
bridge?.AddJoinMap(Key, joinMap);
7067

7168
var customJoins = JoinMapHelper.TryGetJoinMapAdvancedForDevice(joinMapKey);
7269

@@ -75,8 +72,8 @@ public override void LinkToApi(BasicTriList trilist, uint joinStart, string join
7572
joinMap.SetCustomJoinData(customJoins);
7673
}
7774

78-
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
79-
Debug.Console(0, "Linking to Bridge Type {0}", GetType().Name);
75+
this.LogDebug("Linking to Trilist {id}", trilist.ID.ToString("X"));
76+
this.LogInformation("Linking to Bridge Type {type}", GetType().Name);
8077

8178
// TODO [ ] Implement bridge links as needed
8279

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
using System.Collections.Generic;
2+
using Crestron.SimplSharpPro.UI;
3+
using PepperDash.Core;
4+
using PepperDash.Essentials.Core;
5+
6+
namespace PepperDash.Essentials.Plugin
7+
{
8+
9+
/// <summary>
10+
/// Plugin device factory for Crestron wrapper devices
11+
/// </summary>
12+
/// <remarks>
13+
/// Rename the class to match the device plugin being developed
14+
/// </remarks>
15+
/// <example>
16+
/// "EssentialsPluginFactoryTemplate" renamed to "MyCrestronDeviceFactory"
17+
/// </example>
18+
public class MakeModelCrestronDeviceFactory : EssentialsPluginDeviceFactory<MakeModelCrestronDevice>
19+
{
20+
/// <summary>
21+
/// Plugin device factory constructor
22+
/// </summary>
23+
/// <remarks>
24+
/// Update the MinimumEssentialsFrameworkVersion & TypeNames as needed when creating a plugin
25+
/// </remarks>
26+
/// <example>
27+
/// Set the minimum Essentials Framework Version
28+
/// <code>
29+
/// MinimumEssentialsFrameworkVersion = "1.6.4;
30+
/// </code>
31+
/// In the constructor we initialize the list with the typenames that will build an instance of this device
32+
/// <code>
33+
/// TypeNames = new List<string>() { "SamsungMdc", "SamsungMdcDisplay" };
34+
/// </code>
35+
/// </example>
36+
public MakeModelCrestronDeviceFactory()
37+
{
38+
// Set the minimum Essentials Framework Version
39+
// TODO [ ] Update the Essentials minimum framework version which this plugin has been tested against
40+
MinimumEssentialsFrameworkVersion = "2.12.1";
41+
42+
// In the constructor we initialize the list with the typenames that will build an instance of this device
43+
// TODO [ ] Update the TypeNames for the plugin being developed
44+
TypeNames = new List<string>() { "examplePluginCrestronDevice" };
45+
}
46+
47+
/// <summary>
48+
/// Builds and returns an instance of EssentialsPluginTemplateCrestronDevice
49+
/// </summary>
50+
/// <param name="dc">device configuration</param>
51+
/// <returns>plugin device or null</returns>
52+
/// <remarks>
53+
/// The example provided below takes the device key, name, properties config and the comms device created.
54+
/// Modify the EssetnialsPlugingDeviceTemplate constructor as needed to meet the requirements of the plugin device.
55+
/// </remarks>
56+
/// <seealso cref="PepperDash.Core.eControlMethod"/>
57+
public override EssentialsDevice BuildDevice(PepperDash.Essentials.Core.Config.DeviceConfig dc)
58+
{
59+
60+
Debug.LogDebug("[{key}] Factory Attempting to create new device from type: {type}", dc.Key, dc.Type);
61+
62+
// get the plugin device properties configuration object & check for null
63+
var propertiesConfig = dc.Properties.ToObject<MakeModelConfig>();
64+
if (propertiesConfig == null)
65+
{
66+
Debug.LogWarning("[{key}] Factory: failed to read properties config for {name}", dc.Key, dc.Name);
67+
return null;
68+
}
69+
70+
var controlConfig = CommFactory.GetControlPropertiesConfig(dc);
71+
72+
if (controlConfig != null)
73+
{
74+
var myTouchpanel = new Tsw760(controlConfig.IpIdInt, Global.ControlSystem);
75+
76+
return new MakeModelCrestronDevice(dc.Key, dc.Name, propertiesConfig, myTouchpanel);
77+
}
78+
else
79+
{
80+
Debug.LogWarning("[{key}] Factory: Unable to get control properties from device config for {name}", dc.Key, dc.Name);
81+
return null;
82+
}
83+
}
84+
}
85+
86+
}
87+

0 commit comments

Comments
 (0)