Skip to content

Commit

Permalink
[cleanup] Remove code for encoding ember response commands (#7843)
Browse files Browse the repository at this point in the history
* [cleanup] Remove code for encoding im response commands

* Restyled by clang-format

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Aug 10, 2021
1 parent 2796b21 commit 5a55491
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 364 deletions.
13 changes: 0 additions & 13 deletions src/app/clusters/door-lock-server/door-lock-server-logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,6 @@ bool emberAfDoorLockClusterGetLogRecordCallback(chip::app::Command * commandObj,
}
else
{
if (commandObj == nullptr)
{
emberAfFillExternalBuffer((ZCL_CLUSTER_SPECIFIC_COMMAND | ZCL_FRAME_CONTROL_SERVER_TO_CLIENT), ZCL_DOOR_LOCK_CLUSTER_ID,
ZCL_GET_LOG_RECORD_RESPONSE_COMMAND_ID, "vwuuuvs", entry.logEntryId, entry.timestamp,
entry.eventType, entry.source, entry.eventId, entry.userId, entry.pin);

status = emberAfSendResponse();
if (status != EMBER_SUCCESS)
{
emberAfDoorLockClusterPrintln("Failed to send GetLogRecordResponse: 0x%X", status);
}
}
else
{
app::CommandPathParams cmdParams = { emberAfCurrentEndpoint(), /* group id */ 0, ZCL_DOOR_LOCK_CLUSTER_ID,
ZCL_GET_LOG_RECORD_RESPONSE_COMMAND_ID,
Expand Down
79 changes: 1 addition & 78 deletions src/app/clusters/door-lock-server/door-lock-server-schedule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,6 @@ void emAfPluginDoorLockServerInitSchedule(void)
#endif
}

static void sendResponse(const char * responseName)
{
EmberStatus status = emberAfSendResponse();
if (status != EMBER_SUCCESS)
{
emberAfDoorLockClusterPrintln("Failed to send %s: 0x%X", responseName, status);
}
}

bool emberAfDoorLockClusterSetWeekdayScheduleCallback(chip::app::Command * commandObj, uint8_t scheduleId, uint16_t userId,
uint8_t daysMask, uint8_t startHour, uint8_t startMinute, uint8_t stopHour,
uint8_t stopMinute)
Expand Down Expand Up @@ -156,13 +147,7 @@ bool emberAfDoorLockClusterSetWeekdayScheduleCallback(chip::app::Command * comma
emberAfDoorLockClusterPrintln("***RX SET WEEKDAY SCHEDULE***");
printWeekdayScheduleTable();
}
if (commandObj == nullptr)
{
emberAfFillExternalBuffer((ZCL_CLUSTER_SPECIFIC_COMMAND | ZCL_FRAME_CONTROL_SERVER_TO_CLIENT), ZCL_DOOR_LOCK_CLUSTER_ID,
ZCL_SET_WEEKDAY_SCHEDULE_RESPONSE_COMMAND_ID, "u", status);
emberAfSendResponse();
}
else

{
app::CommandPathParams cmdParams = { emberAfCurrentEndpoint(), /* group id */ 0, ZCL_DOOR_LOCK_CLUSTER_ID,
ZCL_SET_WEEKDAY_SCHEDULE_RESPONSE_COMMAND_ID,
Expand Down Expand Up @@ -206,15 +191,7 @@ bool emberAfDoorLockClusterGetWeekdayScheduleCallback(chip::app::Command * comma
zclStatus = (!entry->inUse ? EMBER_ZCL_STATUS_NOT_FOUND
: (entry->userId != userId ? EMBER_ZCL_STATUS_NOT_FOUND : EMBER_ZCL_STATUS_SUCCESS));
}
if (commandObj == nullptr)
{
emberAfFillExternalBuffer((ZCL_CLUSTER_SPECIFIC_COMMAND | ZCL_FRAME_CONTROL_SERVER_TO_CLIENT), ZCL_DOOR_LOCK_CLUSTER_ID,
ZCL_GET_WEEKDAY_SCHEDULE_RESPONSE_COMMAND_ID, "uvuuuuuu", scheduleId, userId, zclStatus,
entry->daysMask, entry->startHour, entry->startMinute, entry->stopHour, entry->stopMinute);

sendResponse("GetWeekdayScheduleResponse");
}
else
{
app::CommandPathParams cmdParams = { emberAfCurrentEndpoint(), /* group id */ 0, ZCL_DOOR_LOCK_CLUSTER_ID,
ZCL_GET_WEEKDAY_SCHEDULE_RESPONSE_COMMAND_ID,
Expand Down Expand Up @@ -252,14 +229,6 @@ bool emberAfDoorLockClusterClearWeekdayScheduleCallback(chip::app::Command * com
emAfPluginDoorLockServerSetPinUserType(userId, EMBER_ZCL_DOOR_LOCK_USER_TYPE_UNRESTRICTED);
}

if (commandObj == nullptr)
{
emberAfFillExternalBuffer((ZCL_CLUSTER_SPECIFIC_COMMAND | ZCL_FRAME_CONTROL_SERVER_TO_CLIENT), ZCL_DOOR_LOCK_CLUSTER_ID,
ZCL_CLEAR_WEEKDAY_SCHEDULE_RESPONSE_COMMAND_ID, "u", zclStatus);

sendResponse("ClearWeekdayScheduleResponse");
}
else
{
app::CommandPathParams cmdParams = { emberAfCurrentEndpoint(), /* group id */ 0, ZCL_DOOR_LOCK_CLUSTER_ID,
ZCL_CLEAR_WEEKDAY_SCHEDULE_RESPONSE_COMMAND_ID,
Expand Down Expand Up @@ -295,14 +264,7 @@ bool emberAfDoorLockClusterSetYeardayScheduleCallback(chip::app::Command * comma
yeardayScheduleTable[scheduleId].inUse = true;
status = 0x00; // success (per 7.3.2.17.15)
}
if (commandObj == nullptr)
{
emberAfFillExternalBuffer((ZCL_CLUSTER_SPECIFIC_COMMAND | ZCL_FRAME_CONTROL_SERVER_TO_CLIENT), ZCL_DOOR_LOCK_CLUSTER_ID,
ZCL_SET_YEARDAY_SCHEDULE_RESPONSE_COMMAND_ID, "u", status);

sendResponse("SetYeardayScheduleResponse");
}
else
{
app::CommandPathParams cmdParams = { emberAfCurrentEndpoint(), /* group id */ 0, ZCL_DOOR_LOCK_CLUSTER_ID,
ZCL_SET_YEARDAY_SCHEDULE_RESPONSE_COMMAND_ID,
Expand Down Expand Up @@ -344,15 +306,6 @@ bool emberAfDoorLockClusterGetYeardayScheduleCallback(chip::app::Command * comma
}
}

if (commandObj == nullptr)
{
emberAfFillExternalBuffer((ZCL_CLUSTER_SPECIFIC_COMMAND | ZCL_FRAME_CONTROL_SERVER_TO_CLIENT), ZCL_DOOR_LOCK_CLUSTER_ID,
ZCL_GET_YEARDAY_SCHEDULE_RESPONSE_COMMAND_ID, "uvuww", scheduleId, userId, zclStatus,
entry->localStartTime, entry->localEndTime);

sendResponse("GetYeardayScheduleResponse");
}
else
{
app::CommandPathParams cmdParams = { emberAfCurrentEndpoint(), /* group id */ 0, ZCL_DOOR_LOCK_CLUSTER_ID,
ZCL_GET_YEARDAY_SCHEDULE_RESPONSE_COMMAND_ID,
Expand Down Expand Up @@ -389,14 +342,7 @@ bool emberAfDoorLockClusterClearYeardayScheduleCallback(chip::app::Command * com
emAfPluginDoorLockServerSetPinUserType(userId, EMBER_ZCL_DOOR_LOCK_USER_TYPE_UNRESTRICTED);
status = 0x00; // success (per 7.3.2.17.17)
}
if (commandObj == nullptr)
{
emberAfFillExternalBuffer((ZCL_CLUSTER_SPECIFIC_COMMAND | ZCL_FRAME_CONTROL_SERVER_TO_CLIENT), ZCL_DOOR_LOCK_CLUSTER_ID,
ZCL_CLEAR_YEARDAY_SCHEDULE_RESPONSE_COMMAND_ID, "u", status);

sendResponse("ClearYeardayScheduleResponse");
}
else
{
app::CommandPathParams cmdParams = { emberAfCurrentEndpoint(), /* group id */ 0, ZCL_DOOR_LOCK_CLUSTER_ID,
ZCL_CLEAR_YEARDAY_SCHEDULE_RESPONSE_COMMAND_ID,
Expand Down Expand Up @@ -435,14 +381,7 @@ bool emberAfDoorLockClusterSetHolidayScheduleCallback(chip::app::Command * comma
holidayScheduleTable[holidayScheduleId].inUse = true;
status = 0x00; // success (per 7.3.2.17.18)
}
if (commandObj == nullptr)
{
emberAfFillExternalBuffer((ZCL_CLUSTER_SPECIFIC_COMMAND | ZCL_FRAME_CONTROL_SERVER_TO_CLIENT), ZCL_DOOR_LOCK_CLUSTER_ID,
ZCL_SET_HOLIDAY_SCHEDULE_RESPONSE_COMMAND_ID, "u", status);

sendResponse("SetHolidayScheduleResponse");
}
else
{
app::CommandPathParams cmdParams = { emberAfCurrentEndpoint(), /* group id */ 0, ZCL_DOOR_LOCK_CLUSTER_ID,
ZCL_SET_HOLIDAY_SCHEDULE_RESPONSE_COMMAND_ID,
Expand Down Expand Up @@ -483,15 +422,6 @@ bool emberAfDoorLockClusterGetHolidayScheduleCallback(chip::app::Command * comma
}
}

if (commandObj == nullptr)
{
emberAfFillExternalBuffer((ZCL_CLUSTER_SPECIFIC_COMMAND | ZCL_FRAME_CONTROL_SERVER_TO_CLIENT), ZCL_DOOR_LOCK_CLUSTER_ID,
ZCL_GET_HOLIDAY_SCHEDULE_RESPONSE_COMMAND_ID, "uuwwu", holidayScheduleId, zclStatus,
entry->localStartTime, entry->localEndTime, entry->operatingModeDuringHoliday);

sendResponse("GetHolidayScheduleResponse");
}
else
{
app::CommandPathParams cmdParams = { emberAfCurrentEndpoint(), /* group id */ 0, ZCL_DOOR_LOCK_CLUSTER_ID,
ZCL_GET_HOLIDAY_SCHEDULE_RESPONSE_COMMAND_ID,
Expand Down Expand Up @@ -527,14 +457,7 @@ bool emberAfDoorLockClusterClearHolidayScheduleCallback(chip::app::Command * com
holidayScheduleTable[holidayScheduleId].inUse = false;
status = 0x00; // success (per 7.3.2.17.20)
}
if (commandObj == nullptr)
{
emberAfFillExternalBuffer((ZCL_CLUSTER_SPECIFIC_COMMAND | ZCL_FRAME_CONTROL_SERVER_TO_CLIENT), ZCL_DOOR_LOCK_CLUSTER_ID,
ZCL_CLEAR_HOLIDAY_SCHEDULE_RESPONSE_COMMAND_ID, "u", status);

sendResponse("ClearYeardayScheduleResponse");
}
else
{
app::CommandPathParams cmdParams = { emberAfCurrentEndpoint(), /* group id */ 0, ZCL_DOOR_LOCK_CLUSTER_ID,
ZCL_CLEAR_HOLIDAY_SCHEDULE_RESPONSE_COMMAND_ID,
Expand Down
Loading

0 comments on commit 5a55491

Please sign in to comment.