mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 05:05:00 +00:00
grammar edits
76
Debugging.md
76
Debugging.md
@@ -1,39 +1,41 @@
|
|||||||
## Methods of Debugging
|
## Methods of Debugging
|
||||||
|
|
||||||
1. You can use Visual Studio step debugging
|
1. You can use Visual Studio step debugging
|
||||||
* Pros:
|
- Pros:
|
||||||
- Detailed real time debugging into with breakpoints and object inspection
|
- Detailed real time debugging into with breakpoints and object inspection
|
||||||
* Cons:
|
- Cons:
|
||||||
- Doesn't really work remotely
|
- Doesn't really work remotely
|
||||||
- On processors with Control Subnet, you must be connected to the CS interface to use step debugging. Often not practical or possible.
|
- On processors with Control Subnet, you must be connected to the CS interface to use step debugging. Often not practical or possible.
|
||||||
- No logging
|
- No logging
|
||||||
- Using breakpoints stops the program and can interrupt system usage
|
- Using breakpoints stops the program and can interrupt system usage
|
||||||
- Requires the running application to be built in debug mode, not release mode
|
- Requires the running application to be built in debug mode, not release mode
|
||||||
2. You can use the Debug class features build into the PepperDash.Core library.
|
2. You can use the Debug class features build into the PepperDash.Core library.
|
||||||
* Pros:
|
- Pros:
|
||||||
- Can be easily enabled from console
|
- Can be easily enabled from console
|
||||||
- Allows for setting the level of verbosity
|
- Allows for setting the level of verbosity
|
||||||
- Works when troubleshooting remotely and doesn't require a connection to the CS interface of the processor.
|
- Works when troubleshooting remotely and doesn't require a connection to the CS interface of the processor.
|
||||||
- Allows for logging to the Crestron error log or a custom log stored on removable media
|
- Allows for logging to the Crestron error log or a custom log stored on removable media
|
||||||
- Works regardless of build type setting (debug/release)
|
- Works regardless of build type setting (debug/release)
|
||||||
- Can easily identify which class instance console messages are being generated by
|
- Can easily identify which class instance is generating console messages
|
||||||
- Can use console commands to view the state of public properties on devices
|
- Can use console commands to view the state of public properties on devices
|
||||||
- Can use console commands to call methods on devices
|
- Can use console commands to call methods on devices
|
||||||
- Doesn't stop the program
|
- Doesn't stop the program
|
||||||
* Cons:
|
- Cons:
|
||||||
- No detailed object inspection in real time
|
- No detailed object inspection in real time
|
||||||
- Only prints console statements already in code
|
- Only prints console statements already in code
|
||||||
- When enabled at the highest level of verbosity, it can produce a significant amount of data in console. Can be hard to find messages easily.
|
- When enabled at the highest level of verbosity, it can produce a significant amount of data in console. Can be hard to find messages easily.
|
||||||
- No current mechanism to filter messages by device. (can be filtered by 3rd party tools easily, though)
|
- No current mechanism to filter messages by device. (can be filtered by 3rd party tools easily, though)
|
||||||
- Not very effective in debugging applications running on the VC-4 platform as only log messages get printed to the Syslog
|
- Not very effective in debugging applications running on the VC-4 platform as only log messages get printed to the Syslog
|
||||||
|
|
||||||
## How to use the PepperDash.Core Debug Class
|
## How to use the PepperDash.Core Debug Class
|
||||||
|
|
||||||
The majority of interaction is done via console, preferably via an SSH session through Crestron Toolbox, PuTTy or any other suitable application.
|
The majority of interaction is done via console, preferably via an SSH session through Crestron Toolbox, PuTTy or any other suitable application.
|
||||||
|
|
||||||
In code, the most useful method is `Debug.Console()` which has several overloads. All variations take an integer value for the level (0-2) as the first argument. Level 0 will ALWAYS print. Level 1 is for typical debug messages and level 2 is for verbose debugging. In cases where the overloads that accept a `Debug.ErrorLogLevel` parameter are used, the message will ALWAYS be logged, but will only print to console if the current debug level is the same or higher than the level set in the `Debug.Console()` statement.
|
In code, the most useful method is `Debug.Console()` which has several overloads. All variations take an integer value for the level (0-2) as the first argument. Level 0 will ALWAYS print. Level 1 is for typical debug messages and level 2 is for verbose debugging. In cases where the overloads that accept a `Debug.ErrorLogLevel` parameter are used, the message will ALWAYS be logged, but will only print to console if the current debug level is the same or higher than the level set in the `Debug.Console()` statement.
|
||||||
|
|
||||||
All statements printed to console are prefixed by a timestamp which can be greatly helpful in debugging order of operations.
|
All statements printed to console are prefixed by a timestamp which can be greatly helpful in debugging order of operations.
|
||||||
|
|
||||||
``` csharp
|
```csharp
|
||||||
// The most basic use, sets the level (0) and the message to print.
|
// The most basic use, sets the level (0) and the message to print.
|
||||||
Debug.Console(0, "Hello World");
|
Debug.Console(0, "Hello World");
|
||||||
// prints: [timestamp]App 1:Hello World
|
// prints: [timestamp]App 1:Hello World
|
||||||
@@ -56,12 +58,15 @@ Debug.Console(0, Debug.ErrorLogLevel.Notice, "Hello World");
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Console Commands
|
## Console Commands
|
||||||
|
|
||||||
The following console commands all perform actions on devices that have been registered with the `PepperDash.Essentials.Core.DeviceManager` static class
|
The following console commands all perform actions on devices that have been registered with the `PepperDash.Essentials.Core.DeviceManager` static class
|
||||||
|
|
||||||
### Appdebug:[slot] [0-2]
|
### Appdebug:[slot][0-2]
|
||||||
|
|
||||||
Gets or sets the current debug level where 0 is the lowest setting and 2 is the most verbose
|
Gets or sets the current debug level where 0 is the lowest setting and 2 is the most verbose
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```
|
```
|
||||||
RMC3>appdebug:1 // Gets current level
|
RMC3>appdebug:1 // Gets current level
|
||||||
RMC3>AppDebug level = 0
|
RMC3>AppDebug level = 0
|
||||||
@@ -71,11 +76,13 @@ RMC3>[Application 1], Debug level set to 1
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Devlist:[slot]
|
### Devlist:[slot]
|
||||||
|
|
||||||
Gets the current list of devices from `DeviceManager`
|
Gets the current list of devices from `DeviceManager`
|
||||||
|
|
||||||
Prints in the form [deviceKey] deviceName
|
Prints in the form [deviceKey] deviceName
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```
|
```
|
||||||
// Get the list of devices for program 1
|
// Get the list of devices for program 1
|
||||||
RMC3>devlist:1
|
RMC3>devlist:1
|
||||||
@@ -110,10 +117,13 @@ RMC3>[16:34:05.819]App 1:28 Devices registered with Device Mangager:
|
|||||||
[16:34:05.848]App 1: [tcp-1] Generic TCP 1
|
[16:34:05.848]App 1: [tcp-1] Generic TCP 1
|
||||||
[16:34:05.849]App 1: [tcp-1-tcp]
|
[16:34:05.849]App 1: [tcp-1-tcp]
|
||||||
```
|
```
|
||||||
### Devprops:[slot] [deviceKey]
|
|
||||||
|
### Devprops:[slot][devicekey]
|
||||||
|
|
||||||
Gets the list of public properties on the device with the corresponding `deviceKey`
|
Gets the list of public properties on the device with the corresponding `deviceKey`
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```
|
```
|
||||||
// Get the properties on the device with Key 'cec-1-cec'
|
// Get the properties on the device with Key 'cec-1-cec'
|
||||||
// This device happens to be a CEC port on a DM-TX-201-C's HDMI input
|
// This device happens to be a CEC port on a DM-TX-201-C's HDMI input
|
||||||
@@ -152,10 +162,13 @@ RMC3>devprops:1 cec-1-cec
|
|||||||
RMC3>
|
RMC3>
|
||||||
|
|
||||||
```
|
```
|
||||||
### Devmethods:[slot] [deviceKey]
|
|
||||||
|
### Devmethods:[slot][devicekey]
|
||||||
|
|
||||||
Gets the list of public methods available on the device
|
Gets the list of public methods available on the device
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```
|
```
|
||||||
// Get the methods on the device with Key 'cec-1-cec'
|
// Get the methods on the device with Key 'cec-1-cec'
|
||||||
RMC3>devmethods:1 cec-1-cec
|
RMC3>devmethods:1 cec-1-cec
|
||||||
@@ -192,12 +205,15 @@ RMC3>devmethods:1 cec-1-cec
|
|||||||
|
|
||||||
RMC3>
|
RMC3>
|
||||||
```
|
```
|
||||||
### Devjson:[slot] [JSON formatted object {"deviceKey", "methodName", "params"}]
|
|
||||||
|
### Devjson:[slot][json formatted object {"devicekey", "methodname", "params"}]
|
||||||
|
|
||||||
Used in conjunction with devmethods, this command allows any of the public methods to be called from console and the appropriate arguments can be passed in to the method via a JSON object.
|
Used in conjunction with devmethods, this command allows any of the public methods to be called from console and the appropriate arguments can be passed in to the method via a JSON object.
|
||||||
|
|
||||||
This command is most useful for testing without access to hardware as it allows both simulated input and output for a device.
|
This command is most useful for testing without access to hardware as it allows both simulated input and output for a device.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```
|
```
|
||||||
// This command will call the SendText(string text) method on the
|
// This command will call the SendText(string text) method on the
|
||||||
// device with the Key 'cec-1-cec' and pass in "hello world" as the
|
// device with the Key 'cec-1-cec' and pass in "hello world" as the
|
||||||
|
|||||||
Reference in New Issue
Block a user