Skip to content

Commit

Permalink
Some example changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jadhavrohit924 committed Sep 17, 2024
1 parent 066dde5 commit 745c18c
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@
#include <lib/support/CodeUtils.h>
#include <lib/support/logging/CHIPLogging.h>

using namespace chip;
using namespace chip::app;
using namespace chip::app::Clusters;
using namespace chip::app::Clusters::Actions;
using namespace chip::app::Clusters::Actions::Attributes;

namespace chip {
namespace app {
namespace Clusters {
Expand Down Expand Up @@ -91,18 +85,18 @@ class ActionsDelegateImpl : public Delegate
CHIP_ERROR ReadEndpointListAtIndex(uint16_t index, EndpointListStructType & epList) override;
CHIP_ERROR FindActionIdInActionList(uint16_t actionId) override;

Status HandleInstantAction(uint16_t actionId, Optional<uint32_t> invokeId) override;
Status HandleInstantActionWithTransition(uint16_t actionId, uint16_t transitionTime, Optional<uint32_t> invokeId) override;
Status HandleStartAction(uint16_t actionId, Optional<uint32_t> invokeId) override;
Status HandleStartActionWithDuration(uint16_t actionId, uint32_t duration, Optional<uint32_t> invokeId) override;
Status HandleStopAction(uint16_t actionId, Optional<uint32_t> invokeId) override;
Status HandlePauseAction(uint16_t actionId, Optional<uint32_t> invokeId) override;
Status HandlePauseActionWithDuration(uint16_t actionId, uint32_t duration, Optional<uint32_t> invokeId) override;
Status HandleResumeAction(uint16_t actionId, Optional<uint32_t> invokeId) override;
Status HandleEnableAction(uint16_t actionId, Optional<uint32_t> invokeId) override;
Status HandleEnableActionWithDuration(uint16_t actionId, uint32_t duration, Optional<uint32_t> invokeId) override;
Status HandleDisableAction(uint16_t actionId, Optional<uint32_t> invokeId) override;
Status HandleDisableActionWithDuration(uint16_t actionId, uint32_t duration, Optional<uint32_t> invokeId) override;
Protocols::InteractionModel::Status HandleInstantAction(uint16_t actionId, Optional<uint32_t> invokeId) override;
Protocols::InteractionModel::Status HandleInstantActionWithTransition(uint16_t actionId, uint16_t transitionTime, Optional<uint32_t> invokeId) override;
Protocols::InteractionModel::Status HandleStartAction(uint16_t actionId, Optional<uint32_t> invokeId) override;
Protocols::InteractionModel::Status HandleStartActionWithDuration(uint16_t actionId, uint32_t duration, Optional<uint32_t> invokeId) override;
Protocols::InteractionModel::Status HandleStopAction(uint16_t actionId, Optional<uint32_t> invokeId) override;
Protocols::InteractionModel::Status HandlePauseAction(uint16_t actionId, Optional<uint32_t> invokeId) override;
Protocols::InteractionModel::Status HandlePauseActionWithDuration(uint16_t actionId, uint32_t duration, Optional<uint32_t> invokeId) override;
Protocols::InteractionModel::Status HandleResumeAction(uint16_t actionId, Optional<uint32_t> invokeId) override;
Protocols::InteractionModel::Status HandleEnableAction(uint16_t actionId, Optional<uint32_t> invokeId) override;
Protocols::InteractionModel::Status HandleEnableActionWithDuration(uint16_t actionId, uint32_t duration, Optional<uint32_t> invokeId) override;
Protocols::InteractionModel::Status HandleDisableAction(uint16_t actionId, Optional<uint32_t> invokeId) override;
Protocols::InteractionModel::Status HandleDisableActionWithDuration(uint16_t actionId, uint32_t duration, Optional<uint32_t> invokeId) override;
};
} // namespace Actions
} // namespace Clusters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ using namespace chip::app;
using namespace chip::app::Clusters;
using namespace chip::app::Clusters::Actions;
using namespace chip::app::Clusters::Actions::Attributes;
using namespace chip::Protocols::InteractionModel;

CHIP_ERROR ActionsDelegateImpl::ReadActionAtIndex(uint16_t index, ActionListStructType & action)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ set(SRC_DIRS_LIST
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/level-control"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/identify-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/access-control-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/actions-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/account-login-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/application-launcher-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/audio-output-server"
Expand Down
8 changes: 4 additions & 4 deletions examples/bridge-app/asr/src/bridged-actions-stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ CHIP_ERROR ActionsAttrAccess::Read(const ConcreteReadAttributePath & aPath, Attr
}
} // anonymous namespace

