Skip to content

Commit 8ed24e7

Browse files
Merge pull request #10 from PepperDash/feature/add-inline-documentation-and-todos
Feature/add inline documentation and todos
2 parents d09c5c5 + 33c7922 commit 8ed24e7

8 files changed

+620
-154
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
using PepperDash.Essentials.Core;
2+
3+
namespace EssentialsPluginTemplate
4+
{
5+
/// <summary>
6+
/// Plugin device Bridge Join Map
7+
/// </summary>
8+
/// <remarks>
9+
/// Rename the class to match the device plugin being developed. Reference Essentials JoinMaps, if one exists for the device plugin being developed
10+
/// </remarks>
11+
/// <see cref="PepperDash.Essentials.Core.Bridges"/>
12+
/// <example>
13+
/// "EssentialsPluginBridgeJoinMapTemplate" renamed to "SamsungMdcBridgeJoinMap"
14+
/// </example>
15+
public class EssentialsPluginBridgeJoinMapTemplate : JoinMapBaseAdvanced
16+
{
17+
#region Digital
18+
19+
// TODO [ ] Add digital joins below plugin being developed
20+
21+
[JoinName("IsOnline")]
22+
public JoinDataComplete IsOnline = new JoinDataComplete(
23+
new JoinData
24+
{
25+
JoinNumber = 1,
26+
JoinSpan = 1
27+
},
28+
new JoinMetadata
29+
{
30+
Description = "Is Online",
31+
JoinCapabilities = eJoinCapabilities.ToSIMPL,
32+
JoinType = eJoinType.Digital
33+
});
34+
35+
[JoinName("Connect")]
36+
public JoinDataComplete Connect = new JoinDataComplete(
37+
new JoinData
38+
{
39+
JoinNumber = 2,
40+
JoinSpan = 1
41+
},
42+
new JoinMetadata
43+
{
44+
Description = "Connect (Held)/Disconnect (Release) & corresponding feedback",
45+
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
46+
JoinType = eJoinType.Digital
47+
});
48+
49+
#endregion
50+
51+
52+
#region Analog
53+
54+
// TODO [ ] Add analog joins below plugin being developed
55+
56+
[JoinName("Status")]
57+
public JoinDataComplete Status = new JoinDataComplete(
58+
new JoinData
59+
{
60+
JoinNumber = 1,
61+
JoinSpan = 1
62+
},
63+
new JoinMetadata
64+
{
65+
Description = "Socket Status",
66+
JoinCapabilities = eJoinCapabilities.ToSIMPL,
67+
JoinType = eJoinType.Analog
68+
});
69+
70+
#endregion
71+
72+
73+
#region Serial
74+
75+
// TODO [ ] Add serial joins below plugin being developed
76+
77+
public JoinDataComplete DeviceName = new JoinDataComplete(
78+
new JoinData
79+
{
80+
JoinNumber = 1,
81+
JoinSpan = 1
82+
},
83+
new JoinMetadata
84+
{
85+
Description = "Device Name",
86+
JoinCapabilities = eJoinCapabilities.ToSIMPL,
87+
JoinType = eJoinType.Serial
88+
});
89+
90+
#endregion
91+
92+
/// <summary>
93+
/// Plugin device BridgeJoinMap constructor
94+
/// </summary>
95+
/// <param name="joinStart">This will be the join it starts on the EISC bridge</param>
96+
public EssentialsPluginBridgeJoinMapTemplate(uint joinStart)
97+
: base(joinStart, typeof(EssentialsPluginBridgeJoinMapTemplate))
98+
{
99+
}
100+
}
101+
}
Lines changed: 189 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,195 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using Crestron.SimplSharp;
6-
7-
using PepperDash.Core;
8-
1+
using System.Collections.Generic;
92
using Newtonsoft.Json;
3+
using PepperDash.Essentials.Core;
104

