Updates to fix issues with sending individual program status messages to the app server. Minor updates to AtcDdvc01Messenger based on testing MC with Heath

This commit is contained in:
Neil Dorin
2018-12-18 17:22:33 -07:00
parent 87a449d1ee
commit 3a3f6db692
4 changed files with 49 additions and 38 deletions

View File

@@ -31,11 +31,19 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// <summary> /// <summary>
/// 211 /// 211
/// </summary> /// </summary>
const uint SCurrentCallString = 211; const uint SCurrentCallNumber = 211;
/// <summary>
/// 212
/// </summary>
const uint SCurrentCallName = 212;
/// <summary> /// <summary>
/// 221 /// 221
/// </summary> /// </summary>
const uint SHookState = 221; const uint SHookState = 221;
/// <summary>
/// 222
/// </summary>
const uint SCallDirection = 222;
/// <summary> /// <summary>
/// ///
@@ -79,11 +87,12 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary> /// </summary>
void SendFullStatus() void SendFullStatus()
{ {
this.PostStatusMessage(new this.PostStatusMessage(new
{ {
calls = GetCurrentCallList(), calls = GetCurrentCallList(),
callStatus = EISC.GetString(SHookState), currentCallString = EISC.GetString(SCurrentCallNumber),
currentCallString = EISC.GetString(SCurrentCallString),
currentDialString = EISC.GetString(SCurrentDialString), currentDialString = EISC.GetString(SCurrentDialString),
isInCall = EISC.GetString(SHookState) == "Connected" isInCall = EISC.GetString(SHookState) == "Connected"
}); });
@@ -95,31 +104,33 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// <param name="appServerController"></param> /// <param name="appServerController"></param>
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController) protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
{ {
Action<object> send = this.PostStatusMessage; //EISC.SetStringSigAction(SCurrentDialString, s => PostStatusMessage(new { currentDialString = s }));
EISC.SetStringSigAction(SCurrentDialString, s => send(new { currentDialString = s }));
EISC.SetStringSigAction(SHookState, s => EISC.SetStringSigAction(SHookState, s =>
{ {
CurrentCallItem.Status = (eCodecCallStatus)Enum.Parse(typeof(eCodecCallStatus), s, true); CurrentCallItem.Status = (eCodecCallStatus)Enum.Parse(typeof(eCodecCallStatus), s, true);
GetCurrentCallList(); //GetCurrentCallList();
send(new SendCallsList();
{
calls = GetCurrentCallList(),
callStatus = s
});
}); });
EISC.SetStringSigAction(SCurrentCallString, s => EISC.SetStringSigAction(SCurrentCallNumber, s =>
{ {
CurrentCallItem.Name = s;
CurrentCallItem.Number = s; CurrentCallItem.Number = s;
send(new SendCallsList();
{
calls = GetCurrentCallList(),
currentCallString = s
});
}); });
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 // Add press and holds using helper
Action<string, uint> addPHAction = (s, u) => Action<string, uint> addPHAction = (s, u) =>
AppServerController.AddAction(MessagePath + s, new PressAndHoldAction(b => EISC.SetBool(u, b))); 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(),
});
}
/// <summary> /// <summary>
/// Turns the /// Turns the
/// </summary> /// </summary>

View File

@@ -27,8 +27,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
foreach (var p in SysMon.ProgramStatusFeedbackCollection) foreach (var p in SysMon.ProgramStatusFeedbackCollection)
{ {
p.Value.AggregatedProgramInfoFeedback.OutputChange += new EventHandler<PepperDash.Essentials.Core.FeedbackEventArgs>(AggregatedProgramInfoFeedback_OutputChange); p.Value.ProgramInfoChanged += new EventHandler<ProgramInfoEventArgs>(ProgramInfoChanged);
} }
CrestronConsole.AddNewConsoleCommand(s => SendFullStatusMessage(), "SendFullSysMonStatus", "Sends the full System Monitor Status", ConsoleAccessLevelEnum.AccessOperator);
} }
/// <summary> /// <summary>
@@ -36,19 +38,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
void AggregatedProgramInfoFeedback_OutputChange(object sender, PepperDash.Essentials.Core.FeedbackEventArgs e) void ProgramInfoChanged(object sender, ProgramInfoEventArgs e)
{ {
SendProgramInfoStatusMessage(e.StringValue); Debug.Console(1, "Posting Status Message: {0}", e.ProgramInfo.ToString());
} PostStatusMessage(e.ProgramInfo);
// 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);
Debug.Console(2, "Posting Status Message: {0}", programInfo.ToString());
PostStatusMessage(programInfo);
} }
/// <summary> /// <summary>
@@ -67,13 +60,13 @@ namespace PepperDash.Essentials.AppServer.Messengers
foreach (var p in SysMon.ProgramStatusFeedbackCollection) foreach (var p in SysMon.ProgramStatusFeedbackCollection)
{ {
SendProgramInfoStatusMessage(p.Value.AggregatedProgramInfoFeedback.StringValue); PostStatusMessage(p.Value.ProgramInfo);
} }
} }
void SendSystemMonitorStatusMessage() 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 // This takes a while, launch a new thread
CrestronInvoke.BeginInvoke((o) => CrestronInvoke.BeginInvoke((o) =>

View File

@@ -212,12 +212,13 @@ namespace PepperDash.Essentials
void Load() void Load()
{ {
LoadDevices(); LoadDevices();
LinkSystemMonitorToAppServer();
LoadTieLines(); LoadTieLines();
LoadRooms(); LoadRooms();
LoadLogoServer(); LoadLogoServer();
DeviceManager.ActivateAll(); DeviceManager.ActivateAll();
LinkSystemMonitorToAppServer();
} }
void LinkSystemMonitorToAppServer() void LinkSystemMonitorToAppServer()
@@ -235,9 +236,7 @@ namespace PepperDash.Essentials
messenger.RegisterWithAppServer(appServer); messenger.RegisterWithAppServer(appServer);
DeviceManager.AddDevice(messenger); DeviceManager.AddDevice(messenger);
} }
} }