From 3a3f6db692c170f80b754feb5f096b9e387492ac Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Tue, 18 Dec 2018 17:22:33 -0700 Subject: [PATCH] Updates to fix issues with sending individual program status messages to the app server. Minor updates to AtcDdvc01Messenger based on testing MC with Heath --- .../Messengers/AtcDdvc01Messenger.cs | 55 +++++++++++++------ .../Messengers/SystemMonitorMessenger.cs | 23 +++----- PepperDashEssentials/ControlSystem.cs | 7 +-- essentials-framework | 2 +- 4 files changed, 49 insertions(+), 38 deletions(-) diff --git a/PepperDashEssentials/AppServer/Messengers/AtcDdvc01Messenger.cs b/PepperDashEssentials/AppServer/Messengers/AtcDdvc01Messenger.cs index 94b44dfb..b19fc2c0 100644 --- a/PepperDashEssentials/AppServer/Messengers/AtcDdvc01Messenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/AtcDdvc01Messenger.cs @@ -31,11 +31,19 @@ namespace PepperDash.Essentials.AppServer.Messengers /// /// 211 /// - const uint SCurrentCallString = 211; + const uint SCurrentCallNumber = 211; + /// + /// 212 + /// + const uint SCurrentCallName = 212; /// /// 221 /// const uint SHookState = 221; + /// + /// 222 + /// + const uint SCallDirection = 222; /// /// @@ -79,11 +87,12 @@ namespace PepperDash.Essentials.AppServer.Messengers /// void SendFullStatus() { + + this.PostStatusMessage(new { calls = GetCurrentCallList(), - callStatus = EISC.GetString(SHookState), - currentCallString = EISC.GetString(SCurrentCallString), + currentCallString = EISC.GetString(SCurrentCallNumber), currentDialString = EISC.GetString(SCurrentDialString), isInCall = EISC.GetString(SHookState) == "Connected" }); @@ -95,31 +104,33 @@ namespace PepperDash.Essentials.AppServer.Messengers /// protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController) { - Action send = this.PostStatusMessage; - EISC.SetStringSigAction(SCurrentDialString, s => send(new { currentDialString = s })); + //EISC.SetStringSigAction(SCurrentDialString, s => PostStatusMessage(new { currentDialString = s })); EISC.SetStringSigAction(SHookState, s => { CurrentCallItem.Status = (eCodecCallStatus)Enum.Parse(typeof(eCodecCallStatus), s, true); - GetCurrentCallList(); - send(new - { - calls = GetCurrentCallList(), - callStatus = s - }); + //GetCurrentCallList(); + SendCallsList(); }); - EISC.SetStringSigAction(SCurrentCallString, s => + EISC.SetStringSigAction(SCurrentCallNumber, s => { - CurrentCallItem.Name = s; CurrentCallItem.Number = s; - send(new - { - calls = GetCurrentCallList(), - currentCallString = s - }); + SendCallsList(); }); + EISC.SetStringSigAction(SCurrentCallName, s => + { + CurrentCallItem.Name = s; + SendCallsList(); + }); + + EISC.SetStringSigAction(SCallDirection, s => + { + CurrentCallItem.Direction = (eCodecCallDirection)Enum.Parse(typeof(eCodecCallDirection), s, true); + SendCallsList(); + }); + // Add press and holds using helper Action addPHAction = (s, u) => AppServerController.AddAction(MessagePath + s, new PressAndHoldAction(b => EISC.SetBool(u, b))); @@ -149,6 +160,14 @@ namespace PepperDash.Essentials.AppServer.Messengers })); } + void SendCallsList() + { + PostStatusMessage(new + { + calls = GetCurrentCallList(), + }); + } + /// /// Turns the /// diff --git a/PepperDashEssentials/AppServer/Messengers/SystemMonitorMessenger.cs b/PepperDashEssentials/AppServer/Messengers/SystemMonitorMessenger.cs index 6f59cf05..7b56ab29 100644 --- a/PepperDashEssentials/AppServer/Messengers/SystemMonitorMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/SystemMonitorMessenger.cs @@ -27,8 +27,10 @@ namespace PepperDash.Essentials.AppServer.Messengers foreach (var p in SysMon.ProgramStatusFeedbackCollection) { - p.Value.AggregatedProgramInfoFeedback.OutputChange += new EventHandler(AggregatedProgramInfoFeedback_OutputChange); + p.Value.ProgramInfoChanged += new EventHandler(ProgramInfoChanged); } + + CrestronConsole.AddNewConsoleCommand(s => SendFullStatusMessage(), "SendFullSysMonStatus", "Sends the full System Monitor Status", ConsoleAccessLevelEnum.AccessOperator); } /// @@ -36,19 +38,10 @@ namespace PepperDash.Essentials.AppServer.Messengers /// /// /// - void AggregatedProgramInfoFeedback_OutputChange(object sender, PepperDash.Essentials.Core.FeedbackEventArgs e) + void ProgramInfoChanged(object sender, ProgramInfoEventArgs 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(serializedProgramInfo); - - Debug.Console(2, "Posting Status Message: {0}", programInfo.ToString()); - - PostStatusMessage(programInfo); + Debug.Console(1, "Posting Status Message: {0}", e.ProgramInfo.ToString()); + PostStatusMessage(e.ProgramInfo); } /// @@ -67,13 +60,13 @@ namespace PepperDash.Essentials.AppServer.Messengers foreach (var p in SysMon.ProgramStatusFeedbackCollection) { - SendProgramInfoStatusMessage(p.Value.AggregatedProgramInfoFeedback.StringValue); + PostStatusMessage(p.Value.ProgramInfo); } } void SendSystemMonitorStatusMessage() { - Debug.Console(2, "Posting System Monitor Status Message."); + Debug.Console(1, "Posting System Monitor Status Message."); // This takes a while, launch a new thread CrestronInvoke.BeginInvoke((o) => diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index de3fca36..177aef4f 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -212,12 +212,13 @@ namespace PepperDash.Essentials void Load() { LoadDevices(); - LinkSystemMonitorToAppServer(); LoadTieLines(); LoadRooms(); LoadLogoServer(); DeviceManager.ActivateAll(); + + LinkSystemMonitorToAppServer(); } void LinkSystemMonitorToAppServer() @@ -235,9 +236,7 @@ namespace PepperDash.Essentials messenger.RegisterWithAppServer(appServer); - DeviceManager.AddDevice(messenger); - - + DeviceManager.AddDevice(messenger); } } diff --git a/essentials-framework b/essentials-framework index fb712a2a..d703be80 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit fb712a2a0ab9f7a4ff5bd039d5ea4f9d70ed5d5e +Subproject commit d703be80d7512e10ae801103d45a794420182ba2