[![OT RCP Architecture](https://openthread.io/static/platforms/images/ot-arch-rcp-vert.png)](https://openthread.io/static/platforms/images/ot-arch-controller-vert_2x.png)

OpenThread Daemon (OT Daemon) is an OpenThread POSIX build mode that runs
OpenThread as a service. It uses a UNIX socket as input and output, to which
clients can connect and communicate using the OpenThread CLI as a protocol.

OT Daemon is used in the Radio Co-Processor (RCP) design. It is included with
OpenThread at [`/src/posix`](https://github.com/openthread/openthread/tree/master/src/posix).

## Build

To build the OT Daemon binary, run the `cmake-build` script and use the
`OT_DAEMON` switch with the POSIX build:

    ./script/bootstrap
    ./script/cmake-build posix -DOT_DAEMON=ON

## Connect

Once built, connect it to an OpenThread node.

Simulated node:

    ./build/posix/src/posix/ot-daemon 'spinel+hdlc+forkpty://output/simulation/bin/ot-rcp?forkpty-arg=1'

Real node located at `/dev/ttyACM0`:

    ./build/posix/src/posix/ot-daemon 'spinel+hdlc+uart:///dev/ttyACM0?uart-baudrate=115200'

## Control

While an instance of OT Daemon is running, use the built-in controller to manage
the connected node:

    ./build/posix/src/posix/ot-ctl

This opens the OpenThread command line, which you can use as normal.

Alternatively, you can issue OpenThread CLI commands directly from the command
line, using the `ot-ctl` binary:

    sudo ot-ctl state

## Codelabs

To learn more about how to use OT Daemon, see our Simulation Codelabs:

[Try the Simulation Codelab with
Docker](https://codelabs.developers.google.com/codelabs/openthread-simulation/)
[Try the Simulation Codelab
with build toolchain](https://codelabs.developers.google.com/codelabs/openthread-simulation-posix/)