Apply Upstream code (2021-03-15)
[platform/upstream/connectedhomeip.git] / examples / tv-app / tv-common / gen / CHIPClustersObjc.mm
1 /*
2  *
3  *    Copyright (c) 2021 Project CHIP Authors
4  *
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
8  *
9  *        http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  */
17
18 // THIS FILE IS GENERATED BY ZAP
19
20 #import <Foundation/Foundation.h>
21
22 #import "CHIPDevice.h"
23 #import "CHIPDevice_Internal.h"
24 #import "ChipError.h"
25 #import "gen/CHIPClientCallbacks.h"
26 #import "gen/CHIPClustersObjc.h"
27
28 #include <controller/CHIPClusters.h>
29 #include <lib/support/Span.h>
30
31 using namespace ::chip;
32
33 class CHIPDefaultSuccessCallbackBridge : public Callback::Callback<DefaultSuccessCallback> {
34 public:
35     CHIPDefaultSuccessCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
36         : Callback::Callback<DefaultSuccessCallback>(CallbackFn, this)
37         , mHandler(handler)
38         , mQueue(queue)
39     {
40     }
41
42     ~CHIPDefaultSuccessCallbackBridge() {};
43
44     static void CallbackFn(void * context)
45     {
46         CHIPDefaultSuccessCallbackBridge * callback = reinterpret_cast<CHIPDefaultSuccessCallbackBridge *>(context);
47         if (callback && callback->mQueue) {
48             dispatch_async(callback->mQueue, ^{
49                 callback->mHandler(nil, nil);
50                 callback->Cancel();
51                 delete callback;
52             });
53         }
54     };
55
56 private:
57     ResponseHandler mHandler;
58     dispatch_queue_t mQueue;
59 };
60
61 class CHIPDefaultFailureCallbackBridge : public Callback::Callback<DefaultFailureCallback> {
62 public:
63     CHIPDefaultFailureCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
64         : Callback::Callback<DefaultFailureCallback>(CallbackFn, this)
65         , mHandler(handler)
66         , mQueue(queue)
67     {
68     }
69
70     ~CHIPDefaultFailureCallbackBridge() {};
71
72     static void CallbackFn(void * context, uint8_t status)
73     {
74         CHIPDefaultFailureCallbackBridge * callback = reinterpret_cast<CHIPDefaultFailureCallbackBridge *>(context);
75         if (callback && callback->mQueue) {
76             dispatch_async(callback->mQueue, ^{
77                 NSError * error = [NSError errorWithDomain:CHIPErrorDomain
78                                                       code:status
79                                                   userInfo:@ { NSLocalizedDescriptionKey : @"" }];
80                 callback->mHandler(error, nil);
81                 callback->Cancel();
82                 delete callback;
83             });
84         }
85     };
86
87 private:
88     ResponseHandler mHandler;
89     dispatch_queue_t mQueue;
90 };
91
92 class CHIPStringAttributeCallbackBridge : public Callback::Callback<StringAttributeCallback> {
93 public:
94     CHIPStringAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool octetString, bool keepAlive = false)
95         : Callback::Callback<StringAttributeCallback>(CallbackFn, this)
96         , mHandler(handler)
97         , mQueue(queue)
98         , mOctetString(octetString)
99         , mKeepAlive(keepAlive)
100     {
101     }
102
103     ~CHIPStringAttributeCallbackBridge() {};
104
105     static void CallbackFn(void * context, chip::ByteSpan value)
106     {
107         CHIPStringAttributeCallbackBridge * callback = reinterpret_cast<CHIPStringAttributeCallbackBridge *>(context);
108         if (callback && callback->mQueue) {
109             dispatch_async(callback->mQueue, ^{
110                 if (callback->mOctetString) {
111                     NSData * data = [NSData dataWithBytes:value.data() length:value.size()];
112                     callback->mHandler(nil, @ { @"value" : data });
113                 } else {
114                     NSString * str = [[NSString alloc] initWithBytes:value.data()
115                                                               length:value.size()
116                                                             encoding:NSUTF8StringEncoding];
117                     callback->mHandler(nil, @ { @"value" : str });
118                 }
119
120                 if (!callback->mKeepAlive) {
121                     callback->Cancel();
122                     delete callback;
123                 }
124             });
125         }
126     };
127
128 private:
129     ResponseHandler mHandler;
130     dispatch_queue_t mQueue;
131     bool mOctetString;
132     bool mKeepAlive;
133 };
134
135 class CHIPBooleanAttributeCallbackBridge : public Callback::Callback<BooleanAttributeCallback> {
136 public:
137     CHIPBooleanAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
138         : Callback::Callback<BooleanAttributeCallback>(CallbackFn, this)
139         , mHandler(handler)
140         , mQueue(queue)
141         , mKeepAlive(keepAlive)
142     {
143     }
144
145     ~CHIPBooleanAttributeCallbackBridge() {};
146
147     static void CallbackFn(void * context, bool value)
148     {
149         CHIPBooleanAttributeCallbackBridge * callback = reinterpret_cast<CHIPBooleanAttributeCallbackBridge *>(context);
150         if (callback && callback->mQueue) {
151             dispatch_async(callback->mQueue, ^{
152                 callback->mHandler(nil, @ { @"value" : [NSNumber numberWithBool:value] });
153                 if (!callback->mKeepAlive) {
154                     callback->Cancel();
155                     delete callback;
156                 }
157             });
158         }
159     };
160
161 private:
162     ResponseHandler mHandler;
163     dispatch_queue_t mQueue;
164     bool mKeepAlive;
165 };
166
167 class CHIPInt8uAttributeCallbackBridge : public Callback::Callback<Int8uAttributeCallback> {
168 public:
169     CHIPInt8uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
170         : Callback::Callback<Int8uAttributeCallback>(CallbackFn, this)
171         , mHandler(handler)
172         , mQueue(queue)
173         , mKeepAlive(keepAlive)
174     {
175     }
176
177     ~CHIPInt8uAttributeCallbackBridge() {};
178
179     static void CallbackFn(void * context, uint8_t value)
180     {
181         CHIPInt8uAttributeCallbackBridge * callback = reinterpret_cast<CHIPInt8uAttributeCallbackBridge *>(context);
182         if (callback && callback->mQueue) {
183             dispatch_async(callback->mQueue, ^{
184                 callback->mHandler(nil, @ { @"value" : [NSNumber numberWithUnsignedChar:value] });
185                 if (!callback->mKeepAlive) {
186                     callback->Cancel();
187                     delete callback;
188                 }
189             });
190         }
191     };
192
193 private:
194     ResponseHandler mHandler;
195     dispatch_queue_t mQueue;
196     bool mKeepAlive;
197 };
198
199 class CHIPInt8sAttributeCallbackBridge : public Callback::Callback<Int8sAttributeCallback> {
200 public:
201     CHIPInt8sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
202         : Callback::Callback<Int8sAttributeCallback>(CallbackFn, this)
203         , mHandler(handler)
204         , mQueue(queue)
205         , mKeepAlive(keepAlive)
206     {
207     }
208
209     ~CHIPInt8sAttributeCallbackBridge() {};
210
211     static void CallbackFn(void * context, int8_t value)
212     {
213         CHIPInt8sAttributeCallbackBridge * callback = reinterpret_cast<CHIPInt8sAttributeCallbackBridge *>(context);
214         if (callback && callback->mQueue) {
215             dispatch_async(callback->mQueue, ^{
216                 callback->mHandler(nil, @ { @"value" : [NSNumber numberWithChar:value] });
217                 if (!callback->mKeepAlive) {
218                     callback->Cancel();
219                     delete callback;
220                 }
221             });
222         }
223     };
224
225 private:
226     ResponseHandler mHandler;
227     dispatch_queue_t mQueue;
228     bool mKeepAlive;
229 };
230
231 class CHIPInt16uAttributeCallbackBridge : public Callback::Callback<Int16uAttributeCallback> {
232 public:
233     CHIPInt16uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
234         : Callback::Callback<Int16uAttributeCallback>(CallbackFn, this)
235         , mHandler(handler)
236         , mQueue(queue)
237         , mKeepAlive(keepAlive)
238     {
239     }
240
241     ~CHIPInt16uAttributeCallbackBridge() {};
242
243     static void CallbackFn(void * context, uint16_t value)
244     {
245         CHIPInt16uAttributeCallbackBridge * callback = reinterpret_cast<CHIPInt16uAttributeCallbackBridge *>(context);
246         if (callback && callback->mQueue) {
247             dispatch_async(callback->mQueue, ^{
248                 callback->mHandler(nil, @ { @"value" : [NSNumber numberWithUnsignedShort:value] });
249                 if (!callback->mKeepAlive) {
250                     callback->Cancel();
251                     delete callback;
252                 }
253             });
254         }
255     };
256
257 private:
258     ResponseHandler mHandler;
259     dispatch_queue_t mQueue;
260     bool mKeepAlive;
261 };
262
263 class CHIPInt32uAttributeCallbackBridge : public Callback::Callback<Int32uAttributeCallback> {
264 public:
265     CHIPInt32uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
266         : Callback::Callback<Int32uAttributeCallback>(CallbackFn, this)
267         , mHandler(handler)
268         , mQueue(queue)
269         , mKeepAlive(keepAlive)
270     {
271     }
272
273     ~CHIPInt32uAttributeCallbackBridge() {};
274
275     static void CallbackFn(void * context, uint32_t value)
276     {
277         CHIPInt32uAttributeCallbackBridge * callback = reinterpret_cast<CHIPInt32uAttributeCallbackBridge *>(context);
278         if (callback && callback->mQueue) {
279             dispatch_async(callback->mQueue, ^{
280                 callback->mHandler(nil, @ { @"value" : [NSNumber numberWithUnsignedLong:value] });
281                 if (!callback->mKeepAlive) {
282                     callback->Cancel();
283                     delete callback;
284                 }
285             });
286         }
287     };
288
289 private:
290     ResponseHandler mHandler;
291     dispatch_queue_t mQueue;
292     bool mKeepAlive;
293 };
294
295 class CHIPInt16sAttributeCallbackBridge : public Callback::Callback<Int16sAttributeCallback> {
296 public:
297     CHIPInt16sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
298         : Callback::Callback<Int16sAttributeCallback>(CallbackFn, this)
299         , mHandler(handler)
300         , mQueue(queue)
301         , mKeepAlive(keepAlive)
302     {
303     }
304
305     ~CHIPInt16sAttributeCallbackBridge() {};
306
307     static void CallbackFn(void * context, int16_t value)
308     {
309         CHIPInt16sAttributeCallbackBridge * callback = reinterpret_cast<CHIPInt16sAttributeCallbackBridge *>(context);
310         if (callback && callback->mQueue) {
311             dispatch_async(callback->mQueue, ^{
312                 callback->mHandler(nil, @ { @"value" : [NSNumber numberWithShort:value] });
313                 if (!callback->mKeepAlive) {
314                     callback->Cancel();
315                     delete callback;
316                 }
317             });
318         }
319     };
320
321 private:
322     ResponseHandler mHandler;
323     dispatch_queue_t mQueue;
324     bool mKeepAlive;
325 };
326
327 class CHIPDoorLockClusterLockDoorResponseCallbackBridge : public Callback::Callback<DoorLockClusterLockDoorResponseCallback> {
328 public:
329     CHIPDoorLockClusterLockDoorResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
330         : Callback::Callback<DoorLockClusterLockDoorResponseCallback>(CallbackFn, this)
331         , mHandler(handler)
332         , mQueue(queue)
333     {
334     }
335
336     ~CHIPDoorLockClusterLockDoorResponseCallbackBridge() {};
337
338     static void CallbackFn(void * context)
339     {
340         CHIPDoorLockClusterLockDoorResponseCallbackBridge * callback
341             = reinterpret_cast<CHIPDoorLockClusterLockDoorResponseCallbackBridge *>(context);
342         if (callback && callback->mQueue) {
343             dispatch_async(callback->mQueue, ^{
344                 callback->mHandler(nil, @ {});
345                 callback->Cancel();
346                 delete callback;
347             });
348         }
349     };
350
351 private:
352     ResponseHandler mHandler;
353     dispatch_queue_t mQueue;
354 };
355
356 class CHIPDoorLockClusterUnlockDoorResponseCallbackBridge : public Callback::Callback<DoorLockClusterUnlockDoorResponseCallback> {
357 public:
358     CHIPDoorLockClusterUnlockDoorResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
359         : Callback::Callback<DoorLockClusterUnlockDoorResponseCallback>(CallbackFn, this)
360         , mHandler(handler)
361         , mQueue(queue)
362     {
363     }
364
365     ~CHIPDoorLockClusterUnlockDoorResponseCallbackBridge() {};
366
367     static void CallbackFn(void * context)
368     {
369         CHIPDoorLockClusterUnlockDoorResponseCallbackBridge * callback
370             = reinterpret_cast<CHIPDoorLockClusterUnlockDoorResponseCallbackBridge *>(context);
371         if (callback && callback->mQueue) {
372             dispatch_async(callback->mQueue, ^{
373                 callback->mHandler(nil, @ {});
374                 callback->Cancel();
375                 delete callback;
376             });
377         }
378     };
379
380 private:
381     ResponseHandler mHandler;
382     dispatch_queue_t mQueue;
383 };
384
385 @interface CHIPCluster ()
386 @property (readonly, nonatomic) dispatch_queue_t callbackQueue;
387 - (Controller::ClusterBase *)getCluster;
388 @end
389
390 @implementation CHIPCluster
391 - (instancetype)initWithDevice:(CHIPDevice *)device endpoint:(EndpointId)endpoint queue:(dispatch_queue_t)queue
392 {
393     if (self = [super init]) {
394         Controller::ClusterBase * cppCluster = [self getCluster];
395         if (cppCluster == nullptr) {
396             return nil;
397         }
398
399         CHIP_ERROR err = cppCluster->Associate([device internalDevice], endpoint);
400         if (err != CHIP_NO_ERROR) {
401             return nil;
402         }
403
404         _callbackQueue = queue;
405     }
406     return self;
407 }
408
409 - (Controller::ClusterBase *)getCluster
410 {
411     return nullptr;
412 }
413 @end
414
415 @interface CHIPApplicationBasic ()
416 @property (readonly) Controller::ApplicationBasicCluster cppCluster;
417 @end
418
419 @implementation CHIPApplicationBasic
420
421 - (Controller::ClusterBase *)getCluster
422 {
423     return &_cppCluster;
424 }
425
426 - (void)readAttributeVendorName:(ResponseHandler)completionHandler
427 {
428     CHIPStringAttributeCallbackBridge * onSuccess
429         = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], true);
430     if (!onSuccess) {
431         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
432         return;
433     }
434
435     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
436     if (!onFailure) {
437         delete onSuccess;
438         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
439         return;
440     }
441
442     CHIP_ERROR err = self.cppCluster.ReadAttributeVendorName(onSuccess->Cancel(), onFailure->Cancel());
443     if (err != CHIP_NO_ERROR) {
444         delete onSuccess;
445         delete onFailure;
446         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
447     }
448 }
449
450 - (void)readAttributeVendorId:(ResponseHandler)completionHandler
451 {
452     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
453     if (!onSuccess) {
454         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
455         return;
456     }
457
458     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
459     if (!onFailure) {
460         delete onSuccess;
461         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
462         return;
463     }
464
465     CHIP_ERROR err = self.cppCluster.ReadAttributeVendorId(onSuccess->Cancel(), onFailure->Cancel());
466     if (err != CHIP_NO_ERROR) {
467         delete onSuccess;
468         delete onFailure;
469         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
470     }
471 }
472
473 - (void)readAttributeApplicationName:(ResponseHandler)completionHandler
474 {
475     CHIPStringAttributeCallbackBridge * onSuccess
476         = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], true);
477     if (!onSuccess) {
478         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
479         return;
480     }
481
482     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
483     if (!onFailure) {
484         delete onSuccess;
485         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
486         return;
487     }
488
489     CHIP_ERROR err = self.cppCluster.ReadAttributeApplicationName(onSuccess->Cancel(), onFailure->Cancel());
490     if (err != CHIP_NO_ERROR) {
491         delete onSuccess;
492         delete onFailure;
493         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
494     }
495 }
496
497 - (void)readAttributeProductId:(ResponseHandler)completionHandler
498 {
499     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
500     if (!onSuccess) {
501         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
502         return;
503     }
504
505     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
506     if (!onFailure) {
507         delete onSuccess;
508         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
509         return;
510     }
511
512     CHIP_ERROR err = self.cppCluster.ReadAttributeProductId(onSuccess->Cancel(), onFailure->Cancel());
513     if (err != CHIP_NO_ERROR) {
514         delete onSuccess;
515         delete onFailure;
516         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
517     }
518 }
519
520 - (void)readAttributeApplicationId:(ResponseHandler)completionHandler
521 {
522     CHIPStringAttributeCallbackBridge * onSuccess
523         = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], true);
524     if (!onSuccess) {
525         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
526         return;
527     }
528
529     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
530     if (!onFailure) {
531         delete onSuccess;
532         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
533         return;
534     }
535
536     CHIP_ERROR err = self.cppCluster.ReadAttributeApplicationId(onSuccess->Cancel(), onFailure->Cancel());
537     if (err != CHIP_NO_ERROR) {
538         delete onSuccess;
539         delete onFailure;
540         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
541     }
542 }
543
544 - (void)readAttributeCatalogVendorId:(ResponseHandler)completionHandler
545 {
546     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
547     if (!onSuccess) {
548         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
549         return;
550     }
551
552     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
553     if (!onFailure) {
554         delete onSuccess;
555         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
556         return;
557     }
558
559     CHIP_ERROR err = self.cppCluster.ReadAttributeCatalogVendorId(onSuccess->Cancel(), onFailure->Cancel());
560     if (err != CHIP_NO_ERROR) {
561         delete onSuccess;
562         delete onFailure;
563         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
564     }
565 }
566
567 - (void)readAttributeApplicationSatus:(ResponseHandler)completionHandler
568 {
569     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
570     if (!onSuccess) {
571         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
572         return;
573     }
574
575     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
576     if (!onFailure) {
577         delete onSuccess;
578         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
579         return;
580     }
581
582     CHIP_ERROR err = self.cppCluster.ReadAttributeApplicationSatus(onSuccess->Cancel(), onFailure->Cancel());
583     if (err != CHIP_NO_ERROR) {
584         delete onSuccess;
585         delete onFailure;
586         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
587     }
588 }
589
590 - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
591 {
592     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
593     if (!onSuccess) {
594         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
595         return;
596     }
597
598     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
599     if (!onFailure) {
600         delete onSuccess;
601         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
602         return;
603     }
604
605     CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
606     if (err != CHIP_NO_ERROR) {
607         delete onSuccess;
608         delete onFailure;
609         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
610     }
611 }
612
613 @end
614
615 @interface CHIPBarrierControl ()
616 @property (readonly) Controller::BarrierControlCluster cppCluster;
617 @end
618
619 @implementation CHIPBarrierControl
620
621 - (Controller::ClusterBase *)getCluster
622 {
623     return &_cppCluster;
624 }
625
626 - (void)barrierControlGoToPercent:(uint8_t)percentOpen completionHandler:(ResponseHandler)completionHandler
627 {
628     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
629     if (!onSuccess) {
630         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
631         return;
632     }
633
634     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
635     if (!onFailure) {
636         delete onSuccess;
637         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
638         return;
639     }
640
641     CHIP_ERROR err = self.cppCluster.BarrierControlGoToPercent(onSuccess->Cancel(), onFailure->Cancel(), percentOpen);
642     if (err != CHIP_NO_ERROR) {
643         delete onSuccess;
644         delete onFailure;
645         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
646     }
647 }
648 - (void)barrierControlStop:(ResponseHandler)completionHandler
649 {
650     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
651     if (!onSuccess) {
652         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
653         return;
654     }
655
656     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
657     if (!onFailure) {
658         delete onSuccess;
659         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
660         return;
661     }
662
663     CHIP_ERROR err = self.cppCluster.BarrierControlStop(onSuccess->Cancel(), onFailure->Cancel());
664     if (err != CHIP_NO_ERROR) {
665         delete onSuccess;
666         delete onFailure;
667         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
668     }
669 }
670
671 - (void)readAttributeBarrierMovingState:(ResponseHandler)completionHandler
672 {
673     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
674     if (!onSuccess) {
675         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
676         return;
677     }
678
679     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
680     if (!onFailure) {
681         delete onSuccess;
682         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
683         return;
684     }
685
686     CHIP_ERROR err = self.cppCluster.ReadAttributeBarrierMovingState(onSuccess->Cancel(), onFailure->Cancel());
687     if (err != CHIP_NO_ERROR) {
688         delete onSuccess;
689         delete onFailure;
690         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
691     }
692 }
693
694 - (void)readAttributeBarrierSafetyStatus:(ResponseHandler)completionHandler
695 {
696     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
697     if (!onSuccess) {
698         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
699         return;
700     }
701
702     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
703     if (!onFailure) {
704         delete onSuccess;
705         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
706         return;
707     }
708
709     CHIP_ERROR err = self.cppCluster.ReadAttributeBarrierSafetyStatus(onSuccess->Cancel(), onFailure->Cancel());
710     if (err != CHIP_NO_ERROR) {
711         delete onSuccess;
712         delete onFailure;
713         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
714     }
715 }
716
717 - (void)readAttributeBarrierCapabilities:(ResponseHandler)completionHandler
718 {
719     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
720     if (!onSuccess) {
721         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
722         return;
723     }
724
725     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
726     if (!onFailure) {
727         delete onSuccess;
728         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
729         return;
730     }
731
732     CHIP_ERROR err = self.cppCluster.ReadAttributeBarrierCapabilities(onSuccess->Cancel(), onFailure->Cancel());
733     if (err != CHIP_NO_ERROR) {
734         delete onSuccess;
735         delete onFailure;
736         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
737     }
738 }
739
740 - (void)readAttributeBarrierPosition:(ResponseHandler)completionHandler
741 {
742     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
743     if (!onSuccess) {
744         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
745         return;
746     }
747
748     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
749     if (!onFailure) {
750         delete onSuccess;
751         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
752         return;
753     }
754
755     CHIP_ERROR err = self.cppCluster.ReadAttributeBarrierPosition(onSuccess->Cancel(), onFailure->Cancel());
756     if (err != CHIP_NO_ERROR) {
757         delete onSuccess;
758         delete onFailure;
759         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
760     }
761 }
762
763 - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
764 {
765     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
766     if (!onSuccess) {
767         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
768         return;
769     }
770
771     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
772     if (!onFailure) {
773         delete onSuccess;
774         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
775         return;
776     }
777
778     CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
779     if (err != CHIP_NO_ERROR) {
780         delete onSuccess;
781         delete onFailure;
782         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
783     }
784 }
785
786 @end
787
788 @interface CHIPBarrierControl ()
789 @property (readonly) Controller::BarrierControlCluster cppCluster;
790 @end
791
792 @implementation CHIPBarrierControl
793
794 - (Controller::ClusterBase *)getCluster
795 {
796     return &_cppCluster;
797 }
798
799 - (void)barrierControlGoToPercent:(uint8_t)percentOpen completionHandler:(ResponseHandler)completionHandler
800 {
801     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
802     if (!onSuccess) {
803         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
804         return;
805     }
806
807     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
808     if (!onFailure) {
809         delete onSuccess;
810         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
811         return;
812     }
813
814     CHIP_ERROR err = self.cppCluster.BarrierControlGoToPercent(onSuccess->Cancel(), onFailure->Cancel(), percentOpen);
815     if (err != CHIP_NO_ERROR) {
816         delete onSuccess;
817         delete onFailure;
818         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
819     }
820 }
821 - (void)barrierControlStop:(ResponseHandler)completionHandler
822 {
823     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
824     if (!onSuccess) {
825         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
826         return;
827     }
828
829     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
830     if (!onFailure) {
831         delete onSuccess;
832         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
833         return;
834     }
835
836     CHIP_ERROR err = self.cppCluster.BarrierControlStop(onSuccess->Cancel(), onFailure->Cancel());
837     if (err != CHIP_NO_ERROR) {
838         delete onSuccess;
839         delete onFailure;
840         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
841     }
842 }
843
844 - (void)readAttributeBarrierMovingState:(ResponseHandler)completionHandler
845 {
846     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
847     if (!onSuccess) {
848         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
849         return;
850     }
851
852     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
853     if (!onFailure) {
854         delete onSuccess;
855         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
856         return;
857     }
858
859     CHIP_ERROR err = self.cppCluster.ReadAttributeBarrierMovingState(onSuccess->Cancel(), onFailure->Cancel());
860     if (err != CHIP_NO_ERROR) {
861         delete onSuccess;
862         delete onFailure;
863         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
864     }
865 }
866
867 - (void)readAttributeBarrierSafetyStatus:(ResponseHandler)completionHandler
868 {
869     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
870     if (!onSuccess) {
871         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
872         return;
873     }
874
875     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
876     if (!onFailure) {
877         delete onSuccess;
878         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
879         return;
880     }
881
882     CHIP_ERROR err = self.cppCluster.ReadAttributeBarrierSafetyStatus(onSuccess->Cancel(), onFailure->Cancel());
883     if (err != CHIP_NO_ERROR) {
884         delete onSuccess;
885         delete onFailure;
886         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
887     }
888 }
889
890 - (void)readAttributeBarrierCapabilities:(ResponseHandler)completionHandler
891 {
892     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
893     if (!onSuccess) {
894         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
895         return;
896     }
897
898     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
899     if (!onFailure) {
900         delete onSuccess;
901         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
902         return;
903     }
904
905     CHIP_ERROR err = self.cppCluster.ReadAttributeBarrierCapabilities(onSuccess->Cancel(), onFailure->Cancel());
906     if (err != CHIP_NO_ERROR) {
907         delete onSuccess;
908         delete onFailure;
909         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
910     }
911 }
912
913 - (void)readAttributeBarrierPosition:(ResponseHandler)completionHandler
914 {
915     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
916     if (!onSuccess) {
917         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
918         return;
919     }
920
921     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
922     if (!onFailure) {
923         delete onSuccess;
924         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
925         return;
926     }
927
928     CHIP_ERROR err = self.cppCluster.ReadAttributeBarrierPosition(onSuccess->Cancel(), onFailure->Cancel());
929     if (err != CHIP_NO_ERROR) {
930         delete onSuccess;
931         delete onFailure;
932         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
933     }
934 }
935
936 - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
937 {
938     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
939     if (!onSuccess) {
940         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
941         return;
942     }
943
944     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
945     if (!onFailure) {
946         delete onSuccess;
947         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
948         return;
949     }
950
951     CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
952     if (err != CHIP_NO_ERROR) {
953         delete onSuccess;
954         delete onFailure;
955         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
956     }
957 }
958
959 @end
960
961 @interface CHIPBasic ()
962 @property (readonly) Controller::BasicCluster cppCluster;
963 @end
964
965 @implementation CHIPBasic
966
967 - (Controller::ClusterBase *)getCluster
968 {
969     return &_cppCluster;
970 }
971
972 - (void)readAttributeInteractionModelVersion:(ResponseHandler)completionHandler
973 {
974     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
975     if (!onSuccess) {
976         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
977         return;
978     }
979
980     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
981     if (!onFailure) {
982         delete onSuccess;
983         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
984         return;
985     }
986
987     CHIP_ERROR err = self.cppCluster.ReadAttributeInteractionModelVersion(onSuccess->Cancel(), onFailure->Cancel());
988     if (err != CHIP_NO_ERROR) {
989         delete onSuccess;
990         delete onFailure;
991         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
992     }
993 }
994
995 - (void)readAttributeVendorName:(ResponseHandler)completionHandler
996 {
997     CHIPStringAttributeCallbackBridge * onSuccess
998         = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
999     if (!onSuccess) {
1000         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1001         return;
1002     }
1003
1004     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1005     if (!onFailure) {
1006         delete onSuccess;
1007         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1008         return;
1009     }
1010
1011     CHIP_ERROR err = self.cppCluster.ReadAttributeVendorName(onSuccess->Cancel(), onFailure->Cancel());
1012     if (err != CHIP_NO_ERROR) {
1013         delete onSuccess;
1014         delete onFailure;
1015         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1016     }
1017 }
1018
1019 - (void)readAttributeVendorID:(ResponseHandler)completionHandler
1020 {
1021     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
1022     if (!onSuccess) {
1023         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1024         return;
1025     }
1026
1027     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1028     if (!onFailure) {
1029         delete onSuccess;
1030         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1031         return;
1032     }
1033
1034     CHIP_ERROR err = self.cppCluster.ReadAttributeVendorID(onSuccess->Cancel(), onFailure->Cancel());
1035     if (err != CHIP_NO_ERROR) {
1036         delete onSuccess;
1037         delete onFailure;
1038         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1039     }
1040 }
1041
1042 - (void)readAttributeProductName:(ResponseHandler)completionHandler
1043 {
1044     CHIPStringAttributeCallbackBridge * onSuccess
1045         = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
1046     if (!onSuccess) {
1047         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1048         return;
1049     }
1050
1051     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1052     if (!onFailure) {
1053         delete onSuccess;
1054         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1055         return;
1056     }
1057
1058     CHIP_ERROR err = self.cppCluster.ReadAttributeProductName(onSuccess->Cancel(), onFailure->Cancel());
1059     if (err != CHIP_NO_ERROR) {
1060         delete onSuccess;
1061         delete onFailure;
1062         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1063     }
1064 }
1065
1066 - (void)readAttributeProductID:(ResponseHandler)completionHandler
1067 {
1068     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
1069     if (!onSuccess) {
1070         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1071         return;
1072     }
1073
1074     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1075     if (!onFailure) {
1076         delete onSuccess;
1077         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1078         return;
1079     }
1080
1081     CHIP_ERROR err = self.cppCluster.ReadAttributeProductID(onSuccess->Cancel(), onFailure->Cancel());
1082     if (err != CHIP_NO_ERROR) {
1083         delete onSuccess;
1084         delete onFailure;
1085         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1086     }
1087 }
1088
1089 - (void)readAttributeUserLabel:(ResponseHandler)completionHandler
1090 {
1091     CHIPStringAttributeCallbackBridge * onSuccess
1092         = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
1093     if (!onSuccess) {
1094         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1095         return;
1096     }
1097
1098     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1099     if (!onFailure) {
1100         delete onSuccess;
1101         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1102         return;
1103     }
1104
1105     CHIP_ERROR err = self.cppCluster.ReadAttributeUserLabel(onSuccess->Cancel(), onFailure->Cancel());
1106     if (err != CHIP_NO_ERROR) {
1107         delete onSuccess;
1108         delete onFailure;
1109         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1110     }
1111 }
1112
1113 - (void)writeAttributeUserLabel:(NSString *)value completionHandler:(ResponseHandler)completionHandler
1114 {
1115     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1116     if (!onSuccess) {
1117         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1118         return;
1119     }
1120
1121     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1122     if (!onFailure) {
1123         delete onSuccess;
1124         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1125         return;
1126     }
1127
1128     NSData * data = [value dataUsingEncoding:NSUTF8StringEncoding];
1129     CHIP_ERROR err = self.cppCluster.WriteAttributeUserLabel(
1130         onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t *) data.bytes, data.length));
1131     if (err != CHIP_NO_ERROR) {
1132         delete onSuccess;
1133         delete onFailure;
1134         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1135     }
1136 }
1137
1138 - (void)readAttributeLocation:(ResponseHandler)completionHandler
1139 {
1140     CHIPStringAttributeCallbackBridge * onSuccess
1141         = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
1142     if (!onSuccess) {
1143         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1144         return;
1145     }
1146
1147     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1148     if (!onFailure) {
1149         delete onSuccess;
1150         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1151         return;
1152     }
1153
1154     CHIP_ERROR err = self.cppCluster.ReadAttributeLocation(onSuccess->Cancel(), onFailure->Cancel());
1155     if (err != CHIP_NO_ERROR) {
1156         delete onSuccess;
1157         delete onFailure;
1158         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1159     }
1160 }
1161
1162 - (void)writeAttributeLocation:(NSString *)value completionHandler:(ResponseHandler)completionHandler
1163 {
1164     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1165     if (!onSuccess) {
1166         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1167         return;
1168     }
1169
1170     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1171     if (!onFailure) {
1172         delete onSuccess;
1173         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1174         return;
1175     }
1176
1177     NSData * data = [value dataUsingEncoding:NSUTF8StringEncoding];
1178     CHIP_ERROR err = self.cppCluster.WriteAttributeLocation(
1179         onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t *) data.bytes, data.length));
1180     if (err != CHIP_NO_ERROR) {
1181         delete onSuccess;
1182         delete onFailure;
1183         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1184     }
1185 }
1186
1187 - (void)readAttributeHardwareVersion:(ResponseHandler)completionHandler
1188 {
1189     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
1190     if (!onSuccess) {
1191         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1192         return;
1193     }
1194
1195     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1196     if (!onFailure) {
1197         delete onSuccess;
1198         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1199         return;
1200     }
1201
1202     CHIP_ERROR err = self.cppCluster.ReadAttributeHardwareVersion(onSuccess->Cancel(), onFailure->Cancel());
1203     if (err != CHIP_NO_ERROR) {
1204         delete onSuccess;
1205         delete onFailure;
1206         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1207     }
1208 }
1209
1210 - (void)readAttributeHardwareVersionString:(ResponseHandler)completionHandler
1211 {
1212     CHIPStringAttributeCallbackBridge * onSuccess
1213         = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
1214     if (!onSuccess) {
1215         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1216         return;
1217     }
1218
1219     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1220     if (!onFailure) {
1221         delete onSuccess;
1222         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1223         return;
1224     }
1225
1226     CHIP_ERROR err = self.cppCluster.ReadAttributeHardwareVersionString(onSuccess->Cancel(), onFailure->Cancel());
1227     if (err != CHIP_NO_ERROR) {
1228         delete onSuccess;
1229         delete onFailure;
1230         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1231     }
1232 }
1233
1234 - (void)readAttributeSoftwareVersion:(ResponseHandler)completionHandler
1235 {
1236     CHIPInt32uAttributeCallbackBridge * onSuccess = new CHIPInt32uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
1237     if (!onSuccess) {
1238         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1239         return;
1240     }
1241
1242     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1243     if (!onFailure) {
1244         delete onSuccess;
1245         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1246         return;
1247     }
1248
1249     CHIP_ERROR err = self.cppCluster.ReadAttributeSoftwareVersion(onSuccess->Cancel(), onFailure->Cancel());
1250     if (err != CHIP_NO_ERROR) {
1251         delete onSuccess;
1252         delete onFailure;
1253         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1254     }
1255 }
1256
1257 - (void)readAttributeSoftwareVersionString:(ResponseHandler)completionHandler
1258 {
1259     CHIPStringAttributeCallbackBridge * onSuccess
1260         = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
1261     if (!onSuccess) {
1262         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1263         return;
1264     }
1265
1266     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1267     if (!onFailure) {
1268         delete onSuccess;
1269         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1270         return;
1271     }
1272
1273     CHIP_ERROR err = self.cppCluster.ReadAttributeSoftwareVersionString(onSuccess->Cancel(), onFailure->Cancel());
1274     if (err != CHIP_NO_ERROR) {
1275         delete onSuccess;
1276         delete onFailure;
1277         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1278     }
1279 }
1280
1281 - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
1282 {
1283     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
1284     if (!onSuccess) {
1285         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1286         return;
1287     }
1288
1289     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1290     if (!onFailure) {
1291         delete onSuccess;
1292         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1293         return;
1294     }
1295
1296     CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
1297     if (err != CHIP_NO_ERROR) {
1298         delete onSuccess;
1299         delete onFailure;
1300         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1301     }
1302 }
1303
1304 @end
1305
1306 @interface CHIPColorControl ()
1307 @property (readonly) Controller::ColorControlCluster cppCluster;
1308 @end
1309
1310 @implementation CHIPColorControl
1311
1312 - (Controller::ClusterBase *)getCluster
1313 {
1314     return &_cppCluster;
1315 }
1316
1317 - (void)moveColor:(int16_t)rateX
1318                 rateY:(int16_t)rateY
1319           optionsMask:(uint8_t)optionsMask
1320       optionsOverride:(uint8_t)optionsOverride
1321     completionHandler:(ResponseHandler)completionHandler
1322 {
1323     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1324     if (!onSuccess) {
1325         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1326         return;
1327     }
1328
1329     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1330     if (!onFailure) {
1331         delete onSuccess;
1332         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1333         return;
1334     }
1335
1336     CHIP_ERROR err
1337         = self.cppCluster.MoveColor(onSuccess->Cancel(), onFailure->Cancel(), rateX, rateY, optionsMask, optionsOverride);
1338     if (err != CHIP_NO_ERROR) {
1339         delete onSuccess;
1340         delete onFailure;
1341         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1342     }
1343 }
1344 - (void)moveColorTemperature:(uint8_t)moveMode
1345                         rate:(uint16_t)rate
1346      colorTemperatureMinimum:(uint16_t)colorTemperatureMinimum
1347      colorTemperatureMaximum:(uint16_t)colorTemperatureMaximum
1348                  optionsMask:(uint8_t)optionsMask
1349              optionsOverride:(uint8_t)optionsOverride
1350            completionHandler:(ResponseHandler)completionHandler
1351 {
1352     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1353     if (!onSuccess) {
1354         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1355         return;
1356     }
1357
1358     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1359     if (!onFailure) {
1360         delete onSuccess;
1361         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1362         return;
1363     }
1364
1365     CHIP_ERROR err = self.cppCluster.MoveColorTemperature(onSuccess->Cancel(), onFailure->Cancel(), moveMode, rate,
1366         colorTemperatureMinimum, colorTemperatureMaximum, optionsMask, optionsOverride);
1367     if (err != CHIP_NO_ERROR) {
1368         delete onSuccess;
1369         delete onFailure;
1370         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1371     }
1372 }
1373 - (void)moveHue:(uint8_t)moveMode
1374                  rate:(uint8_t)rate
1375           optionsMask:(uint8_t)optionsMask
1376       optionsOverride:(uint8_t)optionsOverride
1377     completionHandler:(ResponseHandler)completionHandler
1378 {
1379     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1380     if (!onSuccess) {
1381         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1382         return;
1383     }
1384
1385     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1386     if (!onFailure) {
1387         delete onSuccess;
1388         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1389         return;
1390     }
1391
1392     CHIP_ERROR err
1393         = self.cppCluster.MoveHue(onSuccess->Cancel(), onFailure->Cancel(), moveMode, rate, optionsMask, optionsOverride);
1394     if (err != CHIP_NO_ERROR) {
1395         delete onSuccess;
1396         delete onFailure;
1397         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1398     }
1399 }
1400 - (void)moveSaturation:(uint8_t)moveMode
1401                   rate:(uint8_t)rate
1402            optionsMask:(uint8_t)optionsMask
1403        optionsOverride:(uint8_t)optionsOverride
1404      completionHandler:(ResponseHandler)completionHandler
1405 {
1406     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1407     if (!onSuccess) {
1408         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1409         return;
1410     }
1411
1412     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1413     if (!onFailure) {
1414         delete onSuccess;
1415         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1416         return;
1417     }
1418
1419     CHIP_ERROR err
1420         = self.cppCluster.MoveSaturation(onSuccess->Cancel(), onFailure->Cancel(), moveMode, rate, optionsMask, optionsOverride);
1421     if (err != CHIP_NO_ERROR) {
1422         delete onSuccess;
1423         delete onFailure;
1424         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1425     }
1426 }
1427 - (void)moveToColor:(uint16_t)colorX
1428                colorY:(uint16_t)colorY
1429        transitionTime:(uint16_t)transitionTime
1430           optionsMask:(uint8_t)optionsMask
1431       optionsOverride:(uint8_t)optionsOverride
1432     completionHandler:(ResponseHandler)completionHandler
1433 {
1434     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1435     if (!onSuccess) {
1436         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1437         return;
1438     }
1439
1440     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1441     if (!onFailure) {
1442         delete onSuccess;
1443         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1444         return;
1445     }
1446
1447     CHIP_ERROR err = self.cppCluster.MoveToColor(
1448         onSuccess->Cancel(), onFailure->Cancel(), colorX, colorY, transitionTime, optionsMask, optionsOverride);
1449     if (err != CHIP_NO_ERROR) {
1450         delete onSuccess;
1451         delete onFailure;
1452         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1453     }
1454 }
1455 - (void)moveToColorTemperature:(uint16_t)colorTemperature
1456                 transitionTime:(uint16_t)transitionTime
1457                    optionsMask:(uint8_t)optionsMask
1458                optionsOverride:(uint8_t)optionsOverride
1459              completionHandler:(ResponseHandler)completionHandler
1460 {
1461     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1462     if (!onSuccess) {
1463         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1464         return;
1465     }
1466
1467     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1468     if (!onFailure) {
1469         delete onSuccess;
1470         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1471         return;
1472     }
1473
1474     CHIP_ERROR err = self.cppCluster.MoveToColorTemperature(
1475         onSuccess->Cancel(), onFailure->Cancel(), colorTemperature, transitionTime, optionsMask, optionsOverride);
1476     if (err != CHIP_NO_ERROR) {
1477         delete onSuccess;
1478         delete onFailure;
1479         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1480     }
1481 }
1482 - (void)moveToHue:(uint8_t)hue
1483             direction:(uint8_t)direction
1484        transitionTime:(uint16_t)transitionTime
1485           optionsMask:(uint8_t)optionsMask
1486       optionsOverride:(uint8_t)optionsOverride
1487     completionHandler:(ResponseHandler)completionHandler
1488 {
1489     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1490     if (!onSuccess) {
1491         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1492         return;
1493     }
1494
1495     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1496     if (!onFailure) {
1497         delete onSuccess;
1498         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1499         return;
1500     }
1501
1502     CHIP_ERROR err = self.cppCluster.MoveToHue(
1503         onSuccess->Cancel(), onFailure->Cancel(), hue, direction, transitionTime, optionsMask, optionsOverride);
1504     if (err != CHIP_NO_ERROR) {
1505         delete onSuccess;
1506         delete onFailure;
1507         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1508     }
1509 }
1510 - (void)moveToHueAndSaturation:(uint8_t)hue
1511                     saturation:(uint8_t)saturation
1512                 transitionTime:(uint16_t)transitionTime
1513                    optionsMask:(uint8_t)optionsMask
1514                optionsOverride:(uint8_t)optionsOverride
1515              completionHandler:(ResponseHandler)completionHandler
1516 {
1517     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1518     if (!onSuccess) {
1519         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1520         return;
1521     }
1522
1523     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1524     if (!onFailure) {
1525         delete onSuccess;
1526         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1527         return;
1528     }
1529
1530     CHIP_ERROR err = self.cppCluster.MoveToHueAndSaturation(
1531         onSuccess->Cancel(), onFailure->Cancel(), hue, saturation, transitionTime, optionsMask, optionsOverride);
1532     if (err != CHIP_NO_ERROR) {
1533         delete onSuccess;
1534         delete onFailure;
1535         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1536     }
1537 }
1538 - (void)moveToSaturation:(uint8_t)saturation
1539           transitionTime:(uint16_t)transitionTime
1540              optionsMask:(uint8_t)optionsMask
1541          optionsOverride:(uint8_t)optionsOverride
1542        completionHandler:(ResponseHandler)completionHandler
1543 {
1544     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1545     if (!onSuccess) {
1546         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1547         return;
1548     }
1549
1550     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1551     if (!onFailure) {
1552         delete onSuccess;
1553         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1554         return;
1555     }
1556
1557     CHIP_ERROR err = self.cppCluster.MoveToSaturation(
1558         onSuccess->Cancel(), onFailure->Cancel(), saturation, transitionTime, optionsMask, optionsOverride);
1559     if (err != CHIP_NO_ERROR) {
1560         delete onSuccess;
1561         delete onFailure;
1562         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1563     }
1564 }
1565 - (void)stepColor:(int16_t)stepX
1566                 stepY:(int16_t)stepY
1567        transitionTime:(uint16_t)transitionTime
1568           optionsMask:(uint8_t)optionsMask
1569       optionsOverride:(uint8_t)optionsOverride
1570     completionHandler:(ResponseHandler)completionHandler
1571 {
1572     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1573     if (!onSuccess) {
1574         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1575         return;
1576     }
1577
1578     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1579     if (!onFailure) {
1580         delete onSuccess;
1581         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1582         return;
1583     }
1584
1585     CHIP_ERROR err = self.cppCluster.StepColor(
1586         onSuccess->Cancel(), onFailure->Cancel(), stepX, stepY, transitionTime, optionsMask, optionsOverride);
1587     if (err != CHIP_NO_ERROR) {
1588         delete onSuccess;
1589         delete onFailure;
1590         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1591     }
1592 }
1593 - (void)stepColorTemperature:(uint8_t)stepMode
1594                     stepSize:(uint16_t)stepSize
1595               transitionTime:(uint16_t)transitionTime
1596      colorTemperatureMinimum:(uint16_t)colorTemperatureMinimum
1597      colorTemperatureMaximum:(uint16_t)colorTemperatureMaximum
1598                  optionsMask:(uint8_t)optionsMask
1599              optionsOverride:(uint8_t)optionsOverride
1600            completionHandler:(ResponseHandler)completionHandler
1601 {
1602     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1603     if (!onSuccess) {
1604         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1605         return;
1606     }
1607
1608     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1609     if (!onFailure) {
1610         delete onSuccess;
1611         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1612         return;
1613     }
1614
1615     CHIP_ERROR err = self.cppCluster.StepColorTemperature(onSuccess->Cancel(), onFailure->Cancel(), stepMode, stepSize,
1616         transitionTime, colorTemperatureMinimum, colorTemperatureMaximum, optionsMask, optionsOverride);
1617     if (err != CHIP_NO_ERROR) {
1618         delete onSuccess;
1619         delete onFailure;
1620         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1621     }
1622 }
1623 - (void)stepHue:(uint8_t)stepMode
1624              stepSize:(uint8_t)stepSize
1625        transitionTime:(uint8_t)transitionTime
1626           optionsMask:(uint8_t)optionsMask
1627       optionsOverride:(uint8_t)optionsOverride
1628     completionHandler:(ResponseHandler)completionHandler
1629 {
1630     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1631     if (!onSuccess) {
1632         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1633         return;
1634     }
1635
1636     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1637     if (!onFailure) {
1638         delete onSuccess;
1639         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1640         return;
1641     }
1642
1643     CHIP_ERROR err = self.cppCluster.StepHue(
1644         onSuccess->Cancel(), onFailure->Cancel(), stepMode, stepSize, transitionTime, optionsMask, optionsOverride);
1645     if (err != CHIP_NO_ERROR) {
1646         delete onSuccess;
1647         delete onFailure;
1648         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1649     }
1650 }
1651 - (void)stepSaturation:(uint8_t)stepMode
1652               stepSize:(uint8_t)stepSize
1653         transitionTime:(uint8_t)transitionTime
1654            optionsMask:(uint8_t)optionsMask
1655        optionsOverride:(uint8_t)optionsOverride
1656      completionHandler:(ResponseHandler)completionHandler
1657 {
1658     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1659     if (!onSuccess) {
1660         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1661         return;
1662     }
1663
1664     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1665     if (!onFailure) {
1666         delete onSuccess;
1667         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1668         return;
1669     }
1670
1671     CHIP_ERROR err = self.cppCluster.StepSaturation(
1672         onSuccess->Cancel(), onFailure->Cancel(), stepMode, stepSize, transitionTime, optionsMask, optionsOverride);
1673     if (err != CHIP_NO_ERROR) {
1674         delete onSuccess;
1675         delete onFailure;
1676         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1677     }
1678 }
1679 - (void)stopMoveStep:(uint8_t)optionsMask
1680       optionsOverride:(uint8_t)optionsOverride
1681     completionHandler:(ResponseHandler)completionHandler
1682 {
1683     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1684     if (!onSuccess) {
1685         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1686         return;
1687     }
1688
1689     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1690     if (!onFailure) {
1691         delete onSuccess;
1692         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1693         return;
1694     }
1695
1696     CHIP_ERROR err = self.cppCluster.StopMoveStep(onSuccess->Cancel(), onFailure->Cancel(), optionsMask, optionsOverride);
1697     if (err != CHIP_NO_ERROR) {
1698         delete onSuccess;
1699         delete onFailure;
1700         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1701     }
1702 }
1703
1704 - (void)readAttributeCurrentHue:(ResponseHandler)completionHandler
1705 {
1706     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
1707     if (!onSuccess) {
1708         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1709         return;
1710     }
1711
1712     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1713     if (!onFailure) {
1714         delete onSuccess;
1715         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1716         return;
1717     }
1718
1719     CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentHue(onSuccess->Cancel(), onFailure->Cancel());
1720     if (err != CHIP_NO_ERROR) {
1721         delete onSuccess;
1722         delete onFailure;
1723         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1724     }
1725 }
1726
1727 - (void)configureAttributeCurrentHue:(uint16_t)minInterval
1728                          maxInterval:(uint16_t)maxInterval
1729                               change:(uint8_t)change
1730                    completionHandler:(ResponseHandler)completionHandler
1731 {
1732     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1733     if (!onSuccess) {
1734         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1735         return;
1736     }
1737
1738     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1739     if (!onFailure) {
1740         delete onSuccess;
1741         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1742         return;
1743     }
1744
1745     CHIP_ERROR err
1746         = self.cppCluster.ConfigureAttributeCurrentHue(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
1747     if (err != CHIP_NO_ERROR) {
1748         delete onSuccess;
1749         delete onFailure;
1750         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1751     }
1752 }
1753
1754 - (void)reportAttributeCurrentHue:(ResponseHandler)reportHandler
1755 {
1756     CHIPInt8uAttributeCallbackBridge * onReport = new CHIPInt8uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
1757     if (!onReport) {
1758         reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1759         return;
1760     }
1761
1762     CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentHue(onReport->Cancel());
1763     if (err != CHIP_NO_ERROR) {
1764         delete onReport;
1765         reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
1766     }
1767 }
1768
1769 - (void)readAttributeCurrentSaturation:(ResponseHandler)completionHandler
1770 {
1771     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
1772     if (!onSuccess) {
1773         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1774         return;
1775     }
1776
1777     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1778     if (!onFailure) {
1779         delete onSuccess;
1780         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1781         return;
1782     }
1783
1784     CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentSaturation(onSuccess->Cancel(), onFailure->Cancel());
1785     if (err != CHIP_NO_ERROR) {
1786         delete onSuccess;
1787         delete onFailure;
1788         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1789     }
1790 }
1791
1792 - (void)configureAttributeCurrentSaturation:(uint16_t)minInterval
1793                                 maxInterval:(uint16_t)maxInterval
1794                                      change:(uint8_t)change
1795                           completionHandler:(ResponseHandler)completionHandler
1796 {
1797     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1798     if (!onSuccess) {
1799         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1800         return;
1801     }
1802
1803     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1804     if (!onFailure) {
1805         delete onSuccess;
1806         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1807         return;
1808     }
1809
1810     CHIP_ERROR err = self.cppCluster.ConfigureAttributeCurrentSaturation(
1811         onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
1812     if (err != CHIP_NO_ERROR) {
1813         delete onSuccess;
1814         delete onFailure;
1815         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1816     }
1817 }
1818
1819 - (void)reportAttributeCurrentSaturation:(ResponseHandler)reportHandler
1820 {
1821     CHIPInt8uAttributeCallbackBridge * onReport = new CHIPInt8uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
1822     if (!onReport) {
1823         reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1824         return;
1825     }
1826
1827     CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentSaturation(onReport->Cancel());
1828     if (err != CHIP_NO_ERROR) {
1829         delete onReport;
1830         reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
1831     }
1832 }
1833
1834 - (void)readAttributeRemainingTime:(ResponseHandler)completionHandler
1835 {
1836     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
1837     if (!onSuccess) {
1838         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1839         return;
1840     }
1841
1842     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1843     if (!onFailure) {
1844         delete onSuccess;
1845         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1846         return;
1847     }
1848
1849     CHIP_ERROR err = self.cppCluster.ReadAttributeRemainingTime(onSuccess->Cancel(), onFailure->Cancel());
1850     if (err != CHIP_NO_ERROR) {
1851         delete onSuccess;
1852         delete onFailure;
1853         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1854     }
1855 }
1856
1857 - (void)readAttributeCurrentX:(ResponseHandler)completionHandler
1858 {
1859     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
1860     if (!onSuccess) {
1861         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1862         return;
1863     }
1864
1865     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1866     if (!onFailure) {
1867         delete onSuccess;
1868         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1869         return;
1870     }
1871
1872     CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentX(onSuccess->Cancel(), onFailure->Cancel());
1873     if (err != CHIP_NO_ERROR) {
1874         delete onSuccess;
1875         delete onFailure;
1876         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1877     }
1878 }
1879
1880 - (void)configureAttributeCurrentX:(uint16_t)minInterval
1881                        maxInterval:(uint16_t)maxInterval
1882                             change:(uint16_t)change
1883                  completionHandler:(ResponseHandler)completionHandler
1884 {
1885     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1886     if (!onSuccess) {
1887         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1888         return;
1889     }
1890
1891     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1892     if (!onFailure) {
1893         delete onSuccess;
1894         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1895         return;
1896     }
1897
1898     CHIP_ERROR err
1899         = self.cppCluster.ConfigureAttributeCurrentX(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
1900     if (err != CHIP_NO_ERROR) {
1901         delete onSuccess;
1902         delete onFailure;
1903         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1904     }
1905 }
1906
1907 - (void)reportAttributeCurrentX:(ResponseHandler)reportHandler
1908 {
1909     CHIPInt16uAttributeCallbackBridge * onReport = new CHIPInt16uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
1910     if (!onReport) {
1911         reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1912         return;
1913     }
1914
1915     CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentX(onReport->Cancel());
1916     if (err != CHIP_NO_ERROR) {
1917         delete onReport;
1918         reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
1919     }
1920 }
1921
1922 - (void)readAttributeCurrentY:(ResponseHandler)completionHandler
1923 {
1924     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
1925     if (!onSuccess) {
1926         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1927         return;
1928     }
1929
1930     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1931     if (!onFailure) {
1932         delete onSuccess;
1933         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1934         return;
1935     }
1936
1937     CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentY(onSuccess->Cancel(), onFailure->Cancel());
1938     if (err != CHIP_NO_ERROR) {
1939         delete onSuccess;
1940         delete onFailure;
1941         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1942     }
1943 }
1944
1945 - (void)configureAttributeCurrentY:(uint16_t)minInterval
1946                        maxInterval:(uint16_t)maxInterval
1947                             change:(uint16_t)change
1948                  completionHandler:(ResponseHandler)completionHandler
1949 {
1950     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1951     if (!onSuccess) {
1952         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1953         return;
1954     }
1955
1956     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1957     if (!onFailure) {
1958         delete onSuccess;
1959         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1960         return;
1961     }
1962
1963     CHIP_ERROR err
1964         = self.cppCluster.ConfigureAttributeCurrentY(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
1965     if (err != CHIP_NO_ERROR) {
1966         delete onSuccess;
1967         delete onFailure;
1968         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1969     }
1970 }
1971
1972 - (void)reportAttributeCurrentY:(ResponseHandler)reportHandler
1973 {
1974     CHIPInt16uAttributeCallbackBridge * onReport = new CHIPInt16uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
1975     if (!onReport) {
1976         reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1977         return;
1978     }
1979
1980     CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentY(onReport->Cancel());
1981     if (err != CHIP_NO_ERROR) {
1982         delete onReport;
1983         reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
1984     }
1985 }
1986
1987 - (void)readAttributeDriftCompensation:(ResponseHandler)completionHandler
1988 {
1989     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
1990     if (!onSuccess) {
1991         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1992         return;
1993     }
1994
1995     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1996     if (!onFailure) {
1997         delete onSuccess;
1998         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1999         return;
2000     }
2001
2002     CHIP_ERROR err = self.cppCluster.ReadAttributeDriftCompensation(onSuccess->Cancel(), onFailure->Cancel());
2003     if (err != CHIP_NO_ERROR) {
2004         delete onSuccess;
2005         delete onFailure;
2006         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2007     }
2008 }
2009
2010 - (void)readAttributeCompensationText:(ResponseHandler)completionHandler
2011 {
2012     CHIPStringAttributeCallbackBridge * onSuccess
2013         = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
2014     if (!onSuccess) {
2015         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2016         return;
2017     }
2018
2019     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2020     if (!onFailure) {
2021         delete onSuccess;
2022         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2023         return;
2024     }
2025
2026     CHIP_ERROR err = self.cppCluster.ReadAttributeCompensationText(onSuccess->Cancel(), onFailure->Cancel());
2027     if (err != CHIP_NO_ERROR) {
2028         delete onSuccess;
2029         delete onFailure;
2030         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2031     }
2032 }
2033
2034 - (void)readAttributeColorTemperature:(ResponseHandler)completionHandler
2035 {
2036     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2037     if (!onSuccess) {
2038         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2039         return;
2040     }
2041
2042     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2043     if (!onFailure) {
2044         delete onSuccess;
2045         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2046         return;
2047     }
2048
2049     CHIP_ERROR err = self.cppCluster.ReadAttributeColorTemperature(onSuccess->Cancel(), onFailure->Cancel());
2050     if (err != CHIP_NO_ERROR) {
2051         delete onSuccess;
2052         delete onFailure;
2053         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2054     }
2055 }
2056
2057 - (void)configureAttributeColorTemperature:(uint16_t)minInterval
2058                                maxInterval:(uint16_t)maxInterval
2059                                     change:(uint16_t)change
2060                          completionHandler:(ResponseHandler)completionHandler
2061 {
2062     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
2063     if (!onSuccess) {
2064         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2065         return;
2066     }
2067
2068     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2069     if (!onFailure) {
2070         delete onSuccess;
2071         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2072         return;
2073     }
2074
2075     CHIP_ERROR err = self.cppCluster.ConfigureAttributeColorTemperature(
2076         onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
2077     if (err != CHIP_NO_ERROR) {
2078         delete onSuccess;
2079         delete onFailure;
2080         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2081     }
2082 }
2083
2084 - (void)reportAttributeColorTemperature:(ResponseHandler)reportHandler
2085 {
2086     CHIPInt16uAttributeCallbackBridge * onReport = new CHIPInt16uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
2087     if (!onReport) {
2088         reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2089         return;
2090     }
2091
2092     CHIP_ERROR err = self.cppCluster.ReportAttributeColorTemperature(onReport->Cancel());
2093     if (err != CHIP_NO_ERROR) {
2094         delete onReport;
2095         reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
2096     }
2097 }
2098
2099 - (void)readAttributeColorMode:(ResponseHandler)completionHandler
2100 {
2101     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2102     if (!onSuccess) {
2103         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2104         return;
2105     }
2106
2107     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2108     if (!onFailure) {
2109         delete onSuccess;
2110         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2111         return;
2112     }
2113
2114     CHIP_ERROR err = self.cppCluster.ReadAttributeColorMode(onSuccess->Cancel(), onFailure->Cancel());
2115     if (err != CHIP_NO_ERROR) {
2116         delete onSuccess;
2117         delete onFailure;
2118         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2119     }
2120 }
2121
2122 - (void)readAttributeColorControlOptions:(ResponseHandler)completionHandler
2123 {
2124     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2125     if (!onSuccess) {
2126         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2127         return;
2128     }
2129
2130     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2131     if (!onFailure) {
2132         delete onSuccess;
2133         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2134         return;
2135     }
2136
2137     CHIP_ERROR err = self.cppCluster.ReadAttributeColorControlOptions(onSuccess->Cancel(), onFailure->Cancel());
2138     if (err != CHIP_NO_ERROR) {
2139         delete onSuccess;
2140         delete onFailure;
2141         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2142     }
2143 }
2144
2145 - (void)writeAttributeColorControlOptions:(uint8_t)value completionHandler:(ResponseHandler)completionHandler
2146 {
2147     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
2148     if (!onSuccess) {
2149         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2150         return;
2151     }
2152
2153     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2154     if (!onFailure) {
2155         delete onSuccess;
2156         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2157         return;
2158     }
2159
2160     CHIP_ERROR err = self.cppCluster.WriteAttributeColorControlOptions(onSuccess->Cancel(), onFailure->Cancel(), value);
2161     if (err != CHIP_NO_ERROR) {
2162         delete onSuccess;
2163         delete onFailure;
2164         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2165     }
2166 }
2167
2168 - (void)readAttributeNumberOfPrimaries:(ResponseHandler)completionHandler
2169 {
2170     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2171     if (!onSuccess) {
2172         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2173         return;
2174     }
2175
2176     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2177     if (!onFailure) {
2178         delete onSuccess;
2179         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2180         return;
2181     }
2182
2183     CHIP_ERROR err = self.cppCluster.ReadAttributeNumberOfPrimaries(onSuccess->Cancel(), onFailure->Cancel());
2184     if (err != CHIP_NO_ERROR) {
2185         delete onSuccess;
2186         delete onFailure;
2187         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2188     }
2189 }
2190
2191 - (void)readAttributePrimary1X:(ResponseHandler)completionHandler
2192 {
2193     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2194     if (!onSuccess) {
2195         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2196         return;
2197     }
2198
2199     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2200     if (!onFailure) {
2201         delete onSuccess;
2202         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2203         return;
2204     }
2205
2206     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary1X(onSuccess->Cancel(), onFailure->Cancel());
2207     if (err != CHIP_NO_ERROR) {
2208         delete onSuccess;
2209         delete onFailure;
2210         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2211     }
2212 }
2213
2214 - (void)readAttributePrimary1Y:(ResponseHandler)completionHandler
2215 {
2216     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2217     if (!onSuccess) {
2218         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2219         return;
2220     }
2221
2222     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2223     if (!onFailure) {
2224         delete onSuccess;
2225         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2226         return;
2227     }
2228
2229     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary1Y(onSuccess->Cancel(), onFailure->Cancel());
2230     if (err != CHIP_NO_ERROR) {
2231         delete onSuccess;
2232         delete onFailure;
2233         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2234     }
2235 }
2236
2237 - (void)readAttributePrimary1Intensity:(ResponseHandler)completionHandler
2238 {
2239     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2240     if (!onSuccess) {
2241         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2242         return;
2243     }
2244
2245     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2246     if (!onFailure) {
2247         delete onSuccess;
2248         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2249         return;
2250     }
2251
2252     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary1Intensity(onSuccess->Cancel(), onFailure->Cancel());
2253     if (err != CHIP_NO_ERROR) {
2254         delete onSuccess;
2255         delete onFailure;
2256         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2257     }
2258 }
2259
2260 - (void)readAttributePrimary2X:(ResponseHandler)completionHandler
2261 {
2262     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2263     if (!onSuccess) {
2264         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2265         return;
2266     }
2267
2268     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2269     if (!onFailure) {
2270         delete onSuccess;
2271         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2272         return;
2273     }
2274
2275     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary2X(onSuccess->Cancel(), onFailure->Cancel());
2276     if (err != CHIP_NO_ERROR) {
2277         delete onSuccess;
2278         delete onFailure;
2279         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2280     }
2281 }
2282
2283 - (void)readAttributePrimary2Y:(ResponseHandler)completionHandler
2284 {
2285     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2286     if (!onSuccess) {
2287         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2288         return;
2289     }
2290
2291     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2292     if (!onFailure) {
2293         delete onSuccess;
2294         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2295         return;
2296     }
2297
2298     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary2Y(onSuccess->Cancel(), onFailure->Cancel());
2299     if (err != CHIP_NO_ERROR) {
2300         delete onSuccess;
2301         delete onFailure;
2302         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2303     }
2304 }
2305
2306 - (void)readAttributePrimary2Intensity:(ResponseHandler)completionHandler
2307 {
2308     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2309     if (!onSuccess) {
2310         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2311         return;
2312     }
2313
2314     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2315     if (!onFailure) {
2316         delete onSuccess;
2317         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2318         return;
2319     }
2320
2321     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary2Intensity(onSuccess->Cancel(), onFailure->Cancel());
2322     if (err != CHIP_NO_ERROR) {
2323         delete onSuccess;
2324         delete onFailure;
2325         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2326     }
2327 }
2328
2329 - (void)readAttributePrimary3X:(ResponseHandler)completionHandler
2330 {
2331     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2332     if (!onSuccess) {
2333         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2334         return;
2335     }
2336
2337     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2338     if (!onFailure) {
2339         delete onSuccess;
2340         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2341         return;
2342     }
2343
2344     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary3X(onSuccess->Cancel(), onFailure->Cancel());
2345     if (err != CHIP_NO_ERROR) {
2346         delete onSuccess;
2347         delete onFailure;
2348         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2349     }
2350 }
2351
2352 - (void)readAttributePrimary3Y:(ResponseHandler)completionHandler
2353 {
2354     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2355     if (!onSuccess) {
2356         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2357         return;
2358     }
2359
2360     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2361     if (!onFailure) {
2362         delete onSuccess;
2363         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2364         return;
2365     }
2366
2367     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary3Y(onSuccess->Cancel(), onFailure->Cancel());
2368     if (err != CHIP_NO_ERROR) {
2369         delete onSuccess;
2370         delete onFailure;
2371         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2372     }
2373 }
2374
2375 - (void)readAttributePrimary3Intensity:(ResponseHandler)completionHandler
2376 {
2377     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2378     if (!onSuccess) {
2379         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2380         return;
2381     }
2382
2383     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2384     if (!onFailure) {
2385         delete onSuccess;
2386         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2387         return;
2388     }
2389
2390     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary3Intensity(onSuccess->Cancel(), onFailure->Cancel());
2391     if (err != CHIP_NO_ERROR) {
2392         delete onSuccess;
2393         delete onFailure;
2394         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2395     }
2396 }
2397
2398 - (void)readAttributePrimary4X:(ResponseHandler)completionHandler
2399 {
2400     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2401     if (!onSuccess) {
2402         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2403         return;
2404     }
2405
2406     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2407     if (!onFailure) {
2408         delete onSuccess;
2409         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2410         return;
2411     }
2412
2413     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary4X(onSuccess->Cancel(), onFailure->Cancel());
2414     if (err != CHIP_NO_ERROR) {
2415         delete onSuccess;
2416         delete onFailure;
2417         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2418     }
2419 }
2420
2421 - (void)readAttributePrimary4Y:(ResponseHandler)completionHandler
2422 {
2423     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2424     if (!onSuccess) {
2425         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2426         return;
2427     }
2428
2429     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2430     if (!onFailure) {
2431         delete onSuccess;
2432         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2433         return;
2434     }
2435
2436     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary4Y(onSuccess->Cancel(), onFailure->Cancel());
2437     if (err != CHIP_NO_ERROR) {
2438         delete onSuccess;
2439         delete onFailure;
2440         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2441     }
2442 }
2443
2444 - (void)readAttributePrimary4Intensity:(ResponseHandler)completionHandler
2445 {
2446     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2447     if (!onSuccess) {
2448         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2449         return;
2450     }
2451
2452     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2453     if (!onFailure) {
2454         delete onSuccess;
2455         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2456         return;
2457     }
2458
2459     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary4Intensity(onSuccess->Cancel(), onFailure->Cancel());
2460     if (err != CHIP_NO_ERROR) {
2461         delete onSuccess;
2462         delete onFailure;
2463         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2464     }
2465 }
2466
2467 - (void)readAttributePrimary5X:(ResponseHandler)completionHandler
2468 {
2469     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2470     if (!onSuccess) {
2471         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2472         return;
2473     }
2474
2475     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2476     if (!onFailure) {
2477         delete onSuccess;
2478         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2479         return;
2480     }
2481
2482     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary5X(onSuccess->Cancel(), onFailure->Cancel());
2483     if (err != CHIP_NO_ERROR) {
2484         delete onSuccess;
2485         delete onFailure;
2486         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2487     }
2488 }
2489
2490 - (void)readAttributePrimary5Y:(ResponseHandler)completionHandler
2491 {
2492     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2493     if (!onSuccess) {
2494         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2495         return;
2496     }
2497
2498     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2499     if (!onFailure) {
2500         delete onSuccess;
2501         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2502         return;
2503     }
2504
2505     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary5Y(onSuccess->Cancel(), onFailure->Cancel());
2506     if (err != CHIP_NO_ERROR) {
2507         delete onSuccess;
2508         delete onFailure;
2509         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2510     }
2511 }
2512
2513 - (void)readAttributePrimary5Intensity:(ResponseHandler)completionHandler
2514 {
2515     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2516     if (!onSuccess) {
2517         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2518         return;
2519     }
2520
2521     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2522     if (!onFailure) {
2523         delete onSuccess;
2524         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2525         return;
2526     }
2527
2528     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary5Intensity(onSuccess->Cancel(), onFailure->Cancel());
2529     if (err != CHIP_NO_ERROR) {
2530         delete onSuccess;
2531         delete onFailure;
2532         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2533     }
2534 }
2535
2536 - (void)readAttributePrimary6X:(ResponseHandler)completionHandler
2537 {
2538     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2539     if (!onSuccess) {
2540         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2541         return;
2542     }
2543
2544     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2545     if (!onFailure) {
2546         delete onSuccess;
2547         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2548         return;
2549     }
2550
2551     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary6X(onSuccess->Cancel(), onFailure->Cancel());
2552     if (err != CHIP_NO_ERROR) {
2553         delete onSuccess;
2554         delete onFailure;
2555         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2556     }
2557 }
2558
2559 - (void)readAttributePrimary6Y:(ResponseHandler)completionHandler
2560 {
2561     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2562     if (!onSuccess) {
2563         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2564         return;
2565     }
2566
2567     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2568     if (!onFailure) {
2569         delete onSuccess;
2570         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2571         return;
2572     }
2573
2574     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary6Y(onSuccess->Cancel(), onFailure->Cancel());
2575     if (err != CHIP_NO_ERROR) {
2576         delete onSuccess;
2577         delete onFailure;
2578         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2579     }
2580 }
2581
2582 - (void)readAttributePrimary6Intensity:(ResponseHandler)completionHandler
2583 {
2584     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2585     if (!onSuccess) {
2586         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2587         return;
2588     }
2589
2590     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2591     if (!onFailure) {
2592         delete onSuccess;
2593         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2594         return;
2595     }
2596
2597     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary6Intensity(onSuccess->Cancel(), onFailure->Cancel());
2598     if (err != CHIP_NO_ERROR) {
2599         delete onSuccess;
2600         delete onFailure;
2601         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2602     }
2603 }
2604
2605 - (void)readAttributeWhitePointX:(ResponseHandler)completionHandler
2606 {
2607     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2608     if (!onSuccess) {
2609         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2610         return;
2611     }
2612
2613     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2614     if (!onFailure) {
2615         delete onSuccess;
2616         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2617         return;
2618     }
2619
2620     CHIP_ERROR err = self.cppCluster.ReadAttributeWhitePointX(onSuccess->Cancel(), onFailure->Cancel());
2621     if (err != CHIP_NO_ERROR) {
2622         delete onSuccess;
2623         delete onFailure;
2624         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2625     }
2626 }
2627
2628 - (void)writeAttributeWhitePointX:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
2629 {
2630     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
2631     if (!onSuccess) {
2632         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2633         return;
2634     }
2635
2636     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2637     if (!onFailure) {
2638         delete onSuccess;
2639         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2640         return;
2641     }
2642
2643     CHIP_ERROR err = self.cppCluster.WriteAttributeWhitePointX(onSuccess->Cancel(), onFailure->Cancel(), value);
2644     if (err != CHIP_NO_ERROR) {
2645         delete onSuccess;
2646         delete onFailure;
2647         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2648     }
2649 }
2650
2651 - (void)readAttributeWhitePointY:(ResponseHandler)completionHandler
2652 {
2653     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2654     if (!onSuccess) {
2655         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2656         return;
2657     }
2658
2659     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2660     if (!onFailure) {
2661         delete onSuccess;
2662         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2663         return;
2664     }
2665
2666     CHIP_ERROR err = self.cppCluster.ReadAttributeWhitePointY(onSuccess->Cancel(), onFailure->Cancel());
2667     if (err != CHIP_NO_ERROR) {
2668         delete onSuccess;
2669         delete onFailure;
2670         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2671     }
2672 }
2673
2674 - (void)writeAttributeWhitePointY:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
2675 {
2676     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
2677     if (!onSuccess) {
2678         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2679         return;
2680     }
2681
2682     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2683     if (!onFailure) {
2684         delete onSuccess;
2685         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2686         return;
2687     }
2688
2689     CHIP_ERROR err = self.cppCluster.WriteAttributeWhitePointY(onSuccess->Cancel(), onFailure->Cancel(), value);
2690     if (err != CHIP_NO_ERROR) {
2691         delete onSuccess;
2692         delete onFailure;
2693         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2694     }
2695 }
2696
2697 - (void)readAttributeColorPointRX:(ResponseHandler)completionHandler
2698 {
2699     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2700     if (!onSuccess) {
2701         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2702         return;
2703     }
2704
2705     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2706     if (!onFailure) {
2707         delete onSuccess;
2708         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2709         return;
2710     }
2711
2712     CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointRX(onSuccess->Cancel(), onFailure->Cancel());
2713     if (err != CHIP_NO_ERROR) {
2714         delete onSuccess;
2715         delete onFailure;
2716         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2717     }
2718 }
2719
2720 - (void)writeAttributeColorPointRX:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
2721 {
2722     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
2723     if (!onSuccess) {
2724         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2725         return;
2726     }
2727
2728     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2729     if (!onFailure) {
2730         delete onSuccess;
2731         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2732         return;
2733     }
2734
2735     CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointRX(onSuccess->Cancel(), onFailure->Cancel(), value);
2736     if (err != CHIP_NO_ERROR) {
2737         delete onSuccess;
2738         delete onFailure;
2739         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2740     }
2741 }
2742
2743 - (void)readAttributeColorPointRY:(ResponseHandler)completionHandler
2744 {
2745     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2746     if (!onSuccess) {
2747         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2748         return;
2749     }
2750
2751     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2752     if (!onFailure) {
2753         delete onSuccess;
2754         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2755         return;
2756     }
2757
2758     CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointRY(onSuccess->Cancel(), onFailure->Cancel());
2759     if (err != CHIP_NO_ERROR) {
2760         delete onSuccess;
2761         delete onFailure;
2762         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2763     }
2764 }
2765
2766 - (void)writeAttributeColorPointRY:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
2767 {
2768     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
2769     if (!onSuccess) {
2770         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2771         return;
2772     }
2773
2774     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2775     if (!onFailure) {
2776         delete onSuccess;
2777         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2778         return;
2779     }
2780
2781     CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointRY(onSuccess->Cancel(), onFailure->Cancel(), value);
2782     if (err != CHIP_NO_ERROR) {
2783         delete onSuccess;
2784         delete onFailure;
2785         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2786     }
2787 }
2788
2789 - (void)readAttributeColorPointRIntensity:(ResponseHandler)completionHandler
2790 {
2791     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2792     if (!onSuccess) {
2793         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2794         return;
2795     }
2796
2797     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2798     if (!onFailure) {
2799         delete onSuccess;
2800         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2801         return;
2802     }
2803
2804     CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointRIntensity(onSuccess->Cancel(), onFailure->Cancel());
2805     if (err != CHIP_NO_ERROR) {
2806         delete onSuccess;
2807         delete onFailure;
2808         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2809     }
2810 }
2811
2812 - (void)writeAttributeColorPointRIntensity:(uint8_t)value completionHandler:(ResponseHandler)completionHandler
2813 {
2814     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
2815     if (!onSuccess) {
2816         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2817         return;
2818     }
2819
2820     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2821     if (!onFailure) {
2822         delete onSuccess;
2823         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2824         return;
2825     }
2826
2827     CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointRIntensity(onSuccess->Cancel(), onFailure->Cancel(), value);
2828     if (err != CHIP_NO_ERROR) {
2829         delete onSuccess;
2830         delete onFailure;
2831         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2832     }
2833 }
2834
2835 - (void)readAttributeColorPointGX:(ResponseHandler)completionHandler
2836 {
2837     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2838     if (!onSuccess) {
2839         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2840         return;
2841     }
2842
2843     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2844     if (!onFailure) {
2845         delete onSuccess;
2846         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2847         return;
2848     }
2849
2850     CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointGX(onSuccess->Cancel(), onFailure->Cancel());
2851     if (err != CHIP_NO_ERROR) {
2852         delete onSuccess;
2853         delete onFailure;
2854         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2855     }
2856 }
2857
2858 - (void)writeAttributeColorPointGX:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
2859 {
2860     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
2861     if (!onSuccess) {
2862         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2863         return;
2864     }
2865
2866     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2867     if (!onFailure) {
2868         delete onSuccess;
2869         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2870         return;
2871     }
2872
2873     CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointGX(onSuccess->Cancel(), onFailure->Cancel(), value);
2874     if (err != CHIP_NO_ERROR) {
2875         delete onSuccess;
2876         delete onFailure;
2877         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2878     }
2879 }
2880
2881 - (void)readAttributeColorPointGY:(ResponseHandler)completionHandler
2882 {
2883     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2884     if (!onSuccess) {
2885         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2886         return;
2887     }
2888
2889     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2890     if (!onFailure) {
2891         delete onSuccess;
2892         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2893         return;
2894     }
2895
2896     CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointGY(onSuccess->Cancel(), onFailure->Cancel());
2897     if (err != CHIP_NO_ERROR) {
2898         delete onSuccess;
2899         delete onFailure;
2900         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2901     }
2902 }
2903
2904 - (void)writeAttributeColorPointGY:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
2905 {
2906     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
2907     if (!onSuccess) {
2908         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2909         return;
2910     }
2911
2912     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2913     if (!onFailure) {
2914         delete onSuccess;
2915         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2916         return;
2917     }
2918
2919     CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointGY(onSuccess->Cancel(), onFailure->Cancel(), value);
2920     if (err != CHIP_NO_ERROR) {
2921         delete onSuccess;
2922         delete onFailure;
2923         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2924     }
2925 }
2926
2927 - (void)readAttributeColorPointGIntensity:(ResponseHandler)completionHandler
2928 {
2929     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2930     if (!onSuccess) {
2931         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2932         return;
2933     }
2934
2935     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2936     if (!onFailure) {
2937         delete onSuccess;
2938         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2939         return;
2940     }
2941
2942     CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointGIntensity(onSuccess->Cancel(), onFailure->Cancel());
2943     if (err != CHIP_NO_ERROR) {
2944         delete onSuccess;
2945         delete onFailure;
2946         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2947     }
2948 }
2949
2950 - (void)writeAttributeColorPointGIntensity:(uint8_t)value completionHandler:(ResponseHandler)completionHandler
2951 {
2952     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
2953     if (!onSuccess) {
2954         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2955         return;
2956     }
2957
2958     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2959     if (!onFailure) {
2960         delete onSuccess;
2961         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2962         return;
2963     }
2964
2965     CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointGIntensity(onSuccess->Cancel(), onFailure->Cancel(), value);
2966     if (err != CHIP_NO_ERROR) {
2967         delete onSuccess;
2968         delete onFailure;
2969         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2970     }
2971 }
2972
2973 - (void)readAttributeColorPointBX:(ResponseHandler)completionHandler
2974 {
2975     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
2976     if (!onSuccess) {
2977         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2978         return;
2979     }
2980
2981     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
2982     if (!onFailure) {
2983         delete onSuccess;
2984         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
2985         return;
2986     }
2987
2988     CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointBX(onSuccess->Cancel(), onFailure->Cancel());
2989     if (err != CHIP_NO_ERROR) {
2990         delete onSuccess;
2991         delete onFailure;
2992         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
2993     }
2994 }
2995
2996 - (void)writeAttributeColorPointBX:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
2997 {
2998     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
2999     if (!onSuccess) {
3000         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3001         return;
3002     }
3003
3004     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3005     if (!onFailure) {
3006         delete onSuccess;
3007         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3008         return;
3009     }
3010
3011     CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointBX(onSuccess->Cancel(), onFailure->Cancel(), value);
3012     if (err != CHIP_NO_ERROR) {
3013         delete onSuccess;
3014         delete onFailure;
3015         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3016     }
3017 }
3018
3019 - (void)readAttributeColorPointBY:(ResponseHandler)completionHandler
3020 {
3021     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
3022     if (!onSuccess) {
3023         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3024         return;
3025     }
3026
3027     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3028     if (!onFailure) {
3029         delete onSuccess;
3030         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3031         return;
3032     }
3033
3034     CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointBY(onSuccess->Cancel(), onFailure->Cancel());
3035     if (err != CHIP_NO_ERROR) {
3036         delete onSuccess;
3037         delete onFailure;
3038         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3039     }
3040 }
3041
3042 - (void)writeAttributeColorPointBY:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
3043 {
3044     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
3045     if (!onSuccess) {
3046         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3047         return;
3048     }
3049
3050     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3051     if (!onFailure) {
3052         delete onSuccess;
3053         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3054         return;
3055     }
3056
3057     CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointBY(onSuccess->Cancel(), onFailure->Cancel(), value);
3058     if (err != CHIP_NO_ERROR) {
3059         delete onSuccess;
3060         delete onFailure;
3061         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3062     }
3063 }
3064
3065 - (void)readAttributeColorPointBIntensity:(ResponseHandler)completionHandler
3066 {
3067     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
3068     if (!onSuccess) {
3069         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3070         return;
3071     }
3072
3073     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3074     if (!onFailure) {
3075         delete onSuccess;
3076         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3077         return;
3078     }
3079
3080     CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointBIntensity(onSuccess->Cancel(), onFailure->Cancel());
3081     if (err != CHIP_NO_ERROR) {
3082         delete onSuccess;
3083         delete onFailure;
3084         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3085     }
3086 }
3087
3088 - (void)writeAttributeColorPointBIntensity:(uint8_t)value completionHandler:(ResponseHandler)completionHandler
3089 {
3090     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
3091     if (!onSuccess) {
3092         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3093         return;
3094     }
3095
3096     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3097     if (!onFailure) {
3098         delete onSuccess;
3099         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3100         return;
3101     }
3102
3103     CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointBIntensity(onSuccess->Cancel(), onFailure->Cancel(), value);
3104     if (err != CHIP_NO_ERROR) {
3105         delete onSuccess;
3106         delete onFailure;
3107         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3108     }
3109 }
3110
3111 - (void)readAttributeEnhancedCurrentHue:(ResponseHandler)completionHandler
3112 {
3113     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
3114     if (!onSuccess) {
3115         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3116         return;
3117     }
3118
3119     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3120     if (!onFailure) {
3121         delete onSuccess;
3122         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3123         return;
3124     }
3125
3126     CHIP_ERROR err = self.cppCluster.ReadAttributeEnhancedCurrentHue(onSuccess->Cancel(), onFailure->Cancel());
3127     if (err != CHIP_NO_ERROR) {
3128         delete onSuccess;
3129         delete onFailure;
3130         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3131     }
3132 }
3133
3134 - (void)readAttributeEnhancedColorMode:(ResponseHandler)completionHandler
3135 {
3136     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
3137     if (!onSuccess) {
3138         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3139         return;
3140     }
3141
3142     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3143     if (!onFailure) {
3144         delete onSuccess;
3145         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3146         return;
3147     }
3148
3149     CHIP_ERROR err = self.cppCluster.ReadAttributeEnhancedColorMode(onSuccess->Cancel(), onFailure->Cancel());
3150     if (err != CHIP_NO_ERROR) {
3151         delete onSuccess;
3152         delete onFailure;
3153         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3154     }
3155 }
3156
3157 - (void)readAttributeColorLoopActive:(ResponseHandler)completionHandler
3158 {
3159     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
3160     if (!onSuccess) {
3161         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3162         return;
3163     }
3164
3165     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3166     if (!onFailure) {
3167         delete onSuccess;
3168         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3169         return;
3170     }
3171
3172     CHIP_ERROR err = self.cppCluster.ReadAttributeColorLoopActive(onSuccess->Cancel(), onFailure->Cancel());
3173     if (err != CHIP_NO_ERROR) {
3174         delete onSuccess;
3175         delete onFailure;
3176         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3177     }
3178 }
3179
3180 - (void)readAttributeColorLoopDirection:(ResponseHandler)completionHandler
3181 {
3182     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
3183     if (!onSuccess) {
3184         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3185         return;
3186     }
3187
3188     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3189     if (!onFailure) {
3190         delete onSuccess;
3191         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3192         return;
3193     }
3194
3195     CHIP_ERROR err = self.cppCluster.ReadAttributeColorLoopDirection(onSuccess->Cancel(), onFailure->Cancel());
3196     if (err != CHIP_NO_ERROR) {
3197         delete onSuccess;
3198         delete onFailure;
3199         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3200     }
3201 }
3202
3203 - (void)readAttributeColorLoopTime:(ResponseHandler)completionHandler
3204 {
3205     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
3206     if (!onSuccess) {
3207         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3208         return;
3209     }
3210
3211     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3212     if (!onFailure) {
3213         delete onSuccess;
3214         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3215         return;
3216     }
3217
3218     CHIP_ERROR err = self.cppCluster.ReadAttributeColorLoopTime(onSuccess->Cancel(), onFailure->Cancel());
3219     if (err != CHIP_NO_ERROR) {
3220         delete onSuccess;
3221         delete onFailure;
3222         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3223     }
3224 }
3225
3226 - (void)readAttributeColorCapabilities:(ResponseHandler)completionHandler
3227 {
3228     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
3229     if (!onSuccess) {
3230         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3231         return;
3232     }
3233
3234     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3235     if (!onFailure) {
3236         delete onSuccess;
3237         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3238         return;
3239     }
3240
3241     CHIP_ERROR err = self.cppCluster.ReadAttributeColorCapabilities(onSuccess->Cancel(), onFailure->Cancel());
3242     if (err != CHIP_NO_ERROR) {
3243         delete onSuccess;
3244         delete onFailure;
3245         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3246     }
3247 }
3248
3249 - (void)readAttributeColorTempPhysicalMin:(ResponseHandler)completionHandler
3250 {
3251     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
3252     if (!onSuccess) {
3253         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3254         return;
3255     }
3256
3257     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3258     if (!onFailure) {
3259         delete onSuccess;
3260         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3261         return;
3262     }
3263
3264     CHIP_ERROR err = self.cppCluster.ReadAttributeColorTempPhysicalMin(onSuccess->Cancel(), onFailure->Cancel());
3265     if (err != CHIP_NO_ERROR) {
3266         delete onSuccess;
3267         delete onFailure;
3268         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3269     }
3270 }
3271
3272 - (void)readAttributeColorTempPhysicalMax:(ResponseHandler)completionHandler
3273 {
3274     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
3275     if (!onSuccess) {
3276         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3277         return;
3278     }
3279
3280     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3281     if (!onFailure) {
3282         delete onSuccess;
3283         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3284         return;
3285     }
3286
3287     CHIP_ERROR err = self.cppCluster.ReadAttributeColorTempPhysicalMax(onSuccess->Cancel(), onFailure->Cancel());
3288     if (err != CHIP_NO_ERROR) {
3289         delete onSuccess;
3290         delete onFailure;
3291         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3292     }
3293 }
3294
3295 - (void)readAttributeCoupleColorTempToLevelMinMireds:(ResponseHandler)completionHandler
3296 {
3297     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
3298     if (!onSuccess) {
3299         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3300         return;
3301     }
3302
3303     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3304     if (!onFailure) {
3305         delete onSuccess;
3306         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3307         return;
3308     }
3309
3310     CHIP_ERROR err = self.cppCluster.ReadAttributeCoupleColorTempToLevelMinMireds(onSuccess->Cancel(), onFailure->Cancel());
3311     if (err != CHIP_NO_ERROR) {
3312         delete onSuccess;
3313         delete onFailure;
3314         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3315     }
3316 }
3317
3318 - (void)readAttributeStartUpColorTemperatureMireds:(ResponseHandler)completionHandler
3319 {
3320     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
3321     if (!onSuccess) {
3322         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3323         return;
3324     }
3325
3326     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3327     if (!onFailure) {
3328         delete onSuccess;
3329         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3330         return;
3331     }
3332
3333     CHIP_ERROR err = self.cppCluster.ReadAttributeStartUpColorTemperatureMireds(onSuccess->Cancel(), onFailure->Cancel());
3334     if (err != CHIP_NO_ERROR) {
3335         delete onSuccess;
3336         delete onFailure;
3337         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3338     }
3339 }
3340
3341 - (void)writeAttributeStartUpColorTemperatureMireds:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
3342 {
3343     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
3344     if (!onSuccess) {
3345         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3346         return;
3347     }
3348
3349     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3350     if (!onFailure) {
3351         delete onSuccess;
3352         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3353         return;
3354     }
3355
3356     CHIP_ERROR err = self.cppCluster.WriteAttributeStartUpColorTemperatureMireds(onSuccess->Cancel(), onFailure->Cancel(), value);
3357     if (err != CHIP_NO_ERROR) {
3358         delete onSuccess;
3359         delete onFailure;
3360         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3361     }
3362 }
3363
3364 - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
3365 {
3366     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
3367     if (!onSuccess) {
3368         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3369         return;
3370     }
3371
3372     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3373     if (!onFailure) {
3374         delete onSuccess;
3375         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3376         return;
3377     }
3378
3379     CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
3380     if (err != CHIP_NO_ERROR) {
3381         delete onSuccess;
3382         delete onFailure;
3383         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3384     }
3385 }
3386
3387 @end
3388
3389 @interface CHIPColorControl ()
3390 @property (readonly) Controller::ColorControlCluster cppCluster;
3391 @end
3392
3393 @implementation CHIPColorControl
3394
3395 - (Controller::ClusterBase *)getCluster
3396 {
3397     return &_cppCluster;
3398 }
3399
3400 - (void)moveColor:(int16_t)rateX
3401                 rateY:(int16_t)rateY
3402           optionsMask:(uint8_t)optionsMask
3403       optionsOverride:(uint8_t)optionsOverride
3404     completionHandler:(ResponseHandler)completionHandler
3405 {
3406     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
3407     if (!onSuccess) {
3408         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3409         return;
3410     }
3411
3412     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3413     if (!onFailure) {
3414         delete onSuccess;
3415         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3416         return;
3417     }
3418
3419     CHIP_ERROR err
3420         = self.cppCluster.MoveColor(onSuccess->Cancel(), onFailure->Cancel(), rateX, rateY, optionsMask, optionsOverride);
3421     if (err != CHIP_NO_ERROR) {
3422         delete onSuccess;
3423         delete onFailure;
3424         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3425     }
3426 }
3427 - (void)moveColorTemperature:(uint8_t)moveMode
3428                         rate:(uint16_t)rate
3429      colorTemperatureMinimum:(uint16_t)colorTemperatureMinimum
3430      colorTemperatureMaximum:(uint16_t)colorTemperatureMaximum
3431                  optionsMask:(uint8_t)optionsMask
3432              optionsOverride:(uint8_t)optionsOverride
3433            completionHandler:(ResponseHandler)completionHandler
3434 {
3435     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
3436     if (!onSuccess) {
3437         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3438         return;
3439     }
3440
3441     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3442     if (!onFailure) {
3443         delete onSuccess;
3444         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3445         return;
3446     }
3447
3448     CHIP_ERROR err = self.cppCluster.MoveColorTemperature(onSuccess->Cancel(), onFailure->Cancel(), moveMode, rate,
3449         colorTemperatureMinimum, colorTemperatureMaximum, optionsMask, optionsOverride);
3450     if (err != CHIP_NO_ERROR) {
3451         delete onSuccess;
3452         delete onFailure;
3453         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3454     }
3455 }
3456 - (void)moveHue:(uint8_t)moveMode
3457                  rate:(uint8_t)rate
3458           optionsMask:(uint8_t)optionsMask
3459       optionsOverride:(uint8_t)optionsOverride
3460     completionHandler:(ResponseHandler)completionHandler
3461 {
3462     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
3463     if (!onSuccess) {
3464         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3465         return;
3466     }
3467
3468     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3469     if (!onFailure) {
3470         delete onSuccess;
3471         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3472         return;
3473     }
3474
3475     CHIP_ERROR err
3476         = self.cppCluster.MoveHue(onSuccess->Cancel(), onFailure->Cancel(), moveMode, rate, optionsMask, optionsOverride);
3477     if (err != CHIP_NO_ERROR) {
3478         delete onSuccess;
3479         delete onFailure;
3480         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3481     }
3482 }
3483 - (void)moveSaturation:(uint8_t)moveMode
3484                   rate:(uint8_t)rate
3485            optionsMask:(uint8_t)optionsMask
3486        optionsOverride:(uint8_t)optionsOverride
3487      completionHandler:(ResponseHandler)completionHandler
3488 {
3489     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
3490     if (!onSuccess) {
3491         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3492         return;
3493     }
3494
3495     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3496     if (!onFailure) {
3497         delete onSuccess;
3498         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3499         return;
3500     }
3501
3502     CHIP_ERROR err
3503         = self.cppCluster.MoveSaturation(onSuccess->Cancel(), onFailure->Cancel(), moveMode, rate, optionsMask, optionsOverride);
3504     if (err != CHIP_NO_ERROR) {
3505         delete onSuccess;
3506         delete onFailure;
3507         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3508     }
3509 }
3510 - (void)moveToColor:(uint16_t)colorX
3511                colorY:(uint16_t)colorY
3512        transitionTime:(uint16_t)transitionTime
3513           optionsMask:(uint8_t)optionsMask
3514       optionsOverride:(uint8_t)optionsOverride
3515     completionHandler:(ResponseHandler)completionHandler
3516 {
3517     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
3518     if (!onSuccess) {
3519         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3520         return;
3521     }
3522
3523     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3524     if (!onFailure) {
3525         delete onSuccess;
3526         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3527         return;
3528     }
3529
3530     CHIP_ERROR err = self.cppCluster.MoveToColor(
3531         onSuccess->Cancel(), onFailure->Cancel(), colorX, colorY, transitionTime, optionsMask, optionsOverride);
3532     if (err != CHIP_NO_ERROR) {
3533         delete onSuccess;
3534         delete onFailure;
3535         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3536     }
3537 }
3538 - (void)moveToColorTemperature:(uint16_t)colorTemperature
3539                 transitionTime:(uint16_t)transitionTime
3540                    optionsMask:(uint8_t)optionsMask
3541                optionsOverride:(uint8_t)optionsOverride
3542              completionHandler:(ResponseHandler)completionHandler
3543 {
3544     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
3545     if (!onSuccess) {
3546         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3547         return;
3548     }
3549
3550     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3551     if (!onFailure) {
3552         delete onSuccess;
3553         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3554         return;
3555     }
3556
3557     CHIP_ERROR err = self.cppCluster.MoveToColorTemperature(
3558         onSuccess->Cancel(), onFailure->Cancel(), colorTemperature, transitionTime, optionsMask, optionsOverride);
3559     if (err != CHIP_NO_ERROR) {
3560         delete onSuccess;
3561         delete onFailure;
3562         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3563     }
3564 }
3565 - (void)moveToHue:(uint8_t)hue
3566             direction:(uint8_t)direction
3567        transitionTime:(uint16_t)transitionTime
3568           optionsMask:(uint8_t)optionsMask
3569       optionsOverride:(uint8_t)optionsOverride
3570     completionHandler:(ResponseHandler)completionHandler
3571 {
3572     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
3573     if (!onSuccess) {
3574         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3575         return;
3576     }
3577
3578     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3579     if (!onFailure) {
3580         delete onSuccess;
3581         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3582         return;
3583     }
3584
3585     CHIP_ERROR err = self.cppCluster.MoveToHue(
3586         onSuccess->Cancel(), onFailure->Cancel(), hue, direction, transitionTime, optionsMask, optionsOverride);
3587     if (err != CHIP_NO_ERROR) {
3588         delete onSuccess;
3589         delete onFailure;
3590         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3591     }
3592 }
3593 - (void)moveToHueAndSaturation:(uint8_t)hue
3594                     saturation:(uint8_t)saturation
3595                 transitionTime:(uint16_t)transitionTime
3596                    optionsMask:(uint8_t)optionsMask
3597                optionsOverride:(uint8_t)optionsOverride
3598              completionHandler:(ResponseHandler)completionHandler
3599 {
3600     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
3601     if (!onSuccess) {
3602         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3603         return;
3604     }
3605
3606     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3607     if (!onFailure) {
3608         delete onSuccess;
3609         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3610         return;
3611     }
3612
3613     CHIP_ERROR err = self.cppCluster.MoveToHueAndSaturation(
3614         onSuccess->Cancel(), onFailure->Cancel(), hue, saturation, transitionTime, optionsMask, optionsOverride);
3615     if (err != CHIP_NO_ERROR) {
3616         delete onSuccess;
3617         delete onFailure;
3618         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3619     }
3620 }
3621 - (void)moveToSaturation:(uint8_t)saturation
3622           transitionTime:(uint16_t)transitionTime
3623              optionsMask:(uint8_t)optionsMask
3624          optionsOverride:(uint8_t)optionsOverride
3625        completionHandler:(ResponseHandler)completionHandler
3626 {
3627     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
3628     if (!onSuccess) {
3629         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3630         return;
3631     }
3632
3633     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3634     if (!onFailure) {
3635         delete onSuccess;
3636         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3637         return;
3638     }
3639
3640     CHIP_ERROR err = self.cppCluster.MoveToSaturation(
3641         onSuccess->Cancel(), onFailure->Cancel(), saturation, transitionTime, optionsMask, optionsOverride);
3642     if (err != CHIP_NO_ERROR) {
3643         delete onSuccess;
3644         delete onFailure;
3645         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3646     }
3647 }
3648 - (void)stepColor:(int16_t)stepX
3649                 stepY:(int16_t)stepY
3650        transitionTime:(uint16_t)transitionTime
3651           optionsMask:(uint8_t)optionsMask
3652       optionsOverride:(uint8_t)optionsOverride
3653     completionHandler:(ResponseHandler)completionHandler
3654 {
3655     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
3656     if (!onSuccess) {
3657         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3658         return;
3659     }
3660
3661     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3662     if (!onFailure) {
3663         delete onSuccess;
3664         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3665         return;
3666     }
3667
3668     CHIP_ERROR err = self.cppCluster.StepColor(
3669         onSuccess->Cancel(), onFailure->Cancel(), stepX, stepY, transitionTime, optionsMask, optionsOverride);
3670     if (err != CHIP_NO_ERROR) {
3671         delete onSuccess;
3672         delete onFailure;
3673         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3674     }
3675 }
3676 - (void)stepColorTemperature:(uint8_t)stepMode
3677                     stepSize:(uint16_t)stepSize
3678               transitionTime:(uint16_t)transitionTime
3679      colorTemperatureMinimum:(uint16_t)colorTemperatureMinimum
3680      colorTemperatureMaximum:(uint16_t)colorTemperatureMaximum
3681                  optionsMask:(uint8_t)optionsMask
3682              optionsOverride:(uint8_t)optionsOverride
3683            completionHandler:(ResponseHandler)completionHandler
3684 {
3685     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
3686     if (!onSuccess) {
3687         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3688         return;
3689     }
3690
3691     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3692     if (!onFailure) {
3693         delete onSuccess;
3694         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3695         return;
3696     }
3697
3698     CHIP_ERROR err = self.cppCluster.StepColorTemperature(onSuccess->Cancel(), onFailure->Cancel(), stepMode, stepSize,
3699         transitionTime, colorTemperatureMinimum, colorTemperatureMaximum, optionsMask, optionsOverride);
3700     if (err != CHIP_NO_ERROR) {
3701         delete onSuccess;
3702         delete onFailure;
3703         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3704     }
3705 }
3706 - (void)stepHue:(uint8_t)stepMode
3707              stepSize:(uint8_t)stepSize
3708        transitionTime:(uint8_t)transitionTime
3709           optionsMask:(uint8_t)optionsMask
3710       optionsOverride:(uint8_t)optionsOverride
3711     completionHandler:(ResponseHandler)completionHandler
3712 {
3713     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
3714     if (!onSuccess) {
3715         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3716         return;
3717     }
3718
3719     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3720     if (!onFailure) {
3721         delete onSuccess;
3722         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3723         return;
3724     }
3725
3726     CHIP_ERROR err = self.cppCluster.StepHue(
3727         onSuccess->Cancel(), onFailure->Cancel(), stepMode, stepSize, transitionTime, optionsMask, optionsOverride);
3728     if (err != CHIP_NO_ERROR) {
3729         delete onSuccess;
3730         delete onFailure;
3731         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3732     }
3733 }
3734 - (void)stepSaturation:(uint8_t)stepMode
3735               stepSize:(uint8_t)stepSize
3736         transitionTime:(uint8_t)transitionTime
3737            optionsMask:(uint8_t)optionsMask
3738        optionsOverride:(uint8_t)optionsOverride
3739      completionHandler:(ResponseHandler)completionHandler
3740 {
3741     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
3742     if (!onSuccess) {
3743         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3744         return;
3745     }
3746
3747     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3748     if (!onFailure) {
3749         delete onSuccess;
3750         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3751         return;
3752     }
3753
3754     CHIP_ERROR err = self.cppCluster.StepSaturation(
3755         onSuccess->Cancel(), onFailure->Cancel(), stepMode, stepSize, transitionTime, optionsMask, optionsOverride);
3756     if (err != CHIP_NO_ERROR) {
3757         delete onSuccess;
3758         delete onFailure;
3759         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3760     }
3761 }
3762 - (void)stopMoveStep:(uint8_t)optionsMask
3763       optionsOverride:(uint8_t)optionsOverride
3764     completionHandler:(ResponseHandler)completionHandler
3765 {
3766     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
3767     if (!onSuccess) {
3768         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3769         return;
3770     }
3771
3772     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3773     if (!onFailure) {
3774         delete onSuccess;
3775         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3776         return;
3777     }
3778
3779     CHIP_ERROR err = self.cppCluster.StopMoveStep(onSuccess->Cancel(), onFailure->Cancel(), optionsMask, optionsOverride);
3780     if (err != CHIP_NO_ERROR) {
3781         delete onSuccess;
3782         delete onFailure;
3783         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3784     }
3785 }
3786
3787 - (void)readAttributeCurrentHue:(ResponseHandler)completionHandler
3788 {
3789     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
3790     if (!onSuccess) {
3791         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3792         return;
3793     }
3794
3795     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3796     if (!onFailure) {
3797         delete onSuccess;
3798         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3799         return;
3800     }
3801
3802     CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentHue(onSuccess->Cancel(), onFailure->Cancel());
3803     if (err != CHIP_NO_ERROR) {
3804         delete onSuccess;
3805         delete onFailure;
3806         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3807     }
3808 }
3809
3810 - (void)configureAttributeCurrentHue:(uint16_t)minInterval
3811                          maxInterval:(uint16_t)maxInterval
3812                               change:(uint8_t)change
3813                    completionHandler:(ResponseHandler)completionHandler
3814 {
3815     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
3816     if (!onSuccess) {
3817         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3818         return;
3819     }
3820
3821     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3822     if (!onFailure) {
3823         delete onSuccess;
3824         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3825         return;
3826     }
3827
3828     CHIP_ERROR err
3829         = self.cppCluster.ConfigureAttributeCurrentHue(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
3830     if (err != CHIP_NO_ERROR) {
3831         delete onSuccess;
3832         delete onFailure;
3833         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3834     }
3835 }
3836
3837 - (void)reportAttributeCurrentHue:(ResponseHandler)reportHandler
3838 {
3839     CHIPInt8uAttributeCallbackBridge * onReport = new CHIPInt8uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
3840     if (!onReport) {
3841         reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3842         return;
3843     }
3844
3845     CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentHue(onReport->Cancel());
3846     if (err != CHIP_NO_ERROR) {
3847         delete onReport;
3848         reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
3849     }
3850 }
3851
3852 - (void)readAttributeCurrentSaturation:(ResponseHandler)completionHandler
3853 {
3854     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
3855     if (!onSuccess) {
3856         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3857         return;
3858     }
3859
3860     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3861     if (!onFailure) {
3862         delete onSuccess;
3863         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3864         return;
3865     }
3866
3867     CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentSaturation(onSuccess->Cancel(), onFailure->Cancel());
3868     if (err != CHIP_NO_ERROR) {
3869         delete onSuccess;
3870         delete onFailure;
3871         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3872     }
3873 }
3874
3875 - (void)configureAttributeCurrentSaturation:(uint16_t)minInterval
3876                                 maxInterval:(uint16_t)maxInterval
3877                                      change:(uint8_t)change
3878                           completionHandler:(ResponseHandler)completionHandler
3879 {
3880     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
3881     if (!onSuccess) {
3882         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3883         return;
3884     }
3885
3886     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3887     if (!onFailure) {
3888         delete onSuccess;
3889         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3890         return;
3891     }
3892
3893     CHIP_ERROR err = self.cppCluster.ConfigureAttributeCurrentSaturation(
3894         onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
3895     if (err != CHIP_NO_ERROR) {
3896         delete onSuccess;
3897         delete onFailure;
3898         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3899     }
3900 }
3901
3902 - (void)reportAttributeCurrentSaturation:(ResponseHandler)reportHandler
3903 {
3904     CHIPInt8uAttributeCallbackBridge * onReport = new CHIPInt8uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
3905     if (!onReport) {
3906         reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3907         return;
3908     }
3909
3910     CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentSaturation(onReport->Cancel());
3911     if (err != CHIP_NO_ERROR) {
3912         delete onReport;
3913         reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
3914     }
3915 }
3916
3917 - (void)readAttributeRemainingTime:(ResponseHandler)completionHandler
3918 {
3919     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
3920     if (!onSuccess) {
3921         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3922         return;
3923     }
3924
3925     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3926     if (!onFailure) {
3927         delete onSuccess;
3928         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3929         return;
3930     }
3931
3932     CHIP_ERROR err = self.cppCluster.ReadAttributeRemainingTime(onSuccess->Cancel(), onFailure->Cancel());
3933     if (err != CHIP_NO_ERROR) {
3934         delete onSuccess;
3935         delete onFailure;
3936         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3937     }
3938 }
3939
3940 - (void)readAttributeCurrentX:(ResponseHandler)completionHandler
3941 {
3942     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
3943     if (!onSuccess) {
3944         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3945         return;
3946     }
3947
3948     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3949     if (!onFailure) {
3950         delete onSuccess;
3951         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3952         return;
3953     }
3954
3955     CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentX(onSuccess->Cancel(), onFailure->Cancel());
3956     if (err != CHIP_NO_ERROR) {
3957         delete onSuccess;
3958         delete onFailure;
3959         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3960     }
3961 }
3962
3963 - (void)configureAttributeCurrentX:(uint16_t)minInterval
3964                        maxInterval:(uint16_t)maxInterval
3965                             change:(uint16_t)change
3966                  completionHandler:(ResponseHandler)completionHandler
3967 {
3968     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
3969     if (!onSuccess) {
3970         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3971         return;
3972     }
3973
3974     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
3975     if (!onFailure) {
3976         delete onSuccess;
3977         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3978         return;
3979     }
3980
3981     CHIP_ERROR err
3982         = self.cppCluster.ConfigureAttributeCurrentX(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
3983     if (err != CHIP_NO_ERROR) {
3984         delete onSuccess;
3985         delete onFailure;
3986         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
3987     }
3988 }
3989
3990 - (void)reportAttributeCurrentX:(ResponseHandler)reportHandler
3991 {
3992     CHIPInt16uAttributeCallbackBridge * onReport = new CHIPInt16uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
3993     if (!onReport) {
3994         reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
3995         return;
3996     }
3997
3998     CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentX(onReport->Cancel());
3999     if (err != CHIP_NO_ERROR) {
4000         delete onReport;
4001         reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
4002     }
4003 }
4004
4005 - (void)readAttributeCurrentY:(ResponseHandler)completionHandler
4006 {
4007     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4008     if (!onSuccess) {
4009         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4010         return;
4011     }
4012
4013     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4014     if (!onFailure) {
4015         delete onSuccess;
4016         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4017         return;
4018     }
4019
4020     CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentY(onSuccess->Cancel(), onFailure->Cancel());
4021     if (err != CHIP_NO_ERROR) {
4022         delete onSuccess;
4023         delete onFailure;
4024         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4025     }
4026 }
4027
4028 - (void)configureAttributeCurrentY:(uint16_t)minInterval
4029                        maxInterval:(uint16_t)maxInterval
4030                             change:(uint16_t)change
4031                  completionHandler:(ResponseHandler)completionHandler
4032 {
4033     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
4034     if (!onSuccess) {
4035         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4036         return;
4037     }
4038
4039     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4040     if (!onFailure) {
4041         delete onSuccess;
4042         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4043         return;
4044     }
4045
4046     CHIP_ERROR err
4047         = self.cppCluster.ConfigureAttributeCurrentY(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
4048     if (err != CHIP_NO_ERROR) {
4049         delete onSuccess;
4050         delete onFailure;
4051         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4052     }
4053 }
4054
4055 - (void)reportAttributeCurrentY:(ResponseHandler)reportHandler
4056 {
4057     CHIPInt16uAttributeCallbackBridge * onReport = new CHIPInt16uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
4058     if (!onReport) {
4059         reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4060         return;
4061     }
4062
4063     CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentY(onReport->Cancel());
4064     if (err != CHIP_NO_ERROR) {
4065         delete onReport;
4066         reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
4067     }
4068 }
4069
4070 - (void)readAttributeDriftCompensation:(ResponseHandler)completionHandler
4071 {
4072     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4073     if (!onSuccess) {
4074         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4075         return;
4076     }
4077
4078     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4079     if (!onFailure) {
4080         delete onSuccess;
4081         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4082         return;
4083     }
4084
4085     CHIP_ERROR err = self.cppCluster.ReadAttributeDriftCompensation(onSuccess->Cancel(), onFailure->Cancel());
4086     if (err != CHIP_NO_ERROR) {
4087         delete onSuccess;
4088         delete onFailure;
4089         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4090     }
4091 }
4092
4093 - (void)readAttributeCompensationText:(ResponseHandler)completionHandler
4094 {
4095     CHIPStringAttributeCallbackBridge * onSuccess
4096         = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
4097     if (!onSuccess) {
4098         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4099         return;
4100     }
4101
4102     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4103     if (!onFailure) {
4104         delete onSuccess;
4105         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4106         return;
4107     }
4108
4109     CHIP_ERROR err = self.cppCluster.ReadAttributeCompensationText(onSuccess->Cancel(), onFailure->Cancel());
4110     if (err != CHIP_NO_ERROR) {
4111         delete onSuccess;
4112         delete onFailure;
4113         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4114     }
4115 }
4116
4117 - (void)readAttributeColorTemperature:(ResponseHandler)completionHandler
4118 {
4119     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4120     if (!onSuccess) {
4121         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4122         return;
4123     }
4124
4125     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4126     if (!onFailure) {
4127         delete onSuccess;
4128         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4129         return;
4130     }
4131
4132     CHIP_ERROR err = self.cppCluster.ReadAttributeColorTemperature(onSuccess->Cancel(), onFailure->Cancel());
4133     if (err != CHIP_NO_ERROR) {
4134         delete onSuccess;
4135         delete onFailure;
4136         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4137     }
4138 }
4139
4140 - (void)configureAttributeColorTemperature:(uint16_t)minInterval
4141                                maxInterval:(uint16_t)maxInterval
4142                                     change:(uint16_t)change
4143                          completionHandler:(ResponseHandler)completionHandler
4144 {
4145     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
4146     if (!onSuccess) {
4147         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4148         return;
4149     }
4150
4151     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4152     if (!onFailure) {
4153         delete onSuccess;
4154         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4155         return;
4156     }
4157
4158     CHIP_ERROR err = self.cppCluster.ConfigureAttributeColorTemperature(
4159         onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
4160     if (err != CHIP_NO_ERROR) {
4161         delete onSuccess;
4162         delete onFailure;
4163         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4164     }
4165 }
4166
4167 - (void)reportAttributeColorTemperature:(ResponseHandler)reportHandler
4168 {
4169     CHIPInt16uAttributeCallbackBridge * onReport = new CHIPInt16uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
4170     if (!onReport) {
4171         reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4172         return;
4173     }
4174
4175     CHIP_ERROR err = self.cppCluster.ReportAttributeColorTemperature(onReport->Cancel());
4176     if (err != CHIP_NO_ERROR) {
4177         delete onReport;
4178         reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
4179     }
4180 }
4181
4182 - (void)readAttributeColorMode:(ResponseHandler)completionHandler
4183 {
4184     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4185     if (!onSuccess) {
4186         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4187         return;
4188     }
4189
4190     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4191     if (!onFailure) {
4192         delete onSuccess;
4193         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4194         return;
4195     }
4196
4197     CHIP_ERROR err = self.cppCluster.ReadAttributeColorMode(onSuccess->Cancel(), onFailure->Cancel());
4198     if (err != CHIP_NO_ERROR) {
4199         delete onSuccess;
4200         delete onFailure;
4201         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4202     }
4203 }
4204
4205 - (void)readAttributeColorControlOptions:(ResponseHandler)completionHandler
4206 {
4207     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4208     if (!onSuccess) {
4209         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4210         return;
4211     }
4212
4213     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4214     if (!onFailure) {
4215         delete onSuccess;
4216         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4217         return;
4218     }
4219
4220     CHIP_ERROR err = self.cppCluster.ReadAttributeColorControlOptions(onSuccess->Cancel(), onFailure->Cancel());
4221     if (err != CHIP_NO_ERROR) {
4222         delete onSuccess;
4223         delete onFailure;
4224         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4225     }
4226 }
4227
4228 - (void)writeAttributeColorControlOptions:(uint8_t)value completionHandler:(ResponseHandler)completionHandler
4229 {
4230     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
4231     if (!onSuccess) {
4232         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4233         return;
4234     }
4235
4236     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4237     if (!onFailure) {
4238         delete onSuccess;
4239         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4240         return;
4241     }
4242
4243     CHIP_ERROR err = self.cppCluster.WriteAttributeColorControlOptions(onSuccess->Cancel(), onFailure->Cancel(), value);
4244     if (err != CHIP_NO_ERROR) {
4245         delete onSuccess;
4246         delete onFailure;
4247         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4248     }
4249 }
4250
4251 - (void)readAttributeNumberOfPrimaries:(ResponseHandler)completionHandler
4252 {
4253     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4254     if (!onSuccess) {
4255         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4256         return;
4257     }
4258
4259     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4260     if (!onFailure) {
4261         delete onSuccess;
4262         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4263         return;
4264     }
4265
4266     CHIP_ERROR err = self.cppCluster.ReadAttributeNumberOfPrimaries(onSuccess->Cancel(), onFailure->Cancel());
4267     if (err != CHIP_NO_ERROR) {
4268         delete onSuccess;
4269         delete onFailure;
4270         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4271     }
4272 }
4273
4274 - (void)readAttributePrimary1X:(ResponseHandler)completionHandler
4275 {
4276     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4277     if (!onSuccess) {
4278         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4279         return;
4280     }
4281
4282     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4283     if (!onFailure) {
4284         delete onSuccess;
4285         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4286         return;
4287     }
4288
4289     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary1X(onSuccess->Cancel(), onFailure->Cancel());
4290     if (err != CHIP_NO_ERROR) {
4291         delete onSuccess;
4292         delete onFailure;
4293         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4294     }
4295 }
4296
4297 - (void)readAttributePrimary1Y:(ResponseHandler)completionHandler
4298 {
4299     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4300     if (!onSuccess) {
4301         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4302         return;
4303     }
4304
4305     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4306     if (!onFailure) {
4307         delete onSuccess;
4308         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4309         return;
4310     }
4311
4312     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary1Y(onSuccess->Cancel(), onFailure->Cancel());
4313     if (err != CHIP_NO_ERROR) {
4314         delete onSuccess;
4315         delete onFailure;
4316         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4317     }
4318 }
4319
4320 - (void)readAttributePrimary1Intensity:(ResponseHandler)completionHandler
4321 {
4322     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4323     if (!onSuccess) {
4324         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4325         return;
4326     }
4327
4328     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4329     if (!onFailure) {
4330         delete onSuccess;
4331         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4332         return;
4333     }
4334
4335     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary1Intensity(onSuccess->Cancel(), onFailure->Cancel());
4336     if (err != CHIP_NO_ERROR) {
4337         delete onSuccess;
4338         delete onFailure;
4339         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4340     }
4341 }
4342
4343 - (void)readAttributePrimary2X:(ResponseHandler)completionHandler
4344 {
4345     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4346     if (!onSuccess) {
4347         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4348         return;
4349     }
4350
4351     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4352     if (!onFailure) {
4353         delete onSuccess;
4354         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4355         return;
4356     }
4357
4358     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary2X(onSuccess->Cancel(), onFailure->Cancel());
4359     if (err != CHIP_NO_ERROR) {
4360         delete onSuccess;
4361         delete onFailure;
4362         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4363     }
4364 }
4365
4366 - (void)readAttributePrimary2Y:(ResponseHandler)completionHandler
4367 {
4368     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4369     if (!onSuccess) {
4370         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4371         return;
4372     }
4373
4374     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4375     if (!onFailure) {
4376         delete onSuccess;
4377         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4378         return;
4379     }
4380
4381     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary2Y(onSuccess->Cancel(), onFailure->Cancel());
4382     if (err != CHIP_NO_ERROR) {
4383         delete onSuccess;
4384         delete onFailure;
4385         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4386     }
4387 }
4388
4389 - (void)readAttributePrimary2Intensity:(ResponseHandler)completionHandler
4390 {
4391     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4392     if (!onSuccess) {
4393         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4394         return;
4395     }
4396
4397     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4398     if (!onFailure) {
4399         delete onSuccess;
4400         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4401         return;
4402     }
4403
4404     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary2Intensity(onSuccess->Cancel(), onFailure->Cancel());
4405     if (err != CHIP_NO_ERROR) {
4406         delete onSuccess;
4407         delete onFailure;
4408         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4409     }
4410 }
4411
4412 - (void)readAttributePrimary3X:(ResponseHandler)completionHandler
4413 {
4414     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4415     if (!onSuccess) {
4416         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4417         return;
4418     }
4419
4420     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4421     if (!onFailure) {
4422         delete onSuccess;
4423         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4424         return;
4425     }
4426
4427     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary3X(onSuccess->Cancel(), onFailure->Cancel());
4428     if (err != CHIP_NO_ERROR) {
4429         delete onSuccess;
4430         delete onFailure;
4431         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4432     }
4433 }
4434
4435 - (void)readAttributePrimary3Y:(ResponseHandler)completionHandler
4436 {
4437     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4438     if (!onSuccess) {
4439         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4440         return;
4441     }
4442
4443     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4444     if (!onFailure) {
4445         delete onSuccess;
4446         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4447         return;
4448     }
4449
4450     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary3Y(onSuccess->Cancel(), onFailure->Cancel());
4451     if (err != CHIP_NO_ERROR) {
4452         delete onSuccess;
4453         delete onFailure;
4454         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4455     }
4456 }
4457
4458 - (void)readAttributePrimary3Intensity:(ResponseHandler)completionHandler
4459 {
4460     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4461     if (!onSuccess) {
4462         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4463         return;
4464     }
4465
4466     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4467     if (!onFailure) {
4468         delete onSuccess;
4469         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4470         return;
4471     }
4472
4473     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary3Intensity(onSuccess->Cancel(), onFailure->Cancel());
4474     if (err != CHIP_NO_ERROR) {
4475         delete onSuccess;
4476         delete onFailure;
4477         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4478     }
4479 }
4480
4481 - (void)readAttributePrimary4X:(ResponseHandler)completionHandler
4482 {
4483     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4484     if (!onSuccess) {
4485         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4486         return;
4487     }
4488
4489     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4490     if (!onFailure) {
4491         delete onSuccess;
4492         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4493         return;
4494     }
4495
4496     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary4X(onSuccess->Cancel(), onFailure->Cancel());
4497     if (err != CHIP_NO_ERROR) {
4498         delete onSuccess;
4499         delete onFailure;
4500         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4501     }
4502 }
4503
4504 - (void)readAttributePrimary4Y:(ResponseHandler)completionHandler
4505 {
4506     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4507     if (!onSuccess) {
4508         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4509         return;
4510     }
4511
4512     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4513     if (!onFailure) {
4514         delete onSuccess;
4515         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4516         return;
4517     }
4518
4519     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary4Y(onSuccess->Cancel(), onFailure->Cancel());
4520     if (err != CHIP_NO_ERROR) {
4521         delete onSuccess;
4522         delete onFailure;
4523         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4524     }
4525 }
4526
4527 - (void)readAttributePrimary4Intensity:(ResponseHandler)completionHandler
4528 {
4529     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4530     if (!onSuccess) {
4531         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4532         return;
4533     }
4534
4535     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4536     if (!onFailure) {
4537         delete onSuccess;
4538         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4539         return;
4540     }
4541
4542     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary4Intensity(onSuccess->Cancel(), onFailure->Cancel());
4543     if (err != CHIP_NO_ERROR) {
4544         delete onSuccess;
4545         delete onFailure;
4546         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4547     }
4548 }
4549
4550 - (void)readAttributePrimary5X:(ResponseHandler)completionHandler
4551 {
4552     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4553     if (!onSuccess) {
4554         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4555         return;
4556     }
4557
4558     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4559     if (!onFailure) {
4560         delete onSuccess;
4561         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4562         return;
4563     }
4564
4565     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary5X(onSuccess->Cancel(), onFailure->Cancel());
4566     if (err != CHIP_NO_ERROR) {
4567         delete onSuccess;
4568         delete onFailure;
4569         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4570     }
4571 }
4572
4573 - (void)readAttributePrimary5Y:(ResponseHandler)completionHandler
4574 {
4575     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4576     if (!onSuccess) {
4577         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4578         return;
4579     }
4580
4581     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4582     if (!onFailure) {
4583         delete onSuccess;
4584         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4585         return;
4586     }
4587
4588     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary5Y(onSuccess->Cancel(), onFailure->Cancel());
4589     if (err != CHIP_NO_ERROR) {
4590         delete onSuccess;
4591         delete onFailure;
4592         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4593     }
4594 }
4595
4596 - (void)readAttributePrimary5Intensity:(ResponseHandler)completionHandler
4597 {
4598     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4599     if (!onSuccess) {
4600         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4601         return;
4602     }
4603
4604     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4605     if (!onFailure) {
4606         delete onSuccess;
4607         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4608         return;
4609     }
4610
4611     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary5Intensity(onSuccess->Cancel(), onFailure->Cancel());
4612     if (err != CHIP_NO_ERROR) {
4613         delete onSuccess;
4614         delete onFailure;
4615         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4616     }
4617 }
4618
4619 - (void)readAttributePrimary6X:(ResponseHandler)completionHandler
4620 {
4621     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4622     if (!onSuccess) {
4623         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4624         return;
4625     }
4626
4627     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4628     if (!onFailure) {
4629         delete onSuccess;
4630         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4631         return;
4632     }
4633
4634     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary6X(onSuccess->Cancel(), onFailure->Cancel());
4635     if (err != CHIP_NO_ERROR) {
4636         delete onSuccess;
4637         delete onFailure;
4638         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4639     }
4640 }
4641
4642 - (void)readAttributePrimary6Y:(ResponseHandler)completionHandler
4643 {
4644     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4645     if (!onSuccess) {
4646         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4647         return;
4648     }
4649
4650     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4651     if (!onFailure) {
4652         delete onSuccess;
4653         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4654         return;
4655     }
4656
4657     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary6Y(onSuccess->Cancel(), onFailure->Cancel());
4658     if (err != CHIP_NO_ERROR) {
4659         delete onSuccess;
4660         delete onFailure;
4661         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4662     }
4663 }
4664
4665 - (void)readAttributePrimary6Intensity:(ResponseHandler)completionHandler
4666 {
4667     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4668     if (!onSuccess) {
4669         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4670         return;
4671     }
4672
4673     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4674     if (!onFailure) {
4675         delete onSuccess;
4676         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4677         return;
4678     }
4679
4680     CHIP_ERROR err = self.cppCluster.ReadAttributePrimary6Intensity(onSuccess->Cancel(), onFailure->Cancel());
4681     if (err != CHIP_NO_ERROR) {
4682         delete onSuccess;
4683         delete onFailure;
4684         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4685     }
4686 }
4687
4688 - (void)readAttributeWhitePointX:(ResponseHandler)completionHandler
4689 {
4690     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4691     if (!onSuccess) {
4692         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4693         return;
4694     }
4695
4696     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4697     if (!onFailure) {
4698         delete onSuccess;
4699         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4700         return;
4701     }
4702
4703     CHIP_ERROR err = self.cppCluster.ReadAttributeWhitePointX(onSuccess->Cancel(), onFailure->Cancel());
4704     if (err != CHIP_NO_ERROR) {
4705         delete onSuccess;
4706         delete onFailure;
4707         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4708     }
4709 }
4710
4711 - (void)writeAttributeWhitePointX:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
4712 {
4713     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
4714     if (!onSuccess) {
4715         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4716         return;
4717     }
4718
4719     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4720     if (!onFailure) {
4721         delete onSuccess;
4722         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4723         return;
4724     }
4725
4726     CHIP_ERROR err = self.cppCluster.WriteAttributeWhitePointX(onSuccess->Cancel(), onFailure->Cancel(), value);
4727     if (err != CHIP_NO_ERROR) {
4728         delete onSuccess;
4729         delete onFailure;
4730         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4731     }
4732 }
4733
4734 - (void)readAttributeWhitePointY:(ResponseHandler)completionHandler
4735 {
4736     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4737     if (!onSuccess) {
4738         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4739         return;
4740     }
4741
4742     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4743     if (!onFailure) {
4744         delete onSuccess;
4745         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4746         return;
4747     }
4748
4749     CHIP_ERROR err = self.cppCluster.ReadAttributeWhitePointY(onSuccess->Cancel(), onFailure->Cancel());
4750     if (err != CHIP_NO_ERROR) {
4751         delete onSuccess;
4752         delete onFailure;
4753         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4754     }
4755 }
4756
4757 - (void)writeAttributeWhitePointY:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
4758 {
4759     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
4760     if (!onSuccess) {
4761         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4762         return;
4763     }
4764
4765     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4766     if (!onFailure) {
4767         delete onSuccess;
4768         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4769         return;
4770     }
4771
4772     CHIP_ERROR err = self.cppCluster.WriteAttributeWhitePointY(onSuccess->Cancel(), onFailure->Cancel(), value);
4773     if (err != CHIP_NO_ERROR) {
4774         delete onSuccess;
4775         delete onFailure;
4776         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4777     }
4778 }
4779
4780 - (void)readAttributeColorPointRX:(ResponseHandler)completionHandler
4781 {
4782     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4783     if (!onSuccess) {
4784         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4785         return;
4786     }
4787
4788     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4789     if (!onFailure) {
4790         delete onSuccess;
4791         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4792         return;
4793     }
4794
4795     CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointRX(onSuccess->Cancel(), onFailure->Cancel());
4796     if (err != CHIP_NO_ERROR) {
4797         delete onSuccess;
4798         delete onFailure;
4799         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4800     }
4801 }
4802
4803 - (void)writeAttributeColorPointRX:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
4804 {
4805     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
4806     if (!onSuccess) {
4807         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4808         return;
4809     }
4810
4811     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4812     if (!onFailure) {
4813         delete onSuccess;
4814         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4815         return;
4816     }
4817
4818     CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointRX(onSuccess->Cancel(), onFailure->Cancel(), value);
4819     if (err != CHIP_NO_ERROR) {
4820         delete onSuccess;
4821         delete onFailure;
4822         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4823     }
4824 }
4825
4826 - (void)readAttributeColorPointRY:(ResponseHandler)completionHandler
4827 {
4828     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4829     if (!onSuccess) {
4830         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4831         return;
4832     }
4833
4834     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4835     if (!onFailure) {
4836         delete onSuccess;
4837         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4838         return;
4839     }
4840
4841     CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointRY(onSuccess->Cancel(), onFailure->Cancel());
4842     if (err != CHIP_NO_ERROR) {
4843         delete onSuccess;
4844         delete onFailure;
4845         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4846     }
4847 }
4848
4849 - (void)writeAttributeColorPointRY:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
4850 {
4851     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
4852     if (!onSuccess) {
4853         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4854         return;
4855     }
4856
4857     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4858     if (!onFailure) {
4859         delete onSuccess;
4860         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4861         return;
4862     }
4863
4864     CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointRY(onSuccess->Cancel(), onFailure->Cancel(), value);
4865     if (err != CHIP_NO_ERROR) {
4866         delete onSuccess;
4867         delete onFailure;
4868         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4869     }
4870 }
4871
4872 - (void)readAttributeColorPointRIntensity:(ResponseHandler)completionHandler
4873 {
4874     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4875     if (!onSuccess) {
4876         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4877         return;
4878     }
4879
4880     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4881     if (!onFailure) {
4882         delete onSuccess;
4883         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4884         return;
4885     }
4886
4887     CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointRIntensity(onSuccess->Cancel(), onFailure->Cancel());
4888     if (err != CHIP_NO_ERROR) {
4889         delete onSuccess;
4890         delete onFailure;
4891         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4892     }
4893 }
4894
4895 - (void)writeAttributeColorPointRIntensity:(uint8_t)value completionHandler:(ResponseHandler)completionHandler
4896 {
4897     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
4898     if (!onSuccess) {
4899         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4900         return;
4901     }
4902
4903     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4904     if (!onFailure) {
4905         delete onSuccess;
4906         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4907         return;
4908     }
4909
4910     CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointRIntensity(onSuccess->Cancel(), onFailure->Cancel(), value);
4911     if (err != CHIP_NO_ERROR) {
4912         delete onSuccess;
4913         delete onFailure;
4914         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4915     }
4916 }
4917
4918 - (void)readAttributeColorPointGX:(ResponseHandler)completionHandler
4919 {
4920     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4921     if (!onSuccess) {
4922         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4923         return;
4924     }
4925
4926     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4927     if (!onFailure) {
4928         delete onSuccess;
4929         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4930         return;
4931     }
4932
4933     CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointGX(onSuccess->Cancel(), onFailure->Cancel());
4934     if (err != CHIP_NO_ERROR) {
4935         delete onSuccess;
4936         delete onFailure;
4937         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4938     }
4939 }
4940
4941 - (void)writeAttributeColorPointGX:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
4942 {
4943     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
4944     if (!onSuccess) {
4945         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4946         return;
4947     }
4948
4949     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4950     if (!onFailure) {
4951         delete onSuccess;
4952         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4953         return;
4954     }
4955
4956     CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointGX(onSuccess->Cancel(), onFailure->Cancel(), value);
4957     if (err != CHIP_NO_ERROR) {
4958         delete onSuccess;
4959         delete onFailure;
4960         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4961     }
4962 }
4963
4964 - (void)readAttributeColorPointGY:(ResponseHandler)completionHandler
4965 {
4966     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
4967     if (!onSuccess) {
4968         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4969         return;
4970     }
4971
4972     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4973     if (!onFailure) {
4974         delete onSuccess;
4975         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4976         return;
4977     }
4978
4979     CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointGY(onSuccess->Cancel(), onFailure->Cancel());
4980     if (err != CHIP_NO_ERROR) {
4981         delete onSuccess;
4982         delete onFailure;
4983         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
4984     }
4985 }
4986
4987 - (void)writeAttributeColorPointGY:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
4988 {
4989     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
4990     if (!onSuccess) {
4991         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4992         return;
4993     }
4994
4995     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
4996     if (!onFailure) {
4997         delete onSuccess;
4998         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
4999         return;
5000     }
5001
5002     CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointGY(onSuccess->Cancel(), onFailure->Cancel(), value);
5003     if (err != CHIP_NO_ERROR) {
5004         delete onSuccess;
5005         delete onFailure;
5006         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5007     }
5008 }
5009
5010 - (void)readAttributeColorPointGIntensity:(ResponseHandler)completionHandler
5011 {
5012     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
5013     if (!onSuccess) {
5014         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5015         return;
5016     }
5017
5018     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5019     if (!onFailure) {
5020         delete onSuccess;
5021         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5022         return;
5023     }
5024
5025     CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointGIntensity(onSuccess->Cancel(), onFailure->Cancel());
5026     if (err != CHIP_NO_ERROR) {
5027         delete onSuccess;
5028         delete onFailure;
5029         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5030     }
5031 }
5032
5033 - (void)writeAttributeColorPointGIntensity:(uint8_t)value completionHandler:(ResponseHandler)completionHandler
5034 {
5035     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
5036     if (!onSuccess) {
5037         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5038         return;
5039     }
5040
5041     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5042     if (!onFailure) {
5043         delete onSuccess;
5044         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5045         return;
5046     }
5047
5048     CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointGIntensity(onSuccess->Cancel(), onFailure->Cancel(), value);
5049     if (err != CHIP_NO_ERROR) {
5050         delete onSuccess;
5051         delete onFailure;
5052         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5053     }
5054 }
5055
5056 - (void)readAttributeColorPointBX:(ResponseHandler)completionHandler
5057 {
5058     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
5059     if (!onSuccess) {
5060         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5061         return;
5062     }
5063
5064     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5065     if (!onFailure) {
5066         delete onSuccess;
5067         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5068         return;
5069     }
5070
5071     CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointBX(onSuccess->Cancel(), onFailure->Cancel());
5072     if (err != CHIP_NO_ERROR) {
5073         delete onSuccess;
5074         delete onFailure;
5075         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5076     }
5077 }
5078
5079 - (void)writeAttributeColorPointBX:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
5080 {
5081     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
5082     if (!onSuccess) {
5083         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5084         return;
5085     }
5086
5087     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5088     if (!onFailure) {
5089         delete onSuccess;
5090         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5091         return;
5092     }
5093
5094     CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointBX(onSuccess->Cancel(), onFailure->Cancel(), value);
5095     if (err != CHIP_NO_ERROR) {
5096         delete onSuccess;
5097         delete onFailure;
5098         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5099     }
5100 }
5101
5102 - (void)readAttributeColorPointBY:(ResponseHandler)completionHandler
5103 {
5104     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
5105     if (!onSuccess) {
5106         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5107         return;
5108     }
5109
5110     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5111     if (!onFailure) {
5112         delete onSuccess;
5113         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5114         return;
5115     }
5116
5117     CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointBY(onSuccess->Cancel(), onFailure->Cancel());
5118     if (err != CHIP_NO_ERROR) {
5119         delete onSuccess;
5120         delete onFailure;
5121         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5122     }
5123 }
5124
5125 - (void)writeAttributeColorPointBY:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
5126 {
5127     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
5128     if (!onSuccess) {
5129         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5130         return;
5131     }
5132
5133     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5134     if (!onFailure) {
5135         delete onSuccess;
5136         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5137         return;
5138     }
5139
5140     CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointBY(onSuccess->Cancel(), onFailure->Cancel(), value);
5141     if (err != CHIP_NO_ERROR) {
5142         delete onSuccess;
5143         delete onFailure;
5144         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5145     }
5146 }
5147
5148 - (void)readAttributeColorPointBIntensity:(ResponseHandler)completionHandler
5149 {
5150     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
5151     if (!onSuccess) {
5152         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5153         return;
5154     }
5155
5156     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5157     if (!onFailure) {
5158         delete onSuccess;
5159         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5160         return;
5161     }
5162
5163     CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointBIntensity(onSuccess->Cancel(), onFailure->Cancel());
5164     if (err != CHIP_NO_ERROR) {
5165         delete onSuccess;
5166         delete onFailure;
5167         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5168     }
5169 }
5170
5171 - (void)writeAttributeColorPointBIntensity:(uint8_t)value completionHandler:(ResponseHandler)completionHandler
5172 {
5173     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
5174     if (!onSuccess) {
5175         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5176         return;
5177     }
5178
5179     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5180     if (!onFailure) {
5181         delete onSuccess;
5182         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5183         return;
5184     }
5185
5186     CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointBIntensity(onSuccess->Cancel(), onFailure->Cancel(), value);
5187     if (err != CHIP_NO_ERROR) {
5188         delete onSuccess;
5189         delete onFailure;
5190         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5191     }
5192 }
5193
5194 - (void)readAttributeEnhancedCurrentHue:(ResponseHandler)completionHandler
5195 {
5196     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
5197     if (!onSuccess) {
5198         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5199         return;
5200     }
5201
5202     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5203     if (!onFailure) {
5204         delete onSuccess;
5205         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5206         return;
5207     }
5208
5209     CHIP_ERROR err = self.cppCluster.ReadAttributeEnhancedCurrentHue(onSuccess->Cancel(), onFailure->Cancel());
5210     if (err != CHIP_NO_ERROR) {
5211         delete onSuccess;
5212         delete onFailure;
5213         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5214     }
5215 }
5216
5217 - (void)readAttributeEnhancedColorMode:(ResponseHandler)completionHandler
5218 {
5219     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
5220     if (!onSuccess) {
5221         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5222         return;
5223     }
5224
5225     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5226     if (!onFailure) {
5227         delete onSuccess;
5228         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5229         return;
5230     }
5231
5232     CHIP_ERROR err = self.cppCluster.ReadAttributeEnhancedColorMode(onSuccess->Cancel(), onFailure->Cancel());
5233     if (err != CHIP_NO_ERROR) {
5234         delete onSuccess;
5235         delete onFailure;
5236         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5237     }
5238 }
5239
5240 - (void)readAttributeColorLoopActive:(ResponseHandler)completionHandler
5241 {
5242     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
5243     if (!onSuccess) {
5244         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5245         return;
5246     }
5247
5248     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5249     if (!onFailure) {
5250         delete onSuccess;
5251         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5252         return;
5253     }
5254
5255     CHIP_ERROR err = self.cppCluster.ReadAttributeColorLoopActive(onSuccess->Cancel(), onFailure->Cancel());
5256     if (err != CHIP_NO_ERROR) {
5257         delete onSuccess;
5258         delete onFailure;
5259         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5260     }
5261 }
5262
5263 - (void)readAttributeColorLoopDirection:(ResponseHandler)completionHandler
5264 {
5265     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
5266     if (!onSuccess) {
5267         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5268         return;
5269     }
5270
5271     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5272     if (!onFailure) {
5273         delete onSuccess;
5274         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5275         return;
5276     }
5277
5278     CHIP_ERROR err = self.cppCluster.ReadAttributeColorLoopDirection(onSuccess->Cancel(), onFailure->Cancel());
5279     if (err != CHIP_NO_ERROR) {
5280         delete onSuccess;
5281         delete onFailure;
5282         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5283     }
5284 }
5285
5286 - (void)readAttributeColorLoopTime:(ResponseHandler)completionHandler
5287 {
5288     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
5289     if (!onSuccess) {
5290         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5291         return;
5292     }
5293
5294     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5295     if (!onFailure) {
5296         delete onSuccess;
5297         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5298         return;
5299     }
5300
5301     CHIP_ERROR err = self.cppCluster.ReadAttributeColorLoopTime(onSuccess->Cancel(), onFailure->Cancel());
5302     if (err != CHIP_NO_ERROR) {
5303         delete onSuccess;
5304         delete onFailure;
5305         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5306     }
5307 }
5308
5309 - (void)readAttributeColorCapabilities:(ResponseHandler)completionHandler
5310 {
5311     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
5312     if (!onSuccess) {
5313         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5314         return;
5315     }
5316
5317     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5318     if (!onFailure) {
5319         delete onSuccess;
5320         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5321         return;
5322     }
5323
5324     CHIP_ERROR err = self.cppCluster.ReadAttributeColorCapabilities(onSuccess->Cancel(), onFailure->Cancel());
5325     if (err != CHIP_NO_ERROR) {
5326         delete onSuccess;
5327         delete onFailure;
5328         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5329     }
5330 }
5331
5332 - (void)readAttributeColorTempPhysicalMin:(ResponseHandler)completionHandler
5333 {
5334     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
5335     if (!onSuccess) {
5336         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5337         return;
5338     }
5339
5340     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5341     if (!onFailure) {
5342         delete onSuccess;
5343         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5344         return;
5345     }
5346
5347     CHIP_ERROR err = self.cppCluster.ReadAttributeColorTempPhysicalMin(onSuccess->Cancel(), onFailure->Cancel());
5348     if (err != CHIP_NO_ERROR) {
5349         delete onSuccess;
5350         delete onFailure;
5351         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5352     }
5353 }
5354
5355 - (void)readAttributeColorTempPhysicalMax:(ResponseHandler)completionHandler
5356 {
5357     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
5358     if (!onSuccess) {
5359         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5360         return;
5361     }
5362
5363     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5364     if (!onFailure) {
5365         delete onSuccess;
5366         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5367         return;
5368     }
5369
5370     CHIP_ERROR err = self.cppCluster.ReadAttributeColorTempPhysicalMax(onSuccess->Cancel(), onFailure->Cancel());
5371     if (err != CHIP_NO_ERROR) {
5372         delete onSuccess;
5373         delete onFailure;
5374         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5375     }
5376 }
5377
5378 - (void)readAttributeCoupleColorTempToLevelMinMireds:(ResponseHandler)completionHandler
5379 {
5380     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
5381     if (!onSuccess) {
5382         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5383         return;
5384     }
5385
5386     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5387     if (!onFailure) {
5388         delete onSuccess;
5389         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5390         return;
5391     }
5392
5393     CHIP_ERROR err = self.cppCluster.ReadAttributeCoupleColorTempToLevelMinMireds(onSuccess->Cancel(), onFailure->Cancel());
5394     if (err != CHIP_NO_ERROR) {
5395         delete onSuccess;
5396         delete onFailure;
5397         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5398     }
5399 }
5400
5401 - (void)readAttributeStartUpColorTemperatureMireds:(ResponseHandler)completionHandler
5402 {
5403     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
5404     if (!onSuccess) {
5405         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5406         return;
5407     }
5408
5409     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5410     if (!onFailure) {
5411         delete onSuccess;
5412         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5413         return;
5414     }
5415
5416     CHIP_ERROR err = self.cppCluster.ReadAttributeStartUpColorTemperatureMireds(onSuccess->Cancel(), onFailure->Cancel());
5417     if (err != CHIP_NO_ERROR) {
5418         delete onSuccess;
5419         delete onFailure;
5420         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5421     }
5422 }
5423
5424 - (void)writeAttributeStartUpColorTemperatureMireds:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
5425 {
5426     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
5427     if (!onSuccess) {
5428         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5429         return;
5430     }
5431
5432     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5433     if (!onFailure) {
5434         delete onSuccess;
5435         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5436         return;
5437     }
5438
5439     CHIP_ERROR err = self.cppCluster.WriteAttributeStartUpColorTemperatureMireds(onSuccess->Cancel(), onFailure->Cancel(), value);
5440     if (err != CHIP_NO_ERROR) {
5441         delete onSuccess;
5442         delete onFailure;
5443         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5444     }
5445 }
5446
5447 - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
5448 {
5449     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
5450     if (!onSuccess) {
5451         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5452         return;
5453     }
5454
5455     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5456     if (!onFailure) {
5457         delete onSuccess;
5458         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5459         return;
5460     }
5461
5462     CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
5463     if (err != CHIP_NO_ERROR) {
5464         delete onSuccess;
5465         delete onFailure;
5466         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5467     }
5468 }
5469
5470 @end
5471
5472 @interface CHIPContentLaunch ()
5473 @property (readonly) Controller::ContentLaunchCluster cppCluster;
5474 @end
5475
5476 @implementation CHIPContentLaunch
5477
5478 - (Controller::ClusterBase *)getCluster
5479 {
5480     return &_cppCluster;
5481 }
5482
5483 - (void)launchContent:(ResponseHandler)completionHandler
5484 {
5485     CHIPContentLaunchClusterLaunchContentResponseCallbackBridge * onSuccess
5486         = new CHIPContentLaunchClusterLaunchContentResponseCallbackBridge(completionHandler, [self callbackQueue]);
5487     if (!onSuccess) {
5488         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5489         return;
5490     }
5491
5492     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5493     if (!onFailure) {
5494         delete onSuccess;
5495         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5496         return;
5497     }
5498
5499     CHIP_ERROR err = self.cppCluster.LaunchContent(onSuccess->Cancel(), onFailure->Cancel());
5500     if (err != CHIP_NO_ERROR) {
5501         delete onSuccess;
5502         delete onFailure;
5503         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5504     }
5505 }
5506 - (void)launchURL:(ResponseHandler)completionHandler
5507 {
5508     CHIPContentLaunchClusterLaunchURLResponseCallbackBridge * onSuccess
5509         = new CHIPContentLaunchClusterLaunchURLResponseCallbackBridge(completionHandler, [self callbackQueue]);
5510     if (!onSuccess) {
5511         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5512         return;
5513     }
5514
5515     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5516     if (!onFailure) {
5517         delete onSuccess;
5518         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5519         return;
5520     }
5521
5522     CHIP_ERROR err = self.cppCluster.LaunchURL(onSuccess->Cancel(), onFailure->Cancel());
5523     if (err != CHIP_NO_ERROR) {
5524         delete onSuccess;
5525         delete onFailure;
5526         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5527     }
5528 }
5529
5530 - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
5531 {
5532     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
5533     if (!onSuccess) {
5534         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5535         return;
5536     }
5537
5538     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5539     if (!onFailure) {
5540         delete onSuccess;
5541         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5542         return;
5543     }
5544
5545     CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
5546     if (err != CHIP_NO_ERROR) {
5547         delete onSuccess;
5548         delete onFailure;
5549         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5550     }
5551 }
5552
5553 @end
5554
5555 @interface CHIPDoorLock ()
5556 @property (readonly) Controller::DoorLockCluster cppCluster;
5557 @end
5558
5559 @implementation CHIPDoorLock
5560
5561 - (Controller::ClusterBase *)getCluster
5562 {
5563     return &_cppCluster;
5564 }
5565
5566 - (void)clearAllPins:(ResponseHandler)completionHandler
5567 {
5568     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
5569     if (!onSuccess) {
5570         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5571         return;
5572     }
5573
5574     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5575     if (!onFailure) {
5576         delete onSuccess;
5577         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5578         return;
5579     }
5580
5581     CHIP_ERROR err = self.cppCluster.ClearAllPins(onSuccess->Cancel(), onFailure->Cancel());
5582     if (err != CHIP_NO_ERROR) {
5583         delete onSuccess;
5584         delete onFailure;
5585         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5586     }
5587 }
5588 - (void)clearAllRfids:(ResponseHandler)completionHandler
5589 {
5590     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
5591     if (!onSuccess) {
5592         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5593         return;
5594     }
5595
5596     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5597     if (!onFailure) {
5598         delete onSuccess;
5599         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5600         return;
5601     }
5602
5603     CHIP_ERROR err = self.cppCluster.ClearAllRfids(onSuccess->Cancel(), onFailure->Cancel());
5604     if (err != CHIP_NO_ERROR) {
5605         delete onSuccess;
5606         delete onFailure;
5607         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5608     }
5609 }
5610 - (void)clearHolidaySchedule:(uint8_t)scheduleId completionHandler:(ResponseHandler)completionHandler
5611 {
5612     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
5613     if (!onSuccess) {
5614         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5615         return;
5616     }
5617
5618     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5619     if (!onFailure) {
5620         delete onSuccess;
5621         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5622         return;
5623     }
5624
5625     CHIP_ERROR err = self.cppCluster.ClearHolidaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId);
5626     if (err != CHIP_NO_ERROR) {
5627         delete onSuccess;
5628         delete onFailure;
5629         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5630     }
5631 }
5632 - (void)clearPin:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
5633 {
5634     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
5635     if (!onSuccess) {
5636         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5637         return;
5638     }
5639
5640     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5641     if (!onFailure) {
5642         delete onSuccess;
5643         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5644         return;
5645     }
5646
5647     CHIP_ERROR err = self.cppCluster.ClearPin(onSuccess->Cancel(), onFailure->Cancel(), userId);
5648     if (err != CHIP_NO_ERROR) {
5649         delete onSuccess;
5650         delete onFailure;
5651         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5652     }
5653 }
5654 - (void)clearRfid:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
5655 {
5656     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
5657     if (!onSuccess) {
5658         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5659         return;
5660     }
5661
5662     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5663     if (!onFailure) {
5664         delete onSuccess;
5665         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5666         return;
5667     }
5668
5669     CHIP_ERROR err = self.cppCluster.ClearRfid(onSuccess->Cancel(), onFailure->Cancel(), userId);
5670     if (err != CHIP_NO_ERROR) {
5671         delete onSuccess;
5672         delete onFailure;
5673         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5674     }
5675 }
5676 - (void)clearWeekdaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
5677 {
5678     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
5679     if (!onSuccess) {
5680         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5681         return;
5682     }
5683
5684     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5685     if (!onFailure) {
5686         delete onSuccess;
5687         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5688         return;
5689     }
5690
5691     CHIP_ERROR err = self.cppCluster.ClearWeekdaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId);
5692     if (err != CHIP_NO_ERROR) {
5693         delete onSuccess;
5694         delete onFailure;
5695         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5696     }
5697 }
5698 - (void)clearYeardaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
5699 {
5700     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
5701     if (!onSuccess) {
5702         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5703         return;
5704     }
5705
5706     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5707     if (!onFailure) {
5708         delete onSuccess;
5709         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5710         return;
5711     }
5712
5713     CHIP_ERROR err = self.cppCluster.ClearYeardaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId);
5714     if (err != CHIP_NO_ERROR) {
5715         delete onSuccess;
5716         delete onFailure;
5717         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5718     }
5719 }
5720 - (void)getHolidaySchedule:(uint8_t)scheduleId completionHandler:(ResponseHandler)completionHandler
5721 {
5722     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
5723     if (!onSuccess) {
5724         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5725         return;
5726     }
5727
5728     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5729     if (!onFailure) {
5730         delete onSuccess;
5731         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5732         return;
5733     }
5734
5735     CHIP_ERROR err = self.cppCluster.GetHolidaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId);
5736     if (err != CHIP_NO_ERROR) {
5737         delete onSuccess;
5738         delete onFailure;
5739         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5740     }
5741 }
5742 - (void)getLogRecord:(uint16_t)logIndex completionHandler:(ResponseHandler)completionHandler
5743 {
5744     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
5745     if (!onSuccess) {
5746         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5747         return;
5748     }
5749
5750     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5751     if (!onFailure) {
5752         delete onSuccess;
5753         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5754         return;
5755     }
5756
5757     CHIP_ERROR err = self.cppCluster.GetLogRecord(onSuccess->Cancel(), onFailure->Cancel(), logIndex);
5758     if (err != CHIP_NO_ERROR) {
5759         delete onSuccess;
5760         delete onFailure;
5761         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5762     }
5763 }
5764 - (void)getPin:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
5765 {
5766     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
5767     if (!onSuccess) {
5768         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5769         return;
5770     }
5771
5772     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5773     if (!onFailure) {
5774         delete onSuccess;
5775         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5776         return;
5777     }
5778
5779     CHIP_ERROR err = self.cppCluster.GetPin(onSuccess->Cancel(), onFailure->Cancel(), userId);
5780     if (err != CHIP_NO_ERROR) {
5781         delete onSuccess;
5782         delete onFailure;
5783         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5784     }
5785 }
5786 - (void)getRfid:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
5787 {
5788     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
5789     if (!onSuccess) {
5790         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5791         return;
5792     }
5793
5794     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5795     if (!onFailure) {
5796         delete onSuccess;
5797         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5798         return;
5799     }
5800
5801     CHIP_ERROR err = self.cppCluster.GetRfid(onSuccess->Cancel(), onFailure->Cancel(), userId);
5802     if (err != CHIP_NO_ERROR) {
5803         delete onSuccess;
5804         delete onFailure;
5805         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5806     }
5807 }
5808 - (void)getUserType:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
5809 {
5810     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
5811     if (!onSuccess) {
5812         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5813         return;
5814     }
5815
5816     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5817     if (!onFailure) {
5818         delete onSuccess;
5819         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5820         return;
5821     }
5822
5823     CHIP_ERROR err = self.cppCluster.GetUserType(onSuccess->Cancel(), onFailure->Cancel(), userId);
5824     if (err != CHIP_NO_ERROR) {
5825         delete onSuccess;
5826         delete onFailure;
5827         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5828     }
5829 }
5830 - (void)getWeekdaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
5831 {
5832     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
5833     if (!onSuccess) {
5834         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5835         return;
5836     }
5837
5838     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5839     if (!onFailure) {
5840         delete onSuccess;
5841         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5842         return;
5843     }
5844
5845     CHIP_ERROR err = self.cppCluster.GetWeekdaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId);
5846     if (err != CHIP_NO_ERROR) {
5847         delete onSuccess;
5848         delete onFailure;
5849         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5850     }
5851 }
5852 - (void)getYeardaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
5853 {
5854     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
5855     if (!onSuccess) {
5856         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5857         return;
5858     }
5859
5860     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5861     if (!onFailure) {
5862         delete onSuccess;
5863         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5864         return;
5865     }
5866
5867     CHIP_ERROR err = self.cppCluster.GetYeardaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId);
5868     if (err != CHIP_NO_ERROR) {
5869         delete onSuccess;
5870         delete onFailure;
5871         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5872     }
5873 }
5874 - (void)lockDoor:(NSString *)pin completionHandler:(ResponseHandler)completionHandler
5875 {
5876     CHIPDoorLockClusterLockDoorResponseCallbackBridge * onSuccess
5877         = new CHIPDoorLockClusterLockDoorResponseCallbackBridge(completionHandler, [self callbackQueue]);
5878     if (!onSuccess) {
5879         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5880         return;
5881     }
5882
5883     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5884     if (!onFailure) {
5885         delete onSuccess;
5886         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5887         return;
5888     }
5889
5890     CHIP_ERROR err = self.cppCluster.LockDoor(onSuccess->Cancel(), onFailure->Cancel(),
5891         chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
5892             [pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
5893     if (err != CHIP_NO_ERROR) {
5894         delete onSuccess;
5895         delete onFailure;
5896         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5897     }
5898 }
5899 - (void)setHolidaySchedule:(uint8_t)scheduleId
5900                 localStartTime:(uint32_t)localStartTime
5901                   localEndTime:(uint32_t)localEndTime
5902     operatingModeDuringHoliday:(uint8_t)operatingModeDuringHoliday
5903              completionHandler:(ResponseHandler)completionHandler
5904 {
5905     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
5906     if (!onSuccess) {
5907         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5908         return;
5909     }
5910
5911     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5912     if (!onFailure) {
5913         delete onSuccess;
5914         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5915         return;
5916     }
5917
5918     CHIP_ERROR err = self.cppCluster.SetHolidaySchedule(
5919         onSuccess->Cancel(), onFailure->Cancel(), scheduleId, localStartTime, localEndTime, operatingModeDuringHoliday);
5920     if (err != CHIP_NO_ERROR) {
5921         delete onSuccess;
5922         delete onFailure;
5923         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5924     }
5925 }
5926 - (void)setPin:(uint16_t)userId
5927            userStatus:(uint8_t)userStatus
5928              userType:(uint8_t)userType
5929                   pin:(NSString *)pin
5930     completionHandler:(ResponseHandler)completionHandler
5931 {
5932     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
5933     if (!onSuccess) {
5934         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5935         return;
5936     }
5937
5938     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5939     if (!onFailure) {
5940         delete onSuccess;
5941         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5942         return;
5943     }
5944
5945     CHIP_ERROR err = self.cppCluster.SetPin(onSuccess->Cancel(), onFailure->Cancel(), userId, userStatus, userType,
5946         chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
5947             [pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
5948     if (err != CHIP_NO_ERROR) {
5949         delete onSuccess;
5950         delete onFailure;
5951         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5952     }
5953 }
5954 - (void)setRfid:(uint16_t)userId
5955            userStatus:(uint8_t)userStatus
5956              userType:(uint8_t)userType
5957                    id:(NSString *)id
5958     completionHandler:(ResponseHandler)completionHandler
5959 {
5960     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
5961     if (!onSuccess) {
5962         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5963         return;
5964     }
5965
5966     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5967     if (!onFailure) {
5968         delete onSuccess;
5969         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5970         return;
5971     }
5972
5973     CHIP_ERROR err = self.cppCluster.SetRfid(onSuccess->Cancel(), onFailure->Cancel(), userId, userStatus, userType,
5974         chip::ByteSpan((const uint8_t *) [id dataUsingEncoding:NSUTF8StringEncoding].bytes,
5975             [id lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
5976     if (err != CHIP_NO_ERROR) {
5977         delete onSuccess;
5978         delete onFailure;
5979         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
5980     }
5981 }
5982 - (void)setUserType:(uint16_t)userId userType:(uint8_t)userType completionHandler:(ResponseHandler)completionHandler
5983 {
5984     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
5985     if (!onSuccess) {
5986         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5987         return;
5988     }
5989
5990     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
5991     if (!onFailure) {
5992         delete onSuccess;
5993         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
5994         return;
5995     }
5996
5997     CHIP_ERROR err = self.cppCluster.SetUserType(onSuccess->Cancel(), onFailure->Cancel(), userId, userType);
5998     if (err != CHIP_NO_ERROR) {
5999         delete onSuccess;
6000         delete onFailure;
6001         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6002     }
6003 }
6004 - (void)setWeekdaySchedule:(uint8_t)scheduleId
6005                     userId:(uint16_t)userId
6006                   daysMask:(uint8_t)daysMask
6007                  startHour:(uint8_t)startHour
6008                startMinute:(uint8_t)startMinute
6009                    endHour:(uint8_t)endHour
6010                  endMinute:(uint8_t)endMinute
6011          completionHandler:(ResponseHandler)completionHandler
6012 {
6013     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
6014     if (!onSuccess) {
6015         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6016         return;
6017     }
6018
6019     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6020     if (!onFailure) {
6021         delete onSuccess;
6022         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6023         return;
6024     }
6025
6026     CHIP_ERROR err = self.cppCluster.SetWeekdaySchedule(
6027         onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId, daysMask, startHour, startMinute, endHour, endMinute);
6028     if (err != CHIP_NO_ERROR) {
6029         delete onSuccess;
6030         delete onFailure;
6031         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6032     }
6033 }
6034 - (void)setYeardaySchedule:(uint8_t)scheduleId
6035                     userId:(uint16_t)userId
6036             localStartTime:(uint32_t)localStartTime
6037               localEndTime:(uint32_t)localEndTime
6038          completionHandler:(ResponseHandler)completionHandler
6039 {
6040     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
6041     if (!onSuccess) {
6042         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6043         return;
6044     }
6045
6046     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6047     if (!onFailure) {
6048         delete onSuccess;
6049         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6050         return;
6051     }
6052
6053     CHIP_ERROR err = self.cppCluster.SetYeardaySchedule(
6054         onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId, localStartTime, localEndTime);
6055     if (err != CHIP_NO_ERROR) {
6056         delete onSuccess;
6057         delete onFailure;
6058         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6059     }
6060 }
6061 - (void)unlockDoor:(NSString *)pin completionHandler:(ResponseHandler)completionHandler
6062 {
6063     CHIPDoorLockClusterUnlockDoorResponseCallbackBridge * onSuccess
6064         = new CHIPDoorLockClusterUnlockDoorResponseCallbackBridge(completionHandler, [self callbackQueue]);
6065     if (!onSuccess) {
6066         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6067         return;
6068     }
6069
6070     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6071     if (!onFailure) {
6072         delete onSuccess;
6073         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6074         return;
6075     }
6076
6077     CHIP_ERROR err = self.cppCluster.UnlockDoor(onSuccess->Cancel(), onFailure->Cancel(),
6078         chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
6079             [pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
6080     if (err != CHIP_NO_ERROR) {
6081         delete onSuccess;
6082         delete onFailure;
6083         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6084     }
6085 }
6086 - (void)unlockWithTimeout:(uint16_t)timeoutInSeconds pin:(NSString *)pin completionHandler:(ResponseHandler)completionHandler
6087 {
6088     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
6089     if (!onSuccess) {
6090         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6091         return;
6092     }
6093
6094     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6095     if (!onFailure) {
6096         delete onSuccess;
6097         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6098         return;
6099     }
6100
6101     CHIP_ERROR err = self.cppCluster.UnlockWithTimeout(onSuccess->Cancel(), onFailure->Cancel(), timeoutInSeconds,
6102         chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
6103             [pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
6104     if (err != CHIP_NO_ERROR) {
6105         delete onSuccess;
6106         delete onFailure;
6107         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6108     }
6109 }
6110
6111 - (void)readAttributeLockState:(ResponseHandler)completionHandler
6112 {
6113     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
6114     if (!onSuccess) {
6115         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6116         return;
6117     }
6118
6119     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6120     if (!onFailure) {
6121         delete onSuccess;
6122         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6123         return;
6124     }
6125
6126     CHIP_ERROR err = self.cppCluster.ReadAttributeLockState(onSuccess->Cancel(), onFailure->Cancel());
6127     if (err != CHIP_NO_ERROR) {
6128         delete onSuccess;
6129         delete onFailure;
6130         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6131     }
6132 }
6133
6134 - (void)configureAttributeLockState:(uint16_t)minInterval
6135                         maxInterval:(uint16_t)maxInterval
6136                   completionHandler:(ResponseHandler)completionHandler
6137 {
6138     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
6139     if (!onSuccess) {
6140         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6141         return;
6142     }
6143
6144     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6145     if (!onFailure) {
6146         delete onSuccess;
6147         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6148         return;
6149     }
6150
6151     CHIP_ERROR err
6152         = self.cppCluster.ConfigureAttributeLockState(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval);
6153     if (err != CHIP_NO_ERROR) {
6154         delete onSuccess;
6155         delete onFailure;
6156         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6157     }
6158 }
6159
6160 - (void)reportAttributeLockState:(ResponseHandler)reportHandler
6161 {
6162     CHIPInt8uAttributeCallbackBridge * onReport = new CHIPInt8uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
6163     if (!onReport) {
6164         reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6165         return;
6166     }
6167
6168     CHIP_ERROR err = self.cppCluster.ReportAttributeLockState(onReport->Cancel());
6169     if (err != CHIP_NO_ERROR) {
6170         delete onReport;
6171         reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
6172     }
6173 }
6174
6175 - (void)readAttributeLockType:(ResponseHandler)completionHandler
6176 {
6177     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
6178     if (!onSuccess) {
6179         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6180         return;
6181     }
6182
6183     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6184     if (!onFailure) {
6185         delete onSuccess;
6186         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6187         return;
6188     }
6189
6190     CHIP_ERROR err = self.cppCluster.ReadAttributeLockType(onSuccess->Cancel(), onFailure->Cancel());
6191     if (err != CHIP_NO_ERROR) {
6192         delete onSuccess;
6193         delete onFailure;
6194         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6195     }
6196 }
6197
6198 - (void)readAttributeActuatorEnabled:(ResponseHandler)completionHandler
6199 {
6200     CHIPBooleanAttributeCallbackBridge * onSuccess
6201         = new CHIPBooleanAttributeCallbackBridge(completionHandler, [self callbackQueue]);
6202     if (!onSuccess) {
6203         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6204         return;
6205     }
6206
6207     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6208     if (!onFailure) {
6209         delete onSuccess;
6210         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6211         return;
6212     }
6213
6214     CHIP_ERROR err = self.cppCluster.ReadAttributeActuatorEnabled(onSuccess->Cancel(), onFailure->Cancel());
6215     if (err != CHIP_NO_ERROR) {
6216         delete onSuccess;
6217         delete onFailure;
6218         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6219     }
6220 }
6221
6222 - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
6223 {
6224     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
6225     if (!onSuccess) {
6226         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6227         return;
6228     }
6229
6230     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6231     if (!onFailure) {
6232         delete onSuccess;
6233         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6234         return;
6235     }
6236
6237     CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
6238     if (err != CHIP_NO_ERROR) {
6239         delete onSuccess;
6240         delete onFailure;
6241         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6242     }
6243 }
6244
6245 @end
6246
6247 @interface CHIPDoorLock ()
6248 @property (readonly) Controller::DoorLockCluster cppCluster;
6249 @end
6250
6251 @implementation CHIPDoorLock
6252
6253 - (Controller::ClusterBase *)getCluster
6254 {
6255     return &_cppCluster;
6256 }
6257
6258 - (void)clearAllPins:(ResponseHandler)completionHandler
6259 {
6260     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
6261     if (!onSuccess) {
6262         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6263         return;
6264     }
6265
6266     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6267     if (!onFailure) {
6268         delete onSuccess;
6269         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6270         return;
6271     }
6272
6273     CHIP_ERROR err = self.cppCluster.ClearAllPins(onSuccess->Cancel(), onFailure->Cancel());
6274     if (err != CHIP_NO_ERROR) {
6275         delete onSuccess;
6276         delete onFailure;
6277         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6278     }
6279 }
6280 - (void)clearAllRfids:(ResponseHandler)completionHandler
6281 {
6282     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
6283     if (!onSuccess) {
6284         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6285         return;
6286     }
6287
6288     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6289     if (!onFailure) {
6290         delete onSuccess;
6291         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6292         return;
6293     }
6294
6295     CHIP_ERROR err = self.cppCluster.ClearAllRfids(onSuccess->Cancel(), onFailure->Cancel());
6296     if (err != CHIP_NO_ERROR) {
6297         delete onSuccess;
6298         delete onFailure;
6299         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6300     }
6301 }
6302 - (void)clearHolidaySchedule:(uint8_t)scheduleId completionHandler:(ResponseHandler)completionHandler
6303 {
6304     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
6305     if (!onSuccess) {
6306         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6307         return;
6308     }
6309
6310     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6311     if (!onFailure) {
6312         delete onSuccess;
6313         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6314         return;
6315     }
6316
6317     CHIP_ERROR err = self.cppCluster.ClearHolidaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId);
6318     if (err != CHIP_NO_ERROR) {
6319         delete onSuccess;
6320         delete onFailure;
6321         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6322     }
6323 }
6324 - (void)clearPin:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
6325 {
6326     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
6327     if (!onSuccess) {
6328         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6329         return;
6330     }
6331
6332     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6333     if (!onFailure) {
6334         delete onSuccess;
6335         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6336         return;
6337     }
6338
6339     CHIP_ERROR err = self.cppCluster.ClearPin(onSuccess->Cancel(), onFailure->Cancel(), userId);
6340     if (err != CHIP_NO_ERROR) {
6341         delete onSuccess;
6342         delete onFailure;
6343         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6344     }
6345 }
6346 - (void)clearRfid:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
6347 {
6348     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
6349     if (!onSuccess) {
6350         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6351         return;
6352     }
6353
6354     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6355     if (!onFailure) {
6356         delete onSuccess;
6357         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6358         return;
6359     }
6360
6361     CHIP_ERROR err = self.cppCluster.ClearRfid(onSuccess->Cancel(), onFailure->Cancel(), userId);
6362     if (err != CHIP_NO_ERROR) {
6363         delete onSuccess;
6364         delete onFailure;
6365         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6366     }
6367 }
6368 - (void)clearWeekdaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
6369 {
6370     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
6371     if (!onSuccess) {
6372         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6373         return;
6374     }
6375
6376     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6377     if (!onFailure) {
6378         delete onSuccess;
6379         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6380         return;
6381     }
6382
6383     CHIP_ERROR err = self.cppCluster.ClearWeekdaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId);
6384     if (err != CHIP_NO_ERROR) {
6385         delete onSuccess;
6386         delete onFailure;
6387         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6388     }
6389 }
6390 - (void)clearYeardaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
6391 {
6392     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
6393     if (!onSuccess) {
6394         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6395         return;
6396     }
6397
6398     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6399     if (!onFailure) {
6400         delete onSuccess;
6401         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6402         return;
6403     }
6404
6405     CHIP_ERROR err = self.cppCluster.ClearYeardaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId);
6406     if (err != CHIP_NO_ERROR) {
6407         delete onSuccess;
6408         delete onFailure;
6409         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6410     }
6411 }
6412 - (void)getHolidaySchedule:(uint8_t)scheduleId completionHandler:(ResponseHandler)completionHandler
6413 {
6414     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
6415     if (!onSuccess) {
6416         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6417         return;
6418     }
6419
6420     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6421     if (!onFailure) {
6422         delete onSuccess;
6423         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6424         return;
6425     }
6426
6427     CHIP_ERROR err = self.cppCluster.GetHolidaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId);
6428     if (err != CHIP_NO_ERROR) {
6429         delete onSuccess;
6430         delete onFailure;
6431         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6432     }
6433 }
6434 - (void)getLogRecord:(uint16_t)logIndex completionHandler:(ResponseHandler)completionHandler
6435 {
6436     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
6437     if (!onSuccess) {
6438         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6439         return;
6440     }
6441
6442     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6443     if (!onFailure) {
6444         delete onSuccess;
6445         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6446         return;
6447     }
6448
6449     CHIP_ERROR err = self.cppCluster.GetLogRecord(onSuccess->Cancel(), onFailure->Cancel(), logIndex);
6450     if (err != CHIP_NO_ERROR) {
6451         delete onSuccess;
6452         delete onFailure;
6453         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6454     }
6455 }
6456 - (void)getPin:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
6457 {
6458     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
6459     if (!onSuccess) {
6460         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6461         return;
6462     }
6463
6464     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6465     if (!onFailure) {
6466         delete onSuccess;
6467         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6468         return;
6469     }
6470
6471     CHIP_ERROR err = self.cppCluster.GetPin(onSuccess->Cancel(), onFailure->Cancel(), userId);
6472     if (err != CHIP_NO_ERROR) {
6473         delete onSuccess;
6474         delete onFailure;
6475         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6476     }
6477 }
6478 - (void)getRfid:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
6479 {
6480     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
6481     if (!onSuccess) {
6482         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6483         return;
6484     }
6485
6486     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6487     if (!onFailure) {
6488         delete onSuccess;
6489         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6490         return;
6491     }
6492
6493     CHIP_ERROR err = self.cppCluster.GetRfid(onSuccess->Cancel(), onFailure->Cancel(), userId);
6494     if (err != CHIP_NO_ERROR) {
6495         delete onSuccess;
6496         delete onFailure;
6497         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6498     }
6499 }
6500 - (void)getUserType:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
6501 {
6502     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
6503     if (!onSuccess) {
6504         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6505         return;
6506     }
6507
6508     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6509     if (!onFailure) {
6510         delete onSuccess;
6511         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6512         return;
6513     }
6514
6515     CHIP_ERROR err = self.cppCluster.GetUserType(onSuccess->Cancel(), onFailure->Cancel(), userId);
6516     if (err != CHIP_NO_ERROR) {
6517         delete onSuccess;
6518         delete onFailure;
6519         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6520     }
6521 }
6522 - (void)getWeekdaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
6523 {
6524     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
6525     if (!onSuccess) {
6526         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6527         return;
6528     }
6529
6530     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6531     if (!onFailure) {
6532         delete onSuccess;
6533         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6534         return;
6535     }
6536
6537     CHIP_ERROR err = self.cppCluster.GetWeekdaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId);
6538     if (err != CHIP_NO_ERROR) {
6539         delete onSuccess;
6540         delete onFailure;
6541         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6542     }
6543 }
6544 - (void)getYeardaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
6545 {
6546     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
6547     if (!onSuccess) {
6548         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6549         return;
6550     }
6551
6552     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6553     if (!onFailure) {
6554         delete onSuccess;
6555         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6556         return;
6557     }
6558
6559     CHIP_ERROR err = self.cppCluster.GetYeardaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId);
6560     if (err != CHIP_NO_ERROR) {
6561         delete onSuccess;
6562         delete onFailure;
6563         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6564     }
6565 }
6566 - (void)lockDoor:(NSString *)pin completionHandler:(ResponseHandler)completionHandler
6567 {
6568     CHIPDoorLockClusterLockDoorResponseCallbackBridge * onSuccess
6569         = new CHIPDoorLockClusterLockDoorResponseCallbackBridge(completionHandler, [self callbackQueue]);
6570     if (!onSuccess) {
6571         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6572         return;
6573     }
6574
6575     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6576     if (!onFailure) {
6577         delete onSuccess;
6578         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6579         return;
6580     }
6581
6582     CHIP_ERROR err = self.cppCluster.LockDoor(onSuccess->Cancel(), onFailure->Cancel(),
6583         chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
6584             [pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
6585     if (err != CHIP_NO_ERROR) {
6586         delete onSuccess;
6587         delete onFailure;
6588         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6589     }
6590 }
6591 - (void)setHolidaySchedule:(uint8_t)scheduleId
6592                 localStartTime:(uint32_t)localStartTime
6593                   localEndTime:(uint32_t)localEndTime
6594     operatingModeDuringHoliday:(uint8_t)operatingModeDuringHoliday
6595              completionHandler:(ResponseHandler)completionHandler
6596 {
6597     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
6598     if (!onSuccess) {
6599         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6600         return;
6601     }
6602
6603     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6604     if (!onFailure) {
6605         delete onSuccess;
6606         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6607         return;
6608     }
6609
6610     CHIP_ERROR err = self.cppCluster.SetHolidaySchedule(
6611         onSuccess->Cancel(), onFailure->Cancel(), scheduleId, localStartTime, localEndTime, operatingModeDuringHoliday);
6612     if (err != CHIP_NO_ERROR) {
6613         delete onSuccess;
6614         delete onFailure;
6615         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6616     }
6617 }
6618 - (void)setPin:(uint16_t)userId
6619            userStatus:(uint8_t)userStatus
6620              userType:(uint8_t)userType
6621                   pin:(NSString *)pin
6622     completionHandler:(ResponseHandler)completionHandler
6623 {
6624     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
6625     if (!onSuccess) {
6626         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6627         return;
6628     }
6629
6630     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6631     if (!onFailure) {
6632         delete onSuccess;
6633         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6634         return;
6635     }
6636
6637     CHIP_ERROR err = self.cppCluster.SetPin(onSuccess->Cancel(), onFailure->Cancel(), userId, userStatus, userType,
6638         chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
6639             [pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
6640     if (err != CHIP_NO_ERROR) {
6641         delete onSuccess;
6642         delete onFailure;
6643         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6644     }
6645 }
6646 - (void)setRfid:(uint16_t)userId
6647            userStatus:(uint8_t)userStatus
6648              userType:(uint8_t)userType
6649                    id:(NSString *)id
6650     completionHandler:(ResponseHandler)completionHandler
6651 {
6652     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
6653     if (!onSuccess) {
6654         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6655         return;
6656     }
6657
6658     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6659     if (!onFailure) {
6660         delete onSuccess;
6661         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6662         return;
6663     }
6664
6665     CHIP_ERROR err = self.cppCluster.SetRfid(onSuccess->Cancel(), onFailure->Cancel(), userId, userStatus, userType,
6666         chip::ByteSpan((const uint8_t *) [id dataUsingEncoding:NSUTF8StringEncoding].bytes,
6667             [id lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
6668     if (err != CHIP_NO_ERROR) {
6669         delete onSuccess;
6670         delete onFailure;
6671         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6672     }
6673 }
6674 - (void)setUserType:(uint16_t)userId userType:(uint8_t)userType completionHandler:(ResponseHandler)completionHandler
6675 {
6676     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
6677     if (!onSuccess) {
6678         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6679         return;
6680     }
6681
6682     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6683     if (!onFailure) {
6684         delete onSuccess;
6685         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6686         return;
6687     }
6688
6689     CHIP_ERROR err = self.cppCluster.SetUserType(onSuccess->Cancel(), onFailure->Cancel(), userId, userType);
6690     if (err != CHIP_NO_ERROR) {
6691         delete onSuccess;
6692         delete onFailure;
6693         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6694     }
6695 }
6696 - (void)setWeekdaySchedule:(uint8_t)scheduleId
6697                     userId:(uint16_t)userId
6698                   daysMask:(uint8_t)daysMask
6699                  startHour:(uint8_t)startHour
6700                startMinute:(uint8_t)startMinute
6701                    endHour:(uint8_t)endHour
6702                  endMinute:(uint8_t)endMinute
6703          completionHandler:(ResponseHandler)completionHandler
6704 {
6705     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
6706     if (!onSuccess) {
6707         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6708         return;
6709     }
6710
6711     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6712     if (!onFailure) {
6713         delete onSuccess;
6714         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6715         return;
6716     }
6717
6718     CHIP_ERROR err = self.cppCluster.SetWeekdaySchedule(
6719         onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId, daysMask, startHour, startMinute, endHour, endMinute);
6720     if (err != CHIP_NO_ERROR) {
6721         delete onSuccess;
6722         delete onFailure;
6723         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6724     }
6725 }
6726 - (void)setYeardaySchedule:(uint8_t)scheduleId
6727                     userId:(uint16_t)userId
6728             localStartTime:(uint32_t)localStartTime
6729               localEndTime:(uint32_t)localEndTime
6730          completionHandler:(ResponseHandler)completionHandler
6731 {
6732     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
6733     if (!onSuccess) {
6734         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6735         return;
6736     }
6737
6738     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6739     if (!onFailure) {
6740         delete onSuccess;
6741         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6742         return;
6743     }
6744
6745     CHIP_ERROR err = self.cppCluster.SetYeardaySchedule(
6746         onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId, localStartTime, localEndTime);
6747     if (err != CHIP_NO_ERROR) {
6748         delete onSuccess;
6749         delete onFailure;
6750         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6751     }
6752 }
6753 - (void)unlockDoor:(NSString *)pin completionHandler:(ResponseHandler)completionHandler
6754 {
6755     CHIPDoorLockClusterUnlockDoorResponseCallbackBridge * onSuccess
6756         = new CHIPDoorLockClusterUnlockDoorResponseCallbackBridge(completionHandler, [self callbackQueue]);
6757     if (!onSuccess) {
6758         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6759         return;
6760     }
6761
6762     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6763     if (!onFailure) {
6764         delete onSuccess;
6765         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6766         return;
6767     }
6768
6769     CHIP_ERROR err = self.cppCluster.UnlockDoor(onSuccess->Cancel(), onFailure->Cancel(),
6770         chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
6771             [pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
6772     if (err != CHIP_NO_ERROR) {
6773         delete onSuccess;
6774         delete onFailure;
6775         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6776     }
6777 }
6778 - (void)unlockWithTimeout:(uint16_t)timeoutInSeconds pin:(NSString *)pin completionHandler:(ResponseHandler)completionHandler
6779 {
6780     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
6781     if (!onSuccess) {
6782         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6783         return;
6784     }
6785
6786     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6787     if (!onFailure) {
6788         delete onSuccess;
6789         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6790         return;
6791     }
6792
6793     CHIP_ERROR err = self.cppCluster.UnlockWithTimeout(onSuccess->Cancel(), onFailure->Cancel(), timeoutInSeconds,
6794         chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
6795             [pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
6796     if (err != CHIP_NO_ERROR) {
6797         delete onSuccess;
6798         delete onFailure;
6799         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6800     }
6801 }
6802
6803 - (void)readAttributeLockState:(ResponseHandler)completionHandler
6804 {
6805     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
6806     if (!onSuccess) {
6807         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6808         return;
6809     }
6810
6811     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6812     if (!onFailure) {
6813         delete onSuccess;
6814         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6815         return;
6816     }
6817
6818     CHIP_ERROR err = self.cppCluster.ReadAttributeLockState(onSuccess->Cancel(), onFailure->Cancel());
6819     if (err != CHIP_NO_ERROR) {
6820         delete onSuccess;
6821         delete onFailure;
6822         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6823     }
6824 }
6825
6826 - (void)configureAttributeLockState:(uint16_t)minInterval
6827                         maxInterval:(uint16_t)maxInterval
6828                   completionHandler:(ResponseHandler)completionHandler
6829 {
6830     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
6831     if (!onSuccess) {
6832         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6833         return;
6834     }
6835
6836     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6837     if (!onFailure) {
6838         delete onSuccess;
6839         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6840         return;
6841     }
6842
6843     CHIP_ERROR err
6844         = self.cppCluster.ConfigureAttributeLockState(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval);
6845     if (err != CHIP_NO_ERROR) {
6846         delete onSuccess;
6847         delete onFailure;
6848         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6849     }
6850 }
6851
6852 - (void)reportAttributeLockState:(ResponseHandler)reportHandler
6853 {
6854     CHIPInt8uAttributeCallbackBridge * onReport = new CHIPInt8uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
6855     if (!onReport) {
6856         reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6857         return;
6858     }
6859
6860     CHIP_ERROR err = self.cppCluster.ReportAttributeLockState(onReport->Cancel());
6861     if (err != CHIP_NO_ERROR) {
6862         delete onReport;
6863         reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
6864     }
6865 }
6866
6867 - (void)readAttributeLockType:(ResponseHandler)completionHandler
6868 {
6869     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
6870     if (!onSuccess) {
6871         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6872         return;
6873     }
6874
6875     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6876     if (!onFailure) {
6877         delete onSuccess;
6878         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6879         return;
6880     }
6881
6882     CHIP_ERROR err = self.cppCluster.ReadAttributeLockType(onSuccess->Cancel(), onFailure->Cancel());
6883     if (err != CHIP_NO_ERROR) {
6884         delete onSuccess;
6885         delete onFailure;
6886         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6887     }
6888 }
6889
6890 - (void)readAttributeActuatorEnabled:(ResponseHandler)completionHandler
6891 {
6892     CHIPBooleanAttributeCallbackBridge * onSuccess
6893         = new CHIPBooleanAttributeCallbackBridge(completionHandler, [self callbackQueue]);
6894     if (!onSuccess) {
6895         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6896         return;
6897     }
6898
6899     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6900     if (!onFailure) {
6901         delete onSuccess;
6902         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6903         return;
6904     }
6905
6906     CHIP_ERROR err = self.cppCluster.ReadAttributeActuatorEnabled(onSuccess->Cancel(), onFailure->Cancel());
6907     if (err != CHIP_NO_ERROR) {
6908         delete onSuccess;
6909         delete onFailure;
6910         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6911     }
6912 }
6913
6914 - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
6915 {
6916     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
6917     if (!onSuccess) {
6918         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6919         return;
6920     }
6921
6922     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6923     if (!onFailure) {
6924         delete onSuccess;
6925         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6926         return;
6927     }
6928
6929     CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
6930     if (err != CHIP_NO_ERROR) {
6931         delete onSuccess;
6932         delete onFailure;
6933         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6934     }
6935 }
6936
6937 @end
6938
6939 @interface CHIPGroups ()
6940 @property (readonly) Controller::GroupsCluster cppCluster;
6941 @end
6942
6943 @implementation CHIPGroups
6944
6945 - (Controller::ClusterBase *)getCluster
6946 {
6947     return &_cppCluster;
6948 }
6949
6950 - (void)addGroup:(uint16_t)groupId groupName:(NSString *)groupName completionHandler:(ResponseHandler)completionHandler
6951 {
6952     CHIPGroupsClusterAddGroupResponseCallbackBridge * onSuccess
6953         = new CHIPGroupsClusterAddGroupResponseCallbackBridge(completionHandler, [self callbackQueue]);
6954     if (!onSuccess) {
6955         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6956         return;
6957     }
6958
6959     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6960     if (!onFailure) {
6961         delete onSuccess;
6962         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6963         return;
6964     }
6965
6966     CHIP_ERROR err = self.cppCluster.AddGroup(onSuccess->Cancel(), onFailure->Cancel(), groupId,
6967         chip::ByteSpan((const uint8_t *) [groupName dataUsingEncoding:NSUTF8StringEncoding].bytes,
6968             [groupName lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
6969     if (err != CHIP_NO_ERROR) {
6970         delete onSuccess;
6971         delete onFailure;
6972         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6973     }
6974 }
6975 - (void)addGroupIfIdentifying:(uint16_t)groupId groupName:(NSString *)groupName completionHandler:(ResponseHandler)completionHandler
6976 {
6977     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
6978     if (!onSuccess) {
6979         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6980         return;
6981     }
6982
6983     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
6984     if (!onFailure) {
6985         delete onSuccess;
6986         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
6987         return;
6988     }
6989
6990     CHIP_ERROR err = self.cppCluster.AddGroupIfIdentifying(onSuccess->Cancel(), onFailure->Cancel(), groupId,
6991         chip::ByteSpan((const uint8_t *) [groupName dataUsingEncoding:NSUTF8StringEncoding].bytes,
6992             [groupName lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
6993     if (err != CHIP_NO_ERROR) {
6994         delete onSuccess;
6995         delete onFailure;
6996         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
6997     }
6998 }
6999 - (void)getGroupMembership:(uint8_t)groupCount groupList:(uint16_t)groupList completionHandler:(ResponseHandler)completionHandler
7000 {
7001     CHIPGroupsClusterGetGroupMembershipResponseCallbackBridge * onSuccess
7002         = new CHIPGroupsClusterGetGroupMembershipResponseCallbackBridge(completionHandler, [self callbackQueue]);
7003     if (!onSuccess) {
7004         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7005         return;
7006     }
7007
7008     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7009     if (!onFailure) {
7010         delete onSuccess;
7011         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7012         return;
7013     }
7014
7015     CHIP_ERROR err = self.cppCluster.GetGroupMembership(onSuccess->Cancel(), onFailure->Cancel(), groupCount, groupList);
7016     if (err != CHIP_NO_ERROR) {
7017         delete onSuccess;
7018         delete onFailure;
7019         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7020     }
7021 }
7022 - (void)removeAllGroups:(ResponseHandler)completionHandler
7023 {
7024     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
7025     if (!onSuccess) {
7026         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7027         return;
7028     }
7029
7030     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7031     if (!onFailure) {
7032         delete onSuccess;
7033         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7034         return;
7035     }
7036
7037     CHIP_ERROR err = self.cppCluster.RemoveAllGroups(onSuccess->Cancel(), onFailure->Cancel());
7038     if (err != CHIP_NO_ERROR) {
7039         delete onSuccess;
7040         delete onFailure;
7041         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7042     }
7043 }
7044 - (void)removeGroup:(uint16_t)groupId completionHandler:(ResponseHandler)completionHandler
7045 {
7046     CHIPGroupsClusterRemoveGroupResponseCallbackBridge * onSuccess
7047         = new CHIPGroupsClusterRemoveGroupResponseCallbackBridge(completionHandler, [self callbackQueue]);
7048     if (!onSuccess) {
7049         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7050         return;
7051     }
7052
7053     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7054     if (!onFailure) {
7055         delete onSuccess;
7056         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7057         return;
7058     }
7059
7060     CHIP_ERROR err = self.cppCluster.RemoveGroup(onSuccess->Cancel(), onFailure->Cancel(), groupId);
7061     if (err != CHIP_NO_ERROR) {
7062         delete onSuccess;
7063         delete onFailure;
7064         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7065     }
7066 }
7067 - (void)viewGroup:(uint16_t)groupId completionHandler:(ResponseHandler)completionHandler
7068 {
7069     CHIPGroupsClusterViewGroupResponseCallbackBridge * onSuccess
7070         = new CHIPGroupsClusterViewGroupResponseCallbackBridge(completionHandler, [self callbackQueue]);
7071     if (!onSuccess) {
7072         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7073         return;
7074     }
7075
7076     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7077     if (!onFailure) {
7078         delete onSuccess;
7079         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7080         return;
7081     }
7082
7083     CHIP_ERROR err = self.cppCluster.ViewGroup(onSuccess->Cancel(), onFailure->Cancel(), groupId);
7084     if (err != CHIP_NO_ERROR) {
7085         delete onSuccess;
7086         delete onFailure;
7087         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7088     }
7089 }
7090
7091 - (void)readAttributeNameSupport:(ResponseHandler)completionHandler
7092 {
7093     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
7094     if (!onSuccess) {
7095         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7096         return;
7097     }
7098
7099     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7100     if (!onFailure) {
7101         delete onSuccess;
7102         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7103         return;
7104     }
7105
7106     CHIP_ERROR err = self.cppCluster.ReadAttributeNameSupport(onSuccess->Cancel(), onFailure->Cancel());
7107     if (err != CHIP_NO_ERROR) {
7108         delete onSuccess;
7109         delete onFailure;
7110         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7111     }
7112 }
7113
7114 - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
7115 {
7116     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
7117     if (!onSuccess) {
7118         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7119         return;
7120     }
7121
7122     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7123     if (!onFailure) {
7124         delete onSuccess;
7125         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7126         return;
7127     }
7128
7129     CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
7130     if (err != CHIP_NO_ERROR) {
7131         delete onSuccess;
7132         delete onFailure;
7133         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7134     }
7135 }
7136
7137 @end
7138
7139 @interface CHIPIasZone ()
7140 @property (readonly) Controller::IasZoneCluster cppCluster;
7141 @end
7142
7143 @implementation CHIPIasZone
7144
7145 - (Controller::ClusterBase *)getCluster
7146 {
7147     return &_cppCluster;
7148 }
7149
7150 - (void)readAttributeZoneState:(ResponseHandler)completionHandler
7151 {
7152     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
7153     if (!onSuccess) {
7154         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7155         return;
7156     }
7157
7158     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7159     if (!onFailure) {
7160         delete onSuccess;
7161         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7162         return;
7163     }
7164
7165     CHIP_ERROR err = self.cppCluster.ReadAttributeZoneState(onSuccess->Cancel(), onFailure->Cancel());
7166     if (err != CHIP_NO_ERROR) {
7167         delete onSuccess;
7168         delete onFailure;
7169         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7170     }
7171 }
7172
7173 - (void)readAttributeZoneType:(ResponseHandler)completionHandler
7174 {
7175     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
7176     if (!onSuccess) {
7177         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7178         return;
7179     }
7180
7181     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7182     if (!onFailure) {
7183         delete onSuccess;
7184         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7185         return;
7186     }
7187
7188     CHIP_ERROR err = self.cppCluster.ReadAttributeZoneType(onSuccess->Cancel(), onFailure->Cancel());
7189     if (err != CHIP_NO_ERROR) {
7190         delete onSuccess;
7191         delete onFailure;
7192         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7193     }
7194 }
7195
7196 - (void)readAttributeZoneStatus:(ResponseHandler)completionHandler
7197 {
7198     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
7199     if (!onSuccess) {
7200         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7201         return;
7202     }
7203
7204     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7205     if (!onFailure) {
7206         delete onSuccess;
7207         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7208         return;
7209     }
7210
7211     CHIP_ERROR err = self.cppCluster.ReadAttributeZoneStatus(onSuccess->Cancel(), onFailure->Cancel());
7212     if (err != CHIP_NO_ERROR) {
7213         delete onSuccess;
7214         delete onFailure;
7215         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7216     }
7217 }
7218
7219 - (void)readAttributeIasCieAddress:(ResponseHandler)completionHandler
7220 {
7221     CHIPInt64uAttributeCallbackBridge * onSuccess = new CHIPInt64uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
7222     if (!onSuccess) {
7223         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7224         return;
7225     }
7226
7227     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7228     if (!onFailure) {
7229         delete onSuccess;
7230         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7231         return;
7232     }
7233
7234     CHIP_ERROR err = self.cppCluster.ReadAttributeIasCieAddress(onSuccess->Cancel(), onFailure->Cancel());
7235     if (err != CHIP_NO_ERROR) {
7236         delete onSuccess;
7237         delete onFailure;
7238         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7239     }
7240 }
7241
7242 - (void)writeAttributeIasCieAddress:(uint64_t)value completionHandler:(ResponseHandler)completionHandler
7243 {
7244     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
7245     if (!onSuccess) {
7246         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7247         return;
7248     }
7249
7250     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7251     if (!onFailure) {
7252         delete onSuccess;
7253         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7254         return;
7255     }
7256
7257     CHIP_ERROR err = self.cppCluster.WriteAttributeIasCieAddress(onSuccess->Cancel(), onFailure->Cancel(), value);
7258     if (err != CHIP_NO_ERROR) {
7259         delete onSuccess;
7260         delete onFailure;
7261         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7262     }
7263 }
7264
7265 - (void)readAttributeZoneId:(ResponseHandler)completionHandler
7266 {
7267     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
7268     if (!onSuccess) {
7269         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7270         return;
7271     }
7272
7273     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7274     if (!onFailure) {
7275         delete onSuccess;
7276         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7277         return;
7278     }
7279
7280     CHIP_ERROR err = self.cppCluster.ReadAttributeZoneId(onSuccess->Cancel(), onFailure->Cancel());
7281     if (err != CHIP_NO_ERROR) {
7282         delete onSuccess;
7283         delete onFailure;
7284         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7285     }
7286 }
7287
7288 - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
7289 {
7290     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
7291     if (!onSuccess) {
7292         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7293         return;
7294     }
7295
7296     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7297     if (!onFailure) {
7298         delete onSuccess;
7299         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7300         return;
7301     }
7302
7303     CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
7304     if (err != CHIP_NO_ERROR) {
7305         delete onSuccess;
7306         delete onFailure;
7307         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7308     }
7309 }
7310
7311 @end
7312
7313 @interface CHIPIdentify ()
7314 @property (readonly) Controller::IdentifyCluster cppCluster;
7315 @end
7316
7317 @implementation CHIPIdentify
7318
7319 - (Controller::ClusterBase *)getCluster
7320 {
7321     return &_cppCluster;
7322 }
7323
7324 - (void)identify:(uint16_t)identifyTime completionHandler:(ResponseHandler)completionHandler
7325 {
7326     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
7327     if (!onSuccess) {
7328         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7329         return;
7330     }
7331
7332     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7333     if (!onFailure) {
7334         delete onSuccess;
7335         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7336         return;
7337     }
7338
7339     CHIP_ERROR err = self.cppCluster.Identify(onSuccess->Cancel(), onFailure->Cancel(), identifyTime);
7340     if (err != CHIP_NO_ERROR) {
7341         delete onSuccess;
7342         delete onFailure;
7343         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7344     }
7345 }
7346 - (void)identifyQuery:(ResponseHandler)completionHandler
7347 {
7348     CHIPIdentifyClusterIdentifyQueryResponseCallbackBridge * onSuccess
7349         = new CHIPIdentifyClusterIdentifyQueryResponseCallbackBridge(completionHandler, [self callbackQueue]);
7350     if (!onSuccess) {
7351         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7352         return;
7353     }
7354
7355     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7356     if (!onFailure) {
7357         delete onSuccess;
7358         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7359         return;
7360     }
7361
7362     CHIP_ERROR err = self.cppCluster.IdentifyQuery(onSuccess->Cancel(), onFailure->Cancel());
7363     if (err != CHIP_NO_ERROR) {
7364         delete onSuccess;
7365         delete onFailure;
7366         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7367     }
7368 }
7369
7370 - (void)readAttributeIdentifyTime:(ResponseHandler)completionHandler
7371 {
7372     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
7373     if (!onSuccess) {
7374         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7375         return;
7376     }
7377
7378     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7379     if (!onFailure) {
7380         delete onSuccess;
7381         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7382         return;
7383     }
7384
7385     CHIP_ERROR err = self.cppCluster.ReadAttributeIdentifyTime(onSuccess->Cancel(), onFailure->Cancel());
7386     if (err != CHIP_NO_ERROR) {
7387         delete onSuccess;
7388         delete onFailure;
7389         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7390     }
7391 }
7392
7393 - (void)writeAttributeIdentifyTime:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
7394 {
7395     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
7396     if (!onSuccess) {
7397         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7398         return;
7399     }
7400
7401     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7402     if (!onFailure) {
7403         delete onSuccess;
7404         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7405         return;
7406     }
7407
7408     CHIP_ERROR err = self.cppCluster.WriteAttributeIdentifyTime(onSuccess->Cancel(), onFailure->Cancel(), value);
7409     if (err != CHIP_NO_ERROR) {
7410         delete onSuccess;
7411         delete onFailure;
7412         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7413     }
7414 }
7415
7416 - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
7417 {
7418     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
7419     if (!onSuccess) {
7420         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7421         return;
7422     }
7423
7424     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7425     if (!onFailure) {
7426         delete onSuccess;
7427         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7428         return;
7429     }
7430
7431     CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
7432     if (err != CHIP_NO_ERROR) {
7433         delete onSuccess;
7434         delete onFailure;
7435         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7436     }
7437 }
7438
7439 @end
7440
7441 @interface CHIPLevelControl ()
7442 @property (readonly) Controller::LevelControlCluster cppCluster;
7443 @end
7444
7445 @implementation CHIPLevelControl
7446
7447 - (Controller::ClusterBase *)getCluster
7448 {
7449     return &_cppCluster;
7450 }
7451
7452 - (void)move:(uint8_t)moveMode
7453                  rate:(uint8_t)rate
7454            optionMask:(uint8_t)optionMask
7455        optionOverride:(uint8_t)optionOverride
7456     completionHandler:(ResponseHandler)completionHandler
7457 {
7458     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
7459     if (!onSuccess) {
7460         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7461         return;
7462     }
7463
7464     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7465     if (!onFailure) {
7466         delete onSuccess;
7467         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7468         return;
7469     }
7470
7471     CHIP_ERROR err = self.cppCluster.Move(onSuccess->Cancel(), onFailure->Cancel(), moveMode, rate, optionMask, optionOverride);
7472     if (err != CHIP_NO_ERROR) {
7473         delete onSuccess;
7474         delete onFailure;
7475         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7476     }
7477 }
7478 - (void)moveToLevel:(uint8_t)level
7479        transitionTime:(uint16_t)transitionTime
7480            optionMask:(uint8_t)optionMask
7481        optionOverride:(uint8_t)optionOverride
7482     completionHandler:(ResponseHandler)completionHandler
7483 {
7484     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
7485     if (!onSuccess) {
7486         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7487         return;
7488     }
7489
7490     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7491     if (!onFailure) {
7492         delete onSuccess;
7493         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7494         return;
7495     }
7496
7497     CHIP_ERROR err
7498         = self.cppCluster.MoveToLevel(onSuccess->Cancel(), onFailure->Cancel(), level, transitionTime, optionMask, optionOverride);
7499     if (err != CHIP_NO_ERROR) {
7500         delete onSuccess;
7501         delete onFailure;
7502         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7503     }
7504 }
7505 - (void)moveToLevelWithOnOff:(uint8_t)level
7506               transitionTime:(uint16_t)transitionTime
7507            completionHandler:(ResponseHandler)completionHandler
7508 {
7509     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
7510     if (!onSuccess) {
7511         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7512         return;
7513     }
7514
7515     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7516     if (!onFailure) {
7517         delete onSuccess;
7518         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7519         return;
7520     }
7521
7522     CHIP_ERROR err = self.cppCluster.MoveToLevelWithOnOff(onSuccess->Cancel(), onFailure->Cancel(), level, transitionTime);
7523     if (err != CHIP_NO_ERROR) {
7524         delete onSuccess;
7525         delete onFailure;
7526         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7527     }
7528 }
7529 - (void)moveWithOnOff:(uint8_t)moveMode rate:(uint8_t)rate completionHandler:(ResponseHandler)completionHandler
7530 {
7531     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
7532     if (!onSuccess) {
7533         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7534         return;
7535     }
7536
7537     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7538     if (!onFailure) {
7539         delete onSuccess;
7540         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7541         return;
7542     }
7543
7544     CHIP_ERROR err = self.cppCluster.MoveWithOnOff(onSuccess->Cancel(), onFailure->Cancel(), moveMode, rate);
7545     if (err != CHIP_NO_ERROR) {
7546         delete onSuccess;
7547         delete onFailure;
7548         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7549     }
7550 }
7551 - (void)step:(uint8_t)stepMode
7552              stepSize:(uint8_t)stepSize
7553        transitionTime:(uint16_t)transitionTime
7554            optionMask:(uint8_t)optionMask
7555        optionOverride:(uint8_t)optionOverride
7556     completionHandler:(ResponseHandler)completionHandler
7557 {
7558     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
7559     if (!onSuccess) {
7560         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7561         return;
7562     }
7563
7564     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7565     if (!onFailure) {
7566         delete onSuccess;
7567         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7568         return;
7569     }
7570
7571     CHIP_ERROR err = self.cppCluster.Step(
7572         onSuccess->Cancel(), onFailure->Cancel(), stepMode, stepSize, transitionTime, optionMask, optionOverride);
7573     if (err != CHIP_NO_ERROR) {
7574         delete onSuccess;
7575         delete onFailure;
7576         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7577     }
7578 }
7579 - (void)stepWithOnOff:(uint8_t)stepMode
7580              stepSize:(uint8_t)stepSize
7581        transitionTime:(uint16_t)transitionTime
7582     completionHandler:(ResponseHandler)completionHandler
7583 {
7584     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
7585     if (!onSuccess) {
7586         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7587         return;
7588     }
7589
7590     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7591     if (!onFailure) {
7592         delete onSuccess;
7593         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7594         return;
7595     }
7596
7597     CHIP_ERROR err = self.cppCluster.StepWithOnOff(onSuccess->Cancel(), onFailure->Cancel(), stepMode, stepSize, transitionTime);
7598     if (err != CHIP_NO_ERROR) {
7599         delete onSuccess;
7600         delete onFailure;
7601         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7602     }
7603 }
7604 - (void)stop:(uint8_t)optionMask optionOverride:(uint8_t)optionOverride completionHandler:(ResponseHandler)completionHandler
7605 {
7606     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
7607     if (!onSuccess) {
7608         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7609         return;
7610     }
7611
7612     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7613     if (!onFailure) {
7614         delete onSuccess;
7615         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7616         return;
7617     }
7618
7619     CHIP_ERROR err = self.cppCluster.Stop(onSuccess->Cancel(), onFailure->Cancel(), optionMask, optionOverride);
7620     if (err != CHIP_NO_ERROR) {
7621         delete onSuccess;
7622         delete onFailure;
7623         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7624     }
7625 }
7626 - (void)stopWithOnOff:(ResponseHandler)completionHandler
7627 {
7628     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
7629     if (!onSuccess) {
7630         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7631         return;
7632     }
7633
7634     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7635     if (!onFailure) {
7636         delete onSuccess;
7637         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7638         return;
7639     }
7640
7641     CHIP_ERROR err = self.cppCluster.StopWithOnOff(onSuccess->Cancel(), onFailure->Cancel());
7642     if (err != CHIP_NO_ERROR) {
7643         delete onSuccess;
7644         delete onFailure;
7645         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7646     }
7647 }
7648
7649 - (void)readAttributeCurrentLevel:(ResponseHandler)completionHandler
7650 {
7651     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
7652     if (!onSuccess) {
7653         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7654         return;
7655     }
7656
7657     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7658     if (!onFailure) {
7659         delete onSuccess;
7660         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7661         return;
7662     }
7663
7664     CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentLevel(onSuccess->Cancel(), onFailure->Cancel());
7665     if (err != CHIP_NO_ERROR) {
7666         delete onSuccess;
7667         delete onFailure;
7668         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7669     }
7670 }
7671
7672 - (void)configureAttributeCurrentLevel:(uint16_t)minInterval
7673                            maxInterval:(uint16_t)maxInterval
7674                                 change:(uint8_t)change
7675                      completionHandler:(ResponseHandler)completionHandler
7676 {
7677     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
7678     if (!onSuccess) {
7679         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7680         return;
7681     }
7682
7683     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7684     if (!onFailure) {
7685         delete onSuccess;
7686         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7687         return;
7688     }
7689
7690     CHIP_ERROR err = self.cppCluster.ConfigureAttributeCurrentLevel(
7691         onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
7692     if (err != CHIP_NO_ERROR) {
7693         delete onSuccess;
7694         delete onFailure;
7695         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7696     }
7697 }
7698
7699 - (void)reportAttributeCurrentLevel:(ResponseHandler)reportHandler
7700 {
7701     CHIPInt8uAttributeCallbackBridge * onReport = new CHIPInt8uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
7702     if (!onReport) {
7703         reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7704         return;
7705     }
7706
7707     CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentLevel(onReport->Cancel());
7708     if (err != CHIP_NO_ERROR) {
7709         delete onReport;
7710         reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
7711     }
7712 }
7713
7714 - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
7715 {
7716     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
7717     if (!onSuccess) {
7718         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7719         return;
7720     }
7721
7722     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7723     if (!onFailure) {
7724         delete onSuccess;
7725         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7726         return;
7727     }
7728
7729     CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
7730     if (err != CHIP_NO_ERROR) {
7731         delete onSuccess;
7732         delete onFailure;
7733         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7734     }
7735 }
7736
7737 @end
7738
7739 @interface CHIPLowPower ()
7740 @property (readonly) Controller::LowPowerCluster cppCluster;
7741 @end
7742
7743 @implementation CHIPLowPower
7744
7745 - (Controller::ClusterBase *)getCluster
7746 {
7747     return &_cppCluster;
7748 }
7749
7750 - (void)sleep:(ResponseHandler)completionHandler
7751 {
7752     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
7753     if (!onSuccess) {
7754         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7755         return;
7756     }
7757
7758     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7759     if (!onFailure) {
7760         delete onSuccess;
7761         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7762         return;
7763     }
7764
7765     CHIP_ERROR err = self.cppCluster.Sleep(onSuccess->Cancel(), onFailure->Cancel());
7766     if (err != CHIP_NO_ERROR) {
7767         delete onSuccess;
7768         delete onFailure;
7769         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7770     }
7771 }
7772
7773 - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
7774 {
7775     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
7776     if (!onSuccess) {
7777         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7778         return;
7779     }
7780
7781     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7782     if (!onFailure) {
7783         delete onSuccess;
7784         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7785         return;
7786     }
7787
7788     CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
7789     if (err != CHIP_NO_ERROR) {
7790         delete onSuccess;
7791         delete onFailure;
7792         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7793     }
7794 }
7795
7796 @end
7797
7798 @interface CHIPMediaPlayback ()
7799 @property (readonly) Controller::MediaPlaybackCluster cppCluster;
7800 @end
7801
7802 @implementation CHIPMediaPlayback
7803
7804 - (Controller::ClusterBase *)getCluster
7805 {
7806     return &_cppCluster;
7807 }
7808
7809 - (void)fastForwardRequest:(ResponseHandler)completionHandler
7810 {
7811     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
7812     if (!onSuccess) {
7813         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7814         return;
7815     }
7816
7817     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7818     if (!onFailure) {
7819         delete onSuccess;
7820         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7821         return;
7822     }
7823
7824     CHIP_ERROR err = self.cppCluster.FastForwardRequest(onSuccess->Cancel(), onFailure->Cancel());
7825     if (err != CHIP_NO_ERROR) {
7826         delete onSuccess;
7827         delete onFailure;
7828         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7829     }
7830 }
7831 - (void)nextRequest:(ResponseHandler)completionHandler
7832 {
7833     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
7834     if (!onSuccess) {
7835         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7836         return;
7837     }
7838
7839     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7840     if (!onFailure) {
7841         delete onSuccess;
7842         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7843         return;
7844     }
7845
7846     CHIP_ERROR err = self.cppCluster.NextRequest(onSuccess->Cancel(), onFailure->Cancel());
7847     if (err != CHIP_NO_ERROR) {
7848         delete onSuccess;
7849         delete onFailure;
7850         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7851     }
7852 }
7853 - (void)pauseRequest:(ResponseHandler)completionHandler
7854 {
7855     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
7856     if (!onSuccess) {
7857         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7858         return;
7859     }
7860
7861     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7862     if (!onFailure) {
7863         delete onSuccess;
7864         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7865         return;
7866     }
7867
7868     CHIP_ERROR err = self.cppCluster.PauseRequest(onSuccess->Cancel(), onFailure->Cancel());
7869     if (err != CHIP_NO_ERROR) {
7870         delete onSuccess;
7871         delete onFailure;
7872         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7873     }
7874 }
7875 - (void)playRequest:(ResponseHandler)completionHandler
7876 {
7877     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
7878     if (!onSuccess) {
7879         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7880         return;
7881     }
7882
7883     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7884     if (!onFailure) {
7885         delete onSuccess;
7886         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7887         return;
7888     }
7889
7890     CHIP_ERROR err = self.cppCluster.PlayRequest(onSuccess->Cancel(), onFailure->Cancel());
7891     if (err != CHIP_NO_ERROR) {
7892         delete onSuccess;
7893         delete onFailure;
7894         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7895     }
7896 }
7897 - (void)previousRequest:(ResponseHandler)completionHandler
7898 {
7899     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
7900     if (!onSuccess) {
7901         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7902         return;
7903     }
7904
7905     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7906     if (!onFailure) {
7907         delete onSuccess;
7908         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7909         return;
7910     }
7911
7912     CHIP_ERROR err = self.cppCluster.PreviousRequest(onSuccess->Cancel(), onFailure->Cancel());
7913     if (err != CHIP_NO_ERROR) {
7914         delete onSuccess;
7915         delete onFailure;
7916         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7917     }
7918 }
7919 - (void)rewindRequest:(ResponseHandler)completionHandler
7920 {
7921     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
7922     if (!onSuccess) {
7923         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7924         return;
7925     }
7926
7927     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7928     if (!onFailure) {
7929         delete onSuccess;
7930         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7931         return;
7932     }
7933
7934     CHIP_ERROR err = self.cppCluster.RewindRequest(onSuccess->Cancel(), onFailure->Cancel());
7935     if (err != CHIP_NO_ERROR) {
7936         delete onSuccess;
7937         delete onFailure;
7938         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7939     }
7940 }
7941 - (void)skipBackwardRequest:(ResponseHandler)completionHandler
7942 {
7943     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
7944     if (!onSuccess) {
7945         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7946         return;
7947     }
7948
7949     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7950     if (!onFailure) {
7951         delete onSuccess;
7952         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7953         return;
7954     }
7955
7956     CHIP_ERROR err = self.cppCluster.SkipBackwardRequest(onSuccess->Cancel(), onFailure->Cancel());
7957     if (err != CHIP_NO_ERROR) {
7958         delete onSuccess;
7959         delete onFailure;
7960         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7961     }
7962 }
7963 - (void)skipForwardRequest:(ResponseHandler)completionHandler
7964 {
7965     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
7966     if (!onSuccess) {
7967         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7968         return;
7969     }
7970
7971     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7972     if (!onFailure) {
7973         delete onSuccess;
7974         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7975         return;
7976     }
7977
7978     CHIP_ERROR err = self.cppCluster.SkipForwardRequest(onSuccess->Cancel(), onFailure->Cancel());
7979     if (err != CHIP_NO_ERROR) {
7980         delete onSuccess;
7981         delete onFailure;
7982         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
7983     }
7984 }
7985 - (void)startOverRequest:(ResponseHandler)completionHandler
7986 {
7987     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
7988     if (!onSuccess) {
7989         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7990         return;
7991     }
7992
7993     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
7994     if (!onFailure) {
7995         delete onSuccess;
7996         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
7997         return;
7998     }
7999
8000     CHIP_ERROR err = self.cppCluster.StartOverRequest(onSuccess->Cancel(), onFailure->Cancel());
8001     if (err != CHIP_NO_ERROR) {
8002         delete onSuccess;
8003         delete onFailure;
8004         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
8005     }
8006 }
8007 - (void)stopRequest:(ResponseHandler)completionHandler
8008 {
8009     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
8010     if (!onSuccess) {
8011         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8012         return;
8013     }
8014
8015     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
8016     if (!onFailure) {
8017         delete onSuccess;
8018         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8019         return;
8020     }
8021
8022     CHIP_ERROR err = self.cppCluster.StopRequest(onSuccess->Cancel(), onFailure->Cancel());
8023     if (err != CHIP_NO_ERROR) {
8024         delete onSuccess;
8025         delete onFailure;
8026         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
8027     }
8028 }
8029
8030 - (void)readAttributeCurrentState:(ResponseHandler)completionHandler
8031 {
8032     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
8033     if (!onSuccess) {
8034         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8035         return;
8036     }
8037
8038     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
8039     if (!onFailure) {
8040         delete onSuccess;
8041         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8042         return;
8043     }
8044
8045     CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentState(onSuccess->Cancel(), onFailure->Cancel());
8046     if (err != CHIP_NO_ERROR) {
8047         delete onSuccess;
8048         delete onFailure;
8049         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
8050     }
8051 }
8052
8053 - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
8054 {
8055     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
8056     if (!onSuccess) {
8057         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8058         return;
8059     }
8060
8061     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
8062     if (!onFailure) {
8063         delete onSuccess;
8064         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8065         return;
8066     }
8067
8068     CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
8069     if (err != CHIP_NO_ERROR) {
8070         delete onSuccess;
8071         delete onFailure;
8072         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
8073     }
8074 }
8075
8076 @end
8077
8078 @interface CHIPOnOff ()
8079 @property (readonly) Controller::OnOffCluster cppCluster;
8080 @end
8081
8082 @implementation CHIPOnOff
8083
8084 - (Controller::ClusterBase *)getCluster
8085 {
8086     return &_cppCluster;
8087 }
8088
8089 - (void)off:(ResponseHandler)completionHandler
8090 {
8091     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
8092     if (!onSuccess) {
8093         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8094         return;
8095     }
8096
8097     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
8098     if (!onFailure) {
8099         delete onSuccess;
8100         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8101         return;
8102     }
8103
8104     CHIP_ERROR err = self.cppCluster.Off(onSuccess->Cancel(), onFailure->Cancel());
8105     if (err != CHIP_NO_ERROR) {
8106         delete onSuccess;
8107         delete onFailure;
8108         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
8109     }
8110 }
8111 - (void)on:(ResponseHandler)completionHandler
8112 {
8113     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
8114     if (!onSuccess) {
8115         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8116         return;
8117     }
8118
8119     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
8120     if (!onFailure) {
8121         delete onSuccess;
8122         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8123         return;
8124     }
8125
8126     CHIP_ERROR err = self.cppCluster.On(onSuccess->Cancel(), onFailure->Cancel());
8127     if (err != CHIP_NO_ERROR) {
8128         delete onSuccess;
8129         delete onFailure;
8130         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
8131     }
8132 }
8133 - (void)toggle:(ResponseHandler)completionHandler
8134 {
8135     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
8136     if (!onSuccess) {
8137         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8138         return;
8139     }
8140
8141     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
8142     if (!onFailure) {
8143         delete onSuccess;
8144         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8145         return;
8146     }
8147
8148     CHIP_ERROR err = self.cppCluster.Toggle(onSuccess->Cancel(), onFailure->Cancel());
8149     if (err != CHIP_NO_ERROR) {
8150         delete onSuccess;
8151         delete onFailure;
8152         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
8153     }
8154 }
8155
8156 - (void)readAttributeOnOff:(ResponseHandler)completionHandler
8157 {
8158     CHIPBooleanAttributeCallbackBridge * onSuccess
8159         = new CHIPBooleanAttributeCallbackBridge(completionHandler, [self callbackQueue]);
8160     if (!onSuccess) {
8161         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8162         return;
8163     }
8164
8165     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
8166     if (!onFailure) {
8167         delete onSuccess;
8168         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8169         return;
8170     }
8171
8172     CHIP_ERROR err = self.cppCluster.ReadAttributeOnOff(onSuccess->Cancel(), onFailure->Cancel());
8173     if (err != CHIP_NO_ERROR) {
8174         delete onSuccess;
8175         delete onFailure;
8176         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
8177     }
8178 }
8179
8180 - (void)configureAttributeOnOff:(uint16_t)minInterval
8181                     maxInterval:(uint16_t)maxInterval
8182               completionHandler:(ResponseHandler)completionHandler
8183 {
8184     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
8185     if (!onSuccess) {
8186         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8187         return;
8188     }
8189
8190     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
8191     if (!onFailure) {
8192         delete onSuccess;
8193         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8194         return;
8195     }
8196
8197     CHIP_ERROR err = self.cppCluster.ConfigureAttributeOnOff(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval);
8198     if (err != CHIP_NO_ERROR) {
8199         delete onSuccess;
8200         delete onFailure;
8201         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
8202     }
8203 }
8204
8205 - (void)reportAttributeOnOff:(ResponseHandler)reportHandler
8206 {
8207     CHIPBooleanAttributeCallbackBridge * onReport
8208         = new CHIPBooleanAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
8209     if (!onReport) {
8210         reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8211         return;
8212     }
8213
8214     CHIP_ERROR err = self.cppCluster.ReportAttributeOnOff(onReport->Cancel());
8215     if (err != CHIP_NO_ERROR) {
8216         delete onReport;
8217         reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
8218     }
8219 }
8220
8221 - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
8222 {
8223     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
8224     if (!onSuccess) {
8225         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8226         return;
8227     }
8228
8229     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
8230     if (!onFailure) {
8231         delete onSuccess;
8232         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8233         return;
8234     }
8235
8236     CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
8237     if (err != CHIP_NO_ERROR) {
8238         delete onSuccess;
8239         delete onFailure;
8240         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
8241     }
8242 }
8243
8244 @end
8245
8246 @interface CHIPScenes ()
8247 @property (readonly) Controller::ScenesCluster cppCluster;
8248 @end
8249
8250 @implementation CHIPScenes
8251
8252 - (Controller::ClusterBase *)getCluster
8253 {
8254     return &_cppCluster;
8255 }
8256
8257 - (void)addScene:(uint16_t)groupId
8258               sceneId:(uint8_t)sceneId
8259        transitionTime:(uint16_t)transitionTime
8260             sceneName:(NSString *)sceneName
8261             clusterId:(uint16_t)clusterId
8262                length:(uint8_t)length
8263                 value:(uint8_t)value
8264     completionHandler:(ResponseHandler)completionHandler
8265 {
8266     CHIPScenesClusterAddSceneResponseCallbackBridge * onSuccess
8267         = new CHIPScenesClusterAddSceneResponseCallbackBridge(completionHandler, [self callbackQueue]);
8268     if (!onSuccess) {
8269         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8270         return;
8271     }
8272
8273     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
8274     if (!onFailure) {
8275         delete onSuccess;
8276         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8277         return;
8278     }
8279
8280     CHIP_ERROR err = self.cppCluster.AddScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId, transitionTime,
8281         chip::ByteSpan((const uint8_t *) [sceneName dataUsingEncoding:NSUTF8StringEncoding].bytes,
8282             [sceneName lengthOfBytesUsingEncoding:NSUTF8StringEncoding]),
8283         clusterId, length, value);
8284     if (err != CHIP_NO_ERROR) {
8285         delete onSuccess;
8286         delete onFailure;
8287         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
8288     }
8289 }
8290 - (void)getSceneMembership:(uint16_t)groupId completionHandler:(ResponseHandler)completionHandler
8291 {
8292     CHIPScenesClusterGetSceneMembershipResponseCallbackBridge * onSuccess
8293         = new CHIPScenesClusterGetSceneMembershipResponseCallbackBridge(completionHandler, [self callbackQueue]);
8294     if (!onSuccess) {
8295         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8296         return;
8297     }
8298
8299     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
8300     if (!onFailure) {
8301         delete onSuccess;
8302         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8303         return;
8304     }
8305
8306     CHIP_ERROR err = self.cppCluster.GetSceneMembership(onSuccess->Cancel(), onFailure->Cancel(), groupId);
8307     if (err != CHIP_NO_ERROR) {
8308         delete onSuccess;
8309         delete onFailure;
8310         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
8311     }
8312 }
8313 - (void)recallScene:(uint16_t)groupId
8314               sceneId:(uint8_t)sceneId
8315        transitionTime:(uint16_t)transitionTime
8316     completionHandler:(ResponseHandler)completionHandler
8317 {
8318     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
8319     if (!onSuccess) {
8320         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8321         return;
8322     }
8323
8324     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
8325     if (!onFailure) {
8326         delete onSuccess;
8327         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8328         return;
8329     }
8330
8331     CHIP_ERROR err = self.cppCluster.RecallScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId, transitionTime);
8332     if (err != CHIP_NO_ERROR) {
8333         delete onSuccess;
8334         delete onFailure;
8335         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
8336     }
8337 }
8338 - (void)removeAllScenes:(uint16_t)groupId completionHandler:(ResponseHandler)completionHandler
8339 {
8340     CHIPScenesClusterRemoveAllScenesResponseCallbackBridge * onSuccess
8341         = new CHIPScenesClusterRemoveAllScenesResponseCallbackBridge(completionHandler, [self callbackQueue]);
8342     if (!onSuccess) {
8343         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8344         return;
8345     }
8346
8347     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
8348     if (!onFailure) {
8349         delete onSuccess;
8350         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8351         return;
8352     }
8353
8354     CHIP_ERROR err = self.cppCluster.RemoveAllScenes(onSuccess->Cancel(), onFailure->Cancel(), groupId);
8355     if (err != CHIP_NO_ERROR) {
8356         delete onSuccess;
8357         delete onFailure;
8358         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
8359     }
8360 }
8361 - (void)removeScene:(uint16_t)groupId sceneId:(uint8_t)sceneId completionHandler:(ResponseHandler)completionHandler
8362 {
8363     CHIPScenesClusterRemoveSceneResponseCallbackBridge * onSuccess
8364         = new CHIPScenesClusterRemoveSceneResponseCallbackBridge(completionHandler, [self callbackQueue]);
8365     if (!onSuccess) {
8366         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8367         return;
8368     }
8369
8370     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
8371     if (!onFailure) {
8372         delete onSuccess;
8373         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8374         return;
8375     }
8376
8377     CHIP_ERROR err = self.cppCluster.RemoveScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId);
8378     if (err != CHIP_NO_ERROR) {
8379         delete onSuccess;
8380         delete onFailure;
8381         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
8382     }
8383 }
8384 - (void)storeScene:(uint16_t)groupId sceneId:(uint8_t)sceneId completionHandler:(ResponseHandler)completionHandler
8385 {
8386     CHIPScenesClusterStoreSceneResponseCallbackBridge * onSuccess
8387         = new CHIPScenesClusterStoreSceneResponseCallbackBridge(completionHandler, [self callbackQueue]);
8388     if (!onSuccess) {
8389         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8390         return;
8391     }
8392
8393     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
8394     if (!onFailure) {
8395         delete onSuccess;
8396         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8397         return;
8398     }
8399
8400     CHIP_ERROR err = self.cppCluster.StoreScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId);
8401     if (err != CHIP_NO_ERROR) {
8402         delete onSuccess;
8403         delete onFailure;
8404         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
8405     }
8406 }
8407 - (void)viewScene:(uint16_t)groupId sceneId:(uint8_t)sceneId completionHandler:(ResponseHandler)completionHandler
8408 {
8409     CHIPScenesClusterViewSceneResponseCallbackBridge * onSuccess
8410         = new CHIPScenesClusterViewSceneResponseCallbackBridge(completionHandler, [self callbackQueue]);
8411     if (!onSuccess) {
8412         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8413         return;
8414     }
8415
8416     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
8417     if (!onFailure) {
8418         delete onSuccess;
8419         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8420         return;
8421     }
8422
8423     CHIP_ERROR err = self.cppCluster.ViewScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId);
8424     if (err != CHIP_NO_ERROR) {
8425         delete onSuccess;
8426         delete onFailure;
8427         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
8428     }
8429 }
8430
8431 - (void)readAttributeSceneCount:(ResponseHandler)completionHandler
8432 {
8433     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
8434     if (!onSuccess) {
8435         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8436         return;
8437     }
8438
8439     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
8440     if (!onFailure) {
8441         delete onSuccess;
8442         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8443         return;
8444     }
8445
8446     CHIP_ERROR err = self.cppCluster.ReadAttributeSceneCount(onSuccess->Cancel(), onFailure->Cancel());
8447     if (err != CHIP_NO_ERROR) {
8448         delete onSuccess;
8449         delete onFailure;
8450         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
8451     }
8452 }
8453
8454 - (void)readAttributeCurrentScene:(ResponseHandler)completionHandler
8455 {
8456     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
8457     if (!onSuccess) {
8458         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8459         return;
8460     }
8461
8462     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
8463     if (!onFailure) {
8464         delete onSuccess;
8465         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8466         return;
8467     }
8468
8469     CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentScene(onSuccess->Cancel(), onFailure->Cancel());
8470     if (err != CHIP_NO_ERROR) {
8471         delete onSuccess;
8472         delete onFailure;
8473         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
8474     }
8475 }
8476
8477 - (void)readAttributeCurrentGroup:(ResponseHandler)completionHandler
8478 {
8479     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
8480     if (!onSuccess) {
8481         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8482         return;
8483     }
8484
8485     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
8486     if (!onFailure) {
8487         delete onSuccess;
8488         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8489         return;
8490     }
8491
8492     CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentGroup(onSuccess->Cancel(), onFailure->Cancel());
8493     if (err != CHIP_NO_ERROR) {
8494         delete onSuccess;
8495         delete onFailure;
8496         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
8497     }
8498 }
8499
8500 - (void)readAttributeSceneValid:(ResponseHandler)completionHandler
8501 {
8502     CHIPBooleanAttributeCallbackBridge * onSuccess
8503         = new CHIPBooleanAttributeCallbackBridge(completionHandler, [self callbackQueue]);
8504     if (!onSuccess) {
8505         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8506         return;
8507     }
8508
8509     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
8510     if (!onFailure) {
8511         delete onSuccess;
8512         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8513         return;
8514     }
8515
8516     CHIP_ERROR err = self.cppCluster.ReadAttributeSceneValid(onSuccess->Cancel(), onFailure->Cancel());
8517     if (err != CHIP_NO_ERROR) {
8518         delete onSuccess;
8519         delete onFailure;
8520         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
8521     }
8522 }
8523
8524 - (void)readAttributeNameSupport:(ResponseHandler)completionHandler
8525 {
8526     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
8527     if (!onSuccess) {
8528         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8529         return;
8530     }
8531
8532     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
8533     if (!onFailure) {
8534         delete onSuccess;
8535         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8536         return;
8537     }
8538
8539     CHIP_ERROR err = self.cppCluster.ReadAttributeNameSupport(onSuccess->Cancel(), onFailure->Cancel());
8540     if (err != CHIP_NO_ERROR) {
8541         delete onSuccess;
8542         delete onFailure;
8543         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
8544     }
8545 }
8546
8547 - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
8548 {
8549     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
8550     if (!onSuccess) {
8551         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8552         return;
8553     }
8554
8555     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
8556     if (!onFailure) {
8557         delete onSuccess;
8558         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8559         return;
8560     }
8561
8562     CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
8563     if (err != CHIP_NO_ERROR) {
8564         delete onSuccess;
8565         delete onFailure;
8566         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
8567     }
8568 }
8569
8570 @end
8571
8572 @interface CHIPTemperatureMeasurement ()
8573 @property (readonly) Controller::TemperatureMeasurementCluster cppCluster;
8574 @end
8575
8576 @implementation CHIPTemperatureMeasurement
8577
8578 - (Controller::ClusterBase *)getCluster
8579 {
8580     return &_cppCluster;
8581 }
8582
8583 - (void)readAttributeMeasuredValue:(ResponseHandler)completionHandler
8584 {
8585     CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]);
8586     if (!onSuccess) {
8587         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8588         return;
8589     }
8590
8591     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
8592     if (!onFailure) {
8593         delete onSuccess;
8594         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8595         return;
8596     }
8597
8598     CHIP_ERROR err = self.cppCluster.ReadAttributeMeasuredValue(onSuccess->Cancel(), onFailure->Cancel());
8599     if (err != CHIP_NO_ERROR) {
8600         delete onSuccess;
8601         delete onFailure;
8602         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
8603     }
8604 }
8605
8606 - (void)configureAttributeMeasuredValue:(uint16_t)minInterval
8607                             maxInterval:(uint16_t)maxInterval
8608                                  change:(int16_t)change
8609                       completionHandler:(ResponseHandler)completionHandler
8610 {
8611     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
8612     if (!onSuccess) {
8613         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8614         return;
8615     }
8616
8617     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
8618     if (!onFailure) {
8619         delete onSuccess;
8620         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8621         return;
8622     }
8623
8624     CHIP_ERROR err = self.cppCluster.ConfigureAttributeMeasuredValue(
8625         onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
8626     if (err != CHIP_NO_ERROR) {
8627         delete onSuccess;
8628         delete onFailure;
8629         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
8630     }
8631 }
8632
8633 - (void)reportAttributeMeasuredValue:(ResponseHandler)reportHandler
8634 {
8635     CHIPInt16sAttributeCallbackBridge * onReport = new CHIPInt16sAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
8636     if (!onReport) {
8637         reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8638         return;
8639     }
8640
8641     CHIP_ERROR err = self.cppCluster.ReportAttributeMeasuredValue(onReport->Cancel());
8642     if (err != CHIP_NO_ERROR) {
8643         delete onReport;
8644         reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
8645     }
8646 }
8647
8648 - (void)readAttributeMinMeasuredValue:(ResponseHandler)completionHandler
8649 {
8650     CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]);
8651     if (!onSuccess) {
8652         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8653         return;
8654     }
8655
8656     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
8657     if (!onFailure) {
8658         delete onSuccess;
8659         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8660         return;
8661     }
8662
8663     CHIP_ERROR err = self.cppCluster.ReadAttributeMinMeasuredValue(onSuccess->Cancel(), onFailure->Cancel());
8664     if (err != CHIP_NO_ERROR) {
8665         delete onSuccess;
8666         delete onFailure;
8667         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
8668     }
8669 }
8670
8671 - (void)readAttributeMaxMeasuredValue:(ResponseHandler)completionHandler
8672 {
8673     CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]);
8674     if (!onSuccess) {
8675         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8676         return;
8677     }
8678
8679     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
8680     if (!onFailure) {
8681         delete onSuccess;
8682         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8683         return;
8684     }
8685
8686     CHIP_ERROR err = self.cppCluster.ReadAttributeMaxMeasuredValue(onSuccess->Cancel(), onFailure->Cancel());
8687     if (err != CHIP_NO_ERROR) {
8688         delete onSuccess;
8689         delete onFailure;
8690         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
8691     }
8692 }
8693
8694 - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
8695 {
8696     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
8697     if (!onSuccess) {
8698         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8699         return;
8700     }
8701
8702     CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
8703     if (!onFailure) {
8704         delete onSuccess;
8705         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
8706         return;
8707     }
8708
8709     CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
8710     if (err != CHIP_NO_ERROR) {
8711         delete onSuccess;
8712         delete onFailure;
8713         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
8714     }
8715 }
8716
8717 @end