11-
namespace EssentialsPluginTemplateEPI
5+
namespace EssentialsPluginTemplate
126
{
13-
/// <summary>
14-
/// Example of a config class that represents the structure of the Properties object of a DeviceConfig.
15-
/// The BuildDevice method will attempt to deserialize the Properties object into this class.
16-
/// Populate with any necssary properties for your device
17-
/// </summary>
18-
public class EssentialsPluginTemplatePropertiesConfig
7+
/// <summary>
8+
/// Plugin device configuration object
9+
/// </summary>
10+
/// <remarks>
11+
/// Rename the class to match the device plugin being created
12+
/// </remarks>
13+
/// <example>
14+
/// "EssentialsPluginConfigObjectTemplate" renamed to "SamsungMdcConfig"
15+
/// </example>
16+
[ConfigSnippet("\"properties\":{\"control\":{}")]
17+
public class EssentialsPluginConfigObjectTemplate
1918
{
20-
// Below are some example properties
21-
22-
23-
/// <summary>
24-
/// Control properties if needed to communicate with device.
25-
/// The JsonProperty attribute has been added to specify the name
26-
/// of the object and that it is required
27-
/// </summary>
28-
[JsonProperty("control", Required = Required.Always)]
29-
ControlPropertiesConfig Control { get; set; }
30-
31-
/// <summary>
32-
/// Add custom properties here
33-
/// </summary>
34-
[JsonProperty("myDeviceProperty")]
35-
string MyDeviceProperty { get; set; }
19+
/// <summary>
20+
/// JSON control object
21+
/// </summary>
22+
/// <remarks>
23+
/// Typically this object is not required, but in some instances it may be needed. For example, when building a
24+
/// plugin that is using Telnet (TCP/IP) communications and requires login, the device will need to handle the login.
25+
/// In order to do so, you will need the username and password in the "tcpSshProperties" object.
26+
/// </remarks>
27+
/// <example>
28+
/// <code>
29+
/// "control": {
30+
/// "method": "tcpIp",
31+
/// "controlPortDevKey": "processor",
32+
/// "controlPortNumber": 1,
33+
/// "comParams": {
34+
/// "baudRate": 9600,
35+
/// "dataBits": 8,
36+
/// "stopBits": 1,
37+
/// "parity": "None",
38+
/// "protocol": "RS232",
39+
/// "hardwareHandshake": "None",
40+
/// "softwareHandshake": "None"
41+
/// },
42+
/// "tcpSshProperties": {
43+
/// "address": "172.22.0.101",
44+
/// "port": 23,
45+
/// "username": "admin",
46+
/// "password": "password",
47+
/// "autoReconnect": true,
48+
/// "autoReconnectIntervalMs": 10000
49+
/// }
50+
/// }
51+
/// </code>
52+
/// </example>
53+
[JsonProperty("control")]
54+
public EssentialsControlPropertiesConfig Control { get; set; }
55+
56+
/// <summary>
57+
/// Serializes the poll time value
58+
/// </summary>
59+
/// <remarks>
60+
/// This is an exmaple device plugin property. This should be modified or deleted as needed for the plugin being built.
61+
/// </remarks>
62+
/// <value>
63+
/// PollTimeMs property gets/sets the value as a long
64+
/// </value>
65+
/// <example>
66+
/// <code>
67+
/// "properties": {
68+
/// "polltimeMs": 30000
69+
/// }
70+
/// </code>
71+
/// </example>
72+
[JsonProperty("pollTimeMs")]
73+
public long PollTimeMs { get; set; }
74+
75+
/// <summary>
76+
/// Serializes the warning timeout value
77+
/// </summary>
78+
/// <remarks>
79+
/// This is an exmaple device plugin property. This should be modified or deleted as needed for the plugin being built.
80+
/// </remarks>
81+
/// <value>
82+
/// WarningTimeoutMs property gets/sets the value as a long
83+
/// </value>
84+
/// <example>
85+
/// <code>
86+
/// "properties": {
87+
/// "warningTimeoutMs": 180000
88+
/// }
89+
/// </code>
90+
/// </example>
91+
[JsonProperty("warningTimeoutMs")]
92+
public long WarningTimeoutMs { get; set; }
93+
94+
/// <summary>
95+
/// Serializes the error timeout value
96+
/// </summary>
97+
/// /// <remarks>
98+
/// This is an exmaple device plugin property. This should be modified or deleted as needed for the plugin being built.
99+
/// </remarks>
100+
/// <value>
101+
/// ErrorTimeoutMs property gets/sets the value as a long
102+
/// </value>
103+
/// <example>
104+
/// <code>
105+
/// "properties": {
106+
/// "errorTimeoutMs": 300000
107+
/// }
108+
/// </code>
109+
/// </example>
110+
[JsonProperty("errorTimeoutMs")]
111+
public long ErrorTimeoutMs { get; set; }
112+
113+
/// <summary>
114+
/// Example dictionary of objects
115+
/// </summary>
116+
/// <remarks>
117+
/// This is an example collection configuration object. This should be modified or deleted as needed for the plugin being built.
118+
/// </remarks>
119+
/// <example>
120+
/// <code>
121+
/// "properties": {
122+
/// "presets": {
123+
/// "preset1": {
124+
/// "enabled": true,
125+
/// "name": "Preset 1"
126+
/// }
127+
/// }
128+
/// }
129+
/// </code>
130+
/// </example>
131+
/// <example>
132+
/// <code>
133+
/// "properties": {
134+
/// "inputNames": {
135+
/// "input1": "Input 1",
136+
/// "input2": "Input 2"
137+
/// }
138+
/// }
139+
/// </code>
140+
/// </example>
141+
[JsonProperty("DeviceDictionary")]
142+
public Dictionary<string, EssentialsPluginConfigObjectDictionaryTemplate> DeviceDictionary { get; set; }
143+
144+
/// <summary>
145+
/// Constuctor
146+
/// </summary>
147+
/// <remarks>
148+
/// If using a collection you must instantiate the collection in the constructor
149+
/// to avoid exceptions when reading the configuration file
150+
/// </remarks>
151+
public EssentialsPluginConfigObjectTemplate()
152+
{
153+
DeviceDictionary = new Dictionary<string, EssentialsPluginConfigObjectDictionaryTemplate>();
154+
}
155+
}
156+
157+
/// <summary>
158+
/// Example plugin configuration dictionary object
159+
/// </summary>
160+
/// <remarks>
161+
/// This is an example collection of configuration objects. This can be modified or deleted as needed for the plugin being built.
162+
/// </remarks>
163+
/// <example>
164+
/// <code>
165+
/// "properties": {
166+
/// "dictionary": {
167+
/// "item1": {
168+
/// "name": "Item 1 Name",
169+
/// "value": "Item 1 Value"
170+
/// }
171+
/// }
172+
/// }
173+
/// </code>
174+
/// </example>
175+
public class EssentialsPluginConfigObjectDictionaryTemplate
176+
{
177+
/// <summary>
178+
/// Serializes collection name property
179+
/// </summary>
180+
/// <remarks>
181+
/// This is an example collection of configuration objects. This can be modified or deleted as needed for the plugin being built.
182+
/// </remarks>
183+
[JsonProperty("name")]
184+
public string Name { get; set; }
185+
186+
/// <summary>
187+
/// Serializes collection value property
188+
/// </summary>
189+
/// <remarks>
190+
/// This is an example collection of configuration objects. This can be modified or deleted as needed for the plugin being built.
191+
/// </remarks>
192+
[JsonProperty("value")]
193+
public uint Value { get; set; }
36194
}
37195
}

0 commit comments

Comments
 (0)