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>
/// 211
/// </summary>
const uint SCurrentCallString = 211;
const uint SCurrentCallNumber = 211;
/// <summary>
/// 212
/// </summary>
const uint SCurrentCallName = 212;
/// <summary>
/// 221
/// </summary>
const uint SHookState = 221;
/// <summary>
/// 222
/// </summary>
const uint SCallDirection = 222;
/// <summary>
///
@@ -79,11 +87,12 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
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
/// <param name="appServerController"></param>
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
{
Action<object> 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<string, uint> 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(),
});
}
/// <summary>
/// Turns the
/// </summary>

View File

@@ -27,8 +27,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
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>
@@ -36,19 +38,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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<ProgramInfo>(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);
}
/// <summary>
@@ -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) =>

View File

@@ -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);
}
}