Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]Microwave oven control cluster implementation #30235

Merged
merged 106 commits into from
Dec 17, 2023
Merged
Show file tree
Hide file tree
Changes from 76 commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
e797ebf
Microwave oven control cluster implementation
mideayanghui Nov 6, 2023
e549dad
Restyled by whitespace
restyled-commits Nov 6, 2023
f52e507
Restyled by clang-format
restyled-commits Nov 6, 2023
d3bfd2d
updated SDK code of MicrowaveOvenControl for checking all the input v…
mideayanghui Nov 7, 2023
49b8f2a
Merge branch 'master' into sdk-microwave-1
mideayanghui Nov 7, 2023
fbc53e3
Restyled by clang-format
restyled-commits Nov 7, 2023
8d41b98
fix build err
mideayanghui Nov 7, 2023
4462ba0
Merge branch 'chip-master' into sdk-microwave-1
liangpy4 Nov 8, 2023
7e5a962
1. modified SDK and app layer for MicrowaveOvenControl Cluster to avo…
liangpy4 Nov 15, 2023
e6eb718
1. added microwave oven device app; 2. modified SDK and Application l…
liangpy4 Nov 15, 2023
61ade73
revised device classification ID in examples/microwave-oven-app/linux…
liangpy4 Nov 15, 2023
37c5c20
Merge branch 'chip-master' into sdk-microwave-1
mideayanghui Nov 15, 2023
f562d7f
updated all-cluster-app for returning original
liangpy4 Nov 15, 2023
bc7f993
updated zap&matter files for adding new updates
liangpy4 Nov 15, 2023
57ebcfa
updated the commented code for Microwave Oven Control cluster
liangpy4 Nov 15, 2023
2e95648
Merge branch 'master' into sdk-microwave-1
mideayanghui Nov 15, 2023
f0ba22b
Restyled by whitespace
restyled-commits Nov 15, 2023
93264fc
Restyled by clang-format
restyled-commits Nov 15, 2023
803a226
Restyled by prettier-json
restyled-commits Nov 15, 2023
45c84af
revised copyright and README info
liangpy4 Nov 16, 2023
94c03cf
removed 'feature map' in the zcl*.json
liangpy4 Nov 16, 2023
5ff2b2f
Merge remote-tracking branch 'origin/sdk-microwave-1' into sdk-microw…
liangpy4 Nov 16, 2023
97c6bc4
Merge branch 'chip-master' into sdk-microwave-1
liangpy4 Nov 16, 2023
d6ec9db
merge new change
mideayanghui Nov 16, 2023
2a76863
Restyled by whitespace
restyled-commits Nov 16, 2023
7a30e93
Restyled by clang-format
restyled-commits Nov 16, 2023
5968bd6
Restyled by prettier-json
restyled-commits Nov 16, 2023
dd5bf21
Restyled by prettier-markdown
restyled-commits Nov 16, 2023
98f0436
updated SDK code after reviewed
liangpy4 Nov 17, 2023
559a331
merge midea change
liangpy4 Nov 17, 2023
6e19746
merge origin chip-master
liangpy4 Nov 17, 2023
84d5352
Restyled by whitespace
restyled-commits Nov 17, 2023
0b538a7
Restyled by clang-format
restyled-commits Nov 17, 2023
1ec6564
Merge branch 'chip-master' into sdk-microwave-1
liangpy4 Nov 20, 2023
bec09f9
updated zap configuration for BASIC
liangpy4 Nov 20, 2023
a0111b7
updated microwave oven control SDK for typo
liangpy4 Nov 20, 2023
77a35c5
updated restyled
liangpy4 Nov 20, 2023
b367fb6
Restyled by whitespace
restyled-commits Nov 20, 2023
e42ede2
Restyled by clang-format
restyled-commits Nov 20, 2023
aa65b41
updated Application for microwave oven device
liangpy4 Nov 20, 2023
5b9078e
Restyled by whitespace
restyled-commits Nov 20, 2023
1eb51ef
Restyled by clang-format
restyled-commits Nov 20, 2023
4ebfff3
revised some reviewed typo
liangpy4 Nov 21, 2023
b684cca
Merge branch 'chip-master' into sdk-microwave-1
liangpy4 Nov 21, 2023
009b006
Restyled by clang-format
restyled-commits Nov 21, 2023
20f9d35
Restyled by gn
restyled-commits Nov 21, 2023
91ec757
updated App code after reviewed
liangpy4 Nov 22, 2023
d06f905
Merge branch 'chip-master' into sdk-microwave-1
liangpy4 Nov 22, 2023
9ac6d50
Restyled by whitespace
restyled-commits Nov 22, 2023
2d372a9
Restyled by clang-format
restyled-commits Nov 22, 2023
1bf0d4f
update some comment
liangpy4 Nov 22, 2023
83ea3b3
Merge branch 'chip-master' into sdk-microwave-1
liangpy4 Nov 22, 2023
4742ec6
Restyled by whitespace
restyled-commits Nov 22, 2023
ae11490
Restyled by gn
restyled-commits Nov 22, 2023
1ff3312
recover examples/build_overrides/pigweed_environment.gni
liangpy4 Nov 22, 2023
8b2e481
Restyled by gn
restyled-commits Nov 22, 2023
f386ed5
fix typos and add unique ptr to stdfunction
liangpy4 Nov 24, 2023
48f4681
update add-more-time command relative functions name
liangpy4 Nov 24, 2023
5665bc7
merge branch origin-chip/master
liangpy4 Nov 24, 2023
471a0b0
Restyled by whitespace
restyled-commits Nov 24, 2023
2c1b743
Restyled by clang-format
restyled-commits Nov 24, 2023
4bb3cac
regen microwave-oven-app.matter
liangpy4 Nov 24, 2023
2e4456c
Restyled by clang-format
restyled-commits Nov 24, 2023
b7eec4d
update add-more-time command function name
liangpy4 Nov 27, 2023
0799ef9
Merge branch 'chip-master' into sdk-microwave-1
liangpy4 Nov 27, 2023
d53aa52
Restyled by clang-format
restyled-commits Nov 27, 2023
145b077
removed mode code
liangpy4 Nov 27, 2023
2bcb9fd
fix typo in main.cpp
liangpy4 Nov 27, 2023
f24bd22
Merge branch 'chip-master' into sdk-microwave-1
liangpy4 Nov 27, 2023
5748392
update microwave oven device app and sdk
liangpy4 Nov 29, 2023
9cf9184
compiling app
liangpy4 Nov 29, 2023
8f3bac4
compling sdk
liangpy4 Nov 29, 2023
b5d680f
compiling app, sdk
liangpy4 Nov 29, 2023
f8733cd
update Microwave Oven Application and SDK code after reviewed
liangpy4 Nov 29, 2023
d4a9b56
Restyled by whitespace
restyled-commits Nov 29, 2023
9fcb147
Restyled by clang-format
restyled-commits Nov 29, 2023
50978d2
update MicrowaveOven App after reviewed
liangpy4 Nov 30, 2023
4e10a74
merge origin-chip master
liangpy4 Nov 30, 2023
764c467
Restyled by whitespace
restyled-commits Nov 30, 2023
ad5668d
Restyled by clang-format
restyled-commits Nov 30, 2023
a13dbe1
updated MicrowaveOvenControl
liangpy4 Nov 30, 2023
070468f
Restyled by whitespace
restyled-commits Nov 30, 2023
4d552d2
fix all_targets_linux_x64.txt
liangpy4 Nov 30, 2023
6f5edb4
update microwave oven app for program entry
liangpy4 Dec 4, 2023
faddc52
fix merged problems
liangpy4 Dec 4, 2023
3d9c9ca
Restyled by whitespace
restyled-commits Dec 4, 2023
3345d70
Restyled by clang-format
restyled-commits Dec 4, 2023
ec73925
move all private after public for microwave-oven-device.h
liangpy4 Dec 5, 2023
21d81ae
Merge branch 'chip-master' into sdk-microwave-1
liangpy4 Dec 5, 2023
ad8e132
Restyled by clang-format
restyled-commits Dec 5, 2023
6fce686
update microwave oven app after reviewed
liangpy4 Dec 7, 2023
29ab4cd
Restyled by whitespace
restyled-commits Dec 7, 2023
8583f0d
Restyled by clang-format
restyled-commits Dec 7, 2023
4d4995d
update microwave oven mode after reviewed
liangpy4 Dec 8, 2023
569d089
Merge branch 'chip-master' into sdk-microwave-1
liangpy4 Dec 8, 2023
bc5f868
Restyled by clang-format
restyled-commits Dec 8, 2023
cbd1fde
update microwave-oven-app.matter
liangpy4 Dec 11, 2023
f363139
Merge branch 'chip-master' into sdk-microwave-1
liangpy4 Dec 12, 2023
ec23337
regen ZAP
liangpy4 Dec 12, 2023
c6f9a0d
add api for ModeBase and updated MicrowaveOvenControl
liangpy4 Dec 15, 2023
a8d593a
Restyled by whitespace
restyled-commits Dec 15, 2023
abbbe9e
Restyled by clang-format
restyled-commits Dec 15, 2023
6ad832f
update code after reviewed
liangpy4 Dec 17, 2023
ada4dcf
Merge branch 'chip-master' into sdk-microwave-1
liangpy4 Dec 17, 2023
c90a1f3
regen ZAP
liangpy4 Dec 17, 2023
c8d83fb
Restyled by clang-format
restyled-commits Dec 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/examples/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,15 @@ smoke-co-alarm-app/**/README
dishwasher-app/**/README
```

## Microwave oven example

```{toctree}
:glob:
:maxdepth: 1

