From 5b7d14743aba0426496eda67d1a33053047dfbff Mon Sep 17 00:00:00 2001 From: Morozov-5F Date: Tue, 21 Jun 2022 11:27:19 +0300 Subject: [PATCH] [#19622] Return generic failure instead of not found for schedule operations in the door lock --- .../door-lock-server/door-lock-server.cpp | 12 +++++----- src/app/tests/suites/DL_Schedules.yaml | 22 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/app/clusters/door-lock-server/door-lock-server.cpp b/src/app/clusters/door-lock-server/door-lock-server.cpp index 84b199bb7c591e..58c9384b33a42d 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.cpp +++ b/src/app/clusters/door-lock-server/door-lock-server.cpp @@ -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; } @@ -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; } @@ -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; } @@ -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; } @@ -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; } @@ -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; } diff --git a/src/app/tests/suites/DL_Schedules.yaml b/src/app/tests/suites/DL_Schedules.yaml index 4c2d23875d33f5..580b6556a26869 100644 --- a/src/app/tests/suites/DL_Schedules.yaml +++ b/src/app/tests/suites/DL_Schedules.yaml @@ -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" @@ -488,7 +488,7 @@ tests: - name: "userIndex" value: 2 - name: "status" - value: 0x8B + value: 0x01 # # Excercise SetYearDay schedules with invalid parameters @@ -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" @@ -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" @@ -686,7 +686,7 @@ tests: - name: "userIndex" value: 2 - name: "status" - value: 0x8B + value: 0x01 # # Excercise Set Holiday schedules with invalid parameters @@ -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" @@ -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" @@ -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" @@ -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" @@ -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" @@ -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"