blob: 063497e511de7331666d4b9386e9cb8e816928aa [file] [log] [blame] [view]
# Matter Linux Dishwasher Example
An example showing the use of Matter on the Linux. The document will describe
how to build and run Matter Linux Dishwasher Example on Raspberry Pi. This doc
is tested on **Ubuntu for Raspberry Pi Server 20.04 LTS (aarch64)** and **Ubuntu
for Raspberry Pi Desktop 20.10 (aarch64)**
To cross-compile this example on x64 host and run on **NXP i.MX 8M Mini**
**EVK**, see the associated
[README document](../../../docs/platforms/nxp/nxp_imx8m_linux_examples.md) for
details.
<hr>
- [Matter Linux Dishwasher Example](#matter-linux-dishwasher-example)
- [Building](#building)
- [Commandline arguments](#commandline-arguments)
- [Running the Complete Example on Raspberry Pi 4](#running-the-complete-example-on-raspberry-pi-4)
- [Control](#control)
- [Running RPC Console](#running-rpc-console)
- [Device Tracing](#device-tracing)
<hr>
## Building
- Install tool chain
$ sudo apt-get install git gcc g++ python pkg-config libssl-dev libdbus-1-dev libglib2.0-dev ninja-build python3-venv python3-dev unzip
- Build the example application:
$ cd ~/connectedhomeip/examples/dishwasher-app/linux
$ git submodule update --init
$ source third_party/connectedhomeip/scripts/activate.sh
$ gn gen out/debug
$ ninja -C out/debug
- To delete generated executable, libraries and object files use:
$ cd ~/connectedhomeip/examples/dishwasher-app/linux
$ rm -rf out/
- Build the example with pigweed RPC
$ cd ~/connectedhomeip/examples/dishwasher-app/linux
$ git submodule update --init
$ source third_party/connectedhomeip/scripts/activate.sh
$ gn gen out/debug --args='import("//with_pw_rpc.gni")'
$ ninja -C out/debug
## Commandline arguments
- `--wifi`
Enables WiFi management feature. Required for WiFi commissioning.
- `--thread`
Enables Thread management feature, requires ot-br-posix dbus daemon running.
Required for Thread commissioning.
- `--ble-controller <selector>`
Use the specific Bluetooth controller for BLE advertisement and connections.
For details on controller selection refer to
[Linux BLE Settings](/platforms/linux/ble_settings.md).
## Running the Complete Example on Raspberry Pi 4
> If you want to test Echo protocol, please enable Echo handler
>
> gn gen out/debug --args='chip_app_use_echo=true'
> ninja -C out/debug
- Prerequisites
1. A Raspberry Pi 4 board
2. A USB Bluetooth Dongle, Ubuntu desktop will send Bluetooth advertisement,
which will block Matter from connecting via BLE. On Ubuntu server, you
need to install `pi-bluetooth` via APT.
3. Ubuntu 20.04 or newer image for ARM64 platform.
- Building
Follow [Building](#building) section of this document.
- Running
- [Optional] Plug USB Bluetooth dongle
- Plug USB Bluetooth dongle and find its bluetooth controller selector
as described in
[Linux BLE Settings](/platforms/linux/ble_settings.md).
- Run Linux Dishwasher Example App
$ cd ~/connectedhomeip/examples/dishwasher-app/linux
$ sudo out/debug/chip-dishwasher-app --ble-controller [bluetooth controller number]
# In this example, the device we want to use is hci1
$ sudo out/debug/chip-dishwasher-app --ble-controller 1
- Test the device using ChipDeviceController on your laptop / workstation
etc.
## Control
Control the operational mode:
```
$ chip-tool operationalstate start <node_id> <endpoint>
$ chip-tool operationalstate stop <node_id> <endpoint>
$ chip-tool operationalstate pause <node_id> <endpoint>
$ chip-tool operationalstate start 1 1
$ chip-tool operationalstate stop 1 1
$ chip-tool operationalstate pause 1 1
```
## Running RPC Console
- As part of building the example with RPCs enabled the chip_rpc python
interactive console is installed into your venv. The python wheel files are
also created in the output folder: out/debug/chip_rpc_console_wheels. To
install the wheel files without rebuilding:
`pip3 install out/debug/chip_rpc_console_wheels/*.whl`
- To use the chip-rpc console after it has been installed run:
`chip-console -s localhost:33000 -o /<YourFolder>/pw_log.out`
- Then you can Get and Set the light using the RPCs:
`rpcs.chip.rpc.Dishwasher.Get()`
`rpcs.chip.rpc.Dishwasher.Set(on=True, level=128, color=protos.chip.rpc.DishwasherColor(hue=5, saturation=5))`
## Device Tracing
Device tracing is available to analyze the device performance. To turn on
tracing, build with RPC enabled. See [Building with RPC enabled](#building).
Obtain tracing json file.
```
$ ./{PIGWEED_REPO}/pw_trace_tokenized/py/pw_trace_tokenized/get_trace.py -s localhost:33000 \
-o {OUTPUT_FILE} -t {ELF_FILE} {PIGWEED_REPO}/pw_trace_tokenized/pw_trace_protos/trace_rpc.proto
```