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);
118 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
123 case ZCL_BIND_COMMAND_ID: {
124 CHIP_ERROR TLVError = CHIP_NO_ERROR;
126 chip::GroupId groupId;
127 chip::EndpointId endpointId;
128 chip::ClusterId clusterId;
130 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
132 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
135 TLVError = dataTlv.Get(nodeId);
138 TLVError = dataTlv.Get(groupId);
141 TLVError = dataTlv.Get(endpointId);
144 TLVError = dataTlv.Get(clusterId);
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 emberAfBindingClusterBindCallback(nodeId, groupId, endpointId, clusterId);
161 case ZCL_UNBIND_COMMAND_ID: {
162 CHIP_ERROR TLVError = CHIP_NO_ERROR;
164 chip::GroupId groupId;
165 chip::EndpointId endpointId;
166 chip::ClusterId clusterId;
168 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
170 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
173 TLVError = dataTlv.Get(nodeId);
176 TLVError = dataTlv.Get(groupId);
179 TLVError = dataTlv.Get(endpointId);
182 TLVError = dataTlv.Get(clusterId);
185 // Unsupported tag, ignore it.
186 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
189 if (TLVError != CHIP_NO_ERROR)
191 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
192 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
195 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
196 emberAfBindingClusterUnbindCallback(nodeId, groupId, endpointId, clusterId);
200 // Unrecognized command ID, error status will apply.
201 // TODO: Encode response for command not found
202 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_BINDING_CLUSTER_ID);
209 } // namespace Binding
211 namespace ColorControl {
213 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
218 case ZCL_MOVE_COLOR_COMMAND_ID: {
219 CHIP_ERROR TLVError = CHIP_NO_ERROR;
223 uint8_t optionsOverride;
225 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
227 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
230 TLVError = dataTlv.Get(rateX);
233 TLVError = dataTlv.Get(rateY);
236 TLVError = dataTlv.Get(optionsMask);
239 TLVError = dataTlv.Get(optionsOverride);
242 // Unsupported tag, ignore it.
243 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
246 if (TLVError != CHIP_NO_ERROR)
248 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
249 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
252 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
253 emberAfColorControlClusterMoveColorCallback(rateX, rateY, optionsMask, optionsOverride);
256 case ZCL_MOVE_COLOR_TEMPERATURE_COMMAND_ID: {
257 CHIP_ERROR TLVError = CHIP_NO_ERROR;
260 uint16_t colorTemperatureMinimum;
261 uint16_t colorTemperatureMaximum;
263 uint8_t optionsOverride;
265 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
267 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
270 TLVError = dataTlv.Get(moveMode);
273 TLVError = dataTlv.Get(rate);
276 TLVError = dataTlv.Get(colorTemperatureMinimum);
279 TLVError = dataTlv.Get(colorTemperatureMaximum);
282 TLVError = dataTlv.Get(optionsMask);
285 TLVError = dataTlv.Get(optionsOverride);
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 emberAfColorControlClusterMoveColorTemperatureCallback(moveMode, rate, colorTemperatureMinimum, colorTemperatureMaximum,
300 optionsMask, optionsOverride);
303 case ZCL_MOVE_HUE_COMMAND_ID: {
304 CHIP_ERROR TLVError = CHIP_NO_ERROR;
308 uint8_t optionsOverride;
310 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
312 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
315 TLVError = dataTlv.Get(moveMode);
318 TLVError = dataTlv.Get(rate);
321 TLVError = dataTlv.Get(optionsMask);
324 TLVError = dataTlv.Get(optionsOverride);
327 // Unsupported tag, ignore it.
328 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
331 if (TLVError != CHIP_NO_ERROR)
333 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
334 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
337 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
338 emberAfColorControlClusterMoveHueCallback(moveMode, rate, optionsMask, optionsOverride);
341 case ZCL_MOVE_SATURATION_COMMAND_ID: {
342 CHIP_ERROR TLVError = CHIP_NO_ERROR;
346 uint8_t optionsOverride;
348 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
350 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
353 TLVError = dataTlv.Get(moveMode);
356 TLVError = dataTlv.Get(rate);
359 TLVError = dataTlv.Get(optionsMask);
362 TLVError = dataTlv.Get(optionsOverride);
365 // Unsupported tag, ignore it.
366 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
369 if (TLVError != CHIP_NO_ERROR)
371 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
372 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
375 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
376 emberAfColorControlClusterMoveSaturationCallback(moveMode, rate, optionsMask, optionsOverride);
379 case ZCL_MOVE_TO_COLOR_COMMAND_ID: {
380 CHIP_ERROR TLVError = CHIP_NO_ERROR;
383 uint16_t transitionTime;
385 uint8_t optionsOverride;
387 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
389 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
392 TLVError = dataTlv.Get(colorX);
395 TLVError = dataTlv.Get(colorY);
398 TLVError = dataTlv.Get(transitionTime);
401 TLVError = dataTlv.Get(optionsMask);
404 TLVError = dataTlv.Get(optionsOverride);
407 // Unsupported tag, ignore it.
408 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
411 if (TLVError != CHIP_NO_ERROR)
413 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
414 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
417 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
418 emberAfColorControlClusterMoveToColorCallback(colorX, colorY, transitionTime, optionsMask, optionsOverride);
421 case ZCL_MOVE_TO_COLOR_TEMPERATURE_COMMAND_ID: {
422 CHIP_ERROR TLVError = CHIP_NO_ERROR;
423 uint16_t colorTemperature;
424 uint16_t transitionTime;
426 uint8_t optionsOverride;
428 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
430 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
433 TLVError = dataTlv.Get(colorTemperature);
436 TLVError = dataTlv.Get(transitionTime);
439 TLVError = dataTlv.Get(optionsMask);
442 TLVError = dataTlv.Get(optionsOverride);
445 // Unsupported tag, ignore it.
446 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
449 if (TLVError != CHIP_NO_ERROR)
451 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
452 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
455 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
456 emberAfColorControlClusterMoveToColorTemperatureCallback(colorTemperature, transitionTime, optionsMask,
460 case ZCL_MOVE_TO_HUE_COMMAND_ID: {
461 CHIP_ERROR TLVError = CHIP_NO_ERROR;
464 uint16_t transitionTime;
466 uint8_t optionsOverride;
468 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
470 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
473 TLVError = dataTlv.Get(hue);
476 TLVError = dataTlv.Get(direction);
479 TLVError = dataTlv.Get(transitionTime);
482 TLVError = dataTlv.Get(optionsMask);
485 TLVError = dataTlv.Get(optionsOverride);
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 emberAfColorControlClusterMoveToHueCallback(hue, direction, transitionTime, optionsMask, optionsOverride);
502 case ZCL_MOVE_TO_HUE_AND_SATURATION_COMMAND_ID: {
503 CHIP_ERROR TLVError = CHIP_NO_ERROR;
506 uint16_t transitionTime;
508 uint8_t optionsOverride;
510 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
512 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
515 TLVError = dataTlv.Get(hue);
518 TLVError = dataTlv.Get(saturation);
521 TLVError = dataTlv.Get(transitionTime);
524 TLVError = dataTlv.Get(optionsMask);
527 TLVError = dataTlv.Get(optionsOverride);
530 // Unsupported tag, ignore it.
531 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
534 if (TLVError != CHIP_NO_ERROR)
536 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
537 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
540 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
541 emberAfColorControlClusterMoveToHueAndSaturationCallback(hue, saturation, transitionTime, optionsMask, optionsOverride);
544 case ZCL_MOVE_TO_SATURATION_COMMAND_ID: {
545 CHIP_ERROR TLVError = CHIP_NO_ERROR;
547 uint16_t transitionTime;
549 uint8_t optionsOverride;
551 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
553 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
556 TLVError = dataTlv.Get(saturation);
559 TLVError = dataTlv.Get(transitionTime);
562 TLVError = dataTlv.Get(optionsMask);
565 TLVError = dataTlv.Get(optionsOverride);
568 // Unsupported tag, ignore it.
569 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
572 if (TLVError != CHIP_NO_ERROR)
574 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
575 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
578 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
579 emberAfColorControlClusterMoveToSaturationCallback(saturation, transitionTime, optionsMask, optionsOverride);
582 case ZCL_STEP_COLOR_COMMAND_ID: {
583 CHIP_ERROR TLVError = CHIP_NO_ERROR;
586 uint16_t transitionTime;
588 uint8_t optionsOverride;
590 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
592 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
595 TLVError = dataTlv.Get(stepX);
598 TLVError = dataTlv.Get(stepY);
601 TLVError = dataTlv.Get(transitionTime);
604 TLVError = dataTlv.Get(optionsMask);
607 TLVError = dataTlv.Get(optionsOverride);
610 // Unsupported tag, ignore it.
611 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
614 if (TLVError != CHIP_NO_ERROR)
616 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
617 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
620 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
621 emberAfColorControlClusterStepColorCallback(stepX, stepY, transitionTime, optionsMask, optionsOverride);
624 case ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID: {
625 CHIP_ERROR TLVError = CHIP_NO_ERROR;
628 uint16_t transitionTime;
629 uint16_t colorTemperatureMinimum;
630 uint16_t colorTemperatureMaximum;
632 uint8_t optionsOverride;
634 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
636 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
639 TLVError = dataTlv.Get(stepMode);
642 TLVError = dataTlv.Get(stepSize);
645 TLVError = dataTlv.Get(transitionTime);
648 TLVError = dataTlv.Get(colorTemperatureMinimum);
651 TLVError = dataTlv.Get(colorTemperatureMaximum);
654 TLVError = dataTlv.Get(optionsMask);
657 TLVError = dataTlv.Get(optionsOverride);
660 // Unsupported tag, ignore it.
661 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
664 if (TLVError != CHIP_NO_ERROR)
666 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
667 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
670 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
671 emberAfColorControlClusterStepColorTemperatureCallback(stepMode, stepSize, transitionTime, colorTemperatureMinimum,
672 colorTemperatureMaximum, optionsMask, optionsOverride);
675 case ZCL_STEP_HUE_COMMAND_ID: {
676 CHIP_ERROR TLVError = CHIP_NO_ERROR;
679 uint8_t transitionTime;
681 uint8_t optionsOverride;
683 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
685 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
688 TLVError = dataTlv.Get(stepMode);
691 TLVError = dataTlv.Get(stepSize);
694 TLVError = dataTlv.Get(transitionTime);
697 TLVError = dataTlv.Get(optionsMask);
700 TLVError = dataTlv.Get(optionsOverride);
703 // Unsupported tag, ignore it.
704 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
707 if (TLVError != CHIP_NO_ERROR)
709 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
710 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
713 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
714 emberAfColorControlClusterStepHueCallback(stepMode, stepSize, transitionTime, optionsMask, optionsOverride);
717 case ZCL_STEP_SATURATION_COMMAND_ID: {
718 CHIP_ERROR TLVError = CHIP_NO_ERROR;
721 uint8_t transitionTime;
723 uint8_t optionsOverride;
725 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
727 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
730 TLVError = dataTlv.Get(stepMode);
733 TLVError = dataTlv.Get(stepSize);
736 TLVError = dataTlv.Get(transitionTime);
739 TLVError = dataTlv.Get(optionsMask);
742 TLVError = dataTlv.Get(optionsOverride);
745 // Unsupported tag, ignore it.
746 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
749 if (TLVError != CHIP_NO_ERROR)
751 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
752 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
755 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
756 emberAfColorControlClusterStepSaturationCallback(stepMode, stepSize, transitionTime, optionsMask, optionsOverride);
759 case ZCL_STOP_MOVE_STEP_COMMAND_ID: {
760 CHIP_ERROR TLVError = CHIP_NO_ERROR;
762 uint8_t optionsOverride;
764 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
766 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
769 TLVError = dataTlv.Get(optionsMask);
772 TLVError = dataTlv.Get(optionsOverride);
775 // Unsupported tag, ignore it.
776 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
779 if (TLVError != CHIP_NO_ERROR)
781 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
782 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
785 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
786 emberAfColorControlClusterStopMoveStepCallback(optionsMask, optionsOverride);
790 // Unrecognized command ID, error status will apply.
791 // TODO: Encode response for command not found
792 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_COLOR_CONTROL_CLUSTER_ID);
799 } // namespace ColorControl
801 namespace ContentLaunch {
803 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
808 case ZCL_LAUNCH_CONTENT_COMMAND_ID: {
809 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
810 emberAfContentLaunchClusterLaunchContentCallback();
813 case ZCL_LAUNCH_URL_COMMAND_ID: {
814 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
815 emberAfContentLaunchClusterLaunchURLCallback();
819 // Unrecognized command ID, error status will apply.
820 // TODO: Encode response for command not found
821 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_CONTENT_LAUNCH_CLUSTER_ID);
828 } // namespace ContentLaunch
832 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
837 case ZCL_CLEAR_ALL_PINS_COMMAND_ID: {
838 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
839 emberAfDoorLockClusterClearAllPinsCallback();
842 case ZCL_CLEAR_ALL_RFIDS_COMMAND_ID: {
843 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
844 emberAfDoorLockClusterClearAllRfidsCallback();
847 case ZCL_CLEAR_HOLIDAY_SCHEDULE_COMMAND_ID: {
848 CHIP_ERROR TLVError = CHIP_NO_ERROR;
851 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
853 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
856 TLVError = dataTlv.Get(scheduleId);
859 // Unsupported tag, ignore it.
860 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
863 if (TLVError != CHIP_NO_ERROR)
865 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
866 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
869 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
870 emberAfDoorLockClusterClearHolidayScheduleCallback(scheduleId);
873 case ZCL_CLEAR_PIN_COMMAND_ID: {
874 CHIP_ERROR TLVError = CHIP_NO_ERROR;
877 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
879 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
882 TLVError = dataTlv.Get(userId);
885 // Unsupported tag, ignore it.
886 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
889 if (TLVError != CHIP_NO_ERROR)
891 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
892 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
895 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
896 emberAfDoorLockClusterClearPinCallback(userId);
899 case ZCL_CLEAR_RFID_COMMAND_ID: {
900 CHIP_ERROR TLVError = CHIP_NO_ERROR;
903 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
905 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
908 TLVError = dataTlv.Get(userId);
911 // Unsupported tag, ignore it.
912 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
915 if (TLVError != CHIP_NO_ERROR)
917 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
918 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
921 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
922 emberAfDoorLockClusterClearRfidCallback(userId);
925 case ZCL_CLEAR_WEEKDAY_SCHEDULE_COMMAND_ID: {
926 CHIP_ERROR TLVError = CHIP_NO_ERROR;
930 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
932 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
935 TLVError = dataTlv.Get(scheduleId);
938 TLVError = dataTlv.Get(userId);
941 // Unsupported tag, ignore it.
942 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
945 if (TLVError != CHIP_NO_ERROR)
947 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
948 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
951 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
952 emberAfDoorLockClusterClearWeekdayScheduleCallback(scheduleId, userId);
955 case ZCL_CLEAR_YEARDAY_SCHEDULE_COMMAND_ID: {
956 CHIP_ERROR TLVError = CHIP_NO_ERROR;
960 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
962 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
965 TLVError = dataTlv.Get(scheduleId);
968 TLVError = dataTlv.Get(userId);
971 // Unsupported tag, ignore it.
972 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
975 if (TLVError != CHIP_NO_ERROR)
977 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
978 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
981 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
982 emberAfDoorLockClusterClearYeardayScheduleCallback(scheduleId, userId);
985 case ZCL_GET_HOLIDAY_SCHEDULE_COMMAND_ID: {
986 CHIP_ERROR TLVError = CHIP_NO_ERROR;
989 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
991 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
994 TLVError = dataTlv.Get(scheduleId);
997 // Unsupported tag, ignore it.
998 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1001 if (TLVError != CHIP_NO_ERROR)
1003 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1004 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1007 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1008 emberAfDoorLockClusterGetHolidayScheduleCallback(scheduleId);
1011 case ZCL_GET_LOG_RECORD_COMMAND_ID: {
1012 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1015 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1017 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1020 TLVError = dataTlv.Get(logIndex);
1023 // Unsupported tag, ignore it.
1024 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1027 if (TLVError != CHIP_NO_ERROR)
1029 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1030 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1033 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1034 emberAfDoorLockClusterGetLogRecordCallback(logIndex);
1037 case ZCL_GET_PIN_COMMAND_ID: {
1038 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1041 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1043 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1046 TLVError = dataTlv.Get(userId);
1049 // Unsupported tag, ignore it.
1050 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1053 if (TLVError != CHIP_NO_ERROR)
1055 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1056 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1059 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1060 emberAfDoorLockClusterGetPinCallback(userId);
1063 case ZCL_GET_RFID_COMMAND_ID: {
1064 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1067 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1069 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1072 TLVError = dataTlv.Get(userId);
1075 // Unsupported tag, ignore it.
1076 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1079 if (TLVError != CHIP_NO_ERROR)
1081 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1082 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1085 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1086 emberAfDoorLockClusterGetRfidCallback(userId);
1089 case ZCL_GET_USER_TYPE_COMMAND_ID: {
1090 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1093 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1095 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1098 TLVError = dataTlv.Get(userId);
1101 // Unsupported tag, ignore it.
1102 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1105 if (TLVError != CHIP_NO_ERROR)
1107 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1108 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1111 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1112 emberAfDoorLockClusterGetUserTypeCallback(userId);
1115 case ZCL_GET_WEEKDAY_SCHEDULE_COMMAND_ID: {
1116 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1120 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1122 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1125 TLVError = dataTlv.Get(scheduleId);
1128 TLVError = dataTlv.Get(userId);
1131 // Unsupported tag, ignore it.
1132 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1135 if (TLVError != CHIP_NO_ERROR)
1137 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1138 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1141 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1142 emberAfDoorLockClusterGetWeekdayScheduleCallback(scheduleId, userId);
1145 case ZCL_GET_YEARDAY_SCHEDULE_COMMAND_ID: {
1146 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1150 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1152 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1155 TLVError = dataTlv.Get(scheduleId);
1158 TLVError = dataTlv.Get(userId);
1161 // Unsupported tag, ignore it.
1162 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1165 if (TLVError != CHIP_NO_ERROR)
1167 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1168 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1171 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1172 emberAfDoorLockClusterGetYeardayScheduleCallback(scheduleId, userId);
1175 case ZCL_LOCK_DOOR_COMMAND_ID: {
1176 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1177 const uint8_t * PIN;
1179 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1181 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1184 TLVError = dataTlv.GetDataPtr(PIN);
1187 // Unsupported tag, ignore it.
1188 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1191 if (TLVError != CHIP_NO_ERROR)
1193 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1194 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1197 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1198 emberAfDoorLockClusterLockDoorCallback(const_cast<uint8_t *>(PIN));
1201 case ZCL_SET_HOLIDAY_SCHEDULE_COMMAND_ID: {
1202 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1204 uint32_t localStartTime;
1205 uint32_t localEndTime;
1206 uint8_t operatingModeDuringHoliday;
1208 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1210 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1213 TLVError = dataTlv.Get(scheduleId);
1216 TLVError = dataTlv.Get(localStartTime);
1219 TLVError = dataTlv.Get(localEndTime);
1222 TLVError = dataTlv.Get(operatingModeDuringHoliday);
1225 // Unsupported tag, ignore it.
1226 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1229 if (TLVError != CHIP_NO_ERROR)
1231 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1232 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1235 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1236 emberAfDoorLockClusterSetHolidayScheduleCallback(scheduleId, localStartTime, localEndTime, operatingModeDuringHoliday);
1239 case ZCL_SET_PIN_COMMAND_ID: {
1240 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1244 const uint8_t * pin;
1246 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1248 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1251 TLVError = dataTlv.Get(userId);
1254 TLVError = dataTlv.Get(userStatus);
1257 TLVError = dataTlv.Get(userType);
1260 TLVError = dataTlv.GetDataPtr(pin);
1263 // Unsupported tag, ignore it.
1264 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1267 if (TLVError != CHIP_NO_ERROR)
1269 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1270 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1273 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1274 emberAfDoorLockClusterSetPinCallback(userId, userStatus, userType, const_cast<uint8_t *>(pin));
1277 case ZCL_SET_RFID_COMMAND_ID: {
1278 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1284 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1286 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1289 TLVError = dataTlv.Get(userId);
1292 TLVError = dataTlv.Get(userStatus);
1295 TLVError = dataTlv.Get(userType);
1298 TLVError = dataTlv.GetDataPtr(id);
1301 // Unsupported tag, ignore it.
1302 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1305 if (TLVError != CHIP_NO_ERROR)
1307 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1308 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1311 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1312 emberAfDoorLockClusterSetRfidCallback(userId, userStatus, userType, const_cast<uint8_t *>(id));
1315 case ZCL_SET_USER_TYPE_COMMAND_ID: {
1316 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1320 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1322 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1325 TLVError = dataTlv.Get(userId);
1328 TLVError = dataTlv.Get(userType);
1331 // Unsupported tag, ignore it.
1332 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1335 if (TLVError != CHIP_NO_ERROR)
1337 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1338 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1341 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1342 emberAfDoorLockClusterSetUserTypeCallback(userId, userType);
1345 case ZCL_SET_WEEKDAY_SCHEDULE_COMMAND_ID: {
1346 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1351 uint8_t startMinute;
1355 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1357 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1360 TLVError = dataTlv.Get(scheduleId);
1363 TLVError = dataTlv.Get(userId);
1366 TLVError = dataTlv.Get(daysMask);
1369 TLVError = dataTlv.Get(startHour);
1372 TLVError = dataTlv.Get(startMinute);
1375 TLVError = dataTlv.Get(endHour);
1378 TLVError = dataTlv.Get(endMinute);
1381 // Unsupported tag, ignore it.
1382 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1385 if (TLVError != CHIP_NO_ERROR)
1387 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1388 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1391 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1392 emberAfDoorLockClusterSetWeekdayScheduleCallback(scheduleId, userId, daysMask, startHour, startMinute, endHour,
1396 case ZCL_SET_YEARDAY_SCHEDULE_COMMAND_ID: {
1397 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1400 uint32_t localStartTime;
1401 uint32_t localEndTime;
1403 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1405 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1408 TLVError = dataTlv.Get(scheduleId);
1411 TLVError = dataTlv.Get(userId);
1414 TLVError = dataTlv.Get(localStartTime);
1417 TLVError = dataTlv.Get(localEndTime);
1420 // Unsupported tag, ignore it.
1421 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1424 if (TLVError != CHIP_NO_ERROR)
1426 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1427 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1430 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1431 emberAfDoorLockClusterSetYeardayScheduleCallback(scheduleId, userId, localStartTime, localEndTime);
1434 case ZCL_UNLOCK_DOOR_COMMAND_ID: {
1435 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1436 const uint8_t * PIN;
1438 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1440 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1443 TLVError = dataTlv.GetDataPtr(PIN);
1446 // Unsupported tag, ignore it.
1447 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1450 if (TLVError != CHIP_NO_ERROR)
1452 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1453 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1456 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1457 emberAfDoorLockClusterUnlockDoorCallback(const_cast<uint8_t *>(PIN));
1460 case ZCL_UNLOCK_WITH_TIMEOUT_COMMAND_ID: {
1461 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1462 uint16_t timeoutInSeconds;
1463 const uint8_t * pin;
1465 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1467 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1470 TLVError = dataTlv.Get(timeoutInSeconds);
1473 TLVError = dataTlv.GetDataPtr(pin);
1476 // Unsupported tag, ignore it.
1477 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1480 if (TLVError != CHIP_NO_ERROR)
1482 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1483 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1486 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1487 emberAfDoorLockClusterUnlockWithTimeoutCallback(timeoutInSeconds, const_cast<uint8_t *>(pin));
1491 // Unrecognized command ID, error status will apply.
1492 // TODO: Encode response for command not found
1493 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_DOOR_LOCK_CLUSTER_ID);
1500 } // namespace DoorLock
1502 namespace GeneralCommissioning {
1504 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
1509 case ZCL_ARM_FAIL_SAFE_COMMAND_ID: {
1510 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1511 uint16_t expiryLengthSeconds;
1512 uint64_t breadcrumb;
1515 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1517 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1520 TLVError = dataTlv.Get(expiryLengthSeconds);
1523 TLVError = dataTlv.Get(breadcrumb);
1526 TLVError = dataTlv.Get(timeoutMs);
1529 // Unsupported tag, ignore it.
1530 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1533 if (TLVError != CHIP_NO_ERROR)
1535 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1536 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1539 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1540 emberAfGeneralCommissioningClusterArmFailSafeCallback(expiryLengthSeconds, breadcrumb, timeoutMs);
1543 case ZCL_COMMISSIONING_COMPLETE_COMMAND_ID: {
1544 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1545 emberAfGeneralCommissioningClusterCommissioningCompleteCallback();
1548 case ZCL_SET_FABRIC_COMMAND_ID: {
1549 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1550 const uint8_t * fabricId;
1551 const uint8_t * fabricSecret;
1552 uint64_t breadcrumb;
1555 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1557 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1560 TLVError = dataTlv.GetDataPtr(fabricId);
1563 TLVError = dataTlv.GetDataPtr(fabricSecret);
1566 TLVError = dataTlv.Get(breadcrumb);
1569 TLVError = dataTlv.Get(timeoutMs);
1572 // Unsupported tag, ignore it.
1573 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1576 if (TLVError != CHIP_NO_ERROR)
1578 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1579 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1582 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1583 emberAfGeneralCommissioningClusterSetFabricCallback(const_cast<uint8_t *>(fabricId),
1584 const_cast<uint8_t *>(fabricSecret), breadcrumb, timeoutMs);
1588 // Unrecognized command ID, error status will apply.
1589 // TODO: Encode response for command not found
1590 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_GENERAL_COMMISSIONING_CLUSTER_ID);
1597 } // namespace GeneralCommissioning
1601 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
1606 case ZCL_ADD_GROUP_COMMAND_ID: {
1607 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1609 const uint8_t * groupName;
1611 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1613 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1616 TLVError = dataTlv.Get(groupId);
1619 TLVError = dataTlv.GetDataPtr(groupName);
1622 // Unsupported tag, ignore it.
1623 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1626 if (TLVError != CHIP_NO_ERROR)
1628 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1629 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1632 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1633 emberAfGroupsClusterAddGroupCallback(groupId, const_cast<uint8_t *>(groupName));
1636 case ZCL_ADD_GROUP_IF_IDENTIFYING_COMMAND_ID: {
1637 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1639 const uint8_t * groupName;
1641 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1643 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1646 TLVError = dataTlv.Get(groupId);
1649 TLVError = dataTlv.GetDataPtr(groupName);
1652 // Unsupported tag, ignore it.
1653 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1656 if (TLVError != CHIP_NO_ERROR)
1658 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1659 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1662 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1663 emberAfGroupsClusterAddGroupIfIdentifyingCallback(groupId, const_cast<uint8_t *>(groupName));
1666 case ZCL_GET_GROUP_MEMBERSHIP_COMMAND_ID: {
1667 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1669 /* TYPE WARNING: array array defaults to */ uint8_t * groupList;
1671 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1673 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1676 TLVError = dataTlv.Get(groupCount);
1679 // Just for compatibility, we will add array type support in IM later.
1680 TLVError = dataTlv.GetDataPtr(const_cast<const uint8_t *&>(groupList));
1683 // Unsupported tag, ignore it.
1684 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1687 if (TLVError != CHIP_NO_ERROR)
1689 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1690 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1693 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1694 emberAfGroupsClusterGetGroupMembershipCallback(groupCount, groupList);
1697 case ZCL_REMOVE_ALL_GROUPS_COMMAND_ID: {
1698 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1699 emberAfGroupsClusterRemoveAllGroupsCallback();
1702 case ZCL_REMOVE_GROUP_COMMAND_ID: {
1703 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1706 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1708 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1711 TLVError = dataTlv.Get(groupId);
1714 // Unsupported tag, ignore it.
1715 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1718 if (TLVError != CHIP_NO_ERROR)
1720 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1721 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1724 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1725 emberAfGroupsClusterRemoveGroupCallback(groupId);
1728 case ZCL_VIEW_GROUP_COMMAND_ID: {
1729 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1732 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1734 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1737 TLVError = dataTlv.Get(groupId);
1740 // Unsupported tag, ignore it.
1741 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1744 if (TLVError != CHIP_NO_ERROR)
1746 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1747 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1750 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1751 emberAfGroupsClusterViewGroupCallback(groupId);
1755 // Unrecognized command ID, error status will apply.
1756 // TODO: Encode response for command not found
1757 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_GROUPS_CLUSTER_ID);
1764 } // namespace Groups
1768 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
1773 case ZCL_ZONE_ENROLL_RESPONSE_COMMAND_ID: {
1774 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1775 uint8_t enrollResponseCode;
1778 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1780 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1783 TLVError = dataTlv.Get(enrollResponseCode);
1786 TLVError = dataTlv.Get(zoneId);
1789 // Unsupported tag, ignore it.
1790 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1793 if (TLVError != CHIP_NO_ERROR)
1795 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1796 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1799 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1800 emberAfIasZoneClusterZoneEnrollResponseCallback(enrollResponseCode, zoneId);
1804 // Unrecognized command ID, error status will apply.
1805 // TODO: Encode response for command not found
1806 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_IAS_ZONE_CLUSTER_ID);
1813 } // namespace IasZone
1815 namespace Identify {
1817 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
1822 case ZCL_IDENTIFY_COMMAND_ID: {
1823 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1824 uint16_t identifyTime;
1826 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1828 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1831 TLVError = dataTlv.Get(identifyTime);
1834 // Unsupported tag, ignore it.
1835 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1838 if (TLVError != CHIP_NO_ERROR)
1840 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1841 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1844 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1845 emberAfIdentifyClusterIdentifyCallback(identifyTime);
1848 case ZCL_IDENTIFY_QUERY_COMMAND_ID: {
1849 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1850 emberAfIdentifyClusterIdentifyQueryCallback();
1854 // Unrecognized command ID, error status will apply.
1855 // TODO: Encode response for command not found
1856 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_IDENTIFY_CLUSTER_ID);
1863 } // namespace Identify
1865 namespace LevelControl {
1867 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
1872 case ZCL_MOVE_COMMAND_ID: {
1873 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1877 uint8_t optionOverride;
1879 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1881 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1884 TLVError = dataTlv.Get(moveMode);
1887 TLVError = dataTlv.Get(rate);
1890 TLVError = dataTlv.Get(optionMask);
1893 TLVError = dataTlv.Get(optionOverride);
1896 // Unsupported tag, ignore it.
1897 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1900 if (TLVError != CHIP_NO_ERROR)
1902 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1903 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1906 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1907 emberAfLevelControlClusterMoveCallback(moveMode, rate, optionMask, optionOverride);
1910 case ZCL_MOVE_TO_LEVEL_COMMAND_ID: {
1911 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1913 uint16_t transitionTime;
1915 uint8_t optionOverride;
1917 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1919 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1922 TLVError = dataTlv.Get(level);
1925 TLVError = dataTlv.Get(transitionTime);
1928 TLVError = dataTlv.Get(optionMask);
1931 TLVError = dataTlv.Get(optionOverride);
1934 // Unsupported tag, ignore it.
1935 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1938 if (TLVError != CHIP_NO_ERROR)
1940 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1941 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1944 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1945 emberAfLevelControlClusterMoveToLevelCallback(level, transitionTime, optionMask, optionOverride);
1948 case ZCL_MOVE_TO_LEVEL_WITH_ON_OFF_COMMAND_ID: {
1949 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1951 uint16_t transitionTime;
1953 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1955 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1958 TLVError = dataTlv.Get(level);
1961 TLVError = dataTlv.Get(transitionTime);
1964 // Unsupported tag, ignore it.
1965 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1968 if (TLVError != CHIP_NO_ERROR)
1970 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1971 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1974 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1975 emberAfLevelControlClusterMoveToLevelWithOnOffCallback(level, transitionTime);
1978 case ZCL_MOVE_WITH_ON_OFF_COMMAND_ID: {
1979 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1983 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1985 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1988 TLVError = dataTlv.Get(moveMode);
1991 TLVError = dataTlv.Get(rate);
1994 // Unsupported tag, ignore it.
1995 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1998 if (TLVError != CHIP_NO_ERROR)
2000 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2001 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2004 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2005 emberAfLevelControlClusterMoveWithOnOffCallback(moveMode, rate);
2008 case ZCL_STEP_COMMAND_ID: {
2009 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2012 uint16_t transitionTime;
2014 uint8_t optionOverride;
2016 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2018 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2021 TLVError = dataTlv.Get(stepMode);
2024 TLVError = dataTlv.Get(stepSize);
2027 TLVError = dataTlv.Get(transitionTime);
2030 TLVError = dataTlv.Get(optionMask);
2033 TLVError = dataTlv.Get(optionOverride);
2036 // Unsupported tag, ignore it.
2037 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2040 if (TLVError != CHIP_NO_ERROR)
2042 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2043 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2046 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2047 emberAfLevelControlClusterStepCallback(stepMode, stepSize, transitionTime, optionMask, optionOverride);
2050 case ZCL_STEP_WITH_ON_OFF_COMMAND_ID: {
2051 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2054 uint16_t transitionTime;
2056 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2058 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2061 TLVError = dataTlv.Get(stepMode);
2064 TLVError = dataTlv.Get(stepSize);
2067 TLVError = dataTlv.Get(transitionTime);
2070 // Unsupported tag, ignore it.
2071 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2074 if (TLVError != CHIP_NO_ERROR)
2076 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2077 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2080 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2081 emberAfLevelControlClusterStepWithOnOffCallback(stepMode, stepSize, transitionTime);
2084 case ZCL_STOP_COMMAND_ID: {
2085 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2087 uint8_t optionOverride;
2089 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2091 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2094 TLVError = dataTlv.Get(optionMask);
2097 TLVError = dataTlv.Get(optionOverride);
2100 // Unsupported tag, ignore it.
2101 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2104 if (TLVError != CHIP_NO_ERROR)
2106 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2107 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2110 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2111 emberAfLevelControlClusterStopCallback(optionMask, optionOverride);
2114 case ZCL_STOP_WITH_ON_OFF_COMMAND_ID: {
2115 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2116 emberAfLevelControlClusterStopWithOnOffCallback();
2120 // Unrecognized command ID, error status will apply.
2121 // TODO: Encode response for command not found
2122 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_LEVEL_CONTROL_CLUSTER_ID);
2129 } // namespace LevelControl
2131 namespace LowPower {
2133 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
2138 case ZCL_SLEEP_COMMAND_ID: {
2139 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2140 emberAfLowPowerClusterSleepCallback();
2144 // Unrecognized command ID, error status will apply.
2145 // TODO: Encode response for command not found
2146 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_LOW_POWER_CLUSTER_ID);
2153 } // namespace LowPower
2155 namespace MediaPlayback {
2157 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
2162 case ZCL_FAST_FORWARD_REQUEST_COMMAND_ID: {
2163 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2164 emberAfMediaPlaybackClusterFastForwardRequestCallback();
2167 case ZCL_NEXT_REQUEST_COMMAND_ID: {
2168 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2169 emberAfMediaPlaybackClusterNextRequestCallback();
2172 case ZCL_PAUSE_REQUEST_COMMAND_ID: {
2173 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2174 emberAfMediaPlaybackClusterPauseRequestCallback();
2177 case ZCL_PLAY_REQUEST_COMMAND_ID: {
2178 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2179 emberAfMediaPlaybackClusterPlayRequestCallback();
2182 case ZCL_PREVIOUS_REQUEST_COMMAND_ID: {
2183 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2184 emberAfMediaPlaybackClusterPreviousRequestCallback();
2187 case ZCL_REWIND_REQUEST_COMMAND_ID: {
2188 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2189 emberAfMediaPlaybackClusterRewindRequestCallback();
2192 case ZCL_SKIP_BACKWARD_REQUEST_COMMAND_ID: {
2193 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2194 emberAfMediaPlaybackClusterSkipBackwardRequestCallback();
2197 case ZCL_SKIP_FORWARD_REQUEST_COMMAND_ID: {
2198 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2199 emberAfMediaPlaybackClusterSkipForwardRequestCallback();
2202 case ZCL_START_OVER_REQUEST_COMMAND_ID: {
2203 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2204 emberAfMediaPlaybackClusterStartOverRequestCallback();
2207 case ZCL_STOP_REQUEST_COMMAND_ID: {
2208 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2209 emberAfMediaPlaybackClusterStopRequestCallback();
2213 // Unrecognized command ID, error status will apply.
2214 // TODO: Encode response for command not found
2215 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_MEDIA_PLAYBACK_CLUSTER_ID);
2222 } // namespace MediaPlayback
2226 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
2231 case ZCL_OFF_COMMAND_ID: {
2232 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2233 emberAfOnOffClusterOffCallback();
2236 case ZCL_ON_COMMAND_ID: {
2237 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2238 emberAfOnOffClusterOnCallback();
2241 case ZCL_TOGGLE_COMMAND_ID: {
2242 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2243 emberAfOnOffClusterToggleCallback();
2247 // Unrecognized command ID, error status will apply.
2248 // TODO: Encode response for command not found
2249 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_ON_OFF_CLUSTER_ID);
2256 } // namespace OnOff
2260 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
2265 case ZCL_ADD_SCENE_COMMAND_ID: {
2266 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2269 uint16_t transitionTime;
2270 const uint8_t * sceneName;
2271 /* TYPE WARNING: array array defaults to */ uint8_t * extensionFieldSets;
2273 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2275 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2278 TLVError = dataTlv.Get(groupId);
2281 TLVError = dataTlv.Get(sceneId);
2284 TLVError = dataTlv.Get(transitionTime);
2287 TLVError = dataTlv.GetDataPtr(sceneName);
2290 // Just for compatibility, we will add array type support in IM later.
2291 TLVError = dataTlv.GetDataPtr(const_cast<const uint8_t *&>(extensionFieldSets));
2294 // Unsupported tag, ignore it.
2295 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2298 if (TLVError != CHIP_NO_ERROR)
2300 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2301 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2304 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2305 emberAfScenesClusterAddSceneCallback(groupId, sceneId, transitionTime, const_cast<uint8_t *>(sceneName),
2306 extensionFieldSets);
2309 case ZCL_GET_SCENE_MEMBERSHIP_COMMAND_ID: {
2310 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2313 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2315 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2318 TLVError = dataTlv.Get(groupId);
2321 // Unsupported tag, ignore it.
2322 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2325 if (TLVError != CHIP_NO_ERROR)
2327 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2328 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2331 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2332 emberAfScenesClusterGetSceneMembershipCallback(groupId);
2335 case ZCL_RECALL_SCENE_COMMAND_ID: {
2336 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2339 uint16_t transitionTime;
2341 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2343 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2346 TLVError = dataTlv.Get(groupId);
2349 TLVError = dataTlv.Get(sceneId);
2352 TLVError = dataTlv.Get(transitionTime);
2355 // Unsupported tag, ignore it.
2356 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2359 if (TLVError != CHIP_NO_ERROR)
2361 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2362 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2365 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2366 emberAfScenesClusterRecallSceneCallback(groupId, sceneId, transitionTime);
2369 case ZCL_REMOVE_ALL_SCENES_COMMAND_ID: {
2370 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2373 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2375 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2378 TLVError = dataTlv.Get(groupId);
2381 // Unsupported tag, ignore it.
2382 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2385 if (TLVError != CHIP_NO_ERROR)
2387 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2388 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2391 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2392 emberAfScenesClusterRemoveAllScenesCallback(groupId);
2395 case ZCL_REMOVE_SCENE_COMMAND_ID: {
2396 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2400 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2402 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2405 TLVError = dataTlv.Get(groupId);
2408 TLVError = dataTlv.Get(sceneId);
2411 // Unsupported tag, ignore it.
2412 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2415 if (TLVError != CHIP_NO_ERROR)
2417 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2418 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2421 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2422 emberAfScenesClusterRemoveSceneCallback(groupId, sceneId);
2425 case ZCL_STORE_SCENE_COMMAND_ID: {
2426 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2430 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2432 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2435 TLVError = dataTlv.Get(groupId);
2438 TLVError = dataTlv.Get(sceneId);
2441 // Unsupported tag, ignore it.
2442 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2445 if (TLVError != CHIP_NO_ERROR)
2447 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2448 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2451 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2452 emberAfScenesClusterStoreSceneCallback(groupId, sceneId);
2455 case ZCL_VIEW_SCENE_COMMAND_ID: {
2456 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2460 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2462 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2465 TLVError = dataTlv.Get(groupId);
2468 TLVError = dataTlv.Get(sceneId);
2471 // Unsupported tag, ignore it.
2472 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2475 if (TLVError != CHIP_NO_ERROR)
2477 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2478 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2481 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2482 emberAfScenesClusterViewSceneCallback(groupId, sceneId);
2486 // Unrecognized command ID, error status will apply.
2487 // TODO: Encode response for command not found
2488 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_SCENES_CLUSTER_ID);
2495 } // namespace Scenes
2497 } // namespace clusters
2499 void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aCommandId, chip::EndpointId aEndPointId,
2500 chip::TLV::TLVReader & aReader, Command * apCommandObj)
2502 ChipLogDetail(Zcl, "Received Cluster Command: Cluster=%" PRIx16 " Command=%" PRIx8 " Endpoint=%" PRIx8, aClusterId, aCommandId,
2504 Compatibility::SetupEmberAfObjects(apCommandObj, aClusterId, aCommandId, aEndPointId);
2507 case ZCL_BARRIER_CONTROL_CLUSTER_ID:
2508 clusters::BarrierControl::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2510 case ZCL_BASIC_CLUSTER_ID:
2511 clusters::Basic::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2513 case ZCL_BINDING_CLUSTER_ID:
2514 clusters::Binding::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2516 case ZCL_COLOR_CONTROL_CLUSTER_ID:
2517 clusters::ColorControl::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2519 case ZCL_CONTENT_LAUNCH_CLUSTER_ID:
2520 clusters::ContentLaunch::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2522 case ZCL_DOOR_LOCK_CLUSTER_ID:
2523 clusters::DoorLock::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2525 case ZCL_GENERAL_COMMISSIONING_CLUSTER_ID:
2526 clusters::GeneralCommissioning::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2528 case ZCL_GROUPS_CLUSTER_ID:
2529 clusters::Groups::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2531 case ZCL_IAS_ZONE_CLUSTER_ID:
2532 clusters::IasZone::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2534 case ZCL_IDENTIFY_CLUSTER_ID:
2535 clusters::Identify::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2537 case ZCL_LEVEL_CONTROL_CLUSTER_ID:
2538 clusters::LevelControl::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2540 case ZCL_LOW_POWER_CLUSTER_ID:
2541 clusters::LowPower::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2543 case ZCL_MEDIA_PLAYBACK_CLUSTER_ID:
2544 clusters::MediaPlayback::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2546 case ZCL_ON_OFF_CLUSTER_ID:
2547 clusters::OnOff::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2549 case ZCL_SCENES_CLUSTER_ID:
2550 clusters::Scenes::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2553 // Unrecognized cluster ID, error status will apply.
2554 // TODO: Encode response for Cluster not found
2555 ChipLogError(Zcl, "Unknown cluster %" PRIx16, aClusterId);
2558 Compatibility::ResetEmberAfObjects();