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)
100 // Unrecognized command ID, error status will apply.
101 // TODO: Encode response for command not found
102 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_BASIC_CLUSTER_ID);
113 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
118 case ZCL_BIND_COMMAND_ID: {
119 CHIP_ERROR TLVError = CHIP_NO_ERROR;
121 chip::GroupId groupId;
122 chip::EndpointId endpointId;
123 chip::ClusterId clusterId;
125 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
127 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
130 TLVError = dataTlv.Get(nodeId);
133 TLVError = dataTlv.Get(groupId);
136 TLVError = dataTlv.Get(endpointId);
139 TLVError = dataTlv.Get(clusterId);
142 // Unsupported tag, ignore it.
143 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
146 if (TLVError != CHIP_NO_ERROR)
148 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
149 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
152 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
153 emberAfBindingClusterBindCallback(nodeId, groupId, endpointId, clusterId);
156 case ZCL_UNBIND_COMMAND_ID: {
157 CHIP_ERROR TLVError = CHIP_NO_ERROR;
159 chip::GroupId groupId;
160 chip::EndpointId endpointId;
161 chip::ClusterId clusterId;
163 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
165 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
168 TLVError = dataTlv.Get(nodeId);
171 TLVError = dataTlv.Get(groupId);
174 TLVError = dataTlv.Get(endpointId);
177 TLVError = dataTlv.Get(clusterId);
180 // Unsupported tag, ignore it.
181 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
184 if (TLVError != CHIP_NO_ERROR)
186 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
187 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
190 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
191 emberAfBindingClusterUnbindCallback(nodeId, groupId, endpointId, clusterId);
195 // Unrecognized command ID, error status will apply.
196 // TODO: Encode response for command not found
197 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_BINDING_CLUSTER_ID);
204 } // namespace Binding
206 namespace ColorControl {
208 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
213 case ZCL_MOVE_COLOR_COMMAND_ID: {
214 CHIP_ERROR TLVError = CHIP_NO_ERROR;
218 uint8_t optionsOverride;
220 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
222 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
225 TLVError = dataTlv.Get(rateX);
228 TLVError = dataTlv.Get(rateY);
231 TLVError = dataTlv.Get(optionsMask);
234 TLVError = dataTlv.Get(optionsOverride);
237 // Unsupported tag, ignore it.
238 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
241 if (TLVError != CHIP_NO_ERROR)
243 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
244 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
247 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
248 emberAfColorControlClusterMoveColorCallback(rateX, rateY, optionsMask, optionsOverride);
251 case ZCL_MOVE_COLOR_TEMPERATURE_COMMAND_ID: {
252 CHIP_ERROR TLVError = CHIP_NO_ERROR;
255 uint16_t colorTemperatureMinimum;
256 uint16_t colorTemperatureMaximum;
258 uint8_t optionsOverride;
260 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
262 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
265 TLVError = dataTlv.Get(moveMode);
268 TLVError = dataTlv.Get(rate);
271 TLVError = dataTlv.Get(colorTemperatureMinimum);
274 TLVError = dataTlv.Get(colorTemperatureMaximum);
277 TLVError = dataTlv.Get(optionsMask);
280 TLVError = dataTlv.Get(optionsOverride);
283 // Unsupported tag, ignore it.
284 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
287 if (TLVError != CHIP_NO_ERROR)
289 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
290 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
293 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
294 emberAfColorControlClusterMoveColorTemperatureCallback(moveMode, rate, colorTemperatureMinimum, colorTemperatureMaximum,
295 optionsMask, optionsOverride);
298 case ZCL_MOVE_HUE_COMMAND_ID: {
299 CHIP_ERROR TLVError = CHIP_NO_ERROR;
303 uint8_t optionsOverride;
305 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
307 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
310 TLVError = dataTlv.Get(moveMode);
313 TLVError = dataTlv.Get(rate);
316 TLVError = dataTlv.Get(optionsMask);
319 TLVError = dataTlv.Get(optionsOverride);
322 // Unsupported tag, ignore it.
323 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
326 if (TLVError != CHIP_NO_ERROR)
328 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
329 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
332 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
333 emberAfColorControlClusterMoveHueCallback(moveMode, rate, optionsMask, optionsOverride);
336 case ZCL_MOVE_SATURATION_COMMAND_ID: {
337 CHIP_ERROR TLVError = CHIP_NO_ERROR;
341 uint8_t optionsOverride;
343 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
345 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
348 TLVError = dataTlv.Get(moveMode);
351 TLVError = dataTlv.Get(rate);
354 TLVError = dataTlv.Get(optionsMask);
357 TLVError = dataTlv.Get(optionsOverride);
360 // Unsupported tag, ignore it.
361 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
364 if (TLVError != CHIP_NO_ERROR)
366 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
367 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
370 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
371 emberAfColorControlClusterMoveSaturationCallback(moveMode, rate, optionsMask, optionsOverride);
374 case ZCL_MOVE_TO_COLOR_COMMAND_ID: {
375 CHIP_ERROR TLVError = CHIP_NO_ERROR;
378 uint16_t transitionTime;
380 uint8_t optionsOverride;
382 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
384 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
387 TLVError = dataTlv.Get(colorX);
390 TLVError = dataTlv.Get(colorY);
393 TLVError = dataTlv.Get(transitionTime);
396 TLVError = dataTlv.Get(optionsMask);
399 TLVError = dataTlv.Get(optionsOverride);
402 // Unsupported tag, ignore it.
403 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
406 if (TLVError != CHIP_NO_ERROR)
408 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
409 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
412 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
413 emberAfColorControlClusterMoveToColorCallback(colorX, colorY, transitionTime, optionsMask, optionsOverride);
416 case ZCL_MOVE_TO_COLOR_TEMPERATURE_COMMAND_ID: {
417 CHIP_ERROR TLVError = CHIP_NO_ERROR;
418 uint16_t colorTemperature;
419 uint16_t transitionTime;
421 uint8_t optionsOverride;
423 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
425 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
428 TLVError = dataTlv.Get(colorTemperature);
431 TLVError = dataTlv.Get(transitionTime);
434 TLVError = dataTlv.Get(optionsMask);
437 TLVError = dataTlv.Get(optionsOverride);
440 // Unsupported tag, ignore it.
441 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
444 if (TLVError != CHIP_NO_ERROR)
446 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
447 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
450 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
451 emberAfColorControlClusterMoveToColorTemperatureCallback(colorTemperature, transitionTime, optionsMask,
455 case ZCL_MOVE_TO_HUE_COMMAND_ID: {
456 CHIP_ERROR TLVError = CHIP_NO_ERROR;
459 uint16_t transitionTime;
461 uint8_t optionsOverride;
463 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
465 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
468 TLVError = dataTlv.Get(hue);
471 TLVError = dataTlv.Get(direction);
474 TLVError = dataTlv.Get(transitionTime);
477 TLVError = dataTlv.Get(optionsMask);
480 TLVError = dataTlv.Get(optionsOverride);
483 // Unsupported tag, ignore it.
484 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
487 if (TLVError != CHIP_NO_ERROR)
489 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
490 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
493 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
494 emberAfColorControlClusterMoveToHueCallback(hue, direction, transitionTime, optionsMask, optionsOverride);
497 case ZCL_MOVE_TO_HUE_AND_SATURATION_COMMAND_ID: {
498 CHIP_ERROR TLVError = CHIP_NO_ERROR;
501 uint16_t transitionTime;
503 uint8_t optionsOverride;
505 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
507 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
510 TLVError = dataTlv.Get(hue);
513 TLVError = dataTlv.Get(saturation);
516 TLVError = dataTlv.Get(transitionTime);
519 TLVError = dataTlv.Get(optionsMask);
522 TLVError = dataTlv.Get(optionsOverride);
525 // Unsupported tag, ignore it.
526 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
529 if (TLVError != CHIP_NO_ERROR)
531 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
532 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
535 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
536 emberAfColorControlClusterMoveToHueAndSaturationCallback(hue, saturation, transitionTime, optionsMask, optionsOverride);
539 case ZCL_MOVE_TO_SATURATION_COMMAND_ID: {
540 CHIP_ERROR TLVError = CHIP_NO_ERROR;
542 uint16_t transitionTime;
544 uint8_t optionsOverride;
546 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
548 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
551 TLVError = dataTlv.Get(saturation);
554 TLVError = dataTlv.Get(transitionTime);
557 TLVError = dataTlv.Get(optionsMask);
560 TLVError = dataTlv.Get(optionsOverride);
563 // Unsupported tag, ignore it.
564 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
567 if (TLVError != CHIP_NO_ERROR)
569 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
570 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
573 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
574 emberAfColorControlClusterMoveToSaturationCallback(saturation, transitionTime, optionsMask, optionsOverride);
577 case ZCL_STEP_COLOR_COMMAND_ID: {
578 CHIP_ERROR TLVError = CHIP_NO_ERROR;
581 uint16_t transitionTime;
583 uint8_t optionsOverride;
585 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
587 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
590 TLVError = dataTlv.Get(stepX);
593 TLVError = dataTlv.Get(stepY);
596 TLVError = dataTlv.Get(transitionTime);
599 TLVError = dataTlv.Get(optionsMask);
602 TLVError = dataTlv.Get(optionsOverride);
605 // Unsupported tag, ignore it.
606 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
609 if (TLVError != CHIP_NO_ERROR)
611 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
612 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
615 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
616 emberAfColorControlClusterStepColorCallback(stepX, stepY, transitionTime, optionsMask, optionsOverride);
619 case ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID: {
620 CHIP_ERROR TLVError = CHIP_NO_ERROR;
623 uint16_t transitionTime;
624 uint16_t colorTemperatureMinimum;
625 uint16_t colorTemperatureMaximum;
627 uint8_t optionsOverride;
629 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
631 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
634 TLVError = dataTlv.Get(stepMode);
637 TLVError = dataTlv.Get(stepSize);
640 TLVError = dataTlv.Get(transitionTime);
643 TLVError = dataTlv.Get(colorTemperatureMinimum);
646 TLVError = dataTlv.Get(colorTemperatureMaximum);
649 TLVError = dataTlv.Get(optionsMask);
652 TLVError = dataTlv.Get(optionsOverride);
655 // Unsupported tag, ignore it.
656 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
659 if (TLVError != CHIP_NO_ERROR)
661 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
662 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
665 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
666 emberAfColorControlClusterStepColorTemperatureCallback(stepMode, stepSize, transitionTime, colorTemperatureMinimum,
667 colorTemperatureMaximum, optionsMask, optionsOverride);
670 case ZCL_STEP_HUE_COMMAND_ID: {
671 CHIP_ERROR TLVError = CHIP_NO_ERROR;
674 uint8_t transitionTime;
676 uint8_t optionsOverride;
678 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
680 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
683 TLVError = dataTlv.Get(stepMode);
686 TLVError = dataTlv.Get(stepSize);
689 TLVError = dataTlv.Get(transitionTime);
692 TLVError = dataTlv.Get(optionsMask);
695 TLVError = dataTlv.Get(optionsOverride);
698 // Unsupported tag, ignore it.
699 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
702 if (TLVError != CHIP_NO_ERROR)
704 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
705 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
708 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
709 emberAfColorControlClusterStepHueCallback(stepMode, stepSize, transitionTime, optionsMask, optionsOverride);
712 case ZCL_STEP_SATURATION_COMMAND_ID: {
713 CHIP_ERROR TLVError = CHIP_NO_ERROR;
716 uint8_t transitionTime;
718 uint8_t optionsOverride;
720 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
722 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
725 TLVError = dataTlv.Get(stepMode);
728 TLVError = dataTlv.Get(stepSize);
731 TLVError = dataTlv.Get(transitionTime);
734 TLVError = dataTlv.Get(optionsMask);
737 TLVError = dataTlv.Get(optionsOverride);
740 // Unsupported tag, ignore it.
741 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
744 if (TLVError != CHIP_NO_ERROR)
746 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
747 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
750 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
751 emberAfColorControlClusterStepSaturationCallback(stepMode, stepSize, transitionTime, optionsMask, optionsOverride);
754 case ZCL_STOP_MOVE_STEP_COMMAND_ID: {
755 CHIP_ERROR TLVError = CHIP_NO_ERROR;
757 uint8_t optionsOverride;
759 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
761 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
764 TLVError = dataTlv.Get(optionsMask);
767 TLVError = dataTlv.Get(optionsOverride);
770 // Unsupported tag, ignore it.
771 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
774 if (TLVError != CHIP_NO_ERROR)
776 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
777 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
780 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
781 emberAfColorControlClusterStopMoveStepCallback(optionsMask, optionsOverride);
785 // Unrecognized command ID, error status will apply.
786 // TODO: Encode response for command not found
787 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_COLOR_CONTROL_CLUSTER_ID);
794 } // namespace ColorControl
796 namespace ContentLaunch {
798 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
803 case ZCL_LAUNCH_CONTENT_COMMAND_ID: {
804 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
805 emberAfContentLaunchClusterLaunchContentCallback();
808 case ZCL_LAUNCH_URL_COMMAND_ID: {
809 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
810 emberAfContentLaunchClusterLaunchURLCallback();
814 // Unrecognized command ID, error status will apply.
815 // TODO: Encode response for command not found
816 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_CONTENT_LAUNCH_CLUSTER_ID);
823 } // namespace ContentLaunch
827 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
832 case ZCL_CLEAR_ALL_PINS_COMMAND_ID: {
833 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
834 emberAfDoorLockClusterClearAllPinsCallback();
837 case ZCL_CLEAR_ALL_RFIDS_COMMAND_ID: {
838 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
839 emberAfDoorLockClusterClearAllRfidsCallback();
842 case ZCL_CLEAR_HOLIDAY_SCHEDULE_COMMAND_ID: {
843 CHIP_ERROR TLVError = CHIP_NO_ERROR;
846 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
848 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
851 TLVError = dataTlv.Get(scheduleId);
854 // Unsupported tag, ignore it.
855 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
858 if (TLVError != CHIP_NO_ERROR)
860 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
861 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
864 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
865 emberAfDoorLockClusterClearHolidayScheduleCallback(scheduleId);
868 case ZCL_CLEAR_PIN_COMMAND_ID: {
869 CHIP_ERROR TLVError = CHIP_NO_ERROR;
872 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
874 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
877 TLVError = dataTlv.Get(userId);
880 // Unsupported tag, ignore it.
881 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
884 if (TLVError != CHIP_NO_ERROR)
886 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
887 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
890 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
891 emberAfDoorLockClusterClearPinCallback(userId);
894 case ZCL_CLEAR_RFID_COMMAND_ID: {
895 CHIP_ERROR TLVError = CHIP_NO_ERROR;
898 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
900 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
903 TLVError = dataTlv.Get(userId);
906 // Unsupported tag, ignore it.
907 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
910 if (TLVError != CHIP_NO_ERROR)
912 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
913 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
916 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
917 emberAfDoorLockClusterClearRfidCallback(userId);
920 case ZCL_CLEAR_WEEKDAY_SCHEDULE_COMMAND_ID: {
921 CHIP_ERROR TLVError = CHIP_NO_ERROR;
925 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
927 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
930 TLVError = dataTlv.Get(scheduleId);
933 TLVError = dataTlv.Get(userId);
936 // Unsupported tag, ignore it.
937 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
940 if (TLVError != CHIP_NO_ERROR)
942 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
943 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
946 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
947 emberAfDoorLockClusterClearWeekdayScheduleCallback(scheduleId, userId);
950 case ZCL_CLEAR_YEARDAY_SCHEDULE_COMMAND_ID: {
951 CHIP_ERROR TLVError = CHIP_NO_ERROR;
955 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
957 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
960 TLVError = dataTlv.Get(scheduleId);
963 TLVError = dataTlv.Get(userId);
966 // Unsupported tag, ignore it.
967 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
970 if (TLVError != CHIP_NO_ERROR)
972 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
973 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
976 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
977 emberAfDoorLockClusterClearYeardayScheduleCallback(scheduleId, userId);
980 case ZCL_GET_HOLIDAY_SCHEDULE_COMMAND_ID: {
981 CHIP_ERROR TLVError = CHIP_NO_ERROR;
984 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
986 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
989 TLVError = dataTlv.Get(scheduleId);
992 // Unsupported tag, ignore it.
993 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
996 if (TLVError != CHIP_NO_ERROR)
998 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
999 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1002 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1003 emberAfDoorLockClusterGetHolidayScheduleCallback(scheduleId);
1006 case ZCL_GET_LOG_RECORD_COMMAND_ID: {
1007 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1010 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1012 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1015 TLVError = dataTlv.Get(logIndex);
1018 // Unsupported tag, ignore it.
1019 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1022 if (TLVError != CHIP_NO_ERROR)
1024 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1025 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1028 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1029 emberAfDoorLockClusterGetLogRecordCallback(logIndex);
1032 case ZCL_GET_PIN_COMMAND_ID: {
1033 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1036 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1038 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1041 TLVError = dataTlv.Get(userId);
1044 // Unsupported tag, ignore it.
1045 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1048 if (TLVError != CHIP_NO_ERROR)
1050 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1051 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1054 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1055 emberAfDoorLockClusterGetPinCallback(userId);
1058 case ZCL_GET_RFID_COMMAND_ID: {
1059 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1062 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1064 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1067 TLVError = dataTlv.Get(userId);
1070 // Unsupported tag, ignore it.
1071 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1074 if (TLVError != CHIP_NO_ERROR)
1076 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1077 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1080 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1081 emberAfDoorLockClusterGetRfidCallback(userId);
1084 case ZCL_GET_USER_TYPE_COMMAND_ID: {
1085 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1088 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1090 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1093 TLVError = dataTlv.Get(userId);
1096 // Unsupported tag, ignore it.
1097 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1100 if (TLVError != CHIP_NO_ERROR)
1102 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1103 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1106 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1107 emberAfDoorLockClusterGetUserTypeCallback(userId);
1110 case ZCL_GET_WEEKDAY_SCHEDULE_COMMAND_ID: {
1111 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1115 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1117 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1120 TLVError = dataTlv.Get(scheduleId);
1123 TLVError = dataTlv.Get(userId);
1126 // Unsupported tag, ignore it.
1127 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1130 if (TLVError != CHIP_NO_ERROR)
1132 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1133 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1136 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1137 emberAfDoorLockClusterGetWeekdayScheduleCallback(scheduleId, userId);
1140 case ZCL_GET_YEARDAY_SCHEDULE_COMMAND_ID: {
1141 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1145 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1147 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1150 TLVError = dataTlv.Get(scheduleId);
1153 TLVError = dataTlv.Get(userId);
1156 // Unsupported tag, ignore it.
1157 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1160 if (TLVError != CHIP_NO_ERROR)
1162 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1163 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1166 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1167 emberAfDoorLockClusterGetYeardayScheduleCallback(scheduleId, userId);
1170 case ZCL_LOCK_DOOR_COMMAND_ID: {
1171 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1172 const uint8_t * PIN;
1174 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1176 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1179 TLVError = dataTlv.GetDataPtr(PIN);
1182 // Unsupported tag, ignore it.
1183 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1186 if (TLVError != CHIP_NO_ERROR)
1188 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1189 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1192 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1193 emberAfDoorLockClusterLockDoorCallback(const_cast<uint8_t *>(PIN));
1196 case ZCL_SET_HOLIDAY_SCHEDULE_COMMAND_ID: {
1197 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1199 uint32_t localStartTime;
1200 uint32_t localEndTime;
1201 uint8_t operatingModeDuringHoliday;
1203 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1205 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1208 TLVError = dataTlv.Get(scheduleId);
1211 TLVError = dataTlv.Get(localStartTime);
1214 TLVError = dataTlv.Get(localEndTime);
1217 TLVError = dataTlv.Get(operatingModeDuringHoliday);
1220 // Unsupported tag, ignore it.
1221 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1224 if (TLVError != CHIP_NO_ERROR)
1226 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1227 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1230 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1231 emberAfDoorLockClusterSetHolidayScheduleCallback(scheduleId, localStartTime, localEndTime, operatingModeDuringHoliday);
1234 case ZCL_SET_PIN_COMMAND_ID: {
1235 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1239 const uint8_t * pin;
1241 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1243 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1246 TLVError = dataTlv.Get(userId);
1249 TLVError = dataTlv.Get(userStatus);
1252 TLVError = dataTlv.Get(userType);
1255 TLVError = dataTlv.GetDataPtr(pin);
1258 // Unsupported tag, ignore it.
1259 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1262 if (TLVError != CHIP_NO_ERROR)
1264 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1265 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1268 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1269 emberAfDoorLockClusterSetPinCallback(userId, userStatus, userType, const_cast<uint8_t *>(pin));
1272 case ZCL_SET_RFID_COMMAND_ID: {
1273 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1279 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1281 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1284 TLVError = dataTlv.Get(userId);
1287 TLVError = dataTlv.Get(userStatus);
1290 TLVError = dataTlv.Get(userType);
1293 TLVError = dataTlv.GetDataPtr(id);
1296 // Unsupported tag, ignore it.
1297 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1300 if (TLVError != CHIP_NO_ERROR)
1302 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1303 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1306 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1307 emberAfDoorLockClusterSetRfidCallback(userId, userStatus, userType, const_cast<uint8_t *>(id));
1310 case ZCL_SET_USER_TYPE_COMMAND_ID: {
1311 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1315 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1317 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1320 TLVError = dataTlv.Get(userId);
1323 TLVError = dataTlv.Get(userType);
1326 // Unsupported tag, ignore it.
1327 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1330 if (TLVError != CHIP_NO_ERROR)
1332 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1333 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1336 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1337 emberAfDoorLockClusterSetUserTypeCallback(userId, userType);
1340 case ZCL_SET_WEEKDAY_SCHEDULE_COMMAND_ID: {
1341 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1346 uint8_t startMinute;
1350 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1352 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1355 TLVError = dataTlv.Get(scheduleId);
1358 TLVError = dataTlv.Get(userId);
1361 TLVError = dataTlv.Get(daysMask);
1364 TLVError = dataTlv.Get(startHour);
1367 TLVError = dataTlv.Get(startMinute);
1370 TLVError = dataTlv.Get(endHour);
1373 TLVError = dataTlv.Get(endMinute);
1376 // Unsupported tag, ignore it.
1377 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1380 if (TLVError != CHIP_NO_ERROR)
1382 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1383 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1386 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1387 emberAfDoorLockClusterSetWeekdayScheduleCallback(scheduleId, userId, daysMask, startHour, startMinute, endHour,
1391 case ZCL_SET_YEARDAY_SCHEDULE_COMMAND_ID: {
1392 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1395 uint32_t localStartTime;
1396 uint32_t localEndTime;
1398 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1400 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1403 TLVError = dataTlv.Get(scheduleId);
1406 TLVError = dataTlv.Get(userId);
1409 TLVError = dataTlv.Get(localStartTime);
1412 TLVError = dataTlv.Get(localEndTime);
1415 // Unsupported tag, ignore it.
1416 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1419 if (TLVError != CHIP_NO_ERROR)
1421 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1422 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1425 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1426 emberAfDoorLockClusterSetYeardayScheduleCallback(scheduleId, userId, localStartTime, localEndTime);
1429 case ZCL_UNLOCK_DOOR_COMMAND_ID: {
1430 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1431 const uint8_t * PIN;
1433 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1435 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1438 TLVError = dataTlv.GetDataPtr(PIN);
1441 // Unsupported tag, ignore it.
1442 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1445 if (TLVError != CHIP_NO_ERROR)
1447 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1448 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1451 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1452 emberAfDoorLockClusterUnlockDoorCallback(const_cast<uint8_t *>(PIN));
1455 case ZCL_UNLOCK_WITH_TIMEOUT_COMMAND_ID: {
1456 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1457 uint16_t timeoutInSeconds;
1458 const uint8_t * pin;
1460 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1462 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1465 TLVError = dataTlv.Get(timeoutInSeconds);
1468 TLVError = dataTlv.GetDataPtr(pin);
1471 // Unsupported tag, ignore it.
1472 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1475 if (TLVError != CHIP_NO_ERROR)
1477 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1478 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1481 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1482 emberAfDoorLockClusterUnlockWithTimeoutCallback(timeoutInSeconds, const_cast<uint8_t *>(pin));
1486 // Unrecognized command ID, error status will apply.
1487 // TODO: Encode response for command not found
1488 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_DOOR_LOCK_CLUSTER_ID);
1495 } // namespace DoorLock
1497 namespace GeneralCommissioning {
1499 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
1504 case ZCL_ARM_FAIL_SAFE_COMMAND_ID: {
1505 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1506 uint16_t expiryLengthSeconds;
1507 uint64_t breadcrumb;
1510 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1512 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1515 TLVError = dataTlv.Get(expiryLengthSeconds);
1518 TLVError = dataTlv.Get(breadcrumb);
1521 TLVError = dataTlv.Get(timeoutMs);
1524 // Unsupported tag, ignore it.
1525 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1528 if (TLVError != CHIP_NO_ERROR)
1530 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1531 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1534 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1535 emberAfGeneralCommissioningClusterArmFailSafeCallback(expiryLengthSeconds, breadcrumb, timeoutMs);
1538 case ZCL_COMMISSIONING_COMPLETE_COMMAND_ID: {
1539 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1540 emberAfGeneralCommissioningClusterCommissioningCompleteCallback();
1543 case ZCL_SET_FABRIC_COMMAND_ID: {
1544 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1545 const uint8_t * fabricId;
1546 const uint8_t * fabricSecret;
1547 uint64_t breadcrumb;
1550 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1552 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1555 TLVError = dataTlv.GetDataPtr(fabricId);
1558 TLVError = dataTlv.GetDataPtr(fabricSecret);
1561 TLVError = dataTlv.Get(breadcrumb);
1564 TLVError = dataTlv.Get(timeoutMs);
1567 // Unsupported tag, ignore it.
1568 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1571 if (TLVError != CHIP_NO_ERROR)
1573 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1574 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1577 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1578 emberAfGeneralCommissioningClusterSetFabricCallback(const_cast<uint8_t *>(fabricId),
1579 const_cast<uint8_t *>(fabricSecret), breadcrumb, timeoutMs);
1583 // Unrecognized command ID, error status will apply.
1584 // TODO: Encode response for command not found
1585 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_GENERAL_COMMISSIONING_CLUSTER_ID);
1592 } // namespace GeneralCommissioning
1596 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
1601 case ZCL_ADD_GROUP_COMMAND_ID: {
1602 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1604 const uint8_t * groupName;
1606 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1608 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1611 TLVError = dataTlv.Get(groupId);
1614 TLVError = dataTlv.GetDataPtr(groupName);
1617 // Unsupported tag, ignore it.
1618 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1621 if (TLVError != CHIP_NO_ERROR)
1623 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1624 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1627 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1628 emberAfGroupsClusterAddGroupCallback(groupId, const_cast<uint8_t *>(groupName));
1631 case ZCL_ADD_GROUP_IF_IDENTIFYING_COMMAND_ID: {
1632 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1634 const uint8_t * groupName;
1636 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1638 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1641 TLVError = dataTlv.Get(groupId);
1644 TLVError = dataTlv.GetDataPtr(groupName);
1647 // Unsupported tag, ignore it.
1648 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1651 if (TLVError != CHIP_NO_ERROR)
1653 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1654 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1657 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1658 emberAfGroupsClusterAddGroupIfIdentifyingCallback(groupId, const_cast<uint8_t *>(groupName));
1661 case ZCL_GET_GROUP_MEMBERSHIP_COMMAND_ID: {
1662 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1664 /* TYPE WARNING: array array defaults to */ uint8_t * groupList;
1666 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1668 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1671 TLVError = dataTlv.Get(groupCount);
1674 // Just for compatibility, we will add array type support in IM later.
1675 TLVError = dataTlv.GetDataPtr(const_cast<const uint8_t *&>(groupList));
1678 // Unsupported tag, ignore it.
1679 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1682 if (TLVError != CHIP_NO_ERROR)
1684 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1685 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1688 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1689 emberAfGroupsClusterGetGroupMembershipCallback(groupCount, groupList);
1692 case ZCL_REMOVE_ALL_GROUPS_COMMAND_ID: {
1693 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1694 emberAfGroupsClusterRemoveAllGroupsCallback();
1697 case ZCL_REMOVE_GROUP_COMMAND_ID: {
1698 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1701 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1703 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1706 TLVError = dataTlv.Get(groupId);
1709 // Unsupported tag, ignore it.
1710 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1713 if (TLVError != CHIP_NO_ERROR)
1715 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1716 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1719 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1720 emberAfGroupsClusterRemoveGroupCallback(groupId);
1723 case ZCL_VIEW_GROUP_COMMAND_ID: {
1724 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1727 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1729 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1732 TLVError = dataTlv.Get(groupId);
1735 // Unsupported tag, ignore it.
1736 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1739 if (TLVError != CHIP_NO_ERROR)
1741 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1742 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1745 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1746 emberAfGroupsClusterViewGroupCallback(groupId);
1750 // Unrecognized command ID, error status will apply.
1751 // TODO: Encode response for command not found
1752 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_GROUPS_CLUSTER_ID);
1759 } // namespace Groups
1763 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
1768 case ZCL_ZONE_ENROLL_RESPONSE_COMMAND_ID: {
1769 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1770 uint8_t enrollResponseCode;
1773 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1775 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1778 TLVError = dataTlv.Get(enrollResponseCode);
1781 TLVError = dataTlv.Get(zoneId);
1784 // Unsupported tag, ignore it.
1785 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1788 if (TLVError != CHIP_NO_ERROR)
1790 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1791 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1794 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1795 emberAfIasZoneClusterZoneEnrollResponseCallback(enrollResponseCode, zoneId);
1799 // Unrecognized command ID, error status will apply.
1800 // TODO: Encode response for command not found
1801 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_IAS_ZONE_CLUSTER_ID);
1808 } // namespace IasZone
1810 namespace Identify {
1812 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
1817 case ZCL_IDENTIFY_COMMAND_ID: {
1818 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1819 uint16_t identifyTime;
1821 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1823 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1826 TLVError = dataTlv.Get(identifyTime);
1829 // Unsupported tag, ignore it.
1830 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1833 if (TLVError != CHIP_NO_ERROR)
1835 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1836 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1839 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1840 emberAfIdentifyClusterIdentifyCallback(identifyTime);
1843 case ZCL_IDENTIFY_QUERY_COMMAND_ID: {
1844 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1845 emberAfIdentifyClusterIdentifyQueryCallback();
1849 // Unrecognized command ID, error status will apply.
1850 // TODO: Encode response for command not found
1851 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_IDENTIFY_CLUSTER_ID);
1858 } // namespace Identify
1860 namespace LevelControl {
1862 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
1867 case ZCL_MOVE_COMMAND_ID: {
1868 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1872 uint8_t optionOverride;
1874 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1876 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1879 TLVError = dataTlv.Get(moveMode);
1882 TLVError = dataTlv.Get(rate);
1885 TLVError = dataTlv.Get(optionMask);
1888 TLVError = dataTlv.Get(optionOverride);
1891 // Unsupported tag, ignore it.
1892 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1895 if (TLVError != CHIP_NO_ERROR)
1897 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1898 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1901 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1902 emberAfLevelControlClusterMoveCallback(moveMode, rate, optionMask, optionOverride);
1905 case ZCL_MOVE_TO_LEVEL_COMMAND_ID: {
1906 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1908 uint16_t transitionTime;
1910 uint8_t optionOverride;
1912 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1914 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1917 TLVError = dataTlv.Get(level);
1920 TLVError = dataTlv.Get(transitionTime);
1923 TLVError = dataTlv.Get(optionMask);
1926 TLVError = dataTlv.Get(optionOverride);
1929 // Unsupported tag, ignore it.
1930 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1933 if (TLVError != CHIP_NO_ERROR)
1935 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1936 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1939 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1940 emberAfLevelControlClusterMoveToLevelCallback(level, transitionTime, optionMask, optionOverride);
1943 case ZCL_MOVE_TO_LEVEL_WITH_ON_OFF_COMMAND_ID: {
1944 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1946 uint16_t transitionTime;
1948 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1950 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1953 TLVError = dataTlv.Get(level);
1956 TLVError = dataTlv.Get(transitionTime);
1959 // Unsupported tag, ignore it.
1960 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1963 if (TLVError != CHIP_NO_ERROR)
1965 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1966 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1969 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1970 emberAfLevelControlClusterMoveToLevelWithOnOffCallback(level, transitionTime);
1973 case ZCL_MOVE_WITH_ON_OFF_COMMAND_ID: {
1974 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1978 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1980 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1983 TLVError = dataTlv.Get(moveMode);
1986 TLVError = dataTlv.Get(rate);
1989 // Unsupported tag, ignore it.
1990 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1993 if (TLVError != CHIP_NO_ERROR)
1995 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1996 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1999 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2000 emberAfLevelControlClusterMoveWithOnOffCallback(moveMode, rate);
2003 case ZCL_STEP_COMMAND_ID: {
2004 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2007 uint16_t transitionTime;
2009 uint8_t optionOverride;
2011 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2013 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2016 TLVError = dataTlv.Get(stepMode);
2019 TLVError = dataTlv.Get(stepSize);
2022 TLVError = dataTlv.Get(transitionTime);
2025 TLVError = dataTlv.Get(optionMask);
2028 TLVError = dataTlv.Get(optionOverride);
2031 // Unsupported tag, ignore it.
2032 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2035 if (TLVError != CHIP_NO_ERROR)
2037 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2038 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2041 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2042 emberAfLevelControlClusterStepCallback(stepMode, stepSize, transitionTime, optionMask, optionOverride);
2045 case ZCL_STEP_WITH_ON_OFF_COMMAND_ID: {
2046 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2049 uint16_t transitionTime;
2051 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2053 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2056 TLVError = dataTlv.Get(stepMode);
2059 TLVError = dataTlv.Get(stepSize);
2062 TLVError = dataTlv.Get(transitionTime);
2065 // Unsupported tag, ignore it.
2066 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2069 if (TLVError != CHIP_NO_ERROR)
2071 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2072 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2075 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2076 emberAfLevelControlClusterStepWithOnOffCallback(stepMode, stepSize, transitionTime);
2079 case ZCL_STOP_COMMAND_ID: {
2080 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2082 uint8_t optionOverride;
2084 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2086 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2089 TLVError = dataTlv.Get(optionMask);
2092 TLVError = dataTlv.Get(optionOverride);
2095 // Unsupported tag, ignore it.
2096 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2099 if (TLVError != CHIP_NO_ERROR)
2101 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2102 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2105 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2106 emberAfLevelControlClusterStopCallback(optionMask, optionOverride);
2109 case ZCL_STOP_WITH_ON_OFF_COMMAND_ID: {
2110 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2111 emberAfLevelControlClusterStopWithOnOffCallback();
2115 // Unrecognized command ID, error status will apply.
2116 // TODO: Encode response for command not found
2117 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_LEVEL_CONTROL_CLUSTER_ID);
2124 } // namespace LevelControl
2126 namespace LowPower {
2128 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
2133 case ZCL_SLEEP_COMMAND_ID: {
2134 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2135 emberAfLowPowerClusterSleepCallback();
2139 // Unrecognized command ID, error status will apply.
2140 // TODO: Encode response for command not found
2141 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_LOW_POWER_CLUSTER_ID);
2148 } // namespace LowPower
2150 namespace MediaPlayback {
2152 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
2157 case ZCL_FAST_FORWARD_REQUEST_COMMAND_ID: {
2158 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2159 emberAfMediaPlaybackClusterFastForwardRequestCallback();
2162 case ZCL_NEXT_REQUEST_COMMAND_ID: {
2163 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2164 emberAfMediaPlaybackClusterNextRequestCallback();
2167 case ZCL_PAUSE_REQUEST_COMMAND_ID: {
2168 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2169 emberAfMediaPlaybackClusterPauseRequestCallback();
2172 case ZCL_PLAY_REQUEST_COMMAND_ID: {
2173 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2174 emberAfMediaPlaybackClusterPlayRequestCallback();
2177 case ZCL_PREVIOUS_REQUEST_COMMAND_ID: {
2178 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2179 emberAfMediaPlaybackClusterPreviousRequestCallback();
2182 case ZCL_REWIND_REQUEST_COMMAND_ID: {
2183 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2184 emberAfMediaPlaybackClusterRewindRequestCallback();
2187 case ZCL_SKIP_BACKWARD_REQUEST_COMMAND_ID: {
2188 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2189 emberAfMediaPlaybackClusterSkipBackwardRequestCallback();
2192 case ZCL_SKIP_FORWARD_REQUEST_COMMAND_ID: {
2193 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2194 emberAfMediaPlaybackClusterSkipForwardRequestCallback();
2197 case ZCL_START_OVER_REQUEST_COMMAND_ID: {
2198 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2199 emberAfMediaPlaybackClusterStartOverRequestCallback();
2202 case ZCL_STOP_REQUEST_COMMAND_ID: {
2203 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2204 emberAfMediaPlaybackClusterStopRequestCallback();
2208 // Unrecognized command ID, error status will apply.
2209 // TODO: Encode response for command not found
2210 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_MEDIA_PLAYBACK_CLUSTER_ID);
2217 } // namespace MediaPlayback
2221 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
2226 case ZCL_OFF_COMMAND_ID: {
2227 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2228 emberAfOnOffClusterOffCallback();
2231 case ZCL_ON_COMMAND_ID: {
2232 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2233 emberAfOnOffClusterOnCallback();
2236 case ZCL_TOGGLE_COMMAND_ID: {
2237 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2238 emberAfOnOffClusterToggleCallback();
2242 // Unrecognized command ID, error status will apply.
2243 // TODO: Encode response for command not found
2244 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_ON_OFF_CLUSTER_ID);
2251 } // namespace OnOff
2255 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
2260 case ZCL_ADD_SCENE_COMMAND_ID: {
2261 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2264 uint16_t transitionTime;
2265 const uint8_t * sceneName;
2266 /* TYPE WARNING: array array defaults to */ uint8_t * extensionFieldSets;
2268 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2270 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2273 TLVError = dataTlv.Get(groupId);
2276 TLVError = dataTlv.Get(sceneId);
2279 TLVError = dataTlv.Get(transitionTime);
2282 TLVError = dataTlv.GetDataPtr(sceneName);
2285 // Just for compatibility, we will add array type support in IM later.
2286 TLVError = dataTlv.GetDataPtr(const_cast<const uint8_t *&>(extensionFieldSets));
2289 // Unsupported tag, ignore it.
2290 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2293 if (TLVError != CHIP_NO_ERROR)
2295 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2296 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2299 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2300 emberAfScenesClusterAddSceneCallback(groupId, sceneId, transitionTime, const_cast<uint8_t *>(sceneName),
2301 extensionFieldSets);
2304 case ZCL_GET_SCENE_MEMBERSHIP_COMMAND_ID: {
2305 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2308 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2310 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2313 TLVError = dataTlv.Get(groupId);
2316 // Unsupported tag, ignore it.
2317 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2320 if (TLVError != CHIP_NO_ERROR)
2322 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2323 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2326 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2327 emberAfScenesClusterGetSceneMembershipCallback(groupId);
2330 case ZCL_RECALL_SCENE_COMMAND_ID: {
2331 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2334 uint16_t transitionTime;
2336 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2338 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2341 TLVError = dataTlv.Get(groupId);
2344 TLVError = dataTlv.Get(sceneId);
2347 TLVError = dataTlv.Get(transitionTime);
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 emberAfScenesClusterRecallSceneCallback(groupId, sceneId, transitionTime);
2364 case ZCL_REMOVE_ALL_SCENES_COMMAND_ID: {
2365 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2368 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2370 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2373 TLVError = dataTlv.Get(groupId);
2376 // Unsupported tag, ignore it.
2377 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2380 if (TLVError != CHIP_NO_ERROR)
2382 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2383 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2386 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2387 emberAfScenesClusterRemoveAllScenesCallback(groupId);
2390 case ZCL_REMOVE_SCENE_COMMAND_ID: {
2391 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2395 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2397 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2400 TLVError = dataTlv.Get(groupId);
2403 TLVError = dataTlv.Get(sceneId);
2406 // Unsupported tag, ignore it.
2407 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2410 if (TLVError != CHIP_NO_ERROR)
2412 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2413 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2416 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2417 emberAfScenesClusterRemoveSceneCallback(groupId, sceneId);
2420 case ZCL_STORE_SCENE_COMMAND_ID: {
2421 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2425 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2427 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2430 TLVError = dataTlv.Get(groupId);
2433 TLVError = dataTlv.Get(sceneId);
2436 // Unsupported tag, ignore it.
2437 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2440 if (TLVError != CHIP_NO_ERROR)
2442 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2443 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2446 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2447 emberAfScenesClusterStoreSceneCallback(groupId, sceneId);
2450 case ZCL_VIEW_SCENE_COMMAND_ID: {
2451 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2455 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2457 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2460 TLVError = dataTlv.Get(groupId);
2463 TLVError = dataTlv.Get(sceneId);
2466 // Unsupported tag, ignore it.
2467 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2470 if (TLVError != CHIP_NO_ERROR)
2472 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2473 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2476 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2477 emberAfScenesClusterViewSceneCallback(groupId, sceneId);
2481 // Unrecognized command ID, error status will apply.
2482 // TODO: Encode response for command not found
2483 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_SCENES_CLUSTER_ID);
2490 } // namespace Scenes
2492 } // namespace clusters
2494 void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aCommandId, chip::EndpointId aEndPointId,
2495 chip::TLV::TLVReader & aReader, Command * apCommandObj)
2497 ChipLogDetail(Zcl, "Received Cluster Command: Cluster=%" PRIx16 " Command=%" PRIx8 " Endpoint=%" PRIx8, aClusterId, aCommandId,
2499 Compatibility::SetupEmberAfObjects(apCommandObj, aClusterId, aCommandId, aEndPointId);
2502 case ZCL_BARRIER_CONTROL_CLUSTER_ID:
2503 clusters::BarrierControl::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2505 case ZCL_BASIC_CLUSTER_ID:
2506 clusters::Basic::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2508 case ZCL_BINDING_CLUSTER_ID:
2509 clusters::Binding::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2511 case ZCL_COLOR_CONTROL_CLUSTER_ID:
2512 clusters::ColorControl::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2514 case ZCL_CONTENT_LAUNCH_CLUSTER_ID:
2515 clusters::ContentLaunch::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2517 case ZCL_DOOR_LOCK_CLUSTER_ID:
2518 clusters::DoorLock::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2520 case ZCL_GENERAL_COMMISSIONING_CLUSTER_ID:
2521 clusters::GeneralCommissioning::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2523 case ZCL_GROUPS_CLUSTER_ID:
2524 clusters::Groups::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2526 case ZCL_IAS_ZONE_CLUSTER_ID:
2527 clusters::IasZone::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2529 case ZCL_IDENTIFY_CLUSTER_ID:
2530 clusters::Identify::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2532 case ZCL_LEVEL_CONTROL_CLUSTER_ID:
2533 clusters::LevelControl::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2535 case ZCL_LOW_POWER_CLUSTER_ID:
2536 clusters::LowPower::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2538 case ZCL_MEDIA_PLAYBACK_CLUSTER_ID:
2539 clusters::MediaPlayback::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2541 case ZCL_ON_OFF_CLUSTER_ID:
2542 clusters::OnOff::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2544 case ZCL_SCENES_CLUSTER_ID:
2545 clusters::Scenes::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2548 // Unrecognized cluster ID, error status will apply.
2549 // TODO: Encode response for Cluster not found
2550 ChipLogError(Zcl, "Unknown cluster %" PRIx16, aClusterId);
2553 Compatibility::ResetEmberAfObjects();