Skip to content
Open
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
2fef989
Initial draft of all devices example app
zaid-google Oct 23, 2025
4708c00
Restyled by whitespace
restyled-commits Oct 23, 2025
1e0aa5e
Restyled by clang-format
restyled-commits Oct 23, 2025
1f10a27
Restyled by gn
restyled-commits Oct 23, 2025
5d05758
Address some review comments
zaid-google Oct 24, 2025
d6bf556
Merge branch 'master' into new_all_devices_app
zaid-google Oct 24, 2025
050d6a7
Address more review comments
zaid-google Oct 24, 2025
675bc02
Restyled by whitespace
restyled-commits Oct 24, 2025
54f4933
Restyled by clang-format
restyled-commits Oct 24, 2025
e755f19
Restyled by gn
restyled-commits Oct 24, 2025
899949a
More review comments
zaid-google Oct 24, 2025
14230f4
Review comments for BUILD.gn configs
zaid-google Oct 24, 2025
0debc8d
Restyled by clang-format
restyled-commits Oct 24, 2025
523ed12
Restyled by gn
restyled-commits Oct 24, 2025
1f52853
Add TODOs based on review comments
zaid-google Oct 27, 2025
cdd6d6e
Restyled by whitespace
restyled-commits Oct 27, 2025
1e8876a
Restyled by clang-format
restyled-commits Oct 27, 2025
794d2aa
Merge branch 'master' into new_all_devices_app
zaid-google Oct 27, 2025
42517f3
Update wifi diagnostics optional atteribute set usage
zaid-google Oct 27, 2025
eebaef9
Remove SemanticTags function from Device
zaid-google Oct 27, 2025
c1c6f3a
Restyled by clang-format
restyled-commits Oct 27, 2025
5164883
Make device endpoint a command line argument
zaid-google Oct 29, 2025
ed2caa6
Cleanup includes and remove old args.gni
zaid-google Oct 29, 2025
cd2c5e0
Address comments, make command line args seperate from main
zaid-google Oct 30, 2025
5392dbc
Fix merge conflict
zaid-google Oct 31, 2025
ec9c9ba
Restyled by whitespace
restyled-commits Oct 31, 2025
0b4d7cb
Restyled by clang-format
restyled-commits Oct 31, 2025
1cabc92
Restyled by gn
restyled-commits Oct 31, 2025
879cffd
separation of base device with single endpoint device
zaid-google Oct 31, 2025
5ef1f49
Add comments, fix unregister calls, cleanup of member variables
zaid-google Oct 31, 2025
09a94f2
Remove unique pointer for timer
zaid-google Oct 31, 2025
5263526
Restyled by whitespace
restyled-commits Oct 31, 2025
28da318
Restyled by clang-format
restyled-commits Oct 31, 2025
1eee251
update comment
zaid-google Oct 31, 2025
ac62669
Restyled by whitespace
restyled-commits Oct 31, 2025
e1d7e9c
Restructure device interfaces
zaid-google Nov 3, 2025
b015385
Add all devices app build and basic composition test to CI
zaid-google Nov 3, 2025
9afcb3b
Restyled by clang-format
restyled-commits Nov 3, 2025
87e732f
Remove build variants for CI, not currently supported
zaid-google Nov 3, 2025
0256f69
Fix path for all devices app in CI
zaid-google Nov 4, 2025
3521dc0
Update device info provider used
zaid-google Nov 4, 2025
00f9a30
Update comments
zaid-google Nov 4, 2025
a589afb
Restyled by whitespace
restyled-commits Nov 4, 2025
c6210d5
Restyled by clang-format
restyled-commits Nov 4, 2025
f93e4e0
Add new device info provider
zaid-google Nov 4, 2025
3c9ba8f
Restyled by whitespace
restyled-commits Nov 4, 2025
8f52e9f
Restyled by clang-format
restyled-commits Nov 4, 2025
bfa4f89
Update examples/providers/AllDevicesExampleDeviceInfoProviderImpl.cpp
andy31415 Nov 6, 2025
af50f13
Update examples/all-devices-app/all-devices-common/devices/boolean-st…
andy31415 Nov 6, 2025
d1c1b5c
Update examples/all-devices-app/all-devices-common/devices/interface/…
andy31415 Nov 6, 2025
d557cba
Update examples/all-devices-app/all-devices-common/devices/interface/…
andy31415 Nov 6, 2025
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
10 changes: 10 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,15 @@ jobs:
&& rm -rf out/linux-x64-all-clusters-${BUILD_VARIANT}-tsan-clang-test
"

