Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jadhavrohit924 committed Oct 7, 2024
1 parent 4c10844 commit 379fba2
Show file tree
Hide file tree
Showing 14 changed files with 103 additions and 432 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,29 @@ const uint16_t kEndpointListSize = 3;
class ActionsDelegateImpl : public Delegate
{
private:
const GenericActionStruct kActionList[kActionListSize] = {
GenericActionStruct(0, CharSpan::fromCharString("TurnOnLight"), ActionTypeEnum::kScene, 0, 0, ActionStateEnum::kInactive),
GenericActionStruct(1, CharSpan::fromCharString("TurnOffLight"), ActionTypeEnum::kScene, 1, 0, ActionStateEnum::kInactive),
GenericActionStruct(2, CharSpan::fromCharString("ToggleLight"), ActionTypeEnum::kScene, 2, 0, ActionStateEnum::kInactive),
const ActionStructStorage kActionList[kActionListSize] = {
ActionStructStorage(0, CharSpan::fromCharString("TurnOnLight"), ActionTypeEnum::kScene, 0, 0, ActionStateEnum::kInactive),
ActionStructStorage(1, CharSpan::fromCharString("TurnOffLight"), ActionTypeEnum::kScene, 1, 0, ActionStateEnum::kInactive),
ActionStructStorage(2, CharSpan::fromCharString("ToggleLight"), ActionTypeEnum::kScene, 2, 0, ActionStateEnum::kInactive),
};

// Dummy endpoint list.
const EndpointId firstEpList[1] = { 0 };
const EndpointId secondEpList[1] = { 0 };
const EndpointId thirdEpList[1] = { 0 };

const GenericEndpointList kEndpointList[kEndpointListSize] = {
GenericEndpointList(0, CharSpan::fromCharString("On"), EndpointListTypeEnum::kOther,
const EndpointListStorage kEndpointList[kEndpointListSize] = {
EndpointListStorage(0, CharSpan::fromCharString("On"), EndpointListTypeEnum::kOther,
DataModel::List<const EndpointId>(firstEpList)),
GenericEndpointList(1, CharSpan::fromCharString("Off"), EndpointListTypeEnum::kOther,
EndpointListStorage(1, CharSpan::fromCharString("Off"), EndpointListTypeEnum::kOther,
DataModel::List<const EndpointId>(secondEpList)),
GenericEndpointList(2, CharSpan::fromCharString("Toggle"), EndpointListTypeEnum::kOther,
EndpointListStorage(2, CharSpan::fromCharString("Toggle"), EndpointListTypeEnum::kOther,
DataModel::List<const EndpointId>(thirdEpList)),
};

CHIP_ERROR ReadActionAtIndex(uint16_t index, GenericActionStruct & action) override;
CHIP_ERROR ReadEndpointListAtIndex(uint16_t index, GenericEndpointList & epList) override;
CHIP_ERROR FindActionIdInActionList(uint16_t actionId) override;
CHIP_ERROR ReadActionAtIndex(uint16_t index, ActionStructStorage & action) override;
CHIP_ERROR ReadEndpointListAtIndex(uint16_t index, EndpointListStorage & epList) override;
bool FindActionIdInActionList(uint16_t actionId) override;

Protocols::InteractionModel::Status HandleInstantAction(uint16_t actionId, Optional<uint32_t> invokeId) override;
Protocols::InteractionModel::Status HandleInstantActionWithTransition(uint16_t actionId, uint16_t transitionTime,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ 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, GenericActionStruct & action)
CHIP_ERROR ActionsDelegateImpl::ReadActionAtIndex(uint16_t index, ActionStructStorage & action)
{
if (index >= ArraySize(kActionList))
{
Expand All @@ -34,7 +34,7 @@ CHIP_ERROR ActionsDelegateImpl::ReadActionAtIndex(uint16_t index, GenericActionS
return CHIP_NO_ERROR;
}

CHIP_ERROR ActionsDelegateImpl::ReadEndpointListAtIndex(uint16_t index, GenericEndpointList & epList)
CHIP_ERROR ActionsDelegateImpl::ReadEndpointListAtIndex(uint16_t index, EndpointListStorage & epList)
{
if (index >= ArraySize(kEndpointList))
{
Expand All @@ -44,14 +44,14 @@ CHIP_ERROR ActionsDelegateImpl::ReadEndpointListAtIndex(uint16_t index, GenericE
return CHIP_NO_ERROR;
}

CHIP_ERROR ActionsDelegateImpl::FindActionIdInActionList(uint16_t actionId)
bool ActionsDelegateImpl::FindActionIdInActionList(uint16_t actionId)
{
for (uint16_t i = 0; i < kActionListSize; i++)
{
if (kActionList[i].actionID == actionId)
return CHIP_NO_ERROR;
return true;
}
return CHIP_ERROR_NOT_FOUND;
return false;
}

Status ActionsDelegateImpl::HandleInstantAction(uint16_t actionId, Optional<uint32_t> invokeId)
Expand Down
1 change: 0 additions & 1 deletion examples/bridge-app/asr/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ asr_executable("bridge_app") {
"${examples_plat_dir}/shell/matter_shell.cpp",
"src/AppTask.cpp",
"src/DeviceCallbacks.cpp",
"src/bridged-actions-stub.cpp",
"src/main.cpp",
"subdevice/SubDevice.cpp",
"subdevice/SubDeviceManager.cpp",
Expand Down
101 changes: 0 additions & 101 deletions examples/bridge-app/asr/src/bridged-actions-stub.cpp

This file was deleted.

8 changes: 0 additions & 8 deletions examples/bridge-app/asr/subdevice/SubDeviceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,6 @@ void HandleDeviceStatusChanged(SubDevice * dev, SubDevice::Changed_t itemChanged
const EmberAfDeviceType gRootDeviceTypes[] = { { DEVICE_TYPE_ROOT_NODE, DEVICE_VERSION_DEFAULT } };
const EmberAfDeviceType gAggregateNodeDeviceTypes[] = { { DEVICE_TYPE_BRIDGE, DEVICE_VERSION_DEFAULT } };

bool emberAfActionsClusterInstantActionCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Actions::Commands::InstantAction::DecodableType & commandData)
{
// No actions are implemented, just return status NotFound.
commandObj->AddStatus(commandPath, Protocols::InteractionModel::Status::NotFound);
return true;
}

void Init_Bridge_Endpoint()
{
// bridge will have own database named gSubDevices.
Expand Down
8 changes: 8 additions & 0 deletions examples/bridge-app/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ executable("chip-bridge-app") {
"main.cpp",
]

# Generic implementation of the actions cluster is not introduced in this app as this app has
# an interface to test actions.
# TODO: Generic implementation can be used here instead of having its own.
excludes = [ "${chip_root}/src/app/clusters/actions-server/**" ]

# Apply excludes to the sources
sources -= excludes

deps = [
"${chip_root}/examples/bridge-app/bridge-common",
"${chip_root}/examples/platform/linux:app-main",
Expand Down
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: 0 additions & 8 deletions examples/bridge-app/telink/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,14 +387,6 @@ void HandleDeviceStatusChanged(Device * dev, Device::Changed_t itemChangedMask)
}
}

bool emberAfActionsClusterInstantActionCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Clusters::Actions::Commands::InstantAction::DecodableType & commandData)
{
// No actions are implemented, just return status NotFound.
commandObj->AddStatus(commandPath, Protocols::InteractionModel::Status::NotFound);
return true;
}

CHIP_ERROR AppTask::Init(void)
{
SetExampleButtonCallbacks(LightingActionEventHandler);
Expand Down
105 changes: 0 additions & 105 deletions examples/bridge-app/telink/src/DeviceCallbacks.cpp

This file was deleted.

1 change: 0 additions & 1 deletion examples/placeholder/linux/apps/app1/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ source_set("app1") {

sources = [
"../../resource-monitoring-delegates.cpp",
"../../src/bridged-actions-stub.cpp",
"../../static-supported-modes-manager.cpp",
"../../thread-border-router-management.cpp",
]
Expand Down
1 change: 0 additions & 1 deletion examples/placeholder/linux/apps/app2/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ source_set("app2") {

sources = [
"../../resource-monitoring-delegates.cpp",
"../../src/bridged-actions-stub.cpp",
"../../static-supported-modes-manager.cpp",
]

Expand Down
Loading

0 comments on commit 379fba2

Please sign in to comment.