Coverage Report

Created: 2026-02-12 06:57

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/connectedhomeip/src/app/clusters/boolean-state-server/BooleanStateCluster.h
Line
Count
Source
1
/*
2
 *    Copyright (c) 2025 Project CHIP Authors
3
 *    All rights reserved.
4
 *
5
 *    Licensed under the Apache License, Version 2.0 (the "License");
6
 *    you may not use this file except in compliance with the License.
7
 *    You may obtain a copy of the License at
8
 *
9
 *        http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 *    Unless required by applicable law or agreed to in writing, software
12
 *    distributed under the License is distributed on an "AS IS" BASIS,
13
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 *    See the License for the specific language governing permissions and
15
 *    limitations under the License.
16
 */
17
#pragma once
18
19
#include <app/server-cluster/DefaultServerCluster.h>
20
#include <platform/DeviceInfoProvider.h>
21
22
namespace chip::app::Clusters {
23
24
class BooleanStateCluster : public DefaultServerCluster
25
{
26
public:
27
    BooleanStateCluster(EndpointId endpointId);
28
29
    // Server cluster implementation
30
    DataModel::ActionReturnStatus ReadAttribute(const DataModel::ReadAttributeRequest & request,
31
                                                AttributeValueEncoder & encoder) override;
32
    CHIP_ERROR Attributes(const ConcreteClusterPath & path, ReadOnlyBufferBuilder<DataModel::AttributeEntry> & builder) override;
33
34
    // Set a boolean value.
35
    // If the boolean value was actually modified, an event will be generated.
36
    // On success, the return value is an optional containing the EventNumber of the event that was generated.
37
    // On error, the return value is nullopt.
38
    std::optional<EventNumber> SetStateValue(bool stateValue);
39
40
0
    bool GetStateValue() const { return mStateValue; }
41
42
protected:
43
    bool mStateValue;
44
};
45
46
} // namespace chip::app::Clusters