- name: Build linux-x64-all-devices-app
env:
CCACHE_DIR: "${{ github.workspace }}/.ccache"
run: >-
./scripts/run_in_build_env.sh "./scripts/build/build_examples.py
--target linux-x64-all-devices-app-tsan-clang-test
--pw-command-launcher=ccache build --copy-artifacts-to objdir-clone
&& rm -rf out/linux-x64-all-devices-app-tsan-clang-test"

- name: Build linux-x64-lit-icd
env:
CCACHE_DIR: "${{ github.workspace }}/.ccache"
Expand Down Expand Up @@ -806,6 +815,7 @@ jobs:
run: |
echo -n "" >/tmp/test_env.yaml
echo "ALL_CLUSTERS_APP: objdir-clone/linux-x64-all-clusters-${BUILD_VARIANT}-tsan-clang-test/chip-all-clusters-app" >> /tmp/test_env.yaml
echo "ALL_DEVICES_APP: objdir-clone/linux-x64-all-devices-app-tsan-clang-test/all-devices-app" >> /tmp/test_env.yaml
echo "BRIDGE_APP: objdir-clone/linux-x64-bridge-${BUILD_VARIANT}-tsan-clang-test-unified/chip-bridge-app" >> /tmp/test_env.yaml
echo "CHIP_LOCK_APP: objdir-clone/linux-x64-lock-${BUILD_VARIANT}-tsan-clang-test-unified/chip-lock-app" >> /tmp/test_env.yaml
echo "CAMERA_APP: objdir-clone/linux-x64-camera/chip-camera-app" >> /tmp/test_env.yaml
Expand Down
18 changes: 18 additions & 0 deletions examples/all-devices-app/all-devices-common/devices/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2025 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.