void MatterActionsPluginServerInitCallback(void)
{
AttributeAccessInterfaceRegistry::Instance().Register(&gAttrAccess);
}
//void MatterActionsPluginServerInitCallback(void)
//{
// AttributeAccessInterfaceRegistry::Instance().Register(&gAttrAccess);
//}
8 changes: 4 additions & 4 deletions examples/bridge-app/linux/bridged-actions-stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ CHIP_ERROR ActionsAttrAccess::Read(const ConcreteReadAttributePath & aPath, Attr
}
} // anonymous namespace

void MatterActionsPluginServerInitCallback()
{
AttributeAccessInterfaceRegistry::Instance().Register(&gAttrAccess);
}
//void MatterActionsPluginServerInitCallback()
//{
// AttributeAccessInterfaceRegistry::Instance().Register(&gAttrAccess);
//}
8 changes: 4 additions & 4 deletions examples/bridge-app/telink/src/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ CHIP_ERROR ActionsAttrAccess::Read(const ConcreteReadAttributePath & aPath, Attr
}
} // anonymous namespace

void MatterActionsPluginServerInitCallback(void)
{
AttributeAccessInterfaceRegistry::Instance().Register(&gAttrAccess);
}
//void MatterActionsPluginServerInitCallback(void)
//{
// AttributeAccessInterfaceRegistry::Instance().Register(&gAttrAccess);
//}
1 change: 1 addition & 0 deletions src/app/clusters/actions-server/actions-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ using namespace chip::app;
using namespace chip::app::Clusters;
using namespace chip::app::Clusters::Actions;
using namespace chip::app::Clusters::Actions::Attributes;
using namespace chip::Protocols::InteractionModel;

Instance Instance::instance;
Instance * Instance::GetInstance()
Expand Down
29 changes: 12 additions & 17 deletions src/app/clusters/actions-server/actions-server.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@
#include <app/CommandHandlerInterface.h>
#include <protocols/interaction_model/StatusCode.h>

using namespace chip;
using namespace chip::app;
using namespace chip::app::Clusters;
using namespace chip::Protocols::InteractionModel;

