-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into Modified_Script_Sep_15
- Loading branch information
Showing
124 changed files
with
19,678 additions
and
16,964 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,15 +27,78 @@ jobs: | |
runs-on: ubuntu-latest | ||
if: github.actor != 'restyled-io[bot]' | ||
|
||
container: | ||
image: connectedhomeip/chip-build:0.5.99 | ||
|
||
steps: | ||
- uses: Wandalen/[email protected] | ||
if: ${{ !env.ACT }} | ||
name: Checkout | ||
with: | ||
action: actions/checkout@v3 | ||
with: | | ||
token: ${{ github.token }} | ||
attempt_limit: 3 | ||
attempt_delay: 2000 | ||
# To use act like: | ||
# act -j code-lints | ||
# | ||
# Note you likely still need to have non submodules setup for the | ||
# local machine, like: | ||
# git submodule deinit --all | ||
- uses: actions/checkout@v3 | ||
if: ${{ env.ACT }} | ||
name: Checkout (ACT for local build) | ||
|
||
# Bootstrap and checkout for internal scripts (like idl_lint) | ||
# to run | ||
- name: Checkout submodules | ||
run: scripts/checkout_submodules.py --shallow --platform linux | ||
- name: Bootstrap | ||
timeout-minutes: 10 | ||
run: scripts/build/gn_bootstrap.sh | ||
|
||
- name: Check for matter lint errors | ||
if: always() | ||
run: | | ||
for idl_file in $(find . -name '*.matter'); do | ||
# TODO: all these conformance failures should be fixed | ||
# Issues exist for most of them: | ||
# https://github.com/project-chip/connectedhomeip/issues/19180 | ||
# https://github.com/project-chip/connectedhomeip/issues/19176 | ||
# https://github.com/project-chip/connectedhomeip/issues/19175 | ||
# https://github.com/project-chip/connectedhomeip/issues/19173 | ||
# https://github.com/project-chip/connectedhomeip/issues/19169 | ||
# https://github.com/project-chip/connectedhomeip/issues/22640 | ||
if [ "$idl_file" = './examples/all-clusters-app/all-clusters-common/all-clusters-app.matter' ]; then continue; fi | ||
if [ "$idl_file" = './examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter' ]; then continue; fi | ||
if [ "$idl_file" = './examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO' ]; then continue; fi | ||
if [ "$idl_file" = './examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter' ]; then continue; fi | ||
if [ "$idl_file" = './examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter' ]; then continue; fi | ||
if [ "$idl_file" = './examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter' ]; then continue; fi | ||
if [ "$idl_file" = './examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter' ]; then continue; fi | ||
if [ "$idl_file" = './examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.matter' ]; then continue; fi | ||
if [ "$idl_file" = './examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter' ]; then continue; fi | ||
if [ "$idl_file" = './examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.matter' ]; then continue; fi | ||
if [ "$idl_file" = './examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.matter' ]; then continue; fi | ||
if [ "$idl_file" = './examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter' ]; then continue; fi | ||
if [ "$idl_file" = './examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.matter' ]; then continue; fi | ||
if [ "$idl_file" = './examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.matter' ]; then continue; fi | ||
if [ "$idl_file" = './examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.matter' ]; then continue; fi | ||
if [ "$idl_file" = './examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter' ]; then continue; fi | ||
if [ "$idl_file" = './examples/chef/devices/rootnode_speaker_RpzeXdimqA.matter' ]; then continue; fi | ||
if [ "$idl_file" = './examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.matter' ]; then continue; fi | ||
if [ "$idl_file" = './examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter' ]; then continue; fi | ||
if [ "$idl_file" = './examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter' ]; then continue; fi | ||
if [ "$idl_file" = './examples/lighting-app/lighting-common/lighting-app.matter' ]; then continue; fi | ||
if [ "$idl_file" = './examples/log-source-app/log-source-common/log-source-app.matter' ]; then continue; fi | ||
if [ "$idl_file" = './examples/placeholder/linux/apps/app1/config.matter' ]; then continue; fi | ||
if [ "$idl_file" = './examples/placeholder/linux/apps/app2/config.matter' ]; then continue; fi | ||
if [ "$idl_file" = './examples/thermostat/thermostat-common/thermostat.matter' ]; then continue; fi | ||
if [ "$idl_file" = './examples/window-app/common/window-app.matter' ]; then continue; fi | ||
./scripts/run_in_build_env.sh "./scripts/idl_lint.py --log-level warn $idl_file" >/dev/null || exit 1 | ||
done | ||
- name: Check broken links | ||
# On-push disabled until the job can run fully green | ||
|
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
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
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
138 changes: 138 additions & 0 deletions
138
examples/all-clusters-app/linux/WindowCoveringManager.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,138 @@ | ||
/** | ||
* | ||
* Copyright (c) 2022 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 "WindowCoveringManager.h" | ||
#include <app-common/zap-generated/attributes/Accessors.h> | ||
#include <platform/internal/CHIPDeviceLayerInternal.h> | ||
#include <system/SystemClock.h> | ||
|
||
using namespace chip; | ||
using namespace chip::app; | ||
using namespace chip::app::Clusters::WindowCovering; | ||
using namespace chip::System::Clock::Literals; | ||
|
||
namespace { | ||
|
||
constexpr const System::Clock::Milliseconds32 kIncrementMovementTimeout = 700_ms32; | ||
constexpr const uint16_t kDefaultMovementStep = 2000; | ||
|
||
} // namespace | ||
|
||
void WindowCoveringManager::Init(EndpointId endpoint) | ||
{ | ||
mState = OperationalState::Stall; | ||
mCurrentPosition.SetNonNull(static_cast<uint16_t>(0)); | ||
mTargetPosition.SetNonNull(static_cast<uint16_t>(0)); | ||
SetEndpoint(endpoint); | ||
} | ||
|
||
void WindowCoveringManager::HandleMovementTimer(System::Layer * layer, void * aAppState) | ||
{ | ||
WindowCoveringManager * manager = reinterpret_cast<WindowCoveringManager *>(aAppState); | ||
|
||
VerifyOrReturn(manager->mState != OperationalState::Stall); | ||
|
||
uint16_t currentPosition = manager->mCurrentPosition.Value(); | ||
uint16_t targetPosition = manager->mTargetPosition.Value(); | ||
|
||
ChipLogProgress(NotSpecified, "HandleMovementTimer:currentPosition:%u, targetPosition:%u", currentPosition, targetPosition); | ||
|
||
if (OperationalState::MovingUpOrOpen == manager->mState) | ||
{ | ||
if (currentPosition > targetPosition) | ||
{ | ||
uint16_t tempPosition = | ||
currentPosition > kDefaultMovementStep ? static_cast<uint16_t>(currentPosition - kDefaultMovementStep) : 0; | ||
currentPosition = tempPosition > targetPosition ? tempPosition : targetPosition; | ||
|
||
manager->mCurrentPosition.SetNonNull(currentPosition); | ||
} | ||
else | ||
{ | ||
ChipLogProgress(NotSpecified, "Reached the target position"); | ||
return; | ||
} | ||
} | ||
else | ||
{ | ||
if (currentPosition < targetPosition) | ||
{ | ||
uint16_t tempPosition = static_cast<uint16_t>(currentPosition + kDefaultMovementStep); | ||
currentPosition = tempPosition < targetPosition ? tempPosition : targetPosition; | ||
manager->mCurrentPosition.SetNonNull(currentPosition); | ||
} | ||
else | ||
{ | ||
ChipLogProgress(NotSpecified, "Reached the target position"); | ||
return; | ||
} | ||
} | ||
|
||
if (HasFeature(manager->mEndpoint, Feature::kPositionAwareLift)) | ||
{ | ||
LiftPositionSet(manager->mEndpoint, manager->mCurrentPosition); | ||
} | ||
|
||
if (HasFeature(manager->mEndpoint, Feature::kPositionAwareTilt)) | ||
{ | ||
TiltPositionSet(manager->mEndpoint, manager->mCurrentPosition); | ||
} | ||
|
||
if (manager->mCurrentPosition != manager->mTargetPosition) | ||
{ | ||
LogErrorOnFailure(DeviceLayer::SystemLayer().StartTimer(kIncrementMovementTimeout, HandleMovementTimer, aAppState)); | ||
} | ||
} | ||
|
||
CHIP_ERROR WindowCoveringManager::HandleMovement(WindowCoveringType type) | ||
{ | ||
mState = OperationalStateGet(mEndpoint, OperationalStatus::kGlobal); | ||
|
||
if (OperationalState::Stall == mState) | ||
{ | ||
ChipLogProgress(NotSpecified, "Covering is currently not moving"); | ||
return CHIP_NO_ERROR; | ||
} | ||
|
||
// Cancel ongoing window covering movement timer if any. | ||
DeviceLayer::SystemLayer().CancelTimer(HandleMovementTimer, this); | ||
|
||
// At least one of the Lift and Tilt features SHALL be supported. | ||
if (type == WindowCoveringType::Lift) | ||
{ | ||
Attributes::CurrentPositionLiftPercent100ths::Get(mEndpoint, mCurrentPosition); | ||
Attributes::TargetPositionLiftPercent100ths::Get(mEndpoint, mTargetPosition); | ||
} | ||
else | ||
{ | ||
Attributes::CurrentPositionTiltPercent100ths::Get(mEndpoint, mCurrentPosition); | ||
Attributes::TargetPositionTiltPercent100ths::Get(mEndpoint, mTargetPosition); | ||
} | ||
|
||
VerifyOrReturnError(!mCurrentPosition.IsNull(), CHIP_ERROR_INCORRECT_STATE); | ||
VerifyOrReturnError(!mTargetPosition.IsNull(), CHIP_ERROR_INCORRECT_STATE); | ||
VerifyOrReturnError(mCurrentPosition != mTargetPosition, CHIP_ERROR_INCORRECT_STATE); | ||
|
||
return DeviceLayer::SystemLayer().StartTimer(kIncrementMovementTimeout, HandleMovementTimer, this); | ||
} | ||
|
||
CHIP_ERROR WindowCoveringManager::HandleStopMotion() | ||
{ | ||
|
||
DeviceLayer::SystemLayer().CancelTimer(HandleMovementTimer, this); | ||
return CHIP_NO_ERROR; | ||
} |
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,49 @@ | ||
/** | ||
* | ||
* Copyright (c) 2022 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/window-covering-server/window-covering-server.h> | ||
|
||
namespace chip { | ||
namespace app { | ||
namespace Clusters { | ||
namespace WindowCovering { | ||
|
||
class WindowCoveringManager : public Delegate | ||
{ | ||
public: | ||
void Init(chip::EndpointId endpoint); | ||
CHIP_ERROR HandleMovement(WindowCoveringType type) override; | ||
CHIP_ERROR HandleStopMotion() override; | ||
|
||
private: | ||
OperationalState mState; | ||
NPercent100ths mCurrentPosition; | ||
NPercent100ths mTargetPosition; | ||
|
||
/** | ||
* @brief | ||
* The callback function to be called when "movement timer" expires. | ||
*/ | ||
static void HandleMovementTimer(chip::System::Layer * layer, void * aAppState); | ||
}; | ||
|
||
} // namespace WindowCovering | ||
} // namespace Clusters | ||
} // namespace app | ||
} // namespace chip |
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
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.