-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from PepperDash/feature/add-inline-documentati…
…on-and-todos Feature/add inline documentation and todos
- Loading branch information
Showing
8 changed files
with
620 additions
and
154 deletions.
There are no files selected for viewing
101 changes: 101 additions & 0 deletions
101
PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateBridgeJoinMap.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
using PepperDash.Essentials.Core; | ||
|
||
namespace EssentialsPluginTemplate | ||
{ | ||
/// <summary> | ||
/// Plugin device Bridge Join Map | ||
/// </summary> | ||
/// <remarks> | ||
/// Rename the class to match the device plugin being developed. Reference Essentials JoinMaps, if one exists for the device plugin being developed | ||
/// </remarks> | ||
/// <see cref="PepperDash.Essentials.Core.Bridges"/> | ||
/// <example> | ||
/// "EssentialsPluginBridgeJoinMapTemplate" renamed to "SamsungMdcBridgeJoinMap" | ||
/// </example> | ||
public class EssentialsPluginBridgeJoinMapTemplate : JoinMapBaseAdvanced | ||
{ | ||
#region Digital | ||
|
||
// TODO [ ] Add digital joins below plugin being developed | ||
|
||
[JoinName("IsOnline")] | ||
public JoinDataComplete IsOnline = new JoinDataComplete( | ||
new JoinData | ||
{ | ||
JoinNumber = 1, | ||
JoinSpan = 1 | ||
}, | ||
new JoinMetadata | ||
{ | ||
Description = "Is Online", | ||
JoinCapabilities = eJoinCapabilities.ToSIMPL, | ||
JoinType = eJoinType.Digital | ||
}); | ||
|
||
[JoinName("Connect")] | ||
public JoinDataComplete Connect = new JoinDataComplete( | ||
new JoinData | ||
{ | ||
JoinNumber = 2, | ||
JoinSpan = 1 | ||
}, | ||
new JoinMetadata | ||
{ | ||
Description = "Connect (Held)/Disconnect (Release) & corresponding feedback", | ||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL, | ||
JoinType = eJoinType.Digital | ||
}); | ||
|
||
#endregion | ||
|
||
|
||
#region Analog | ||
|
||
// TODO [ ] Add analog joins below plugin being developed | ||
|
||
[JoinName("Status")] | ||
public JoinDataComplete Status = new JoinDataComplete( | ||
new JoinData | ||
{ | ||
JoinNumber = 1, | ||
JoinSpan = 1 | ||
}, | ||
new JoinMetadata | ||
{ | ||
Description = "Socket Status", | ||
JoinCapabilities = eJoinCapabilities.ToSIMPL, | ||
JoinType = eJoinType.Analog | ||
}); | ||
|
||
#endregion | ||
|
||
|
||
#region Serial | ||
|
||
// TODO [ ] Add serial joins below plugin being developed | ||
|
||
public JoinDataComplete DeviceName = new JoinDataComplete( | ||
new JoinData | ||
{ | ||
JoinNumber = 1, | ||
JoinSpan = 1 | ||
}, | ||
new JoinMetadata | ||
{ | ||
Description = "Device Name", | ||
JoinCapabilities = eJoinCapabilities.ToSIMPL, | ||
JoinType = eJoinType.Serial | ||
}); | ||
|
||
#endregion | ||
|
||
/// <summary> | ||
/// Plugin device BridgeJoinMap constructor | ||
/// </summary> | ||
/// <param name="joinStart">This will be the join it starts on the EISC bridge</param> | ||
public EssentialsPluginBridgeJoinMapTemplate(uint joinStart) | ||
: base(joinStart, typeof(EssentialsPluginBridgeJoinMapTemplate)) | ||
{ | ||
} | ||
} | ||
} |
220 changes: 189 additions & 31 deletions
220
PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateConfigObject.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,195 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using Crestron.SimplSharp; | ||
|
||
using PepperDash.Core; | ||
|
||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
using PepperDash.Essentials.Core; | ||
|
||
namespace EssentialsPluginTemplateEPI | ||
namespace EssentialsPluginTemplate | ||
{ | ||
/// <summary> | ||
/// Example of a config class that represents the structure of the Properties object of a DeviceConfig. | ||
/// The BuildDevice method will attempt to deserialize the Properties object into this class. | ||
/// Populate with any necssary properties for your device | ||
/// </summary> | ||
public class EssentialsPluginTemplatePropertiesConfig | ||
/// <summary> | ||
/// Plugin device configuration object | ||
/// </summary> | ||
/// <remarks> | ||
/// Rename the class to match the device plugin being created | ||
/// </remarks> | ||
/// <example> | ||
/// "EssentialsPluginConfigObjectTemplate" renamed to "SamsungMdcConfig" | ||
/// </example> | ||
[ConfigSnippet("\"properties\":{\"control\":{}")] | ||
public class EssentialsPluginConfigObjectTemplate | ||
{ | ||
// Below are some example properties | ||
|
||
|
||
/// <summary> | ||
/// Control properties if needed to communicate with device. | ||
/// The JsonProperty attribute has been added to specify the name | ||
/// of the object and that it is required | ||
/// </summary> | ||
[JsonProperty("control", Required = Required.Always)] | ||
ControlPropertiesConfig Control { get; set; } | ||
|
||
/// <summary> | ||
/// Add custom properties here | ||
/// </summary> | ||
[JsonProperty("myDeviceProperty")] | ||
string MyDeviceProperty { get; set; } | ||
/// <summary> | ||
/// JSON control object | ||
/// </summary> | ||
/// <remarks> | ||
/// Typically this object is not required, but in some instances it may be needed. For example, when building a | ||
/// plugin that is using Telnet (TCP/IP) communications and requires login, the device will need to handle the login. | ||
/// In order to do so, you will need the username and password in the "tcpSshProperties" object. | ||
/// </remarks> | ||
/// <example> | ||
/// <code> | ||
/// "control": { | ||
/// "method": "tcpIp", | ||
/// "controlPortDevKey": "processor", | ||
/// "controlPortNumber": 1, | ||
/// "comParams": { | ||
/// "baudRate": 9600, | ||
/// "dataBits": 8, | ||
/// "stopBits": 1, | ||
/// "parity": "None", | ||
/// "protocol": "RS232", | ||
/// "hardwareHandshake": "None", | ||
/// "softwareHandshake": "None" | ||
/// }, | ||
/// "tcpSshProperties": { | ||
/// "address": "172.22.0.101", | ||
/// "port": 23, | ||
/// "username": "admin", | ||
/// "password": "password", | ||
/// "autoReconnect": true, | ||
/// "autoReconnectIntervalMs": 10000 | ||
/// } | ||
/// } | ||
/// </code> | ||
/// </example> | ||
[JsonProperty("control")] | ||
public EssentialsControlPropertiesConfig Control { get; set; } | ||
|
||
/// <summary> | ||
/// Serializes the poll time value | ||
/// </summary> | ||
/// <remarks> | ||
/// This is an exmaple device plugin property. This should be modified or deleted as needed for the plugin being built. | ||
/// </remarks> | ||
/// <value> | ||
/// PollTimeMs property gets/sets the value as a long | ||
/// </value> | ||
/// <example> | ||
/// <code> | ||
/// "properties": { | ||
/// "polltimeMs": 30000 | ||
/// } | ||
/// </code> | ||
/// </example> | ||
[JsonProperty("pollTimeMs")] | ||
public long PollTimeMs { get; set; } | ||
|
||
/// <summary> | ||
/// Serializes the warning timeout value | ||
/// </summary> | ||
/// <remarks> | ||
/// This is an exmaple device plugin property. This should be modified or deleted as needed for the plugin being built. | ||
/// </remarks> | ||
/// <value> | ||
/// WarningTimeoutMs property gets/sets the value as a long | ||
/// </value> | ||
/// <example> | ||
/// <code> | ||
/// "properties": { | ||
/// "warningTimeoutMs": 180000 | ||
/// } | ||
/// </code> | ||
/// </example> | ||
[JsonProperty("warningTimeoutMs")] | ||
public long WarningTimeoutMs { get; set; } | ||
|
||
/// <summary> | ||
/// Serializes the error timeout value | ||
/// </summary> | ||
/// /// <remarks> | ||
/// This is an exmaple device plugin property. This should be modified or deleted as needed for the plugin being built. | ||
/// </remarks> | ||
/// <value> | ||
/// ErrorTimeoutMs property gets/sets the value as a long | ||
/// </value> | ||
/// <example> | ||
/// <code> | ||
/// "properties": { | ||
/// "errorTimeoutMs": 300000 | ||
/// } | ||
/// </code> | ||
/// </example> | ||
[JsonProperty("errorTimeoutMs")] | ||
public long ErrorTimeoutMs { get; set; } | ||
|
||
/// <summary> | ||
/// Example dictionary of objects | ||
/// </summary> | ||
/// <remarks> | ||
/// This is an example collection configuration object. This should be modified or deleted as needed for the plugin being built. | ||
/// </remarks> | ||
/// <example> | ||
/// <code> | ||
/// "properties": { | ||
/// "presets": { | ||
/// "preset1": { | ||
/// "enabled": true, | ||
/// "name": "Preset 1" | ||
/// } | ||
/// } | ||
/// } | ||
/// </code> | ||
/// </example> | ||
/// <example> | ||
/// <code> | ||
/// "properties": { | ||
/// "inputNames": { | ||
/// "input1": "Input 1", | ||
/// "input2": "Input 2" | ||
/// } | ||
/// } | ||
/// </code> | ||
/// </example> | ||
[JsonProperty("DeviceDictionary")] | ||
public Dictionary<string, EssentialsPluginConfigObjectDictionaryTemplate> DeviceDictionary { get; set; } | ||
|
||
/// <summary> | ||
/// Constuctor | ||
/// </summary> | ||
/// <remarks> | ||
/// If using a collection you must instantiate the collection in the constructor | ||
/// to avoid exceptions when reading the configuration file | ||
/// </remarks> | ||
public EssentialsPluginConfigObjectTemplate() | ||
{ | ||
DeviceDictionary = new Dictionary<string, EssentialsPluginConfigObjectDictionaryTemplate>(); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Example plugin configuration dictionary object | ||
/// </summary> | ||
/// <remarks> | ||
/// This is an example collection of configuration objects. This can be modified or deleted as needed for the plugin being built. | ||
/// </remarks> | ||
/// <example> | ||
/// <code> | ||
/// "properties": { | ||
/// "dictionary": { | ||
/// "item1": { | ||
/// "name": "Item 1 Name", | ||
/// "value": "Item 1 Value" | ||
/// } | ||
/// } | ||
/// } | ||
/// </code> | ||
/// </example> | ||
public class EssentialsPluginConfigObjectDictionaryTemplate | ||
{ | ||
/// <summary> | ||
/// Serializes collection name property | ||
/// </summary> | ||
/// <remarks> | ||
/// This is an example collection of configuration objects. This can be modified or deleted as needed for the plugin being built. | ||
/// </remarks> | ||
[JsonProperty("name")] | ||
public string Name { get; set; } | ||
|
||
/// <summary> | ||
/// Serializes collection value property | ||
/// </summary> | ||
/// <remarks> | ||
/// This is an example collection of configuration objects. This can be modified or deleted as needed for the plugin being built. | ||
/// </remarks> | ||
[JsonProperty("value")] | ||
public uint Value { get; set; } | ||
} | ||
} |
Oops, something went wrong.