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 "app/util/util.h"
25 #include "call-command-handler.h"
27 #include "cluster-id.h"
28 #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
92 namespace ColorControl {
94 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
99 case ZCL_MOVE_COLOR_COMMAND_ID: {
100 CHIP_ERROR TLVError = CHIP_NO_ERROR;
104 uint8_t optionsOverride;
106 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
108 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
111 TLVError = dataTlv.Get(rateX);
114 TLVError = dataTlv.Get(rateY);
117 TLVError = dataTlv.Get(optionsMask);
120 TLVError = dataTlv.Get(optionsOverride);
123 // Unsupported tag, ignore it.
124 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
127 if (TLVError != CHIP_NO_ERROR)
129 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
130 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
133 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
134 emberAfColorControlClusterMoveColorCallback(rateX, rateY, optionsMask, optionsOverride);
137 case ZCL_MOVE_COLOR_TEMPERATURE_COMMAND_ID: {
138 CHIP_ERROR TLVError = CHIP_NO_ERROR;
141 uint16_t colorTemperatureMinimum;
142 uint16_t colorTemperatureMaximum;
144 uint8_t optionsOverride;
146 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
148 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
151 TLVError = dataTlv.Get(moveMode);
154 TLVError = dataTlv.Get(rate);
157 TLVError = dataTlv.Get(colorTemperatureMinimum);
160 TLVError = dataTlv.Get(colorTemperatureMaximum);
163 TLVError = dataTlv.Get(optionsMask);
166 TLVError = dataTlv.Get(optionsOverride);
169 // Unsupported tag, ignore it.
170 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
173 if (TLVError != CHIP_NO_ERROR)
175 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
176 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
179 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
180 emberAfColorControlClusterMoveColorTemperatureCallback(moveMode, rate, colorTemperatureMinimum, colorTemperatureMaximum,
181 optionsMask, optionsOverride);
184 case ZCL_MOVE_HUE_COMMAND_ID: {
185 CHIP_ERROR TLVError = CHIP_NO_ERROR;
189 uint8_t optionsOverride;
191 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
193 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
196 TLVError = dataTlv.Get(moveMode);
199 TLVError = dataTlv.Get(rate);
202 TLVError = dataTlv.Get(optionsMask);
205 TLVError = dataTlv.Get(optionsOverride);
208 // Unsupported tag, ignore it.
209 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
212 if (TLVError != CHIP_NO_ERROR)
214 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
215 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
218 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
219 emberAfColorControlClusterMoveHueCallback(moveMode, rate, optionsMask, optionsOverride);
222 case ZCL_MOVE_SATURATION_COMMAND_ID: {
223 CHIP_ERROR TLVError = CHIP_NO_ERROR;
227 uint8_t optionsOverride;
229 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
231 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
234 TLVError = dataTlv.Get(moveMode);
237 TLVError = dataTlv.Get(rate);
240 TLVError = dataTlv.Get(optionsMask);
243 TLVError = dataTlv.Get(optionsOverride);
246 // Unsupported tag, ignore it.
247 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
250 if (TLVError != CHIP_NO_ERROR)
252 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
253 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
256 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
257 emberAfColorControlClusterMoveSaturationCallback(moveMode, rate, optionsMask, optionsOverride);
260 case ZCL_MOVE_TO_COLOR_COMMAND_ID: {
261 CHIP_ERROR TLVError = CHIP_NO_ERROR;
264 uint16_t transitionTime;
266 uint8_t optionsOverride;
268 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
270 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
273 TLVError = dataTlv.Get(colorX);
276 TLVError = dataTlv.Get(colorY);
279 TLVError = dataTlv.Get(transitionTime);
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 emberAfColorControlClusterMoveToColorCallback(colorX, colorY, transitionTime, optionsMask, optionsOverride);
302 case ZCL_MOVE_TO_COLOR_TEMPERATURE_COMMAND_ID: {
303 CHIP_ERROR TLVError = CHIP_NO_ERROR;
304 uint16_t colorTemperature;
305 uint16_t transitionTime;
307 uint8_t optionsOverride;
309 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
311 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
314 TLVError = dataTlv.Get(colorTemperature);
317 TLVError = dataTlv.Get(transitionTime);
320 TLVError = dataTlv.Get(optionsMask);
323 TLVError = dataTlv.Get(optionsOverride);
326 // Unsupported tag, ignore it.
327 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
330 if (TLVError != CHIP_NO_ERROR)
332 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
333 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
336 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
337 emberAfColorControlClusterMoveToColorTemperatureCallback(colorTemperature, transitionTime, optionsMask,
341 case ZCL_MOVE_TO_HUE_COMMAND_ID: {
342 CHIP_ERROR TLVError = CHIP_NO_ERROR;
345 uint16_t transitionTime;
347 uint8_t optionsOverride;
349 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
351 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
354 TLVError = dataTlv.Get(hue);
357 TLVError = dataTlv.Get(direction);
360 TLVError = dataTlv.Get(transitionTime);
363 TLVError = dataTlv.Get(optionsMask);
366 TLVError = dataTlv.Get(optionsOverride);
369 // Unsupported tag, ignore it.
370 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
373 if (TLVError != CHIP_NO_ERROR)
375 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
376 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
379 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
380 emberAfColorControlClusterMoveToHueCallback(hue, direction, transitionTime, optionsMask, optionsOverride);
383 case ZCL_MOVE_TO_HUE_AND_SATURATION_COMMAND_ID: {
384 CHIP_ERROR TLVError = CHIP_NO_ERROR;
387 uint16_t transitionTime;
389 uint8_t optionsOverride;
391 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
393 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
396 TLVError = dataTlv.Get(hue);
399 TLVError = dataTlv.Get(saturation);
402 TLVError = dataTlv.Get(transitionTime);
405 TLVError = dataTlv.Get(optionsMask);
408 TLVError = dataTlv.Get(optionsOverride);
411 // Unsupported tag, ignore it.
412 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
415 if (TLVError != CHIP_NO_ERROR)
417 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
418 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
421 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
422 emberAfColorControlClusterMoveToHueAndSaturationCallback(hue, saturation, transitionTime, optionsMask, optionsOverride);
425 case ZCL_MOVE_TO_SATURATION_COMMAND_ID: {
426 CHIP_ERROR TLVError = CHIP_NO_ERROR;
428 uint16_t transitionTime;
430 uint8_t optionsOverride;
432 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
434 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
437 TLVError = dataTlv.Get(saturation);
440 TLVError = dataTlv.Get(transitionTime);
443 TLVError = dataTlv.Get(optionsMask);
446 TLVError = dataTlv.Get(optionsOverride);
449 // Unsupported tag, ignore it.
450 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
453 if (TLVError != CHIP_NO_ERROR)
455 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
456 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
459 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
460 emberAfColorControlClusterMoveToSaturationCallback(saturation, transitionTime, optionsMask, optionsOverride);
463 case ZCL_STEP_COLOR_COMMAND_ID: {
464 CHIP_ERROR TLVError = CHIP_NO_ERROR;
467 uint16_t transitionTime;
469 uint8_t optionsOverride;
471 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
473 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
476 TLVError = dataTlv.Get(stepX);
479 TLVError = dataTlv.Get(stepY);
482 TLVError = dataTlv.Get(transitionTime);
485 TLVError = dataTlv.Get(optionsMask);
488 TLVError = dataTlv.Get(optionsOverride);
491 // Unsupported tag, ignore it.
492 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
495 if (TLVError != CHIP_NO_ERROR)
497 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
498 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
501 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
502 emberAfColorControlClusterStepColorCallback(stepX, stepY, transitionTime, optionsMask, optionsOverride);
505 case ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID: {
506 CHIP_ERROR TLVError = CHIP_NO_ERROR;
509 uint16_t transitionTime;
510 uint16_t colorTemperatureMinimum;
511 uint16_t colorTemperatureMaximum;
513 uint8_t optionsOverride;
515 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
517 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
520 TLVError = dataTlv.Get(stepMode);
523 TLVError = dataTlv.Get(stepSize);
526 TLVError = dataTlv.Get(transitionTime);
529 TLVError = dataTlv.Get(colorTemperatureMinimum);
532 TLVError = dataTlv.Get(colorTemperatureMaximum);
535 TLVError = dataTlv.Get(optionsMask);
538 TLVError = dataTlv.Get(optionsOverride);
541 // Unsupported tag, ignore it.
542 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
545 if (TLVError != CHIP_NO_ERROR)
547 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
548 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
551 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
552 emberAfColorControlClusterStepColorTemperatureCallback(stepMode, stepSize, transitionTime, colorTemperatureMinimum,
553 colorTemperatureMaximum, optionsMask, optionsOverride);
556 case ZCL_STEP_HUE_COMMAND_ID: {
557 CHIP_ERROR TLVError = CHIP_NO_ERROR;
560 uint8_t transitionTime;
562 uint8_t optionsOverride;
564 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
566 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
569 TLVError = dataTlv.Get(stepMode);
572 TLVError = dataTlv.Get(stepSize);
575 TLVError = dataTlv.Get(transitionTime);
578 TLVError = dataTlv.Get(optionsMask);
581 TLVError = dataTlv.Get(optionsOverride);
584 // Unsupported tag, ignore it.
585 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
588 if (TLVError != CHIP_NO_ERROR)
590 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
591 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
594 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
595 emberAfColorControlClusterStepHueCallback(stepMode, stepSize, transitionTime, optionsMask, optionsOverride);
598 case ZCL_STEP_SATURATION_COMMAND_ID: {
599 CHIP_ERROR TLVError = CHIP_NO_ERROR;
602 uint8_t transitionTime;
604 uint8_t optionsOverride;
606 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
608 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
611 TLVError = dataTlv.Get(stepMode);
614 TLVError = dataTlv.Get(stepSize);
617 TLVError = dataTlv.Get(transitionTime);
620 TLVError = dataTlv.Get(optionsMask);
623 TLVError = dataTlv.Get(optionsOverride);
626 // Unsupported tag, ignore it.
627 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
630 if (TLVError != CHIP_NO_ERROR)
632 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
633 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
636 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
637 emberAfColorControlClusterStepSaturationCallback(stepMode, stepSize, transitionTime, optionsMask, optionsOverride);
640 case ZCL_STOP_MOVE_STEP_COMMAND_ID: {
641 CHIP_ERROR TLVError = CHIP_NO_ERROR;
643 uint8_t optionsOverride;
645 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
647 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
650 TLVError = dataTlv.Get(optionsMask);
653 TLVError = dataTlv.Get(optionsOverride);
656 // Unsupported tag, ignore it.
657 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
660 if (TLVError != CHIP_NO_ERROR)
662 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
663 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
666 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
667 emberAfColorControlClusterStopMoveStepCallback(optionsMask, optionsOverride);
671 // Unrecognized command ID, error status will apply.
672 // TODO: Encode response for command not found
673 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_COLOR_CONTROL_CLUSTER_ID);
680 } // namespace ColorControl
684 void DispatchClientCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
689 case ZCL_LOCK_DOOR_RESPONSE_COMMAND_ID: {
690 CHIP_ERROR TLVError = CHIP_NO_ERROR;
693 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
695 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
698 TLVError = dataTlv.Get(status);
701 // Unsupported tag, ignore it.
702 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
705 if (TLVError != CHIP_NO_ERROR)
707 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
708 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
711 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
712 emberAfDoorLockClusterLockDoorResponseCallback(status);
715 case ZCL_UNLOCK_DOOR_RESPONSE_COMMAND_ID: {
716 CHIP_ERROR TLVError = CHIP_NO_ERROR;
719 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
721 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
724 TLVError = dataTlv.Get(status);
727 // Unsupported tag, ignore it.
728 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
731 if (TLVError != CHIP_NO_ERROR)
733 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
734 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
737 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
738 emberAfDoorLockClusterUnlockDoorResponseCallback(status);
742 // Unrecognized command ID, error status will apply.
743 // TODO: Encode response for command not found
744 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_DOOR_LOCK_CLUSTER_ID);
751 } // namespace DoorLock
755 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
760 case ZCL_CLEAR_ALL_PINS_COMMAND_ID: {
761 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
762 emberAfDoorLockClusterClearAllPinsCallback();
765 case ZCL_CLEAR_ALL_RFIDS_COMMAND_ID: {
766 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
767 emberAfDoorLockClusterClearAllRfidsCallback();
770 case ZCL_CLEAR_HOLIDAY_SCHEDULE_COMMAND_ID: {
771 CHIP_ERROR TLVError = CHIP_NO_ERROR;
774 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
776 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
779 TLVError = dataTlv.Get(scheduleId);
782 // Unsupported tag, ignore it.
783 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
786 if (TLVError != CHIP_NO_ERROR)
788 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
789 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
792 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
793 emberAfDoorLockClusterClearHolidayScheduleCallback(scheduleId);
796 case ZCL_CLEAR_PIN_COMMAND_ID: {
797 CHIP_ERROR TLVError = CHIP_NO_ERROR;
800 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
802 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
805 TLVError = dataTlv.Get(userId);
808 // Unsupported tag, ignore it.
809 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
812 if (TLVError != CHIP_NO_ERROR)
814 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
815 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
818 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
819 emberAfDoorLockClusterClearPinCallback(userId);
822 case ZCL_CLEAR_RFID_COMMAND_ID: {
823 CHIP_ERROR TLVError = CHIP_NO_ERROR;
826 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
828 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
831 TLVError = dataTlv.Get(userId);
834 // Unsupported tag, ignore it.
835 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
838 if (TLVError != CHIP_NO_ERROR)
840 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
841 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
844 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
845 emberAfDoorLockClusterClearRfidCallback(userId);
848 case ZCL_CLEAR_WEEKDAY_SCHEDULE_COMMAND_ID: {
849 CHIP_ERROR TLVError = CHIP_NO_ERROR;
853 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
855 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
858 TLVError = dataTlv.Get(scheduleId);
861 TLVError = dataTlv.Get(userId);
864 // Unsupported tag, ignore it.
865 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
868 if (TLVError != CHIP_NO_ERROR)
870 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
871 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
874 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
875 emberAfDoorLockClusterClearWeekdayScheduleCallback(scheduleId, userId);
878 case ZCL_CLEAR_YEARDAY_SCHEDULE_COMMAND_ID: {
879 CHIP_ERROR TLVError = CHIP_NO_ERROR;
883 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
885 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
888 TLVError = dataTlv.Get(scheduleId);
891 TLVError = dataTlv.Get(userId);
894 // Unsupported tag, ignore it.
895 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
898 if (TLVError != CHIP_NO_ERROR)
900 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
901 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
904 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
905 emberAfDoorLockClusterClearYeardayScheduleCallback(scheduleId, userId);
908 case ZCL_GET_HOLIDAY_SCHEDULE_COMMAND_ID: {
909 CHIP_ERROR TLVError = CHIP_NO_ERROR;
912 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
914 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
917 TLVError = dataTlv.Get(scheduleId);
920 // Unsupported tag, ignore it.
921 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
924 if (TLVError != CHIP_NO_ERROR)
926 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
927 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
930 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
931 emberAfDoorLockClusterGetHolidayScheduleCallback(scheduleId);
934 case ZCL_GET_LOG_RECORD_COMMAND_ID: {
935 CHIP_ERROR TLVError = CHIP_NO_ERROR;
938 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
940 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
943 TLVError = dataTlv.Get(logIndex);
946 // Unsupported tag, ignore it.
947 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
950 if (TLVError != CHIP_NO_ERROR)
952 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
953 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
956 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
957 emberAfDoorLockClusterGetLogRecordCallback(logIndex);
960 case ZCL_GET_PIN_COMMAND_ID: {
961 CHIP_ERROR TLVError = CHIP_NO_ERROR;
964 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
966 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
969 TLVError = dataTlv.Get(userId);
972 // Unsupported tag, ignore it.
973 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
976 if (TLVError != CHIP_NO_ERROR)
978 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
979 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
982 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
983 emberAfDoorLockClusterGetPinCallback(userId);
986 case ZCL_GET_RFID_COMMAND_ID: {
987 CHIP_ERROR TLVError = CHIP_NO_ERROR;
990 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
992 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
995 TLVError = dataTlv.Get(userId);
998 // Unsupported tag, ignore it.
999 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1002 if (TLVError != CHIP_NO_ERROR)
1004 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1005 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1008 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1009 emberAfDoorLockClusterGetRfidCallback(userId);
1012 case ZCL_GET_USER_TYPE_COMMAND_ID: {
1013 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1016 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1018 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1021 TLVError = dataTlv.Get(userId);
1024 // Unsupported tag, ignore it.
1025 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1028 if (TLVError != CHIP_NO_ERROR)
1030 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1031 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1034 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1035 emberAfDoorLockClusterGetUserTypeCallback(userId);
1038 case ZCL_GET_WEEKDAY_SCHEDULE_COMMAND_ID: {
1039 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1043 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1045 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1048 TLVError = dataTlv.Get(scheduleId);
1051 TLVError = dataTlv.Get(userId);
1054 // Unsupported tag, ignore it.
1055 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1058 if (TLVError != CHIP_NO_ERROR)
1060 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1061 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1064 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1065 emberAfDoorLockClusterGetWeekdayScheduleCallback(scheduleId, userId);
1068 case ZCL_GET_YEARDAY_SCHEDULE_COMMAND_ID: {
1069 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1073 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1075 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1078 TLVError = dataTlv.Get(scheduleId);
1081 TLVError = dataTlv.Get(userId);
1084 // Unsupported tag, ignore it.
1085 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1088 if (TLVError != CHIP_NO_ERROR)
1090 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1091 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1094 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1095 emberAfDoorLockClusterGetYeardayScheduleCallback(scheduleId, userId);
1098 case ZCL_LOCK_DOOR_COMMAND_ID: {
1099 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1100 const uint8_t * PIN;
1102 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1104 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1107 TLVError = dataTlv.GetDataPtr(PIN);
1110 // Unsupported tag, ignore it.
1111 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1114 if (TLVError != CHIP_NO_ERROR)
1116 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1117 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1120 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1121 emberAfDoorLockClusterLockDoorCallback(const_cast<uint8_t *>(PIN));
1124 case ZCL_SET_HOLIDAY_SCHEDULE_COMMAND_ID: {
1125 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1127 uint32_t localStartTime;
1128 uint32_t localEndTime;
1129 uint8_t operatingModeDuringHoliday;
1131 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1133 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1136 TLVError = dataTlv.Get(scheduleId);
1139 TLVError = dataTlv.Get(localStartTime);
1142 TLVError = dataTlv.Get(localEndTime);
1145 TLVError = dataTlv.Get(operatingModeDuringHoliday);
1148 // Unsupported tag, ignore it.
1149 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1152 if (TLVError != CHIP_NO_ERROR)
1154 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1155 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1158 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1159 emberAfDoorLockClusterSetHolidayScheduleCallback(scheduleId, localStartTime, localEndTime, operatingModeDuringHoliday);
1162 case ZCL_SET_PIN_COMMAND_ID: {
1163 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1167 const uint8_t * pin;
1169 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1171 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1174 TLVError = dataTlv.Get(userId);
1177 TLVError = dataTlv.Get(userStatus);
1180 TLVError = dataTlv.Get(userType);
1183 TLVError = dataTlv.GetDataPtr(pin);
1186 // Unsupported tag, ignore it.
1187 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1190 if (TLVError != CHIP_NO_ERROR)
1192 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1193 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1196 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1197 emberAfDoorLockClusterSetPinCallback(userId, userStatus, userType, const_cast<uint8_t *>(pin));
1200 case ZCL_SET_RFID_COMMAND_ID: {
1201 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1207 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1209 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1212 TLVError = dataTlv.Get(userId);
1215 TLVError = dataTlv.Get(userStatus);
1218 TLVError = dataTlv.Get(userType);
1221 TLVError = dataTlv.GetDataPtr(id);
1224 // Unsupported tag, ignore it.
1225 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1228 if (TLVError != CHIP_NO_ERROR)
1230 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1231 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1234 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1235 emberAfDoorLockClusterSetRfidCallback(userId, userStatus, userType, const_cast<uint8_t *>(id));
1238 case ZCL_SET_USER_TYPE_COMMAND_ID: {
1239 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1243 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1245 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1248 TLVError = dataTlv.Get(userId);
1251 TLVError = dataTlv.Get(userType);
1254 // Unsupported tag, ignore it.
1255 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1258 if (TLVError != CHIP_NO_ERROR)
1260 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1261 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1264 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1265 emberAfDoorLockClusterSetUserTypeCallback(userId, userType);
1268 case ZCL_SET_WEEKDAY_SCHEDULE_COMMAND_ID: {
1269 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1274 uint8_t startMinute;
1278 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1280 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1283 TLVError = dataTlv.Get(scheduleId);
1286 TLVError = dataTlv.Get(userId);
1289 TLVError = dataTlv.Get(daysMask);
1292 TLVError = dataTlv.Get(startHour);
1295 TLVError = dataTlv.Get(startMinute);
1298 TLVError = dataTlv.Get(endHour);
1301 TLVError = dataTlv.Get(endMinute);
1304 // Unsupported tag, ignore it.
1305 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1308 if (TLVError != CHIP_NO_ERROR)
1310 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1311 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1314 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1315 emberAfDoorLockClusterSetWeekdayScheduleCallback(scheduleId, userId, daysMask, startHour, startMinute, endHour,
1319 case ZCL_SET_YEARDAY_SCHEDULE_COMMAND_ID: {
1320 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1323 uint32_t localStartTime;
1324 uint32_t localEndTime;
1326 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1328 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1331 TLVError = dataTlv.Get(scheduleId);
1334 TLVError = dataTlv.Get(userId);
1337 TLVError = dataTlv.Get(localStartTime);
1340 TLVError = dataTlv.Get(localEndTime);
1343 // Unsupported tag, ignore it.
1344 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1347 if (TLVError != CHIP_NO_ERROR)
1349 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1350 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1353 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1354 emberAfDoorLockClusterSetYeardayScheduleCallback(scheduleId, userId, localStartTime, localEndTime);
1357 case ZCL_UNLOCK_DOOR_COMMAND_ID: {
1358 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1359 const uint8_t * PIN;
1361 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1363 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1366 TLVError = dataTlv.GetDataPtr(PIN);
1369 // Unsupported tag, ignore it.
1370 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1373 if (TLVError != CHIP_NO_ERROR)
1375 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1376 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1379 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1380 emberAfDoorLockClusterUnlockDoorCallback(const_cast<uint8_t *>(PIN));
1383 case ZCL_UNLOCK_WITH_TIMEOUT_COMMAND_ID: {
1384 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1385 uint16_t timeoutInSeconds;
1386 const uint8_t * pin;
1388 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1390 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1393 TLVError = dataTlv.Get(timeoutInSeconds);
1396 TLVError = dataTlv.GetDataPtr(pin);
1399 // Unsupported tag, ignore it.
1400 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1403 if (TLVError != CHIP_NO_ERROR)
1405 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1406 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1409 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1410 emberAfDoorLockClusterUnlockWithTimeoutCallback(timeoutInSeconds, const_cast<uint8_t *>(pin));
1414 // Unrecognized command ID, error status will apply.
1415 // TODO: Encode response for command not found
1416 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_DOOR_LOCK_CLUSTER_ID);
1423 } // namespace DoorLock
1427 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
1432 case ZCL_ADD_GROUP_COMMAND_ID: {
1433 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1435 const uint8_t * groupName;
1437 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1439 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1442 TLVError = dataTlv.Get(groupId);
1445 TLVError = dataTlv.GetDataPtr(groupName);
1448 // Unsupported tag, ignore it.
1449 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1452 if (TLVError != CHIP_NO_ERROR)
1454 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1455 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1458 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1459 emberAfGroupsClusterAddGroupCallback(groupId, const_cast<uint8_t *>(groupName));
1462 case ZCL_ADD_GROUP_IF_IDENTIFYING_COMMAND_ID: {
1463 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1465 const uint8_t * groupName;
1467 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1469 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1472 TLVError = dataTlv.Get(groupId);
1475 TLVError = dataTlv.GetDataPtr(groupName);
1478 // Unsupported tag, ignore it.
1479 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1482 if (TLVError != CHIP_NO_ERROR)
1484 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1485 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1488 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1489 emberAfGroupsClusterAddGroupIfIdentifyingCallback(groupId, const_cast<uint8_t *>(groupName));
1492 case ZCL_GET_GROUP_MEMBERSHIP_COMMAND_ID: {
1493 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1495 /* TYPE WARNING: array array defaults to */ uint8_t * groupList;
1497 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1499 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1502 TLVError = dataTlv.Get(groupCount);
1505 // Just for compatibility, we will add array type support in IM later.
1506 TLVError = dataTlv.GetDataPtr(const_cast<const uint8_t *&>(groupList));
1509 // Unsupported tag, ignore it.
1510 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1513 if (TLVError != CHIP_NO_ERROR)
1515 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1516 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1519 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1520 emberAfGroupsClusterGetGroupMembershipCallback(groupCount, groupList);
1523 case ZCL_REMOVE_ALL_GROUPS_COMMAND_ID: {
1524 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1525 emberAfGroupsClusterRemoveAllGroupsCallback();
1528 case ZCL_REMOVE_GROUP_COMMAND_ID: {
1529 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1532 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1534 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1537 TLVError = dataTlv.Get(groupId);
1540 // Unsupported tag, ignore it.
1541 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1544 if (TLVError != CHIP_NO_ERROR)
1546 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1547 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1550 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1551 emberAfGroupsClusterRemoveGroupCallback(groupId);
1554 case ZCL_VIEW_GROUP_COMMAND_ID: {
1555 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1558 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1560 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1563 TLVError = dataTlv.Get(groupId);
1566 // Unsupported tag, ignore it.
1567 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1570 if (TLVError != CHIP_NO_ERROR)
1572 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1573 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1576 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1577 emberAfGroupsClusterViewGroupCallback(groupId);
1581 // Unrecognized command ID, error status will apply.
1582 // TODO: Encode response for command not found
1583 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_GROUPS_CLUSTER_ID);
1590 } // namespace Groups
1594 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
1599 case ZCL_ZONE_ENROLL_RESPONSE_COMMAND_ID: {
1600 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1601 uint8_t enrollResponseCode;
1604 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1606 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1609 TLVError = dataTlv.Get(enrollResponseCode);
1612 TLVError = dataTlv.Get(zoneId);
1615 // Unsupported tag, ignore it.
1616 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1619 if (TLVError != CHIP_NO_ERROR)
1621 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1622 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1625 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1626 emberAfIasZoneClusterZoneEnrollResponseCallback(enrollResponseCode, zoneId);
1630 // Unrecognized command ID, error status will apply.
1631 // TODO: Encode response for command not found
1632 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_IAS_ZONE_CLUSTER_ID);
1639 } // namespace IasZone
1641 namespace Identify {
1643 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
1648 case ZCL_IDENTIFY_COMMAND_ID: {
1649 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1650 uint16_t identifyTime;
1652 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1654 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1657 TLVError = dataTlv.Get(identifyTime);
1660 // Unsupported tag, ignore it.
1661 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1664 if (TLVError != CHIP_NO_ERROR)
1666 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1667 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1670 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1671 emberAfIdentifyClusterIdentifyCallback(identifyTime);
1674 case ZCL_IDENTIFY_QUERY_COMMAND_ID: {
1675 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1676 emberAfIdentifyClusterIdentifyQueryCallback();
1680 // Unrecognized command ID, error status will apply.
1681 // TODO: Encode response for command not found
1682 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_IDENTIFY_CLUSTER_ID);
1689 } // namespace Identify
1691 namespace LevelControl {
1693 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
1698 case ZCL_MOVE_COMMAND_ID: {
1699 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1703 uint8_t optionOverride;
1705 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1707 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1710 TLVError = dataTlv.Get(moveMode);
1713 TLVError = dataTlv.Get(rate);
1716 TLVError = dataTlv.Get(optionMask);
1719 TLVError = dataTlv.Get(optionOverride);
1722 // Unsupported tag, ignore it.
1723 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1726 if (TLVError != CHIP_NO_ERROR)
1728 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1729 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1732 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1733 emberAfLevelControlClusterMoveCallback(moveMode, rate, optionMask, optionOverride);
1736 case ZCL_MOVE_TO_LEVEL_COMMAND_ID: {
1737 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1739 uint16_t transitionTime;
1741 uint8_t optionOverride;
1743 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1745 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1748 TLVError = dataTlv.Get(level);
1751 TLVError = dataTlv.Get(transitionTime);
1754 TLVError = dataTlv.Get(optionMask);
1757 TLVError = dataTlv.Get(optionOverride);
1760 // Unsupported tag, ignore it.
1761 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1764 if (TLVError != CHIP_NO_ERROR)
1766 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1767 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1770 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1771 emberAfLevelControlClusterMoveToLevelCallback(level, transitionTime, optionMask, optionOverride);
1774 case ZCL_MOVE_TO_LEVEL_WITH_ON_OFF_COMMAND_ID: {
1775 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1777 uint16_t transitionTime;
1779 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1781 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1784 TLVError = dataTlv.Get(level);
1787 TLVError = dataTlv.Get(transitionTime);
1790 // Unsupported tag, ignore it.
1791 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1794 if (TLVError != CHIP_NO_ERROR)
1796 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1797 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1800 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1801 emberAfLevelControlClusterMoveToLevelWithOnOffCallback(level, transitionTime);
1804 case ZCL_MOVE_WITH_ON_OFF_COMMAND_ID: {
1805 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1809 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1811 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1814 TLVError = dataTlv.Get(moveMode);
1817 TLVError = dataTlv.Get(rate);
1820 // Unsupported tag, ignore it.
1821 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1824 if (TLVError != CHIP_NO_ERROR)
1826 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1827 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1830 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1831 emberAfLevelControlClusterMoveWithOnOffCallback(moveMode, rate);
1834 case ZCL_STEP_COMMAND_ID: {
1835 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1838 uint16_t transitionTime;
1840 uint8_t optionOverride;
1842 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1844 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1847 TLVError = dataTlv.Get(stepMode);
1850 TLVError = dataTlv.Get(stepSize);
1853 TLVError = dataTlv.Get(transitionTime);
1856 TLVError = dataTlv.Get(optionMask);
1859 TLVError = dataTlv.Get(optionOverride);
1862 // Unsupported tag, ignore it.
1863 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1866 if (TLVError != CHIP_NO_ERROR)
1868 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1869 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1872 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1873 emberAfLevelControlClusterStepCallback(stepMode, stepSize, transitionTime, optionMask, optionOverride);
1876 case ZCL_STEP_WITH_ON_OFF_COMMAND_ID: {
1877 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1880 uint16_t transitionTime;
1882 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1884 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1887 TLVError = dataTlv.Get(stepMode);
1890 TLVError = dataTlv.Get(stepSize);
1893 TLVError = dataTlv.Get(transitionTime);
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 emberAfLevelControlClusterStepWithOnOffCallback(stepMode, stepSize, transitionTime);
1910 case ZCL_STOP_COMMAND_ID: {
1911 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1913 uint8_t optionOverride;
1915 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1917 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1920 TLVError = dataTlv.Get(optionMask);
1923 TLVError = dataTlv.Get(optionOverride);
1926 // Unsupported tag, ignore it.
1927 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1930 if (TLVError != CHIP_NO_ERROR)
1932 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1933 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1936 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1937 emberAfLevelControlClusterStopCallback(optionMask, optionOverride);
1940 case ZCL_STOP_WITH_ON_OFF_COMMAND_ID: {
1941 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1942 emberAfLevelControlClusterStopWithOnOffCallback();
1946 // Unrecognized command ID, error status will apply.
1947 // TODO: Encode response for command not found
1948 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_LEVEL_CONTROL_CLUSTER_ID);
1955 } // namespace LevelControl
1957 namespace LowPower {
1959 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
1964 case ZCL_SLEEP_COMMAND_ID: {
1965 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1966 emberAfLowPowerClusterSleepCallback();
1970 // Unrecognized command ID, error status will apply.
1971 // TODO: Encode response for command not found
1972 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_LOW_POWER_CLUSTER_ID);
1979 } // namespace LowPower
1981 namespace NetworkCommissioning {
1983 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
1988 case ZCL_ADD_THREAD_NETWORK_COMMAND_ID: {
1989 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1990 chip::ByteSpan operationalDataset;
1991 uint64_t breadcrumb;
1994 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1996 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1999 const uint8_t * data = nullptr;
2000 TLVError = dataTlv.GetDataPtr(data);
2001 operationalDataset = chip::ByteSpan(data, dataTlv.GetLength());
2005 TLVError = dataTlv.Get(breadcrumb);
2008 TLVError = dataTlv.Get(timeoutMs);
2011 // Unsupported tag, ignore it.
2012 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2015 if (TLVError != CHIP_NO_ERROR)
2017 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2018 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2021 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2022 emberAfNetworkCommissioningClusterAddThreadNetworkCallback(operationalDataset, breadcrumb, timeoutMs);
2025 case ZCL_ADD_WI_FI_NETWORK_COMMAND_ID: {
2026 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2027 chip::ByteSpan ssid;
2028 chip::ByteSpan credentials;
2029 uint64_t breadcrumb;
2032 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2034 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2037 const uint8_t * data = nullptr;
2038 TLVError = dataTlv.GetDataPtr(data);
2039 ssid = chip::ByteSpan(data, dataTlv.GetLength());
2043 const uint8_t * data = nullptr;
2044 TLVError = dataTlv.GetDataPtr(data);
2045 credentials = chip::ByteSpan(data, dataTlv.GetLength());
2049 TLVError = dataTlv.Get(breadcrumb);
2052 TLVError = dataTlv.Get(timeoutMs);
2055 // Unsupported tag, ignore it.
2056 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2059 if (TLVError != CHIP_NO_ERROR)
2061 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2062 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2065 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2066 emberAfNetworkCommissioningClusterAddWiFiNetworkCallback(ssid, credentials, breadcrumb, timeoutMs);
2069 case ZCL_DISABLE_NETWORK_COMMAND_ID: {
2070 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2071 chip::ByteSpan networkID;
2072 uint64_t breadcrumb;
2075 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2077 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2080 const uint8_t * data = nullptr;
2081 TLVError = dataTlv.GetDataPtr(data);
2082 networkID = chip::ByteSpan(data, dataTlv.GetLength());
2086 TLVError = dataTlv.Get(breadcrumb);
2089 TLVError = dataTlv.Get(timeoutMs);
2092 // Unsupported tag, ignore it.
2093 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2096 if (TLVError != CHIP_NO_ERROR)
2098 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2099 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2102 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2103 emberAfNetworkCommissioningClusterDisableNetworkCallback(networkID, breadcrumb, timeoutMs);
2106 case ZCL_ENABLE_NETWORK_COMMAND_ID: {
2107 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2108 chip::ByteSpan networkID;
2109 uint64_t breadcrumb;
2112 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2114 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2117 const uint8_t * data = nullptr;
2118 TLVError = dataTlv.GetDataPtr(data);
2119 networkID = chip::ByteSpan(data, dataTlv.GetLength());
2123 TLVError = dataTlv.Get(breadcrumb);
2126 TLVError = dataTlv.Get(timeoutMs);
2129 // Unsupported tag, ignore it.
2130 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2133 if (TLVError != CHIP_NO_ERROR)
2135 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2136 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2139 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2140 emberAfNetworkCommissioningClusterEnableNetworkCallback(networkID, breadcrumb, timeoutMs);
2143 case ZCL_GET_LAST_NETWORK_COMMISSIONING_RESULT_COMMAND_ID: {
2144 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2147 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2149 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2152 TLVError = dataTlv.Get(timeoutMs);
2155 // Unsupported tag, ignore it.
2156 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2159 if (TLVError != CHIP_NO_ERROR)
2161 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2162 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2165 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2166 emberAfNetworkCommissioningClusterGetLastNetworkCommissioningResultCallback(timeoutMs);
2169 case ZCL_REMOVE_NETWORK_COMMAND_ID: {
2170 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2171 chip::ByteSpan NetworkID;
2172 uint64_t Breadcrumb;
2175 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2177 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2180 const uint8_t * data = nullptr;
2181 TLVError = dataTlv.GetDataPtr(data);
2182 NetworkID = chip::ByteSpan(data, dataTlv.GetLength());
2186 TLVError = dataTlv.Get(Breadcrumb);
2189 TLVError = dataTlv.Get(TimeoutMs);
2192 // Unsupported tag, ignore it.
2193 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2196 if (TLVError != CHIP_NO_ERROR)
2198 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2199 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2202 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2203 emberAfNetworkCommissioningClusterRemoveNetworkCallback(NetworkID, Breadcrumb, TimeoutMs);
2206 case ZCL_SCAN_NETWORKS_COMMAND_ID: {
2207 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2208 chip::ByteSpan ssid;
2209 uint64_t breadcrumb;
2212 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2214 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2217 const uint8_t * data = nullptr;
2218 TLVError = dataTlv.GetDataPtr(data);
2219 ssid = chip::ByteSpan(data, dataTlv.GetLength());
2223 TLVError = dataTlv.Get(breadcrumb);
2226 TLVError = dataTlv.Get(timeoutMs);
2229 // Unsupported tag, ignore it.
2230 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2233 if (TLVError != CHIP_NO_ERROR)
2235 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2236 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2239 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2240 emberAfNetworkCommissioningClusterScanNetworksCallback(ssid, breadcrumb, timeoutMs);
2243 case ZCL_UPDATE_THREAD_NETWORK_COMMAND_ID: {
2244 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2245 chip::ByteSpan operationalDataset;
2246 uint64_t breadcrumb;
2249 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2251 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2254 const uint8_t * data = nullptr;
2255 TLVError = dataTlv.GetDataPtr(data);
2256 operationalDataset = chip::ByteSpan(data, dataTlv.GetLength());
2260 TLVError = dataTlv.Get(breadcrumb);
2263 TLVError = dataTlv.Get(timeoutMs);
2266 // Unsupported tag, ignore it.
2267 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2270 if (TLVError != CHIP_NO_ERROR)
2272 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2273 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2276 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2277 emberAfNetworkCommissioningClusterUpdateThreadNetworkCallback(operationalDataset, breadcrumb, timeoutMs);
2280 case ZCL_UPDATE_WI_FI_NETWORK_COMMAND_ID: {
2281 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2282 chip::ByteSpan ssid;
2283 chip::ByteSpan credentials;
2284 uint64_t breadcrumb;
2287 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2289 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2292 const uint8_t * data = nullptr;
2293 TLVError = dataTlv.GetDataPtr(data);
2294 ssid = chip::ByteSpan(data, dataTlv.GetLength());
2298 const uint8_t * data = nullptr;
2299 TLVError = dataTlv.GetDataPtr(data);
2300 credentials = chip::ByteSpan(data, dataTlv.GetLength());
2304 TLVError = dataTlv.Get(breadcrumb);
2307 TLVError = dataTlv.Get(timeoutMs);
2310 // Unsupported tag, ignore it.
2311 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2314 if (TLVError != CHIP_NO_ERROR)
2316 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2317 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2320 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2321 emberAfNetworkCommissioningClusterUpdateWiFiNetworkCallback(ssid, credentials, breadcrumb, timeoutMs);
2325 // Unrecognized command ID, error status will apply.
2326 // TODO: Encode response for command not found
2327 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_NETWORK_COMMISSIONING_CLUSTER_ID);
2334 } // namespace NetworkCommissioning
2338 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
2343 case ZCL_OFF_COMMAND_ID: {
2344 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2345 emberAfOnOffClusterOffCallback();
2348 case ZCL_ON_COMMAND_ID: {
2349 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2350 emberAfOnOffClusterOnCallback();
2353 case ZCL_TOGGLE_COMMAND_ID: {
2354 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2355 emberAfOnOffClusterToggleCallback();
2359 // Unrecognized command ID, error status will apply.
2360 // TODO: Encode response for command not found
2361 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_ON_OFF_CLUSTER_ID);
2368 } // namespace OnOff
2372 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
2377 case ZCL_ADD_SCENE_COMMAND_ID: {
2378 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2381 uint16_t transitionTime;
2382 const uint8_t * sceneName;
2383 /* TYPE WARNING: array array defaults to */ uint8_t * extensionFieldSets;
2385 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2387 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2390 TLVError = dataTlv.Get(groupId);
2393 TLVError = dataTlv.Get(sceneId);
2396 TLVError = dataTlv.Get(transitionTime);
2399 TLVError = dataTlv.GetDataPtr(sceneName);
2402 // Just for compatibility, we will add array type support in IM later.
2403 TLVError = dataTlv.GetDataPtr(const_cast<const uint8_t *&>(extensionFieldSets));
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 emberAfScenesClusterAddSceneCallback(groupId, sceneId, transitionTime, const_cast<uint8_t *>(sceneName),
2418 extensionFieldSets);
2421 case ZCL_GET_SCENE_MEMBERSHIP_COMMAND_ID: {
2422 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 // Unsupported tag, ignore it.
2434 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2437 if (TLVError != CHIP_NO_ERROR)
2439 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2440 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2443 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2444 emberAfScenesClusterGetSceneMembershipCallback(groupId);
2447 case ZCL_RECALL_SCENE_COMMAND_ID: {
2448 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2451 uint16_t transitionTime;
2453 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2455 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2458 TLVError = dataTlv.Get(groupId);
2461 TLVError = dataTlv.Get(sceneId);
2464 TLVError = dataTlv.Get(transitionTime);
2467 // Unsupported tag, ignore it.
2468 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2471 if (TLVError != CHIP_NO_ERROR)
2473 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2474 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2477 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2478 emberAfScenesClusterRecallSceneCallback(groupId, sceneId, transitionTime);
2481 case ZCL_REMOVE_ALL_SCENES_COMMAND_ID: {
2482 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2485 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2487 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2490 TLVError = dataTlv.Get(groupId);
2493 // Unsupported tag, ignore it.
2494 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2497 if (TLVError != CHIP_NO_ERROR)
2499 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2500 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2503 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2504 emberAfScenesClusterRemoveAllScenesCallback(groupId);
2507 case ZCL_REMOVE_SCENE_COMMAND_ID: {
2508 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2512 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2514 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2517 TLVError = dataTlv.Get(groupId);
2520 TLVError = dataTlv.Get(sceneId);
2523 // Unsupported tag, ignore it.
2524 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2527 if (TLVError != CHIP_NO_ERROR)
2529 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2530 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2533 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2534 emberAfScenesClusterRemoveSceneCallback(groupId, sceneId);
2537 case ZCL_STORE_SCENE_COMMAND_ID: {
2538 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2542 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2544 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2547 TLVError = dataTlv.Get(groupId);
2550 TLVError = dataTlv.Get(sceneId);
2553 // Unsupported tag, ignore it.
2554 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2557 if (TLVError != CHIP_NO_ERROR)
2559 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2560 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2563 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2564 emberAfScenesClusterStoreSceneCallback(groupId, sceneId);
2567 case ZCL_VIEW_SCENE_COMMAND_ID: {
2568 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2572 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2574 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2577 TLVError = dataTlv.Get(groupId);
2580 TLVError = dataTlv.Get(sceneId);
2583 // Unsupported tag, ignore it.
2584 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2587 if (TLVError != CHIP_NO_ERROR)
2589 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2590 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2593 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2594 emberAfScenesClusterViewSceneCallback(groupId, sceneId);
2598 // Unrecognized command ID, error status will apply.
2599 // TODO: Encode response for command not found
2600 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_SCENES_CLUSTER_ID);
2607 } // namespace Scenes
2609 } // namespace clusters
2611 void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aCommandId, chip::EndpointId aEndPointId,
2612 chip::TLV::TLVReader & aReader, Command * apCommandObj)
2614 ChipLogDetail(Zcl, "Received Cluster Command: Cluster=%" PRIx16 " Command=%" PRIx8 " Endpoint=%" PRIx8, aClusterId, aCommandId,
2616 Compatibility::SetupEmberAfObjects(apCommandObj, aClusterId, aCommandId, aEndPointId);
2619 case ZCL_BARRIER_CONTROL_CLUSTER_ID:
2620 clusters::BarrierControl::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2622 case ZCL_COLOR_CONTROL_CLUSTER_ID:
2623 clusters::ColorControl::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2625 case ZCL_DOOR_LOCK_CLUSTER_ID:
2626 clusters::DoorLock::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2628 case ZCL_GROUPS_CLUSTER_ID:
2629 clusters::Groups::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2631 case ZCL_IAS_ZONE_CLUSTER_ID:
2632 clusters::IasZone::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2634 case ZCL_IDENTIFY_CLUSTER_ID:
2635 clusters::Identify::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2637 case ZCL_LEVEL_CONTROL_CLUSTER_ID:
2638 clusters::LevelControl::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2640 case ZCL_LOW_POWER_CLUSTER_ID:
2641 clusters::LowPower::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2643 case ZCL_NETWORK_COMMISSIONING_CLUSTER_ID:
2644 clusters::NetworkCommissioning::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2646 case ZCL_ON_OFF_CLUSTER_ID:
2647 clusters::OnOff::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2649 case ZCL_SCENES_CLUSTER_ID:
2650 clusters::Scenes::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2653 // Unrecognized cluster ID, error status will apply.
2654 // TODO: Encode response for Cluster not found
2655 ChipLogError(Zcl, "Unknown cluster %" PRIx16, aClusterId);
2658 Compatibility::ResetEmberAfObjects();