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 ;
92using 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