public ProgramStatusFeedbacks(Program program) { ProgramInfo = new ProgramInfo(program.Number); Program = program; ProgramInfo.OperatingState = Program.OperatingState; ProgramInfo.RegistrationState = Program.RegistrationState; ProgramStartedFeedback = new BoolFeedback(() => Program.OperatingState == eProgramOperatingState.Start); ProgramStoppedFeedback = new BoolFeedback(() => Program.OperatingState == eProgramOperatingState.Stop); ProgramRegisteredFeedback = new BoolFeedback(() => Program.RegistrationState == eProgramRegistrationState.Register); ProgramUnregisteredFeedback = new BoolFeedback(() => Program.RegistrationState == eProgramRegistrationState.Unregister); ProgramNameFeedback = new StringFeedback(() => ProgramInfo.ProgramFile); ProgramCompileTimeFeedback = new StringFeedback(() => ProgramInfo.CompileTime); CrestronDataBaseVersionFeedback = new StringFeedback(() => ProgramInfo.CrestronDb); EnvironmentVersionFeedback = new StringFeedback(() => ProgramInfo.Environment); AggregatedProgramInfoFeedback = new StringFeedback(() => JsonConvert.SerializeObject(ProgramInfo)); GetProgramInfo(); }
public ProgramInfoEventArgs(ProgramInfo progInfo) { ProgramInfo = progInfo; }
private void GetProgramInfo(object o) { Debug.Console(2, "Attempting to get program info for slot: {0}", Program.Number); string response = null; if (Program.RegistrationState == eProgramRegistrationState.Unregister || Program.OperatingState == eProgramOperatingState.Stop) { Debug.Console(2, "Program {0} not registered. Setting default values for program information.", Program.Number); ProgramInfo = new ProgramInfo(Program.Number) { OperatingState = Program.OperatingState, RegistrationState = Program.RegistrationState }; return; } var success = CrestronConsole.SendControlSystemCommand( string.Format("progcomments:{0}", Program.Number), ref response); if (!success) { Debug.Console(2, "Progcomments Attempt Unsuccessful for slot: {0}", Program.Number); UpdateFeedbacks(); return; } if (response.ToLower().Contains("bad or incomplete")) { Debug.Console(2, "Program in slot {0} not running. Setting default ProgramInfo for slot: {0}", Program.Number); // Assume no valid program info. Constructing a new object will wipe all properties ProgramInfo = new ProgramInfo(Program.Number) { OperatingState = Program.OperatingState, RegistrationState = Program.RegistrationState }; UpdateFeedbacks(); return; } // Shared properteis ProgramInfo.ProgramFile = ParseConsoleData(response, "Program File", ": ", "\n"); ProgramInfo.CompilerRevision = ParseConsoleData(response, "Compiler Rev", ": ", "\n"); ProgramInfo.CompileTime = ParseConsoleData(response, "Compiled On", ": ", "\n"); ProgramInfo.Include4Dat = ParseConsoleData(response, "Include4.dat", ": ", "\n"); if (ProgramInfo.ProgramFile.Contains(".dll")) { // SSP Program ProgramInfo.FriendlyName = ParseConsoleData(response, "Friendly Name", ": ", "\n"); ProgramInfo.ApplicationName = ParseConsoleData(response, "Application Name", ": ", "\n"); ProgramInfo.ProgramTool = ParseConsoleData(response, "Program Tool", ": ", "\n"); ProgramInfo.MinFirmwareVersion = ParseConsoleData(response, "Min Firmware Version", ": ", "\n"); ProgramInfo.PlugInVersion = ParseConsoleData(response, "PlugInVersion", ": ", "\n"); } else if (ProgramInfo.ProgramFile.Contains(".smw")) { // SIMPL Windows Program ProgramInfo.FriendlyName = ParseConsoleData(response, "Friendly Name", ":", "\n"); ProgramInfo.SystemName = ParseConsoleData(response, "System Name", ": ", "\n"); ProgramInfo.CrestronDb = ParseConsoleData(response, "CrestronDB", ": ", "\n"); ProgramInfo.Environment = ParseConsoleData(response, "Source Env", ": ", "\n"); ProgramInfo.Programmer = ParseConsoleData(response, "Programmer", ": ", "\n"); } Debug.Console(2, "Program info for slot {0} successfully updated", Program.Number); UpdateFeedbacks(); }
/// <summary> /// Retrieves information about a running program /// </summary> public void GetProgramInfo() { CrestronInvoke.BeginInvoke((o) => { Debug.Console(2, "Attempting to get program info for slot: {0}", Program.Number); string response = null; var success = CrestronConsole.SendControlSystemCommand(string.Format("progcomments:{0}", Program.Number), ref response); if (success) { //Debug.Console(2, "Progcomments Response: \r{0}", response); if (!response.ToLower().Contains("bad or incomplete")) { // Shared properteis ProgramInfo.ProgramFile = ParseConsoleData(response, "Program File", ": ", "\n"); ProgramInfo.CompilerRevision = ParseConsoleData(response, "Compiler Rev", ": ", "\n"); ProgramInfo.CompileTime = ParseConsoleData(response, "Compiled On", ": ", "\n"); ProgramInfo.Include4Dat = ParseConsoleData(response, "Include4.dat", ": ", "\n"); if (ProgramInfo.ProgramFile.Contains(".dll")) { // SSP Program ProgramInfo.FriendlyName = ParseConsoleData(response, "Friendly Name", ": ", "\n"); ProgramInfo.ApplicationName = ParseConsoleData(response, "Application Name", ": ", "\n"); ProgramInfo.ProgramTool = ParseConsoleData(response, "Program Tool", ": ", "\n"); ProgramInfo.MinFirmwareVersion = ParseConsoleData(response, "Min Firmware Version", ": ", "\n"); ProgramInfo.PlugInVersion = ParseConsoleData(response, "PlugInVersion", ": ", "\n"); } else if (ProgramInfo.ProgramFile.Contains(".smw")) { // SIMPL Windows Program ProgramInfo.FriendlyName = ParseConsoleData(response, "Friendly Name", ":", "\n"); ProgramInfo.SystemName = ParseConsoleData(response, "System Name", ": ", "\n"); ProgramInfo.CrestronDB = ParseConsoleData(response, "CrestronDB", ": ", "\n"); ProgramInfo.Environment = ParseConsoleData(response, "Source Env", ": ", "\n"); ProgramInfo.Programmer = ParseConsoleData(response, "Programmer", ": ", "\n"); } //Debug.Console(2, "ProgramInfo: \r{0}", JsonConvert.SerializeObject(ProgramInfo)); } else { Debug.Console(2, "Bad or incomplete console command response. Initializing ProgramInfo for slot: {0}", Program.Number); // Assume no valid program info. Constructing a new object will wipe all properties ProgramInfo = new ProgramInfo(Program.Number); ProgramInfo.OperatingState = Program.OperatingState; ProgramInfo.RegistrationState = Program.RegistrationState; } } else { Debug.Console(2, "Progcomments Attempt Unsuccessful for slot: {0}", Program.Number); } ProgramNameFeedback.FireUpdate(); ProgramCompileTimeFeedback.FireUpdate(); CrestronDataBaseVersionFeedback.FireUpdate(); EnvironmentVersionFeedback.FireUpdate(); AggregatedProgramInfoFeedback.FireUpdate(); OnProgramInfoChanged(); }); }