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; } public static uint Level { get; private set; }
/// <summary> /// <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> /// </summary>
public static void Initialize() public static void Initialize()
{ {
// Add command to console if (CrestronEnvironment.RuntimeEnvironment == eRuntimeEnvironment.SimplSharpPro)
CrestronConsole.AddNewConsoleCommand(SetDebugFromConsole, "appdebug", {
"appdebug:P [0-2]: Sets the application's console debug message level", // Add command to console
ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(SetDebugFromConsole, "appdebug",
"appdebug:P [0-2]: Sets the application's console debug message level",
ConsoleAccessLevelEnum.AccessOperator);
uint level = 0; uint level = 0;
var err = CrestronDataStoreStatic.GetGlobalUintValue("DebugLevel", out level); var err = CrestronDataStoreStatic.GetGlobalUintValue("DebugLevel", out level);
if (err == CrestronDataStore.CDS_ERROR.CDS_SUCCESS) if (err == CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
SetDebugLevel(level); SetDebugLevel(level);
else if (err == CrestronDataStore.CDS_ERROR.CDS_RECORD_NOT_FOUND) else if (err == CrestronDataStore.CDS_ERROR.CDS_RECORD_NOT_FOUND)
CrestronDataStoreStatic.SetGlobalUintValue("DebugLevel", 0); CrestronDataStoreStatic.SetGlobalUintValue("DebugLevel", 0);
else else
CrestronConsole.PrintLine("Error restoring console debug level setting: {0}", err); CrestronConsole.PrintLine("Error restoring console debug level setting: {0}", err);
}
} }
/// <summary> /// <summary>
@@ -62,12 +66,15 @@ namespace PepperDash.Core
{ {
if (level <= 2) if (level <= 2)
{ {
Level = 2; Level = level;
CrestronConsole.PrintLine("[Application {0}], Debug level set to {1}", CrestronConsole.PrintLine("[Application {0}], Debug level set to {1}",
InitialParametersClass.ApplicationNumber, level); InitialParametersClass.ApplicationNumber, Level);
var err = CrestronDataStoreStatic.SetGlobalUintValue("DebugLevel", level); if (CrestronEnvironment.RuntimeEnvironment == eRuntimeEnvironment.SimplSharpPro)
if(err != CrestronDataStore.CDS_ERROR.CDS_SUCCESS) {
CrestronConsole.PrintLine("Error saving console debug level setting: {0}", err); 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 /> <Programmer />
<ArchiveFilename>C:\Users\hvolm\Desktop\working\pepperdash-simplsharp-core\Pepperdash Core\Pepperdash Core\bin\PepperDash_Core.clz</ArchiveFilename> <ArchiveFilename>C:\Users\hvolm\Desktop\working\pepperdash-simplsharp-core\Pepperdash Core\Pepperdash Core\bin\PepperDash_Core.clz</ArchiveFilename>
<MinFirmwareVersion>1.007.0017</MinFirmwareVersion> <MinFirmwareVersion>1.007.0017</MinFirmwareVersion>
<CompiledOn>6/16/2016 10:11:07 AM</CompiledOn> <CompiledOn>6/17/2016 10:42:36 AM</CompiledOn>
<AdditionalInfo /> <AdditionalInfo />
<EmbedSourceArchive>False</EmbedSourceArchive> <EmbedSourceArchive>False</EmbedSourceArchive>
<CopyTo /> <CopyTo />

View File

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

View File

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