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.
[occupancy-sensing]Updated occupancy sensing cluster SDK & Sample app…
…(all-clusters-app) implementation to Rev 5 (Matter 1.4) (project-chip#34293) * [occupancy-sensing]Updated occupancy sensing cluster SDK & Sample app(all-clusters-app) implementation to Rev 5 (Matter 1.4) Signed-off-by: Oliver Fan <[email protected]> * Restyled by whitespace * Restyled by clang-format * Apply suggestions from code review Update Copyright suggestions Co-authored-by: Boris Zbarsky <[email protected]> * Apply suggestions from code review, remove some dead code. Signed-off-by: Oliver Fan <[email protected]> * Restyled by clang-format * Apply suggestions from code review * Avoid mixing code-backed and Attribute-store-backed attributes * Avoid global singletons to maintain state * Initialize the cluster from the application * Report features based on code, not on ZAP-configured values Signed-off-by: Oliver Fan <[email protected]> * Restyled by whitespace * Restyled by clang-format * Restyled by clang-format * Restyled by clang-format * Restyled by clang-format * Update examples/all-clusters-app/all-clusters-common/src/occupancy-sensing-stub.cpp Co-authored-by: Boris Zbarsky <[email protected]> * Apply suggestions from code review change mHoldTimeLimitsStructs and mHoldTime to sHoldTimeLimitsStructs and sHoldTime put above two variables in an anonymous namespace Signed-off-by: Oliver Fan <[email protected]> * Restyled by clang-format --------- Signed-off-by: Oliver Fan <[email protected]> Co-authored-by: Restyled.io <[email protected]> Co-authored-by: Boris Zbarsky <[email protected]>
- Loading branch information
Showing
7 changed files
with
327 additions
and
26 deletions.
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
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
57 changes: 57 additions & 0 deletions
57
examples/all-clusters-app/all-clusters-common/src/occupancy-sensing-stub.cpp
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,57 @@ | ||
/* | ||
* | ||
* 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. | ||
*/ | ||
|
||
#include <app/CommandHandler.h> | ||
#include <app/clusters/occupancy-sensor-server/occupancy-hal.h> | ||
#include <app/clusters/occupancy-sensor-server/occupancy-sensor-server.h> | ||
#include <platform/CHIPDeviceLayer.h> | ||
|
||
using namespace chip; | ||
using namespace chip::app::Clusters; | ||
using namespace chip::app::Clusters::OccupancySensing; | ||
using namespace chip::app::Clusters::OccupancySensing::Structs; | ||
using namespace chip::DeviceLayer; | ||
|
||
using chip::Protocols::InteractionModel::Status; | ||
|
||
static std::unique_ptr<OccupancySensingAttrAccess> | ||
gAttrAccess[MATTER_DM_OCCUPANCY_SENSING_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT]; | ||
|
||
void emberAfOccupancySensingClusterInitCallback(EndpointId endpointId) | ||
{ | ||
VerifyOrDie(!gAttrAccess[endpointId]); | ||
|
||
gAttrAccess[endpointId] = std::make_unique<OccupancySensingAttrAccess>( | ||
BitMask<OccupancySensing::Feature, uint32_t>(OccupancySensing::Feature::kOther)); | ||
|
||
OccupancySensing::Structs::HoldTimeLimitsStruct::Type holdTimeLimits = { | ||
.holdTimeMin = 1, | ||
.holdTimeMax = 300, | ||
.holdTimeDefault = 10, | ||
}; | ||
|
||
uint16_t holdTime = 10; | ||
|
||
if (gAttrAccess[endpointId]) | ||
{ | ||
gAttrAccess[endpointId]->Init(); | ||
|
||
SetHoldTimeLimits(endpointId, holdTimeLimits); | ||
|
||
SetHoldTime(endpointId, holdTime); | ||
} | ||
} |
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
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
Oops, something went wrong.