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

[Linux] Matter Linux Water Leak Detector Example #35392

Merged
merged 25 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
da2152d
[Linux] Matter Linux Water Leak Detector Example
lboue Sep 4, 2024
c566aa8
Update README.md
lboue Sep 4, 2024
4026aa0
Update water-leak-detector-app.zap
lboue Sep 4, 2024
ec2af87
Symlinks
lboue Sep 4, 2024
e22d4c3
New sym links
lboue Sep 4, 2024
1882b76
Update README.md
lboue Sep 4, 2024
abc1ab4
Create water-leak-detector-app.matter
lboue Sep 4, 2024
355db35
Update water-leak-detector-app.matter
lboue Sep 4, 2024
42d21b4
Update README.md
lboue Sep 4, 2024
589d906
Update water-leak-detector-app.matter
lboue Sep 4, 2024
0b1e3f9
Update water-leak-detector-app.zap
lboue Sep 4, 2024
b451013
Update water-leak-detector-app.matter
lboue Sep 4, 2024
c20cfab
Merge branch 'master' into Linux_WLD
lboue Sep 5, 2024
31bc082
Merge branch 'master' into Linux_WLD
lboue Sep 5, 2024
54d17fd
Update water-leak-detector-app.zap
lboue Sep 8, 2024
343d2f0
Update water-leak-detector-app.matter
lboue Sep 8, 2024
70bbdd0
Merge branch 'master' into Linux_WLD
lboue Sep 15, 2024
889feec
Merge branch 'master' into Linux_WLD
lboue Sep 25, 2024
1e754d4
Delete examples/water-leak-detector-app/linux/README.md
lboue Sep 25, 2024
6dd7fc6
Merge branch 'master' into Linux_WLD
lboue Sep 26, 2024
7040377
Update targets.py to add WATER_LEAK_DETECTOR
lboue Oct 2, 2024
62d4f67
Update host.py to add WATER_LEAK_DETECTOR
lboue Oct 2, 2024
931905e
Merge branch 'master' into Linux_WLD
lboue Oct 2, 2024
7146e9c
Update water-leak-detector-app.matter
lboue Oct 2, 2024
79b97a9
Update all_targets_linux_x64.txt
lboue Oct 2, 2024
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
25 changes: 25 additions & 0 deletions examples/water-leak-detector-app/linux/.gn
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")
}
64 changes: 64 additions & 0 deletions examples/water-leak-detector-app/linux/BUILD.gn
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" ]
}
28 changes: 28 additions & 0 deletions examples/water-leak-detector-app/linux/args.gni
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
1 change: 1 addition & 0 deletions examples/water-leak-detector-app/linux/build_overrides
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"
53 changes: 53 additions & 0 deletions examples/water-leak-detector-app/linux/main.cpp
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;
}
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
}
Loading
Loading