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