blob: 4651649bf3207f8c6b57a4d324881da3e66bbb0e [file] [log] [blame]
/*
*
* Copyright (c) 2021 Project CHIP Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// THIS FILE IS GENERATED BY ZAP
#import <Foundation/Foundation.h>
#import "CHIPDevice.h"
#import "CHIPDevice_Internal.h"
#import "ChipError.h"
#import "gen/CHIPClientCallbacks.h"
#import "gen/CHIPClustersObjc.h"
#include <controller/CHIPClusters.h>
#include <lib/support/Span.h>
using namespace ::chip;
class CHIPDefaultSuccessCallbackBridge : public Callback::Callback<DefaultSuccessCallback> {
public:
CHIPDefaultSuccessCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<DefaultSuccessCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPDefaultSuccessCallbackBridge() {};
static void CallbackFn(void * context)
{
CHIPDefaultSuccessCallbackBridge * callback = reinterpret_cast<CHIPDefaultSuccessCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, nil);
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPDefaultFailureCallbackBridge : public Callback::Callback<DefaultFailureCallback> {
public:
CHIPDefaultFailureCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<DefaultFailureCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPDefaultFailureCallbackBridge() {};
static void CallbackFn(void * context, uint8_t status)
{
CHIPDefaultFailureCallbackBridge * callback = reinterpret_cast<CHIPDefaultFailureCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
NSError * error = [NSError errorWithDomain:CHIPErrorDomain
code:status
userInfo:@ { NSLocalizedDescriptionKey : @"" }];
callback->mHandler(error, nil);
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPUnsupportedAttributeCallbackBridge : public Callback::Callback<DefaultSuccessCallback> {
public:
CHIPUnsupportedAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<DefaultSuccessCallback>(CallbackFn, this)
{
}
~CHIPUnsupportedAttributeCallbackBridge() {};
static void CallbackFn(void * context)
{
CHIPUnsupportedAttributeCallbackBridge * callback = reinterpret_cast<CHIPUnsupportedAttributeCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
NSError * error = [NSError errorWithDomain:CHIPErrorDomain
code:CHIPErrorCodeUndefinedError
userInfo:@ { NSLocalizedDescriptionKey : @"Unsupported attribute type" }];
callback->mHandler(error, nil);
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPBooleanAttributeCallbackBridge : public Callback::Callback<BooleanAttributeCallback> {
public:
CHIPBooleanAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
: Callback::Callback<BooleanAttributeCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
, mKeepAlive(keepAlive)
{
}
~CHIPBooleanAttributeCallbackBridge() {};
static void CallbackFn(void * context, bool value)
{
CHIPBooleanAttributeCallbackBridge * callback = reinterpret_cast<CHIPBooleanAttributeCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ { @"value" : [NSNumber numberWithBool:value] });
if (!callback->mKeepAlive) {
callback->Cancel();
delete callback;
}
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
bool mKeepAlive;
};
class CHIPInt8uAttributeCallbackBridge : public Callback::Callback<Int8uAttributeCallback> {
public:
CHIPInt8uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
: Callback::Callback<Int8uAttributeCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
, mKeepAlive(keepAlive)
{
}
~CHIPInt8uAttributeCallbackBridge() {};
static void CallbackFn(void * context, uint8_t value)
{
CHIPInt8uAttributeCallbackBridge * callback = reinterpret_cast<CHIPInt8uAttributeCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ { @"value" : [NSNumber numberWithUnsignedChar:value] });
if (!callback->mKeepAlive) {
callback->Cancel();
delete callback;
}
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
bool mKeepAlive;
};
class CHIPInt8sAttributeCallbackBridge : public Callback::Callback<Int8sAttributeCallback> {
public:
CHIPInt8sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
: Callback::Callback<Int8sAttributeCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
, mKeepAlive(keepAlive)
{
}
~CHIPInt8sAttributeCallbackBridge() {};
static void CallbackFn(void * context, int8_t value)
{
CHIPInt8sAttributeCallbackBridge * callback = reinterpret_cast<CHIPInt8sAttributeCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ { @"value" : [NSNumber numberWithChar:value] });
if (!callback->mKeepAlive) {
callback->Cancel();
delete callback;
}
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
bool mKeepAlive;
};
class CHIPInt16uAttributeCallbackBridge : public Callback::Callback<Int16uAttributeCallback> {
public:
CHIPInt16uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
: Callback::Callback<Int16uAttributeCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
, mKeepAlive(keepAlive)
{
}
~CHIPInt16uAttributeCallbackBridge() {};
static void CallbackFn(void * context, uint16_t value)
{
CHIPInt16uAttributeCallbackBridge * callback = reinterpret_cast<CHIPInt16uAttributeCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ { @"value" : [NSNumber numberWithUnsignedShort:value] });
if (!callback->mKeepAlive) {
callback->Cancel();
delete callback;
}
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
bool mKeepAlive;
};
class CHIPInt16sAttributeCallbackBridge : public Callback::Callback<Int16sAttributeCallback> {
public:
CHIPInt16sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
: Callback::Callback<Int16sAttributeCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
, mKeepAlive(keepAlive)
{
}
~CHIPInt16sAttributeCallbackBridge() {};
static void CallbackFn(void * context, int16_t value)
{
CHIPInt16sAttributeCallbackBridge * callback = reinterpret_cast<CHIPInt16sAttributeCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ { @"value" : [NSNumber numberWithShort:value] });
if (!callback->mKeepAlive) {
callback->Cancel();
delete callback;
}
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
bool mKeepAlive;
};
@interface CHIPCluster ()
@property (readonly, nonatomic) dispatch_queue_t callbackQueue;
- (Controller::ClusterBase *)getCluster;
@end
@implementation CHIPCluster
- (instancetype)initWithDevice:(CHIPDevice *)device endpoint:(EndpointId)endpoint queue:(dispatch_queue_t)queue
{
if (self = [super init]) {
Controller::ClusterBase * cppCluster = [self getCluster];
if (cppCluster == nullptr) {
return nil;
}
CHIP_ERROR err = cppCluster->Associate([device internalDevice], endpoint);
if (err != CHIP_NO_ERROR) {
return nil;
}
_callbackQueue = queue;
}
return self;
}
- (Controller::ClusterBase *)getCluster
{
return nullptr;
}
@end
@interface CHIPApplicationBasic ()
@property (readonly) Controller::ApplicationBasicCluster cppCluster;
@end
@implementation CHIPApplicationBasic
- (Controller::ClusterBase *)getCluster
{
return &_cppCluster;
}
- (void)readAttributeVendorName:(ResponseHandler)completionHandler
{
CHIPUnsupportedAttributeCallbackBridge * onSuccess
= new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeVendorName(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeVendorId:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeVendorId(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeApplicationName:(ResponseHandler)completionHandler
{
CHIPUnsupportedAttributeCallbackBridge * onSuccess
= new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeApplicationName(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeProductId:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeProductId(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeApplicationId:(ResponseHandler)completionHandler
{
CHIPUnsupportedAttributeCallbackBridge * onSuccess
= new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeApplicationId(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeCatalogVendorId:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeCatalogVendorId(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeApplicationSatus:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeApplicationSatus(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
@end
@interface CHIPBarrierControl ()
@property (readonly) Controller::BarrierControlCluster cppCluster;
@end
@implementation CHIPBarrierControl
- (Controller::ClusterBase *)getCluster
{
return &_cppCluster;
}
- (void)barrierControlGoToPercent:(uint8_t)percentOpen completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.BarrierControlGoToPercent(onSuccess->Cancel(), onFailure->Cancel(), percentOpen);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)barrierControlStop:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.BarrierControlStop(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeBarrierMovingState:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeBarrierMovingState(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeBarrierSafetyStatus:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeBarrierSafetyStatus(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeBarrierCapabilities:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeBarrierCapabilities(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeBarrierPosition:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeBarrierPosition(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
@end
@interface CHIPBasic ()
@property (readonly) Controller::BasicCluster cppCluster;
@end
@implementation CHIPBasic
- (Controller::ClusterBase *)getCluster
{
return &_cppCluster;
}
- (void)mfgSpecificPing:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.MfgSpecificPing(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)resetToFactoryDefaults:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ResetToFactoryDefaults(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeZclVersion:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeZclVersion(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributePowerSource:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributePowerSource(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
@end
@interface CHIPBinding ()
@property (readonly) Controller::BindingCluster cppCluster;
@end
@implementation CHIPBinding
- (Controller::ClusterBase *)getCluster
{
return &_cppCluster;
}
- (void)bind:(uint64_t)nodeId
groupId:(uint16_t)groupId
endpointId:(uint8_t)endpointId
clusterId:(uint16_t)clusterId
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.Bind(onSuccess->Cancel(), onFailure->Cancel(), nodeId, groupId, endpointId, clusterId);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)unbind:(uint64_t)nodeId
groupId:(uint16_t)groupId
endpointId:(uint8_t)endpointId
clusterId:(uint16_t)clusterId
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.Unbind(onSuccess->Cancel(), onFailure->Cancel(), nodeId, groupId, endpointId, clusterId);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
@end
@interface CHIPColorControl ()
@property (readonly) Controller::ColorControlCluster cppCluster;
@end
@implementation CHIPColorControl
- (Controller::ClusterBase *)getCluster
{
return &_cppCluster;
}
- (void)moveColor:(int16_t)rateX
rateY:(int16_t)rateY
optionsMask:(uint8_t)optionsMask
optionsOverride:(uint8_t)optionsOverride
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err
= self.cppCluster.MoveColor(onSuccess->Cancel(), onFailure->Cancel(), rateX, rateY, optionsMask, optionsOverride);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)moveColorTemperature:(uint8_t)moveMode
rate:(uint16_t)rate
colorTemperatureMinimum:(uint16_t)colorTemperatureMinimum
colorTemperatureMaximum:(uint16_t)colorTemperatureMaximum
optionsMask:(uint8_t)optionsMask
optionsOverride:(uint8_t)optionsOverride
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.MoveColorTemperature(onSuccess->Cancel(), onFailure->Cancel(), moveMode, rate,
colorTemperatureMinimum, colorTemperatureMaximum, optionsMask, optionsOverride);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)moveHue:(uint8_t)moveMode
rate:(uint8_t)rate
optionsMask:(uint8_t)optionsMask
optionsOverride:(uint8_t)optionsOverride
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err
= self.cppCluster.MoveHue(onSuccess->Cancel(), onFailure->Cancel(), moveMode, rate, optionsMask, optionsOverride);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)moveSaturation:(uint8_t)moveMode
rate:(uint8_t)rate
optionsMask:(uint8_t)optionsMask
optionsOverride:(uint8_t)optionsOverride
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err
= self.cppCluster.MoveSaturation(onSuccess->Cancel(), onFailure->Cancel(), moveMode, rate, optionsMask, optionsOverride);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)moveToColor:(uint16_t)colorX
colorY:(uint16_t)colorY
transitionTime:(uint16_t)transitionTime
optionsMask:(uint8_t)optionsMask
optionsOverride:(uint8_t)optionsOverride
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.MoveToColor(
onSuccess->Cancel(), onFailure->Cancel(), colorX, colorY, transitionTime, optionsMask, optionsOverride);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)moveToColorTemperature:(uint16_t)colorTemperature
transitionTime:(uint16_t)transitionTime
optionsMask:(uint8_t)optionsMask
optionsOverride:(uint8_t)optionsOverride
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.MoveToColorTemperature(
onSuccess->Cancel(), onFailure->Cancel(), colorTemperature, transitionTime, optionsMask, optionsOverride);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)moveToHue:(uint8_t)hue
direction:(uint8_t)direction
transitionTime:(uint16_t)transitionTime
optionsMask:(uint8_t)optionsMask
optionsOverride:(uint8_t)optionsOverride
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.MoveToHue(
onSuccess->Cancel(), onFailure->Cancel(), hue, direction, transitionTime, optionsMask, optionsOverride);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)moveToHueAndSaturation:(uint8_t)hue
saturation:(uint8_t)saturation
transitionTime:(uint16_t)transitionTime
optionsMask:(uint8_t)optionsMask
optionsOverride:(uint8_t)optionsOverride
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.MoveToHueAndSaturation(
onSuccess->Cancel(), onFailure->Cancel(), hue, saturation, transitionTime, optionsMask, optionsOverride);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)moveToSaturation:(uint8_t)saturation
transitionTime:(uint16_t)transitionTime
optionsMask:(uint8_t)optionsMask
optionsOverride:(uint8_t)optionsOverride
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.MoveToSaturation(
onSuccess->Cancel(), onFailure->Cancel(), saturation, transitionTime, optionsMask, optionsOverride);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)stepColor:(int16_t)stepX
stepY:(int16_t)stepY
transitionTime:(uint16_t)transitionTime
optionsMask:(uint8_t)optionsMask
optionsOverride:(uint8_t)optionsOverride
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.StepColor(
onSuccess->Cancel(), onFailure->Cancel(), stepX, stepY, transitionTime, optionsMask, optionsOverride);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)stepColorTemperature:(uint8_t)stepMode
stepSize:(uint16_t)stepSize
transitionTime:(uint16_t)transitionTime
colorTemperatureMinimum:(uint16_t)colorTemperatureMinimum
colorTemperatureMaximum:(uint16_t)colorTemperatureMaximum
optionsMask:(uint8_t)optionsMask
optionsOverride:(uint8_t)optionsOverride
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.StepColorTemperature(onSuccess->Cancel(), onFailure->Cancel(), stepMode, stepSize,
transitionTime, colorTemperatureMinimum, colorTemperatureMaximum, optionsMask, optionsOverride);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)stepHue:(uint8_t)stepMode
stepSize:(uint8_t)stepSize
transitionTime:(uint8_t)transitionTime
optionsMask:(uint8_t)optionsMask
optionsOverride:(uint8_t)optionsOverride
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.StepHue(
onSuccess->Cancel(), onFailure->Cancel(), stepMode, stepSize, transitionTime, optionsMask, optionsOverride);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)stepSaturation:(uint8_t)stepMode
stepSize:(uint8_t)stepSize
transitionTime:(uint8_t)transitionTime
optionsMask:(uint8_t)optionsMask
optionsOverride:(uint8_t)optionsOverride
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.StepSaturation(
onSuccess->Cancel(), onFailure->Cancel(), stepMode, stepSize, transitionTime, optionsMask, optionsOverride);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)stopMoveStep:(uint8_t)optionsMask
optionsOverride:(uint8_t)optionsOverride
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.StopMoveStep(onSuccess->Cancel(), onFailure->Cancel(), optionsMask, optionsOverride);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeCurrentHue:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentHue(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)configureAttributeCurrentHue:(uint16_t)minInterval
maxInterval:(uint16_t)maxInterval
change:(uint8_t)change
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err
= self.cppCluster.ConfigureAttributeCurrentHue(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)reportAttributeCurrentHue:(ResponseHandler)reportHandler
{
CHIPInt8uAttributeCallbackBridge * onReport = new CHIPInt8uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
if (!onReport) {
reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentHue(onReport->Cancel());
if (err != CHIP_NO_ERROR) {
delete onReport;
reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeCurrentSaturation:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentSaturation(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)configureAttributeCurrentSaturation:(uint16_t)minInterval
maxInterval:(uint16_t)maxInterval
change:(uint8_t)change
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ConfigureAttributeCurrentSaturation(
onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)reportAttributeCurrentSaturation:(ResponseHandler)reportHandler
{
CHIPInt8uAttributeCallbackBridge * onReport = new CHIPInt8uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
if (!onReport) {
reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentSaturation(onReport->Cancel());
if (err != CHIP_NO_ERROR) {
delete onReport;
reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeRemainingTime:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeRemainingTime(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeCurrentX:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentX(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)configureAttributeCurrentX:(uint16_t)minInterval
maxInterval:(uint16_t)maxInterval
change:(uint16_t)change
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err
= self.cppCluster.ConfigureAttributeCurrentX(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)reportAttributeCurrentX:(ResponseHandler)reportHandler
{
CHIPInt16uAttributeCallbackBridge * onReport = new CHIPInt16uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
if (!onReport) {
reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentX(onReport->Cancel());
if (err != CHIP_NO_ERROR) {
delete onReport;
reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeCurrentY:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentY(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)configureAttributeCurrentY:(uint16_t)minInterval
maxInterval:(uint16_t)maxInterval
change:(uint16_t)change
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err
= self.cppCluster.ConfigureAttributeCurrentY(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)reportAttributeCurrentY:(ResponseHandler)reportHandler
{
CHIPInt16uAttributeCallbackBridge * onReport = new CHIPInt16uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
if (!onReport) {
reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentY(onReport->Cancel());
if (err != CHIP_NO_ERROR) {
delete onReport;
reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeDriftCompensation:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeDriftCompensation(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeCompensationText:(ResponseHandler)completionHandler
{
CHIPUnsupportedAttributeCallbackBridge * onSuccess
= new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeCompensationText(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeColorTemperature:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeColorTemperature(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)configureAttributeColorTemperature:(uint16_t)minInterval
maxInterval:(uint16_t)maxInterval
change:(uint16_t)change
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ConfigureAttributeColorTemperature(
onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)reportAttributeColorTemperature:(ResponseHandler)reportHandler
{
CHIPInt16uAttributeCallbackBridge * onReport = new CHIPInt16uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
if (!onReport) {
reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReportAttributeColorTemperature(onReport->Cancel());
if (err != CHIP_NO_ERROR) {
delete onReport;
reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeColorMode:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeColorMode(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeColorControlOptions:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeColorControlOptions(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)writeAttributeColorControlOptions:(uint8_t)value completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.WriteAttributeColorControlOptions(onSuccess->Cancel(), onFailure->Cancel(), value);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeNumberOfPrimaries:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeNumberOfPrimaries(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributePrimary1X:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributePrimary1X(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributePrimary1Y:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributePrimary1Y(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributePrimary1Intensity:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributePrimary1Intensity(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributePrimary2X:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributePrimary2X(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributePrimary2Y:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributePrimary2Y(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributePrimary2Intensity:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributePrimary2Intensity(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributePrimary3X:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributePrimary3X(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributePrimary3Y:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributePrimary3Y(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributePrimary3Intensity:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributePrimary3Intensity(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributePrimary4X:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributePrimary4X(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributePrimary4Y:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributePrimary4Y(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributePrimary4Intensity:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributePrimary4Intensity(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributePrimary5X:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributePrimary5X(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributePrimary5Y:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributePrimary5Y(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributePrimary5Intensity:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributePrimary5Intensity(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributePrimary6X:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributePrimary6X(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributePrimary6Y:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributePrimary6Y(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributePrimary6Intensity:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributePrimary6Intensity(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeWhitePointX:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeWhitePointX(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)writeAttributeWhitePointX:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.WriteAttributeWhitePointX(onSuccess->Cancel(), onFailure->Cancel(), value);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeWhitePointY:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeWhitePointY(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)writeAttributeWhitePointY:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.WriteAttributeWhitePointY(onSuccess->Cancel(), onFailure->Cancel(), value);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeColorPointRX:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointRX(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)writeAttributeColorPointRX:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointRX(onSuccess->Cancel(), onFailure->Cancel(), value);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeColorPointRY:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointRY(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)writeAttributeColorPointRY:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointRY(onSuccess->Cancel(), onFailure->Cancel(), value);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeColorPointRIntensity:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointRIntensity(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)writeAttributeColorPointRIntensity:(uint8_t)value completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointRIntensity(onSuccess->Cancel(), onFailure->Cancel(), value);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeColorPointGX:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointGX(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)writeAttributeColorPointGX:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointGX(onSuccess->Cancel(), onFailure->Cancel(), value);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeColorPointGY:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointGY(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)writeAttributeColorPointGY:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointGY(onSuccess->Cancel(), onFailure->Cancel(), value);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeColorPointGIntensity:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointGIntensity(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)writeAttributeColorPointGIntensity:(uint8_t)value completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointGIntensity(onSuccess->Cancel(), onFailure->Cancel(), value);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeColorPointBX:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointBX(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)writeAttributeColorPointBX:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointBX(onSuccess->Cancel(), onFailure->Cancel(), value);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeColorPointBY:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointBY(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)writeAttributeColorPointBY:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointBY(onSuccess->Cancel(), onFailure->Cancel(), value);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeColorPointBIntensity:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointBIntensity(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)writeAttributeColorPointBIntensity:(uint8_t)value completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointBIntensity(onSuccess->Cancel(), onFailure->Cancel(), value);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeEnhancedCurrentHue:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeEnhancedCurrentHue(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeEnhancedColorMode:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeEnhancedColorMode(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeColorLoopActive:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeColorLoopActive(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeColorLoopDirection:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeColorLoopDirection(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeColorLoopTime:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeColorLoopTime(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeColorCapabilities:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeColorCapabilities(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeColorTempPhysicalMin:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeColorTempPhysicalMin(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeColorTempPhysicalMax:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeColorTempPhysicalMax(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeCoupleColorTempToLevelMinMireds:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeCoupleColorTempToLevelMinMireds(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeStartUpColorTemperatureMireds:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeStartUpColorTemperatureMireds(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)writeAttributeStartUpColorTemperatureMireds:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.WriteAttributeStartUpColorTemperatureMireds(onSuccess->Cancel(), onFailure->Cancel(), value);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
@end
@interface CHIPContentLaunch ()
@property (readonly) Controller::ContentLaunchCluster cppCluster;
@end
@implementation CHIPContentLaunch
- (Controller::ClusterBase *)getCluster
{
return &_cppCluster;
}
- (void)launchContent:(ResponseHandler)completionHandler
{
CHIPContentLaunchClusterLaunchContentResponseCallbackBridge * onSuccess
= new CHIPContentLaunchClusterLaunchContentResponseCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.LaunchContent(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)launchURL:(ResponseHandler)completionHandler
{
CHIPContentLaunchClusterLaunchURLResponseCallbackBridge * onSuccess
= new CHIPContentLaunchClusterLaunchURLResponseCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.LaunchURL(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
@end
@interface CHIPDoorLock ()
@property (readonly) Controller::DoorLockCluster cppCluster;
@end
@implementation CHIPDoorLock
- (Controller::ClusterBase *)getCluster
{
return &_cppCluster;
}
- (void)clearAllPins:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ClearAllPins(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)clearAllRfids:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ClearAllRfids(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)clearHolidaySchedule:(uint8_t)scheduleId completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ClearHolidaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)clearPin:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ClearPin(onSuccess->Cancel(), onFailure->Cancel(), userId);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)clearRfid:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ClearRfid(onSuccess->Cancel(), onFailure->Cancel(), userId);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)clearWeekdaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ClearWeekdaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)clearYeardaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ClearYeardaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)getHolidaySchedule:(uint8_t)scheduleId completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.GetHolidaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)getLogRecord:(uint16_t)logIndex completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.GetLogRecord(onSuccess->Cancel(), onFailure->Cancel(), logIndex);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)getPin:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.GetPin(onSuccess->Cancel(), onFailure->Cancel(), userId);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)getRfid:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.GetRfid(onSuccess->Cancel(), onFailure->Cancel(), userId);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)getUserType:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.GetUserType(onSuccess->Cancel(), onFailure->Cancel(), userId);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)getWeekdaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.GetWeekdaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)getYeardaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.GetYeardaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)lockDoor:(char *)pin completionHandler:(ResponseHandler)completionHandler
{
CHIPDoorLockClusterLockDoorResponseCallbackBridge * onSuccess
= new CHIPDoorLockClusterLockDoorResponseCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.LockDoor(onSuccess->Cancel(), onFailure->Cancel(), pin);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)setHolidaySchedule:(uint8_t)scheduleId
localStartTime:(uint32_t)localStartTime
localEndTime:(uint32_t)localEndTime
operatingModeDuringHoliday:(uint8_t)operatingModeDuringHoliday
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.SetHolidaySchedule(
onSuccess->Cancel(), onFailure->Cancel(), scheduleId, localStartTime, localEndTime, operatingModeDuringHoliday);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)setPin:(uint16_t)userId
userStatus:(uint8_t)userStatus
userType:(uint8_t)userType
pin:(char *)pin
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.SetPin(onSuccess->Cancel(), onFailure->Cancel(), userId, userStatus, userType, pin);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)setRfid:(uint16_t)userId
userStatus:(uint8_t)userStatus
userType:(uint8_t)userType
id:(char *)id
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.SetRfid(onSuccess->Cancel(), onFailure->Cancel(), userId, userStatus, userType, id);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)setUserType:(uint16_t)userId userType:(uint8_t)userType completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.SetUserType(onSuccess->Cancel(), onFailure->Cancel(), userId, userType);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)setWeekdaySchedule:(uint8_t)scheduleId
userId:(uint16_t)userId
daysMask:(uint8_t)daysMask
startHour:(uint8_t)startHour
startMinute:(uint8_t)startMinute
endHour:(uint8_t)endHour
endMinute:(uint8_t)endMinute
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.SetWeekdaySchedule(
onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId, daysMask, startHour, startMinute, endHour, endMinute);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)setYeardaySchedule:(uint8_t)scheduleId
userId:(uint16_t)userId
localStartTime:(uint32_t)localStartTime
localEndTime:(uint32_t)localEndTime
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.SetYeardaySchedule(
onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId, localStartTime, localEndTime);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)unlockDoor:(char *)pin completionHandler:(ResponseHandler)completionHandler
{
CHIPDoorLockClusterUnlockDoorResponseCallbackBridge * onSuccess
= new CHIPDoorLockClusterUnlockDoorResponseCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.UnlockDoor(onSuccess->Cancel(), onFailure->Cancel(), pin);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)unlockWithTimeout:(uint16_t)timeoutInSeconds pin:(char *)pin completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.UnlockWithTimeout(onSuccess->Cancel(), onFailure->Cancel(), timeoutInSeconds, pin);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeLockState:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeLockState(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)configureAttributeLockState:(uint16_t)minInterval
maxInterval:(uint16_t)maxInterval
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err
= self.cppCluster.ConfigureAttributeLockState(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)reportAttributeLockState:(ResponseHandler)reportHandler
{
CHIPInt8uAttributeCallbackBridge * onReport = new CHIPInt8uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
if (!onReport) {
reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReportAttributeLockState(onReport->Cancel());
if (err != CHIP_NO_ERROR) {
delete onReport;
reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeLockType:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeLockType(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeActuatorEnabled:(ResponseHandler)completionHandler
{
CHIPBooleanAttributeCallbackBridge * onSuccess
= new CHIPBooleanAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeActuatorEnabled(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
@end
@interface CHIPGeneralCommissioning ()
@property (readonly) Controller::GeneralCommissioningCluster cppCluster;
@end
@implementation CHIPGeneralCommissioning
- (Controller::ClusterBase *)getCluster
{
return &_cppCluster;
}
- (void)armFailSafe:(uint16_t)expiryLengthSeconds
breadcrumb:(uint64_t)breadcrumb
timeoutMs:(uint32_t)timeoutMs
completionHandler:(ResponseHandler)completionHandler
{
CHIPGeneralCommissioningClusterArmFailSafeResponseCallbackBridge * onSuccess
= new CHIPGeneralCommissioningClusterArmFailSafeResponseCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err
= self.cppCluster.ArmFailSafe(onSuccess->Cancel(), onFailure->Cancel(), expiryLengthSeconds, breadcrumb, timeoutMs);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)commissioningComplete:(ResponseHandler)completionHandler
{
CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallbackBridge * onSuccess
= new CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.CommissioningComplete(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)setFabric:(NSData *)fabricId
fabricSecret:(NSData *)fabricSecret
breadcrumb:(uint64_t)breadcrumb
timeoutMs:(uint32_t)timeoutMs
completionHandler:(ResponseHandler)completionHandler
{
CHIPGeneralCommissioningClusterSetFabricResponseCallbackBridge * onSuccess
= new CHIPGeneralCommissioningClusterSetFabricResponseCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.SetFabric(onSuccess->Cancel(), onFailure->Cancel(),
chip::ByteSpan((const uint8_t *) fabricId.bytes, fabricId.length),
chip::ByteSpan((const uint8_t *) fabricSecret.bytes, fabricSecret.length), breadcrumb, timeoutMs);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeFabricId:(ResponseHandler)completionHandler
{
CHIPUnsupportedAttributeCallbackBridge * onSuccess
= new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeFabricId(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeBreadcrumb:(ResponseHandler)completionHandler
{
CHIPInt64uAttributeCallbackBridge * onSuccess = new CHIPInt64uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeBreadcrumb(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)writeAttributeBreadcrumb:(uint64_t)value completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.WriteAttributeBreadcrumb(onSuccess->Cancel(), onFailure->Cancel(), value);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
@end
@interface CHIPGroups ()
@property (readonly) Controller::GroupsCluster cppCluster;
@end
@implementation CHIPGroups
- (Controller::ClusterBase *)getCluster
{
return &_cppCluster;
}
- (void)addGroup:(uint16_t)groupId groupName:(char *)groupName completionHandler:(ResponseHandler)completionHandler
{
CHIPGroupsClusterAddGroupResponseCallbackBridge * onSuccess
= new CHIPGroupsClusterAddGroupResponseCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.AddGroup(onSuccess->Cancel(), onFailure->Cancel(), groupId, groupName);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)addGroupIfIdentifying:(uint16_t)groupId groupName:(char *)groupName completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.AddGroupIfIdentifying(onSuccess->Cancel(), onFailure->Cancel(), groupId, groupName);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)getGroupMembership:(uint8_t)groupCount groupList:(uint16_t)groupList completionHandler:(ResponseHandler)completionHandler
{
CHIPGroupsClusterGetGroupMembershipResponseCallbackBridge * onSuccess
= new CHIPGroupsClusterGetGroupMembershipResponseCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.GetGroupMembership(onSuccess->Cancel(), onFailure->Cancel(), groupCount, groupList);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)removeAllGroups:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.RemoveAllGroups(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)removeGroup:(uint16_t)groupId completionHandler:(ResponseHandler)completionHandler
{
CHIPGroupsClusterRemoveGroupResponseCallbackBridge * onSuccess
= new CHIPGroupsClusterRemoveGroupResponseCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.RemoveGroup(onSuccess->Cancel(), onFailure->Cancel(), groupId);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)viewGroup:(uint16_t)groupId completionHandler:(ResponseHandler)completionHandler
{
CHIPGroupsClusterViewGroupResponseCallbackBridge * onSuccess
= new CHIPGroupsClusterViewGroupResponseCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ViewGroup(onSuccess->Cancel(), onFailure->Cancel(), groupId);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeNameSupport:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeNameSupport(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
@end
@interface CHIPIasZone ()
@property (readonly) Controller::IasZoneCluster cppCluster;
@end
@implementation CHIPIasZone
- (Controller::ClusterBase *)getCluster
{
return &_cppCluster;
}
- (void)readAttributeZoneState:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeZoneState(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeZoneType:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeZoneType(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeZoneStatus:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeZoneStatus(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeIasCieAddress:(ResponseHandler)completionHandler
{
CHIPInt64uAttributeCallbackBridge * onSuccess = new CHIPInt64uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeIasCieAddress(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)writeAttributeIasCieAddress:(uint64_t)value completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.WriteAttributeIasCieAddress(onSuccess->Cancel(), onFailure->Cancel(), value);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeZoneId:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeZoneId(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
@end
@interface CHIPIdentify ()
@property (readonly) Controller::IdentifyCluster cppCluster;
@end
@implementation CHIPIdentify
- (Controller::ClusterBase *)getCluster
{
return &_cppCluster;
}
- (void)identify:(uint16_t)identifyTime completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.Identify(onSuccess->Cancel(), onFailure->Cancel(), identifyTime);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)identifyQuery:(ResponseHandler)completionHandler
{
CHIPIdentifyClusterIdentifyQueryResponseCallbackBridge * onSuccess
= new CHIPIdentifyClusterIdentifyQueryResponseCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.IdentifyQuery(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeIdentifyTime:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeIdentifyTime(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)writeAttributeIdentifyTime:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.WriteAttributeIdentifyTime(onSuccess->Cancel(), onFailure->Cancel(), value);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
@end
@interface CHIPLevelControl ()
@property (readonly) Controller::LevelControlCluster cppCluster;
@end
@implementation CHIPLevelControl
- (Controller::ClusterBase *)getCluster
{
return &_cppCluster;
}
- (void)move:(uint8_t)moveMode
rate:(uint8_t)rate
optionMask:(uint8_t)optionMask
optionOverride:(uint8_t)optionOverride
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.Move(onSuccess->Cancel(), onFailure->Cancel(), moveMode, rate, optionMask, optionOverride);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)moveToLevel:(uint8_t)level
transitionTime:(uint16_t)transitionTime
optionMask:(uint8_t)optionMask
optionOverride:(uint8_t)optionOverride
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err
= self.cppCluster.MoveToLevel(onSuccess->Cancel(), onFailure->Cancel(), level, transitionTime, optionMask, optionOverride);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)moveToLevelWithOnOff:(uint8_t)level
transitionTime:(uint16_t)transitionTime
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.MoveToLevelWithOnOff(onSuccess->Cancel(), onFailure->Cancel(), level, transitionTime);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)moveWithOnOff:(uint8_t)moveMode rate:(uint8_t)rate completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.MoveWithOnOff(onSuccess->Cancel(), onFailure->Cancel(), moveMode, rate);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)step:(uint8_t)stepMode
stepSize:(uint8_t)stepSize
transitionTime:(uint16_t)transitionTime
optionMask:(uint8_t)optionMask
optionOverride:(uint8_t)optionOverride
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.Step(
onSuccess->Cancel(), onFailure->Cancel(), stepMode, stepSize, transitionTime, optionMask, optionOverride);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)stepWithOnOff:(uint8_t)stepMode
stepSize:(uint8_t)stepSize
transitionTime:(uint16_t)transitionTime
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.StepWithOnOff(onSuccess->Cancel(), onFailure->Cancel(), stepMode, stepSize, transitionTime);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)stop:(uint8_t)optionMask optionOverride:(uint8_t)optionOverride completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.Stop(onSuccess->Cancel(), onFailure->Cancel(), optionMask, optionOverride);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)stopWithOnOff:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.StopWithOnOff(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeCurrentLevel:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentLevel(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)configureAttributeCurrentLevel:(uint16_t)minInterval
maxInterval:(uint16_t)maxInterval
change:(uint8_t)change
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ConfigureAttributeCurrentLevel(
onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)reportAttributeCurrentLevel:(ResponseHandler)reportHandler
{
CHIPInt8uAttributeCallbackBridge * onReport = new CHIPInt8uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
if (!onReport) {
reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentLevel(onReport->Cancel());
if (err != CHIP_NO_ERROR) {
delete onReport;
reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
@end
@interface CHIPLowPower ()
@property (readonly) Controller::LowPowerCluster cppCluster;
@end
@implementation CHIPLowPower
- (Controller::ClusterBase *)getCluster
{
return &_cppCluster;
}
- (void)sleep:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.Sleep(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
@end
@interface CHIPMediaPlayback ()
@property (readonly) Controller::MediaPlaybackCluster cppCluster;
@end
@implementation CHIPMediaPlayback
- (Controller::ClusterBase *)getCluster
{
return &_cppCluster;
}
- (void)fastForwardRequest:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.FastForwardRequest(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)nextRequest:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.NextRequest(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)pauseRequest:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.PauseRequest(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)playRequest:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.PlayRequest(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)previousRequest:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.PreviousRequest(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)rewindRequest:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.RewindRequest(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)skipBackwardRequest:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.SkipBackwardRequest(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)skipForwardRequest:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.SkipForwardRequest(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)startOverRequest:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.StartOverRequest(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)stopRequest:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.StopRequest(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeCurrentState:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentState(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
@end
@interface CHIPOnOff ()
@property (readonly) Controller::OnOffCluster cppCluster;
@end
@implementation CHIPOnOff
- (Controller::ClusterBase *)getCluster
{
return &_cppCluster;
}
- (void)off:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.Off(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)on:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.On(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)toggle:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.Toggle(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeOnOff:(ResponseHandler)completionHandler
{
CHIPBooleanAttributeCallbackBridge * onSuccess
= new CHIPBooleanAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeOnOff(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)configureAttributeOnOff:(uint16_t)minInterval
maxInterval:(uint16_t)maxInterval
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ConfigureAttributeOnOff(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)reportAttributeOnOff:(ResponseHandler)reportHandler
{
CHIPBooleanAttributeCallbackBridge * onReport
= new CHIPBooleanAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
if (!onReport) {
reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReportAttributeOnOff(onReport->Cancel());
if (err != CHIP_NO_ERROR) {
delete onReport;
reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
@end
@interface CHIPScenes ()
@property (readonly) Controller::ScenesCluster cppCluster;
@end
@implementation CHIPScenes
- (Controller::ClusterBase *)getCluster
{
return &_cppCluster;
}
- (void)addScene:(uint16_t)groupId
sceneId:(uint8_t)sceneId
transitionTime:(uint16_t)transitionTime
sceneName:(char *)sceneName
clusterId:(uint16_t)clusterId
length:(uint8_t)length
value:(uint8_t)value
completionHandler:(ResponseHandler)completionHandler
{
CHIPScenesClusterAddSceneResponseCallbackBridge * onSuccess
= new CHIPScenesClusterAddSceneResponseCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.AddScene(
onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId, transitionTime, sceneName, clusterId, length, value);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)getSceneMembership:(uint16_t)groupId completionHandler:(ResponseHandler)completionHandler
{
CHIPScenesClusterGetSceneMembershipResponseCallbackBridge * onSuccess
= new CHIPScenesClusterGetSceneMembershipResponseCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.GetSceneMembership(onSuccess->Cancel(), onFailure->Cancel(), groupId);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)recallScene:(uint16_t)groupId
sceneId:(uint8_t)sceneId
transitionTime:(uint16_t)transitionTime
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.RecallScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId, transitionTime);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)removeAllScenes:(uint16_t)groupId completionHandler:(ResponseHandler)completionHandler
{
CHIPScenesClusterRemoveAllScenesResponseCallbackBridge * onSuccess
= new CHIPScenesClusterRemoveAllScenesResponseCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.RemoveAllScenes(onSuccess->Cancel(), onFailure->Cancel(), groupId);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)removeScene:(uint16_t)groupId sceneId:(uint8_t)sceneId completionHandler:(ResponseHandler)completionHandler
{
CHIPScenesClusterRemoveSceneResponseCallbackBridge * onSuccess
= new CHIPScenesClusterRemoveSceneResponseCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.RemoveScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)storeScene:(uint16_t)groupId sceneId:(uint8_t)sceneId completionHandler:(ResponseHandler)completionHandler
{
CHIPScenesClusterStoreSceneResponseCallbackBridge * onSuccess
= new CHIPScenesClusterStoreSceneResponseCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.StoreScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)viewScene:(uint16_t)groupId sceneId:(uint8_t)sceneId completionHandler:(ResponseHandler)completionHandler
{
CHIPScenesClusterViewSceneResponseCallbackBridge * onSuccess
= new CHIPScenesClusterViewSceneResponseCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ViewScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeSceneCount:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeSceneCount(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeCurrentScene:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentScene(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeCurrentGroup:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentGroup(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeSceneValid:(ResponseHandler)completionHandler
{
CHIPBooleanAttributeCallbackBridge * onSuccess
= new CHIPBooleanAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeSceneValid(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeNameSupport:(ResponseHandler)completionHandler
{
CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeNameSupport(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
@end
@interface CHIPTemperatureMeasurement ()
@property (readonly) Controller::TemperatureMeasurementCluster cppCluster;
@end
@implementation CHIPTemperatureMeasurement
- (Controller::ClusterBase *)getCluster
{
return &_cppCluster;
}
- (void)readAttributeMeasuredValue:(ResponseHandler)completionHandler
{
CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeMeasuredValue(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)configureAttributeMeasuredValue:(uint16_t)minInterval
maxInterval:(uint16_t)maxInterval
change:(int16_t)change
completionHandler:(ResponseHandler)completionHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ConfigureAttributeMeasuredValue(
onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)reportAttributeMeasuredValue:(ResponseHandler)reportHandler
{
CHIPInt16sAttributeCallbackBridge * onReport = new CHIPInt16sAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
if (!onReport) {
reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReportAttributeMeasuredValue(onReport->Cancel());
if (err != CHIP_NO_ERROR) {
delete onReport;
reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeMinMeasuredValue:(ResponseHandler)completionHandler
{
CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeMinMeasuredValue(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeMaxMeasuredValue:(ResponseHandler)completionHandler
{
CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeMaxMeasuredValue(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
{
CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
if (!onSuccess) {
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}
CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
@end