mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 13:15:03 +00:00
Adds SystemMonitroMessenger to bridge between SystemMonitorController and AppServer (untested)
This commit is contained in:
@@ -15,6 +15,7 @@ using Newtonsoft.Json.Linq;
|
|||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
using PepperDash.Essentials.Room.Cotija;
|
using PepperDash.Essentials.Room.Cotija;
|
||||||
|
|
||||||
namespace PepperDash.Essentials
|
namespace PepperDash.Essentials
|
||||||
|
|||||||
@@ -64,8 +64,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="eisc"></param>
|
/// <param name="eisc"></param>
|
||||||
/// <param name="messagePath"></param>
|
/// <param name="messagePath"></param>
|
||||||
public Ddvc01AtcMessenger(BasicTriList eisc, string messagePath)
|
public Ddvc01AtcMessenger(string key, BasicTriList eisc, string messagePath)
|
||||||
: base(messagePath)
|
: base(key, messagePath)
|
||||||
{
|
{
|
||||||
EISC = eisc;
|
EISC = eisc;
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ using Crestron.SimplSharp;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
|
||||||
using PepperDash.Essentials.Devices.Common.Codec;
|
using PepperDash.Essentials.Devices.Common.Codec;
|
||||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||||
|
|
||||||
@@ -15,8 +17,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides a messaging bridge for a VideoCodecBase
|
/// Provides a messaging bridge for a VideoCodecBase
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class MessengerBase
|
public abstract class MessengerBase : IKeyed
|
||||||
{
|
{
|
||||||
|
public string Key { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -28,8 +32,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="codec"></param>
|
/// <param name="codec"></param>
|
||||||
public MessengerBase(string messagePath)
|
public MessengerBase(string key, string messagePath)
|
||||||
{
|
{
|
||||||
|
Key = key;
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(messagePath))
|
if (string.IsNullOrEmpty(messagePath))
|
||||||
throw new ArgumentException("messagePath must not be empty or null");
|
throw new ArgumentException("messagePath must not be empty or null");
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,94 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
using PepperDash.Essentials.Core.Monitoring;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
|
{
|
||||||
|
public class SystemMonitorMessenger : MessengerBase
|
||||||
|
{
|
||||||
|
public SystemMonitorController SysMon { get; private set; }
|
||||||
|
|
||||||
|
public SystemMonitorMessenger(string key, SystemMonitorController sysMon, string messagePath)
|
||||||
|
: base(key, messagePath)
|
||||||
|
{
|
||||||
|
if (sysMon == null)
|
||||||
|
throw new ArgumentNullException("sysMon");
|
||||||
|
|
||||||
|
SysMon = sysMon;
|
||||||
|
|
||||||
|
SysMon.SystemMonitorPropertiesChanged += new EventHandler<EventArgs>(SysMon_SystemMonitorPropertiesChanged);
|
||||||
|
|
||||||
|
foreach (var p in SysMon.ProgramStatusFeedbackCollection)
|
||||||
|
{
|
||||||
|
p.Value.AggregatedProgramInfoFeedback.OutputChange += new EventHandler<PepperDash.Essentials.Core.FeedbackEventArgs>(AggregatedProgramInfoFeedback_OutputChange);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Posts the program information message
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
void AggregatedProgramInfoFeedback_OutputChange(object sender, PepperDash.Essentials.Core.FeedbackEventArgs e)
|
||||||
|
{
|
||||||
|
SendProgramInfoStatusMessage(e.StringValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deserializes the program info into an object that can be setn in a status message
|
||||||
|
void SendProgramInfoStatusMessage(string serializedProgramInfo)
|
||||||
|
{
|
||||||
|
var programInfo = JsonConvert.DeserializeObject<ProgramInfo>(serializedProgramInfo);
|
||||||
|
|
||||||
|
PostStatusMessage(programInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Posts the system monitor properties
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
void SysMon_SystemMonitorPropertiesChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SendSystemMonitorStatusMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SendFullStatusMessage()
|
||||||
|
{
|
||||||
|
SendSystemMonitorStatusMessage();
|
||||||
|
|
||||||
|
foreach (var p in SysMon.ProgramStatusFeedbackCollection)
|
||||||
|
{
|
||||||
|
SendProgramInfoStatusMessage(p.Value.AggregatedProgramInfoFeedback.StringValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SendSystemMonitorStatusMessage()
|
||||||
|
{
|
||||||
|
// This takes a while, launch a new thread
|
||||||
|
CrestronInvoke.BeginInvoke((o) =>
|
||||||
|
{
|
||||||
|
PostStatusMessage(new
|
||||||
|
{
|
||||||
|
timeZone = SysMon.TimeZoneFeedback.IntValue,
|
||||||
|
timeZoneName = SysMon.TimeZoneTextFeedback.StringValue,
|
||||||
|
ioControllerVersion = SysMon.IOControllerVersionFeedback.StringValue,
|
||||||
|
snmpVersion = SysMon.SnmpVersionFeedback.StringValue,
|
||||||
|
bacnetVersion = SysMon.BACnetAppVersionFeedback.StringValue,
|
||||||
|
controllerVersion = SysMon.ControllerVersionFeedback.StringValue
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
|
||||||
|
{
|
||||||
|
AppServerController.AddAction(MessagePath + "/fullStatus", new Action(SendFullStatusMessage));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -26,7 +26,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="codec"></param>
|
/// <param name="codec"></param>
|
||||||
public VideoCodecBaseMessenger(VideoCodecBase codec, string messagePath) : base(messagePath)
|
public VideoCodecBaseMessenger(string key, VideoCodecBase codec, string messagePath)
|
||||||
|
: base(key, messagePath)
|
||||||
{
|
{
|
||||||
if (codec == null)
|
if (codec == null)
|
||||||
throw new ArgumentNullException("codec");
|
throw new ArgumentNullException("codec");
|
||||||
|
|||||||
@@ -204,7 +204,8 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
SetupFunctions();
|
SetupFunctions();
|
||||||
SetupFeedbacks();
|
SetupFeedbacks();
|
||||||
|
|
||||||
AtcMessenger = new Ddvc01AtcMessenger(EISC, "/device/audioCodec");
|
var key = this.Key + "-" + Parent.Key;
|
||||||
|
AtcMessenger = new Ddvc01AtcMessenger(key, EISC, "/device/audioCodec");
|
||||||
AtcMessenger.RegisterWithAppServer(Parent);
|
AtcMessenger.RegisterWithAppServer(Parent);
|
||||||
|
|
||||||
EISC.SigChange += EISC_SigChange;
|
EISC.SigChange += EISC_SigChange;
|
||||||
@@ -384,8 +385,8 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
//Room
|
//Room
|
||||||
//if (co.Rooms == null)
|
//if (co.Rooms == null)
|
||||||
// always start fresh in case simpl changed
|
// always start fresh in case simpl changed
|
||||||
co.Rooms = new List<EssentialsRoomConfig>();
|
co.Rooms = new List<DeviceConfig>();
|
||||||
var rm = new EssentialsRoomConfig();
|
var rm = new DeviceConfig();
|
||||||
if (co.Rooms.Count == 0)
|
if (co.Rooms.Count == 0)
|
||||||
{
|
{
|
||||||
Debug.Console(0, this, "Adding room to config");
|
Debug.Console(0, this, "Adding room to config");
|
||||||
|
|||||||
@@ -95,7 +95,8 @@ namespace PepperDash.Essentials
|
|||||||
if (vcRoom != null)
|
if (vcRoom != null)
|
||||||
{
|
{
|
||||||
var codec = vcRoom.VideoCodec;
|
var codec = vcRoom.VideoCodec;
|
||||||
VCMessenger = new VideoCodecBaseMessenger(vcRoom.VideoCodec, "/device/videoCodec");
|
var key = vcRoom.VideoCodec.Key + "-" + parent.Key;
|
||||||
|
VCMessenger = new VideoCodecBaseMessenger(key, vcRoom.VideoCodec, "/device/videoCodec");
|
||||||
VCMessenger.RegisterWithAppServer(Parent);
|
VCMessenger.RegisterWithAppServer(Parent);
|
||||||
|
|
||||||
// May need to move this or remove this
|
// May need to move this or remove this
|
||||||
|
|||||||
@@ -212,6 +212,7 @@ namespace PepperDash.Essentials
|
|||||||
void Load()
|
void Load()
|
||||||
{
|
{
|
||||||
LoadDevices();
|
LoadDevices();
|
||||||
|
LinkSystemMonitorToAppServer();
|
||||||
LoadTieLines();
|
LoadTieLines();
|
||||||
LoadRooms();
|
LoadRooms();
|
||||||
LoadLogoServer();
|
LoadLogoServer();
|
||||||
@@ -219,6 +220,24 @@ namespace PepperDash.Essentials
|
|||||||
DeviceManager.ActivateAll();
|
DeviceManager.ActivateAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LinkSystemMonitorToAppServer()
|
||||||
|
{
|
||||||
|
var sysMon = DeviceManager.GetDeviceForKey("systemMonitor") as PepperDash.Essentials.Core.Monitoring.SystemMonitorController;
|
||||||
|
|
||||||
|
var appServer = DeviceManager.GetDeviceForKey("appServer") as CotijaSystemController;
|
||||||
|
|
||||||
|
|
||||||
|
if (sysMon != null && appServer != null)
|
||||||
|
{
|
||||||
|
var key = sysMon.Key + "-" + appServer.Key;
|
||||||
|
var messenger = new PepperDash.Essentials.AppServer.Messengers.SystemMonitorMessenger
|
||||||
|
(key, sysMon, "/device/systemMonitor");
|
||||||
|
|
||||||
|
DeviceManager.AddDevice(messenger);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reads all devices from config and adds them to DeviceManager
|
/// Reads all devices from config and adds them to DeviceManager
|
||||||
@@ -278,6 +297,7 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper method to load tie lines. This should run after devices have loaded
|
/// Helper method to load tie lines. This should run after devices have loaded
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -110,6 +110,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="AppServer\Messengers\AtcDdvc01Messenger.cs" />
|
<Compile Include="AppServer\Messengers\AtcDdvc01Messenger.cs" />
|
||||||
<Compile Include="AppServer\Messengers\MessengerBase.cs" />
|
<Compile Include="AppServer\Messengers\MessengerBase.cs" />
|
||||||
|
<Compile Include="AppServer\Messengers\SystemMonitorMessenger.cs" />
|
||||||
<Compile Include="AppServer\Messengers\VideoCodecBaseMessenger.cs" />
|
<Compile Include="AppServer\Messengers\VideoCodecBaseMessenger.cs" />
|
||||||
<Compile Include="Audio\EssentialsVolumeLevelConfig.cs" />
|
<Compile Include="Audio\EssentialsVolumeLevelConfig.cs" />
|
||||||
<Compile Include="Bridges\BridgeBase.cs" />
|
<Compile Include="Bridges\BridgeBase.cs" />
|
||||||
@@ -142,13 +143,13 @@
|
|||||||
<Compile Include="Devices\NUMERIC AppleTV.cs" />
|
<Compile Include="Devices\NUMERIC AppleTV.cs" />
|
||||||
<Compile Include="ControlSystem.cs" />
|
<Compile Include="ControlSystem.cs" />
|
||||||
<Compile Include="Factory\UiDeviceFactory.cs" />
|
<Compile Include="Factory\UiDeviceFactory.cs" />
|
||||||
<Compile Include="OTHER\Fusion\EssentialsHuddleVtc1FusionController.cs" />
|
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\EssentialsHuddleVtc1FusionController.cs" />
|
||||||
<Compile Include="OTHER\Fusion\FusionCustomPropertiesBridge.cs" />
|
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\FusionCustomPropertiesBridge.cs" />
|
||||||
<Compile Include="OTHER\Fusion\FusionEventHandlers.cs" />
|
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\FusionEventHandlers.cs" />
|
||||||
<Compile Include="OTHER\Fusion\FusionProcessorQueries.cs" />
|
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\FusionProcessorQueries.cs" />
|
||||||
<Compile Include="OTHER\Fusion\FusionRviDataClasses.cs" />
|
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\FusionRviDataClasses.cs" />
|
||||||
<Compile Include="REMOVE EssentialsApp.cs" />
|
<Compile Include="REMOVE EssentialsApp.cs" />
|
||||||
<Compile Include="OTHER\Fusion\EssentialsHuddleSpaceFusionSystemControllerBase.cs" />
|
<Compile Include="FOR REFERENCE UI\OTHER\Fusion\EssentialsHuddleSpaceFusionSystemControllerBase.cs" />
|
||||||
<Compile Include="HttpApiHandler.cs" />
|
<Compile Include="HttpApiHandler.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Room\Behaviours\RoomOnToDefaultSourceWhenOccupied.cs" />
|
<Compile Include="Room\Behaviours\RoomOnToDefaultSourceWhenOccupied.cs" />
|
||||||
|
|||||||
Submodule essentials-framework updated: 67ab8aa632...3d81472afd
Reference in New Issue
Block a user