microwave-oven-app/**/README
```

## Temperature measurement example

```{toctree}
Expand Down
1 change: 0 additions & 1 deletion examples/build_overrides/pigweed_environment.gni
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@
_bootstrap_root = "//third_party/connectedhomeip"

import("${_bootstrap_root}/build_overrides/pigweed_environment.gni")

25 changes: 25 additions & 0 deletions examples/microwave-oven-app/linux/.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (c) 2023 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("//build_overrides/build.gni")

# The location of the build configuration file.
buildconfig = "${build_root}/config/BUILDCONFIG.gn"

# CHIP uses angle bracket includes.
check_system_includes = true

default_args = {
import("//args.gni")
}
51 changes: 51 additions & 0 deletions examples/microwave-oven-app/linux/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright (c) 2023 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")

config("includes") {
include_dirs = [
".",
"include",
]
}

executable("chip-microwave-oven-app") {
sources = [
"${chip_root}/examples/microwave-oven-app/microwave-oven-common/src/microwave-oven-device.cpp",
"include/CHIPProjectAppConfig.h",
"main.cpp",
]

deps = [
"${chip_root}/examples/microwave-oven-app/microwave-oven-common",
"${chip_root}/examples/platform/linux:app-main",
"${chip_root}/src/lib",
]

include_dirs = [
"include",
"${chip_root}/examples/microwave-oven-app/microwave-oven-common/include",
]
output_dir = root_out_dir
}

