debug
The sos.management.debug
API groups together methods for working with native debug mode.
Some modern systems might require additional steps to enable the native debug mode. Please refer to the native debug documentation for more information.
Debug Management Capabilities
Capability | Description |
---|---|
SET_DEBUG | If the device can enable or disable the native debug mode. |
If you want to check if the device supports this capability, use sos.management.supports()
.
Methods
disable()
The enable()
method disables the native debug mode.
disable(): Promise<void>;
Return value
A promise that resolves when the debug mode is disabled.
Example
await sos.management.debug.disable();
enable()
The enable()
method enables the native debug mode.
enable(): Promise<void>;
Return value
A promise that resolves when the debug mode is enabled.
Example
await sos.management.debug.enable();
isEnabled()
The isEnabled()
method returns whether the native debug mode is enabled.
isEnabled(): Promise<boolean>;
Return value
A promise that resolves to true
if the debug mode is enabled, otherwise false
.
Example
const isDebugEnabled = await sos.management.debug.isEnabled();
console.log(`Native debug mode is ${isDebugEnabled ? 'enabled' : 'disabled'}.`);
setDebug()
The setDebug(enabled)
method sets the native debug mode to the specified state.
setDebug(enabled: boolean): Promise<void>;
Params
Name | Type | Required | Description |
---|---|---|---|
enabled | boolean | Yes | true to enable the debug mode, false to disable it. |
Return value
A promise that resolves when the debug mode is set.
Possible errors
If the enabled
parameter is not a boolean.
Example
const enabled = await sos.management.debug.isEnabled();
if (!enabled) {
await sos.management.debug.setDebug(true);
}