Skip to content

Commit 9b6bb5b

Browse files
authored
Documentation: Building your first example (#33536)
* Documentation: Add MD version of webinar Adds a slightly cleaned up version of the quick start guide webinar section 1 as a quick start guide. The old quick start is quite out of date, we should consider removing that and using this as a replacement. NOTE: Still need to hook in the indexes, and determin what to do with the current quick start file (move this and replace?) * add to index * fix ref * md files hate braces
1 parent dd55376 commit 9b6bb5b

File tree

2 files changed

+124
-0
lines changed

2 files changed

+124
-0
lines changed

docs/getting_started/first_example.md

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# An SDK example
2+
3+
The SDK provides a number of example devices and controllers that can be used to
4+
familiarize yourself with the SDK and the Matter ecosystem.
5+
6+
## Example Devices
7+
8+
The example devices (occasionally referred to as "apps") are located in the
9+
[examples](../../examples/) directory. The examples often implement one
10+
particular device type. Some have implementations for various platforms.
11+
12+
The linux platform examples are provided as examples, and are used in the CI.
13+
These can be used for preliminary testing.
14+
15+
The all-clusters-app is used by the QA team for testing. This app implements
16+
nearly all the available clusters and does not conform to a specific device
17+
type. This app is not a good starting place for product development.
18+
19+
## Example Controllers
20+
21+
The SDK has two example controllers that can be used to interact with devices
22+
for testing.
23+
24+
[chip-tool](../../examples/chip-tool/) is a C++ command line controller with an
25+
interactive shell. More information on chip-tool can be found in the
26+
[chip-tool guide](../guides/chip_tool_guide.md).
27+
28+
[chip-repl](../../src/controller/python/chip-repl.py) is a shell for the python
29+
controller. The chip-repl is part of the python controller framework, often used
30+
for testing. More information about the python controller can be found in the
31+
[python testing](../testing/python.md) documentation.
32+
33+
## Building your first demo app (lighting)
34+
35+
The examples directory contains a set of apps using an example device
36+
composition \.zap file. For more information about device composition and zap,
37+
see [ZAP documentation](./zap.md).
38+
39+
This quick start guide will walk you through
40+
41+
- Building an app (lighting app) for the host platform
42+
- Interacting with the app using chip\-tool \(controller\)
43+
44+
### Building the lighting app
45+
46+
- Install prerequisites from docs/guides/BUILDING\.md
47+
- Run bootstrap or activate to install all the required tools etc.
48+
- `. scripts/bootstrap.sh` \- run this first\, or if builds fail
49+
- `. scripts/activate.sh` \- faster\, use if you’ve already bootstrapped
50+
and are just starting a new terminal
51+
52+
The build system we use is Ninja / GN. You can use a standard gn gen / ninja to
53+
build as normal, or use the scripts to build specific variants. More information
54+
about the build system can be found at [BUILDING.md](../guides/BUILDING.md). The
55+
official quickstart guide for the build system is located ag
56+
https://gn.googlesource.com/gn/+/master/docs/quick_start.md and a full reference
57+
can be found at https://gn.googlesource.com/gn/+/main/docs/reference.md.
58+
59+
To build with the scripts, use scripts/build/build_examples\.py -
60+
`scripts/build/build_examples.py targets` -
61+
`scripts/build/build_examples.py --target <your target> build` - builds to
62+
`out/<target_name>/`
63+
64+
Scripts can be used to build both the lighting app and chip tool
65+
66+
- Lighting app \(device\)
67+
- `./scripts/build/build_examples.py --target linux-x64-light-no-ble build`
68+
- This will build an executable to
69+
`./out/linux-x64-light-no-ble/chip-lighting-app`
70+
71+
* NOTE that the host name (linux-x64 here) may be different on different
72+
systems ex. darwin
73+
74+
- chip-tool (controller)
75+
- `./scripts/build/build_examples.py --target linux-x64-chip-tool build`
76+
- This will build an executable to `./out/linux-x64-chip-tool/chip-tool`
77+
78+
### Building / Interacting with Matter Examples
79+
80+
The first thing you need to do is to commission the device. First start up the
81+
app in one terminal. By default it will start up with the default discriminator
82+
(3840) and passcode (20202021) and save its non-volatile information in a KVS in
83+
/temp/chip_kvs. You can change these, and multiple other options on the command
84+
line. For a full description, use the `--help` command.
85+
86+
Start the lighting app in one terminal using
87+
88+
`./out/linux-x64-light-no-ble/chip-lighting-app`
89+
90+
The lighting app will print out all its setup information. You can get the setup
91+
codes, discriminator and passcode from the logs.
92+
93+
Open a new terminal to use chip tool. Commission the device using:
94+
95+
`./out/linux-x64-chip-tool/chip-tool pairing code 0x12344321 MT:-24J0AFN00KA0648G0`
96+
97+
NOTE: pairing is the old name for commissioning. 0x12344321 is the node ID you
98+
want to assign to the node. 0x12344321 is the default for testing.
99+
MT:-24J0AFN00KA0648G0 is the QR code for a device with the default discriminator
100+
and passcode. If you have changed these, the code will be different.
101+
102+
#### Basic device interactions - Sending a command
103+
104+
`./chip-tool onoff on 0x12344321 1`
105+
106+
where:
107+
108+
- onoff is the cluster name
109+
- on is the command name
110+
- 0x12344321 is the node ID you used for commissioning
111+
- 1 is the endpoint
112+
113+
#### Basic device interactions - Reading an attribute
114+
115+
`./chip-tool onoff read on-off 0x12344321 1`
116+
117+
where:
118+
119+
- onoff is the cluster name
120+
- read is the desired action
121+
- on is the attribute name
122+
- 0x12344321 is the node ID you used for commissioning
123+
- 1 is the endpoint

docs/getting_started/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The following docs are a brief introduction to SDK development.
1111
1212
```
1313

14+
- [Running your first example](./first_example.md)
1415
- [SDK Basics](./SDKBasics.md)
1516
- [ZAP](./zap.md)
1617
- [Discover from a host computer](./discovery_from_a_host_computer.md)

0 commit comments

Comments
 (0)