# Factory Diagnostics - Thread Stack

# Factory Diagnostics - Thread Stack

This module includes functions that control the Thread stack's execution.

## Summary

| ### Typedefs ||
|---|---|
| `https://openthread.io/reference/group/api-factory-diagnostics#group__api-factory-diagnostics_1ga877f914ac9866e64001d0c0b2026389d` | typedef `https://openthread.io/reference/group/plat-factory-diagnostics#group__plat-factory-diagnostics_1gab725003cfb10ba112b78ab1dc71e53eb` |

| ### Functions ||
|---|---|
| `https://openthread.io/reference/group/api-factory-diagnostics#group__api-factory-diagnostics_1ga3df17ad10cad3cd8973007d94e026ded(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `bool` Indicates whether or not the factory diagnostics mode is enabled. |
| `https://openthread.io/reference/group/api-factory-diagnostics#group__api-factory-diagnostics_1ga2607e0aef9cc144d8ab1b2d0073cce96(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint8_t aArgsLength, char *aArgs[])` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Processes a factory diagnostics command line. |
| `https://openthread.io/reference/group/api-factory-diagnostics#group__api-factory-diagnostics_1gae55828f1f4460efc99b99d947c9228c4(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const char *aString)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Processes a factory diagnostics command line. |
| `https://openthread.io/reference/group/api-factory-diagnostics#group__api-factory-diagnostics_1ga1e7505ea2f3021f21ccbaeca4a7aac5b(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/group/api-factory-diagnostics#group__api-factory-diagnostics_1ga877f914ac9866e64001d0c0b2026389d aCallback, void *aContext)` | `void` Sets the diag output callback. |

## Typedefs

### otDiagOutputCallback

```
otPlatDiagOutputCallback otDiagOutputCallback
```

## Functions

### otDiagIsEnabled

```
bool otDiagIsEnabled(
  otInstance *aInstance
)
```
Indicates whether or not the factory diagnostics mode is enabled.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | |
| Return Values | |---|---| | `TRUE` | if factory diagnostics mode is enabled | | `FALSE` | if factory diagnostics mode is disabled. | |

### otDiagProcessCmd

```
otError otDiagProcessCmd(
  otInstance *aInstance,
  uint8_t aArgsLength,
  char *aArgs[]
)
```
Processes a factory diagnostics command line.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aArgsLength` | The number of elements in `aArgs`. | | `[in] aArgs` | An array of arguments. | |
| Return Values | |---|---| | `OT_ERROR_INVALID_ARGS` | The command is supported but invalid arguments provided. | | `OT_ERROR_NONE` | The command is successfully process. | | `OT_ERROR_NOT_IMPLEMENTED` | The command is not supported. | |

### otDiagProcessCmdLine

```
otError otDiagProcessCmdLine(
  otInstance *aInstance,
  const char *aString
)
```
Processes a factory diagnostics command line.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aString` | A NULL-terminated input string. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | The command is successfully process. | | `OT_ERROR_INVALID_ARGS` | The command is supported but invalid arguments provided. | | `OT_ERROR_NOT_IMPLEMENTED` | The command is not supported. | | `OT_ERROR_NO_BUFS` | The command string is too long. | |

### otDiagSetOutputCallback

```
void otDiagSetOutputCallback(
  otInstance *aInstance,
  otDiagOutputCallback aCallback,
  void *aContext
)
```
Sets the diag output callback.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance structure. | | `[in] aCallback` | A pointer to a function that is called on outputting diag messages. | | `[in] aContext` | A pointer to the user context. | |

## Resources

OpenThread API Reference topics originate from the source code, available
on [GitHub](https://github.com/openthread/openthread/tree/main/include/openthread).
For more information, or to contribute to our documentation, refer to
[Resources](https://openthread.io/resources).