Skip to content

Commit

Permalink
fix(doc): documentation format
Browse files Browse the repository at this point in the history
  • Loading branch information
SuGlider committed Jun 24, 2024
1 parent 6b0b9af commit 4ec1397
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions libraries/OpenThread/helper_functions.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# OpenThread Helper Functions and Types

The following helper functions and types are designed to simplify writing Arduino sketches for OpenThread. They provide useful utilities for managing OpenThread stack behavior and interacting with the Thread network.
The following helper functions and types are designed to simplify writing Arduino sketches for OpenThread.\
They provide useful utilities for managing OpenThread stack behavior and interacting with the Thread network.

## Enumerated Type: `ot_device_role_t`
### Enumerated Type: `ot_device_role_t`

This enumeration defines the possible roles of a Thread device within the network:

Expand All @@ -12,46 +13,46 @@ This enumeration defines the possible roles of a Thread device within the networ
- `OT_ROLE_ROUTER`: The device operates as a Thread Router.
- `OT_ROLE_LEADER`: The device operates as a Thread Leader.

## Struct: `ot_cmd_return_t`
### Struct: `ot_cmd_return_t`

This structure represents the return status of an OpenThread CLI command:

- `errorCode`: An integer representing the error code (if any).
- `errorMessage`: A string containing an error message (if applicable).

## Function: `otGetDeviceRole()`
### Function: `otGetDeviceRole()`

- Returns the current role of the device as an `ot_device_role_t` value.

## Function: `otGetStringDeviceRole()`
### Function: `otGetStringDeviceRole()`

- Returns a human-readable string representation of the device role (e.g., "Child," "Router," etc.).

## Function: `otGetRespCmd(const char* cmd, char* resp = NULL, uint32_t respTimeout = 5000)`
### Function: `otGetRespCmd(const char* cmd, char* resp = NULL, uint32_t respTimeout = 5000)`

- Executes an OpenThread CLI command and retrieves the response.
- Parameters:
- `cmd`: The OpenThread CLI command to execute.
- `resp`: Optional buffer to store the response (if provided).
- `respTimeout`: Timeout (in milliseconds) for waiting for the response.

## Function: `otExecCommand(const char* cmd, const char* arg, ot_cmd_return_t* returnCode = NULL)`
### Function: `otExecCommand(const char* cmd, const char* arg, ot_cmd_return_t* returnCode = NULL)`

- Executes an OpenThread CLI command with an argument.
- Parameters:
- `cmd`: The OpenThread CLI command to execute.
- `arg`: The argument for the command.
- `returnCode`: Optional pointer to an `ot_cmd_return_t` structure to store the return status.

## Function: `otPrintRespCLI(const char* cmd, Stream& output, uint32_t respTimeout)`
### Function: `otPrintRespCLI(const char* cmd, Stream& output, uint32_t respTimeout)`

- Executes an OpenThread CLI command and prints the response to the specified output stream.
- Parameters:
- `cmd`: The OpenThread CLI command to execute.
- `output`: The output stream (e.g., Serial) to print the response.
- `respTimeout`: Timeout (in milliseconds) for waiting for the response.

## Function: `otPrintNetworkInformation(Stream& output)`
### Function: `otPrintNetworkInformation(Stream& output)`

- Prints information about the current Thread network to the specified output stream.
- Parameters:
Expand Down

0 comments on commit 4ec1397

Please sign in to comment.