forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Linux] Matter Linux Water Leak Detector Example (project-chip#35392)
* [Linux] Matter Linux Water Leak Detector Example * Update README.md Remote Echo protocol section * Update water-leak-detector-app.zap * Symlinks * New sym links * Update README.md Fix typo * Create water-leak-detector-app.matter * Update water-leak-detector-app.matter Remove last line * Update README.md * Update water-leak-detector-app.matter * Update water-leak-detector-app.zap * Update water-leak-detector-app.matter * Update water-leak-detector-app.zap * Update water-leak-detector-app.matter * Delete examples/water-leak-detector-app/linux/README.md * Update targets.py to add WATER_LEAK_DETECTOR * Update host.py to add WATER_LEAK_DETECTOR * Update water-leak-detector-app.matter Fix ThreeLevelAutoEnum * Update all_targets_linux_x64.txt Add water-leak-detector
- Loading branch information
Showing
13 changed files
with
5,415 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright (c) 2024 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") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Copyright (c) 2024 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}/build/chip/tools.gni") | ||
import("${chip_root}/src/app/common_flags.gni") | ||
import("${chip_root}/third_party/imgui/imgui.gni") | ||
|
||
assert(chip_build_tools) | ||
|
||
config("includes") { | ||
include_dirs = [ | ||
".", | ||
"include", | ||
] | ||
} | ||
|
||
executable("water-leak-detector-app") { | ||
sources = [ | ||
"include/CHIPProjectAppConfig.h", | ||
"main.cpp", | ||
] | ||
|
||
deps = [ | ||
"${chip_root}/examples/platform/linux:app-main", | ||
"${chip_root}/examples/water-leak-detector-app/water-leak-detector-common", | ||
"${chip_root}/src/lib", | ||
] | ||
|
||
if (chip_examples_enable_imgui_ui) { | ||
deps += [ | ||
"${chip_root}/examples/common/imgui_ui", | ||
"${chip_root}/examples/common/imgui_ui/windows:boolean_state", | ||
"${chip_root}/examples/common/imgui_ui/windows:occupancy_sensing", | ||
"${chip_root}/examples/common/imgui_ui/windows:qrcode", | ||
] | ||
} | ||
|
||
include_dirs = [ "include" ] | ||
|
||
cflags = [ "-Wconversion" ] | ||
|
||
output_dir = root_out_dir | ||
} | ||
|
||
group("linux") { | ||
deps = [ ":water-leak-detector-app" ] | ||
} | ||
|
||
group("default") { | ||
deps = [ ":linux" ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright (c) 2024 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/water-leak-detector-app/linux/include" ] | ||
chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] | ||
matter_enable_tracing_support = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../build_overrides |
39 changes: 39 additions & 0 deletions
39
examples/water-leak-detector-app/linux/include/CHIPProjectAppConfig.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* | ||
* Copyright (c) 2024 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. | ||
*/ | ||
|
||
#pragma once | ||
|
||
// include the CHIPProjectConfig from config/standalone | ||
#include <CHIPProjectConfig.h> | ||
|
||
#define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY 0 | ||
|
||
// Bulbs do not typically use this - enabled so we can use shell to discover commissioners | ||
#define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT 1 | ||
|
||
#define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1 | ||
|
||
#define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DEVICE_TYPE 1 | ||
|
||
#define CHIP_DEVICE_CONFIG_DEVICE_TYPE 0x0043 // Water Leak Detector | ||
|
||
#define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DEVICE_NAME 1 | ||
|
||
#define CHIP_DEVICE_ENABLE_PORT_PARAMS 1 | ||
|
||
#define CHIP_DEVICE_CONFIG_DEVICE_NAME "Water Leak Detector" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* | ||
* Copyright (c) 2024 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 <AppMain.h> | ||
#include <platform/CHIPDeviceConfig.h> | ||
|
||
#if defined(CHIP_IMGUI_ENABLED) && CHIP_IMGUI_ENABLED | ||
#include <imgui_ui/ui.h> | ||
#include <imgui_ui/windows/boolean_state.h> | ||
#include <imgui_ui/windows/occupancy_sensing.h> | ||
#include <imgui_ui/windows/qrcode.h> | ||
#endif | ||
|
||
using namespace chip; | ||
using namespace chip::app; | ||
using namespace chip::app::Clusters; | ||
|
||
void ApplicationInit() {} | ||
|
||
void ApplicationShutdown() {} | ||
|
||
int main(int argc, char * argv[]) | ||
{ | ||
VerifyOrDie(ChipLinuxAppInit(argc, argv) == 0); | ||
|
||
#if defined(CHIP_IMGUI_ENABLED) && CHIP_IMGUI_ENABLED | ||
example::Ui::ImguiUi ui; | ||
|
||
ui.AddWindow(std::make_unique<example::Ui::Windows::QRCode>()); | ||
ui.AddWindow(std::make_unique<example::Ui::Windows::BooleanState>(chip::EndpointId(1), "Water Leak Detector")); | ||
|
||
ChipLinuxAppMainLoop(&ui); | ||
#else | ||
ChipLinuxAppMainLoop(); | ||
#endif | ||
|
||
return 0; | ||
} |
1 change: 1 addition & 0 deletions
1
examples/water-leak-detector-app/linux/third_party/connectedhomeip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../.. |
21 changes: 21 additions & 0 deletions
21
examples/water-leak-detector-app/water-leak-detector-common/BUILD.gn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright (c) 2024 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") | ||
|
||
chip_data_model("water-leak-detector-common") { | ||
zap_file = "water-leak-detector-app.zap" | ||
is_server = true | ||
} |
Oops, something went wrong.