config("includes") {
# allows includes like "devices/..."
include_dirs = [ ".." ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright (c) 2025 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")

source_set("boolean-state-sensor") {
sources = [
"BooleanStateSensorDevice.cpp",
"BooleanStateSensorDevice.h",
]

public_deps = [
"${chip_root}/examples/all-devices-app/all-devices-common/devices/interface:single-endpoint-device",
"${chip_root}/src/app/clusters/boolean-state-server",
"${chip_root}/src/app/clusters/identify-server",
"${chip_root}/src/data-model-providers/codedriven",
"${chip_root}/src/lib/core:error",
"${chip_root}/src/lib/support",
]

public_configs = [
"${chip_root}/examples/all-devices-app/all-devices-common/devices/:includes",
"${chip_root}/src:includes",
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
*
* Copyright (c) 2025 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.
*/
#include <devices/boolean-state-sensor/BooleanStateSensorDevice.h>

using namespace chip::app::Clusters;

namespace chip::app {

CHIP_ERROR BooleanStateSensorDevice::Register(chip::EndpointId endpoint, CodeDrivenDataModelProvider & provider,
EndpointId parentId)
{
ReturnErrorOnFailure(SingleEndpointRegistration(endpoint, provider, parentId));

mIdentifyCluster.Create(IdentifyCluster::Config(endpoint, *mTimerDelegate));
ReturnErrorOnFailure(provider.AddCluster(mIdentifyCluster.Registration()));

mBooleanStateCluster.Create(endpoint);
ReturnErrorOnFailure(provider.AddCluster(mBooleanStateCluster.Registration()));

return provider.AddEndpoint(mEndpointRegistration);
}

void BooleanStateSensorDevice::UnRegister(CodeDrivenDataModelProvider & provider)
{
SingleEndpointUnregistration(provider);
if (mBooleanStateCluster.IsConstructed())
{
provider.RemoveCluster(&mBooleanStateCluster.Cluster());
mBooleanStateCluster.Destroy();
}
if (mIdentifyCluster.IsConstructed())
{
provider.RemoveCluster(&mIdentifyCluster.Cluster());
mIdentifyCluster.Destroy();
}
}

} // namespace chip::app
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
*
* Copyright (c) 2025 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.
*/
#pragma once

#include <app/clusters/boolean-state-server/boolean-state-cluster.h>
#include <app/clusters/identify-server/IdentifyCluster.h>
#include <app/reporting/ReportScheduler.h>
#include <devices/interface/SingleEndpointDevice.h>
#include <memory>

namespace chip {
namespace app {

class BooleanStateSensorDevice : public SingleEndpointDevice
{
public:
/// This is a general class for boolean state sensor devices. The device type passed here will
/// determine the type of sensor it is (contact, water leak, etc.) This is meant to be a reusable
/// class for the sensor types that share the same core functionality through the identify and
/// boolean state clusters. The caller creating a BooleanStateSensorDevice MUST ensure that the underlying
/// data for the Span of deviceTypes remains valid for the entire liefetime of the BooleanStateSensorDevice object instance.
BooleanStateSensorDevice(reporting::ReportScheduler::TimerDelegate * timerDelegate,
Span<const DataModel::DeviceTypeEntry> deviceType) :
SingleEndpointDevice(deviceType),
mTimerDelegate(timerDelegate)
{}
~BooleanStateSensorDevice() override = default;

CHIP_ERROR Register(chip::EndpointId endpoint, CodeDrivenDataModelProvider & provider,
EndpointId parentId = kInvalidEndpointId) override;
void UnRegister(CodeDrivenDataModelProvider & provider) override;

Clusters::BooleanStateCluster & BooleanState() { return mBooleanStateCluster.Cluster(); }

private:
reporting::ReportScheduler::TimerDelegate * mTimerDelegate;
LazyRegisteredServerCluster<Clusters::IdentifyCluster> mIdentifyCluster;
LazyRegisteredServerCluster<Clusters::BooleanStateCluster> mBooleanStateCluster;
};

} // namespace app
} // namespace chip
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright (c) 2025 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")

source_set("device-factory") {
sources = [ "DeviceFactory.h" ]

public_deps = [
"${chip_root}/examples/all-devices-app/all-devices-common/devices/boolean-state-sensor",
"${chip_root}/src/lib/core:error",
"${chip_root}/zzz_generated/app-common/devices/",
]

public_configs = [
"${chip_root}/examples/all-devices-app/all-devices-common/devices/:includes",
"${chip_root}/src:includes",
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
*
* Copyright (c) 2025 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.
*/

#pragma once

#include <app/TimerDelegates.h>
#include <devices/Types.h>
#include <devices/boolean-state-sensor/BooleanStateSensorDevice.h>
#include <functional>
#include <lib/core/CHIPError.h>
#include <map>

namespace chip::app {

/**
* This is a factory class made to be used to create any valid device type as part of the
* all-devices-app. This class is meant to abstract away some details of device specific code,
* and to have more generic implementation code being used in main to create a device. The keys
* in the device registry map are the command line arguments used to start the respective device.
* Create devices by fetching the instance of this class and passing in the device type argument
* i.e. DeviceFactory::GetInstance().Create(deviceTypeName)
*/
class DeviceFactory
{
public:
using DeviceCreator = std::function<std::unique_ptr<DeviceInterface>()>;

static DeviceFactory & GetInstance()
{
static DeviceFactory instance;
return instance;
}

bool IsValidDevice(const std::string & deviceTypeArg) { return mRegistry.find(deviceTypeArg) != mRegistry.end(); }

std::unique_ptr<DeviceInterface> Create(const std::string & deviceTypeArg)
{
if (IsValidDevice(deviceTypeArg))
{
return mRegistry.find(deviceTypeArg)->second();
}
else
{
ChipLogError(
Support,
"INTERNAL ERROR: Invalid device type: %s. Run with the --help argument to view the list of valid device types.\n",
deviceTypeArg.c_str());
}
return nullptr;
}

private:
std::map<std::string, DeviceCreator> mRegistry;
DefaultTimerDelegate timer;

DeviceFactory()
{
mRegistry["contact-sensor"] = [this]() {
return std::make_unique<BooleanStateSensorDevice>(
&timer, Span<const DataModel::DeviceTypeEntry>(&Device::Type::kContactSensor, 1));
};
mRegistry["water-leak-detector"] = [this]() {
return std::make_unique<BooleanStateSensorDevice>(
&timer, Span<const DataModel::DeviceTypeEntry>(&Device::Type::kWaterLeakDetector, 1));
};
}
};

} // namespace chip::app
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright (c) 2025 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")

source_set("device-interface") {
sources = [
"DeviceInterface.cpp",
"DeviceInterface.h",
]

public_deps = [
"${chip_root}/src/app/clusters/descriptor",
"${chip_root}/src/data-model-providers/codedriven",
"${chip_root}/src/lib/core:error",
"${chip_root}/src/lib/support",
]

public_configs = [
"${chip_root}/examples/all-devices-app/all-devices-common/devices/:includes",
"${chip_root}/src:includes",
]
}

source_set("single-endpoint-device") {
sources = [
"SingleEndpointDevice.cpp",
"SingleEndpointDevice.h",
]

public_deps = [
":device-interface",
"${chip_root}/src/app/clusters/descriptor",
"${chip_root}/src/data-model-providers/codedriven",
"${chip_root}/src/lib/core:error",
"${chip_root}/src/lib/support",
]

public_configs = [
"${chip_root}/examples/all-devices-app/all-devices-common/devices/:includes",
"${chip_root}/src:includes",
]
}
Loading
Loading