Fixed problems with Debug, and protected some SSP-only things from running in Simpl

This commit is contained in:
Heath Volmer
2016-06-17 12:29:09 -06:00
parent 84ef279167
commit 1ee963afe7
6 changed files with 29 additions and 22 deletions

View File

@@ -13,23 +13,27 @@ namespace PepperDash.Core
public static uint Level { get; private set; }
/// <summary>
/// This should called from the ControlSystem Initiailize method.
/// This should called from the ControlSystem Initiailize method. It is only valid
/// in #pro environments because of direct console access and CrestronDataStoreStatic
/// </summary>
public static void Initialize()
{
// Add command to console
CrestronConsole.AddNewConsoleCommand(SetDebugFromConsole, "appdebug",
"appdebug:P [0-2]: Sets the application's console debug message level",
ConsoleAccessLevelEnum.AccessOperator);
if (CrestronEnvironment.RuntimeEnvironment == eRuntimeEnvironment.SimplSharpPro)
{
// Add command to console
CrestronConsole.AddNewConsoleCommand(SetDebugFromConsole, "appdebug",
"appdebug:P [0-2]: Sets the application's console debug message level",
ConsoleAccessLevelEnum.AccessOperator);
uint level = 0;
var err = CrestronDataStoreStatic.GetGlobalUintValue("DebugLevel", out level);
if (err == CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
SetDebugLevel(level);
else if (err == CrestronDataStore.CDS_ERROR.CDS_RECORD_NOT_FOUND)
CrestronDataStoreStatic.SetGlobalUintValue("DebugLevel", 0);
else
CrestronConsole.PrintLine("Error restoring console debug level setting: {0}", err);
uint level = 0;
var err = CrestronDataStoreStatic.GetGlobalUintValue("DebugLevel", out level);
if (err == CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
SetDebugLevel(level);
else if (err == CrestronDataStore.CDS_ERROR.CDS_RECORD_NOT_FOUND)
CrestronDataStoreStatic.SetGlobalUintValue("DebugLevel", 0);
else
CrestronConsole.PrintLine("Error restoring console debug level setting: {0}", err);
}
}
/// <summary>
@@ -62,12 +66,15 @@ namespace PepperDash.Core
{
if (level <= 2)
{
Level = 2;
Level = level;
CrestronConsole.PrintLine("[Application {0}], Debug level set to {1}",
InitialParametersClass.ApplicationNumber, level);
var err = CrestronDataStoreStatic.SetGlobalUintValue("DebugLevel", level);
if(err != CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
CrestronConsole.PrintLine("Error saving console debug level setting: {0}", err);
InitialParametersClass.ApplicationNumber, Level);
if (CrestronEnvironment.RuntimeEnvironment == eRuntimeEnvironment.SimplSharpPro)
{
var err = CrestronDataStoreStatic.SetGlobalUintValue("DebugLevel", level);
if (err != CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
CrestronConsole.PrintLine("Error saving console debug level setting: {0}", err);
}
}
}

View File

@@ -80,7 +80,7 @@
<Programmer />
<ArchiveFilename>C:\Users\hvolm\Desktop\working\pepperdash-simplsharp-core\Pepperdash Core\Pepperdash Core\bin\PepperDash_Core.clz</ArchiveFilename>
<MinFirmwareVersion>1.007.0017</MinFirmwareVersion>
<CompiledOn>6/16/2016 10:11:07 AM</CompiledOn>
<CompiledOn>6/17/2016 10:42:36 AM</CompiledOn>
<AdditionalInfo />
<EmbedSourceArchive>False</EmbedSourceArchive>
<CopyTo />

View File

@@ -10,7 +10,7 @@
<ArchiveName />
</RequiredInfo>
<OptionalInfo>
<CompiledOn>6/16/2016 10:11:07 AM</CompiledOn>
<CompilerRev>1.0.0.16532</CompilerRev>
<CompiledOn>6/17/2016 10:42:36 AM</CompiledOn>
<CompilerRev>1.0.0.17477</CompilerRev>
</OptionalInfo>
</ProgramInfo>

View File

@@ -1,4 +1,4 @@
MainAssembly=PepperDash_Core.dll:7798e05e669cbd100fa392d2c0515bfd
MainAssembly=PepperDash_Core.dll:2aa20b6ac2f133d96f5ebf4bd3388e0f
MainAssemblyMinFirmwareVersion=1.007.0017
ü
DependencySource=Newtonsoft.Json.Compact.dll:ea996aa2ec65aa1878e7c9d09e37a896