mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-14 04:04:58 +00:00
Updates from testing System Monitor messaging with AppServer
This commit is contained in:
@@ -67,6 +67,9 @@ namespace PepperDash.Essentials
|
||||
public CotijaSystemController(string key, string name, CotijaConfig config) : base(key, name)
|
||||
{
|
||||
Config = config;
|
||||
|
||||
SystemUuid = ConfigReader.ConfigObject.SystemUuid;
|
||||
|
||||
Debug.Console(0, this, "Mobile UI controller initializing for server:{0}", config.ServerUrl);
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(AuthorizeSystem,
|
||||
@@ -97,6 +100,21 @@ namespace PepperDash.Essentials
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If config rooms is empty or null then go
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override bool CustomActivate()
|
||||
{
|
||||
if (ConfigReader.ConfigObject.Rooms == null || ConfigReader.ConfigObject.Rooms.Count == 0)
|
||||
{
|
||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Config contains no rooms. Registering with Server.");
|
||||
RegisterSystemToServer();
|
||||
}
|
||||
|
||||
return base.CustomActivate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -177,7 +195,7 @@ namespace PepperDash.Essentials
|
||||
else
|
||||
{
|
||||
Debug.Console(0, this, "Adding room bridge and sending configuration");
|
||||
SystemUuid = ConfigReader.ConfigObject.SystemUuid;
|
||||
//SystemUuid = ConfigReader.ConfigObject.SystemUuid;
|
||||
RegisterSystemToServer();
|
||||
}
|
||||
}
|
||||
@@ -190,7 +208,7 @@ namespace PepperDash.Essentials
|
||||
void bridge_ConfigurationIsReady(object sender, EventArgs e)
|
||||
{
|
||||
Debug.Console(1, this, "Bridge ready. Registering");
|
||||
SystemUuid = ConfigReader.ConfigObject.SystemUuid;
|
||||
//SystemUuid = ConfigReader.ConfigObject.SystemUuid;
|
||||
// send the configuration object to the server
|
||||
RegisterSystemToServer();
|
||||
}
|
||||
@@ -210,7 +228,7 @@ namespace PepperDash.Essentials
|
||||
/// <param name="command"></param>
|
||||
void AuthorizeSystem(string code)
|
||||
{
|
||||
SystemUuid = ConfigReader.ConfigObject.SystemUuid;
|
||||
//SystemUuid = ConfigReader.ConfigObject.SystemUuid;
|
||||
|
||||
if (string.IsNullOrEmpty(SystemUuid))
|
||||
{
|
||||
@@ -315,7 +333,6 @@ namespace PepperDash.Essentials
|
||||
void ConnectWebsocketClient()
|
||||
{
|
||||
|
||||
|
||||
Debug.Console(1, this, "Initializing Stream client to server.");
|
||||
|
||||
if (WSClient != null)
|
||||
|
||||
@@ -68,11 +68,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// <param name="contentObject">The contents of the content object</param>
|
||||
protected void PostStatusMessage(object contentObject)
|
||||
{
|
||||
AppServerController.SendMessageToServer(JObject.FromObject(new
|
||||
{
|
||||
type = MessagePath,
|
||||
content = contentObject
|
||||
}));
|
||||
if (AppServerController != null)
|
||||
{
|
||||
AppServerController.SendMessageToServer(JObject.FromObject(new
|
||||
{
|
||||
type = MessagePath,
|
||||
content = contentObject
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using Crestron.SimplSharp;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Monitoring;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
@@ -45,6 +46,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
var programInfo = JsonConvert.DeserializeObject<ProgramInfo>(serializedProgramInfo);
|
||||
|
||||
Debug.Console(2, "Posting Status Message: {0}", programInfo.ToString());
|
||||
|
||||
PostStatusMessage(programInfo);
|
||||
}
|
||||
|
||||
@@ -70,6 +73,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
|
||||
void SendSystemMonitorStatusMessage()
|
||||
{
|
||||
Debug.Console(2, "Posting System Monitor Status Message.");
|
||||
|
||||
// This takes a while, launch a new thread
|
||||
CrestronInvoke.BeginInvoke((o) =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user