Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/PepperDash.Essentials.Core/Routing/RoutingInputPort.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Newtonsoft.Json;
using System;


namespace PepperDash.Essentials.Core
Expand All @@ -8,10 +9,11 @@ namespace PepperDash.Essentials.Core
/// </summary>
public class RoutingInputPort : RoutingPort
{
/// <summary>
/// The IRoutingInputs object this lives on
/// </summary>
public IRoutingInputs ParentDevice { get; private set; }
/// <summary>
/// The IRoutingInputs object this lives on
/// </summary>
[JsonIgnore]
public IRoutingInputs ParentDevice { get; private set; }

/// <summary>
/// Constructor for a basic RoutingInputPort
Expand Down
15 changes: 9 additions & 6 deletions src/PepperDash.Essentials.Core/Routing/RoutingOutputPort.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
using System;
using Newtonsoft.Json;
using System;


namespace PepperDash.Essentials.Core
{
public class RoutingOutputPort : RoutingPort
{
/// <summary>
/// The IRoutingOutputs object this port lives on
/// </summary>
public IRoutingOutputs ParentDevice { get; private set; }
{
/// <summary>
/// The IRoutingOutputs object this port lives on
/// </summary>
///
[JsonIgnore]
public IRoutingOutputs ParentDevice { get; private set; }

public InUseTracking InUseTracker { get; private set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
using System.Collections.Generic;
using System.Linq;

using PepperDash.Core;


namespace PepperDash.Essentials.Core
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public abstract class CameraBase : ReconfigurableDevice, IRoutingOutputs

#region IRoutingOutputs Members

[JsonIgnore]
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; protected set; }

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private void SavePresets(List<PresetChannel> presets)
protected override void RegisterActions()

{
AddAction("/presets/fullStatus", (id, content) =>
AddAction("/fullStatus", (id, content) =>
{
this.LogInformation("getting full status for client {id}", id);
try
Expand All @@ -56,7 +56,7 @@ protected override void RegisterActions()
}
});

AddAction("/presets/recall", (id, content) =>
AddAction("/recall", (id, content) =>
{
var p = content.ToObject<PresetChannelMessage>();

Expand All @@ -70,7 +70,7 @@ protected override void RegisterActions()
RecallPreset(dev, p.Preset.Channel);
});

AddAction("/presets/save", (id, content) =>
AddAction("/save", (id, content) =>
{
var presets = content.ToObject<List<PresetChannel>>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Core.Logging;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
using System;
using System.Collections.Generic;

namespace PepperDash.Essentials.AppServer.Messengers
{
Expand Down Expand Up @@ -56,10 +59,32 @@ protected override void RegisterActions()

private void SendFullStatus()
{
var stateObject = new JObject();
stateObject[_propName] = JToken.FromObject(itemDevice, serializer);
PostStatusMessage(stateObject);
try
{
this.LogInformation("Sending full status");

var stateObject = new ISelectableItemsStateMessage<TKey>
{
Items = itemDevice.Items,
CurrentItem = itemDevice.CurrentItem
};

PostStatusMessage(stateObject);
}
catch (Exception e)
{
this.LogError("Error sending full status: {0}", e.Message);
}
}
}

public class ISelectableItemsStateMessage<TKey> : DeviceStateMessageBase
{
[JsonProperty("items")]
public Dictionary<TKey, ISelectableItem> Items { get; set; }

[JsonProperty("currentItem")]
public TKey CurrentItem { get; set; }
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Core.Logging;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
using System;
Expand Down Expand Up @@ -152,11 +153,13 @@ protected void PostStatusMessage(DeviceStateMessageBase message, string clientId

message.Name = _device.Name;

PostStatusMessage(JToken.FromObject(message), MessagePath, clientId);
var token = JToken.FromObject(message);

PostStatusMessage(token, MessagePath, clientId);
}
catch (Exception ex)
{
Debug.LogMessage(ex, "Exception posting status message", this);
this.LogError(ex, "Exception posting status message for {messagePath} to {clientId}", MessagePath, clientId ?? "all clients");
}
}

Expand All @@ -173,11 +176,13 @@ protected void PostStatusMessage(string type, DeviceStateMessageBase deviceState

deviceState.MessageBasePath = MessagePath;

PostStatusMessage(JToken.FromObject(deviceState), type, clientId);
var token = JToken.FromObject(deviceState);

PostStatusMessage(token, type, clientId);
}
catch (Exception ex)
{
Debug.LogMessage(ex, "Exception posting status message", this);
this.LogError(ex, "Exception posting status message for {type} to {clientId}", type, clientId ?? "all clients");
}
}

Expand Down
Loading