3 * Copyright (c) 2021 Project CHIP Authors
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 // THIS FILE IS GENERATED BY ZAP
20 #import <Foundation/Foundation.h>
22 #import "CHIPDevice.h"
23 #import "CHIPDevice_Internal.h"
25 #import "gen/CHIPClientCallbacks.h"
26 #import "gen/CHIPClustersObjc.h"
28 #include <controller/CHIPClusters.h>
29 #include <lib/support/Span.h>
31 using namespace ::chip;
33 class CHIPDefaultSuccessCallbackBridge : public Callback::Callback<DefaultSuccessCallback> {
35 CHIPDefaultSuccessCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
36 : Callback::Callback<DefaultSuccessCallback>(CallbackFn, this)
42 ~CHIPDefaultSuccessCallbackBridge() {};
44 static void CallbackFn(void * context)
46 CHIPDefaultSuccessCallbackBridge * callback = reinterpret_cast<CHIPDefaultSuccessCallbackBridge *>(context);
47 if (callback && callback->mQueue) {
48 dispatch_async(callback->mQueue, ^{
49 callback->mHandler(nil, nil);
57 ResponseHandler mHandler;
58 dispatch_queue_t mQueue;
61 class CHIPDefaultFailureCallbackBridge : public Callback::Callback<DefaultFailureCallback> {
63 CHIPDefaultFailureCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
64 : Callback::Callback<DefaultFailureCallback>(CallbackFn, this)
70 ~CHIPDefaultFailureCallbackBridge() {};
72 static void CallbackFn(void * context, uint8_t status)
74 CHIPDefaultFailureCallbackBridge * callback = reinterpret_cast<CHIPDefaultFailureCallbackBridge *>(context);
75 if (callback && callback->mQueue) {
76 dispatch_async(callback->mQueue, ^{
77 NSError * error = [NSError errorWithDomain:CHIPErrorDomain
79 userInfo:@ { NSLocalizedDescriptionKey : @"" }];
80 callback->mHandler(error, nil);
88 ResponseHandler mHandler;
89 dispatch_queue_t mQueue;
92 class CHIPUnsupportedAttributeCallbackBridge : public Callback::Callback<DefaultSuccessCallback> {
94 CHIPUnsupportedAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
95 : Callback::Callback<DefaultSuccessCallback>(CallbackFn, this)
99 ~CHIPUnsupportedAttributeCallbackBridge() {};
101 static void CallbackFn(void * context)
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);
117 ResponseHandler mHandler;
118 dispatch_queue_t mQueue;
121 class CHIPBooleanAttributeCallbackBridge : public Callback::Callback<BooleanAttributeCallback> {
123 CHIPBooleanAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
124 : Callback::Callback<BooleanAttributeCallback>(CallbackFn, this)
127 , mKeepAlive(keepAlive)
131 ~CHIPBooleanAttributeCallbackBridge() {};
133 static void CallbackFn(void * context, bool value)
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) {
148 ResponseHandler mHandler;
149 dispatch_queue_t mQueue;
153 class CHIPInt8uAttributeCallbackBridge : public Callback::Callback<Int8uAttributeCallback> {
155 CHIPInt8uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
156 : Callback::Callback<Int8uAttributeCallback>(CallbackFn, this)
159 , mKeepAlive(keepAlive)
163 ~CHIPInt8uAttributeCallbackBridge() {};
165 static void CallbackFn(void * context, uint8_t value)
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) {
180 ResponseHandler mHandler;
181 dispatch_queue_t mQueue;
185 class CHIPInt8sAttributeCallbackBridge : public Callback::Callback<Int8sAttributeCallback> {
187 CHIPInt8sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
188 : Callback::Callback<Int8sAttributeCallback>(CallbackFn, this)
191 , mKeepAlive(keepAlive)
195 ~CHIPInt8sAttributeCallbackBridge() {};
197 static void CallbackFn(void * context, int8_t value)
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) {
212 ResponseHandler mHandler;
213 dispatch_queue_t mQueue;
217 class CHIPInt16uAttributeCallbackBridge : public Callback::Callback<Int16uAttributeCallback> {
219 CHIPInt16uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
220 : Callback::Callback<Int16uAttributeCallback>(CallbackFn, this)
223 , mKeepAlive(keepAlive)
227 ~CHIPInt16uAttributeCallbackBridge() {};
229 static void CallbackFn(void * context, uint16_t value)
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) {
244 ResponseHandler mHandler;
245 dispatch_queue_t mQueue;
249 class CHIPInt16sAttributeCallbackBridge : public Callback::Callback<Int16sAttributeCallback> {
251 CHIPInt16sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
252 : Callback::Callback<Int16sAttributeCallback>(CallbackFn, this)
255 , mKeepAlive(keepAlive)
259 ~CHIPInt16sAttributeCallbackBridge() {};
261 static void CallbackFn(void * context, int16_t value)
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) {
276 ResponseHandler mHandler;
277 dispatch_queue_t mQueue;
281 @interface CHIPCluster ()
282 @property (readonly, nonatomic) dispatch_queue_t callbackQueue;
283 - (Controller::ClusterBase *)getCluster;
286 @implementation CHIPCluster
287 - (instancetype)initWithDevice:(CHIPDevice *)device endpoint:(EndpointId)endpoint queue:(dispatch_queue_t)queue
289 if (self = [super init]) {
290 Controller::ClusterBase * cppCluster = [self getCluster];
291 if (cppCluster == nullptr) {
295 CHIP_ERROR err = cppCluster->Associate([device internalDevice], endpoint);
296 if (err != CHIP_NO_ERROR) {
300 _callbackQueue = queue;
305 - (Controller::ClusterBase *)getCluster
311 @interface CHIPBasic ()
312 @property (readonly) Controller::BasicCluster cppCluster;
315 @implementation CHIPBasic
317 - (Controller::ClusterBase *)getCluster
322 - (void)resetToFactoryDefaults:(ResponseHandler)completionHandler
324 CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
326 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
330 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
333 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
337 CHIP_ERROR err = self.cppCluster.ResetToFactoryDefaults(onSuccess->Cancel(), onFailure->Cancel());
338 if (err != CHIP_NO_ERROR) {
341 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
345 - (void)readAttributeZclVersion:(ResponseHandler)completionHandler
347 CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
349 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
353 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
356 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
360 CHIP_ERROR err = self.cppCluster.ReadAttributeZclVersion(onSuccess->Cancel(), onFailure->Cancel());
361 if (err != CHIP_NO_ERROR) {
364 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
368 - (void)readAttributeApplicationVersion:(ResponseHandler)completionHandler
370 CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
372 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
376 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
379 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
383 CHIP_ERROR err = self.cppCluster.ReadAttributeApplicationVersion(onSuccess->Cancel(), onFailure->Cancel());
384 if (err != CHIP_NO_ERROR) {
387 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
391 - (void)readAttributeStackVersion:(ResponseHandler)completionHandler
393 CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
395 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
399 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
402 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
406 CHIP_ERROR err = self.cppCluster.ReadAttributeStackVersion(onSuccess->Cancel(), onFailure->Cancel());
407 if (err != CHIP_NO_ERROR) {
410 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
414 - (void)readAttributeHardwareVersion:(ResponseHandler)completionHandler
416 CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
418 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
422 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
425 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
429 CHIP_ERROR err = self.cppCluster.ReadAttributeHardwareVersion(onSuccess->Cancel(), onFailure->Cancel());
430 if (err != CHIP_NO_ERROR) {
433 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
437 - (void)readAttributeManufacturerName:(ResponseHandler)completionHandler
439 CHIPUnsupportedAttributeCallbackBridge * onSuccess
440 = new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
442 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
446 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
449 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
453 CHIP_ERROR err = self.cppCluster.ReadAttributeManufacturerName(onSuccess->Cancel(), onFailure->Cancel());
454 if (err != CHIP_NO_ERROR) {
457 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
461 - (void)readAttributeModelIdentifier:(ResponseHandler)completionHandler
463 CHIPUnsupportedAttributeCallbackBridge * onSuccess
464 = new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
466 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
470 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
473 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
477 CHIP_ERROR err = self.cppCluster.ReadAttributeModelIdentifier(onSuccess->Cancel(), onFailure->Cancel());
478 if (err != CHIP_NO_ERROR) {
481 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
485 - (void)readAttributeDateCode:(ResponseHandler)completionHandler
487 CHIPUnsupportedAttributeCallbackBridge * onSuccess
488 = new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
490 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
494 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
497 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
501 CHIP_ERROR err = self.cppCluster.ReadAttributeDateCode(onSuccess->Cancel(), onFailure->Cancel());
502 if (err != CHIP_NO_ERROR) {
505 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
509 - (void)readAttributePowerSource:(ResponseHandler)completionHandler
511 CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
513 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
517 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
520 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
524 CHIP_ERROR err = self.cppCluster.ReadAttributePowerSource(onSuccess->Cancel(), onFailure->Cancel());
525 if (err != CHIP_NO_ERROR) {
528 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
532 - (void)readAttributeGenericDeviceClass:(ResponseHandler)completionHandler
534 CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
536 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
540 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
543 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
547 CHIP_ERROR err = self.cppCluster.ReadAttributeGenericDeviceClass(onSuccess->Cancel(), onFailure->Cancel());
548 if (err != CHIP_NO_ERROR) {
551 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
555 - (void)readAttributeGenericDeviceType:(ResponseHandler)completionHandler
557 CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
559 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
563 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
566 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
570 CHIP_ERROR err = self.cppCluster.ReadAttributeGenericDeviceType(onSuccess->Cancel(), onFailure->Cancel());
571 if (err != CHIP_NO_ERROR) {
574 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
578 - (void)readAttributeProductCode:(ResponseHandler)completionHandler
580 CHIPUnsupportedAttributeCallbackBridge * onSuccess
581 = new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
583 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
587 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
590 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
594 CHIP_ERROR err = self.cppCluster.ReadAttributeProductCode(onSuccess->Cancel(), onFailure->Cancel());
595 if (err != CHIP_NO_ERROR) {
598 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
602 - (void)readAttributeProductUrl:(ResponseHandler)completionHandler
604 CHIPUnsupportedAttributeCallbackBridge * onSuccess
605 = new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
607 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
611 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
614 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
618 CHIP_ERROR err = self.cppCluster.ReadAttributeProductUrl(onSuccess->Cancel(), onFailure->Cancel());
619 if (err != CHIP_NO_ERROR) {
622 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
626 - (void)readAttributeSwBuildId:(ResponseHandler)completionHandler
628 CHIPUnsupportedAttributeCallbackBridge * onSuccess
629 = new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
631 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
635 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
638 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
642 CHIP_ERROR err = self.cppCluster.ReadAttributeSwBuildId(onSuccess->Cancel(), onFailure->Cancel());
643 if (err != CHIP_NO_ERROR) {
646 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
650 - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
652 CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
654 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
658 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
661 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
665 CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
666 if (err != CHIP_NO_ERROR) {
669 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
675 @interface CHIPLevelControl ()
676 @property (readonly) Controller::LevelControlCluster cppCluster;
679 @implementation CHIPLevelControl
681 - (Controller::ClusterBase *)getCluster
686 - (void)move:(uint8_t)moveMode
688 optionMask:(uint8_t)optionMask
689 optionOverride:(uint8_t)optionOverride
690 completionHandler:(ResponseHandler)completionHandler
692 CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
694 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
698 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
701 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
705 CHIP_ERROR err = self.cppCluster.Move(onSuccess->Cancel(), onFailure->Cancel(), moveMode, rate, optionMask, optionOverride);
706 if (err != CHIP_NO_ERROR) {
709 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
712 - (void)moveToLevel:(uint8_t)level
713 transitionTime:(uint16_t)transitionTime
714 optionMask:(uint8_t)optionMask
715 optionOverride:(uint8_t)optionOverride
716 completionHandler:(ResponseHandler)completionHandler
718 CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
720 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
724 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
727 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
732 = self.cppCluster.MoveToLevel(onSuccess->Cancel(), onFailure->Cancel(), level, transitionTime, optionMask, optionOverride);
733 if (err != CHIP_NO_ERROR) {
736 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
739 - (void)moveToLevelWithOnOff:(uint8_t)level
740 transitionTime:(uint16_t)transitionTime
741 completionHandler:(ResponseHandler)completionHandler
743 CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
745 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
749 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
752 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
756 CHIP_ERROR err = self.cppCluster.MoveToLevelWithOnOff(onSuccess->Cancel(), onFailure->Cancel(), level, transitionTime);
757 if (err != CHIP_NO_ERROR) {
760 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
763 - (void)moveWithOnOff:(uint8_t)moveMode rate:(uint8_t)rate completionHandler:(ResponseHandler)completionHandler
765 CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
767 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
771 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
774 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
778 CHIP_ERROR err = self.cppCluster.MoveWithOnOff(onSuccess->Cancel(), onFailure->Cancel(), moveMode, rate);
779 if (err != CHIP_NO_ERROR) {
782 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
785 - (void)step:(uint8_t)stepMode
786 stepSize:(uint8_t)stepSize
787 transitionTime:(uint16_t)transitionTime
788 optionMask:(uint8_t)optionMask
789 optionOverride:(uint8_t)optionOverride
790 completionHandler:(ResponseHandler)completionHandler
792 CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
794 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
798 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
801 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
805 CHIP_ERROR err = self.cppCluster.Step(
806 onSuccess->Cancel(), onFailure->Cancel(), stepMode, stepSize, transitionTime, optionMask, optionOverride);
807 if (err != CHIP_NO_ERROR) {
810 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
813 - (void)stepWithOnOff:(uint8_t)stepMode
814 stepSize:(uint8_t)stepSize
815 transitionTime:(uint16_t)transitionTime
816 completionHandler:(ResponseHandler)completionHandler
818 CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
820 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
824 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
827 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
831 CHIP_ERROR err = self.cppCluster.StepWithOnOff(onSuccess->Cancel(), onFailure->Cancel(), stepMode, stepSize, transitionTime);
832 if (err != CHIP_NO_ERROR) {
835 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
838 - (void)stop:(uint8_t)optionMask optionOverride:(uint8_t)optionOverride completionHandler:(ResponseHandler)completionHandler
840 CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
842 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
846 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
849 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
853 CHIP_ERROR err = self.cppCluster.Stop(onSuccess->Cancel(), onFailure->Cancel(), optionMask, optionOverride);
854 if (err != CHIP_NO_ERROR) {
857 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
860 - (void)stopWithOnOff:(ResponseHandler)completionHandler
862 CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
864 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
868 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
871 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
875 CHIP_ERROR err = self.cppCluster.StopWithOnOff(onSuccess->Cancel(), onFailure->Cancel());
876 if (err != CHIP_NO_ERROR) {
879 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
883 - (void)readAttributeCurrentLevel:(ResponseHandler)completionHandler
885 CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
887 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
891 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
894 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
898 CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentLevel(onSuccess->Cancel(), onFailure->Cancel());
899 if (err != CHIP_NO_ERROR) {
902 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
906 - (void)configureAttributeCurrentLevel:(uint16_t)minInterval
907 maxInterval:(uint16_t)maxInterval
908 change:(uint8_t)change
909 completionHandler:(ResponseHandler)completionHandler
911 CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
913 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
917 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
920 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
924 CHIP_ERROR err = self.cppCluster.ConfigureAttributeCurrentLevel(
925 onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
926 if (err != CHIP_NO_ERROR) {
929 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
933 - (void)reportAttributeCurrentLevel:(ResponseHandler)reportHandler
935 CHIPInt8uAttributeCallbackBridge * onReport = new CHIPInt8uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
937 reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
941 CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentLevel(onReport->Cancel());
942 if (err != CHIP_NO_ERROR) {
944 reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
948 - (void)readAttributeRemainingTime:(ResponseHandler)completionHandler
950 CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
952 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
956 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
959 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
963 CHIP_ERROR err = self.cppCluster.ReadAttributeRemainingTime(onSuccess->Cancel(), onFailure->Cancel());
964 if (err != CHIP_NO_ERROR) {
967 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
971 - (void)readAttributeOptions:(ResponseHandler)completionHandler
973 CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
975 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
979 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
982 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
986 CHIP_ERROR err = self.cppCluster.ReadAttributeOptions(onSuccess->Cancel(), onFailure->Cancel());
987 if (err != CHIP_NO_ERROR) {
990 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
994 - (void)writeAttributeOptions:(uint8_t)value completionHandler:(ResponseHandler)completionHandler
996 CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
998 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1002 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1005 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1009 CHIP_ERROR err = self.cppCluster.WriteAttributeOptions(onSuccess->Cancel(), onFailure->Cancel(), value);
1010 if (err != CHIP_NO_ERROR) {
1013 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1017 - (void)readAttributeStartUpCurrentLevel:(ResponseHandler)completionHandler
1019 CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
1021 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1025 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1028 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1032 CHIP_ERROR err = self.cppCluster.ReadAttributeStartUpCurrentLevel(onSuccess->Cancel(), onFailure->Cancel());
1033 if (err != CHIP_NO_ERROR) {
1036 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1040 - (void)writeAttributeStartUpCurrentLevel:(uint8_t)value completionHandler:(ResponseHandler)completionHandler
1042 CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1044 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1048 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1051 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1055 CHIP_ERROR err = self.cppCluster.WriteAttributeStartUpCurrentLevel(onSuccess->Cancel(), onFailure->Cancel(), value);
1056 if (err != CHIP_NO_ERROR) {
1059 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1063 - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
1065 CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
1067 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1071 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1074 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1078 CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
1079 if (err != CHIP_NO_ERROR) {
1082 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1088 @interface CHIPOnOff ()
1089 @property (readonly) Controller::OnOffCluster cppCluster;
1092 @implementation CHIPOnOff
1094 - (Controller::ClusterBase *)getCluster
1096 return &_cppCluster;
1099 - (void)off:(ResponseHandler)completionHandler
1101 CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1103 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1107 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1110 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1114 CHIP_ERROR err = self.cppCluster.Off(onSuccess->Cancel(), onFailure->Cancel());
1115 if (err != CHIP_NO_ERROR) {
1118 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1121 - (void)offWithEffect:(uint8_t)effectId effectVariant:(uint8_t)effectVariant completionHandler:(ResponseHandler)completionHandler
1123 CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1125 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1129 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1132 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1136 CHIP_ERROR err = self.cppCluster.OffWithEffect(onSuccess->Cancel(), onFailure->Cancel(), effectId, effectVariant);
1137 if (err != CHIP_NO_ERROR) {
1140 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1143 - (void)on:(ResponseHandler)completionHandler
1145 CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1147 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1151 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1154 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1158 CHIP_ERROR err = self.cppCluster.On(onSuccess->Cancel(), onFailure->Cancel());
1159 if (err != CHIP_NO_ERROR) {
1162 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1165 - (void)onWithRecallGlobalScene:(ResponseHandler)completionHandler
1167 CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1169 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1173 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1176 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1180 CHIP_ERROR err = self.cppCluster.OnWithRecallGlobalScene(onSuccess->Cancel(), onFailure->Cancel());
1181 if (err != CHIP_NO_ERROR) {
1184 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1187 - (void)onWithTimedOff:(uint8_t)onOffControl
1188 onTime:(uint16_t)onTime
1189 offWaitTime:(uint16_t)offWaitTime
1190 completionHandler:(ResponseHandler)completionHandler
1192 CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1194 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1198 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1201 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1205 CHIP_ERROR err = self.cppCluster.OnWithTimedOff(onSuccess->Cancel(), onFailure->Cancel(), onOffControl, onTime, offWaitTime);
1206 if (err != CHIP_NO_ERROR) {
1209 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1212 - (void)toggle:(ResponseHandler)completionHandler
1214 CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1216 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1220 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1223 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1227 CHIP_ERROR err = self.cppCluster.Toggle(onSuccess->Cancel(), onFailure->Cancel());
1228 if (err != CHIP_NO_ERROR) {
1231 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1235 - (void)readAttributeOnOff:(ResponseHandler)completionHandler
1237 CHIPBooleanAttributeCallbackBridge * onSuccess
1238 = new CHIPBooleanAttributeCallbackBridge(completionHandler, [self callbackQueue]);
1240 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1244 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1247 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1251 CHIP_ERROR err = self.cppCluster.ReadAttributeOnOff(onSuccess->Cancel(), onFailure->Cancel());
1252 if (err != CHIP_NO_ERROR) {
1255 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1259 - (void)configureAttributeOnOff:(uint16_t)minInterval
1260 maxInterval:(uint16_t)maxInterval
1261 completionHandler:(ResponseHandler)completionHandler
1263 CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1265 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1269 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1272 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1276 CHIP_ERROR err = self.cppCluster.ConfigureAttributeOnOff(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval);
1277 if (err != CHIP_NO_ERROR) {
1280 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1284 - (void)reportAttributeOnOff:(ResponseHandler)reportHandler
1286 CHIPBooleanAttributeCallbackBridge * onReport
1287 = new CHIPBooleanAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
1289 reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1293 CHIP_ERROR err = self.cppCluster.ReportAttributeOnOff(onReport->Cancel());
1294 if (err != CHIP_NO_ERROR) {
1296 reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
1300 - (void)readAttributeGlobalSceneControl:(ResponseHandler)completionHandler
1302 CHIPBooleanAttributeCallbackBridge * onSuccess
1303 = new CHIPBooleanAttributeCallbackBridge(completionHandler, [self callbackQueue]);
1305 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1309 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1312 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1316 CHIP_ERROR err = self.cppCluster.ReadAttributeGlobalSceneControl(onSuccess->Cancel(), onFailure->Cancel());
1317 if (err != CHIP_NO_ERROR) {
1320 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1324 - (void)readAttributeOnTime:(ResponseHandler)completionHandler
1326 CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
1328 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1332 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1335 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1339 CHIP_ERROR err = self.cppCluster.ReadAttributeOnTime(onSuccess->Cancel(), onFailure->Cancel());
1340 if (err != CHIP_NO_ERROR) {
1343 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1347 - (void)writeAttributeOnTime:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
1349 CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1351 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1355 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1358 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1362 CHIP_ERROR err = self.cppCluster.WriteAttributeOnTime(onSuccess->Cancel(), onFailure->Cancel(), value);
1363 if (err != CHIP_NO_ERROR) {
1366 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1370 - (void)readAttributeOffWaitTime:(ResponseHandler)completionHandler
1372 CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
1374 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1378 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1381 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1385 CHIP_ERROR err = self.cppCluster.ReadAttributeOffWaitTime(onSuccess->Cancel(), onFailure->Cancel());
1386 if (err != CHIP_NO_ERROR) {
1389 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1393 - (void)writeAttributeOffWaitTime:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
1395 CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1397 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1401 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1404 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1408 CHIP_ERROR err = self.cppCluster.WriteAttributeOffWaitTime(onSuccess->Cancel(), onFailure->Cancel(), value);
1409 if (err != CHIP_NO_ERROR) {
1412 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1416 - (void)readAttributeStartUpOnOff:(ResponseHandler)completionHandler
1418 CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
1420 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1424 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1427 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1431 CHIP_ERROR err = self.cppCluster.ReadAttributeStartUpOnOff(onSuccess->Cancel(), onFailure->Cancel());
1432 if (err != CHIP_NO_ERROR) {
1435 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1439 - (void)writeAttributeStartUpOnOff:(uint8_t)value completionHandler:(ResponseHandler)completionHandler
1441 CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
1443 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1447 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1450 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1454 CHIP_ERROR err = self.cppCluster.WriteAttributeStartUpOnOff(onSuccess->Cancel(), onFailure->Cancel(), value);
1455 if (err != CHIP_NO_ERROR) {
1458 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
1462 - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
1464 CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
1466 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1470 CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
1473 completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
1477 CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
1478 if (err != CHIP_NO_ERROR) {
1481 completionHandler([CHIPError errorForCHIPErrorCode:err], nil);