3 * Copyright (c) 2021 Project CHIP Authors
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 // THIS FILE IS GENERATED BY ZAP
23 #include "af-structs.h"
24 #include "call-command-handler.h"
26 #include "cluster-id.h"
27 #include "command-id.h"
30 #include <app/InteractionModelEngine.h>
32 // Currently we need some work to keep compatible with ember lib.
33 #include <util/ember-compatibility-functions.h>
38 // Cluster specific command parsing
42 namespace ContentLaunch {
44 void DispatchClientCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
49 case ZCL_LAUNCH_CONTENT_RESPONSE_COMMAND_ID: {
50 CHIP_ERROR TLVError = CHIP_NO_ERROR;
51 uint8_t contentLaunchStatus;
53 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
55 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
58 TLVError = dataTlv.Get(contentLaunchStatus);
61 // Unsupported tag, ignore it.
62 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
65 if (TLVError != CHIP_NO_ERROR)
67 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
68 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
71 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
72 emberAfContentLaunchClusterLaunchContentResponseCallback(contentLaunchStatus);
75 case ZCL_LAUNCH_URL_RESPONSE_COMMAND_ID: {
76 CHIP_ERROR TLVError = CHIP_NO_ERROR;
77 uint8_t contentLaunchStatus;
79 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
81 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
84 TLVError = dataTlv.Get(contentLaunchStatus);
87 // Unsupported tag, ignore it.
88 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
91 if (TLVError != CHIP_NO_ERROR)
93 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
94 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
97 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
98 emberAfContentLaunchClusterLaunchURLResponseCallback(contentLaunchStatus);
102 // Unrecognized command ID, error status will apply.
103 // TODO: Encode response for command not found
104 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_CONTENT_LAUNCH_CLUSTER_ID);
111 } // namespace ContentLaunch
115 void DispatchClientCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
120 case ZCL_CLEAR_ALL_PINS_RESPONSE_COMMAND_ID: {
121 CHIP_ERROR TLVError = CHIP_NO_ERROR;
124 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
126 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
129 TLVError = dataTlv.Get(status);
132 // Unsupported tag, ignore it.
133 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
136 if (TLVError != CHIP_NO_ERROR)
138 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
139 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
142 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
143 emberAfDoorLockClusterClearAllPinsResponseCallback(status);
146 case ZCL_CLEAR_ALL_RFIDS_RESPONSE_COMMAND_ID: {
147 CHIP_ERROR TLVError = CHIP_NO_ERROR;
150 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
152 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
155 TLVError = dataTlv.Get(status);
158 // Unsupported tag, ignore it.
159 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
162 if (TLVError != CHIP_NO_ERROR)
164 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
165 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
168 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
169 emberAfDoorLockClusterClearAllRfidsResponseCallback(status);
172 case ZCL_CLEAR_HOLIDAY_SCHEDULE_RESPONSE_COMMAND_ID: {
173 CHIP_ERROR TLVError = CHIP_NO_ERROR;
176 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
178 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
181 TLVError = dataTlv.Get(status);
184 // Unsupported tag, ignore it.
185 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
188 if (TLVError != CHIP_NO_ERROR)
190 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
191 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
194 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
195 emberAfDoorLockClusterClearHolidayScheduleResponseCallback(status);
198 case ZCL_CLEAR_PIN_RESPONSE_COMMAND_ID: {
199 CHIP_ERROR TLVError = CHIP_NO_ERROR;
202 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
204 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
207 TLVError = dataTlv.Get(status);
210 // Unsupported tag, ignore it.
211 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
214 if (TLVError != CHIP_NO_ERROR)
216 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
217 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
220 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
221 emberAfDoorLockClusterClearPinResponseCallback(status);
224 case ZCL_CLEAR_RFID_RESPONSE_COMMAND_ID: {
225 CHIP_ERROR TLVError = CHIP_NO_ERROR;
228 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
230 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
233 TLVError = dataTlv.Get(status);
236 // Unsupported tag, ignore it.
237 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
240 if (TLVError != CHIP_NO_ERROR)
242 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
243 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
246 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
247 emberAfDoorLockClusterClearRfidResponseCallback(status);
250 case ZCL_CLEAR_WEEKDAY_SCHEDULE_RESPONSE_COMMAND_ID: {
251 CHIP_ERROR TLVError = CHIP_NO_ERROR;
254 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
256 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
259 TLVError = dataTlv.Get(status);
262 // Unsupported tag, ignore it.
263 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
266 if (TLVError != CHIP_NO_ERROR)
268 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
269 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
272 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
273 emberAfDoorLockClusterClearWeekdayScheduleResponseCallback(status);
276 case ZCL_CLEAR_YEARDAY_SCHEDULE_RESPONSE_COMMAND_ID: {
277 CHIP_ERROR TLVError = CHIP_NO_ERROR;
280 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
282 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
285 TLVError = dataTlv.Get(status);
288 // Unsupported tag, ignore it.
289 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
292 if (TLVError != CHIP_NO_ERROR)
294 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
295 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
298 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
299 emberAfDoorLockClusterClearYeardayScheduleResponseCallback(status);
302 case ZCL_GET_HOLIDAY_SCHEDULE_RESPONSE_COMMAND_ID: {
303 CHIP_ERROR TLVError = CHIP_NO_ERROR;
306 uint32_t localStartTime;
307 uint32_t localEndTime;
308 uint8_t operatingModeDuringHoliday;
310 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
312 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
315 TLVError = dataTlv.Get(scheduleId);
318 TLVError = dataTlv.Get(status);
321 TLVError = dataTlv.Get(localStartTime);
324 TLVError = dataTlv.Get(localEndTime);
327 TLVError = dataTlv.Get(operatingModeDuringHoliday);
330 // Unsupported tag, ignore it.
331 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
334 if (TLVError != CHIP_NO_ERROR)
336 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
337 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
340 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
341 emberAfDoorLockClusterGetHolidayScheduleResponseCallback(scheduleId, status, localStartTime, localEndTime,
342 operatingModeDuringHoliday);
345 case ZCL_GET_LOG_RECORD_RESPONSE_COMMAND_ID: {
346 CHIP_ERROR TLVError = CHIP_NO_ERROR;
351 uint8_t eventIdOrAlarmCode;
355 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
357 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
360 TLVError = dataTlv.Get(logEntryId);
363 TLVError = dataTlv.Get(timestamp);
366 TLVError = dataTlv.Get(eventType);
369 TLVError = dataTlv.Get(source);
372 TLVError = dataTlv.Get(eventIdOrAlarmCode);
375 TLVError = dataTlv.Get(userId);
378 TLVError = dataTlv.GetDataPtr(pin);
381 // Unsupported tag, ignore it.
382 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
385 if (TLVError != CHIP_NO_ERROR)
387 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
388 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
391 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
392 emberAfDoorLockClusterGetLogRecordResponseCallback(logEntryId, timestamp, eventType, source, eventIdOrAlarmCode, userId,
393 const_cast<uint8_t *>(pin));
396 case ZCL_GET_PIN_RESPONSE_COMMAND_ID: {
397 CHIP_ERROR TLVError = CHIP_NO_ERROR;
403 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
405 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
408 TLVError = dataTlv.Get(userId);
411 TLVError = dataTlv.Get(userStatus);
414 TLVError = dataTlv.Get(userType);
417 TLVError = dataTlv.GetDataPtr(pin);
420 // Unsupported tag, ignore it.
421 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
424 if (TLVError != CHIP_NO_ERROR)
426 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
427 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
430 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
431 emberAfDoorLockClusterGetPinResponseCallback(userId, userStatus, userType, const_cast<uint8_t *>(pin));
434 case ZCL_GET_RFID_RESPONSE_COMMAND_ID: {
435 CHIP_ERROR TLVError = CHIP_NO_ERROR;
439 const uint8_t * rfid;
441 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
443 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
446 TLVError = dataTlv.Get(userId);
449 TLVError = dataTlv.Get(userStatus);
452 TLVError = dataTlv.Get(userType);
455 TLVError = dataTlv.GetDataPtr(rfid);
458 // Unsupported tag, ignore it.
459 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
462 if (TLVError != CHIP_NO_ERROR)
464 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
465 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
468 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
469 emberAfDoorLockClusterGetRfidResponseCallback(userId, userStatus, userType, const_cast<uint8_t *>(rfid));
472 case ZCL_GET_USER_TYPE_RESPONSE_COMMAND_ID: {
473 CHIP_ERROR TLVError = CHIP_NO_ERROR;
477 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
479 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
482 TLVError = dataTlv.Get(userId);
485 TLVError = dataTlv.Get(userType);
488 // Unsupported tag, ignore it.
489 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
492 if (TLVError != CHIP_NO_ERROR)
494 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
495 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
498 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
499 emberAfDoorLockClusterGetUserTypeResponseCallback(userId, userType);
502 case ZCL_GET_WEEKDAY_SCHEDULE_RESPONSE_COMMAND_ID: {
503 CHIP_ERROR TLVError = CHIP_NO_ERROR;
513 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
515 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
518 TLVError = dataTlv.Get(scheduleId);
521 TLVError = dataTlv.Get(userId);
524 TLVError = dataTlv.Get(status);
527 TLVError = dataTlv.Get(daysMask);
530 TLVError = dataTlv.Get(startHour);
533 TLVError = dataTlv.Get(startMinute);
536 TLVError = dataTlv.Get(endHour);
539 TLVError = dataTlv.Get(endMinute);
542 // Unsupported tag, ignore it.
543 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
546 if (TLVError != CHIP_NO_ERROR)
548 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
549 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
552 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
553 emberAfDoorLockClusterGetWeekdayScheduleResponseCallback(scheduleId, userId, status, daysMask, startHour, startMinute,
557 case ZCL_GET_YEARDAY_SCHEDULE_RESPONSE_COMMAND_ID: {
558 CHIP_ERROR TLVError = CHIP_NO_ERROR;
562 uint32_t localStartTime;
563 uint32_t localEndTime;
565 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
567 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
570 TLVError = dataTlv.Get(scheduleId);
573 TLVError = dataTlv.Get(userId);
576 TLVError = dataTlv.Get(status);
579 TLVError = dataTlv.Get(localStartTime);
582 TLVError = dataTlv.Get(localEndTime);
585 // Unsupported tag, ignore it.
586 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
589 if (TLVError != CHIP_NO_ERROR)
591 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
592 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
595 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
596 emberAfDoorLockClusterGetYeardayScheduleResponseCallback(scheduleId, userId, status, localStartTime, localEndTime);
599 case ZCL_LOCK_DOOR_RESPONSE_COMMAND_ID: {
600 CHIP_ERROR TLVError = CHIP_NO_ERROR;
603 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
605 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
608 TLVError = dataTlv.Get(status);
611 // Unsupported tag, ignore it.
612 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
615 if (TLVError != CHIP_NO_ERROR)
617 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
618 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
621 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
622 emberAfDoorLockClusterLockDoorResponseCallback(status);
625 case ZCL_SET_HOLIDAY_SCHEDULE_RESPONSE_COMMAND_ID: {
626 CHIP_ERROR TLVError = CHIP_NO_ERROR;
629 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
631 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
634 TLVError = dataTlv.Get(status);
637 // Unsupported tag, ignore it.
638 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
641 if (TLVError != CHIP_NO_ERROR)
643 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
644 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
647 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
648 emberAfDoorLockClusterSetHolidayScheduleResponseCallback(status);
651 case ZCL_SET_PIN_RESPONSE_COMMAND_ID: {
652 CHIP_ERROR TLVError = CHIP_NO_ERROR;
655 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
657 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
660 TLVError = dataTlv.Get(status);
663 // Unsupported tag, ignore it.
664 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
667 if (TLVError != CHIP_NO_ERROR)
669 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
670 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
673 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
674 emberAfDoorLockClusterSetPinResponseCallback(status);
677 case ZCL_SET_RFID_RESPONSE_COMMAND_ID: {
678 CHIP_ERROR TLVError = CHIP_NO_ERROR;
681 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
683 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
686 TLVError = dataTlv.Get(status);
689 // Unsupported tag, ignore it.
690 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
693 if (TLVError != CHIP_NO_ERROR)
695 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
696 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
699 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
700 emberAfDoorLockClusterSetRfidResponseCallback(status);
703 case ZCL_SET_USER_TYPE_RESPONSE_COMMAND_ID: {
704 CHIP_ERROR TLVError = CHIP_NO_ERROR;
707 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
709 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
712 TLVError = dataTlv.Get(status);
715 // Unsupported tag, ignore it.
716 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
719 if (TLVError != CHIP_NO_ERROR)
721 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
722 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
725 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
726 emberAfDoorLockClusterSetUserTypeResponseCallback(status);
729 case ZCL_SET_WEEKDAY_SCHEDULE_RESPONSE_COMMAND_ID: {
730 CHIP_ERROR TLVError = CHIP_NO_ERROR;
733 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
735 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
738 TLVError = dataTlv.Get(status);
741 // Unsupported tag, ignore it.
742 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
745 if (TLVError != CHIP_NO_ERROR)
747 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
748 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
751 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
752 emberAfDoorLockClusterSetWeekdayScheduleResponseCallback(status);
755 case ZCL_SET_YEARDAY_SCHEDULE_RESPONSE_COMMAND_ID: {
756 CHIP_ERROR TLVError = CHIP_NO_ERROR;
759 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
761 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
764 TLVError = dataTlv.Get(status);
767 // Unsupported tag, ignore it.
768 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
771 if (TLVError != CHIP_NO_ERROR)
773 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
774 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
777 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
778 emberAfDoorLockClusterSetYeardayScheduleResponseCallback(status);
781 case ZCL_UNLOCK_DOOR_RESPONSE_COMMAND_ID: {
782 CHIP_ERROR TLVError = CHIP_NO_ERROR;
785 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
787 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
790 TLVError = dataTlv.Get(status);
793 // Unsupported tag, ignore it.
794 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
797 if (TLVError != CHIP_NO_ERROR)
799 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
800 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
803 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
804 emberAfDoorLockClusterUnlockDoorResponseCallback(status);
807 case ZCL_UNLOCK_WITH_TIMEOUT_RESPONSE_COMMAND_ID: {
808 CHIP_ERROR TLVError = CHIP_NO_ERROR;
811 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
813 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
816 TLVError = dataTlv.Get(status);
819 // Unsupported tag, ignore it.
820 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
823 if (TLVError != CHIP_NO_ERROR)
825 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
826 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
829 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
830 emberAfDoorLockClusterUnlockWithTimeoutResponseCallback(status);
834 // Unrecognized command ID, error status will apply.
835 // TODO: Encode response for command not found
836 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_DOOR_LOCK_CLUSTER_ID);
843 } // namespace DoorLock
845 namespace GeneralCommissioning {
847 void DispatchClientCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
852 case ZCL_ARM_FAIL_SAFE_RESPONSE_COMMAND_ID: {
853 CHIP_ERROR TLVError = CHIP_NO_ERROR;
855 const uint8_t * debugText;
857 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
859 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
862 TLVError = dataTlv.Get(errorCode);
865 TLVError = dataTlv.GetDataPtr(debugText);
868 // Unsupported tag, ignore it.
869 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
872 if (TLVError != CHIP_NO_ERROR)
874 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
875 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
878 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
879 emberAfGeneralCommissioningClusterArmFailSafeResponseCallback(errorCode, const_cast<uint8_t *>(debugText));
882 case ZCL_COMMISSIONING_COMPLETE_RESPONSE_COMMAND_ID: {
883 CHIP_ERROR TLVError = CHIP_NO_ERROR;
885 const uint8_t * debugText;
887 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
889 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
892 TLVError = dataTlv.Get(errorCode);
895 TLVError = dataTlv.GetDataPtr(debugText);
898 // Unsupported tag, ignore it.
899 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
902 if (TLVError != CHIP_NO_ERROR)
904 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
905 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
908 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
909 emberAfGeneralCommissioningClusterCommissioningCompleteResponseCallback(errorCode, const_cast<uint8_t *>(debugText));
912 case ZCL_SET_FABRIC_RESPONSE_COMMAND_ID: {
913 CHIP_ERROR TLVError = CHIP_NO_ERROR;
915 const uint8_t * debugText;
917 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
919 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
922 TLVError = dataTlv.Get(errorCode);
925 TLVError = dataTlv.GetDataPtr(debugText);
928 // Unsupported tag, ignore it.
929 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
932 if (TLVError != CHIP_NO_ERROR)
934 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
935 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
938 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
939 emberAfGeneralCommissioningClusterSetFabricResponseCallback(errorCode, const_cast<uint8_t *>(debugText));
943 // Unrecognized command ID, error status will apply.
944 // TODO: Encode response for command not found
945 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_GENERAL_COMMISSIONING_CLUSTER_ID);
952 } // namespace GeneralCommissioning
956 void DispatchClientCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
961 case ZCL_ADD_GROUP_RESPONSE_COMMAND_ID: {
962 CHIP_ERROR TLVError = CHIP_NO_ERROR;
966 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
968 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
971 TLVError = dataTlv.Get(status);
974 TLVError = dataTlv.Get(groupId);
977 // Unsupported tag, ignore it.
978 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
981 if (TLVError != CHIP_NO_ERROR)
983 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
984 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
987 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
988 emberAfGroupsClusterAddGroupResponseCallback(status, groupId);
991 case ZCL_GET_GROUP_MEMBERSHIP_RESPONSE_COMMAND_ID: {
992 CHIP_ERROR TLVError = CHIP_NO_ERROR;
995 /* TYPE WARNING: array array defaults to */ uint8_t * groupList;
997 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
999 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1002 TLVError = dataTlv.Get(capacity);
1005 TLVError = dataTlv.Get(groupCount);
1008 // Just for compatibility, we will add array type support in IM later.
1009 TLVError = dataTlv.GetDataPtr(const_cast<const uint8_t *&>(groupList));
1012 // Unsupported tag, ignore it.
1013 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1016 if (TLVError != CHIP_NO_ERROR)
1018 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1019 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1022 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1023 emberAfGroupsClusterGetGroupMembershipResponseCallback(capacity, groupCount, groupList);
1026 case ZCL_REMOVE_GROUP_RESPONSE_COMMAND_ID: {
1027 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1031 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1033 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1036 TLVError = dataTlv.Get(status);
1039 TLVError = dataTlv.Get(groupId);
1042 // Unsupported tag, ignore it.
1043 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1046 if (TLVError != CHIP_NO_ERROR)
1048 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1049 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1052 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1053 emberAfGroupsClusterRemoveGroupResponseCallback(status, groupId);
1056 case ZCL_VIEW_GROUP_RESPONSE_COMMAND_ID: {
1057 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1060 const uint8_t * groupName;
1062 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1064 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1067 TLVError = dataTlv.Get(status);
1070 TLVError = dataTlv.Get(groupId);
1073 TLVError = dataTlv.GetDataPtr(groupName);
1076 // Unsupported tag, ignore it.
1077 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1080 if (TLVError != CHIP_NO_ERROR)
1082 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1083 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1086 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1087 emberAfGroupsClusterViewGroupResponseCallback(status, groupId, const_cast<uint8_t *>(groupName));
1091 // Unrecognized command ID, error status will apply.
1092 // TODO: Encode response for command not found
1093 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_GROUPS_CLUSTER_ID);
1100 } // namespace Groups
1102 namespace Identify {
1104 void DispatchClientCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
1109 case ZCL_IDENTIFY_QUERY_RESPONSE_COMMAND_ID: {
1110 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1113 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1115 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1118 TLVError = dataTlv.Get(timeout);
1121 // Unsupported tag, ignore it.
1122 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1125 if (TLVError != CHIP_NO_ERROR)
1127 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1128 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1131 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1132 emberAfIdentifyClusterIdentifyQueryResponseCallback(timeout);
1136 // Unrecognized command ID, error status will apply.
1137 // TODO: Encode response for command not found
1138 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_IDENTIFY_CLUSTER_ID);
1145 } // namespace Identify
1147 namespace MediaPlayback {
1149 void DispatchClientCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
1154 case ZCL_PLAYBACK_COMMAND_ID: {
1155 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1156 emberAfMediaPlaybackClusterPlaybackCallback();
1160 // Unrecognized command ID, error status will apply.
1161 // TODO: Encode response for command not found
1162 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_MEDIA_PLAYBACK_CLUSTER_ID);
1169 } // namespace MediaPlayback
1173 void DispatchClientCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
1178 case ZCL_ADD_SCENE_RESPONSE_COMMAND_ID: {
1179 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1184 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1186 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1189 TLVError = dataTlv.Get(status);
1192 TLVError = dataTlv.Get(groupId);
1195 TLVError = dataTlv.Get(sceneId);
1198 // Unsupported tag, ignore it.
1199 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1202 if (TLVError != CHIP_NO_ERROR)
1204 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1205 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1208 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1209 emberAfScenesClusterAddSceneResponseCallback(status, groupId, sceneId);
1212 case ZCL_GET_SCENE_MEMBERSHIP_RESPONSE_COMMAND_ID: {
1213 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1218 /* TYPE WARNING: array array defaults to */ uint8_t * sceneList;
1220 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1222 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1225 TLVError = dataTlv.Get(status);
1228 TLVError = dataTlv.Get(capacity);
1231 TLVError = dataTlv.Get(groupId);
1234 TLVError = dataTlv.Get(sceneCount);
1237 // Just for compatibility, we will add array type support in IM later.
1238 TLVError = dataTlv.GetDataPtr(const_cast<const uint8_t *&>(sceneList));
1241 // Unsupported tag, ignore it.
1242 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1245 if (TLVError != CHIP_NO_ERROR)
1247 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1248 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1251 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1252 emberAfScenesClusterGetSceneMembershipResponseCallback(status, capacity, groupId, sceneCount, sceneList);
1255 case ZCL_REMOVE_ALL_SCENES_RESPONSE_COMMAND_ID: {
1256 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1260 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1262 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1265 TLVError = dataTlv.Get(status);
1268 TLVError = dataTlv.Get(groupId);
1271 // Unsupported tag, ignore it.
1272 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1275 if (TLVError != CHIP_NO_ERROR)
1277 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1278 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1281 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1282 emberAfScenesClusterRemoveAllScenesResponseCallback(status, groupId);
1285 case ZCL_REMOVE_SCENE_RESPONSE_COMMAND_ID: {
1286 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1291 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1293 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1296 TLVError = dataTlv.Get(status);
1299 TLVError = dataTlv.Get(groupId);
1302 TLVError = dataTlv.Get(sceneId);
1305 // Unsupported tag, ignore it.
1306 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1309 if (TLVError != CHIP_NO_ERROR)
1311 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1312 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1315 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1316 emberAfScenesClusterRemoveSceneResponseCallback(status, groupId, sceneId);
1319 case ZCL_STORE_SCENE_RESPONSE_COMMAND_ID: {
1320 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1325 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1327 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1330 TLVError = dataTlv.Get(status);
1333 TLVError = dataTlv.Get(groupId);
1336 TLVError = dataTlv.Get(sceneId);
1339 // Unsupported tag, ignore it.
1340 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1343 if (TLVError != CHIP_NO_ERROR)
1345 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1346 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1349 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1350 emberAfScenesClusterStoreSceneResponseCallback(status, groupId, sceneId);
1353 case ZCL_VIEW_SCENE_RESPONSE_COMMAND_ID: {
1354 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1358 uint16_t transitionTime;
1359 const uint8_t * sceneName;
1360 /* TYPE WARNING: array array defaults to */ uint8_t * extensionFieldSets;
1362 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1364 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1367 TLVError = dataTlv.Get(status);
1370 TLVError = dataTlv.Get(groupId);
1373 TLVError = dataTlv.Get(sceneId);
1376 TLVError = dataTlv.Get(transitionTime);
1379 TLVError = dataTlv.GetDataPtr(sceneName);
1382 // Just for compatibility, we will add array type support in IM later.
1383 TLVError = dataTlv.GetDataPtr(const_cast<const uint8_t *&>(extensionFieldSets));
1386 // Unsupported tag, ignore it.
1387 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1390 if (TLVError != CHIP_NO_ERROR)
1392 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1393 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1396 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1397 emberAfScenesClusterViewSceneResponseCallback(status, groupId, sceneId, transitionTime,
1398 const_cast<uint8_t *>(sceneName), extensionFieldSets);
1402 // Unrecognized command ID, error status will apply.
1403 // TODO: Encode response for command not found
1404 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_SCENES_CLUSTER_ID);
1411 } // namespace Scenes
1413 } // namespace clusters
1415 void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aCommandId, chip::EndpointId aEndPointId,
1416 chip::TLV::TLVReader & aReader, Command * apCommandObj)
1418 ChipLogDetail(Zcl, "Received Cluster Command: Cluster=%" PRIx16 " Command=%" PRIx8 " Endpoint=%" PRIx8, aClusterId, aCommandId,
1420 Compatibility::SetupEmberAfObjects(apCommandObj, aClusterId, aCommandId, aEndPointId);
1424 // Unrecognized cluster ID, error status will apply.
1425 // TODO: Encode response for Cluster not found
1426 ChipLogError(Zcl, "Unknown cluster %" PRIx16, aClusterId);
1429 Compatibility::ResetEmberAfObjects();