diff --git a/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateBridgeJoinMap.cs b/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateBridgeJoinMap.cs
new file mode 100644
index 0000000..1f1f9d0
--- /dev/null
+++ b/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateBridgeJoinMap.cs
@@ -0,0 +1,101 @@
+using PepperDash.Essentials.Core;
+
+namespace EssentialsPluginTemplate
+{
+ ///
+ /// Plugin device Bridge Join Map
+ ///
+ ///
+ /// Rename the class to match the device plugin being developed. Reference Essentials JoinMaps, if one exists for the device plugin being developed
+ ///
+ ///
+ ///
+ /// "EssentialsPluginBridgeJoinMapTemplate" renamed to "SamsungMdcBridgeJoinMap"
+ ///
+ 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
+
+ ///
+ /// Plugin device BridgeJoinMap constructor
+ ///
+ /// This will be the join it starts on the EISC bridge
+ public EssentialsPluginBridgeJoinMapTemplate(uint joinStart)
+ : base(joinStart, typeof(EssentialsPluginBridgeJoinMapTemplate))
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateConfigObject.cs b/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateConfigObject.cs
index 5a76b22..027cefe 100644
--- a/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateConfigObject.cs
+++ b/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateConfigObject.cs
@@ -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
{
- ///
- /// 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
- ///
- public class EssentialsPluginTemplatePropertiesConfig
+ ///
+ /// Plugin device configuration object
+ ///
+ ///
+ /// Rename the class to match the device plugin being created
+ ///
+ ///
+ /// "EssentialsPluginConfigObjectTemplate" renamed to "SamsungMdcConfig"
+ ///
+ [ConfigSnippet("\"properties\":{\"control\":{}")]
+ public class EssentialsPluginConfigObjectTemplate
{
- // Below are some example properties
-
-
- ///
- /// 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
- ///
- [JsonProperty("control", Required = Required.Always)]
- ControlPropertiesConfig Control { get; set; }
-
- ///
- /// Add custom properties here
- ///
- [JsonProperty("myDeviceProperty")]
- string MyDeviceProperty { get; set; }
+ ///
+ /// JSON control object
+ ///
+ ///
+ /// 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.
+ ///
+ ///
+ ///
+ /// "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
+ /// }
+ /// }
+ ///
+ ///
+ [JsonProperty("control")]
+ public EssentialsControlPropertiesConfig Control { get; set; }
+
+ ///
+ /// Serializes the poll time value
+ ///
+ ///
+ /// This is an exmaple device plugin property. This should be modified or deleted as needed for the plugin being built.
+ ///
+ ///
+ /// PollTimeMs property gets/sets the value as a long
+ ///
+ ///
+ ///
+ /// "properties": {
+ /// "polltimeMs": 30000
+ /// }
+ ///
+ ///
+ [JsonProperty("pollTimeMs")]
+ public long PollTimeMs { get; set; }
+
+ ///
+ /// Serializes the warning timeout value
+ ///
+ ///
+ /// This is an exmaple device plugin property. This should be modified or deleted as needed for the plugin being built.
+ ///
+ ///
+ /// WarningTimeoutMs property gets/sets the value as a long
+ ///
+ ///
+ ///
+ /// "properties": {
+ /// "warningTimeoutMs": 180000
+ /// }
+ ///
+ ///
+ [JsonProperty("warningTimeoutMs")]
+ public long WarningTimeoutMs { get; set; }
+
+ ///
+ /// Serializes the error timeout value
+ ///
+ /// ///
+ /// This is an exmaple device plugin property. This should be modified or deleted as needed for the plugin being built.
+ ///
+ ///
+ /// ErrorTimeoutMs property gets/sets the value as a long
+ ///
+ ///
+ ///
+ /// "properties": {
+ /// "errorTimeoutMs": 300000
+ /// }
+ ///
+ ///
+ [JsonProperty("errorTimeoutMs")]
+ public long ErrorTimeoutMs { get; set; }
+
+ ///
+ /// Example dictionary of objects
+ ///
+ ///
+ /// This is an example collection configuration object. This should be modified or deleted as needed for the plugin being built.
+ ///
+ ///
+ ///
+ /// "properties": {
+ /// "presets": {
+ /// "preset1": {
+ /// "enabled": true,
+ /// "name": "Preset 1"
+ /// }
+ /// }
+ /// }
+ ///
+ ///
+ ///
+ ///
+ /// "properties": {
+ /// "inputNames": {
+ /// "input1": "Input 1",
+ /// "input2": "Input 2"
+ /// }
+ /// }
+ ///
+ ///
+ [JsonProperty("DeviceDictionary")]
+ public Dictionary DeviceDictionary { get; set; }
+
+ ///
+ /// Constuctor
+ ///
+ ///
+ /// If using a collection you must instantiate the collection in the constructor
+ /// to avoid exceptions when reading the configuration file
+ ///
+ public EssentialsPluginConfigObjectTemplate()
+ {
+ DeviceDictionary = new Dictionary();
+ }
+ }
+
+ ///
+ /// Example plugin configuration dictionary object
+ ///
+ ///
+ /// This is an example collection of configuration objects. This can be modified or deleted as needed for the plugin being built.
+ ///
+ ///
+ ///
+ /// "properties": {
+ /// "dictionary": {
+ /// "item1": {
+ /// "name": "Item 1 Name",
+ /// "value": "Item 1 Value"
+ /// }
+ /// }
+ /// }
+ ///
+ ///
+ public class EssentialsPluginConfigObjectDictionaryTemplate
+ {
+ ///
+ /// Serializes collection name property
+ ///
+ ///
+ /// This is an example collection of configuration objects. This can be modified or deleted as needed for the plugin being built.
+ ///
+ [JsonProperty("name")]
+ public string Name { get; set; }
+
+ ///
+ /// Serializes collection value property
+ ///
+ ///
+ /// This is an example collection of configuration objects. This can be modified or deleted as needed for the plugin being built.
+ ///
+ [JsonProperty("value")]
+ public uint Value { get; set; }
}
}
\ No newline at end of file
diff --git a/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateDevice.cs b/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateDevice.cs
index dda96b2..649c7e6 100644
--- a/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateDevice.cs
+++ b/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateDevice.cs
@@ -1,67 +1,246 @@
-using Crestron.SimplSharpPro.DeviceSupport;
-using Newtonsoft.Json;
-using PDT.EssentialsPluginTemplate.EPI;
+// For Basic SIMPL# Classes
+// For Basic SIMPL#Pro classes
+
+using Crestron.SimplSharpPro.DeviceSupport;
+using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
-using PepperDash.Core;
-namespace EssentialsPluginTemplateEPI
+namespace EssentialsPluginTemplate
{
- ///
- /// Example of a plugin device
- ///
- public class EssentialsPluginTemplateDevice : EssentialsDevice, IBridgeAdvanced
- {
- ///
- /// Device Constructor. Called by BuildDevice
- ///
- ///
- ///
- ///
- public EssentialsPluginTemplateDevice(string key, string name, EssentialsPluginTemplatePropertiesConfig config)
- : base(key, name)
- {
-
- }
-
- ///
- /// Add items to be executed during the Activaction phase
- ///
- ///
- public override bool CustomActivate()
- {
-
- return base.CustomActivate();
- }
-
- ///
- /// This method gets called by the EiscApi bridge and calls your bridge extension method
- ///
- ///
- ///
- ///
- public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
- {
- // Construct the default join map
- var joinMap = new EssentialsPluginTemplateBridgeJoinMap(joinStart);
-
- // Attempt to get a custom join map if specified in config
- var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
-
- // If we find a custom join map, deserialize it
- if (!string.IsNullOrEmpty(joinMapSerialized))
- joinMap = JsonConvert.DeserializeObject(joinMapSerialized);
-
- //Checking if the bridge is null allows for backwards compatability with configurations that use EiscApi instead of EiscApiAdvanced
- if (bridge != null)
- {
- bridge.AddJoinMap(Key, joinMap);
- }
-
- // Set all your join actions here
-
-
- // Link all your feedbacks to joins here
- }
- }
-}
\ No newline at end of file
+ ///
+ /// Plugin device
+ ///
+ ///
+ /// Rename the class to match the device plugin being developed.
+ ///
+ ///
+ /// "EssentialsPluginDeviceTemplate" renamed to "SamsungMdcDevice"
+ ///
+ public class EssentialsPluginDeviceTemplate : EssentialsBridgeableDevice
+ {
+ // TODO [ ] Add, modify, remove properties and fields as needed for the plugin being developed
+ private readonly IBasicCommunication _comms;
+ private readonly GenericCommunicationMonitor _commsMonitor;
+
+ // _comms gather for ASCII based API's
+ // TODO [ ] If not using an ASCII based API, delete the properties below
+ private readonly CommunicationGather _commsGather;
+ private const string CommsDelimiter = "\r";
+
+ // _comms byte buffer for HEX/byte based API's
+ // TODO [ ] If not using an HEX/byte based API, delete the properties below
+ private byte[] _commsByteBuffer = { };
+
+
+ private EssentialsPluginConfigObjectTemplate _config;
+
+ ///
+ /// Connects/disconnects the comms of the plugin device
+ ///
+ ///
+ /// triggers the _comms.Connect/Disconnect as well as thee comms monitor start/stop
+ ///
+ public bool Connect
+ {
+ get { return _comms.IsConnected; }
+ set
+ {
+ if (value)
+ {
+ _comms.Connect();
+ _commsMonitor.Start();
+ }
+ else
+ {
+ _comms.Disconnect();
+ _commsMonitor.Stop();
+ }
+ }
+ }
+
+ ///
+ /// Reports connect feedback through the bridge
+ ///
+ public BoolFeedback ConnectFeedback { get; private set; }
+
+ ///
+ /// Reports online feedback through the bridge
+ ///
+ public BoolFeedback OnlineFeedback { get; private set; }
+
+ ///
+ /// Reports socket status feedback through the bridge
+ ///
+ public IntFeedback StatusFeedback { get; private set; }
+
+ ///
+ /// Plugin device constructor
+ ///
+ ///
+ ///
+ ///
+ ///
+ public EssentialsPluginDeviceTemplate(string key, string name, EssentialsPluginConfigObjectTemplate config, IBasicCommunication comms)
+ : base(key, name)
+ {
+ Debug.Console(0, this, "Constructing new {0} instance", name);
+
+ // TODO [ ] Update the constructor as needed for the plugin device being developed
+
+ _config = config;
+
+ ConnectFeedback = new BoolFeedback(() => Connect);
+ OnlineFeedback = new BoolFeedback(() => _commsMonitor.IsOnline);
+ StatusFeedback = new IntFeedback(() => (int)_commsMonitor.Status);
+
+ _comms = comms;
+ _commsMonitor = new GenericCommunicationMonitor(this, _comms, _config.PollTimeMs, _config.WarningTimeoutMs, _config.ErrorTimeoutMs, Poll);
+
+ var socket = _comms as ISocketStatus;
+ if (socket != null)
+ {
+ // device comms is IP **ELSE** device comms is RS232
+ socket.ConnectionChange += socket_ConnectionChange;
+ Connect = true;
+ }
+
+ // _comms gather for ASCII based API's
+ // TODO [ ] If not using an ASCII based API, delete the properties below
+ _commsGather = new CommunicationGather(_comms, CommsDelimiter);
+ AddPostActivationAction(() => _commsGather.LineReceived += Handle_LineRecieved);
+
+ // _comms byte buffer for HEX/byte based API's
+ // TODO [ ] If not using an HEX/byte based API, delete the properties below
+ _comms.BytesReceived += Handle_BytesReceived;
+ AddPostActivationAction(() => _comms.BytesReceived += Handle_BytesReceived);
+ }
+
+ #region Overrides of EssentialsBridgeableDevice
+
+ ///
+ /// Links the plugin device to the EISC bridge
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
+ {
+ var joinMap = new EssentialsPluginBridgeJoinMapTemplate(joinStart);
+
+ // This adds the join map to the collection on the bridge
+ if (bridge != null)
+ {
+ bridge.AddJoinMap(Key, joinMap);
+ }
+
+ var customJoins = JoinMapHelper.TryGetJoinMapAdvancedForDevice(joinMapKey);
+
+ if (customJoins != null)
+ {
+ joinMap.SetCustomJoinData(customJoins);
+ }
+
+ Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
+ Debug.Console(0, "Linking to Bridge Type {0}", GetType().Name);
+
+ // TODO [ ] Implement bridge links as needed
+
+ // links to bridge
+ trilist.SetString(joinMap.DeviceName.JoinNumber, Name);
+
+ trilist.SetBoolSigAction(joinMap.Connect.JoinNumber, sig => Connect = sig);
+ ConnectFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Connect.JoinNumber]);
+
+ StatusFeedback.LinkInputSig(trilist.UShortInput[joinMap.Status.JoinNumber]);
+ OnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
+
+ UpdateFeedbacks();
+
+ trilist.OnlineStatusChange += (o, a) =>
+ {
+ if (!a.DeviceOnLine) return;
+
+ trilist.SetString(joinMap.DeviceName.JoinNumber, Name);
+ UpdateFeedbacks();
+ };
+ }
+
+ private void UpdateFeedbacks()
+ {
+ // TODO [ ] Update as needed for the plugin being developed
+ ConnectFeedback.FireUpdate();
+ OnlineFeedback.FireUpdate();
+ StatusFeedback.FireUpdate();
+ }
+
+ #endregion
+
+ private void socket_ConnectionChange(object sender, GenericSocketStatusChageEventArgs args)
+ {
+ if (ConnectFeedback != null)
+ ConnectFeedback.FireUpdate();
+
+ if (StatusFeedback != null)
+ StatusFeedback.FireUpdate();
+ }
+
+ // TODO [ ] If not using an ASCII based API, delete the properties below
+ private void Handle_LineRecieved(object sender, GenericCommMethodReceiveTextArgs args)
+ {
+ // TODO [ ] Implement method
+ throw new System.NotImplementedException();
+ }
+
+ // TODO [ ] If not using an HEX/byte based API, delete the properties below
+ private void Handle_BytesReceived(object sender, GenericCommMethodReceiveBytesArgs args)
+ {
+ // TODO [ ] Implement method
+ throw new System.NotImplementedException();
+ }
+
+ // TODO [ ] If not using an ACII based API, delete the properties below
+ ///
+ /// Sends text to the device plugin comms
+ ///
+ ///
+ /// Can be used to test commands with the device plugin using the DEVPROPS and DEVJSON console commands
+ ///
+ /// Command to be sent
+ public void SendText(string text)
+ {
+ if (string.IsNullOrEmpty(text)) return;
+
+ _comms.SendText(string.Format("{0}{1}", text, CommsDelimiter));
+ }
+
+ // TODO [ ] If not using an HEX/byte based API, delete the properties below
+ ///
+ /// Sends bytes to the device plugin comms
+ ///
+ ///
+ /// Can be used to test commands with the device plugin using the DEVPROPS and DEVJSON console commands
+ ///
+ /// Bytes to be sent
+ public void SendBytes(byte[] bytes)
+ {
+ if (bytes == null) return;
+
+ _comms.SendBytes(bytes);
+ }
+
+ ///
+ /// Polls the device
+ ///
+ ///
+ /// Poll method is used by the communication monitor. Update the poll method as needed for the plugin being developed
+ ///
+ public void Poll()
+ {
+ // TODO [ ] Update Poll method as needed for the plugin being developed
+ throw new System.NotImplementedException();
+ }
+ }
+}
+
diff --git a/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateFactory.cs b/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateFactory.cs
index 79cfcf9..76e5baa 100644
--- a/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateFactory.cs
+++ b/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateFactory.cs
@@ -1,43 +1,92 @@
-using System;
-using System.Collections.Generic;
-using Crestron.SimplSharp; // For Basic SIMPL# Classes
-using Crestron.SimplSharpPro; // For Basic SIMPL#Pro classes
-
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-
-using PepperDash.Essentials;
-using PepperDash.Essentials.Core;
-using PepperDash.Essentials.Core.Config;
+using System.Collections.Generic;
using PepperDash.Core;
+using PepperDash.Essentials.Core;
-namespace EssentialsPluginTemplateEPI
+namespace EssentialsPluginTemplate
{
- ///
- /// This class contains the necessary properties and methods required to function as an Essentials Plugin
- ///
- public class EssentialsPluginFactory:EssentialsPluginDeviceFactory
+ ///
+ /// Plugin device factory
+ ///
+ ///
+ /// Rename the class to match the device plugin being developed
+ ///
+ ///
+ /// "EssentialsPluginFactoryTemplate" renamed to "SamsungMdcFactory"
+ ///
+ public class EssentialsPluginFactoryTemplate : EssentialsPluginDeviceFactory
{
- public EssentialsPluginFactory()
+ ///
+ /// Plugin device factory constructor
+ ///
+ ///
+ /// Update the MinimumEssentialsFrameworkVersion & TypeNames as needed when creating a plugin
+ ///
+ ///
+ ///
+ /// // Set the minimum Essentials Framework Version
+ /// MinimumEssentialsFrameworkVersion = "1.5.5";
+ /// // In the constructor we initialize the list with the typenames that will build an instance of this device
+#pragma warning disable 1570
+ /// TypeNames = new List() { "SamsungMdc", "SamsungMdcDisplay" };
+#pragma warning restore 1570
+ ///
+ ///
+ public EssentialsPluginFactoryTemplate()
{
- // This string is used to define the minimum version of the
- // Essentials Framework required for this plugin
- MinimumEssentialsFrameworkVersion = "1.6.1";
+ // Set the minimum Essentials Framework Version
+ // TODO [ ] Update the Essentials minimum framework version which this plugin has been tested against
+ MinimumEssentialsFrameworkVersion = "1.6.4";
- //The strings defined in this list will be used in the configuration file to build the device in this plugin.
- TypeNames = new List {"essentialsPluginTemplateDevice"};
+ // 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
+ TypeNames = new List() { "examplePluginDevice" };
}
+
+ ///
+ /// Builds and returns an instance of EssentialsPluginDeviceTemplate
+ ///
+ /// device configuration
+ /// plugin device or null
+ ///
+ /// The example provided below takes the device key, name, properties config and the comms device created.
+ /// Modify the EssetnialsPlugingDeviceTemplate constructor as needed to meet the requirements of the plugin device.
+ ///
+ ///
+ public override EssentialsDevice BuildDevice(PepperDash.Essentials.Core.Config.DeviceConfig dc)
+ {
+ Debug.Console(1, "[{0}] Factory Attempting to create new device from type: {1}", dc.Key, dc.Type);
- #region Overrides of EssentialsDeviceFactory
+ // get the plugin device properties configuration object & check for null
+ var propertiesConfig = dc.Properties.ToObject();
+ if (propertiesConfig == null)
+ {
+ Debug.Console(0, "[{0}] Factory: failed to read properties config for {1}", dc.Key, dc.Name);
+ return null;
+ }
- public override EssentialsDevice BuildDevice(DeviceConfig dc)
- {
- var config = dc.Properties.ToObject();
- var newDevice = new EssentialsPluginTemplateDevice(dc.Key, dc.Name, config);
- return newDevice;
+ // TODO [ ] Discuss with Andrew/Neil on recommended best practice
+
+ // Method 1
+ //var username = dc.Properties["control"].Value("tcpSshProperties").Username;
+ //var password = dc.Properties["control"].Value("tcpSshProperties").Password;
+ //var method = dc.Properties["control"].Value("method");
+
+ // Method 2 - Returns a JValue, has to be casted to string
+ var username = (string)dc.Properties["control"]["tcpSshProperties"]["username"];
+ var password = (string)dc.Properties["control"]["tcpSshProperties"]["password"];
+ var method = (string)dc.Properties["control"]["method"];
+
+ // build the plugin device comms & check for null
+ // TODO { ] As of PepperDash Core 1.0.41, HTTP and HTTPS are not valid eControlMethods and will throw an exception.
+ var comms = CommFactory.CreateCommForDevice(dc);
+ if (comms == null)
+ {
+ Debug.Console(0, "[{0}] Factory: failed to create comm for {1}", dc.Key, dc.Name);
+ return null;
+ }
+
+ return new EssentialsPluginDeviceTemplate(dc.Key, dc.Name, propertiesConfig, comms);
}
- #endregion
}
-}
-
+}
\ No newline at end of file
diff --git a/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateJoinMap.cs b/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateJoinMap.cs
deleted file mode 100644
index 4272a97..0000000
--- a/PDT.EssentialsPluginTemplate.EPI/EssentialsPluginTemplateJoinMap.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Crestron.SimplSharp;
-using PepperDash.Essentials.Core;
-
-namespace PDT.EssentialsPluginTemplate.EPI
-{
- public class EssentialsPluginTemplateBridgeJoinMap : JoinMapBaseAdvanced
- {
- [JoinName("IsOnline")]
- public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData {JoinNumber = 1, JoinSpan = 1},
- new JoinMetadata
- {
- Description = "Device is Online",
- JoinType = eJoinType.Digital,
- JoinCapabilities = eJoinCapabilities.ToSIMPL
- });
-
-
- public EssentialsPluginTemplateBridgeJoinMap(uint joinStart):base(joinStart, typeof(EssentialsPluginTemplateBridgeJoinMap))
- {
-
- }
- }
-}
\ No newline at end of file
diff --git a/PDT.EssentialsPluginTemplate.EPI/PDT.EssentialsPluginTemplate.EPI.csproj b/PDT.EssentialsPluginTemplate.EPI/PDT.EssentialsPluginTemplate.EPI.csproj
index dda70b0..6517361 100644
--- a/PDT.EssentialsPluginTemplate.EPI/PDT.EssentialsPluginTemplate.EPI.csproj
+++ b/PDT.EssentialsPluginTemplate.EPI/PDT.EssentialsPluginTemplate.EPI.csproj
@@ -95,9 +95,9 @@
+
-
diff --git a/README.md b/README.md
index f299a15..9447de4 100644
--- a/README.md
+++ b/README.md
@@ -28,4 +28,6 @@ If you need a different version of PepperDash Core, use the command `nuget insta
### Instructions for Renaming Solution and Files
-See the Task List in Visual Studio to help identify what needs to be renamed. There is extensive inline documentation adn examples as well.
+See the Task List in Visual Studio for a guide on how to start using the templage. There is extensive inline documentation and examples as well.
+
+For renaming instructions in particular, see the XML `remarks` tags on class definitions
diff --git a/packages.config b/packages.config
index 4ed0ac7..fa05b32 100644
--- a/packages.config
+++ b/packages.config
@@ -1,3 +1,3 @@
-
+
\ No newline at end of file