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 BarrierControl {
44 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
49 case ZCL_BARRIER_CONTROL_GO_TO_PERCENT_COMMAND_ID: {
50 CHIP_ERROR TLVError = CHIP_NO_ERROR;
53 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
55 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
58 TLVError = dataTlv.Get(percentOpen);
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 emberAfBarrierControlClusterBarrierControlGoToPercentCallback(percentOpen);
75 case ZCL_BARRIER_CONTROL_STOP_COMMAND_ID: {
76 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
77 emberAfBarrierControlClusterBarrierControlStopCallback();
81 // Unrecognized command ID, error status will apply.
82 // TODO: Encode response for command not found
83 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_BARRIER_CONTROL_CLUSTER_ID);
90 } // namespace BarrierControl
94 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
99 case ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID: {
100 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
101 emberAfBasicClusterResetToFactoryDefaultsCallback();
105 // Unrecognized command ID, error status will apply.
106 // TODO: Encode response for command not found
107 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_BASIC_CLUSTER_ID);
116 namespace ColorControl {
118 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
123 case ZCL_MOVE_COLOR_COMMAND_ID: {
124 CHIP_ERROR TLVError = CHIP_NO_ERROR;
128 uint8_t optionsOverride;
130 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
132 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
135 TLVError = dataTlv.Get(rateX);
138 TLVError = dataTlv.Get(rateY);
141 TLVError = dataTlv.Get(optionsMask);
144 TLVError = dataTlv.Get(optionsOverride);
147 // Unsupported tag, ignore it.
148 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
151 if (TLVError != CHIP_NO_ERROR)
153 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
154 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
157 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
158 emberAfColorControlClusterMoveColorCallback(rateX, rateY, optionsMask, optionsOverride);
161 case ZCL_MOVE_COLOR_TEMPERATURE_COMMAND_ID: {
162 CHIP_ERROR TLVError = CHIP_NO_ERROR;
165 uint16_t colorTemperatureMinimum;
166 uint16_t colorTemperatureMaximum;
168 uint8_t optionsOverride;
170 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
172 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
175 TLVError = dataTlv.Get(moveMode);
178 TLVError = dataTlv.Get(rate);
181 TLVError = dataTlv.Get(colorTemperatureMinimum);
184 TLVError = dataTlv.Get(colorTemperatureMaximum);
187 TLVError = dataTlv.Get(optionsMask);
190 TLVError = dataTlv.Get(optionsOverride);
193 // Unsupported tag, ignore it.
194 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
197 if (TLVError != CHIP_NO_ERROR)
199 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
200 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
203 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
204 emberAfColorControlClusterMoveColorTemperatureCallback(moveMode, rate, colorTemperatureMinimum, colorTemperatureMaximum,
205 optionsMask, optionsOverride);
208 case ZCL_MOVE_HUE_COMMAND_ID: {
209 CHIP_ERROR TLVError = CHIP_NO_ERROR;
213 uint8_t optionsOverride;
215 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
217 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
220 TLVError = dataTlv.Get(moveMode);
223 TLVError = dataTlv.Get(rate);
226 TLVError = dataTlv.Get(optionsMask);
229 TLVError = dataTlv.Get(optionsOverride);
232 // Unsupported tag, ignore it.
233 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
236 if (TLVError != CHIP_NO_ERROR)
238 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
239 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
242 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
243 emberAfColorControlClusterMoveHueCallback(moveMode, rate, optionsMask, optionsOverride);
246 case ZCL_MOVE_SATURATION_COMMAND_ID: {
247 CHIP_ERROR TLVError = CHIP_NO_ERROR;
251 uint8_t optionsOverride;
253 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
255 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
258 TLVError = dataTlv.Get(moveMode);
261 TLVError = dataTlv.Get(rate);
264 TLVError = dataTlv.Get(optionsMask);
267 TLVError = dataTlv.Get(optionsOverride);
270 // Unsupported tag, ignore it.
271 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
274 if (TLVError != CHIP_NO_ERROR)
276 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
277 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
280 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
281 emberAfColorControlClusterMoveSaturationCallback(moveMode, rate, optionsMask, optionsOverride);
284 case ZCL_MOVE_TO_COLOR_COMMAND_ID: {
285 CHIP_ERROR TLVError = CHIP_NO_ERROR;
288 uint16_t transitionTime;
290 uint8_t optionsOverride;
292 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
294 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
297 TLVError = dataTlv.Get(colorX);
300 TLVError = dataTlv.Get(colorY);
303 TLVError = dataTlv.Get(transitionTime);
306 TLVError = dataTlv.Get(optionsMask);
309 TLVError = dataTlv.Get(optionsOverride);
312 // Unsupported tag, ignore it.
313 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
316 if (TLVError != CHIP_NO_ERROR)
318 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
319 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
322 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
323 emberAfColorControlClusterMoveToColorCallback(colorX, colorY, transitionTime, optionsMask, optionsOverride);
326 case ZCL_MOVE_TO_COLOR_TEMPERATURE_COMMAND_ID: {
327 CHIP_ERROR TLVError = CHIP_NO_ERROR;
328 uint16_t colorTemperature;
329 uint16_t transitionTime;
331 uint8_t optionsOverride;
333 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
335 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
338 TLVError = dataTlv.Get(colorTemperature);
341 TLVError = dataTlv.Get(transitionTime);
344 TLVError = dataTlv.Get(optionsMask);
347 TLVError = dataTlv.Get(optionsOverride);
350 // Unsupported tag, ignore it.
351 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
354 if (TLVError != CHIP_NO_ERROR)
356 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
357 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
360 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
361 emberAfColorControlClusterMoveToColorTemperatureCallback(colorTemperature, transitionTime, optionsMask,
365 case ZCL_MOVE_TO_HUE_COMMAND_ID: {
366 CHIP_ERROR TLVError = CHIP_NO_ERROR;
369 uint16_t transitionTime;
371 uint8_t optionsOverride;
373 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
375 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
378 TLVError = dataTlv.Get(hue);
381 TLVError = dataTlv.Get(direction);
384 TLVError = dataTlv.Get(transitionTime);
387 TLVError = dataTlv.Get(optionsMask);
390 TLVError = dataTlv.Get(optionsOverride);
393 // Unsupported tag, ignore it.
394 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
397 if (TLVError != CHIP_NO_ERROR)
399 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
400 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
403 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
404 emberAfColorControlClusterMoveToHueCallback(hue, direction, transitionTime, optionsMask, optionsOverride);
407 case ZCL_MOVE_TO_HUE_AND_SATURATION_COMMAND_ID: {
408 CHIP_ERROR TLVError = CHIP_NO_ERROR;
411 uint16_t transitionTime;
413 uint8_t optionsOverride;
415 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
417 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
420 TLVError = dataTlv.Get(hue);
423 TLVError = dataTlv.Get(saturation);
426 TLVError = dataTlv.Get(transitionTime);
429 TLVError = dataTlv.Get(optionsMask);
432 TLVError = dataTlv.Get(optionsOverride);
435 // Unsupported tag, ignore it.
436 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
439 if (TLVError != CHIP_NO_ERROR)
441 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
442 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
445 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
446 emberAfColorControlClusterMoveToHueAndSaturationCallback(hue, saturation, transitionTime, optionsMask, optionsOverride);
449 case ZCL_MOVE_TO_SATURATION_COMMAND_ID: {
450 CHIP_ERROR TLVError = CHIP_NO_ERROR;
452 uint16_t transitionTime;
454 uint8_t optionsOverride;
456 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
458 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
461 TLVError = dataTlv.Get(saturation);
464 TLVError = dataTlv.Get(transitionTime);
467 TLVError = dataTlv.Get(optionsMask);
470 TLVError = dataTlv.Get(optionsOverride);
473 // Unsupported tag, ignore it.
474 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
477 if (TLVError != CHIP_NO_ERROR)
479 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
480 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
483 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
484 emberAfColorControlClusterMoveToSaturationCallback(saturation, transitionTime, optionsMask, optionsOverride);
487 case ZCL_STEP_COLOR_COMMAND_ID: {
488 CHIP_ERROR TLVError = CHIP_NO_ERROR;
491 uint16_t transitionTime;
493 uint8_t optionsOverride;
495 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
497 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
500 TLVError = dataTlv.Get(stepX);
503 TLVError = dataTlv.Get(stepY);
506 TLVError = dataTlv.Get(transitionTime);
509 TLVError = dataTlv.Get(optionsMask);
512 TLVError = dataTlv.Get(optionsOverride);
515 // Unsupported tag, ignore it.
516 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
519 if (TLVError != CHIP_NO_ERROR)
521 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
522 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
525 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
526 emberAfColorControlClusterStepColorCallback(stepX, stepY, transitionTime, optionsMask, optionsOverride);
529 case ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID: {
530 CHIP_ERROR TLVError = CHIP_NO_ERROR;
533 uint16_t transitionTime;
534 uint16_t colorTemperatureMinimum;
535 uint16_t colorTemperatureMaximum;
537 uint8_t optionsOverride;
539 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
541 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
544 TLVError = dataTlv.Get(stepMode);
547 TLVError = dataTlv.Get(stepSize);
550 TLVError = dataTlv.Get(transitionTime);
553 TLVError = dataTlv.Get(colorTemperatureMinimum);
556 TLVError = dataTlv.Get(colorTemperatureMaximum);
559 TLVError = dataTlv.Get(optionsMask);
562 TLVError = dataTlv.Get(optionsOverride);
565 // Unsupported tag, ignore it.
566 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
569 if (TLVError != CHIP_NO_ERROR)
571 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
572 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
575 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
576 emberAfColorControlClusterStepColorTemperatureCallback(stepMode, stepSize, transitionTime, colorTemperatureMinimum,
577 colorTemperatureMaximum, optionsMask, optionsOverride);
580 case ZCL_STEP_HUE_COMMAND_ID: {
581 CHIP_ERROR TLVError = CHIP_NO_ERROR;
584 uint8_t transitionTime;
586 uint8_t optionsOverride;
588 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
590 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
593 TLVError = dataTlv.Get(stepMode);
596 TLVError = dataTlv.Get(stepSize);
599 TLVError = dataTlv.Get(transitionTime);
602 TLVError = dataTlv.Get(optionsMask);
605 TLVError = dataTlv.Get(optionsOverride);
608 // Unsupported tag, ignore it.
609 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
612 if (TLVError != CHIP_NO_ERROR)
614 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
615 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
618 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
619 emberAfColorControlClusterStepHueCallback(stepMode, stepSize, transitionTime, optionsMask, optionsOverride);
622 case ZCL_STEP_SATURATION_COMMAND_ID: {
623 CHIP_ERROR TLVError = CHIP_NO_ERROR;
626 uint8_t transitionTime;
628 uint8_t optionsOverride;
630 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
632 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
635 TLVError = dataTlv.Get(stepMode);
638 TLVError = dataTlv.Get(stepSize);
641 TLVError = dataTlv.Get(transitionTime);
644 TLVError = dataTlv.Get(optionsMask);
647 TLVError = dataTlv.Get(optionsOverride);
650 // Unsupported tag, ignore it.
651 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
654 if (TLVError != CHIP_NO_ERROR)
656 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
657 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
660 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
661 emberAfColorControlClusterStepSaturationCallback(stepMode, stepSize, transitionTime, optionsMask, optionsOverride);
664 case ZCL_STOP_MOVE_STEP_COMMAND_ID: {
665 CHIP_ERROR TLVError = CHIP_NO_ERROR;
667 uint8_t optionsOverride;
669 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
671 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
674 TLVError = dataTlv.Get(optionsMask);
677 TLVError = dataTlv.Get(optionsOverride);
680 // Unsupported tag, ignore it.
681 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
684 if (TLVError != CHIP_NO_ERROR)
686 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
687 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
690 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
691 emberAfColorControlClusterStopMoveStepCallback(optionsMask, optionsOverride);
695 // Unrecognized command ID, error status will apply.
696 // TODO: Encode response for command not found
697 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_COLOR_CONTROL_CLUSTER_ID);
704 } // namespace ColorControl
706 namespace ContentLaunch {
708 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
713 case ZCL_LAUNCH_CONTENT_COMMAND_ID: {
714 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
715 emberAfContentLaunchClusterLaunchContentCallback();
718 case ZCL_LAUNCH_URL_COMMAND_ID: {
719 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
720 emberAfContentLaunchClusterLaunchURLCallback();
724 // Unrecognized command ID, error status will apply.
725 // TODO: Encode response for command not found
726 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_CONTENT_LAUNCH_CLUSTER_ID);
733 } // namespace ContentLaunch
737 void DispatchClientCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
742 case ZCL_LOCK_DOOR_RESPONSE_COMMAND_ID: {
743 CHIP_ERROR TLVError = CHIP_NO_ERROR;
746 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
748 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
751 TLVError = dataTlv.Get(status);
754 // Unsupported tag, ignore it.
755 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
758 if (TLVError != CHIP_NO_ERROR)
760 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
761 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
764 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
765 emberAfDoorLockClusterLockDoorResponseCallback(status);
768 case ZCL_UNLOCK_DOOR_RESPONSE_COMMAND_ID: {
769 CHIP_ERROR TLVError = CHIP_NO_ERROR;
772 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
774 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
777 TLVError = dataTlv.Get(status);
780 // Unsupported tag, ignore it.
781 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
784 if (TLVError != CHIP_NO_ERROR)
786 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
787 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
790 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
791 emberAfDoorLockClusterUnlockDoorResponseCallback(status);
795 // Unrecognized command ID, error status will apply.
796 // TODO: Encode response for command not found
797 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_DOOR_LOCK_CLUSTER_ID);
804 } // namespace DoorLock
808 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
813 case ZCL_CLEAR_ALL_PINS_COMMAND_ID: {
814 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
815 emberAfDoorLockClusterClearAllPinsCallback();
818 case ZCL_CLEAR_ALL_RFIDS_COMMAND_ID: {
819 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
820 emberAfDoorLockClusterClearAllRfidsCallback();
823 case ZCL_CLEAR_HOLIDAY_SCHEDULE_COMMAND_ID: {
824 CHIP_ERROR TLVError = CHIP_NO_ERROR;
827 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
829 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
832 TLVError = dataTlv.Get(scheduleId);
835 // Unsupported tag, ignore it.
836 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
839 if (TLVError != CHIP_NO_ERROR)
841 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
842 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
845 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
846 emberAfDoorLockClusterClearHolidayScheduleCallback(scheduleId);
849 case ZCL_CLEAR_PIN_COMMAND_ID: {
850 CHIP_ERROR TLVError = CHIP_NO_ERROR;
853 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
855 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
858 TLVError = dataTlv.Get(userId);
861 // Unsupported tag, ignore it.
862 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
865 if (TLVError != CHIP_NO_ERROR)
867 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
868 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
871 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
872 emberAfDoorLockClusterClearPinCallback(userId);
875 case ZCL_CLEAR_RFID_COMMAND_ID: {
876 CHIP_ERROR TLVError = CHIP_NO_ERROR;
879 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
881 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
884 TLVError = dataTlv.Get(userId);
887 // Unsupported tag, ignore it.
888 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
891 if (TLVError != CHIP_NO_ERROR)
893 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
894 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
897 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
898 emberAfDoorLockClusterClearRfidCallback(userId);
901 case ZCL_CLEAR_WEEKDAY_SCHEDULE_COMMAND_ID: {
902 CHIP_ERROR TLVError = CHIP_NO_ERROR;
906 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
908 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
911 TLVError = dataTlv.Get(scheduleId);
914 TLVError = dataTlv.Get(userId);
917 // Unsupported tag, ignore it.
918 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
921 if (TLVError != CHIP_NO_ERROR)
923 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
924 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
927 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
928 emberAfDoorLockClusterClearWeekdayScheduleCallback(scheduleId, userId);
931 case ZCL_CLEAR_YEARDAY_SCHEDULE_COMMAND_ID: {
932 CHIP_ERROR TLVError = CHIP_NO_ERROR;
936 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
938 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
941 TLVError = dataTlv.Get(scheduleId);
944 TLVError = dataTlv.Get(userId);
947 // Unsupported tag, ignore it.
948 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
951 if (TLVError != CHIP_NO_ERROR)
953 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
954 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
957 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
958 emberAfDoorLockClusterClearYeardayScheduleCallback(scheduleId, userId);
961 case ZCL_GET_HOLIDAY_SCHEDULE_COMMAND_ID: {
962 CHIP_ERROR TLVError = CHIP_NO_ERROR;
965 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
967 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
970 TLVError = dataTlv.Get(scheduleId);
973 // Unsupported tag, ignore it.
974 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
977 if (TLVError != CHIP_NO_ERROR)
979 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
980 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
983 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
984 emberAfDoorLockClusterGetHolidayScheduleCallback(scheduleId);
987 case ZCL_GET_LOG_RECORD_COMMAND_ID: {
988 CHIP_ERROR TLVError = CHIP_NO_ERROR;
991 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
993 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
996 TLVError = dataTlv.Get(logIndex);
999 // Unsupported tag, ignore it.
1000 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1003 if (TLVError != CHIP_NO_ERROR)
1005 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1006 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1009 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1010 emberAfDoorLockClusterGetLogRecordCallback(logIndex);
1013 case ZCL_GET_PIN_COMMAND_ID: {
1014 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1017 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1019 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1022 TLVError = dataTlv.Get(userId);
1025 // Unsupported tag, ignore it.
1026 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1029 if (TLVError != CHIP_NO_ERROR)
1031 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1032 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1035 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1036 emberAfDoorLockClusterGetPinCallback(userId);
1039 case ZCL_GET_RFID_COMMAND_ID: {
1040 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1043 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1045 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1048 TLVError = dataTlv.Get(userId);
1051 // Unsupported tag, ignore it.
1052 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1055 if (TLVError != CHIP_NO_ERROR)
1057 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1058 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1061 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1062 emberAfDoorLockClusterGetRfidCallback(userId);
1065 case ZCL_GET_USER_TYPE_COMMAND_ID: {
1066 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1069 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1071 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1074 TLVError = dataTlv.Get(userId);
1077 // Unsupported tag, ignore it.
1078 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1081 if (TLVError != CHIP_NO_ERROR)
1083 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1084 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1087 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1088 emberAfDoorLockClusterGetUserTypeCallback(userId);
1091 case ZCL_GET_WEEKDAY_SCHEDULE_COMMAND_ID: {
1092 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1096 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1098 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1101 TLVError = dataTlv.Get(scheduleId);
1104 TLVError = dataTlv.Get(userId);
1107 // Unsupported tag, ignore it.
1108 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1111 if (TLVError != CHIP_NO_ERROR)
1113 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1114 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1117 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1118 emberAfDoorLockClusterGetWeekdayScheduleCallback(scheduleId, userId);
1121 case ZCL_GET_YEARDAY_SCHEDULE_COMMAND_ID: {
1122 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1126 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1128 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1131 TLVError = dataTlv.Get(scheduleId);
1134 TLVError = dataTlv.Get(userId);
1137 // Unsupported tag, ignore it.
1138 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1141 if (TLVError != CHIP_NO_ERROR)
1143 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1144 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1147 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1148 emberAfDoorLockClusterGetYeardayScheduleCallback(scheduleId, userId);
1151 case ZCL_LOCK_DOOR_COMMAND_ID: {
1152 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1153 const uint8_t * PIN;
1155 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1157 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1160 TLVError = dataTlv.GetDataPtr(PIN);
1163 // Unsupported tag, ignore it.
1164 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1167 if (TLVError != CHIP_NO_ERROR)
1169 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1170 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1173 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1174 emberAfDoorLockClusterLockDoorCallback(const_cast<uint8_t *>(PIN));
1177 case ZCL_SET_HOLIDAY_SCHEDULE_COMMAND_ID: {
1178 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1180 uint32_t localStartTime;
1181 uint32_t localEndTime;
1182 uint8_t operatingModeDuringHoliday;
1184 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1186 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1189 TLVError = dataTlv.Get(scheduleId);
1192 TLVError = dataTlv.Get(localStartTime);
1195 TLVError = dataTlv.Get(localEndTime);
1198 TLVError = dataTlv.Get(operatingModeDuringHoliday);
1201 // Unsupported tag, ignore it.
1202 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1205 if (TLVError != CHIP_NO_ERROR)
1207 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1208 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1211 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1212 emberAfDoorLockClusterSetHolidayScheduleCallback(scheduleId, localStartTime, localEndTime, operatingModeDuringHoliday);
1215 case ZCL_SET_PIN_COMMAND_ID: {
1216 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1220 const uint8_t * pin;
1222 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1224 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1227 TLVError = dataTlv.Get(userId);
1230 TLVError = dataTlv.Get(userStatus);
1233 TLVError = dataTlv.Get(userType);
1236 TLVError = dataTlv.GetDataPtr(pin);
1239 // Unsupported tag, ignore it.
1240 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1243 if (TLVError != CHIP_NO_ERROR)
1245 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1246 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1249 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1250 emberAfDoorLockClusterSetPinCallback(userId, userStatus, userType, const_cast<uint8_t *>(pin));
1253 case ZCL_SET_RFID_COMMAND_ID: {
1254 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1260 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1262 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1265 TLVError = dataTlv.Get(userId);
1268 TLVError = dataTlv.Get(userStatus);
1271 TLVError = dataTlv.Get(userType);
1274 TLVError = dataTlv.GetDataPtr(id);
1277 // Unsupported tag, ignore it.
1278 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1281 if (TLVError != CHIP_NO_ERROR)
1283 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1284 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1287 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1288 emberAfDoorLockClusterSetRfidCallback(userId, userStatus, userType, const_cast<uint8_t *>(id));
1291 case ZCL_SET_USER_TYPE_COMMAND_ID: {
1292 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1296 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1298 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1301 TLVError = dataTlv.Get(userId);
1304 TLVError = dataTlv.Get(userType);
1307 // Unsupported tag, ignore it.
1308 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1311 if (TLVError != CHIP_NO_ERROR)
1313 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1314 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1317 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1318 emberAfDoorLockClusterSetUserTypeCallback(userId, userType);
1321 case ZCL_SET_WEEKDAY_SCHEDULE_COMMAND_ID: {
1322 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1327 uint8_t startMinute;
1331 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1333 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1336 TLVError = dataTlv.Get(scheduleId);
1339 TLVError = dataTlv.Get(userId);
1342 TLVError = dataTlv.Get(daysMask);
1345 TLVError = dataTlv.Get(startHour);
1348 TLVError = dataTlv.Get(startMinute);
1351 TLVError = dataTlv.Get(endHour);
1354 TLVError = dataTlv.Get(endMinute);
1357 // Unsupported tag, ignore it.
1358 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1361 if (TLVError != CHIP_NO_ERROR)
1363 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1364 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1367 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1368 emberAfDoorLockClusterSetWeekdayScheduleCallback(scheduleId, userId, daysMask, startHour, startMinute, endHour,
1372 case ZCL_SET_YEARDAY_SCHEDULE_COMMAND_ID: {
1373 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1376 uint32_t localStartTime;
1377 uint32_t localEndTime;
1379 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1381 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1384 TLVError = dataTlv.Get(scheduleId);
1387 TLVError = dataTlv.Get(userId);
1390 TLVError = dataTlv.Get(localStartTime);
1393 TLVError = dataTlv.Get(localEndTime);
1396 // Unsupported tag, ignore it.
1397 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1400 if (TLVError != CHIP_NO_ERROR)
1402 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1403 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1406 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1407 emberAfDoorLockClusterSetYeardayScheduleCallback(scheduleId, userId, localStartTime, localEndTime);
1410 case ZCL_UNLOCK_DOOR_COMMAND_ID: {
1411 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1412 const uint8_t * PIN;
1414 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1416 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1419 TLVError = dataTlv.GetDataPtr(PIN);
1422 // Unsupported tag, ignore it.
1423 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1426 if (TLVError != CHIP_NO_ERROR)
1428 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1429 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1432 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1433 emberAfDoorLockClusterUnlockDoorCallback(const_cast<uint8_t *>(PIN));
1436 case ZCL_UNLOCK_WITH_TIMEOUT_COMMAND_ID: {
1437 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1438 uint16_t timeoutInSeconds;
1439 const uint8_t * pin;
1441 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1443 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1446 TLVError = dataTlv.Get(timeoutInSeconds);
1449 TLVError = dataTlv.GetDataPtr(pin);
1452 // Unsupported tag, ignore it.
1453 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1456 if (TLVError != CHIP_NO_ERROR)
1458 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1459 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1462 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1463 emberAfDoorLockClusterUnlockWithTimeoutCallback(timeoutInSeconds, const_cast<uint8_t *>(pin));
1467 // Unrecognized command ID, error status will apply.
1468 // TODO: Encode response for command not found
1469 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_DOOR_LOCK_CLUSTER_ID);
1476 } // namespace DoorLock
1480 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
1485 case ZCL_ADD_GROUP_COMMAND_ID: {
1486 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1488 const uint8_t * groupName;
1490 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1492 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1495 TLVError = dataTlv.Get(groupId);
1498 TLVError = dataTlv.GetDataPtr(groupName);
1501 // Unsupported tag, ignore it.
1502 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1505 if (TLVError != CHIP_NO_ERROR)
1507 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1508 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1511 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1512 emberAfGroupsClusterAddGroupCallback(groupId, const_cast<uint8_t *>(groupName));
1515 case ZCL_ADD_GROUP_IF_IDENTIFYING_COMMAND_ID: {
1516 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1518 const uint8_t * groupName;
1520 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1522 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1525 TLVError = dataTlv.Get(groupId);
1528 TLVError = dataTlv.GetDataPtr(groupName);
1531 // Unsupported tag, ignore it.
1532 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1535 if (TLVError != CHIP_NO_ERROR)
1537 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1538 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1541 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1542 emberAfGroupsClusterAddGroupIfIdentifyingCallback(groupId, const_cast<uint8_t *>(groupName));
1545 case ZCL_GET_GROUP_MEMBERSHIP_COMMAND_ID: {
1546 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1548 /* TYPE WARNING: array array defaults to */ uint8_t * groupList;
1550 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1552 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1555 TLVError = dataTlv.Get(groupCount);
1558 // Just for compatibility, we will add array type support in IM later.
1559 TLVError = dataTlv.GetDataPtr(const_cast<const uint8_t *&>(groupList));
1562 // Unsupported tag, ignore it.
1563 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1566 if (TLVError != CHIP_NO_ERROR)
1568 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1569 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1572 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1573 emberAfGroupsClusterGetGroupMembershipCallback(groupCount, groupList);
1576 case ZCL_REMOVE_ALL_GROUPS_COMMAND_ID: {
1577 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1578 emberAfGroupsClusterRemoveAllGroupsCallback();
1581 case ZCL_REMOVE_GROUP_COMMAND_ID: {
1582 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1585 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1587 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1590 TLVError = dataTlv.Get(groupId);
1593 // Unsupported tag, ignore it.
1594 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1597 if (TLVError != CHIP_NO_ERROR)
1599 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1600 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1603 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1604 emberAfGroupsClusterRemoveGroupCallback(groupId);
1607 case ZCL_VIEW_GROUP_COMMAND_ID: {
1608 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1611 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1613 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1616 TLVError = dataTlv.Get(groupId);
1619 // Unsupported tag, ignore it.
1620 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1623 if (TLVError != CHIP_NO_ERROR)
1625 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1626 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1629 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1630 emberAfGroupsClusterViewGroupCallback(groupId);
1634 // Unrecognized command ID, error status will apply.
1635 // TODO: Encode response for command not found
1636 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_GROUPS_CLUSTER_ID);
1643 } // namespace Groups
1647 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
1652 case ZCL_ZONE_ENROLL_RESPONSE_COMMAND_ID: {
1653 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1654 uint8_t enrollResponseCode;
1657 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1659 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1662 TLVError = dataTlv.Get(enrollResponseCode);
1665 TLVError = dataTlv.Get(zoneId);
1668 // Unsupported tag, ignore it.
1669 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1672 if (TLVError != CHIP_NO_ERROR)
1674 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1675 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1678 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1679 emberAfIasZoneClusterZoneEnrollResponseCallback(enrollResponseCode, zoneId);
1683 // Unrecognized command ID, error status will apply.
1684 // TODO: Encode response for command not found
1685 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_IAS_ZONE_CLUSTER_ID);
1692 } // namespace IasZone
1694 namespace Identify {
1696 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
1701 case ZCL_IDENTIFY_COMMAND_ID: {
1702 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1703 uint16_t identifyTime;
1705 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1707 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1710 TLVError = dataTlv.Get(identifyTime);
1713 // Unsupported tag, ignore it.
1714 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1717 if (TLVError != CHIP_NO_ERROR)
1719 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1720 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1723 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1724 emberAfIdentifyClusterIdentifyCallback(identifyTime);
1727 case ZCL_IDENTIFY_QUERY_COMMAND_ID: {
1728 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1729 emberAfIdentifyClusterIdentifyQueryCallback();
1733 // Unrecognized command ID, error status will apply.
1734 // TODO: Encode response for command not found
1735 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_IDENTIFY_CLUSTER_ID);
1742 } // namespace Identify
1744 namespace LevelControl {
1746 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
1751 case ZCL_MOVE_COMMAND_ID: {
1752 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1756 uint8_t optionOverride;
1758 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1760 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1763 TLVError = dataTlv.Get(moveMode);
1766 TLVError = dataTlv.Get(rate);
1769 TLVError = dataTlv.Get(optionMask);
1772 TLVError = dataTlv.Get(optionOverride);
1775 // Unsupported tag, ignore it.
1776 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1779 if (TLVError != CHIP_NO_ERROR)
1781 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1782 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1785 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1786 emberAfLevelControlClusterMoveCallback(moveMode, rate, optionMask, optionOverride);
1789 case ZCL_MOVE_TO_LEVEL_COMMAND_ID: {
1790 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1792 uint16_t transitionTime;
1794 uint8_t optionOverride;
1796 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1798 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1801 TLVError = dataTlv.Get(level);
1804 TLVError = dataTlv.Get(transitionTime);
1807 TLVError = dataTlv.Get(optionMask);
1810 TLVError = dataTlv.Get(optionOverride);
1813 // Unsupported tag, ignore it.
1814 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1817 if (TLVError != CHIP_NO_ERROR)
1819 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1820 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1823 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1824 emberAfLevelControlClusterMoveToLevelCallback(level, transitionTime, optionMask, optionOverride);
1827 case ZCL_MOVE_TO_LEVEL_WITH_ON_OFF_COMMAND_ID: {
1828 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1830 uint16_t transitionTime;
1832 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1834 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1837 TLVError = dataTlv.Get(level);
1840 TLVError = dataTlv.Get(transitionTime);
1843 // Unsupported tag, ignore it.
1844 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1847 if (TLVError != CHIP_NO_ERROR)
1849 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1850 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1853 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1854 emberAfLevelControlClusterMoveToLevelWithOnOffCallback(level, transitionTime);
1857 case ZCL_MOVE_WITH_ON_OFF_COMMAND_ID: {
1858 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1862 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1864 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1867 TLVError = dataTlv.Get(moveMode);
1870 TLVError = dataTlv.Get(rate);
1873 // Unsupported tag, ignore it.
1874 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1877 if (TLVError != CHIP_NO_ERROR)
1879 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1880 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1883 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1884 emberAfLevelControlClusterMoveWithOnOffCallback(moveMode, rate);
1887 case ZCL_STEP_COMMAND_ID: {
1888 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1891 uint16_t transitionTime;
1893 uint8_t optionOverride;
1895 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1897 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1900 TLVError = dataTlv.Get(stepMode);
1903 TLVError = dataTlv.Get(stepSize);
1906 TLVError = dataTlv.Get(transitionTime);
1909 TLVError = dataTlv.Get(optionMask);
1912 TLVError = dataTlv.Get(optionOverride);
1915 // Unsupported tag, ignore it.
1916 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1919 if (TLVError != CHIP_NO_ERROR)
1921 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1922 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1925 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1926 emberAfLevelControlClusterStepCallback(stepMode, stepSize, transitionTime, optionMask, optionOverride);
1929 case ZCL_STEP_WITH_ON_OFF_COMMAND_ID: {
1930 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1933 uint16_t transitionTime;
1935 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1937 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1940 TLVError = dataTlv.Get(stepMode);
1943 TLVError = dataTlv.Get(stepSize);
1946 TLVError = dataTlv.Get(transitionTime);
1949 // Unsupported tag, ignore it.
1950 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1953 if (TLVError != CHIP_NO_ERROR)
1955 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1956 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1959 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1960 emberAfLevelControlClusterStepWithOnOffCallback(stepMode, stepSize, transitionTime);
1963 case ZCL_STOP_COMMAND_ID: {
1964 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1966 uint8_t optionOverride;
1968 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1970 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1973 TLVError = dataTlv.Get(optionMask);
1976 TLVError = dataTlv.Get(optionOverride);
1979 // Unsupported tag, ignore it.
1980 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1983 if (TLVError != CHIP_NO_ERROR)
1985 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1986 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1989 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1990 emberAfLevelControlClusterStopCallback(optionMask, optionOverride);
1993 case ZCL_STOP_WITH_ON_OFF_COMMAND_ID: {
1994 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1995 emberAfLevelControlClusterStopWithOnOffCallback();
1999 // Unrecognized command ID, error status will apply.
2000 // TODO: Encode response for command not found
2001 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_LEVEL_CONTROL_CLUSTER_ID);
2008 } // namespace LevelControl
2010 namespace LowPower {
2012 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
2017 case ZCL_SLEEP_COMMAND_ID: {
2018 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2019 emberAfLowPowerClusterSleepCallback();
2023 // Unrecognized command ID, error status will apply.
2024 // TODO: Encode response for command not found
2025 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_LOW_POWER_CLUSTER_ID);
2032 } // namespace LowPower
2034 namespace MediaPlayback {
2036 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
2041 case ZCL_FAST_FORWARD_REQUEST_COMMAND_ID: {
2042 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2043 emberAfMediaPlaybackClusterFastForwardRequestCallback();
2046 case ZCL_NEXT_REQUEST_COMMAND_ID: {
2047 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2048 emberAfMediaPlaybackClusterNextRequestCallback();
2051 case ZCL_PAUSE_REQUEST_COMMAND_ID: {
2052 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2053 emberAfMediaPlaybackClusterPauseRequestCallback();
2056 case ZCL_PLAY_REQUEST_COMMAND_ID: {
2057 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2058 emberAfMediaPlaybackClusterPlayRequestCallback();
2061 case ZCL_PREVIOUS_REQUEST_COMMAND_ID: {
2062 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2063 emberAfMediaPlaybackClusterPreviousRequestCallback();
2066 case ZCL_REWIND_REQUEST_COMMAND_ID: {
2067 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2068 emberAfMediaPlaybackClusterRewindRequestCallback();
2071 case ZCL_SKIP_BACKWARD_REQUEST_COMMAND_ID: {
2072 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2073 emberAfMediaPlaybackClusterSkipBackwardRequestCallback();
2076 case ZCL_SKIP_FORWARD_REQUEST_COMMAND_ID: {
2077 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2078 emberAfMediaPlaybackClusterSkipForwardRequestCallback();
2081 case ZCL_START_OVER_REQUEST_COMMAND_ID: {
2082 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2083 emberAfMediaPlaybackClusterStartOverRequestCallback();
2086 case ZCL_STOP_REQUEST_COMMAND_ID: {
2087 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2088 emberAfMediaPlaybackClusterStopRequestCallback();
2092 // Unrecognized command ID, error status will apply.
2093 // TODO: Encode response for command not found
2094 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_MEDIA_PLAYBACK_CLUSTER_ID);
2101 } // namespace MediaPlayback
2105 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
2110 case ZCL_OFF_COMMAND_ID: {
2111 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2112 emberAfOnOffClusterOffCallback();
2115 case ZCL_ON_COMMAND_ID: {
2116 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2117 emberAfOnOffClusterOnCallback();
2120 case ZCL_TOGGLE_COMMAND_ID: {
2121 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2122 emberAfOnOffClusterToggleCallback();
2126 // Unrecognized command ID, error status will apply.
2127 // TODO: Encode response for command not found
2128 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_ON_OFF_CLUSTER_ID);
2135 } // namespace OnOff
2139 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
2144 case ZCL_ADD_SCENE_COMMAND_ID: {
2145 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2148 uint16_t transitionTime;
2149 const uint8_t * sceneName;
2150 /* TYPE WARNING: array array defaults to */ uint8_t * extensionFieldSets;
2152 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2154 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2157 TLVError = dataTlv.Get(groupId);
2160 TLVError = dataTlv.Get(sceneId);
2163 TLVError = dataTlv.Get(transitionTime);
2166 TLVError = dataTlv.GetDataPtr(sceneName);
2169 // Just for compatibility, we will add array type support in IM later.
2170 TLVError = dataTlv.GetDataPtr(const_cast<const uint8_t *&>(extensionFieldSets));
2173 // Unsupported tag, ignore it.
2174 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2177 if (TLVError != CHIP_NO_ERROR)
2179 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2180 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2183 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2184 emberAfScenesClusterAddSceneCallback(groupId, sceneId, transitionTime, const_cast<uint8_t *>(sceneName),
2185 extensionFieldSets);
2188 case ZCL_GET_SCENE_MEMBERSHIP_COMMAND_ID: {
2189 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2192 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2194 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2197 TLVError = dataTlv.Get(groupId);
2200 // Unsupported tag, ignore it.
2201 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2204 if (TLVError != CHIP_NO_ERROR)
2206 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2207 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2210 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2211 emberAfScenesClusterGetSceneMembershipCallback(groupId);
2214 case ZCL_RECALL_SCENE_COMMAND_ID: {
2215 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2218 uint16_t transitionTime;
2220 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2222 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2225 TLVError = dataTlv.Get(groupId);
2228 TLVError = dataTlv.Get(sceneId);
2231 TLVError = dataTlv.Get(transitionTime);
2234 // Unsupported tag, ignore it.
2235 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2238 if (TLVError != CHIP_NO_ERROR)
2240 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2241 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2244 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2245 emberAfScenesClusterRecallSceneCallback(groupId, sceneId, transitionTime);
2248 case ZCL_REMOVE_ALL_SCENES_COMMAND_ID: {
2249 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2252 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2254 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2257 TLVError = dataTlv.Get(groupId);
2260 // Unsupported tag, ignore it.
2261 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2264 if (TLVError != CHIP_NO_ERROR)
2266 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2267 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2270 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2271 emberAfScenesClusterRemoveAllScenesCallback(groupId);
2274 case ZCL_REMOVE_SCENE_COMMAND_ID: {
2275 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2279 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2281 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2284 TLVError = dataTlv.Get(groupId);
2287 TLVError = dataTlv.Get(sceneId);
2290 // Unsupported tag, ignore it.
2291 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2294 if (TLVError != CHIP_NO_ERROR)
2296 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2297 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2300 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2301 emberAfScenesClusterRemoveSceneCallback(groupId, sceneId);
2304 case ZCL_STORE_SCENE_COMMAND_ID: {
2305 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2309 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2311 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2314 TLVError = dataTlv.Get(groupId);
2317 TLVError = dataTlv.Get(sceneId);
2320 // Unsupported tag, ignore it.
2321 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2324 if (TLVError != CHIP_NO_ERROR)
2326 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2327 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2330 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2331 emberAfScenesClusterStoreSceneCallback(groupId, sceneId);
2334 case ZCL_VIEW_SCENE_COMMAND_ID: {
2335 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2339 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2341 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2344 TLVError = dataTlv.Get(groupId);
2347 TLVError = dataTlv.Get(sceneId);
2350 // Unsupported tag, ignore it.
2351 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2354 if (TLVError != CHIP_NO_ERROR)
2356 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2357 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2360 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2361 emberAfScenesClusterViewSceneCallback(groupId, sceneId);
2365 // Unrecognized command ID, error status will apply.
2366 // TODO: Encode response for command not found
2367 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_SCENES_CLUSTER_ID);
2374 } // namespace Scenes
2376 } // namespace clusters
2378 void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aCommandId, chip::EndpointId aEndPointId,
2379 chip::TLV::TLVReader & aReader, Command * apCommandObj)
2381 ChipLogDetail(Zcl, "Received Cluster Command: Cluster=%" PRIx16 " Command=%" PRIx8 " Endpoint=%" PRIx8, aClusterId, aCommandId,
2383 Compatibility::SetupEmberAfObjects(apCommandObj, aClusterId, aCommandId, aEndPointId);
2386 case ZCL_BARRIER_CONTROL_CLUSTER_ID:
2387 clusters::BarrierControl::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2389 case ZCL_BASIC_CLUSTER_ID:
2390 clusters::Basic::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2392 case ZCL_COLOR_CONTROL_CLUSTER_ID:
2393 clusters::ColorControl::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2395 case ZCL_CONTENT_LAUNCH_CLUSTER_ID:
2396 clusters::ContentLaunch::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2398 case ZCL_DOOR_LOCK_CLUSTER_ID:
2399 clusters::DoorLock::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2401 case ZCL_GROUPS_CLUSTER_ID:
2402 clusters::Groups::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2404 case ZCL_IAS_ZONE_CLUSTER_ID:
2405 clusters::IasZone::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2407 case ZCL_IDENTIFY_CLUSTER_ID:
2408 clusters::Identify::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2410 case ZCL_LEVEL_CONTROL_CLUSTER_ID:
2411 clusters::LevelControl::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2413 case ZCL_LOW_POWER_CLUSTER_ID:
2414 clusters::LowPower::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2416 case ZCL_MEDIA_PLAYBACK_CLUSTER_ID:
2417 clusters::MediaPlayback::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2419 case ZCL_ON_OFF_CLUSTER_ID:
2420 clusters::OnOff::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2422 case ZCL_SCENES_CLUSTER_ID:
2423 clusters::Scenes::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2426 // Unrecognized cluster ID, error status will apply.
2427 // TODO: Encode response for Cluster not found
2428 ChipLogError(Zcl, "Unknown cluster %" PRIx16, aClusterId);
2431 Compatibility::ResetEmberAfObjects();