Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
*
*/

#include "closure-dimension-server.h"
#include "closure-dimension-cluster-logic.h"
#include "ClosureDimensionCluster.h"
#include "ClosureDimensionClusterLogic.h"

namespace chip {
namespace app {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/**
*
* 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 "ClosureDimensionClusterLogic.h"

#include <app/AttributeAccessInterfaceRegistry.h>
#include <app/CommandHandlerInterfaceRegistry.h>

namespace chip {
namespace app {
namespace Clusters {
namespace ClosureDimension {

/**
* @brief Class implements the client facing APIs to read, write and process incoming commands
* App should instantiate and init one Interface per endpoint
*/
class Interface : public AttributeAccessInterface, public CommandHandlerInterface
{
public:
Interface(EndpointId endpoint, ClusterLogic & clusterLogic) :
AttributeAccessInterface(Optional<EndpointId>(endpoint), Id), CommandHandlerInterface(Optional<EndpointId>(endpoint), Id),
mClusterLogic(clusterLogic)
{}

// AttributeAccessInterface implementation

CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override;

// CommandHandlerInterface implementation

void InvokeCommand(HandlerContext & handlerContext) override;

/**
* @brief This function registers attribute access and command handler.
* @return CHIP_NO_ERROR when succesfully initialized.
* Aborts if registration fails.
*/
CHIP_ERROR Init();

/**
* @brief This function unregisters attribute access and command handlers.
* @return CHIP_NO_ERROR when succesfully initialized
* Aborts if attribute access unregistration fails.
*/
CHIP_ERROR Shutdown();

private:
// This is owned by the caller and passed to the interface for its use.
ClusterLogic & mClusterLogic;
};

} // namespace ClosureDimension
} // namespace Clusters
} // namespace app
} // namespace chip
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
*
* Copyright (c) 2025 Project CHIP Authors
* All rights reserved.
*
* 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-common/zap-generated/cluster-enums.h>
#include <app/data-model/Nullable.h>
#include <app/util/basic-types.h>
#include <protocols/interaction_model/StatusCode.h>

namespace chip {
namespace app {
namespace Clusters {
namespace ClosureDimension {

/** @brief
* Defines methods for implementing application-specific logic for the Closure Dimension Cluster.
*/

class DelegateBase
{
public:
DelegateBase(){};
virtual ~DelegateBase() = default;

/**
* @brief This function handles SetTarget command implementaion.
*
* @param [in] position TargetState position to be set
* @param [in] latch TargetState Latch to be set
* @param [in] speed TargetState speed to be set
*
* @return Success when succesfully handled.
* Error when handle SetTarget fails.
*/
virtual Protocols::InteractionModel::Status HandleSetTarget(const Optional<Percent100ths> & position,
const Optional<bool> & latch,
const Optional<Globals::ThreeLevelAutoEnum> & speed) = 0;

/**
* @brief This function handles Step command implementaion.
*
* @param [in] direction step direction
* @param [in] numberOfSteps total number of steps
* @param [in] speed speed of each step
*
* @return Success when successfully handled.
* Error when handle Step fails.
*/
virtual Protocols::InteractionModel::Status HandleStep(const StepDirectionEnum & direction, const uint16_t & numberOfSteps,
const Optional<Globals::ThreeLevelAutoEnum> & speed) = 0;
};

} // namespace ClosureDimension
} // namespace Clusters
} // namespace app
} // namespace chip
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @file Cross-platform API to handle cluster-specific logic for the closure dimension cluster on a single endpoint.
*/

#include "closure-dimension-cluster-logic.h"
#include "ClosureDimensionClusterLogic.h"
#include <clusters/ClosureDimension/Metadata.h>
#include <platform/LockTracker.h>

Expand Down
Loading
Loading