Skip to content

Commit

Permalink
[window-covering] Fixed window covering build on nrfconnect (#34385)
Browse files Browse the repository at this point in the history
The window covering example does not build on nrfconnect
platform, because of the missing chip namespace.
  • Loading branch information
kkasperczyk-no authored and pull[bot] committed Jul 25, 2024
1 parent 671a329 commit 2707107
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions examples/window-app/nrfconnect/main/WindowCovering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ void WindowCovering::DriveCurrentLiftPosition(intptr_t)
NPercent100ths positionToSet{};

VerifyOrReturn(Attributes::CurrentPositionLiftPercent100ths::Get(Endpoint(), current) ==
Protocols::InteractionModel::Status::Success);
chip::Protocols::InteractionModel::Status::Success);
VerifyOrReturn(Attributes::TargetPositionLiftPercent100ths::Get(Endpoint(), target) ==
Protocols::InteractionModel::Status::Success);
chip::Protocols::InteractionModel::Status::Success);

OperationalState state = ComputeOperationalState(target, current);
UpdateOperationalStatus(MoveType::LIFT, state);
Expand All @@ -87,7 +87,7 @@ void WindowCovering::DriveCurrentLiftPosition(intptr_t)
Instance().mInLiftMove = false;

VerifyOrReturn(Attributes::CurrentPositionLiftPercent100ths::Get(Endpoint(), current) ==
Protocols::InteractionModel::Status::Success);
chip::Protocols::InteractionModel::Status::Success);

if (!TargetCompleted(MoveType::LIFT, current, target))
{
Expand All @@ -103,7 +103,7 @@ void WindowCovering::DriveCurrentLiftPosition(intptr_t)

chip::Percent100ths WindowCovering::CalculateNextPosition(MoveType aMoveType)
{
Protocols::InteractionModel::Status status{};
chip::Protocols::InteractionModel::Status status{};
chip::Percent100ths percent100ths{};
NPercent100ths current{};
OperationalState opState{};
Expand All @@ -119,7 +119,7 @@ chip::Percent100ths WindowCovering::CalculateNextPosition(MoveType aMoveType)
opState = OperationalStateGet(Endpoint(), OperationalStatus::kTilt);
}

if ((status == Protocols::InteractionModel::Status::Success) && !current.IsNull())
if ((status == chip::Protocols::InteractionModel::Status::Success) && !current.IsNull())
{
static constexpr auto sPercentDelta{ WC_PERCENT100THS_MAX_CLOSED / 20 };
percent100ths = ComputePercent100thsStep(opState, current.Value(), sPercentDelta);
Expand Down Expand Up @@ -171,9 +171,9 @@ void WindowCovering::DriveCurrentTiltPosition(intptr_t)
NPercent100ths positionToSet{};

VerifyOrReturn(Attributes::CurrentPositionTiltPercent100ths::Get(Endpoint(), current) ==
Protocols::InteractionModel::Status::Success);
chip::Protocols::InteractionModel::Status::Success);
VerifyOrReturn(Attributes::TargetPositionTiltPercent100ths::Get(Endpoint(), target) ==
Protocols::InteractionModel::Status::Success);
chip::Protocols::InteractionModel::Status::Success);

OperationalState state = ComputeOperationalState(target, current);
UpdateOperationalStatus(MoveType::TILT, state);
Expand All @@ -199,7 +199,7 @@ void WindowCovering::DriveCurrentTiltPosition(intptr_t)
Instance().mInTiltMove = false;

VerifyOrReturn(Attributes::CurrentPositionTiltPercent100ths::Get(Endpoint(), current) ==
Protocols::InteractionModel::Status::Success);
chip::Protocols::InteractionModel::Status::Success);

if (!TargetCompleted(MoveType::TILT, current, target))
{
Expand Down Expand Up @@ -261,7 +261,7 @@ void WindowCovering::UpdateOperationalStatus(MoveType aMoveType, OperationalStat

void WindowCovering::SetTargetPosition(OperationalState aDirection, chip::Percent100ths aPosition)
{
Protocols::InteractionModel::Status status{};
chip::Protocols::InteractionModel::Status status{};
if (Instance().mCurrentUIMoveType == MoveType::LIFT)
{
status = Attributes::TargetPositionLiftPercent100ths::Set(Endpoint(), aPosition);
Expand All @@ -271,29 +271,29 @@ void WindowCovering::SetTargetPosition(OperationalState aDirection, chip::Percen
status = Attributes::TargetPositionTiltPercent100ths::Set(Endpoint(), aPosition);
}

if (status != Protocols::InteractionModel::Status::Success)
if (status != chip::Protocols::InteractionModel::Status::Success)
{
LOG_ERR("Cannot set the target position. Error: %d", static_cast<uint8_t>(status));
}
}

void WindowCovering::PositionLEDUpdate(MoveType aMoveType)
{
Protocols::InteractionModel::Status status{};
chip::Protocols::InteractionModel::Status status{};
NPercent100ths currentPosition{};

if (aMoveType == MoveType::LIFT)
{
status = Attributes::CurrentPositionLiftPercent100ths::Get(Endpoint(), currentPosition);
if (Protocols::InteractionModel::Status::Success == status && !currentPosition.IsNull())
if (chip::Protocols::InteractionModel::Status::Success == status && !currentPosition.IsNull())
{
Instance().SetBrightness(MoveType::LIFT, currentPosition.Value());
}
}
else if (aMoveType == MoveType::TILT)
{
status = Attributes::CurrentPositionTiltPercent100ths::Get(Endpoint(), currentPosition);
if (Protocols::InteractionModel::Status::Success == status && !currentPosition.IsNull())
if (chip::Protocols::InteractionModel::Status::Success == status && !currentPosition.IsNull())
{
Instance().SetBrightness(MoveType::TILT, currentPosition.Value());
}
Expand Down

0 comments on commit 2707107

Please sign in to comment.