Skip to content

Commit

Permalink
[project-chip#19622] Return generic failure instead of not found for …
Browse files Browse the repository at this point in the history
…schedule operations in the door lock
  • Loading branch information
Morozov-5F committed Jul 7, 2022
1 parent 1107d8e commit c282387
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
12 changes: 6 additions & 6 deletions src/app/clusters/door-lock-server/door-lock-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ void DoorLockServer::SetWeekDayScheduleCommandHandler(
emberAfDoorLockClusterPrintln("[SetWeekDaySchedule] Unable to add schedule - user does not exist "
"[endpointId=%d,weekDayIndex=%d,userIndex=%d]",
endpointId, weekDayIndex, userIndex);
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_NOT_FOUND);
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE);
return;
}

Expand Down Expand Up @@ -912,7 +912,7 @@ void DoorLockServer::GetWeekDayScheduleCommandHandler(
{
emberAfDoorLockClusterPrintln("[GetWeekDaySchedule] User does not exist [endpointId=%d,weekDayIndex=%d,userIndex=%d]",
endpointId, weekDayIndex, userIndex);
sendGetWeekDayScheduleResponse(commandObj, commandPath, weekDayIndex, userIndex, DlStatus::kNotFound);
sendGetWeekDayScheduleResponse(commandObj, commandPath, weekDayIndex, userIndex, DlStatus::kFailure);
return;
}

Expand Down Expand Up @@ -974,7 +974,7 @@ void DoorLockServer::ClearWeekDayScheduleCommandHandler(
{
emberAfDoorLockClusterPrintln("[ClearWeekDaySchedule] User does not exist [endpointId=%d,weekDayIndex=%d,userIndex=%d]",
endpointId, weekDayIndex, userIndex);
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_NOT_FOUND);
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE);
return;
}

Expand Down Expand Up @@ -1057,7 +1057,7 @@ void DoorLockServer::SetYearDayScheduleCommandHandler(
emberAfDoorLockClusterPrintln("[SetYearDaySchedule] Unable to add schedule - user does not exist "
"[endpointId=%d,yearDayIndex=%d,userIndex=%d]",
endpointId, yearDayIndex, userIndex);
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_NOT_FOUND);
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE);
return;
}

Expand Down Expand Up @@ -1122,7 +1122,7 @@ void DoorLockServer::GetYearDayScheduleCommandHandler(
{
emberAfDoorLockClusterPrintln("[GetYearDaySchedule] User does not exist [endpointId=%d,yearDayIndex=%d,userIndex=%d]",
endpointId, yearDayIndex, userIndex);
sendGetYearDayScheduleResponse(commandObj, commandPath, yearDayIndex, userIndex, DlStatus::kNotFound);
sendGetYearDayScheduleResponse(commandObj, commandPath, yearDayIndex, userIndex, DlStatus::kFailure);
return;
}

Expand Down Expand Up @@ -1183,7 +1183,7 @@ void DoorLockServer::ClearYearDayScheduleCommandHandler(
{
emberAfDoorLockClusterPrintln("[ClearYearDaySchedule] User does not exist [endpointId=%d,yearDayIndex=%d,userIndex=%d]",
endpointId, yearDayIndex, userIndex);
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_NOT_FOUND);
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE);
return;
}

Expand Down
22 changes: 11 additions & 11 deletions src/app/tests/suites/DL_Schedules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ tests:
- name: "endMinute"
value: 00
response:
error: NOT_FOUND
error: FAILURE

- label: "Create Week Day schedule with 0 days mask"
command: "SetWeekDaySchedule"
Expand Down Expand Up @@ -488,7 +488,7 @@ tests:
- name: "userIndex"
value: 2
- name: "status"
value: 0x8B
value: 0x01

#
# Excercise SetYearDay schedules with invalid parameters
Expand Down Expand Up @@ -566,7 +566,7 @@ tests:
- name: "localEndTime"
value: 12345689
response:
error: NOT_FOUND
error: FAILURE

- label: "Create Year Day schedule with start hour later that end hour"
command: "SetYearDaySchedule"
Expand All @@ -581,7 +581,7 @@ tests:
- name: "localEndTime"
value: 12345688
response:
error: INVALID_FIELD
error: INVALID_COMMAND

- label: "Make sure that previous operations did not create a schedule"
command: "GetYearDaySchedule"
Expand Down Expand Up @@ -686,7 +686,7 @@ tests:
- name: "userIndex"
value: 2
- name: "status"
value: 0x8B
value: 0x01

#
# Excercise Set Holiday schedules with invalid parameters
Expand Down Expand Up @@ -962,7 +962,7 @@ tests:
- name: "userIndex"
value: 2
response:
error: NOT_FOUND
error: FAILURE

- label: "Make sure that week day schedule was not deleted"
command: "GetWeekDaySchedule"
Expand Down Expand Up @@ -1087,7 +1087,7 @@ tests:
- name: "userIndex"
value: 2
response:
error: NOT_FOUND
error: FAILURE

- label: "Make sure that week day schedule was not deleted"
command: "GetWeekDaySchedule"
Expand Down Expand Up @@ -1799,7 +1799,7 @@ tests:
- name: "userIndex"
value: 1
- name: "status"
value: 0x8B
value: 0x01

- label: "Make sure clearing first user also cleared year day schedules"
command: "GetYearDaySchedule"
Expand All @@ -1816,7 +1816,7 @@ tests:
- name: "userIndex"
value: 1
- name: "status"
value: 0x8B
value: 0x01

- label: "Make sure clearing second user also cleared week day schedules"
command: "GetWeekDaySchedule"
Expand All @@ -1833,7 +1833,7 @@ tests:
- name: "userIndex"
value: 2
- name: "status"
value: 0x8B
value: 0x01

- label: "Make sure clearing second user also cleared year day schedules"
command: "GetYearDaySchedule"
Expand All @@ -1850,7 +1850,7 @@ tests:
- name: "userIndex"
value: 2
- name: "status"
value: 0x8B
value: 0x01

# Make sure that all the manipulations did not affect the holiday schedules
- label: "Make sure that first holiday schedule was not deleted"
Expand Down

0 comments on commit c282387

Please sign in to comment.