mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-12 12:06:58 +00:00
Updates from testing System Monitor messaging with AppServer
This commit is contained in:
parent
f6136a8c77
commit
821f2a6d60
7 changed files with 40 additions and 13 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -67,6 +67,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
/// </summary>
|
||||
/// <param name="contentObject">The contents of the content object</param>
|
||||
protected void PostStatusMessage(object contentObject)
|
||||
{
|
||||
if (AppServerController != null)
|
||||
{
|
||||
AppServerController.SendMessageToServer(JObject.FromObject(new
|
||||
{
|
||||
|
|
@ -76,3 +78,4 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 3d81472afdcf8713ec92c44d9a1521bfb2261738
|
||||
Subproject commit 1d210d80f8c142d5281bbc7138aab17bc4c14c7b
|
||||
Loading…
Add table
Add a link
Reference in a new issue