Skip to content

Commit

Permalink
Replace some deprecated EMBER_ZCL_STATUS by their non deprecated coun…
Browse files Browse the repository at this point in the history
…terparts (#23883)

* Remove EMBER_ZCL_STATUS_NOT_AUTHORIZED

* Remove EMBER_ZCL_STATUS_INVALID_FIELD

* Remove EMBER_ZCL_STATUS_INVALID_VALUE

* Remove EMBER_ZCL_STATUS_READ_ONLY

* Remove EMBER_ZCL_STATUS_INSUFFICIENT_SPACE
  • Loading branch information
vivien-apple authored and pull[bot] committed Feb 7, 2023
1 parent 74a706d commit 1852241
Show file tree
Hide file tree
Showing 18 changed files with 164 additions and 169 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ constexpr pw::Status EmberStatusToPwStatus(EmberAfStatus ember_status)
return pw::OkStatus();
case EMBER_ZCL_STATUS_NOT_FOUND:
return pw::Status::NotFound();
case EMBER_ZCL_STATUS_NOT_AUTHORIZED:
case EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS:
return pw::Status::PermissionDenied();
default:
return pw::Status::Unknown();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ static void stepHandler(CommandId commandId, uint8_t stepMode, uint8_t stepSize,
}
break;
default:
status = EMBER_ZCL_STATUS_INVALID_FIELD;
status = EMBER_ZCL_STATUS_INVALID_COMMAND;
goto send_default_response;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ bool emberAfAccountLoginClusterLoginCallback(app::CommandHandler * command, cons

if (!delegate->HandleLogin(tempAccountIdentifier, setupPin))
{
status = EMBER_ZCL_STATUS_NOT_AUTHORIZED;
status = EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS;
}

exit:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ bool emberAfBarrierControlClusterBarrierControlGoToPercentCallback(
percentOpen != EMBER_ZCL_BARRIER_CONTROL_BARRIER_POSITION_CLOSED &&
percentOpen != EMBER_ZCL_BARRIER_CONTROL_BARRIER_POSITION_OPEN))
{
status = EMBER_ZCL_STATUS_INVALID_VALUE;
status = EMBER_ZCL_STATUS_CONSTRAINT_ERROR;
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2207,7 +2207,7 @@ bool ColorControlServer::moveColorTempCommand(const app::ConcreteCommandPath & c

if (rate == 0)
{
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_INVALID_FIELD);
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_INVALID_COMMAND);
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/clusters/groups-server/groups-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ bool emberAfGroupsClusterViewGroupCallback(app::CommandHandler * commandObj, con
CHIP_ERROR err = CHIP_NO_ERROR;
EmberAfStatus status = EMBER_ZCL_STATUS_NOT_FOUND;

VerifyOrExit(IsFabricGroupId(groupId), status = EMBER_ZCL_STATUS_INVALID_VALUE);
VerifyOrExit(IsFabricGroupId(groupId), status = EMBER_ZCL_STATUS_CONSTRAINT_ERROR);
VerifyOrExit(nullptr != provider, status = EMBER_ZCL_STATUS_FAILURE);
VerifyOrExit(provider->HasEndpoint(fabricIndex, groupId, commandPath.mEndpointId), status = EMBER_ZCL_STATUS_NOT_FOUND);

Expand Down
4 changes: 2 additions & 2 deletions src/app/clusters/ias-zone-server/ias-zone-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,12 @@ EmberAfStatus emberAfPluginIasZoneClusterSetEnrollmentMethod(EndpointId endpoint
if (emberAfIasZoneClusterAmIEnrolled(endpoint))
{
emberAfIasZoneClusterPrintln("Error: Already enrolled");
status = EMBER_ZCL_STATUS_NOT_AUTHORIZED;
status = EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS;
}
else if (!isValidEnrollmentMode(method))
{
emberAfIasZoneClusterPrintln("Invalid IAS Zone Server Enrollment Mode: %d", method);
status = EMBER_ZCL_STATUS_INVALID_VALUE;
status = EMBER_ZCL_STATUS_CONSTRAINT_ERROR;
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions src/app/clusters/level-control/level-control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ static void moveHandler(EndpointId endpoint, CommandId commandId, uint8_t moveMo
difference = static_cast<uint8_t>(currentLevel.Value() - state->minLevel);
break;
default:
status = EMBER_ZCL_STATUS_INVALID_FIELD;
status = EMBER_ZCL_STATUS_INVALID_COMMAND;
goto send_default_response;
}

Expand Down Expand Up @@ -972,7 +972,7 @@ static void stepHandler(EndpointId endpoint, CommandId commandId, uint8_t stepMo
}
break;
default:
status = EMBER_ZCL_STATUS_INVALID_FIELD;
status = EMBER_ZCL_STATUS_INVALID_COMMAND;
goto send_default_response;
}

Expand Down
18 changes: 9 additions & 9 deletions src/app/clusters/scenes/scenes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ bool emberAfScenesClusterRemoveSceneCallback(app::CommandHandler * commandObj, c

if (!isEndpointInGroup(fabricIndex, emberAfCurrentEndpoint(), groupId))
{
status = EMBER_ZCL_STATUS_INVALID_FIELD;
status = EMBER_ZCL_STATUS_INVALID_COMMAND;
}
else
{
Expand Down Expand Up @@ -284,7 +284,7 @@ bool emberAfScenesClusterRemoveAllScenesCallback(app::CommandHandler * commandOb
auto fabricIndex = commandObj->GetAccessingFabricIndex();
auto & groupId = commandData.groupId;

EmberAfStatus status = EMBER_ZCL_STATUS_INVALID_FIELD;
EmberAfStatus status = EMBER_ZCL_STATUS_INVALID_COMMAND;
CHIP_ERROR err = CHIP_NO_ERROR;

emberAfScenesClusterPrintln("RX: RemoveAllScenes 0x%2x", groupId);
Expand Down Expand Up @@ -417,7 +417,7 @@ bool emberAfScenesClusterGetSceneMembershipCallback(app::CommandHandler * comman

if (!isEndpointInGroup(fabricIndex, emberAfCurrentEndpoint(), groupId))
{
status = EMBER_ZCL_STATUS_INVALID_FIELD;
status = EMBER_ZCL_STATUS_INVALID_COMMAND;
}

if (status == EMBER_ZCL_STATUS_SUCCESS)
Expand Down Expand Up @@ -471,7 +471,7 @@ EmberAfStatus emberAfScenesClusterStoreCurrentSceneCallback(chip::FabricIndex fa

if (!isEndpointInGroup(fabricIndex, endpoint, groupId))
{
return EMBER_ZCL_STATUS_INVALID_FIELD;
return EMBER_ZCL_STATUS_INVALID_COMMAND;
}

for (i = 0; i < MATTER_SCENES_TABLE_SIZE; i++)
Expand All @@ -491,7 +491,7 @@ EmberAfStatus emberAfScenesClusterStoreCurrentSceneCallback(chip::FabricIndex fa
// If the target index is still zero, the table is full.
if (index == EMBER_AF_SCENE_TABLE_NULL_INDEX)
{
return EMBER_ZCL_STATUS_INSUFFICIENT_SPACE;
return EMBER_ZCL_STATUS_RESOURCE_EXHAUSTED;
}

emberAfPluginScenesServerRetrieveSceneEntry(entry, index);
Expand Down Expand Up @@ -589,7 +589,7 @@ EmberAfStatus emberAfScenesClusterRecallSavedSceneCallback(chip::FabricIndex fab
{
if (!isEndpointInGroup(fabricIndex, endpoint, groupId))
{
return EMBER_ZCL_STATUS_INVALID_FIELD;
return EMBER_ZCL_STATUS_INVALID_COMMAND;
}

uint8_t i;
Expand Down Expand Up @@ -737,7 +737,7 @@ bool emberAfPluginScenesServerParseAddScene(
// Add Scene commands can only reference groups to which we belong.
if (!isEndpointInGroup(fabricIndex, endpoint, groupId))
{
status = EMBER_ZCL_STATUS_INVALID_FIELD;
status = EMBER_ZCL_STATUS_INVALID_COMMAND;
goto kickout;
}

Expand All @@ -758,7 +758,7 @@ bool emberAfPluginScenesServerParseAddScene(
// If the target index is still zero, the table is full.
if (index == EMBER_AF_SCENE_TABLE_NULL_INDEX)
{
status = EMBER_ZCL_STATUS_INSUFFICIENT_SPACE;
status = EMBER_ZCL_STATUS_RESOURCE_EXHAUSTED;
goto kickout;
}

Expand Down Expand Up @@ -1070,7 +1070,7 @@ bool emberAfPluginScenesServerParseViewScene(app::CommandHandler * commandObj, c
// View Scene commands can only reference groups which we belong to.
if (!isEndpointInGroup(fabricIndex, endpoint, groupId))
{
status = EMBER_ZCL_STATUS_INVALID_FIELD;
status = EMBER_ZCL_STATUS_INVALID_COMMAND;
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ bool emberAfWindowCoveringClusterGoToLiftPercentageCallback(app::CommandHandler
}
else
{
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_INVALID_VALUE);
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_CONSTRAINT_ERROR);
}
}
else
Expand Down Expand Up @@ -933,7 +933,7 @@ bool emberAfWindowCoveringClusterGoToTiltPercentageCallback(app::CommandHandler
}
else
{
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_INVALID_VALUE);
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_CONSTRAINT_ERROR);
}
}
else
Expand Down
Loading

0 comments on commit 1852241

Please sign in to comment.