mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-09 09:45:06 +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) =>
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace PepperDash.Essentials
|
||||
var typeName = dc.Type.ToLower();
|
||||
var groupName = dc.Group.ToLower();
|
||||
|
||||
Debug.Console(0, "Name {0}, Key {1}, Type {2}, Properties {3}", name, key, type, properties.ToString());
|
||||
//Debug.Console(2, "Name {0}, Key {1}, Type {2}, Properties {3}", name, key, type, properties.ToString());
|
||||
|
||||
if (typeName == "eiscapi")
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace PepperDash.Essentials.Bridges
|
||||
|
||||
joinMap.OffsetJoinNumbers(joinStart);
|
||||
|
||||
Debug.Console(1, systemMonitorController, "Linking API starting at join: {0}", joinStart);
|
||||
//Debug.Console(1, systemMonitorController, "Linking API starting at join: {0}", joinStart);
|
||||
|
||||
systemMonitorController.TimeZoneFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeZone]);
|
||||
//trilist.SetUShortSigAction(joinMap.TimeZone, new Action<ushort>(u => systemMonitorController.SetTimeZone(u)));
|
||||
@@ -44,7 +44,7 @@ namespace PepperDash.Essentials.Bridges
|
||||
// TODO: link feedbacks for each program slot
|
||||
var programNumber = p.Value.Program.Number;
|
||||
|
||||
Debug.Console(1, systemMonitorController, "Linking API for Program Slot: {0} starting at join: {1}", programNumber, programSlotJoinStart);
|
||||
//Debug.Console(1, systemMonitorController, "Linking API for Program Slot: {0} starting at join: {1}", programNumber, programSlotJoinStart);
|
||||
|
||||
trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramStart, new Action<bool>
|
||||
(b => SystemMonitor.ProgramCollection[programNumber].OperatingState = eProgramOperatingState.Start));
|
||||
|
||||
@@ -233,6 +233,8 @@ namespace PepperDash.Essentials
|
||||
var messenger = new PepperDash.Essentials.AppServer.Messengers.SystemMonitorMessenger
|
||||
(key, sysMon, "/device/systemMonitor");
|
||||
|
||||
messenger.RegisterWithAppServer(appServer);
|
||||
|
||||
DeviceManager.AddDevice(messenger);
|
||||
|
||||
|
||||
|
||||
Submodule essentials-framework updated: 3d81472afd...1d210d80f8
Reference in New Issue
Block a user