diff --git a/src/CommunicationExtras.cs b/src/CommunicationExtras.cs
index e780efd..9db5420 100644
--- a/src/CommunicationExtras.cs
+++ b/src/CommunicationExtras.cs
@@ -5,6 +5,7 @@ using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronSockets;
using System.Text.RegularExpressions;
+using Newtonsoft.Json;
namespace PepperDash.Core
{
@@ -25,6 +26,7 @@ namespace PepperDash.Core
///
/// Indicates connection status
///
+ [JsonProperty("isConnected")]
bool IsConnected { get; }
///
/// Connect to the device
@@ -70,6 +72,7 @@ namespace PepperDash.Core
///
/// Object to enable stream debugging
///
+ [JsonProperty("streamDebugging")]
CommunicationStreamDebugging StreamDebugging { get; }
}
@@ -87,7 +90,9 @@ namespace PepperDash.Core
///
/// The current socket status of the client
///
- SocketStatus ClientStatus { get; }
+ [JsonProperty("clinetStatus")]
+ [JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
+ SocketStatus ClientStatus { get; }
}
///
@@ -106,10 +111,12 @@ namespace PepperDash.Core
///
/// Enable automatic recconnect
///
+ [JsonProperty("autoReconnect")]
bool AutoReconnect { get; set; }
///
/// Interval in ms to attempt automatic recconnections
///
+ [JsonProperty("autoReconnectIntervalMs")]
int AutoReconnectIntervalMs { get; set; }
}
diff --git a/src/CoreInterfaces.cs b/src/CoreInterfaces.cs
index c1432c2..6e0b639 100644
--- a/src/CoreInterfaces.cs
+++ b/src/CoreInterfaces.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
+using Newtonsoft.Json;
using Serilog;
namespace PepperDash.Core
@@ -15,6 +16,7 @@ namespace PepperDash.Core
///
/// Unique Key
///
+ [JsonProperty("key")]
string Key { get; }
}
@@ -26,6 +28,7 @@ namespace PepperDash.Core
///
/// Isn't it obvious :)
///
+ [JsonProperty("name")]
string Name { get; }
}
diff --git a/src/Device.cs b/src/Device.cs
index 749713e..fda30c4 100644
--- a/src/Device.cs
+++ b/src/Device.cs
@@ -99,7 +99,15 @@ namespace PepperDash.Core
public void PreActivate()
{
if (_PreActivationActions != null)
- _PreActivationActions.ForEach(a => a.Invoke());
+ _PreActivationActions.ForEach(a => {
+ try
+ {
+ a.Invoke();
+ } catch (Exception e)
+ {
+ Debug.LogMessage(e, "Error in PreActivationAction: " + e.Message, this);
+ }
+ });
}
///
@@ -123,7 +131,16 @@ namespace PepperDash.Core
public void PostActivate()
{
if (_PostActivationActions != null)
- _PostActivationActions.ForEach(a => a.Invoke());
+ _PostActivationActions.ForEach(a => {
+ try
+ {
+ a.Invoke();
+ }
+ catch (Exception e)
+ {
+ Debug.LogMessage(e, "Error in PostActivationAction: " + e.Message, this);
+ }
+ });
}
///
diff --git a/src/PepperDash.Core.4Series.csproj b/src/PepperDash.Core.4Series.csproj
index cd93167..1433862 100644
--- a/src/PepperDash.Core.4Series.csproj
+++ b/src/PepperDash.Core.4Series.csproj
@@ -24,6 +24,14 @@
pdbonly
bin\4Series\$(Configuration)\PepperDashCore.xml
+
+
+
+
+
+
+
+