blob: 44db3fcc35fd1d42b9fa9efc129e36a698e83734 [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 = [CHIPError errorForCHIPErrorCode:status];
callback->mHandler(error, nil);
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPStringAttributeCallbackBridge : public Callback::Callback<StringAttributeCallback> {
public:
CHIPStringAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool octetString, bool keepAlive = false)
: Callback::Callback<StringAttributeCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
, mOctetString(octetString)
, mKeepAlive(keepAlive)
{
}
~CHIPStringAttributeCallbackBridge() {};
static void CallbackFn(void * context, chip::ByteSpan value)
{
CHIPStringAttributeCallbackBridge * callback = reinterpret_cast<CHIPStringAttributeCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
if (callback->mOctetString) {
NSData * data = [NSData dataWithBytes:value.data() length:value.size()];
callback->mHandler(nil, @ { @"value" : data });
} else {
NSString * str = [[NSString alloc] initWithBytes:value.data()
length:value.size()
encoding:NSUTF8StringEncoding];
callback->mHandler(nil, @ { @"value" : str });
}
if (!callback->mKeepAlive) {
callback->Cancel();
delete callback;
}
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
bool mOctetString;
bool mKeepAlive;
};
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 CHIPInt32uAttributeCallbackBridge : public Callback::Callback<Int32uAttributeCallback> {
public:
CHIPInt32uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
: Callback::Callback<Int32uAttributeCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
, mKeepAlive(keepAlive)
{
}
~CHIPInt32uAttributeCallbackBridge() {};
static void CallbackFn(void * context, uint32_t value)
{
CHIPInt32uAttributeCallbackBridge * callback = reinterpret_cast<CHIPInt32uAttributeCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ { @"value" : [NSNumber numberWithUnsignedLong:value] });
if (!callback->mKeepAlive) {
callback->Cancel();
delete callback;
}
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
bool mKeepAlive;
};
class CHIPInt64uAttributeCallbackBridge : public Callback::Callback<Int64uAttributeCallback> {
public:
CHIPInt64uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
: Callback::Callback<Int64uAttributeCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
, mKeepAlive(keepAlive)
{
}
~CHIPInt64uAttributeCallbackBridge() {};
static void CallbackFn(void * context, uint64_t value)
{
CHIPInt64uAttributeCallbackBridge * callback = reinterpret_cast<CHIPInt64uAttributeCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ { @"value" : [NSNumber numberWithUnsignedLongLong: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;
};
class CHIPDoorLockClusterClearAllPinsResponseCallbackBridge
: public Callback::Callback<DoorLockClusterClearAllPinsResponseCallback> {
public:
CHIPDoorLockClusterClearAllPinsResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<DoorLockClusterClearAllPinsResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPDoorLockClusterClearAllPinsResponseCallbackBridge() {};
static void CallbackFn(void * context)
{
CHIPDoorLockClusterClearAllPinsResponseCallbackBridge * callback
= reinterpret_cast<CHIPDoorLockClusterClearAllPinsResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPDoorLockClusterClearAllRfidsResponseCallbackBridge
: public Callback::Callback<DoorLockClusterClearAllRfidsResponseCallback> {
public:
CHIPDoorLockClusterClearAllRfidsResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<DoorLockClusterClearAllRfidsResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPDoorLockClusterClearAllRfidsResponseCallbackBridge() {};
static void CallbackFn(void * context)
{
CHIPDoorLockClusterClearAllRfidsResponseCallbackBridge * callback
= reinterpret_cast<CHIPDoorLockClusterClearAllRfidsResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPDoorLockClusterClearHolidayScheduleResponseCallbackBridge
: public Callback::Callback<DoorLockClusterClearHolidayScheduleResponseCallback> {
public:
CHIPDoorLockClusterClearHolidayScheduleResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<DoorLockClusterClearHolidayScheduleResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPDoorLockClusterClearHolidayScheduleResponseCallbackBridge() {};
static void CallbackFn(void * context)
{
CHIPDoorLockClusterClearHolidayScheduleResponseCallbackBridge * callback
= reinterpret_cast<CHIPDoorLockClusterClearHolidayScheduleResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPDoorLockClusterClearPinResponseCallbackBridge : public Callback::Callback<DoorLockClusterClearPinResponseCallback> {
public:
CHIPDoorLockClusterClearPinResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<DoorLockClusterClearPinResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPDoorLockClusterClearPinResponseCallbackBridge() {};
static void CallbackFn(void * context)
{
CHIPDoorLockClusterClearPinResponseCallbackBridge * callback
= reinterpret_cast<CHIPDoorLockClusterClearPinResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPDoorLockClusterClearRfidResponseCallbackBridge : public Callback::Callback<DoorLockClusterClearRfidResponseCallback> {
public:
CHIPDoorLockClusterClearRfidResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<DoorLockClusterClearRfidResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPDoorLockClusterClearRfidResponseCallbackBridge() {};
static void CallbackFn(void * context)
{
CHIPDoorLockClusterClearRfidResponseCallbackBridge * callback
= reinterpret_cast<CHIPDoorLockClusterClearRfidResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPDoorLockClusterClearWeekdayScheduleResponseCallbackBridge
: public Callback::Callback<DoorLockClusterClearWeekdayScheduleResponseCallback> {
public:
CHIPDoorLockClusterClearWeekdayScheduleResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<DoorLockClusterClearWeekdayScheduleResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPDoorLockClusterClearWeekdayScheduleResponseCallbackBridge() {};
static void CallbackFn(void * context)
{
CHIPDoorLockClusterClearWeekdayScheduleResponseCallbackBridge * callback
= reinterpret_cast<CHIPDoorLockClusterClearWeekdayScheduleResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPDoorLockClusterClearYeardayScheduleResponseCallbackBridge
: public Callback::Callback<DoorLockClusterClearYeardayScheduleResponseCallback> {
public:
CHIPDoorLockClusterClearYeardayScheduleResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<DoorLockClusterClearYeardayScheduleResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPDoorLockClusterClearYeardayScheduleResponseCallbackBridge() {};
static void CallbackFn(void * context)
{
CHIPDoorLockClusterClearYeardayScheduleResponseCallbackBridge * callback
= reinterpret_cast<CHIPDoorLockClusterClearYeardayScheduleResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPDoorLockClusterGetHolidayScheduleResponseCallbackBridge
: public Callback::Callback<DoorLockClusterGetHolidayScheduleResponseCallback> {
public:
CHIPDoorLockClusterGetHolidayScheduleResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<DoorLockClusterGetHolidayScheduleResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPDoorLockClusterGetHolidayScheduleResponseCallbackBridge() {};
static void CallbackFn(
void * context, uint8_t scheduleId, uint32_t localStartTime, uint32_t localEndTime, uint8_t operatingModeDuringHoliday)
{
CHIPDoorLockClusterGetHolidayScheduleResponseCallbackBridge * callback
= reinterpret_cast<CHIPDoorLockClusterGetHolidayScheduleResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"scheduleId" : [NSNumber numberWithUnsignedChar:scheduleId],
@"localStartTime" : [NSNumber numberWithUnsignedLong:localStartTime],
@"localEndTime" : [NSNumber numberWithUnsignedLong:localEndTime],
@"operatingModeDuringHoliday" : [NSNumber numberWithUnsignedChar:operatingModeDuringHoliday],
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPDoorLockClusterGetLogRecordResponseCallbackBridge
: public Callback::Callback<DoorLockClusterGetLogRecordResponseCallback> {
public:
CHIPDoorLockClusterGetLogRecordResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<DoorLockClusterGetLogRecordResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPDoorLockClusterGetLogRecordResponseCallbackBridge() {};
static void CallbackFn(void * context, uint16_t logEntryId, uint32_t timestamp, uint8_t eventType, uint8_t source,
uint8_t eventIdOrAlarmCode, uint16_t userId, uint8_t * pin)
{
CHIPDoorLockClusterGetLogRecordResponseCallbackBridge * callback
= reinterpret_cast<CHIPDoorLockClusterGetLogRecordResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"logEntryId" : [NSNumber numberWithUnsignedShort:logEntryId],
@"timestamp" : [NSNumber numberWithUnsignedLong:timestamp],
@"eventType" : [NSNumber numberWithUnsignedChar:eventType],
@"source" : [NSNumber numberWithUnsignedChar:source],
@"eventIdOrAlarmCode" : [NSNumber numberWithUnsignedChar:eventIdOrAlarmCode],
@"userId" : [NSNumber numberWithUnsignedShort:userId],
@"pin" : [NSString stringWithFormat:@"%s", pin],
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPDoorLockClusterGetPinResponseCallbackBridge : public Callback::Callback<DoorLockClusterGetPinResponseCallback> {
public:
CHIPDoorLockClusterGetPinResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<DoorLockClusterGetPinResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPDoorLockClusterGetPinResponseCallbackBridge() {};
static void CallbackFn(void * context, uint16_t userId, uint8_t userStatus, uint8_t userType, uint8_t * pin)
{
CHIPDoorLockClusterGetPinResponseCallbackBridge * callback
= reinterpret_cast<CHIPDoorLockClusterGetPinResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"userId" : [NSNumber numberWithUnsignedShort:userId],
@"userStatus" : [NSNumber numberWithUnsignedChar:userStatus],
@"userType" : [NSNumber numberWithUnsignedChar:userType],
@"pin" : [NSString stringWithFormat:@"%s", pin],
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPDoorLockClusterGetRfidResponseCallbackBridge : public Callback::Callback<DoorLockClusterGetRfidResponseCallback> {
public:
CHIPDoorLockClusterGetRfidResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<DoorLockClusterGetRfidResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPDoorLockClusterGetRfidResponseCallbackBridge() {};
static void CallbackFn(void * context, uint16_t userId, uint8_t userStatus, uint8_t userType, uint8_t * rfid)
{
CHIPDoorLockClusterGetRfidResponseCallbackBridge * callback
= reinterpret_cast<CHIPDoorLockClusterGetRfidResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"userId" : [NSNumber numberWithUnsignedShort:userId],
@"userStatus" : [NSNumber numberWithUnsignedChar:userStatus],
@"userType" : [NSNumber numberWithUnsignedChar:userType],
@"rfid" : [NSString stringWithFormat:@"%s", rfid],
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPDoorLockClusterGetUserTypeResponseCallbackBridge : public Callback::Callback<DoorLockClusterGetUserTypeResponseCallback> {
public:
CHIPDoorLockClusterGetUserTypeResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<DoorLockClusterGetUserTypeResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPDoorLockClusterGetUserTypeResponseCallbackBridge() {};
static void CallbackFn(void * context, uint16_t userId, uint8_t userType)
{
CHIPDoorLockClusterGetUserTypeResponseCallbackBridge * callback
= reinterpret_cast<CHIPDoorLockClusterGetUserTypeResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"userId" : [NSNumber numberWithUnsignedShort:userId],
@"userType" : [NSNumber numberWithUnsignedChar:userType],
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPDoorLockClusterGetWeekdayScheduleResponseCallbackBridge
: public Callback::Callback<DoorLockClusterGetWeekdayScheduleResponseCallback> {
public:
CHIPDoorLockClusterGetWeekdayScheduleResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<DoorLockClusterGetWeekdayScheduleResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPDoorLockClusterGetWeekdayScheduleResponseCallbackBridge() {};
static void CallbackFn(void * context, uint8_t scheduleId, uint16_t userId, uint8_t daysMask, uint8_t startHour,
uint8_t startMinute, uint8_t endHour, uint8_t endMinute)
{
CHIPDoorLockClusterGetWeekdayScheduleResponseCallbackBridge * callback
= reinterpret_cast<CHIPDoorLockClusterGetWeekdayScheduleResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"scheduleId" : [NSNumber numberWithUnsignedChar:scheduleId],
@"userId" : [NSNumber numberWithUnsignedShort:userId],
@"daysMask" : [NSNumber numberWithUnsignedChar:daysMask],
@"startHour" : [NSNumber numberWithUnsignedChar:startHour],
@"startMinute" : [NSNumber numberWithUnsignedChar:startMinute],
@"endHour" : [NSNumber numberWithUnsignedChar:endHour],
@"endMinute" : [NSNumber numberWithUnsignedChar:endMinute],
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPDoorLockClusterGetYeardayScheduleResponseCallbackBridge
: public Callback::Callback<DoorLockClusterGetYeardayScheduleResponseCallback> {
public:
CHIPDoorLockClusterGetYeardayScheduleResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<DoorLockClusterGetYeardayScheduleResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPDoorLockClusterGetYeardayScheduleResponseCallbackBridge() {};
static void CallbackFn(void * context, uint8_t scheduleId, uint16_t userId, uint32_t localStartTime, uint32_t localEndTime)
{
CHIPDoorLockClusterGetYeardayScheduleResponseCallbackBridge * callback
= reinterpret_cast<CHIPDoorLockClusterGetYeardayScheduleResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"scheduleId" : [NSNumber numberWithUnsignedChar:scheduleId],
@"userId" : [NSNumber numberWithUnsignedShort:userId],
@"localStartTime" : [NSNumber numberWithUnsignedLong:localStartTime],
@"localEndTime" : [NSNumber numberWithUnsignedLong:localEndTime],
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPDoorLockClusterLockDoorResponseCallbackBridge : public Callback::Callback<DoorLockClusterLockDoorResponseCallback> {
public:
CHIPDoorLockClusterLockDoorResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<DoorLockClusterLockDoorResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPDoorLockClusterLockDoorResponseCallbackBridge() {};
static void CallbackFn(void * context)
{
CHIPDoorLockClusterLockDoorResponseCallbackBridge * callback
= reinterpret_cast<CHIPDoorLockClusterLockDoorResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPDoorLockClusterSetHolidayScheduleResponseCallbackBridge
: public Callback::Callback<DoorLockClusterSetHolidayScheduleResponseCallback> {
public:
CHIPDoorLockClusterSetHolidayScheduleResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<DoorLockClusterSetHolidayScheduleResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPDoorLockClusterSetHolidayScheduleResponseCallbackBridge() {};
static void CallbackFn(void * context)
{
CHIPDoorLockClusterSetHolidayScheduleResponseCallbackBridge * callback
= reinterpret_cast<CHIPDoorLockClusterSetHolidayScheduleResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPDoorLockClusterSetPinResponseCallbackBridge : public Callback::Callback<DoorLockClusterSetPinResponseCallback> {
public:
CHIPDoorLockClusterSetPinResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<DoorLockClusterSetPinResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPDoorLockClusterSetPinResponseCallbackBridge() {};
static void CallbackFn(void * context)
{
CHIPDoorLockClusterSetPinResponseCallbackBridge * callback
= reinterpret_cast<CHIPDoorLockClusterSetPinResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPDoorLockClusterSetRfidResponseCallbackBridge : public Callback::Callback<DoorLockClusterSetRfidResponseCallback> {
public:
CHIPDoorLockClusterSetRfidResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<DoorLockClusterSetRfidResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPDoorLockClusterSetRfidResponseCallbackBridge() {};
static void CallbackFn(void * context)
{
CHIPDoorLockClusterSetRfidResponseCallbackBridge * callback
= reinterpret_cast<CHIPDoorLockClusterSetRfidResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPDoorLockClusterSetUserTypeResponseCallbackBridge : public Callback::Callback<DoorLockClusterSetUserTypeResponseCallback> {
public:
CHIPDoorLockClusterSetUserTypeResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<DoorLockClusterSetUserTypeResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPDoorLockClusterSetUserTypeResponseCallbackBridge() {};
static void CallbackFn(void * context)
{
CHIPDoorLockClusterSetUserTypeResponseCallbackBridge * callback
= reinterpret_cast<CHIPDoorLockClusterSetUserTypeResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPDoorLockClusterSetWeekdayScheduleResponseCallbackBridge
: public Callback::Callback<DoorLockClusterSetWeekdayScheduleResponseCallback> {
public:
CHIPDoorLockClusterSetWeekdayScheduleResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<DoorLockClusterSetWeekdayScheduleResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPDoorLockClusterSetWeekdayScheduleResponseCallbackBridge() {};
static void CallbackFn(void * context)
{
CHIPDoorLockClusterSetWeekdayScheduleResponseCallbackBridge * callback
= reinterpret_cast<CHIPDoorLockClusterSetWeekdayScheduleResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPDoorLockClusterSetYeardayScheduleResponseCallbackBridge
: public Callback::Callback<DoorLockClusterSetYeardayScheduleResponseCallback> {
public:
CHIPDoorLockClusterSetYeardayScheduleResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<DoorLockClusterSetYeardayScheduleResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPDoorLockClusterSetYeardayScheduleResponseCallbackBridge() {};
static void CallbackFn(void * context)
{
CHIPDoorLockClusterSetYeardayScheduleResponseCallbackBridge * callback
= reinterpret_cast<CHIPDoorLockClusterSetYeardayScheduleResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPDoorLockClusterUnlockDoorResponseCallbackBridge : public Callback::Callback<DoorLockClusterUnlockDoorResponseCallback> {
public:
CHIPDoorLockClusterUnlockDoorResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<DoorLockClusterUnlockDoorResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPDoorLockClusterUnlockDoorResponseCallbackBridge() {};
static void CallbackFn(void * context)
{
CHIPDoorLockClusterUnlockDoorResponseCallbackBridge * callback
= reinterpret_cast<CHIPDoorLockClusterUnlockDoorResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPDoorLockClusterUnlockWithTimeoutResponseCallbackBridge
: public Callback::Callback<DoorLockClusterUnlockWithTimeoutResponseCallback> {
public:
CHIPDoorLockClusterUnlockWithTimeoutResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<DoorLockClusterUnlockWithTimeoutResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPDoorLockClusterUnlockWithTimeoutResponseCallbackBridge() {};
static void CallbackFn(void * context)
{
CHIPDoorLockClusterUnlockWithTimeoutResponseCallbackBridge * callback
= reinterpret_cast<CHIPDoorLockClusterUnlockWithTimeoutResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPGeneralCommissioningClusterArmFailSafeResponseCallbackBridge
: public Callback::Callback<GeneralCommissioningClusterArmFailSafeResponseCallback> {
public:
CHIPGeneralCommissioningClusterArmFailSafeResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<GeneralCommissioningClusterArmFailSafeResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPGeneralCommissioningClusterArmFailSafeResponseCallbackBridge() {};
static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText)
{
CHIPGeneralCommissioningClusterArmFailSafeResponseCallbackBridge * callback
= reinterpret_cast<CHIPGeneralCommissioningClusterArmFailSafeResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"errorCode" : [NSNumber numberWithUnsignedChar:errorCode],
@"debugText" : [NSString stringWithFormat:@"%s", debugText],
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallbackBridge
: public Callback::Callback<GeneralCommissioningClusterCommissioningCompleteResponseCallback> {
public:
CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<GeneralCommissioningClusterCommissioningCompleteResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallbackBridge() {};
static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText)
{
CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallbackBridge * callback
= reinterpret_cast<CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"errorCode" : [NSNumber numberWithUnsignedChar:errorCode],
@"debugText" : [NSString stringWithFormat:@"%s", debugText],
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPGeneralCommissioningClusterSetFabricResponseCallbackBridge
: public Callback::Callback<GeneralCommissioningClusterSetFabricResponseCallback> {
public:
CHIPGeneralCommissioningClusterSetFabricResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<GeneralCommissioningClusterSetFabricResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPGeneralCommissioningClusterSetFabricResponseCallbackBridge() {};
static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText)
{
CHIPGeneralCommissioningClusterSetFabricResponseCallbackBridge * callback
= reinterpret_cast<CHIPGeneralCommissioningClusterSetFabricResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"errorCode" : [NSNumber numberWithUnsignedChar:errorCode],
@"debugText" : [NSString stringWithFormat:@"%s", debugText],
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPGroupsClusterAddGroupResponseCallbackBridge : public Callback::Callback<GroupsClusterAddGroupResponseCallback> {
public:
CHIPGroupsClusterAddGroupResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<GroupsClusterAddGroupResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPGroupsClusterAddGroupResponseCallbackBridge() {};
static void CallbackFn(void * context, uint16_t groupId)
{
CHIPGroupsClusterAddGroupResponseCallbackBridge * callback
= reinterpret_cast<CHIPGroupsClusterAddGroupResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"groupId" : [NSNumber numberWithUnsignedShort:groupId],
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPGroupsClusterGetGroupMembershipResponseCallbackBridge
: public Callback::Callback<GroupsClusterGetGroupMembershipResponseCallback> {
public:
CHIPGroupsClusterGetGroupMembershipResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<GroupsClusterGetGroupMembershipResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPGroupsClusterGetGroupMembershipResponseCallbackBridge() {};
static void CallbackFn(
void * context, uint8_t capacity, uint8_t groupCount, /* TYPE WARNING: array array defaults to */ uint8_t * groupList)
{
CHIPGroupsClusterGetGroupMembershipResponseCallbackBridge * callback
= reinterpret_cast<CHIPGroupsClusterGetGroupMembershipResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"capacity" : [NSNumber numberWithUnsignedChar:capacity],
@"groupCount" : [NSNumber numberWithUnsignedChar:groupCount],
// groupList: /* TYPE WARNING: array array defaults to */ uint8_t *
// Conversion from this type to Objc is not properly implemented yet
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPGroupsClusterRemoveGroupResponseCallbackBridge : public Callback::Callback<GroupsClusterRemoveGroupResponseCallback> {
public:
CHIPGroupsClusterRemoveGroupResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<GroupsClusterRemoveGroupResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPGroupsClusterRemoveGroupResponseCallbackBridge() {};
static void CallbackFn(void * context, uint16_t groupId)
{
CHIPGroupsClusterRemoveGroupResponseCallbackBridge * callback
= reinterpret_cast<CHIPGroupsClusterRemoveGroupResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"groupId" : [NSNumber numberWithUnsignedShort:groupId],
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPGroupsClusterViewGroupResponseCallbackBridge : public Callback::Callback<GroupsClusterViewGroupResponseCallback> {
public:
CHIPGroupsClusterViewGroupResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<GroupsClusterViewGroupResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPGroupsClusterViewGroupResponseCallbackBridge() {};
static void CallbackFn(void * context, uint16_t groupId, uint8_t * groupName)
{
CHIPGroupsClusterViewGroupResponseCallbackBridge * callback
= reinterpret_cast<CHIPGroupsClusterViewGroupResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"groupId" : [NSNumber numberWithUnsignedShort:groupId],
@"groupName" : [NSString stringWithFormat:@"%s", groupName],
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPIdentifyClusterIdentifyQueryResponseCallbackBridge
: public Callback::Callback<IdentifyClusterIdentifyQueryResponseCallback> {
public:
CHIPIdentifyClusterIdentifyQueryResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<IdentifyClusterIdentifyQueryResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPIdentifyClusterIdentifyQueryResponseCallbackBridge() {};
static void CallbackFn(void * context, uint16_t timeout)
{
CHIPIdentifyClusterIdentifyQueryResponseCallbackBridge * callback
= reinterpret_cast<CHIPIdentifyClusterIdentifyQueryResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"timeout" : [NSNumber numberWithUnsignedShort:timeout],
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPNetworkCommissioningClusterAddThreadNetworkResponseCallbackBridge
: public Callback::Callback<NetworkCommissioningClusterAddThreadNetworkResponseCallback> {
public:
CHIPNetworkCommissioningClusterAddThreadNetworkResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<NetworkCommissioningClusterAddThreadNetworkResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPNetworkCommissioningClusterAddThreadNetworkResponseCallbackBridge() {};
static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText)
{
CHIPNetworkCommissioningClusterAddThreadNetworkResponseCallbackBridge * callback
= reinterpret_cast<CHIPNetworkCommissioningClusterAddThreadNetworkResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"errorCode" : [NSNumber numberWithUnsignedChar:errorCode],
@"debugText" : [NSString stringWithFormat:@"%s", debugText],
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPNetworkCommissioningClusterAddWiFiNetworkResponseCallbackBridge
: public Callback::Callback<NetworkCommissioningClusterAddWiFiNetworkResponseCallback> {
public:
CHIPNetworkCommissioningClusterAddWiFiNetworkResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<NetworkCommissioningClusterAddWiFiNetworkResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPNetworkCommissioningClusterAddWiFiNetworkResponseCallbackBridge() {};
static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText)
{
CHIPNetworkCommissioningClusterAddWiFiNetworkResponseCallbackBridge * callback
= reinterpret_cast<CHIPNetworkCommissioningClusterAddWiFiNetworkResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"errorCode" : [NSNumber numberWithUnsignedChar:errorCode],
@"debugText" : [NSString stringWithFormat:@"%s", debugText],
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPNetworkCommissioningClusterDisableNetworkResponseCallbackBridge
: public Callback::Callback<NetworkCommissioningClusterDisableNetworkResponseCallback> {
public:
CHIPNetworkCommissioningClusterDisableNetworkResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<NetworkCommissioningClusterDisableNetworkResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPNetworkCommissioningClusterDisableNetworkResponseCallbackBridge() {};
static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText)
{
CHIPNetworkCommissioningClusterDisableNetworkResponseCallbackBridge * callback
= reinterpret_cast<CHIPNetworkCommissioningClusterDisableNetworkResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"errorCode" : [NSNumber numberWithUnsignedChar:errorCode],
@"debugText" : [NSString stringWithFormat:@"%s", debugText],
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPNetworkCommissioningClusterEnableNetworkResponseCallbackBridge
: public Callback::Callback<NetworkCommissioningClusterEnableNetworkResponseCallback> {
public:
CHIPNetworkCommissioningClusterEnableNetworkResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<NetworkCommissioningClusterEnableNetworkResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPNetworkCommissioningClusterEnableNetworkResponseCallbackBridge() {};
static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText)
{
CHIPNetworkCommissioningClusterEnableNetworkResponseCallbackBridge * callback
= reinterpret_cast<CHIPNetworkCommissioningClusterEnableNetworkResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"errorCode" : [NSNumber numberWithUnsignedChar:errorCode],
@"debugText" : [NSString stringWithFormat:@"%s", debugText],
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPNetworkCommissioningClusterRemoveNetworkResponseCallbackBridge
: public Callback::Callback<NetworkCommissioningClusterRemoveNetworkResponseCallback> {
public:
CHIPNetworkCommissioningClusterRemoveNetworkResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<NetworkCommissioningClusterRemoveNetworkResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPNetworkCommissioningClusterRemoveNetworkResponseCallbackBridge() {};
static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText)
{
CHIPNetworkCommissioningClusterRemoveNetworkResponseCallbackBridge * callback
= reinterpret_cast<CHIPNetworkCommissioningClusterRemoveNetworkResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"errorCode" : [NSNumber numberWithUnsignedChar:errorCode],
@"debugText" : [NSString stringWithFormat:@"%s", debugText],
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPNetworkCommissioningClusterScanNetworksResponseCallbackBridge
: public Callback::Callback<NetworkCommissioningClusterScanNetworksResponseCallback> {
public:
CHIPNetworkCommissioningClusterScanNetworksResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<NetworkCommissioningClusterScanNetworksResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPNetworkCommissioningClusterScanNetworksResponseCallbackBridge() {};
static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText,
/* TYPE WARNING: array array defaults to */ uint8_t * wifiScanResults,
/* TYPE WARNING: array array defaults to */ uint8_t * threadScanResults)
{
CHIPNetworkCommissioningClusterScanNetworksResponseCallbackBridge * callback
= reinterpret_cast<CHIPNetworkCommissioningClusterScanNetworksResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"errorCode" : [NSNumber numberWithUnsignedChar:errorCode],
@"debugText" : [NSString stringWithFormat:@"%s", debugText],
// wifiScanResults: /* TYPE WARNING: array array defaults to */ uint8_t *
// Conversion from this type to Objc is not properly implemented yet
// threadScanResults: /* TYPE WARNING: array array defaults to */ uint8_t *
// Conversion from this type to Objc is not properly implemented yet
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPNetworkCommissioningClusterUpdateThreadNetworkResponseCallbackBridge
: public Callback::Callback<NetworkCommissioningClusterUpdateThreadNetworkResponseCallback> {
public:
CHIPNetworkCommissioningClusterUpdateThreadNetworkResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<NetworkCommissioningClusterUpdateThreadNetworkResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPNetworkCommissioningClusterUpdateThreadNetworkResponseCallbackBridge() {};
static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText)
{
CHIPNetworkCommissioningClusterUpdateThreadNetworkResponseCallbackBridge * callback
= reinterpret_cast<CHIPNetworkCommissioningClusterUpdateThreadNetworkResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"errorCode" : [NSNumber numberWithUnsignedChar:errorCode],
@"debugText" : [NSString stringWithFormat:@"%s", debugText],
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPNetworkCommissioningClusterUpdateWiFiNetworkResponseCallbackBridge
: public Callback::Callback<NetworkCommissioningClusterUpdateWiFiNetworkResponseCallback> {
public:
CHIPNetworkCommissioningClusterUpdateWiFiNetworkResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<NetworkCommissioningClusterUpdateWiFiNetworkResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPNetworkCommissioningClusterUpdateWiFiNetworkResponseCallbackBridge() {};
static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText)
{
CHIPNetworkCommissioningClusterUpdateWiFiNetworkResponseCallbackBridge * callback
= reinterpret_cast<CHIPNetworkCommissioningClusterUpdateWiFiNetworkResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"errorCode" : [NSNumber numberWithUnsignedChar:errorCode],
@"debugText" : [NSString stringWithFormat:@"%s", debugText],
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPScenesClusterAddSceneResponseCallbackBridge : public Callback::Callback<ScenesClusterAddSceneResponseCallback> {
public:
CHIPScenesClusterAddSceneResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<ScenesClusterAddSceneResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPScenesClusterAddSceneResponseCallbackBridge() {};
static void CallbackFn(void * context, uint16_t groupId, uint8_t sceneId)
{
CHIPScenesClusterAddSceneResponseCallbackBridge * callback
= reinterpret_cast<CHIPScenesClusterAddSceneResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"groupId" : [NSNumber numberWithUnsignedShort:groupId],
@"sceneId" : [NSNumber numberWithUnsignedChar:sceneId],
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPScenesClusterGetSceneMembershipResponseCallbackBridge
: public Callback::Callback<ScenesClusterGetSceneMembershipResponseCallback> {
public:
CHIPScenesClusterGetSceneMembershipResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<ScenesClusterGetSceneMembershipResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPScenesClusterGetSceneMembershipResponseCallbackBridge() {};
static void CallbackFn(void * context, uint8_t capacity, uint16_t groupId, uint8_t sceneCount,
/* TYPE WARNING: array array defaults to */ uint8_t * sceneList)
{
CHIPScenesClusterGetSceneMembershipResponseCallbackBridge * callback
= reinterpret_cast<CHIPScenesClusterGetSceneMembershipResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"capacity" : [NSNumber numberWithUnsignedChar:capacity],
@"groupId" : [NSNumber numberWithUnsignedShort:groupId],
@"sceneCount" : [NSNumber numberWithUnsignedChar:sceneCount],
// sceneList: /* TYPE WARNING: array array defaults to */ uint8_t *
// Conversion from this type to Objc is not properly implemented yet
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPScenesClusterRemoveAllScenesResponseCallbackBridge
: public Callback::Callback<ScenesClusterRemoveAllScenesResponseCallback> {
public:
CHIPScenesClusterRemoveAllScenesResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<ScenesClusterRemoveAllScenesResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPScenesClusterRemoveAllScenesResponseCallbackBridge() {};
static void CallbackFn(void * context, uint16_t groupId)
{
CHIPScenesClusterRemoveAllScenesResponseCallbackBridge * callback
= reinterpret_cast<CHIPScenesClusterRemoveAllScenesResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"groupId" : [NSNumber numberWithUnsignedShort:groupId],
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPScenesClusterRemoveSceneResponseCallbackBridge : public Callback::Callback<ScenesClusterRemoveSceneResponseCallback> {
public:
CHIPScenesClusterRemoveSceneResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<ScenesClusterRemoveSceneResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPScenesClusterRemoveSceneResponseCallbackBridge() {};
static void CallbackFn(void * context, uint16_t groupId, uint8_t sceneId)
{
CHIPScenesClusterRemoveSceneResponseCallbackBridge * callback
= reinterpret_cast<CHIPScenesClusterRemoveSceneResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"groupId" : [NSNumber numberWithUnsignedShort:groupId],
@"sceneId" : [NSNumber numberWithUnsignedChar:sceneId],
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPScenesClusterStoreSceneResponseCallbackBridge : public Callback::Callback<ScenesClusterStoreSceneResponseCallback> {
public:
CHIPScenesClusterStoreSceneResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<ScenesClusterStoreSceneResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPScenesClusterStoreSceneResponseCallbackBridge() {};
static void CallbackFn(void * context, uint16_t groupId, uint8_t sceneId)
{
CHIPScenesClusterStoreSceneResponseCallbackBridge * callback
= reinterpret_cast<CHIPScenesClusterStoreSceneResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"groupId" : [NSNumber numberWithUnsignedShort:groupId],
@"sceneId" : [NSNumber numberWithUnsignedChar:sceneId],
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
class CHIPScenesClusterViewSceneResponseCallbackBridge : public Callback::Callback<ScenesClusterViewSceneResponseCallback> {
public:
CHIPScenesClusterViewSceneResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
: Callback::Callback<ScenesClusterViewSceneResponseCallback>(CallbackFn, this)
, mHandler(handler)
, mQueue(queue)
{
}
~CHIPScenesClusterViewSceneResponseCallbackBridge() {};
static void CallbackFn(void * context, uint16_t groupId, uint8_t sceneId, uint16_t transitionTime, uint8_t * sceneName,
/* TYPE WARNING: array array defaults to */ uint8_t * extensionFieldSets)
{
CHIPScenesClusterViewSceneResponseCallbackBridge * callback
= reinterpret_cast<CHIPScenesClusterViewSceneResponseCallbackBridge *>(context);
if (callback && callback->mQueue) {
dispatch_async(callback->mQueue, ^{
callback->mHandler(nil, @ {
@"groupId" : [NSNumber numberWithUnsignedShort:groupId],
@"sceneId" : [NSNumber numberWithUnsignedChar:sceneId],
@"transitionTime" : [NSNumber numberWithUnsignedShort:transitionTime],
@"sceneName" : [NSString stringWithFormat:@"%s", sceneName],
// extensionFieldSets: /* TYPE WARNING: array array defaults to */ uint8_t *
// Conversion from this type to Objc is not properly implemented yet
});
callback->Cancel();
delete callback;
});
}
};
private:
ResponseHandler mHandler;
dispatch_queue_t mQueue;
};
@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
{
CHIPStringAttributeCallbackBridge * onSuccess
= new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
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
{
CHIPStringAttributeCallbackBridge * onSuccess
= new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
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
{
CHIPStringAttributeCallbackBridge * onSuccess
= new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
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)readAttributeInteractionModelVersion:(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.ReadAttributeInteractionModelVersion(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeVendorName:(ResponseHandler)completionHandler
{
CHIPStringAttributeCallbackBridge * onSuccess
= new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
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)readAttributeProductName:(ResponseHandler)completionHandler
{
CHIPStringAttributeCallbackBridge * onSuccess
= new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
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.ReadAttributeProductName(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)readAttributeUserLabel:(ResponseHandler)completionHandler
{
CHIPStringAttributeCallbackBridge * onSuccess
= new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
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.ReadAttributeUserLabel(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)writeAttributeUserLabel:(NSString *)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;
}
NSData * data = [value dataUsingEncoding:NSUTF8StringEncoding];
CHIP_ERROR err = self.cppCluster.WriteAttributeUserLabel(
onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t *) data.bytes, data.length));
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeLocation:(ResponseHandler)completionHandler
{
CHIPStringAttributeCallbackBridge * onSuccess
= new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
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.ReadAttributeLocation(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)writeAttributeLocation:(NSString *)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;
}
NSData * data = [value dataUsingEncoding:NSUTF8StringEncoding];
CHIP_ERROR err = self.cppCluster.WriteAttributeLocation(
onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t *) data.bytes, data.length));
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeHardwareVersion:(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.ReadAttributeHardwareVersion(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeHardwareVersionString:(ResponseHandler)completionHandler
{
CHIPStringAttributeCallbackBridge * onSuccess
= new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
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.ReadAttributeHardwareVersionString(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeSoftwareVersion:(ResponseHandler)completionHandler
{
CHIPInt32uAttributeCallbackBridge * onSuccess = new CHIPInt32uAttributeCallbackBridge(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.ReadAttributeSoftwareVersion(onSuccess->Cancel(), onFailure->Cancel());
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)readAttributeSoftwareVersionString:(ResponseHandler)completionHandler
{
CHIPStringAttributeCallbackBridge * onSuccess
= new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
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.ReadAttributeSoftwareVersionString(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
{
CHIPStringAttributeCallbackBridge * onSuccess
= new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
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 CHIPDescriptor ()
@property (readonly) Controller::DescriptorCluster cppCluster;
@end
@implementation CHIPDescriptor
- (Controller::ClusterBase *)getCluster
{
return &_cppCluster;
}
- (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
{
CHIPDoorLockClusterClearAllPinsResponseCallbackBridge * onSuccess
= new CHIPDoorLockClusterClearAllPinsResponseCallbackBridge(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
{
CHIPDoorLockClusterClearAllRfidsResponseCallbackBridge * onSuccess
= new CHIPDoorLockClusterClearAllRfidsResponseCallbackBridge(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
{
CHIPDoorLockClusterClearHolidayScheduleResponseCallbackBridge * onSuccess
= new CHIPDoorLockClusterClearHolidayScheduleResponseCallbackBridge(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
{
CHIPDoorLockClusterClearPinResponseCallbackBridge * onSuccess
= new CHIPDoorLockClusterClearPinResponseCallbackBridge(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
{
CHIPDoorLockClusterClearRfidResponseCallbackBridge * onSuccess
= new CHIPDoorLockClusterClearRfidResponseCallbackBridge(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
{
CHIPDoorLockClusterClearWeekdayScheduleResponseCallbackBridge * onSuccess
= new CHIPDoorLockClusterClearWeekdayScheduleResponseCallbackBridge(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
{
CHIPDoorLockClusterClearYeardayScheduleResponseCallbackBridge * onSuccess
= new CHIPDoorLockClusterClearYeardayScheduleResponseCallbackBridge(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
{
CHIPDoorLockClusterGetHolidayScheduleResponseCallbackBridge * onSuccess
= new CHIPDoorLockClusterGetHolidayScheduleResponseCallbackBridge(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
{
CHIPDoorLockClusterGetLogRecordResponseCallbackBridge * onSuccess
= new CHIPDoorLockClusterGetLogRecordResponseCallbackBridge(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
{
CHIPDoorLockClusterGetPinResponseCallbackBridge * onSuccess
= new CHIPDoorLockClusterGetPinResponseCallbackBridge(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
{
CHIPDoorLockClusterGetRfidResponseCallbackBridge * onSuccess
= new CHIPDoorLockClusterGetRfidResponseCallbackBridge(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
{
CHIPDoorLockClusterGetUserTypeResponseCallbackBridge * onSuccess
= new CHIPDoorLockClusterGetUserTypeResponseCallbackBridge(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
{
CHIPDoorLockClusterGetWeekdayScheduleResponseCallbackBridge * onSuccess
= new CHIPDoorLockClusterGetWeekdayScheduleResponseCallbackBridge(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
{
CHIPDoorLockClusterGetYeardayScheduleResponseCallbackBridge * onSuccess
= new CHIPDoorLockClusterGetYeardayScheduleResponseCallbackBridge(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:(NSString *)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(),
chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
[pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
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
{
CHIPDoorLockClusterSetHolidayScheduleResponseCallbackBridge * onSuccess
= new CHIPDoorLockClusterSetHolidayScheduleResponseCallbackBridge(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:(NSString *)pin
completionHandler:(ResponseHandler)completionHandler
{
CHIPDoorLockClusterSetPinResponseCallbackBridge * onSuccess
= new CHIPDoorLockClusterSetPinResponseCallbackBridge(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,
chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
[pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
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:(NSString *)id
completionHandler:(ResponseHandler)completionHandler
{
CHIPDoorLockClusterSetRfidResponseCallbackBridge * onSuccess
= new CHIPDoorLockClusterSetRfidResponseCallbackBridge(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,
chip::ByteSpan((const uint8_t *) [id dataUsingEncoding:NSUTF8StringEncoding].bytes,
[id lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
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
{
CHIPDoorLockClusterSetUserTypeResponseCallbackBridge * onSuccess
= new CHIPDoorLockClusterSetUserTypeResponseCallbackBridge(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
{
CHIPDoorLockClusterSetWeekdayScheduleResponseCallbackBridge * onSuccess
= new CHIPDoorLockClusterSetWeekdayScheduleResponseCallbackBridge(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
{
CHIPDoorLockClusterSetYeardayScheduleResponseCallbackBridge * onSuccess
= new CHIPDoorLockClusterSetYeardayScheduleResponseCallbackBridge(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:(NSString *)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(),
chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
[pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)unlockWithTimeout:(uint16_t)timeoutInSeconds pin:(NSString *)pin completionHandler:(ResponseHandler)completionHandler
{
CHIPDoorLockClusterUnlockWithTimeoutResponseCallbackBridge * onSuccess
= new CHIPDoorLockClusterUnlockWithTimeoutResponseCallbackBridge(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,
chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
[pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
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
{
CHIPStringAttributeCallbackBridge * onSuccess
= new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], true);
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 CHIPGroupKeyManagement ()
@property (readonly) Controller::GroupKeyManagementCluster cppCluster;
@end
@implementation CHIPGroupKeyManagement
- (Controller::ClusterBase *)getCluster
{
return &_cppCluster;
}
- (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:(NSString *)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,
chip::ByteSpan((const uint8_t *) [groupName dataUsingEncoding:NSUTF8StringEncoding].bytes,
[groupName lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)addGroupIfIdentifying:(uint16_t)groupId groupName:(NSString *)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,
chip::ByteSpan((const uint8_t *) [groupName dataUsingEncoding:NSUTF8StringEncoding].bytes,
[groupName lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
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 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 CHIPNetworkCommissioning ()
@property (readonly) Controller::NetworkCommissioningCluster cppCluster;
@end
@implementation CHIPNetworkCommissioning
- (Controller::ClusterBase *)getCluster
{
return &_cppCluster;
}
- (void)addThreadNetwork:(NSData *)operationalDataset
breadcrumb:(uint64_t)breadcrumb
timeoutMs:(uint32_t)timeoutMs
completionHandler:(ResponseHandler)completionHandler
{
CHIPNetworkCommissioningClusterAddThreadNetworkResponseCallbackBridge * onSuccess
= new CHIPNetworkCommissioningClusterAddThreadNetworkResponseCallbackBridge(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.AddThreadNetwork(onSuccess->Cancel(), onFailure->Cancel(),
chip::ByteSpan((const uint8_t *) operationalDataset.bytes, operationalDataset.length), breadcrumb, timeoutMs);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)addWiFiNetwork:(NSData *)ssid
credentials:(NSData *)credentials
breadcrumb:(uint64_t)breadcrumb
timeoutMs:(uint32_t)timeoutMs
completionHandler:(ResponseHandler)completionHandler
{
CHIPNetworkCommissioningClusterAddWiFiNetworkResponseCallbackBridge * onSuccess
= new CHIPNetworkCommissioningClusterAddWiFiNetworkResponseCallbackBridge(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.AddWiFiNetwork(onSuccess->Cancel(), onFailure->Cancel(),
chip::ByteSpan((const uint8_t *) ssid.bytes, ssid.length),
chip::ByteSpan((const uint8_t *) credentials.bytes, credentials.length), breadcrumb, timeoutMs);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)disableNetwork:(NSData *)networkID
breadcrumb:(uint64_t)breadcrumb
timeoutMs:(uint32_t)timeoutMs
completionHandler:(ResponseHandler)completionHandler
{
CHIPNetworkCommissioningClusterDisableNetworkResponseCallbackBridge * onSuccess
= new CHIPNetworkCommissioningClusterDisableNetworkResponseCallbackBridge(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.DisableNetwork(onSuccess->Cancel(), onFailure->Cancel(),
chip::ByteSpan((const uint8_t *) networkID.bytes, networkID.length), breadcrumb, timeoutMs);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)enableNetwork:(NSData *)networkID
breadcrumb:(uint64_t)breadcrumb
timeoutMs:(uint32_t)timeoutMs
completionHandler:(ResponseHandler)completionHandler
{
CHIPNetworkCommissioningClusterEnableNetworkResponseCallbackBridge * onSuccess
= new CHIPNetworkCommissioningClusterEnableNetworkResponseCallbackBridge(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.EnableNetwork(onSuccess->Cancel(), onFailure->Cancel(),
chip::ByteSpan((const uint8_t *) networkID.bytes, networkID.length), breadcrumb, timeoutMs);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)getLastNetworkCommissioningResult:(uint32_t)timeoutMs 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.GetLastNetworkCommissioningResult(onSuccess->Cancel(), onFailure->Cancel(), timeoutMs);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)removeNetwork:(NSData *)networkID
breadcrumb:(uint64_t)breadcrumb
timeoutMs:(uint32_t)timeoutMs
completionHandler:(ResponseHandler)completionHandler
{
CHIPNetworkCommissioningClusterRemoveNetworkResponseCallbackBridge * onSuccess
= new CHIPNetworkCommissioningClusterRemoveNetworkResponseCallbackBridge(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.RemoveNetwork(onSuccess->Cancel(), onFailure->Cancel(),
chip::ByteSpan((const uint8_t *) networkID.bytes, networkID.length), breadcrumb, timeoutMs);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)scanNetworks:(NSData *)ssid
breadcrumb:(uint64_t)breadcrumb
timeoutMs:(uint32_t)timeoutMs
completionHandler:(ResponseHandler)completionHandler
{
CHIPNetworkCommissioningClusterScanNetworksResponseCallbackBridge * onSuccess
= new CHIPNetworkCommissioningClusterScanNetworksResponseCallbackBridge(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.ScanNetworks(
onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t *) ssid.bytes, ssid.length), breadcrumb, timeoutMs);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)updateThreadNetwork:(NSData *)operationalDataset
breadcrumb:(uint64_t)breadcrumb
timeoutMs:(uint32_t)timeoutMs
completionHandler:(ResponseHandler)completionHandler
{
CHIPNetworkCommissioningClusterUpdateThreadNetworkResponseCallbackBridge * onSuccess
= new CHIPNetworkCommissioningClusterUpdateThreadNetworkResponseCallbackBridge(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.UpdateThreadNetwork(onSuccess->Cancel(), onFailure->Cancel(),
chip::ByteSpan((const uint8_t *) operationalDataset.bytes, operationalDataset.length), breadcrumb, timeoutMs);
if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)updateWiFiNetwork:(NSData *)ssid
credentials:(NSData *)credentials
breadcrumb:(uint64_t)breadcrumb
timeoutMs:(uint32_t)timeoutMs
completionHandler:(ResponseHandler)completionHandler
{
CHIPNetworkCommissioningClusterUpdateWiFiNetworkResponseCallbackBridge * onSuccess
= new CHIPNetworkCommissioningClusterUpdateWiFiNetworkResponseCallbackBridge(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.UpdateWiFiNetwork(onSuccess->Cancel(), onFailure->Cancel(),
chip::ByteSpan((const uint8_t *) ssid.bytes, ssid.length),
chip::ByteSpan((const uint8_t *) credentials.bytes, credentials.length), breadcrumb, timeoutMs);
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:(NSString *)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,
chip::ByteSpan((const uint8_t *) [sceneName dataUsingEncoding:NSUTF8StringEncoding].bytes,
[sceneName lengthOfBytesUsingEncoding:NSUTF8StringEncoding]),
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