namespace chip {
namespace app {
namespace Clusters {
Expand Down Expand Up @@ -126,7 +121,7 @@ class Delegate
* @param actionId The id of an action on which an action shall takes place.
* @return Returns a Success if an action took place successfully otherwise, suitable error.
*/
virtual Status HandleInstantAction(uint16_t actionId, Optional<uint32_t> invokeId);
virtual Protocols::InteractionModel::Status HandleInstantAction(uint16_t actionId, Optional<uint32_t> invokeId);

/**
* When an InstantActionWithTransition command is recieved, an action (state change) on the involved endpoints shall trigger,
Expand All @@ -137,7 +132,7 @@ class Delegate
* @param transitionTime The time for transition from the current state to the new state.
* @return Returns a Success if an action took place successfully otherwise, suitable error.
*/
virtual Status HandleInstantActionWithTransition(uint16_t actionId, uint16_t transitionTime, Optional<uint32_t> invokeId);
virtual Protocols::InteractionModel::Status HandleInstantActionWithTransition(uint16_t actionId, uint16_t transitionTime, Optional<uint32_t> invokeId);

/**
* When a StartAction command is recieved, the commencement of an action on the involved endpoints shall trigger. Afterwards,
Expand All @@ -146,7 +141,7 @@ class Delegate
* @param actionId The id of an action on which an action shall takes place.
* @return Returns a Success if an action took place successfully otherwise, suitable error.
*/
virtual Status HandleStartAction(uint16_t actionId, Optional<uint32_t> invokeId);
virtual Protocols::InteractionModel::Status HandleStartAction(uint16_t actionId, Optional<uint32_t> invokeId);

/**
* When a StartActionWithDuration command is recieved, the commencement of an action on the involved endpoints shall trigger,
Expand All @@ -157,7 +152,7 @@ class Delegate
* @param duration The time for which an action shall be in start state.
* @return Returns a Success if an action took place successfully otherwise, suitable error.
*/
virtual Status HandleStartActionWithDuration(uint16_t actionId, uint32_t duration, Optional<uint32_t> invokeId);
virtual Protocols::InteractionModel::Status HandleStartActionWithDuration(uint16_t actionId, uint32_t duration, Optional<uint32_t> invokeId);

/**
* When a StopAction command is recieved, the ongoing action on the involved endpoints shall stop. Afterwards, the action’s
Expand All @@ -166,7 +161,7 @@ class Delegate
* @param actionId The id of an action on which an action shall takes place.
* @return Returns a Success if an action took place successfully otherwise, suitable error.
*/
virtual Status HandleStopAction(uint16_t actionId, Optional<uint32_t> invokeId);
virtual Protocols::InteractionModel::Status HandleStopAction(uint16_t actionId, Optional<uint32_t> invokeId);

/**
* When a PauseAction command is recieved, the ongoing action on the involved endpoints shall pause and SHALL change the
Expand All @@ -175,7 +170,7 @@ class Delegate
* @param actionId The id of an action on which an action shall takes place.
* @return Returns a Success if an action took place successfully otherwise, suitable error.
*/
virtual Status HandlePauseAction(uint16_t actionId, Optional<uint32_t> invokeId);
virtual Protocols::InteractionModel::Status HandlePauseAction(uint16_t actionId, Optional<uint32_t> invokeId);

/**
* When a PauseActionWithDuration command is recieved, pauses an ongoing action, and SHALL change the action’s state to Paused.
Expand All @@ -186,7 +181,7 @@ class Delegate
* @param duration The time for which an action shall be in pause state.
* @return Returns a Success if an action took place successfully otherwise, suitable error.
*/
virtual Status HandlePauseActionWithDuration(uint16_t actionId, uint32_t duration, Optional<uint32_t> invokeId);
virtual Protocols::InteractionModel::Status HandlePauseActionWithDuration(uint16_t actionId, uint32_t duration, Optional<uint32_t> invokeId);

/**
* When a ResumeAction command is recieved, the previously paused action shall resume and SHALL change the action’s state to
Expand All @@ -195,7 +190,7 @@ class Delegate
* @param actionId The id of an action on which an action shall takes place.
* @return Returns a Success if an action took place successfully otherwise, suitable error.
*/
virtual Status HandleResumeAction(uint16_t actionId, Optional<uint32_t> invokeId);
virtual Protocols::InteractionModel::Status HandleResumeAction(uint16_t actionId, Optional<uint32_t> invokeId);

/**
* When an EnableAction command is recieved, it enables a certain action or automation. Afterwards, the action’s state SHALL be
Expand All @@ -204,7 +199,7 @@ class Delegate
* @param actionId The id of an action on which an action shall takes place.
* @return Returns a Success if an action took place successfully otherwise, suitable error.
*/
virtual Status HandleEnableAction(uint16_t actionId, Optional<uint32_t> invokeId);
virtual Protocols::InteractionModel::Status HandleEnableAction(uint16_t actionId, Optional<uint32_t> invokeId);

/**
* When an EnableActionWithDuration command is recieved, it enables a certain action or automation, and SHALL change the
Expand All @@ -215,7 +210,7 @@ class Delegate
* @param duration The time for which an action shall be in active state.
* @return Returns a Success if an action took place successfully otherwise, suitable error.
*/
virtual Status HandleEnableActionWithDuration(uint16_t actionId, uint32_t duration, Optional<uint32_t> invokeId);
virtual Protocols::InteractionModel::Status HandleEnableActionWithDuration(uint16_t actionId, uint32_t duration, Optional<uint32_t> invokeId);

/**
* When a DisableAction command is recieved, it disables a certain action or automation, and SHALL change the action’s state to
Expand All @@ -224,7 +219,7 @@ class Delegate
* @param actionId The id of an action on which an action shall takes place.
* @return Returns a Success if an action took place successfully otherwise, suitable error.
*/
virtual Status HandleDisableAction(uint16_t actionId, Optional<uint32_t> invokeId);
virtual Protocols::InteractionModel::Status HandleDisableAction(uint16_t actionId, Optional<uint32_t> invokeId);

/**
* When a DisableActionWithDuration command is recieved, it disables a certain action or automation, and SHALL change the
Expand All @@ -235,7 +230,7 @@ class Delegate
* @param duration The time for which an action shall be in disable state.
* @return Returns a Success if an action took place successfully otherwise, suitable error.
*/
virtual Status HandleDisableActionWithDuration(uint16_t actionId, uint32_t duration, Optional<uint32_t> invokeId);
virtual Protocols::InteractionModel::Status HandleDisableActionWithDuration(uint16_t actionId, uint32_t duration, Optional<uint32_t> invokeId);
};

} // namespace Actions
Expand Down

0 comments on commit 745c18c

Please sign in to comment.