group("linux") {
deps = [ ":chip-microwave-oven-app" ]
}

group("default") {
deps = [ ":linux" ]
}
141 changes: 141 additions & 0 deletions examples/microwave-oven-app/linux/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# Matter Linux Microwave Oven Example

An example showing the use of Matter on the Linux. The document will describe
how to build and run Matter Linux Microwave Oven 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)**

<hr>

- [Matter Linux Microwave Oven Example](#matter-linux-microwave-oven-example)
- [Building](#building)
- [Commandline Arguments](#commandline-arguments)
- [Running the Complete Example on Raspberry Pi 4](#running-the-complete-example-on-raspberry-pi-4)
- [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/lighting-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/lighting-app/linux
$ rm -rf out/

- Build the example with pigweed RPC

$ cd ~/connectedhomeip/examples/lighting-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-device <interface id>`

Use specific bluetooth interface for BLE advertisement and connections.

`interface id`: the number after `hci` when listing BLE interfaces by
`hciconfig` command, for example, `--ble-device 1` means using `hci1`
interface. Default: `0`.

## 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 CHIP 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 device number. The
number after `hci` is the bluetooth device number, `1` in this
example.

$ hciconfig
hci1: Type: Primary Bus: USB
BD Address: 00:1A:7D:AA:BB:CC ACL MTU: 310:10 SCO MTU: 64:8
UP RUNNING PSCAN ISCAN
RX bytes:20942 acl:1023 sco:0 events:1140 errors:0
TX bytes:16559 acl:1011 sco:0 commands:121 errors:0

hci0: Type: Primary Bus: UART
BD Address: B8:27:EB:AA:BB:CC ACL MTU: 1021:8 SCO MTU: 64:1
UP RUNNING PSCAN ISCAN
RX bytes:8609495 acl:14 sco:0 events:217484 errors:0
TX bytes:92185 acl:20 sco:0 commands:5259 errors:0

- Run Linux Lighting Example App

$ cd ~/connectedhomeip/examples/lighting-app/linux
$ sudo out/debug/chip-lighting-app --ble-device [bluetooth device number]
# In this example, the device we want to use is hci1
$ sudo out/debug/chip-lighting-app --ble-device 1

- Test the device using ChipDeviceController on your laptop /
workstation etc.

## 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.Lighting.Get()`

`rpcs.chip.rpc.Lighting.Set(on=True, level=128, color=protos.chip.rpc.LightingColor(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
```
27 changes: 27 additions & 0 deletions examples/microwave-oven-app/linux/args.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright (c) 2023 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# CHIPProjectConfig.h

import("//build_overrides/chip.gni")

import("${chip_root}/config/standalone/args.gni")

chip_device_project_config_include = "<CHIPProjectAppConfig.h>"
chip_project_config_include = "<CHIPProjectAppConfig.h>"
chip_system_project_config_include = "<SystemProjectConfig.h>"

chip_project_config_include_dirs =
[ "${chip_root}/examples/microwave-oven-app/linux/include" ]
chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ]
1 change: 1 addition & 0 deletions examples/microwave-oven-app/linux/build_overrides
34 changes: 34 additions & 0 deletions examples/microwave-oven-app/linux/include/CHIPProjectAppConfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
*
* Copyright (c) 2023 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* @file
* Example project configuration file for CHIP.
*
* This is a place to put application or project-specific overrides
* to the default configuration values for general CHIP features.
*
*/

#pragma once

// include the CHIPProjectConfig from config/standalone
#include <CHIPProjectConfig.h>

#define CHIP_DEVICE_CONFIG_DEVICE_TYPE 121 // 0x0079 = 121 = Matter Microwave Oven
#define CHIP_DEVICE_CONFIG_DEVICE_NAME "Test Microwave Oven"
46 changes: 46 additions & 0 deletions examples/microwave-oven-app/linux/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
*
* Copyright (c) 2023 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "microwave-oven-device.h"
#include <AppMain.h>

using namespace chip;
using namespace chip::app;
using namespace chip::app::Clusters;

static constexpr EndpointId kMicrowaveOvenEndpointId = 1;

Platform::UniquePtr<ExampleMicrowaveOvenDevice> gMicrowaveOvenDevice;

void ApplicationInit()
{
gMicrowaveOvenDevice = Platform::MakeUnique<ExampleMicrowaveOvenDevice>(kMicrowaveOvenEndpointId);
gMicrowaveOvenDevice.get()->MicrowaveOvenInit(kMicrowaveOvenEndpointId);
}

void ApplicationShutdown() {}
fengdx4 marked this conversation as resolved.
Show resolved Hide resolved

int main(int argc, char * argv[])
{
if (ChipLinuxAppInit(argc, argv) != 0)
{
return -1;
}

ChipLinuxAppMainLoop();
return 0;
}
28 changes: 28 additions & 0 deletions examples/microwave-oven-app/microwave-oven-common/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright (c) 2020 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("//build_overrides/chip.gni")
import("${chip_root}/src/app/chip_data_model.gni")

config("config") {
include_dirs = [ "include" ]
}

chip_data_model("microwave-oven-common") {
zap_file = "microwave-oven-app.zap"

zap_pregenerated_dir =
"${chip_root}/zzz_generated/microwave-oven-app/zap-generated"
is_server = true
}
Loading