mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-09 01:35:02 +00:00
feat: unique status requests for messengers
UI Applications can now request status for specific feature sets instead of full status for a device. This will hopefully cut down on the traffic and messages required to get the data for the UI.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Essentials.Devices.Common.AudioCodec;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
@@ -29,12 +29,16 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
codec.CallStatusChange += Codec_CallStatusChange;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
AddAction("/fullStatus", (id, content) => SendAtcFullMessageObject());
|
||||
AddAction("/fullStatus", (id, content) => SendAtcFullMessageObject(id));
|
||||
|
||||
AddAction("/audioDialerStatus", (id, content) => SendAtcFullMessageObject(id));
|
||||
|
||||
AddAction("/dial", (id, content) =>
|
||||
{
|
||||
var msg = content.ToObject<MobileControlSimpleContent<string>>();
|
||||
@@ -97,7 +101,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// Helper method to build call status for vtc
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private void SendAtcFullMessageObject()
|
||||
private void SendAtcFullMessageObject(string id = null)
|
||||
{
|
||||
var info = Codec.CodecInfo;
|
||||
|
||||
@@ -109,7 +113,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
phoneNumber = info.PhoneNumber
|
||||
}
|
||||
})
|
||||
}), id
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
AddAction("/fullStatus", (id, content) => SendCameraFullMessageObject());
|
||||
AddAction("/fullStatus", (id, content) => SendCameraFullMessageObject(id));
|
||||
|
||||
AddAction("/cameraStatus", (id, content) => SendCameraFullMessageObject(id));
|
||||
|
||||
|
||||
if (Camera is IHasCameraPtzControl ptzCamera)
|
||||
@@ -173,7 +175,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// <summary>
|
||||
/// Helper method to update the full status of the camera
|
||||
/// </summary>
|
||||
private void SendCameraFullMessageObject()
|
||||
private void SendCameraFullMessageObject(string id = null)
|
||||
{
|
||||
var presetList = new List<CameraPreset>();
|
||||
|
||||
@@ -188,7 +190,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
cameraMode = GetCameraMode(),
|
||||
hasPresets = Camera is IHasCameraPresets,
|
||||
presets = presetList
|
||||
})
|
||||
}), id
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,16 +33,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
AddAction("/fullStatus", (id, content) =>
|
||||
{
|
||||
var message = new CurrentSourcesStateMessage
|
||||
{
|
||||
CurrentSourceKeys = sourceDevice.CurrentSourceKeys,
|
||||
CurrentSources = sourceDevice.CurrentSources
|
||||
};
|
||||
AddAction("/fullStatus", (id, content) => SendCurrentSourceStatus(id));
|
||||
|
||||
PostStatusMessage(message);
|
||||
});
|
||||
AddAction("/currentSourceStatus", (id, content) => SendCurrentSourceStatus(id));
|
||||
|
||||
sourceDevice.CurrentSourcesChanged += (sender, e) =>
|
||||
{
|
||||
@@ -53,6 +46,17 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}));
|
||||
};
|
||||
}
|
||||
|
||||
private void SendCurrentSourceStatus(string id = null)
|
||||
{
|
||||
var message = new CurrentSourcesStateMessage
|
||||
{
|
||||
CurrentSourceKeys = sourceDevice.CurrentSourceKeys,
|
||||
CurrentSources = sourceDevice.CurrentSources
|
||||
};
|
||||
|
||||
PostStatusMessage(message, id);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Timers;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.DeviceInfo;
|
||||
using System.Timers;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
@@ -67,13 +67,20 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
debounceTimer.Start();
|
||||
};
|
||||
|
||||
AddAction("/fullStatus", (id, context) => PostStatusMessage(new DeviceInfoStateMessage
|
||||
{
|
||||
DeviceInfo = _deviceInfoProvider.DeviceInfo
|
||||
}));
|
||||
AddAction("/fullStatus", (id, context) => SendFullStatus(id));
|
||||
|
||||
AddAction("/deviceInfo", (id, content) => SendFullStatus(id));
|
||||
|
||||
AddAction("/update", (id, context) => _deviceInfoProvider.UpdateDeviceInfo());
|
||||
}
|
||||
|
||||
private void SendFullStatus(string id = null)
|
||||
{
|
||||
PostStatusMessage(new DeviceInfoStateMessage
|
||||
{
|
||||
DeviceInfo = _deviceInfoProvider.DeviceInfo
|
||||
}, id);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Core.Logging;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using PepperDash.Essentials.Core.Presets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
@@ -16,18 +16,24 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
private readonly ITvPresetsProvider _presetsDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for DevicePresetsModelMessenger
|
||||
/// </summary>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <param name="messagePath">The message path.</param>
|
||||
/// <param name="presetsDevice">The presets device.</param>
|
||||
public DevicePresetsModelMessenger(string key, string messagePath, ITvPresetsProvider presetsDevice)
|
||||
: base(key, messagePath, presetsDevice as Device)
|
||||
{
|
||||
_presetsDevice = presetsDevice;
|
||||
}
|
||||
|
||||
private void SendPresets()
|
||||
private void SendPresets(string id = null)
|
||||
{
|
||||
PostStatusMessage(new PresetStateMessage
|
||||
{
|
||||
Favorites = _presetsDevice.TvPresets.PresetsList
|
||||
});
|
||||
}, id);
|
||||
}
|
||||
|
||||
private void RecallPreset(ISetTopBoxNumericKeypad device, string channel)
|
||||
@@ -43,6 +49,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
|
||||
#region Overrides of MessengerBase
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
|
||||
{
|
||||
@@ -51,7 +58,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
this.LogInformation("getting full status for client {id}", id);
|
||||
try
|
||||
{
|
||||
SendPresets();
|
||||
SendPresets(id);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -59,6 +66,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
});
|
||||
|
||||
AddAction("/presetsStatus", (id, content) => SendPresets(id));
|
||||
|
||||
AddAction("/recall", (id, content) =>
|
||||
{
|
||||
var p = content.ToObject<PresetChannelMessage>();
|
||||
@@ -91,16 +100,16 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// </summary>
|
||||
public class PresetChannelMessage
|
||||
{
|
||||
[JsonProperty("preset")]
|
||||
/// <summary>
|
||||
/// Gets or sets the Preset
|
||||
/// </summary>
|
||||
[JsonProperty("preset")]
|
||||
public PresetChannel Preset;
|
||||
|
||||
[JsonProperty("deviceKey")]
|
||||
/// <summary>
|
||||
/// Gets or sets the DeviceKey
|
||||
/// </summary>
|
||||
[JsonProperty("deviceKey")]
|
||||
public string DeviceKey;
|
||||
}
|
||||
|
||||
@@ -109,10 +118,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// </summary>
|
||||
public class PresetStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
[JsonProperty("favorites", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Favorites
|
||||
/// </summary>
|
||||
[JsonProperty("favorites", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public List<PresetChannel> Favorites { get; set; } = new List<PresetChannel>();
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
@@ -14,13 +14,19 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
private readonly IBasicVolumeWithFeedback _localDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DeviceVolumeMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <param name="messagePath">The message path.</param>
|
||||
/// <param name="device">The device.</param>
|
||||
public DeviceVolumeMessenger(string key, string messagePath, IBasicVolumeWithFeedback device)
|
||||
: base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
_localDevice = device;
|
||||
}
|
||||
|
||||
private void SendStatus()
|
||||
private void SendStatus(string id = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -40,7 +46,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
messageObj.Volume.Units = volumeAdvanced.Units;
|
||||
}
|
||||
|
||||
PostStatusMessage(messageObj);
|
||||
PostStatusMessage(messageObj, id);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -50,10 +56,12 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
|
||||
#region Overrides of MessengerBase
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
AddAction("/fullStatus", (id, content) => SendStatus());
|
||||
AddAction("/fullStatus", (id, content) => SendStatus(id));
|
||||
|
||||
AddAction("/volumeStatus", (id, content) => SendStatus(id));
|
||||
|
||||
AddAction("/level", (id, content) =>
|
||||
{
|
||||
|
||||
@@ -7,22 +7,29 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// </summary>
|
||||
public class GenericMessenger : MessengerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GenericMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <param name="device">The device.</param>
|
||||
/// <param name="messagePath">The message path.</param>
|
||||
public GenericMessenger(string key, EssentialsDevice device, string messagePath) : base(key, messagePath, device)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatus());
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||
}
|
||||
|
||||
private void SendFullStatus()
|
||||
private void SendFullStatus(string id = null)
|
||||
{
|
||||
var state = new DeviceStateMessageBase();
|
||||
|
||||
PostStatusMessage(state);
|
||||
PostStatusMessage(state, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
@@ -13,6 +13,12 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
private readonly IBasicVideoMuteWithFeedback device;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="IBasicVideoMuteWithFeedbackMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
/// <param name="device"></param>
|
||||
public IBasicVideoMuteWithFeedbackMessenger(string key, string messagePath, IBasicVideoMuteWithFeedback device)
|
||||
: base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
@@ -22,21 +28,24 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// <summary>
|
||||
/// SendFullStatus method
|
||||
/// </summary>
|
||||
public void SendFullStatus()
|
||||
public void SendFullStatus(string id = null)
|
||||
{
|
||||
var messageObj = new IBasicVideoMuteWithFeedbackMessage
|
||||
{
|
||||
VideoMuteState = device.VideoMuteIsOn.BoolValue
|
||||
};
|
||||
|
||||
PostStatusMessage(messageObj);
|
||||
PostStatusMessage(messageObj, id);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatus());
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
AddAction("/videoMuteStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
AddAction("/videoMuteToggle", (id, content) =>
|
||||
{
|
||||
|
||||
@@ -24,14 +24,12 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
|
||||
AddAction("/fullStatus", (id, content) =>
|
||||
{
|
||||
PostStatusMessage(new CommunicationMonitorState
|
||||
{
|
||||
CommunicationMonitor = new CommunicationMonitorProps
|
||||
{
|
||||
IsOnline = _communicationMonitor.CommunicationMonitor.IsOnline,
|
||||
Status = _communicationMonitor.CommunicationMonitor.Status
|
||||
}
|
||||
});
|
||||
SendFullStatus(id);
|
||||
});
|
||||
|
||||
AddAction("/commStatus", (id, content) =>
|
||||
{
|
||||
SendFullStatus(id);
|
||||
});
|
||||
|
||||
_communicationMonitor.CommunicationMonitor.StatusChange += (sender, args) =>
|
||||
@@ -46,6 +44,18 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}));
|
||||
};
|
||||
}
|
||||
|
||||
private void SendFullStatus(string id = null)
|
||||
{
|
||||
PostStatusMessage(new CommunicationMonitorState
|
||||
{
|
||||
CommunicationMonitor = new CommunicationMonitorProps
|
||||
{
|
||||
IsOnline = _communicationMonitor.CommunicationMonitor.IsOnline,
|
||||
Status = _communicationMonitor.CommunicationMonitor.Status
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
@@ -22,15 +22,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
AddAction("/fullStatus", (id, content) =>
|
||||
{
|
||||
var message = new IHasDspPresetsStateMessage
|
||||
{
|
||||
Presets = device.Presets
|
||||
};
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
PostStatusMessage(message);
|
||||
});
|
||||
AddAction("/dspPresetStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
AddAction("/recallPreset", (id, content) =>
|
||||
{
|
||||
@@ -43,6 +37,16 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void SendFullStatus(string id = null)
|
||||
{
|
||||
var message = new IHasDspPresetsStateMessage
|
||||
{
|
||||
Presets = device.Presets
|
||||
};
|
||||
|
||||
PostStatusMessage(message, id);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Core.Logging;
|
||||
using PepperDash.Essentials.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
@@ -46,7 +46,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// partition states.</remarks>
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatus());
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
AddAction("/combinerStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
AddAction("/setAutoMode", (id, content) =>
|
||||
{
|
||||
@@ -120,7 +122,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
}
|
||||
|
||||
private void SendFullStatus()
|
||||
private void SendFullStatus(string id = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -141,7 +143,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
Partitions = _roomCombiner.Partitions
|
||||
};
|
||||
|
||||
PostStatusMessage(message);
|
||||
PostStatusMessage(message, id);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Essentials.Devices.Common.Cameras;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Essentials.Devices.Common.Cameras;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
@@ -26,7 +26,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// <param name="cameraController"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
public IHasCamerasMessenger(string key, string messagePath , IHasCameras cameraController)
|
||||
public IHasCamerasMessenger(string key, string messagePath, IHasCameras cameraController)
|
||||
: base(key, messagePath, cameraController)
|
||||
{
|
||||
CameraController = cameraController ?? throw new ArgumentNullException("cameraController");
|
||||
@@ -49,10 +49,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
AddAction("/fullStatus", (id, context) =>
|
||||
{
|
||||
SendFullStatus(id);
|
||||
});
|
||||
AddAction("/fullStatus", (id, context) => SendFullStatus(id));
|
||||
|
||||
AddAction("/cameraListStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
AddAction("/selectCamera", (id, content) =>
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
public class IHasCurrentSourceInfoMessenger : MessengerBase
|
||||
{
|
||||
private readonly IHasCurrentSourceInfoChange sourceDevice;
|
||||
|
||||
public IHasCurrentSourceInfoMessenger(string key, string messagePath, IHasCurrentSourceInfoChange device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
sourceDevice = device;
|
||||
@@ -20,16 +21,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
AddAction("/fullStatus", (id, content) =>
|
||||
{
|
||||
var message = new CurrentSourceStateMessage
|
||||
{
|
||||
CurrentSourceKey = sourceDevice.CurrentSourceInfoKey,
|
||||
CurrentSource = sourceDevice.CurrentSourceInfo
|
||||
};
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
PostStatusMessage(message);
|
||||
});
|
||||
AddAction("/currentSourceInfoStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
sourceDevice.CurrentSourceChange += (sender, e) =>
|
||||
{
|
||||
@@ -47,6 +41,17 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void SendFullStatus(string id = null)
|
||||
{
|
||||
var message = new CurrentSourceStateMessage
|
||||
{
|
||||
CurrentSourceKey = sourceDevice.CurrentSourceInfoKey,
|
||||
CurrentSource = sourceDevice.CurrentSourceInfo
|
||||
};
|
||||
|
||||
PostStatusMessage(message, id);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Core.Logging;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
@@ -11,8 +11,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// Represents a IHasInputsMessenger
|
||||
/// </summary>
|
||||
public class IHasInputsMessenger<TKey> : MessengerBase
|
||||
{
|
||||
private readonly IHasInputs<TKey> itemDevice;
|
||||
{
|
||||
private readonly IHasInputs<TKey> itemDevice;
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -23,17 +23,16 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// <param name="device"></param>
|
||||
public IHasInputsMessenger(string key, string messagePath, IHasInputs<TKey> device) : base(key, messagePath, device)
|
||||
{
|
||||
itemDevice = device;
|
||||
itemDevice = device;
|
||||
}
|
||||
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
AddAction("/fullStatus", (id, context) =>
|
||||
{
|
||||
SendFullStatus();
|
||||
});
|
||||
AddAction("/fullStatus", (id, context) => SendFullStatus(id));
|
||||
|
||||
AddAction("/inputStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
itemDevice.Inputs.ItemsUpdated += (sender, args) =>
|
||||
{
|
||||
@@ -62,7 +61,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
}
|
||||
|
||||
private void SendFullStatus()
|
||||
private void SendFullStatus(string id = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -77,7 +76,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
};
|
||||
|
||||
PostStatusMessage(stateObject);
|
||||
PostStatusMessage(stateObject, id);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -12,6 +12,12 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
private readonly IHasPowerControlWithFeedback _powerControl;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="IHasPowerControlWithFeedbackMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <param name="messagePath">The message path.</param>
|
||||
/// <param name="powerControl">The power control device</param>
|
||||
public IHasPowerControlWithFeedbackMessenger(string key, string messagePath, IHasPowerControlWithFeedback powerControl)
|
||||
: base(key, messagePath, powerControl as IKeyName)
|
||||
{
|
||||
@@ -21,7 +27,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// <summary>
|
||||
/// SendFullStatus method
|
||||
/// </summary>
|
||||
public void SendFullStatus()
|
||||
public void SendFullStatus(string id = null)
|
||||
{
|
||||
var messageObj = new PowerControlWithFeedbackStateMessage
|
||||
{
|
||||
@@ -31,11 +37,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
PostStatusMessage(messageObj);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatus());
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
AddAction("/powerStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
_powerControl.PowerIsOnFeedback.OutputChange += PowerIsOnFeedback_OutputChange; ;
|
||||
}
|
||||
@@ -55,6 +64,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// </summary>
|
||||
public class PowerControlWithFeedbackStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Power State
|
||||
/// </summary>
|
||||
[JsonProperty("powerState", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? PowerState { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
@@ -27,7 +27,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
AddAction("/schedule/fullStatus", (id, content) => SendFullScheduleObject());
|
||||
AddAction("/schedule/fullStatus", (id, content) => SendFullScheduleObject(id));
|
||||
|
||||
AddAction("/schedule/status", (id, content) => SendFullScheduleObject(id));
|
||||
}
|
||||
|
||||
private void CodecSchedule_MeetingEventChange(object sender, MeetingEventArgs e)
|
||||
@@ -51,13 +53,13 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// <summary>
|
||||
/// Helper method to send the full schedule data
|
||||
/// </summary>
|
||||
private void SendFullScheduleObject()
|
||||
private void SendFullScheduleObject(string id = null)
|
||||
{
|
||||
PostStatusMessage(new FullScheduleMessage
|
||||
{
|
||||
Meetings = ScheduleSource.CodecSchedule.Meetings,
|
||||
MeetingWarningMinutes = ScheduleSource.CodecSchedule.MeetingWarningMinutes
|
||||
});
|
||||
}, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,16 +68,18 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// </summary>
|
||||
public class FullScheduleMessage : DeviceStateMessageBase
|
||||
{
|
||||
[JsonProperty("meetings", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Meetings
|
||||
/// </summary>
|
||||
[JsonProperty("meetings", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public List<Meeting> Meetings { get; set; }
|
||||
|
||||
[JsonProperty("meetingWarningMinutes", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the MeetingWarningMinutes
|
||||
/// </summary>
|
||||
[JsonProperty("meetingWarningMinutes", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public int MeetingWarningMinutes { get; set; }
|
||||
}
|
||||
|
||||
@@ -84,10 +88,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// </summary>
|
||||
public class MeetingChangeMessage
|
||||
{
|
||||
[JsonProperty("meetingChange", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the MeetingChange
|
||||
/// </summary>
|
||||
[JsonProperty("meetingChange", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public MeetingChange MeetingChange { get; set; }
|
||||
}
|
||||
|
||||
@@ -96,16 +101,18 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// </summary>
|
||||
public class MeetingChange
|
||||
{
|
||||
[JsonProperty("changeType", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ChangeType
|
||||
/// </summary>
|
||||
[JsonProperty("changeType", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string ChangeType { get; set; }
|
||||
|
||||
[JsonProperty("meeting", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Meeting
|
||||
/// </summary>
|
||||
[JsonProperty("meeting", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public Meeting Meeting { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
@@ -22,19 +22,21 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatus());
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
AddAction("/humidityStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
device.HumidityFeedback.OutputChange += new EventHandler<Core.FeedbackEventArgs>((o, a) => SendFullStatus());
|
||||
}
|
||||
|
||||
private void SendFullStatus()
|
||||
private void SendFullStatus(string id = null)
|
||||
{
|
||||
var state = new IHumiditySensorStateMessage
|
||||
{
|
||||
Humidity = string.Format("{0}%", device.HumidityFeedback.UShortValue)
|
||||
};
|
||||
|
||||
PostStatusMessage(state);
|
||||
PostStatusMessage(state, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,10 +45,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// </summary>
|
||||
public class IHumiditySensorStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
[JsonProperty("humidity")]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Humidity
|
||||
/// </summary>
|
||||
[JsonProperty("humidity")]
|
||||
public string Humidity { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
@@ -13,6 +13,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
public class ILevelControlsMessenger : MessengerBase
|
||||
{
|
||||
private ILevelControls levelControlsDevice;
|
||||
|
||||
public ILevelControlsMessenger(string key, string messagePath, ILevelControls device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
levelControlsDevice = device;
|
||||
@@ -22,15 +23,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
AddAction("/fullStatus", (id, context) =>
|
||||
{
|
||||
var message = new LevelControlStateMessage
|
||||
{
|
||||
Levels = levelControlsDevice.LevelControlPoints.ToDictionary(kv => kv.Key, kv => new Volume { Level = kv.Value.VolumeLevelFeedback.IntValue, Muted = kv.Value.MuteFeedback.BoolValue })
|
||||
};
|
||||
AddAction("/fullStatus", (id, context) => SendFullStatus(id));
|
||||
|
||||
PostStatusMessage(message);
|
||||
});
|
||||
AddAction("/levelStats", (id, content) => SendFullStatus(id));
|
||||
|
||||
foreach (var levelControl in levelControlsDevice.LevelControlPoints)
|
||||
{
|
||||
@@ -75,6 +70,16 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
private void SendFullStatus(string id = null)
|
||||
{
|
||||
var message = new LevelControlStateMessage
|
||||
{
|
||||
Levels = levelControlsDevice.LevelControlPoints.ToDictionary(kv => kv.Key, kv => new Volume { Level = kv.Value.VolumeLevelFeedback.IntValue, Muted = kv.Value.MuteFeedback.BoolValue })
|
||||
};
|
||||
|
||||
PostStatusMessage(message, id);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
using Serilog.Events;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
@@ -25,25 +25,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
AddAction("/fullStatus", (id, content) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Verbose, "InputCount: {inputCount}, OutputCount: {outputCount}", this, matrixDevice.InputSlots.Count, matrixDevice.OutputSlots.Count);
|
||||
var message = new MatrixStateMessage
|
||||
{
|
||||
Outputs = matrixDevice.OutputSlots.ToDictionary(kvp => kvp.Key, kvp => new RoutingOutput(kvp.Value)),
|
||||
Inputs = matrixDevice.InputSlots.ToDictionary(kvp => kvp.Key, kvp => new RoutingInput(kvp.Value)),
|
||||
};
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
|
||||
PostStatusMessage(message);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogMessage(e, "Exception Getting full status: {@exception}", this, e);
|
||||
}
|
||||
});
|
||||
AddAction("/matrixStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
AddAction("/route", (id, content) =>
|
||||
{
|
||||
@@ -80,6 +64,26 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private void SendFullStatus(string id = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Verbose, "InputCount: {inputCount}, OutputCount: {outputCount}", this, matrixDevice.InputSlots.Count, matrixDevice.OutputSlots.Count);
|
||||
var message = new MatrixStateMessage
|
||||
{
|
||||
Outputs = matrixDevice.OutputSlots.ToDictionary(kvp => kvp.Key, kvp => new RoutingOutput(kvp.Value)),
|
||||
Inputs = matrixDevice.InputSlots.ToDictionary(kvp => kvp.Key, kvp => new RoutingInput(kvp.Value)),
|
||||
};
|
||||
|
||||
|
||||
PostStatusMessage(message, id);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogMessage(e, "Exception Getting full status: {@exception}", this, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
@@ -14,17 +14,28 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
private readonly IProjectorScreenLiftControl device;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="IProjectorScreenLiftControlMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key">message key</param>
|
||||
/// <param name="messagePath">message path</param>
|
||||
/// <param name="screenLiftDevice">screen lift device</param>
|
||||
public IProjectorScreenLiftControlMessenger(string key, string messagePath, IProjectorScreenLiftControl screenLiftDevice)
|
||||
: base(key, messagePath, screenLiftDevice as IKeyName)
|
||||
{
|
||||
device = screenLiftDevice;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers the actions for the messenger.
|
||||
/// </summary>
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatus());
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
AddAction("/screenliftStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
AddAction("/raise", (id, content) =>
|
||||
{
|
||||
@@ -53,7 +64,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
PostStatusMessage(JToken.FromObject(state));
|
||||
}
|
||||
|
||||
private void SendFullStatus()
|
||||
private void SendFullStatus(string id = null)
|
||||
{
|
||||
var state = new ScreenLiftStateMessage
|
||||
{
|
||||
@@ -62,7 +73,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
DisplayDeviceKey = device.DisplayDeviceKey
|
||||
};
|
||||
|
||||
PostStatusMessage(state);
|
||||
PostStatusMessage(state, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,20 +82,23 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// </summary>
|
||||
public class ScreenLiftStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the InUpPosition
|
||||
/// </summary>
|
||||
[JsonProperty("inUpPosition", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? InUpPosition { get; set; }
|
||||
|
||||
[JsonProperty("displayDeviceKey", NullValueHandling = NullValueHandling.Ignore)]
|
||||
/// <summary>
|
||||
/// Gets or sets the DisplayDeviceKey
|
||||
/// </summary>
|
||||
[JsonProperty("displayDeviceKey", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string DisplayDeviceKey { get; set; }
|
||||
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
[JsonProperty("type", NullValueHandling = NullValueHandling.Ignore)]
|
||||
/// <summary>
|
||||
/// Gets or sets the Type
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
[JsonProperty("type", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public eScreenLiftControlType Type { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Core.Logging;
|
||||
using PepperDash.Essentials.Core;
|
||||
using System;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
@@ -36,7 +36,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
AddAction("/fullStatus", (id, content) => SendRoutingFullMessageObject());
|
||||
AddAction("/fullStatus", (id, content) => SendRoutingFullMessageObject(id));
|
||||
|
||||
AddAction("/routingStatus", (id, content) => SendRoutingFullMessageObject(id));
|
||||
|
||||
AddAction("/source", (id, content) =>
|
||||
{
|
||||
@@ -62,7 +64,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// <summary>
|
||||
/// Helper method to update full status of the routing device
|
||||
/// </summary>
|
||||
private void SendRoutingFullMessageObject()
|
||||
private void SendRoutingFullMessageObject(string id = null)
|
||||
{
|
||||
if (RoutingDevice is IRoutingSink sinkDevice)
|
||||
{
|
||||
@@ -84,10 +86,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// </summary>
|
||||
public class RoutingStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
[JsonProperty("selectedSourceKey")]
|
||||
/// <summary>
|
||||
/// Gets or sets the SelectedSourceKey
|
||||
/// </summary>
|
||||
[JsonProperty("selectedSourceKey")]
|
||||
public string SelectedSourceKey { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Core.Logging;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
@@ -11,7 +11,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// Represents a ISelectableItemsMessenger
|
||||
/// </summary>
|
||||
public class ISelectableItemsMessenger<TKey> : MessengerBase
|
||||
{
|
||||
{
|
||||
private readonly ISelectableItems<TKey> itemDevice;
|
||||
|
||||
private readonly string _propName;
|
||||
@@ -34,9 +34,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
base.RegisterActions();
|
||||
|
||||
AddAction("/fullStatus", (id, context) =>
|
||||
{
|
||||
SendFullStatus();
|
||||
});
|
||||
SendFullStatus(id)
|
||||
);
|
||||
|
||||
AddAction("/itemsStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
itemDevice.ItemsUpdated += (sender, args) =>
|
||||
{
|
||||
@@ -65,7 +66,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
}
|
||||
|
||||
private void SendFullStatus()
|
||||
private void SendFullStatus(string id = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -77,7 +78,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
CurrentItem = itemDevice.CurrentItem
|
||||
};
|
||||
|
||||
PostStatusMessage(stateObject);
|
||||
PostStatusMessage(stateObject, id);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -91,13 +92,17 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// </summary>
|
||||
public class ISelectableItemsStateMessage<TKey> : DeviceStateMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Items
|
||||
/// </summary>
|
||||
[JsonProperty("items")]
|
||||
public Dictionary<TKey, ISelectableItem> Items { get; set; }
|
||||
|
||||
[JsonProperty("currentItem")]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CurrentItem
|
||||
/// </summary>
|
||||
[JsonProperty("currentItem")]
|
||||
public TKey CurrentItem { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@@ -21,9 +21,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
AddAction("/status", (id, content) =>
|
||||
{
|
||||
SendFullStatus();
|
||||
});
|
||||
SendFullStatus(id)
|
||||
);
|
||||
|
||||
AddAction("/shutdownPromptStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
AddAction("/setShutdownPromptSeconds", (id, content) =>
|
||||
{
|
||||
@@ -68,7 +69,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
};
|
||||
}
|
||||
|
||||
private void SendFullStatus()
|
||||
private void SendFullStatus(string id = null)
|
||||
{
|
||||
var status = new IShutdownPromptTimerStateMessage
|
||||
{
|
||||
@@ -77,7 +78,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
PercentageRemaining = _room.ShutdownPromptTimer.PercentFeedback.UShortValue
|
||||
};
|
||||
|
||||
PostStatusMessage(status);
|
||||
PostStatusMessage(status, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,22 +88,22 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// </summary>
|
||||
public class IShutdownPromptTimerStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
[JsonProperty("secondsRemaining")]
|
||||
/// <summary>
|
||||
/// Gets or sets the SecondsRemaining
|
||||
/// </summary>
|
||||
[JsonProperty("secondsRemaining")]
|
||||
public int SecondsRemaining { get; set; }
|
||||
|
||||
[JsonProperty("percentageRemaining")]
|
||||
/// <summary>
|
||||
/// Gets or sets the PercentageRemaining
|
||||
/// </summary>
|
||||
[JsonProperty("percentageRemaining")]
|
||||
public int PercentageRemaining { get; set; }
|
||||
|
||||
[JsonProperty("shutdownPromptSeconds")]
|
||||
/// <summary>
|
||||
/// Gets or sets the ShutdownPromptSeconds
|
||||
/// </summary>
|
||||
[JsonProperty("shutdownPromptSeconds")]
|
||||
public int ShutdownPromptSeconds { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.CrestronIO;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
@@ -23,7 +23,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatus());
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
AddAction("/switchedOutputStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
AddAction("/on", (id, content) =>
|
||||
{
|
||||
@@ -42,14 +44,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
device.OutputIsOnFeedback.OutputChange += new EventHandler<Core.FeedbackEventArgs>((o, a) => SendFullStatus());
|
||||
}
|
||||
|
||||
private void SendFullStatus()
|
||||
private void SendFullStatus(string id = null)
|
||||
{
|
||||
var state = new ISwitchedOutputStateMessage
|
||||
{
|
||||
IsOn = device.OutputIsOnFeedback.BoolValue
|
||||
};
|
||||
|
||||
PostStatusMessage(state);
|
||||
PostStatusMessage(state, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,10 +60,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// </summary>
|
||||
public class ISwitchedOutputStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
[JsonProperty("isOn")]
|
||||
/// <summary>
|
||||
/// Gets or sets the IsOn
|
||||
/// </summary>
|
||||
[JsonProperty("isOn")]
|
||||
public bool IsOn { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,10 +20,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
|
||||
AddAction("/status", (id, content) =>
|
||||
{
|
||||
SendFullStatus();
|
||||
});
|
||||
AddAction("/status", (id, content) => SendFullStatus(id));
|
||||
|
||||
AddAction("/techPasswordStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
AddAction("/validateTechPassword", (id, content) =>
|
||||
{
|
||||
@@ -55,14 +54,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
};
|
||||
}
|
||||
|
||||
private void SendFullStatus()
|
||||
private void SendFullStatus(string id = null)
|
||||
{
|
||||
var status = new ITechPasswordStateMessage
|
||||
{
|
||||
TechPasswordLength = _room.TechPasswordLength
|
||||
};
|
||||
|
||||
PostStatusMessage(status);
|
||||
PostStatusMessage(status, id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
@@ -22,7 +22,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatus());
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
AddAction("/temperatureStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
AddAction("/setTemperatureUnitsToCelcius", (id, content) =>
|
||||
{
|
||||
@@ -38,7 +40,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
device.TemperatureInCFeedback.OutputChange += new EventHandler<Core.FeedbackEventArgs>((o, a) => SendFullStatus());
|
||||
}
|
||||
|
||||
private void SendFullStatus()
|
||||
private void SendFullStatus(string id = null)
|
||||
{
|
||||
// format the temperature to a string with one decimal place
|
||||
var tempString = string.Format("{0}.{1}", device.TemperatureFeedback.UShortValue / 10, device.TemperatureFeedback.UShortValue % 10);
|
||||
@@ -49,7 +51,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
TemperatureInCelsius = device.TemperatureInCFeedback.BoolValue
|
||||
};
|
||||
|
||||
PostStatusMessage(state);
|
||||
PostStatusMessage(state, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,16 +60,16 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// </summary>
|
||||
public class ITemperatureSensorStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
[JsonProperty("temperature")]
|
||||
/// <summary>
|
||||
/// Gets or sets the Temperature
|
||||
/// </summary>
|
||||
[JsonProperty("temperature")]
|
||||
public string Temperature { get; set; }
|
||||
|
||||
[JsonProperty("temperatureInCelsius")]
|
||||
/// <summary>
|
||||
/// Gets or sets the TemperatureInCelsius
|
||||
/// </summary>
|
||||
[JsonProperty("temperatureInCelsius")]
|
||||
public bool TemperatureInCelsius { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Lighting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
@@ -35,7 +35,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatus());
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
AddAction("/lightingStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
AddAction("/selectScene", (id, content) =>
|
||||
{
|
||||
@@ -43,14 +45,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
lightingScenesDevice.SelectScene(s);
|
||||
});
|
||||
|
||||
if(!(lightingScenesDevice is ILightingScenesDynamic lightingScenesDynamic))
|
||||
if (!(lightingScenesDevice is ILightingScenesDynamic lightingScenesDynamic))
|
||||
return;
|
||||
|
||||
lightingScenesDynamic.LightingScenesUpdated += (s, e) => SendFullStatus();
|
||||
}
|
||||
|
||||
|
||||
private void SendFullStatus()
|
||||
private void SendFullStatus(string id = null)
|
||||
{
|
||||
var state = new LightingBaseStateMessage
|
||||
{
|
||||
@@ -58,7 +60,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
CurrentLightingScene = lightingScenesDevice.CurrentLightingScene
|
||||
};
|
||||
|
||||
PostStatusMessage(state);
|
||||
PostStatusMessage(state, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,16 +69,17 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// </summary>
|
||||
public class LightingBaseStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
[JsonProperty("scenes", NullValueHandling = NullValueHandling.Ignore)]
|
||||
/// <summary>
|
||||
/// Gets or sets the Scenes
|
||||
/// </summary>
|
||||
[JsonProperty("scenes", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public List<LightingScene> Scenes { get; set; }
|
||||
|
||||
[JsonProperty("currentLightingScene", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CurrentLightingScene
|
||||
/// </summary>
|
||||
[JsonProperty("currentLightingScene", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public LightingScene CurrentLightingScene { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
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;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
@@ -159,13 +159,13 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
|
||||
message.Name = _device.Name;
|
||||
|
||||
var token = JToken.FromObject(message);
|
||||
|
||||
var token = JToken.FromObject(message);
|
||||
|
||||
PostStatusMessage(token, MessagePath, clientId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.LogError(ex, "Exception posting status message for {messagePath} to {clientId}", MessagePath, clientId ?? "all clients");
|
||||
this.LogError(ex, "Exception posting status message for {messagePath} to {clientId}", MessagePath, clientId ?? "all clients");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.LogError(ex, "Exception posting status message for {type} to {clientId}", type, clientId ?? "all clients");
|
||||
this.LogError(ex, "Exception posting status message for {type} to {clientId}", type, clientId ?? "all clients");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
using Crestron.SimplSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharp;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
/// <summary>
|
||||
/// Handler for press/hold/release messages
|
||||
/// </summary>
|
||||
public static class PressAndHoldHandler
|
||||
{
|
||||
private const long ButtonHeartbeatInterval = 1000;
|
||||
@@ -26,21 +29,21 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
|
||||
private static void AddTimer(string deviceKey, Action<bool> action)
|
||||
{
|
||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Attempting to add timer for {deviceKey}", deviceKey);
|
||||
Debug.LogDebug("Attempting to add timer for {deviceKey}", deviceKey);
|
||||
|
||||
if (_pushedActions.TryGetValue(deviceKey, out CTimer cancelTimer))
|
||||
{
|
||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Timer for {deviceKey} already exists", deviceKey);
|
||||
Debug.LogDebug("Timer for {deviceKey} already exists", deviceKey);
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Adding timer for {deviceKey} with due time {dueTime}", deviceKey, ButtonHeartbeatInterval);
|
||||
Debug.LogDebug("Adding timer for {deviceKey} with due time {dueTime}", deviceKey, ButtonHeartbeatInterval);
|
||||
|
||||
action(true);
|
||||
|
||||
cancelTimer = new CTimer(o =>
|
||||
{
|
||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Timer expired for {deviceKey}", deviceKey);
|
||||
Debug.LogDebug("Timer expired for {deviceKey}", deviceKey);
|
||||
|
||||
action(false);
|
||||
|
||||
@@ -52,30 +55,30 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
|
||||
private static void ResetTimer(string deviceKey, Action<bool> action)
|
||||
{
|
||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Attempting to reset timer for {deviceKey}", deviceKey);
|
||||
Debug.LogDebug("Attempting to reset timer for {deviceKey}", deviceKey);
|
||||
|
||||
if (!_pushedActions.TryGetValue(deviceKey, out CTimer cancelTimer))
|
||||
{
|
||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Timer for {deviceKey} not found", deviceKey);
|
||||
Debug.LogDebug("Timer for {deviceKey} not found", deviceKey);
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Resetting timer for {deviceKey} with due time {dueTime}", deviceKey, ButtonHeartbeatInterval);
|
||||
Debug.LogDebug("Resetting timer for {deviceKey} with due time {dueTime}", deviceKey, ButtonHeartbeatInterval);
|
||||
|
||||
cancelTimer.Reset(ButtonHeartbeatInterval);
|
||||
}
|
||||
|
||||
private static void StopTimer(string deviceKey, Action<bool> action)
|
||||
{
|
||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Attempting to stop timer for {deviceKey}", deviceKey);
|
||||
Debug.LogDebug("Attempting to stop timer for {deviceKey}", deviceKey);
|
||||
|
||||
if (!_pushedActions.TryGetValue(deviceKey, out CTimer cancelTimer))
|
||||
{
|
||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Timer for {deviceKey} not found", deviceKey);
|
||||
Debug.LogDebug("Timer for {deviceKey} not found", deviceKey);
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Stopping timer for {deviceKey} with due time {dueTime}", deviceKey, ButtonHeartbeatInterval);
|
||||
Debug.LogDebug("Stopping timer for {deviceKey} with due time {dueTime}", deviceKey, ButtonHeartbeatInterval);
|
||||
|
||||
action(false);
|
||||
cancelTimer.Stop();
|
||||
@@ -84,15 +87,15 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
|
||||
public static Action<string, Action<bool>> GetPressAndHoldHandler(string value)
|
||||
{
|
||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Getting press and hold handler for {value}", value);
|
||||
Debug.LogDebug("Getting press and hold handler for {value}", value);
|
||||
|
||||
if (!_pushedActionHandlers.TryGetValue(value, out Action<string, Action<bool>> handler))
|
||||
{
|
||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Press and hold handler for {value} not found", value);
|
||||
Debug.LogDebug("Press and hold handler for {value} not found", value);
|
||||
return null;
|
||||
}
|
||||
|
||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Got handler for {value}", value);
|
||||
Debug.LogDebug("Got handler for {value}", value);
|
||||
|
||||
return handler;
|
||||
}
|
||||
@@ -104,7 +107,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
var msg = content.ToObject<MobileControlSimpleContent<string>>();
|
||||
|
||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Handling press and hold message of {type} for {deviceKey}", msg.Value, deviceKey);
|
||||
Debug.LogDebug("Handling press and hold message of {type} for {deviceKey}", msg.Value, deviceKey);
|
||||
|
||||
var timerHandler = GetPressAndHoldHandler(msg.Value);
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Core.Logging;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Room.Config;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
@@ -31,7 +31,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
var events = _room.GetScheduledEvents();
|
||||
|
||||
SendFullStatus(events);
|
||||
SendFullStatus(events, id);
|
||||
});
|
||||
|
||||
AddAction("/scheduledEventsStatus", (id, content) =>
|
||||
{
|
||||
var events = _room.GetScheduledEvents();
|
||||
|
||||
SendFullStatus(events, id);
|
||||
});
|
||||
|
||||
_room.ScheduledEventsChanged += (sender, args) => SendFullStatus(args.ScheduledEvents);
|
||||
@@ -55,11 +62,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.LogException(ex,"Exception saving event");
|
||||
this.LogException(ex, "Exception saving event");
|
||||
}
|
||||
}
|
||||
|
||||
private void SendFullStatus(List<ScheduledEventConfig> events)
|
||||
private void SendFullStatus(List<ScheduledEventConfig> events, string id = null)
|
||||
{
|
||||
|
||||
var message = new RoomEventScheduleStateMessage
|
||||
@@ -67,7 +74,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
ScheduleEvents = events,
|
||||
};
|
||||
|
||||
PostStatusMessage(message);
|
||||
PostStatusMessage(message, id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Shades;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
@@ -22,7 +22,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatus());
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||
AddAction("/shadesStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
AddAction("/shadeUp", (id, content) =>
|
||||
{
|
||||
@@ -75,7 +76,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
|
||||
|
||||
private void SendFullStatus()
|
||||
private void SendFullStatus(string id = null)
|
||||
{
|
||||
var state = new ShadeBaseStateMessage();
|
||||
|
||||
@@ -85,7 +86,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
state.IsClosed = feedbackDevice.ShadeIsClosedFeedback.BoolValue;
|
||||
}
|
||||
|
||||
PostStatusMessage(state);
|
||||
PostStatusMessage(state, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,10 +95,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// </summary>
|
||||
public class ShadeBaseStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
[JsonProperty("middleButtonLabel", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the MiddleButtonLabel
|
||||
/// </summary>
|
||||
[JsonProperty("middleButtonLabel", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string MiddleButtonLabel { get; set; }
|
||||
|
||||
[JsonProperty("isOpen", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using Crestron.SimplSharp;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Crestron.SimplSharp;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Monitoring;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
@@ -56,36 +56,37 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
SendSystemMonitorStatusMessage();
|
||||
}
|
||||
|
||||
private void SendFullStatusMessage()
|
||||
private void SendFullStatusMessage(string id = null)
|
||||
{
|
||||
SendSystemMonitorStatusMessage();
|
||||
SendSystemMonitorStatusMessage(id);
|
||||
|
||||
foreach (var p in systemMonitor.ProgramStatusFeedbackCollection)
|
||||
{
|
||||
PostStatusMessage(JToken.FromObject(p.Value.ProgramInfo));
|
||||
PostStatusMessage(JToken.FromObject(p.Value.ProgramInfo), id);
|
||||
}
|
||||
}
|
||||
|
||||
private void SendSystemMonitorStatusMessage()
|
||||
private void SendSystemMonitorStatusMessage(string id = null)
|
||||
{
|
||||
// This takes a while, launch a new thread
|
||||
|
||||
|
||||
Task.Run(() => PostStatusMessage(JToken.FromObject(new SystemMonitorStateMessage
|
||||
{
|
||||
|
||||
TimeZone = systemMonitor.TimeZoneFeedback.IntValue,
|
||||
TimeZoneName = systemMonitor.TimeZoneTextFeedback.StringValue,
|
||||
IoControllerVersion = systemMonitor.IoControllerVersionFeedback.StringValue,
|
||||
SnmpVersion = systemMonitor.SnmpVersionFeedback.StringValue,
|
||||
BacnetVersion = systemMonitor.BaCnetAppVersionFeedback.StringValue,
|
||||
ControllerVersion = systemMonitor.ControllerVersionFeedback.StringValue
|
||||
})
|
||||
}), id
|
||||
));
|
||||
}
|
||||
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatusMessage());
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatusMessage(id));
|
||||
|
||||
AddAction("/systemStatus", (id, content) => SendFullStatusMessage(id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,40 +95,45 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// </summary>
|
||||
public class SystemMonitorStateMessage
|
||||
{
|
||||
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
|
||||
/// <summary>
|
||||
/// Gets or sets the TimeZone
|
||||
/// </summary>
|
||||
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public int TimeZone { get; set; }
|
||||
|
||||
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the TimeZoneName
|
||||
/// </summary>
|
||||
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string TimeZoneName { get; set; }
|
||||
|
||||
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the IoControllerVersion
|
||||
/// </summary>
|
||||
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string IoControllerVersion { get; set; }
|
||||
|
||||
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the SnmpVersion
|
||||
/// </summary>
|
||||
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string SnmpVersion { get; set; }
|
||||
|
||||
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the BacnetVersion
|
||||
/// </summary>
|
||||
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string BacnetVersion { get; set; }
|
||||
|
||||
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ControllerVersion
|
||||
/// </summary>
|
||||
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string ControllerVersion { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// <summary>
|
||||
/// SendFullStatus method
|
||||
/// </summary>
|
||||
public void SendFullStatus()
|
||||
public void SendFullStatus(string id = null)
|
||||
{
|
||||
var messageObj = new TwoWayDisplayBaseStateMessage
|
||||
{
|
||||
@@ -31,16 +31,17 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
CurrentInput = _display.CurrentInputFeedback.StringValue
|
||||
};
|
||||
|
||||
PostStatusMessage(messageObj);
|
||||
PostStatusMessage(messageObj, id);
|
||||
}
|
||||
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatus());
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
AddAction("/displayStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
//_display.PowerIsOnFeedback.OutputChange += PowerIsOnFeedbackOnOutputChange;
|
||||
_display.CurrentInputFeedback.OutputChange += CurrentInputFeedbackOnOutputChange;
|
||||
_display.IsCoolingDownFeedback.OutputChange += IsCoolingFeedbackOnOutputChange;
|
||||
_display.IsWarmingUpFeedback.OutputChange += IsWarmingFeedbackOnOutputChange;
|
||||
@@ -55,16 +56,6 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//private void PowerIsOnFeedbackOnOutputChange(object sender, FeedbackEventArgs feedbackEventArgs)
|
||||
//{
|
||||
// PostStatusMessage(JToken.FromObject(new
|
||||
// {
|
||||
// powerState = feedbackEventArgs.BoolValue
|
||||
// })
|
||||
// );
|
||||
//}
|
||||
|
||||
private void IsWarmingFeedbackOnOutputChange(object sender, FeedbackEventArgs feedbackEventArgs)
|
||||
{
|
||||
PostStatusMessage(JToken.FromObject(new
|
||||
@@ -96,10 +87,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
//[JsonProperty("powerState", NullValueHandling = NullValueHandling.Ignore)]
|
||||
//public bool? PowerState { get; set; }
|
||||
|
||||
[JsonProperty("currentInput", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CurrentInput
|
||||
/// </summary>
|
||||
[JsonProperty("currentInput", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string CurrentInput { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,8 @@
|
||||
using Crestron.SimplSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Crestron.SimplSharp;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
@@ -9,9 +13,6 @@ using PepperDash.Essentials.Devices.Common.Cameras;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
@@ -151,7 +152,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
PostStatusMessage(state);
|
||||
|
||||
SendFullStatus();
|
||||
} catch (Exception ex)
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.LogError(ex, "Error sending codec ready status");
|
||||
}
|
||||
@@ -169,7 +171,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
|
||||
AddAction("/isReady", (id, content) => SendIsReady());
|
||||
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatus());
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||
AddAction("/codecStatus", (id, content) => SendFullStatus(id));
|
||||
|
||||
AddAction("/dial", (id, content) =>
|
||||
{
|
||||
@@ -369,7 +372,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
};
|
||||
|
||||
PostStatusMessage(state);
|
||||
} catch (Exception ex)
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.LogError(ex, "Error posting sharing source");
|
||||
}
|
||||
@@ -385,7 +389,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
};
|
||||
|
||||
PostStatusMessage(state);
|
||||
} catch (Exception ex)
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.LogError(ex, "Error posting sharing content");
|
||||
}
|
||||
@@ -435,7 +440,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
MapCameraActions();
|
||||
PostSelectedCamera();
|
||||
} catch(Exception ex)
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.LogError(ex, "Exception handling camera selected event");
|
||||
}
|
||||
@@ -780,14 +786,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void SendFullStatus()
|
||||
protected virtual void SendFullStatus(string id = null)
|
||||
{
|
||||
if (!Codec.IsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CrestronInvoke.BeginInvoke((o) => PostStatusMessage(GetStatus()));
|
||||
Task.Run(() => PostStatusMessage(GetStatus(), id));
|
||||
}
|
||||
|
||||
private void PostReceivingContent(bool receivingContent)
|
||||
@@ -800,7 +806,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
};
|
||||
|
||||
PostStatusMessage(state);
|
||||
} catch(Exception ex)
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.LogError(ex, "Error posting receiving content");
|
||||
}
|
||||
@@ -949,22 +956,25 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
[JsonProperty("cameraSupportsOffMode", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? CameraSupportsOffMode { get; set; }
|
||||
|
||||
[JsonProperty("currentDialString", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CurrentDialString
|
||||
/// </summary>
|
||||
[JsonProperty("currentDialString", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string CurrentDialString { get; set; }
|
||||
|
||||
[JsonProperty("currentDirectory", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CurrentDirectory
|
||||
/// </summary>
|
||||
[JsonProperty("currentDirectory", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public CodecDirectory CurrentDirectory { get; set; }
|
||||
|
||||
[JsonProperty("directorySelectedFolderName", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the DirectorySelectedFolderName
|
||||
/// </summary>
|
||||
[JsonProperty("directorySelectedFolderName", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string DirectorySelectedFolderName { get; set; }
|
||||
|
||||
[JsonProperty("hasCameras", NullValueHandling = NullValueHandling.Ignore)]
|
||||
@@ -985,10 +995,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
[JsonProperty("initialPhonebookSyncComplete", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? InitialPhonebookSyncComplete { get; set; }
|
||||
|
||||
[JsonProperty("info", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Info
|
||||
/// </summary>
|
||||
[JsonProperty("info", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public VideoCodecInfo Info { get; set; }
|
||||
|
||||
[JsonProperty("isInCall", NullValueHandling = NullValueHandling.Ignore)]
|
||||
@@ -1000,16 +1011,18 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
[JsonProperty("isZoomRoom", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? IsZoomRoom { get; set; }
|
||||
|
||||
[JsonProperty("meetingInfo", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the MeetingInfo
|
||||
/// </summary>
|
||||
[JsonProperty("meetingInfo", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public MeetingInfo MeetingInfo { get; set; }
|
||||
|
||||
[JsonProperty("presets", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Presets
|
||||
/// </summary>
|
||||
[JsonProperty("presets", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public List<CodecRoomPreset> Presets { get; set; }
|
||||
|
||||
[JsonProperty("privacyModeIsOn", NullValueHandling = NullValueHandling.Ignore)]
|
||||
@@ -1024,10 +1037,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
[JsonProperty("sharingContentIsOn", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? SharingContentIsOn { get; set; }
|
||||
|
||||
[JsonProperty("sharingSource", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the SharingSource
|
||||
/// </summary>
|
||||
[JsonProperty("sharingSource", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string SharingSource { get; set; }
|
||||
|
||||
[JsonProperty("showCamerasWhenNotInCall", NullValueHandling = NullValueHandling.Ignore)]
|
||||
@@ -1057,23 +1071,26 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
[JsonProperty("cameraOffSupported", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? CameraOffIsSupported { get; set; }
|
||||
|
||||
[JsonProperty("cameraMode", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CameraMode
|
||||
/// </summary>
|
||||
[JsonProperty("cameraMode", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string CameraMode { get; set; }
|
||||
|
||||
[JsonProperty("cameraList", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Cameras
|
||||
/// </summary>
|
||||
[JsonProperty("cameraList", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public List<CameraBase> Cameras { get; set; }
|
||||
|
||||
[JsonProperty("selectedCamera", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the SelectedCamera
|
||||
/// </summary>
|
||||
public Camera SelectedCamera { get; set; }
|
||||
[JsonProperty("selectedCamera", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public Camera SelectedCamera { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1081,25 +1098,28 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// </summary>
|
||||
public class Camera
|
||||
{
|
||||
[JsonProperty("key", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Key
|
||||
/// </summary>
|
||||
[JsonProperty("key", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Key { get; set; }
|
||||
|
||||
[JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Name
|
||||
/// </summary>
|
||||
[JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("isFarEnd", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? IsFarEnd { get; set; }
|
||||
|
||||
[JsonProperty("capabilities", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Capabilities
|
||||
/// </summary>
|
||||
[JsonProperty("capabilities", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public CameraCapabilities Capabilities { get; set; }
|
||||
}
|
||||
|
||||
@@ -1135,27 +1155,31 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// </summary>
|
||||
public class PasswordPromptEventMessage : VideoCodecBaseEventMessage
|
||||
{
|
||||
[JsonProperty("message", NullValueHandling = NullValueHandling.Ignore)]
|
||||
/// <summary>
|
||||
/// Gets or sets the Message
|
||||
/// </summary>
|
||||
[JsonProperty("message", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Message { get; set; }
|
||||
[JsonProperty("lastAttemptWasIncorrect", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the LastAttemptWasIncorrect
|
||||
/// </summary>
|
||||
[JsonProperty("lastAttemptWasIncorrect", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool LastAttemptWasIncorrect { get; set; }
|
||||
|
||||
[JsonProperty("loginAttemptFailed", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the LoginAttemptFailed
|
||||
/// </summary>
|
||||
[JsonProperty("loginAttemptFailed", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool LoginAttemptFailed { get; set; }
|
||||
|
||||
[JsonProperty("loginAttemptCancelled", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the LoginAttemptCancelled
|
||||
/// </summary>
|
||||
[JsonProperty("loginAttemptCancelled", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool LoginAttemptCancelled { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user