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
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
682 namespace ContentLaunch {
684 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
689 case ZCL_LAUNCH_CONTENT_COMMAND_ID: {
690 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
691 emberAfContentLaunchClusterLaunchContentCallback();
694 case ZCL_LAUNCH_URL_COMMAND_ID: {
695 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
696 emberAfContentLaunchClusterLaunchURLCallback();
700 // Unrecognized command ID, error status will apply.
701 // TODO: Encode response for command not found
702 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_CONTENT_LAUNCH_CLUSTER_ID);
709 } // namespace ContentLaunch
713 void DispatchClientCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
718 case ZCL_LOCK_DOOR_RESPONSE_COMMAND_ID: {
719 CHIP_ERROR TLVError = CHIP_NO_ERROR;
722 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
724 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
727 TLVError = dataTlv.Get(status);
730 // Unsupported tag, ignore it.
731 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
734 if (TLVError != CHIP_NO_ERROR)
736 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
737 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
740 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
741 emberAfDoorLockClusterLockDoorResponseCallback(status);
744 case ZCL_UNLOCK_DOOR_RESPONSE_COMMAND_ID: {
745 CHIP_ERROR TLVError = CHIP_NO_ERROR;
748 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
750 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
753 TLVError = dataTlv.Get(status);
756 // Unsupported tag, ignore it.
757 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
760 if (TLVError != CHIP_NO_ERROR)
762 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
763 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
766 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
767 emberAfDoorLockClusterUnlockDoorResponseCallback(status);
771 // Unrecognized command ID, error status will apply.
772 // TODO: Encode response for command not found
773 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_DOOR_LOCK_CLUSTER_ID);
780 } // namespace DoorLock
784 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
789 case ZCL_CLEAR_ALL_PINS_COMMAND_ID: {
790 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
791 emberAfDoorLockClusterClearAllPinsCallback();
794 case ZCL_CLEAR_ALL_RFIDS_COMMAND_ID: {
795 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
796 emberAfDoorLockClusterClearAllRfidsCallback();
799 case ZCL_CLEAR_HOLIDAY_SCHEDULE_COMMAND_ID: {
800 CHIP_ERROR TLVError = CHIP_NO_ERROR;
803 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
805 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
808 TLVError = dataTlv.Get(scheduleId);
811 // Unsupported tag, ignore it.
812 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
815 if (TLVError != CHIP_NO_ERROR)
817 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
818 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
821 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
822 emberAfDoorLockClusterClearHolidayScheduleCallback(scheduleId);
825 case ZCL_CLEAR_PIN_COMMAND_ID: {
826 CHIP_ERROR TLVError = CHIP_NO_ERROR;
829 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
831 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
834 TLVError = dataTlv.Get(userId);
837 // Unsupported tag, ignore it.
838 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
841 if (TLVError != CHIP_NO_ERROR)
843 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
844 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
847 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
848 emberAfDoorLockClusterClearPinCallback(userId);
851 case ZCL_CLEAR_RFID_COMMAND_ID: {
852 CHIP_ERROR TLVError = CHIP_NO_ERROR;
855 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
857 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
860 TLVError = dataTlv.Get(userId);
863 // Unsupported tag, ignore it.
864 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
867 if (TLVError != CHIP_NO_ERROR)
869 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
870 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
873 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
874 emberAfDoorLockClusterClearRfidCallback(userId);
877 case ZCL_CLEAR_WEEKDAY_SCHEDULE_COMMAND_ID: {
878 CHIP_ERROR TLVError = CHIP_NO_ERROR;
882 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
884 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
887 TLVError = dataTlv.Get(scheduleId);
890 TLVError = dataTlv.Get(userId);
893 // Unsupported tag, ignore it.
894 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
897 if (TLVError != CHIP_NO_ERROR)
899 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
900 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
903 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
904 emberAfDoorLockClusterClearWeekdayScheduleCallback(scheduleId, userId);
907 case ZCL_CLEAR_YEARDAY_SCHEDULE_COMMAND_ID: {
908 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 TLVError = dataTlv.Get(userId);
923 // Unsupported tag, ignore it.
924 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
927 if (TLVError != CHIP_NO_ERROR)
929 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
930 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
933 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
934 emberAfDoorLockClusterClearYeardayScheduleCallback(scheduleId, userId);
937 case ZCL_GET_HOLIDAY_SCHEDULE_COMMAND_ID: {
938 CHIP_ERROR TLVError = CHIP_NO_ERROR;
941 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
943 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
946 TLVError = dataTlv.Get(scheduleId);
949 // Unsupported tag, ignore it.
950 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
953 if (TLVError != CHIP_NO_ERROR)
955 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
956 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
959 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
960 emberAfDoorLockClusterGetHolidayScheduleCallback(scheduleId);
963 case ZCL_GET_LOG_RECORD_COMMAND_ID: {
964 CHIP_ERROR TLVError = CHIP_NO_ERROR;
967 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
969 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
972 TLVError = dataTlv.Get(logIndex);
975 // Unsupported tag, ignore it.
976 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
979 if (TLVError != CHIP_NO_ERROR)
981 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
982 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
985 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
986 emberAfDoorLockClusterGetLogRecordCallback(logIndex);
989 case ZCL_GET_PIN_COMMAND_ID: {
990 CHIP_ERROR TLVError = CHIP_NO_ERROR;
993 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
995 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
998 TLVError = dataTlv.Get(userId);
1001 // Unsupported tag, ignore it.
1002 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1005 if (TLVError != CHIP_NO_ERROR)
1007 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1008 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1011 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1012 emberAfDoorLockClusterGetPinCallback(userId);
1015 case ZCL_GET_RFID_COMMAND_ID: {
1016 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1019 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1021 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1024 TLVError = dataTlv.Get(userId);
1027 // Unsupported tag, ignore it.
1028 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1031 if (TLVError != CHIP_NO_ERROR)
1033 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1034 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1037 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1038 emberAfDoorLockClusterGetRfidCallback(userId);
1041 case ZCL_GET_USER_TYPE_COMMAND_ID: {
1042 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1045 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1047 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1050 TLVError = dataTlv.Get(userId);
1053 // Unsupported tag, ignore it.
1054 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1057 if (TLVError != CHIP_NO_ERROR)
1059 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1060 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1063 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1064 emberAfDoorLockClusterGetUserTypeCallback(userId);
1067 case ZCL_GET_WEEKDAY_SCHEDULE_COMMAND_ID: {
1068 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1072 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1074 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1077 TLVError = dataTlv.Get(scheduleId);
1080 TLVError = dataTlv.Get(userId);
1083 // Unsupported tag, ignore it.
1084 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1087 if (TLVError != CHIP_NO_ERROR)
1089 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1090 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1093 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1094 emberAfDoorLockClusterGetWeekdayScheduleCallback(scheduleId, userId);
1097 case ZCL_GET_YEARDAY_SCHEDULE_COMMAND_ID: {
1098 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1102 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1104 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1107 TLVError = dataTlv.Get(scheduleId);
1110 TLVError = dataTlv.Get(userId);
1113 // Unsupported tag, ignore it.
1114 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1117 if (TLVError != CHIP_NO_ERROR)
1119 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1120 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1123 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1124 emberAfDoorLockClusterGetYeardayScheduleCallback(scheduleId, userId);
1127 case ZCL_LOCK_DOOR_COMMAND_ID: {
1128 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1129 const uint8_t * PIN;
1131 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1133 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1136 TLVError = dataTlv.GetDataPtr(PIN);
1139 // Unsupported tag, ignore it.
1140 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1143 if (TLVError != CHIP_NO_ERROR)
1145 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1146 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1149 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1150 emberAfDoorLockClusterLockDoorCallback(const_cast<uint8_t *>(PIN));
1153 case ZCL_SET_HOLIDAY_SCHEDULE_COMMAND_ID: {
1154 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1156 uint32_t localStartTime;
1157 uint32_t localEndTime;
1158 uint8_t operatingModeDuringHoliday;
1160 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1162 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1165 TLVError = dataTlv.Get(scheduleId);
1168 TLVError = dataTlv.Get(localStartTime);
1171 TLVError = dataTlv.Get(localEndTime);
1174 TLVError = dataTlv.Get(operatingModeDuringHoliday);
1177 // Unsupported tag, ignore it.
1178 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1181 if (TLVError != CHIP_NO_ERROR)
1183 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1184 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1187 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1188 emberAfDoorLockClusterSetHolidayScheduleCallback(scheduleId, localStartTime, localEndTime, operatingModeDuringHoliday);
1191 case ZCL_SET_PIN_COMMAND_ID: {
1192 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1196 const uint8_t * pin;
1198 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1200 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1203 TLVError = dataTlv.Get(userId);
1206 TLVError = dataTlv.Get(userStatus);
1209 TLVError = dataTlv.Get(userType);
1212 TLVError = dataTlv.GetDataPtr(pin);
1215 // Unsupported tag, ignore it.
1216 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1219 if (TLVError != CHIP_NO_ERROR)
1221 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1222 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1225 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1226 emberAfDoorLockClusterSetPinCallback(userId, userStatus, userType, const_cast<uint8_t *>(pin));
1229 case ZCL_SET_RFID_COMMAND_ID: {
1230 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1236 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1238 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1241 TLVError = dataTlv.Get(userId);
1244 TLVError = dataTlv.Get(userStatus);
1247 TLVError = dataTlv.Get(userType);
1250 TLVError = dataTlv.GetDataPtr(id);
1253 // Unsupported tag, ignore it.
1254 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1257 if (TLVError != CHIP_NO_ERROR)
1259 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1260 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1263 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1264 emberAfDoorLockClusterSetRfidCallback(userId, userStatus, userType, const_cast<uint8_t *>(id));
1267 case ZCL_SET_USER_TYPE_COMMAND_ID: {
1268 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1272 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1274 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1277 TLVError = dataTlv.Get(userId);
1280 TLVError = dataTlv.Get(userType);
1283 // Unsupported tag, ignore it.
1284 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1287 if (TLVError != CHIP_NO_ERROR)
1289 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1290 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1293 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1294 emberAfDoorLockClusterSetUserTypeCallback(userId, userType);
1297 case ZCL_SET_WEEKDAY_SCHEDULE_COMMAND_ID: {
1298 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1303 uint8_t startMinute;
1307 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1309 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1312 TLVError = dataTlv.Get(scheduleId);
1315 TLVError = dataTlv.Get(userId);
1318 TLVError = dataTlv.Get(daysMask);
1321 TLVError = dataTlv.Get(startHour);
1324 TLVError = dataTlv.Get(startMinute);
1327 TLVError = dataTlv.Get(endHour);
1330 TLVError = dataTlv.Get(endMinute);
1333 // Unsupported tag, ignore it.
1334 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1337 if (TLVError != CHIP_NO_ERROR)
1339 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1340 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1343 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1344 emberAfDoorLockClusterSetWeekdayScheduleCallback(scheduleId, userId, daysMask, startHour, startMinute, endHour,
1348 case ZCL_SET_YEARDAY_SCHEDULE_COMMAND_ID: {
1349 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1352 uint32_t localStartTime;
1353 uint32_t localEndTime;
1355 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1357 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1360 TLVError = dataTlv.Get(scheduleId);
1363 TLVError = dataTlv.Get(userId);
1366 TLVError = dataTlv.Get(localStartTime);
1369 TLVError = dataTlv.Get(localEndTime);
1372 // Unsupported tag, ignore it.
1373 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1376 if (TLVError != CHIP_NO_ERROR)
1378 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1379 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1382 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1383 emberAfDoorLockClusterSetYeardayScheduleCallback(scheduleId, userId, localStartTime, localEndTime);
1386 case ZCL_UNLOCK_DOOR_COMMAND_ID: {
1387 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1388 const uint8_t * PIN;
1390 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1392 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1395 TLVError = dataTlv.GetDataPtr(PIN);
1398 // Unsupported tag, ignore it.
1399 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1402 if (TLVError != CHIP_NO_ERROR)
1404 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1405 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1408 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1409 emberAfDoorLockClusterUnlockDoorCallback(const_cast<uint8_t *>(PIN));
1412 case ZCL_UNLOCK_WITH_TIMEOUT_COMMAND_ID: {
1413 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1414 uint16_t timeoutInSeconds;
1415 const uint8_t * pin;
1417 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1419 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1422 TLVError = dataTlv.Get(timeoutInSeconds);
1425 TLVError = dataTlv.GetDataPtr(pin);
1428 // Unsupported tag, ignore it.
1429 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1432 if (TLVError != CHIP_NO_ERROR)
1434 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1435 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1438 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1439 emberAfDoorLockClusterUnlockWithTimeoutCallback(timeoutInSeconds, const_cast<uint8_t *>(pin));
1443 // Unrecognized command ID, error status will apply.
1444 // TODO: Encode response for command not found
1445 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_DOOR_LOCK_CLUSTER_ID);
1452 } // namespace DoorLock
1456 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
1461 case ZCL_ADD_GROUP_COMMAND_ID: {
1462 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1464 const uint8_t * groupName;
1466 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1468 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1471 TLVError = dataTlv.Get(groupId);
1474 TLVError = dataTlv.GetDataPtr(groupName);
1477 // Unsupported tag, ignore it.
1478 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1481 if (TLVError != CHIP_NO_ERROR)
1483 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1484 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1487 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1488 emberAfGroupsClusterAddGroupCallback(groupId, const_cast<uint8_t *>(groupName));
1491 case ZCL_ADD_GROUP_IF_IDENTIFYING_COMMAND_ID: {
1492 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1494 const uint8_t * groupName;
1496 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1498 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1501 TLVError = dataTlv.Get(groupId);
1504 TLVError = dataTlv.GetDataPtr(groupName);
1507 // Unsupported tag, ignore it.
1508 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1511 if (TLVError != CHIP_NO_ERROR)
1513 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1514 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1517 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1518 emberAfGroupsClusterAddGroupIfIdentifyingCallback(groupId, const_cast<uint8_t *>(groupName));
1521 case ZCL_GET_GROUP_MEMBERSHIP_COMMAND_ID: {
1522 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1524 /* TYPE WARNING: array array defaults to */ uint8_t * groupList;
1526 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1528 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1531 TLVError = dataTlv.Get(groupCount);
1534 // Just for compatibility, we will add array type support in IM later.
1535 TLVError = dataTlv.GetDataPtr(const_cast<const uint8_t *&>(groupList));
1538 // Unsupported tag, ignore it.
1539 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1542 if (TLVError != CHIP_NO_ERROR)
1544 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1545 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1548 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1549 emberAfGroupsClusterGetGroupMembershipCallback(groupCount, groupList);
1552 case ZCL_REMOVE_ALL_GROUPS_COMMAND_ID: {
1553 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1554 emberAfGroupsClusterRemoveAllGroupsCallback();
1557 case ZCL_REMOVE_GROUP_COMMAND_ID: {
1558 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1561 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1563 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1566 TLVError = dataTlv.Get(groupId);
1569 // Unsupported tag, ignore it.
1570 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1573 if (TLVError != CHIP_NO_ERROR)
1575 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1576 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1579 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1580 emberAfGroupsClusterRemoveGroupCallback(groupId);
1583 case ZCL_VIEW_GROUP_COMMAND_ID: {
1584 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1587 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1589 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1592 TLVError = dataTlv.Get(groupId);
1595 // Unsupported tag, ignore it.
1596 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1599 if (TLVError != CHIP_NO_ERROR)
1601 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1602 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1605 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1606 emberAfGroupsClusterViewGroupCallback(groupId);
1610 // Unrecognized command ID, error status will apply.
1611 // TODO: Encode response for command not found
1612 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_GROUPS_CLUSTER_ID);
1619 } // namespace Groups
1623 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
1628 case ZCL_ZONE_ENROLL_RESPONSE_COMMAND_ID: {
1629 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1630 uint8_t enrollResponseCode;
1633 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1635 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1638 TLVError = dataTlv.Get(enrollResponseCode);
1641 TLVError = dataTlv.Get(zoneId);
1644 // Unsupported tag, ignore it.
1645 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1648 if (TLVError != CHIP_NO_ERROR)
1650 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1651 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1654 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1655 emberAfIasZoneClusterZoneEnrollResponseCallback(enrollResponseCode, zoneId);
1659 // Unrecognized command ID, error status will apply.
1660 // TODO: Encode response for command not found
1661 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_IAS_ZONE_CLUSTER_ID);
1668 } // namespace IasZone
1670 namespace Identify {
1672 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
1677 case ZCL_IDENTIFY_COMMAND_ID: {
1678 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1679 uint16_t identifyTime;
1681 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1683 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1686 TLVError = dataTlv.Get(identifyTime);
1689 // Unsupported tag, ignore it.
1690 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1693 if (TLVError != CHIP_NO_ERROR)
1695 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1696 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1699 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1700 emberAfIdentifyClusterIdentifyCallback(identifyTime);
1703 case ZCL_IDENTIFY_QUERY_COMMAND_ID: {
1704 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1705 emberAfIdentifyClusterIdentifyQueryCallback();
1709 // Unrecognized command ID, error status will apply.
1710 // TODO: Encode response for command not found
1711 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_IDENTIFY_CLUSTER_ID);
1718 } // namespace Identify
1720 namespace LevelControl {
1722 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
1727 case ZCL_MOVE_COMMAND_ID: {
1728 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1732 uint8_t optionOverride;
1734 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1736 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1739 TLVError = dataTlv.Get(moveMode);
1742 TLVError = dataTlv.Get(rate);
1745 TLVError = dataTlv.Get(optionMask);
1748 TLVError = dataTlv.Get(optionOverride);
1751 // Unsupported tag, ignore it.
1752 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1755 if (TLVError != CHIP_NO_ERROR)
1757 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1758 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1761 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1762 emberAfLevelControlClusterMoveCallback(moveMode, rate, optionMask, optionOverride);
1765 case ZCL_MOVE_TO_LEVEL_COMMAND_ID: {
1766 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1768 uint16_t transitionTime;
1770 uint8_t optionOverride;
1772 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1774 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1777 TLVError = dataTlv.Get(level);
1780 TLVError = dataTlv.Get(transitionTime);
1783 TLVError = dataTlv.Get(optionMask);
1786 TLVError = dataTlv.Get(optionOverride);
1789 // Unsupported tag, ignore it.
1790 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1793 if (TLVError != CHIP_NO_ERROR)
1795 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1796 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1799 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1800 emberAfLevelControlClusterMoveToLevelCallback(level, transitionTime, optionMask, optionOverride);
1803 case ZCL_MOVE_TO_LEVEL_WITH_ON_OFF_COMMAND_ID: {
1804 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1806 uint16_t transitionTime;
1808 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1810 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1813 TLVError = dataTlv.Get(level);
1816 TLVError = dataTlv.Get(transitionTime);
1819 // Unsupported tag, ignore it.
1820 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1823 if (TLVError != CHIP_NO_ERROR)
1825 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1826 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1829 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1830 emberAfLevelControlClusterMoveToLevelWithOnOffCallback(level, transitionTime);
1833 case ZCL_MOVE_WITH_ON_OFF_COMMAND_ID: {
1834 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1838 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1840 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1843 TLVError = dataTlv.Get(moveMode);
1846 TLVError = dataTlv.Get(rate);
1849 // Unsupported tag, ignore it.
1850 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1853 if (TLVError != CHIP_NO_ERROR)
1855 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1856 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1859 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1860 emberAfLevelControlClusterMoveWithOnOffCallback(moveMode, rate);
1863 case ZCL_STEP_COMMAND_ID: {
1864 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1867 uint16_t transitionTime;
1869 uint8_t optionOverride;
1871 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1873 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1876 TLVError = dataTlv.Get(stepMode);
1879 TLVError = dataTlv.Get(stepSize);
1882 TLVError = dataTlv.Get(transitionTime);
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 emberAfLevelControlClusterStepCallback(stepMode, stepSize, transitionTime, optionMask, optionOverride);
1905 case ZCL_STEP_WITH_ON_OFF_COMMAND_ID: {
1906 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1909 uint16_t transitionTime;
1911 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1913 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1916 TLVError = dataTlv.Get(stepMode);
1919 TLVError = dataTlv.Get(stepSize);
1922 TLVError = dataTlv.Get(transitionTime);
1925 // Unsupported tag, ignore it.
1926 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1929 if (TLVError != CHIP_NO_ERROR)
1931 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1932 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1935 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1936 emberAfLevelControlClusterStepWithOnOffCallback(stepMode, stepSize, transitionTime);
1939 case ZCL_STOP_COMMAND_ID: {
1940 CHIP_ERROR TLVError = CHIP_NO_ERROR;
1942 uint8_t optionOverride;
1944 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
1946 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
1949 TLVError = dataTlv.Get(optionMask);
1952 TLVError = dataTlv.Get(optionOverride);
1955 // Unsupported tag, ignore it.
1956 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
1959 if (TLVError != CHIP_NO_ERROR)
1961 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
1962 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
1965 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1966 emberAfLevelControlClusterStopCallback(optionMask, optionOverride);
1969 case ZCL_STOP_WITH_ON_OFF_COMMAND_ID: {
1970 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1971 emberAfLevelControlClusterStopWithOnOffCallback();
1975 // Unrecognized command ID, error status will apply.
1976 // TODO: Encode response for command not found
1977 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_LEVEL_CONTROL_CLUSTER_ID);
1984 } // namespace LevelControl
1986 namespace LowPower {
1988 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
1993 case ZCL_SLEEP_COMMAND_ID: {
1994 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
1995 emberAfLowPowerClusterSleepCallback();
1999 // Unrecognized command ID, error status will apply.
2000 // TODO: Encode response for command not found
2001 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_LOW_POWER_CLUSTER_ID);
2008 } // namespace LowPower
2010 namespace MediaPlayback {
2012 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
2017 case ZCL_FAST_FORWARD_REQUEST_COMMAND_ID: {
2018 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2019 emberAfMediaPlaybackClusterFastForwardRequestCallback();
2022 case ZCL_NEXT_REQUEST_COMMAND_ID: {
2023 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2024 emberAfMediaPlaybackClusterNextRequestCallback();
2027 case ZCL_PAUSE_REQUEST_COMMAND_ID: {
2028 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2029 emberAfMediaPlaybackClusterPauseRequestCallback();
2032 case ZCL_PLAY_REQUEST_COMMAND_ID: {
2033 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2034 emberAfMediaPlaybackClusterPlayRequestCallback();
2037 case ZCL_PREVIOUS_REQUEST_COMMAND_ID: {
2038 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2039 emberAfMediaPlaybackClusterPreviousRequestCallback();
2042 case ZCL_REWIND_REQUEST_COMMAND_ID: {
2043 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2044 emberAfMediaPlaybackClusterRewindRequestCallback();
2047 case ZCL_SKIP_BACKWARD_REQUEST_COMMAND_ID: {
2048 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2049 emberAfMediaPlaybackClusterSkipBackwardRequestCallback();
2052 case ZCL_SKIP_FORWARD_REQUEST_COMMAND_ID: {
2053 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2054 emberAfMediaPlaybackClusterSkipForwardRequestCallback();
2057 case ZCL_START_OVER_REQUEST_COMMAND_ID: {
2058 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2059 emberAfMediaPlaybackClusterStartOverRequestCallback();
2062 case ZCL_STOP_REQUEST_COMMAND_ID: {
2063 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2064 emberAfMediaPlaybackClusterStopRequestCallback();
2068 // Unrecognized command ID, error status will apply.
2069 // TODO: Encode response for command not found
2070 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_MEDIA_PLAYBACK_CLUSTER_ID);
2077 } // namespace MediaPlayback
2081 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
2086 case ZCL_OFF_COMMAND_ID: {
2087 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2088 emberAfOnOffClusterOffCallback();
2091 case ZCL_ON_COMMAND_ID: {
2092 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2093 emberAfOnOffClusterOnCallback();
2096 case ZCL_TOGGLE_COMMAND_ID: {
2097 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2098 emberAfOnOffClusterToggleCallback();
2102 // Unrecognized command ID, error status will apply.
2103 // TODO: Encode response for command not found
2104 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_ON_OFF_CLUSTER_ID);
2111 } // namespace OnOff
2115 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
2120 case ZCL_ADD_SCENE_COMMAND_ID: {
2121 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2124 uint16_t transitionTime;
2125 const uint8_t * sceneName;
2126 /* TYPE WARNING: array array defaults to */ uint8_t * extensionFieldSets;
2128 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2130 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2133 TLVError = dataTlv.Get(groupId);
2136 TLVError = dataTlv.Get(sceneId);
2139 TLVError = dataTlv.Get(transitionTime);
2142 TLVError = dataTlv.GetDataPtr(sceneName);
2145 // Just for compatibility, we will add array type support in IM later.
2146 TLVError = dataTlv.GetDataPtr(const_cast<const uint8_t *&>(extensionFieldSets));
2149 // Unsupported tag, ignore it.
2150 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2153 if (TLVError != CHIP_NO_ERROR)
2155 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2156 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2159 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2160 emberAfScenesClusterAddSceneCallback(groupId, sceneId, transitionTime, const_cast<uint8_t *>(sceneName),
2161 extensionFieldSets);
2164 case ZCL_GET_SCENE_MEMBERSHIP_COMMAND_ID: {
2165 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2168 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2170 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2173 TLVError = dataTlv.Get(groupId);
2176 // Unsupported tag, ignore it.
2177 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2180 if (TLVError != CHIP_NO_ERROR)
2182 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2183 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2186 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2187 emberAfScenesClusterGetSceneMembershipCallback(groupId);
2190 case ZCL_RECALL_SCENE_COMMAND_ID: {
2191 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2194 uint16_t transitionTime;
2196 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2198 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2201 TLVError = dataTlv.Get(groupId);
2204 TLVError = dataTlv.Get(sceneId);
2207 TLVError = dataTlv.Get(transitionTime);
2210 // Unsupported tag, ignore it.
2211 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2214 if (TLVError != CHIP_NO_ERROR)
2216 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2217 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2220 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2221 emberAfScenesClusterRecallSceneCallback(groupId, sceneId, transitionTime);
2224 case ZCL_REMOVE_ALL_SCENES_COMMAND_ID: {
2225 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2228 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2230 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2233 TLVError = dataTlv.Get(groupId);
2236 // Unsupported tag, ignore it.
2237 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2240 if (TLVError != CHIP_NO_ERROR)
2242 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2243 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2246 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2247 emberAfScenesClusterRemoveAllScenesCallback(groupId);
2250 case ZCL_REMOVE_SCENE_COMMAND_ID: {
2251 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2255 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2257 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2260 TLVError = dataTlv.Get(groupId);
2263 TLVError = dataTlv.Get(sceneId);
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 emberAfScenesClusterRemoveSceneCallback(groupId, sceneId);
2280 case ZCL_STORE_SCENE_COMMAND_ID: {
2281 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2285 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2287 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2290 TLVError = dataTlv.Get(groupId);
2293 TLVError = dataTlv.Get(sceneId);
2296 // Unsupported tag, ignore it.
2297 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2300 if (TLVError != CHIP_NO_ERROR)
2302 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2303 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2306 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2307 emberAfScenesClusterStoreSceneCallback(groupId, sceneId);
2310 case ZCL_VIEW_SCENE_COMMAND_ID: {
2311 CHIP_ERROR TLVError = CHIP_NO_ERROR;
2315 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
2317 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
2320 TLVError = dataTlv.Get(groupId);
2323 TLVError = dataTlv.Get(sceneId);
2326 // Unsupported tag, ignore it.
2327 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
2330 if (TLVError != CHIP_NO_ERROR)
2332 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
2333 TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
2336 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
2337 emberAfScenesClusterViewSceneCallback(groupId, sceneId);
2341 // Unrecognized command ID, error status will apply.
2342 // TODO: Encode response for command not found
2343 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_SCENES_CLUSTER_ID);
2350 } // namespace Scenes
2352 } // namespace clusters
2354 void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aCommandId, chip::EndpointId aEndPointId,
2355 chip::TLV::TLVReader & aReader, Command * apCommandObj)
2357 ChipLogDetail(Zcl, "Received Cluster Command: Cluster=%" PRIx16 " Command=%" PRIx8 " Endpoint=%" PRIx8, aClusterId, aCommandId,
2359 Compatibility::SetupEmberAfObjects(apCommandObj, aClusterId, aCommandId, aEndPointId);
2362 case ZCL_BARRIER_CONTROL_CLUSTER_ID:
2363 clusters::BarrierControl::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2365 case ZCL_COLOR_CONTROL_CLUSTER_ID:
2366 clusters::ColorControl::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2368 case ZCL_CONTENT_LAUNCH_CLUSTER_ID:
2369 clusters::ContentLaunch::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2371 case ZCL_DOOR_LOCK_CLUSTER_ID:
2372 clusters::DoorLock::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2374 case ZCL_GROUPS_CLUSTER_ID:
2375 clusters::Groups::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2377 case ZCL_IAS_ZONE_CLUSTER_ID:
2378 clusters::IasZone::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2380 case ZCL_IDENTIFY_CLUSTER_ID:
2381 clusters::Identify::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2383 case ZCL_LEVEL_CONTROL_CLUSTER_ID:
2384 clusters::LevelControl::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2386 case ZCL_LOW_POWER_CLUSTER_ID:
2387 clusters::LowPower::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2389 case ZCL_MEDIA_PLAYBACK_CLUSTER_ID:
2390 clusters::MediaPlayback::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2392 case ZCL_ON_OFF_CLUSTER_ID:
2393 clusters::OnOff::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2395 case ZCL_SCENES_CLUSTER_ID:
2396 clusters::Scenes::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
2399 // Unrecognized cluster ID, error status will apply.
2400 // TODO: Encode response for Cluster not found
2401 ChipLogError(Zcl, "Unknown cluster %" PRIx16, aClusterId);
2404 Compatibility::ResetEmberAfObjects();